@soomo/text-annotator 3.2.0-staging.9 → 3.4.0-staging.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,18 @@ import { HighlightStyleExpression } from './highlight';
5
5
  export interface TextAnnotatorOptions<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> {
6
6
  adapter?: FormatAdapter<I, E> | null;
7
7
  annotatingEnabled?: boolean;
8
+ /**
9
+ * Determines whether an active selection should be dismissed
10
+ * when a user ends their interaction (click, selection)
11
+ * on a non-annotatable element.
12
+ * - NEVER - don't dismiss the selection, ignore the action.
13
+ * - ALWAYS - dismiss the selection.
14
+ * - function - a custom matcher that takes an event and container as arguments.
15
+ * Returns `true` if the selection should be dismissed.
16
+ *
17
+ * @defaut NEVER
18
+ */
19
+ dismissOnNotAnnotatable?: DismissOnNotAnnotatableExpression;
8
20
  renderer?: RendererType;
9
21
  offsetReferenceSelector?: string;
10
22
  userSelectAction?: UserSelectActionExpression<E>;
@@ -14,4 +26,5 @@ export interface TextAnnotatorOptions<I extends TextAnnotation = TextAnnotation,
14
26
  user?: User;
15
27
  }
16
28
  export type RendererType = 'SPANS' | 'CANVAS' | 'CSS_HIGHLIGHTS';
29
+ export type DismissOnNotAnnotatableExpression = 'NEVER' | 'ALWAYS' | ((event: Event, container: HTMLElement) => boolean);
17
30
  export declare const fillDefaults: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(opts: TextAnnotatorOptions<I, E>, defaults: TextAnnotatorOptions<I, E>) => TextAnnotatorOptions<I, E>;
@@ -1,4 +1,4 @@
1
1
  export declare const NOT_ANNOTATABLE_CLASS = "not-annotatable";
2
2
  export declare const NOT_ANNOTATABLE_SELECTOR = ".not-annotatable";
3
- export declare const isNotAnnotatable: (node: Node) => boolean;
4
- export declare const isRangeAnnotatable: (range: Range) => boolean;
3
+ export declare const isNotAnnotatable: (container: Node, node: Node) => boolean;
4
+ export declare const isRangeAnnotatable: (container: Node, range: Range) => boolean;
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Splits a DOM Range into one or more ranges that span annotatable content only.
3
3
  */
4
- export declare const splitAnnotatableRanges: (range: Range) => Range[];
4
+ export declare const splitAnnotatableRanges: (container: Node, range: Range) => Range[];
5
5
  export declare const getRangeAnnotatableContents: (range: Range) => DocumentFragment;