@embedpdf/plugin-annotation 2.9.0 → 2.9.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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/tools/default-tools.d.ts +5 -1
- package/dist/lib/tools/types.d.ts +2 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +21 -5
- 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 +21 -5
- 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 +21 -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 +32 -16
- package/dist/vue/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -771,7 +771,9 @@ const defaultTools = [
|
|
|
771
771
|
defaultContent: "Insert text"
|
|
772
772
|
},
|
|
773
773
|
behavior: {
|
|
774
|
-
insertUpright: true
|
|
774
|
+
insertUpright: true,
|
|
775
|
+
editAfterCreate: true,
|
|
776
|
+
selectAfterCreate: true
|
|
775
777
|
}
|
|
776
778
|
},
|
|
777
779
|
{
|
|
@@ -876,13 +878,14 @@ const initialState = (cfg) => {
|
|
|
876
878
|
}
|
|
877
879
|
});
|
|
878
880
|
const tools = Array.from(toolMap.values()).map((t) => {
|
|
879
|
-
var _a, _b;
|
|
881
|
+
var _a, _b, _c;
|
|
880
882
|
return {
|
|
881
883
|
...t,
|
|
882
884
|
behavior: {
|
|
883
885
|
...t.behavior,
|
|
884
886
|
deactivateToolAfterCreate: ((_a = t.behavior) == null ? void 0 : _a.deactivateToolAfterCreate) ?? cfg.deactivateToolAfterCreate ?? false,
|
|
885
|
-
selectAfterCreate: ((_b = t.behavior) == null ? void 0 : _b.selectAfterCreate) ?? cfg.selectAfterCreate ?? true
|
|
887
|
+
selectAfterCreate: ((_b = t.behavior) == null ? void 0 : _b.selectAfterCreate) ?? cfg.selectAfterCreate ?? true,
|
|
888
|
+
editAfterCreate: ((_c = t.behavior) == null ? void 0 : _c.editAfterCreate) ?? cfg.editAfterCreate ?? false
|
|
886
889
|
}
|
|
887
890
|
};
|
|
888
891
|
});
|
|
@@ -4147,12 +4150,13 @@ const _AnnotationPlugin = class _AnnotationPlugin extends BasePlugin {
|
|
|
4147
4150
|
// Pass through services
|
|
4148
4151
|
onPreview: (state) => callbacks.onPreview(tool.id, state),
|
|
4149
4152
|
onCommit: (annotation, ctx) => {
|
|
4150
|
-
var _a2, _b;
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
+
var _a2, _b, _c;
|
|
4154
|
+
const editAfterCreate = ((_a2 = tool.behavior) == null ? void 0 : _a2.editAfterCreate) ?? false;
|
|
4155
|
+
this.createAnnotation(pageIndex, annotation, ctx, documentId, { editAfterCreate });
|
|
4156
|
+
if ((_b = tool.behavior) == null ? void 0 : _b.deactivateToolAfterCreate) {
|
|
4153
4157
|
this.setActiveTool(null, documentId);
|
|
4154
4158
|
}
|
|
4155
|
-
if ((
|
|
4159
|
+
if (((_c = tool.behavior) == null ? void 0 : _c.selectAfterCreate) || editAfterCreate) {
|
|
4156
4160
|
this.selectAnnotation(pageIndex, annotation.id, documentId);
|
|
4157
4161
|
}
|
|
4158
4162
|
},
|
|
@@ -4322,7 +4326,7 @@ const _AnnotationPlugin = class _AnnotationPlugin extends BasePlugin {
|
|
|
4322
4326
|
}
|
|
4323
4327
|
if (this.config.autoCommit !== false) this.commit(documentId);
|
|
4324
4328
|
}
|
|
4325
|
-
createAnnotation(pageIndex, annotation, ctx, documentId) {
|
|
4329
|
+
createAnnotation(pageIndex, annotation, ctx, documentId, options) {
|
|
4326
4330
|
const docId = documentId ?? this.getActiveDocumentId();
|
|
4327
4331
|
if (!this.checkPermission(docId, PdfPermissionFlag.ModifyAnnotations)) {
|
|
4328
4332
|
this.logger.debug(
|
|
@@ -4339,6 +4343,7 @@ const _AnnotationPlugin = class _AnnotationPlugin extends BasePlugin {
|
|
|
4339
4343
|
...annotation,
|
|
4340
4344
|
author: annotation.author ?? this.config.annotationAuthor
|
|
4341
4345
|
};
|
|
4346
|
+
const editAfterCreate = options == null ? void 0 : options.editAfterCreate;
|
|
4342
4347
|
const execute = () => {
|
|
4343
4348
|
this.dispatch(createAnnotation(docId, pageIndex, newAnnotation));
|
|
4344
4349
|
if (ctx) contexts.set(id, ctx);
|
|
@@ -4348,7 +4353,8 @@ const _AnnotationPlugin = class _AnnotationPlugin extends BasePlugin {
|
|
|
4348
4353
|
annotation: newAnnotation,
|
|
4349
4354
|
pageIndex,
|
|
4350
4355
|
ctx,
|
|
4351
|
-
committed: false
|
|
4356
|
+
committed: false,
|
|
4357
|
+
editAfterCreate
|
|
4352
4358
|
});
|
|
4353
4359
|
};
|
|
4354
4360
|
if (!this.history) {
|