@soomo/text-annotator 3.2.0-staging.11 → 3.2.0-staging.14

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,19 @@ 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
+ * - ALWAYS - always dismiss the selection.
13
+ * - ANNOTATABLE_AREAS - will dismiss selection only if you click on annotatable areas
14
+ * (inside the `container`, not marked as not-annotatable)
15
+ * - function - a custom matcher that takes an event and container as arguments
16
+ * and returns true if the selection should be dismissed.
17
+ *
18
+ * @defaut ANNOTATABLE_AREAS
19
+ */
20
+ dismissOnNotAnnotatable?: DismissOnNotAnnotatableExpression;
8
21
  renderer?: RendererType;
9
22
  offsetReferenceSelector?: string;
10
23
  userSelectAction?: UserSelectActionExpression<E>;
@@ -14,4 +27,5 @@ export interface TextAnnotatorOptions<I extends TextAnnotation = TextAnnotation,
14
27
  user?: User;
15
28
  }
16
29
  export type RendererType = 'SPANS' | 'CANVAS' | 'CSS_HIGHLIGHTS';
30
+ export type DismissOnNotAnnotatableExpression = 'ALWAYS' | 'ANNOTATABLE_AREAS' | ((event: Event, container: HTMLElement) => boolean);
17
31
  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;