@embedpdf/plugin-annotation 2.1.1 → 2.2.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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +13 -6
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +13 -6
- package/dist/react/index.js.map +1 -1
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +10 -6
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +19 -6
- package/dist/vue/index.js.map +1 -1
- package/package.json +10 -10
package/dist/svelte/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as $ from "svelte/internal/client";
|
|
2
2
|
import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp } from "@embedpdf/plugin-annotation";
|
|
3
3
|
export * from "@embedpdf/plugin-annotation";
|
|
4
|
-
import { useCapability, usePlugin, useDocumentState } from "@embedpdf/core/svelte";
|
|
4
|
+
import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/svelte";
|
|
5
5
|
import "svelte/internal/disclose-version";
|
|
6
6
|
import { useInteractionHandles, deepToRaw, doublePress, CounterRotate } from "@embedpdf/utils/svelte";
|
|
7
7
|
import { PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCss, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
|
|
@@ -73,7 +73,11 @@ function AnnotationContainer($$anchor, $$props) {
|
|
|
73
73
|
]);
|
|
74
74
|
let preview = $.state($.proxy($$props.trackedAnnotation.object));
|
|
75
75
|
let annotationCapability = useAnnotationCapability();
|
|
76
|
+
const permissions = useDocumentPermissions(() => $$props.documentId);
|
|
76
77
|
let gestureBaseRef = $.state(null);
|
|
78
|
+
const effectiveIsDraggable = $.derived(() => permissions.canModifyAnnotations && $$props.isDraggable);
|
|
79
|
+
const effectiveIsResizable = $.derived(() => permissions.canModifyAnnotations && $$props.isResizable);
|
|
80
|
+
const guardedOnDoubleClick = $.derived(() => permissions.canModifyAnnotations && $$props.onDoubleClick ? $$props.onDoubleClick : void 0);
|
|
77
81
|
const annotationProvides = $.derived(() => annotationCapability.provides ? annotationCapability.provides.forDocument($$props.documentId) : null);
|
|
78
82
|
let currentObject = $.derived(() => $.get(preview) ? { ...$$props.trackedAnnotation.object, ...$.get(preview) } : $$props.trackedAnnotation.object);
|
|
79
83
|
const HANDLE_COLOR = $.derived(() => {
|
|
@@ -170,7 +174,7 @@ function AnnotationContainer($$anchor, $$props) {
|
|
|
170
174
|
var div = root$a();
|
|
171
175
|
var div_1 = $.child(div);
|
|
172
176
|
$.attribute_effect(div_1, () => ({
|
|
173
|
-
|
|
177
|
+
...$.get(effectiveIsDraggable) && $$props.isSelected ? interactionHandles.dragProps : {},
|
|
174
178
|
style: $$props.style || "",
|
|
175
179
|
class: propsClass(),
|
|
176
180
|
...restProps,
|
|
@@ -184,7 +188,7 @@ function AnnotationContainer($$anchor, $$props) {
|
|
|
184
188
|
"outline-offset": $$props.isSelected ? `${outlineOffset()}px` : "0px",
|
|
185
189
|
"pointer-events": $$props.isSelected ? "auto" : "none",
|
|
186
190
|
"touch-action": "none",
|
|
187
|
-
cursor: $$props.isSelected &&
|
|
191
|
+
cursor: $$props.isSelected && $.get(effectiveIsDraggable) ? "move" : "default",
|
|
188
192
|
"z-index": zIndex()
|
|
189
193
|
}
|
|
190
194
|
}));
|
|
@@ -260,7 +264,7 @@ function AnnotationContainer($$anchor, $$props) {
|
|
|
260
264
|
$.append($$anchor2, fragment_2);
|
|
261
265
|
};
|
|
262
266
|
$.if(node_3, ($$render) => {
|
|
263
|
-
if ($$props.isSelected &&
|
|
267
|
+
if ($$props.isSelected && $.get(effectiveIsResizable)) $$render(consequent_2);
|
|
264
268
|
});
|
|
265
269
|
}
|
|
266
270
|
var node_7 = $.sibling(node_3, 2);
|
|
@@ -306,14 +310,14 @@ function AnnotationContainer($$anchor, $$props) {
|
|
|
306
310
|
$.append($$anchor2, fragment_5);
|
|
307
311
|
};
|
|
308
312
|
$.if(node_7, ($$render) => {
|
|
309
|
-
if ($$props.isSelected) $$render(consequent_4);
|
|
313
|
+
if ($$props.isSelected && permissions.canModifyAnnotations) $$render(consequent_4);
|
|
310
314
|
});
|
|
311
315
|
}
|
|
312
316
|
$.reset(div_1);
|
|
313
317
|
$.action(div_1, ($$node, $$action_arg) => {
|
|
314
318
|
var _a;
|
|
315
319
|
return (_a = doublePress) == null ? void 0 : _a($$node, $$action_arg);
|
|
316
|
-
}, () => ({ onDouble:
|
|
320
|
+
}, () => ({ onDouble: $.get(guardedOnDoubleClick) }));
|
|
317
321
|
var node_11 = $.sibling(div_1, 2);
|
|
318
322
|
{
|
|
319
323
|
var consequent_8 = ($$anchor2) => {
|