@embedpdf/plugin-annotation 3.0.0-next.4 → 3.0.0-next.5
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/{capability-CYbikyob.cjs → capability-BMBwSdaY.cjs} +22 -1
- package/dist/capability-BMBwSdaY.cjs.map +1 -0
- package/dist/{capability-DjUdnoYn.js → capability-CYYDz4dW.js} +22 -1
- package/dist/capability-CYYDz4dW.js.map +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/{types-CfewRmXH.d.cts → types-BCB5YKIk.d.ts} +17 -4
- package/dist/{types-DZ29RSW9.d.ts → types-N25K86pT.d.cts} +17 -4
- package/package.json +7 -7
- package/dist/capability-CYbikyob.cjs.map +0 -1
- package/dist/capability-DjUdnoYn.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CONTINUOUS_RENDER_POLICY, createCapabilityToken, snapAppearanceScale } from "@embedpdf/core";
|
|
2
2
|
import { InteractionToken } from "@embedpdf/plugin-interaction";
|
|
3
3
|
import { resolveBinarySource, sniffBinaryMetadata } from "@embedpdf/engine-core/runtime";
|
|
4
|
+
import { SelectionToken } from "@embedpdf/plugin-selection";
|
|
4
5
|
import { FLAG_KEYS, calloutLinePoints, chrome, clickCreateGeom, cloudyBorderExtent, contentToPdfPoint, contentToPdfRect, contentToPdfRect as contentToPdfRect$1, creationDraftAnchor, cursorAt, defaultsFor, expandGroups, fitStampBox, geomPdfBounds, geomRotation, geomVisualBounds, groupKeyOf, hitTest, initialTextStyle, normalizeDeg, pageItems, pdfToContentPoint, pdfToContentPoint as pdfToContentPoint$1, pdfToContentRect, pdfToContentRect as pdfToContentRect$1, propsFor, readProp, resolveClickPlacement, rotatedAabb, selectionAnchor, selectionQuad, sharedProps, styleFromProps, textBoxes, unionRect, update, uprightRotation, viewable } from "@embedpdf/core-annotation";
|
|
5
6
|
import { normalizeQuad, textQuadBounds } from "@embedpdf/core-geometry";
|
|
6
7
|
//#region src/types.ts
|
|
@@ -2487,6 +2488,26 @@ function createAnnotationCapability(ctx, config = {}) {
|
|
|
2487
2488
|
finishCreationDraft: () => apply({ t: "finishCreationDraft" }),
|
|
2488
2489
|
finishInkDraft: () => apply({ t: "finishInkDraft" }),
|
|
2489
2490
|
cancelCreationDraft: () => apply({ t: "cancel" }),
|
|
2491
|
+
markupFromSelection: (subtype, preset) => {
|
|
2492
|
+
const selection = ctx.tryGet(SelectionToken);
|
|
2493
|
+
if (!selection || !selection.hasSelection()) return false;
|
|
2494
|
+
const snapshot = selection.snapshot();
|
|
2495
|
+
let created = false;
|
|
2496
|
+
for (const page of snapshot.pages) {
|
|
2497
|
+
if (!page.segments.length) continue;
|
|
2498
|
+
apply({
|
|
2499
|
+
t: "createMarkup",
|
|
2500
|
+
subtype,
|
|
2501
|
+
pon: page.pon,
|
|
2502
|
+
quads: page.segments.map((s) => s.quad),
|
|
2503
|
+
preset,
|
|
2504
|
+
flags: preset ? registry.get(preset)?.flags : void 0
|
|
2505
|
+
});
|
|
2506
|
+
created = true;
|
|
2507
|
+
}
|
|
2508
|
+
if (created) selection.clear();
|
|
2509
|
+
return created;
|
|
2510
|
+
},
|
|
2490
2511
|
createMarkup: (subtype, pon, quads, preset) => apply({
|
|
2491
2512
|
t: "createMarkup",
|
|
2492
2513
|
subtype,
|
|
@@ -2687,4 +2708,4 @@ function createAnnotationCapability(ctx, config = {}) {
|
|
|
2687
2708
|
//#endregion
|
|
2688
2709
|
export { toCreateDraft as a, styleFromDTO as c, fromDTO as i, widgetAppearanceFromProps as l, DEFAULT_TOOLS as n, toPatch as o, buildToolRegistry as r, refKey as s, createAnnotationCapability as t, AnnotationToken as u };
|
|
2689
2710
|
|
|
2690
|
-
//# sourceMappingURL=capability-
|
|
2711
|
+
//# sourceMappingURL=capability-CYYDz4dW.js.map
|