@semiont/react-ui 0.2.33-build.85 → 0.2.33-build.86
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.
- package/dist/index.mjs +5 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/resource/AnnotateView.tsx +6 -28
package/dist/index.mjs
CHANGED
|
@@ -30417,21 +30417,9 @@ function ProposeEntitiesModal({
|
|
|
30417
30417
|
|
|
30418
30418
|
// src/components/resource/AnnotateView.tsx
|
|
30419
30419
|
import { useRef as useRef12, useEffect as useEffect18, useCallback as useCallback12, lazy, Suspense } from "react";
|
|
30420
|
-
import { getTextPositionSelector, getTextQuoteSelector, getTargetSelector, getMimeCategory, isPdfMimeType as isPdfMimeType2, resourceUri as toResourceUri } from "@semiont/api-client";
|
|
30421
|
-
import { findTextWithContext } from "@semiont/api-client";
|
|
30420
|
+
import { getTextPositionSelector, getTextQuoteSelector, getTargetSelector, getMimeCategory, isPdfMimeType as isPdfMimeType2, resourceUri as toResourceUri, extractContext, findTextWithContext } from "@semiont/api-client";
|
|
30422
30421
|
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
30423
30422
|
var PdfAnnotationCanvas = lazy(() => import("./PdfAnnotationCanvas.client-FGV33CWN.mjs").then((mod) => ({ default: mod.PdfAnnotationCanvas })));
|
|
30424
|
-
function extractContext(content4, start2, end) {
|
|
30425
|
-
const CONTEXT_LENGTH = 32;
|
|
30426
|
-
const result = {};
|
|
30427
|
-
if (start2 > 0) {
|
|
30428
|
-
result.prefix = content4.substring(Math.max(0, start2 - CONTEXT_LENGTH), start2);
|
|
30429
|
-
}
|
|
30430
|
-
if (end < content4.length) {
|
|
30431
|
-
result.suffix = content4.substring(end, Math.min(content4.length, end + CONTEXT_LENGTH));
|
|
30432
|
-
}
|
|
30433
|
-
return result;
|
|
30434
|
-
}
|
|
30435
30423
|
function segmentTextWithAnnotations(content4, annotations) {
|
|
30436
30424
|
if (!content4) {
|
|
30437
30425
|
return [{ exact: "", start: 0, end: 0 }];
|
|
@@ -30441,12 +30429,14 @@ function segmentTextWithAnnotations(content4, annotations) {
|
|
|
30441
30429
|
const posSelector = getTextPositionSelector(targetSelector);
|
|
30442
30430
|
const quoteSelector = targetSelector ? getTextQuoteSelector(targetSelector) : null;
|
|
30443
30431
|
let position4;
|
|
30444
|
-
if (quoteSelector
|
|
30432
|
+
if (quoteSelector) {
|
|
30445
30433
|
position4 = findTextWithContext(
|
|
30446
30434
|
content4,
|
|
30447
30435
|
quoteSelector.exact,
|
|
30448
30436
|
quoteSelector.prefix,
|
|
30449
|
-
quoteSelector.suffix
|
|
30437
|
+
quoteSelector.suffix,
|
|
30438
|
+
posSelector?.start
|
|
30439
|
+
// Position hint for fuzzy matching
|
|
30450
30440
|
);
|
|
30451
30441
|
}
|
|
30452
30442
|
const start2 = position4?.start ?? posSelector?.start ?? 0;
|