Skip to content

Commit f01a09c

Browse files
Added internal generic to the createTextAnnotator
1 parent 3e4f654 commit f01a09c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/text-annotator/src/TextAnnotator.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,31 @@ export interface TextAnnotator<I extends TextAnnotation = TextAnnotation, E exte
2727

2828
}
2929

30-
export const createTextAnnotator = <E extends unknown = TextAnnotation>(
30+
export const createTextAnnotator = <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(
3131
container: HTMLElement,
32-
options: TextAnnotatorOptions<TextAnnotation, E> = {}
33-
): TextAnnotator<TextAnnotation, E> => {
32+
options: TextAnnotatorOptions<I, E> = {}
33+
): TextAnnotator<I, E> => {
3434
// Prevent mobile browsers from triggering word selection on single click.
3535
cancelSingleClickEvents(container);
3636

3737
// Make sure that the container is focusable and can receive both pointer and keyboard events
3838
programmaticallyFocusable(container);
3939

40-
const opts = fillDefaults<TextAnnotation, E>(options, {
40+
const opts = fillDefaults<I, E>(options, {
4141
annotatingEnabled: true,
4242
user: createAnonymousGuest()
4343
});
4444

45-
const state: TextAnnotatorState<TextAnnotation, E> =
46-
createTextAnnotatorState<TextAnnotation, E>(container, opts.userSelectAction);
45+
const state: TextAnnotatorState<I, E> =
46+
createTextAnnotatorState<I, E>(container, opts.userSelectAction);
4747

4848
const { selection, viewport } = state;
4949

5050
const store: TextAnnotationStore = state.store;
5151

5252
const undoStack = createUndoStack(store);
5353

54-
const lifecycle = createLifecycleObserver<TextAnnotation, E>(state, undoStack, opts.adapter);
54+
const lifecycle = createLifecycleObserver<I, E>(state, undoStack, opts.adapter);
5555

5656
let currentUser: User = opts.user;
5757

0 commit comments

Comments
 (0)