@recogito/text-annotator 3.0.0 → 3.0.1
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.
|
@@ -7,6 +7,6 @@ export type W3CTextFormatAdapter<I extends TextAnnotation = TextAnnotation, E ex
|
|
|
7
7
|
* @param container - the HTML container of the annotated content,
|
|
8
8
|
* Required to locate the content's `range` within the DOM
|
|
9
9
|
*/
|
|
10
|
-
export declare const W3CTextFormat: <I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation>(source: string, container
|
|
10
|
+
export declare const W3CTextFormat: <I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation>(source: string, container?: HTMLElement) => W3CTextFormatAdapter<I, E>;
|
|
11
11
|
export declare const parseW3CTextAnnotation: <I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation>(annotation: E) => ParseResult<I>;
|
|
12
|
-
export declare const serializeW3CTextAnnotation: <I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation>(annotation: I, source: string, container
|
|
12
|
+
export declare const serializeW3CTextAnnotation: <I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation>(annotation: I, source: string, container?: HTMLElement) => E;
|
|
@@ -49,7 +49,8 @@ const re = "not-annotatable", et = `.${re}`, it = (t) => {
|
|
|
49
49
|
defaultPrevented: t.defaultPrevented,
|
|
50
50
|
detail: t.detail,
|
|
51
51
|
timeStamp: t.timeStamp
|
|
52
|
-
}), Te =
|
|
52
|
+
}), Te = typeof navigator < "u" && // @ts-ignore
|
|
53
|
+
/mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Oe = (t) => {
|
|
53
54
|
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
54
55
|
}, Dt = (t, e = 10) => {
|
|
55
56
|
let n;
|
|
@@ -1362,23 +1363,26 @@ const xo = (t, e) => ({
|
|
|
1362
1363
|
updated: f,
|
|
1363
1364
|
...h
|
|
1364
1365
|
} = i, u = a.map((p) => {
|
|
1365
|
-
const { id: v, quote: g, start: m, end: A, range: d } = p,
|
|
1366
|
+
const { id: v, quote: g, start: m, end: A, range: d } = p, c = {
|
|
1366
1367
|
type: "TextQuoteSelector",
|
|
1367
|
-
exact: g
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1368
|
+
exact: g
|
|
1369
|
+
};
|
|
1370
|
+
if (n) {
|
|
1371
|
+
const { prefix: S, suffix: E } = Be(d, n);
|
|
1372
|
+
c.prefix = S, c.suffix = E;
|
|
1373
|
+
}
|
|
1374
|
+
const b = {
|
|
1371
1375
|
type: "TextPositionSelector",
|
|
1372
1376
|
start: m,
|
|
1373
1377
|
end: A
|
|
1374
|
-
}
|
|
1378
|
+
};
|
|
1375
1379
|
return {
|
|
1376
1380
|
...h,
|
|
1377
1381
|
id: v,
|
|
1378
1382
|
// @ts-expect-error: `scope` is not part of the core `TextSelector` type
|
|
1379
1383
|
scope: "scope" in p ? p.scope : void 0,
|
|
1380
1384
|
source: e,
|
|
1381
|
-
selector:
|
|
1385
|
+
selector: [c, b]
|
|
1382
1386
|
};
|
|
1383
1387
|
});
|
|
1384
1388
|
return {
|