@harbour-enterprises/superdoc 1.0.0-next.10 → 1.0.0-next.3
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/chunks/{PdfViewer-CZG4udaT.es.js → PdfViewer-PUn0q_lG.es.js} +1 -1
- package/dist/chunks/{PdfViewer-B9LcTIm2.cjs → PdfViewer-cVGt7Ne7.cjs} +1 -1
- package/dist/chunks/{index-DdTDm9oI-Duiy8M_G.cjs → index-DLO-SgUP-BNtYQDPq.cjs} +1 -1
- package/dist/chunks/{index-DdTDm9oI-BXzE00pk.es.js → index-DLO-SgUP-c73otQJ5.es.js} +1 -1
- package/dist/chunks/{index-4FiyZ-0E.cjs → index-Djmhr-R6.cjs} +97 -99
- package/dist/chunks/{index-1n6qegaQ.es.js → index-mHanL4xN.es.js} +97 -99
- package/dist/chunks/{super-editor.es-BQQuazyp.cjs → super-editor.es-Cve8WKfM.cjs} +25570 -28023
- package/dist/chunks/{super-editor.es-DKr759cY.es.js → super-editor.es-S9Kp_7dy.es.js} +25570 -28023
- package/dist/images/altText_add.svg +3 -0
- package/dist/images/altText_disclaimer.svg +3 -0
- package/dist/images/altText_done.svg +3 -0
- package/dist/images/altText_spinner.svg +30 -0
- package/dist/images/altText_warning.svg +3 -0
- package/dist/images/annotation-check.svg +11 -0
- package/dist/images/annotation-comment.svg +16 -0
- package/dist/images/annotation-help.svg +26 -0
- package/dist/images/annotation-insert.svg +10 -0
- package/dist/images/annotation-key.svg +11 -0
- package/dist/images/annotation-newparagraph.svg +11 -0
- package/dist/images/annotation-noicon.svg +7 -0
- package/dist/images/annotation-note.svg +42 -0
- package/dist/images/annotation-paperclip.svg +6 -0
- package/dist/images/annotation-paragraph.svg +16 -0
- package/dist/images/annotation-pushpin.svg +7 -0
- package/dist/images/cursor-editorFreeHighlight.svg +6 -0
- package/dist/images/cursor-editorFreeText.svg +3 -0
- package/dist/images/cursor-editorInk.svg +4 -0
- package/dist/images/cursor-editorTextHighlight.svg +8 -0
- package/dist/images/editor-toolbar-delete.svg +5 -0
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/messageBar_closingButton.svg +3 -0
- package/dist/images/messageBar_warning.svg +3 -0
- package/dist/images/toolbarButton-editorHighlight.svg +6 -0
- package/dist/images/toolbarButton-menuArrow.svg +3 -0
- package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts +3 -3
- package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/collaboration/helpers.d.ts.map +1 -1
- package/dist/style.css +6 -6
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BavE2jnW.js → converter-ByybZRFp.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-CY4M19qa.js → docx-zipper-CFQANTLI.js} +1 -1
- package/dist/super-editor/chunks/{editor-Cslr04KI.js → editor-Cu4hD14N.js} +25808 -27898
- package/dist/super-editor/chunks/{index-DdTDm9oI.js → index-DLO-SgUP.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Zdgn--Js.js → toolbar-5MMla0sj.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +19 -40
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +25652 -28107
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { y as defineComponent, A as h, P as Transition, a0 as process$1, K as watchEffect, a as computed, r as ref, j as onMounted, X as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, s as createVNode, x as unref } from "./vue-BuPTonTJ.es.js";
|
|
2
|
-
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-
|
|
2
|
+
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-mHanL4xN.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-jWLMl8Ts.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-Djmhr-R6.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
+
const superEditor_es = require("./super-editor.es-Cve8WKfM.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-Cve8WKfM.cjs");
|
|
3
3
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
4
4
|
const eventemitter3 = require("./eventemitter3-DQmQUge-.cjs");
|
|
5
5
|
const provider = require("@hocuspocus/provider");
|
|
@@ -3327,17 +3327,17 @@ function setupAwarenessHandler(provider2, superdocInstance, user) {
|
|
|
3327
3327
|
});
|
|
3328
3328
|
});
|
|
3329
3329
|
}
|
|
3330
|
-
const addYComment = (yArray, ydoc, event
|
|
3330
|
+
const addYComment = (yArray, ydoc, event) => {
|
|
3331
3331
|
const { comment } = event;
|
|
3332
3332
|
const yComment = new Y.Map(Object.entries(comment));
|
|
3333
3333
|
ydoc.transact(
|
|
3334
3334
|
() => {
|
|
3335
3335
|
yArray.push([yComment]);
|
|
3336
3336
|
},
|
|
3337
|
-
{ user }
|
|
3337
|
+
{ user: superdoc.user }
|
|
3338
3338
|
);
|
|
3339
3339
|
};
|
|
3340
|
-
const updateYComment = (yArray, ydoc, event
|
|
3340
|
+
const updateYComment = (yArray, ydoc, event) => {
|
|
3341
3341
|
const { comment } = event;
|
|
3342
3342
|
const yComment = new Y.Map(Object.entries(comment));
|
|
3343
3343
|
const commentIndex = getCommentIndex(yArray, comment);
|
|
@@ -3347,10 +3347,10 @@ const updateYComment = (yArray, ydoc, event, user) => {
|
|
|
3347
3347
|
yArray.delete(commentIndex, 1);
|
|
3348
3348
|
yArray.insert(commentIndex, [yComment]);
|
|
3349
3349
|
},
|
|
3350
|
-
{ user }
|
|
3350
|
+
{ user: superdoc.user }
|
|
3351
3351
|
);
|
|
3352
3352
|
};
|
|
3353
|
-
const deleteYComment = (yArray, ydoc, event
|
|
3353
|
+
const deleteYComment = (yArray, ydoc, event) => {
|
|
3354
3354
|
const { comment } = event;
|
|
3355
3355
|
const commentIndex = getCommentIndex(yArray, comment);
|
|
3356
3356
|
if (commentIndex === -1) return;
|
|
@@ -3358,26 +3358,26 @@ const deleteYComment = (yArray, ydoc, event, user) => {
|
|
|
3358
3358
|
() => {
|
|
3359
3359
|
yArray.delete(commentIndex, 1);
|
|
3360
3360
|
},
|
|
3361
|
-
{ user }
|
|
3361
|
+
{ user: superdoc.user }
|
|
3362
3362
|
);
|
|
3363
3363
|
};
|
|
3364
3364
|
const getCommentIndex = (yArray, comment) => {
|
|
3365
3365
|
const baseArray = yArray.toJSON();
|
|
3366
3366
|
return baseArray.findIndex((c2) => c2.commentId === comment.commentId);
|
|
3367
3367
|
};
|
|
3368
|
-
const initCollaborationComments = (
|
|
3369
|
-
if (!
|
|
3368
|
+
const initCollaborationComments = (superdoc2) => {
|
|
3369
|
+
if (!superdoc2.config.modules.comments || !superdoc2.provider) return;
|
|
3370
3370
|
const onSuperDocYdocSynced = () => {
|
|
3371
|
-
const parent =
|
|
3372
|
-
const ids =
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3371
|
+
const parent = superdoc2.commentsStore.commentsParentElement;
|
|
3372
|
+
const ids = superdoc2.commentsStore.editorCommentIds;
|
|
3373
|
+
superdoc2.commentsStore.handleEditorLocationsUpdate(parent, ids);
|
|
3374
|
+
superdoc2.commentsStore.hasSyncedCollaborationComments = true;
|
|
3375
|
+
superdoc2.provider.off("synced", onSuperDocYdocSynced);
|
|
3376
3376
|
};
|
|
3377
|
-
|
|
3378
|
-
const commentsArray =
|
|
3377
|
+
superdoc2.provider.on("synced", onSuperDocYdocSynced);
|
|
3378
|
+
const commentsArray = superdoc2.ydoc.getArray("comments");
|
|
3379
3379
|
commentsArray.observe((event) => {
|
|
3380
|
-
const currentUser =
|
|
3380
|
+
const currentUser = superdoc2.config.user;
|
|
3381
3381
|
const { user = {} } = event.transaction.origin;
|
|
3382
3382
|
if (currentUser.name === user.name && currentUser.email === user.email) return;
|
|
3383
3383
|
const comments = commentsArray.toJSON();
|
|
@@ -3389,60 +3389,59 @@ const initCollaborationComments = (superdoc) => {
|
|
|
3389
3389
|
filtered.push(c2);
|
|
3390
3390
|
}
|
|
3391
3391
|
});
|
|
3392
|
-
|
|
3392
|
+
superdoc2.commentsStore.commentsList = filtered.map((c2) => useComment(c2));
|
|
3393
3393
|
});
|
|
3394
3394
|
};
|
|
3395
|
-
const initSuperdocYdoc = (
|
|
3396
|
-
const { isInternal } =
|
|
3397
|
-
const baseName = `${
|
|
3398
|
-
if (!
|
|
3395
|
+
const initSuperdocYdoc = (superdoc2) => {
|
|
3396
|
+
const { isInternal } = superdoc2.config;
|
|
3397
|
+
const baseName = `${superdoc2.config.superdocId}-superdoc`;
|
|
3398
|
+
if (!superdoc2.config.superdocId) return;
|
|
3399
3399
|
const documentId = isInternal ? baseName : `${baseName}-external`;
|
|
3400
3400
|
const superdocCollaborationOptions = {
|
|
3401
|
-
config:
|
|
3402
|
-
user:
|
|
3401
|
+
config: superdoc2.config.modules.collaboration,
|
|
3402
|
+
user: superdoc2.config.user,
|
|
3403
3403
|
documentId,
|
|
3404
|
-
socket:
|
|
3405
|
-
superdocInstance:
|
|
3404
|
+
socket: superdoc2.config.socket,
|
|
3405
|
+
superdocInstance: superdoc2
|
|
3406
3406
|
};
|
|
3407
3407
|
const { provider: superdocProvider, ydoc: superdocYdoc } = createProvider(superdocCollaborationOptions);
|
|
3408
3408
|
return { ydoc: superdocYdoc, provider: superdocProvider };
|
|
3409
3409
|
};
|
|
3410
|
-
const makeDocumentsCollaborative = (
|
|
3410
|
+
const makeDocumentsCollaborative = (superdoc2) => {
|
|
3411
3411
|
const processedDocuments = [];
|
|
3412
|
-
|
|
3413
|
-
|
|
3412
|
+
superdoc2.config.documents.forEach((doc) => {
|
|
3413
|
+
superdoc2.config.user.color = superdoc2.colors[0];
|
|
3414
3414
|
const options = {
|
|
3415
|
-
config:
|
|
3416
|
-
user:
|
|
3415
|
+
config: superdoc2.config.modules.collaboration,
|
|
3416
|
+
user: superdoc2.config.user,
|
|
3417
3417
|
documentId: doc.id,
|
|
3418
|
-
socket:
|
|
3419
|
-
superdocInstance:
|
|
3418
|
+
socket: superdoc2.config.socket,
|
|
3419
|
+
superdocInstance: superdoc2
|
|
3420
3420
|
};
|
|
3421
3421
|
const { provider: provider2, ydoc } = createProvider(options);
|
|
3422
3422
|
doc.provider = provider2;
|
|
3423
|
-
doc.socket =
|
|
3423
|
+
doc.socket = superdoc2.config.socket;
|
|
3424
3424
|
doc.ydoc = ydoc;
|
|
3425
|
-
doc.role =
|
|
3425
|
+
doc.role = superdoc2.config.role;
|
|
3426
3426
|
processedDocuments.push(doc);
|
|
3427
3427
|
});
|
|
3428
3428
|
return processedDocuments;
|
|
3429
3429
|
};
|
|
3430
|
-
const syncCommentsToClients = (
|
|
3431
|
-
if (!
|
|
3432
|
-
const yArray =
|
|
3433
|
-
const user = superdoc.config.user;
|
|
3430
|
+
const syncCommentsToClients = (superdoc2, event) => {
|
|
3431
|
+
if (!superdoc2.isCollaborative || !superdoc2.config.modules.comments) return;
|
|
3432
|
+
const yArray = superdoc2.ydoc.getArray("comments");
|
|
3434
3433
|
switch (event.type) {
|
|
3435
3434
|
case "add":
|
|
3436
|
-
addYComment(yArray,
|
|
3435
|
+
addYComment(yArray, superdoc2.ydoc, event);
|
|
3437
3436
|
break;
|
|
3438
3437
|
case "update":
|
|
3439
|
-
updateYComment(yArray,
|
|
3438
|
+
updateYComment(yArray, superdoc2.ydoc, event);
|
|
3440
3439
|
break;
|
|
3441
3440
|
case "resolved":
|
|
3442
|
-
updateYComment(yArray,
|
|
3441
|
+
updateYComment(yArray, superdoc2.ydoc, event);
|
|
3443
3442
|
break;
|
|
3444
3443
|
case "deleted":
|
|
3445
|
-
deleteYComment(yArray,
|
|
3444
|
+
deleteYComment(yArray, superdoc2.ydoc, event);
|
|
3446
3445
|
break;
|
|
3447
3446
|
}
|
|
3448
3447
|
};
|
|
@@ -3517,22 +3516,22 @@ function useComment(params2) {
|
|
|
3517
3516
|
const resolvedTime = vue.ref(params2.resolvedTime || null);
|
|
3518
3517
|
const resolvedByEmail = vue.ref(params2.resolvedByEmail || null);
|
|
3519
3518
|
const resolvedByName = vue.ref(params2.resolvedByName || null);
|
|
3520
|
-
const resolveComment = ({ email, name, superdoc }) => {
|
|
3519
|
+
const resolveComment = ({ email, name, superdoc: superdoc2 }) => {
|
|
3521
3520
|
if (resolvedTime.value) return;
|
|
3522
3521
|
resolvedTime.value = Date.now();
|
|
3523
3522
|
resolvedByEmail.value = email;
|
|
3524
3523
|
resolvedByName.value = name;
|
|
3525
3524
|
if (trackedChange.value) {
|
|
3526
3525
|
const emitData2 = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
3527
|
-
propagateUpdate(
|
|
3528
|
-
|
|
3526
|
+
propagateUpdate(superdoc2, emitData2);
|
|
3527
|
+
superdoc2.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
3529
3528
|
return;
|
|
3530
3529
|
}
|
|
3531
3530
|
const emitData = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
3532
|
-
propagateUpdate(
|
|
3533
|
-
|
|
3531
|
+
propagateUpdate(superdoc2, emitData);
|
|
3532
|
+
superdoc2.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
3534
3533
|
};
|
|
3535
|
-
const setIsInternal = ({ isInternal: newIsInternal, superdoc }) => {
|
|
3534
|
+
const setIsInternal = ({ isInternal: newIsInternal, superdoc: superdoc2 }) => {
|
|
3536
3535
|
const previousValue = isInternal.value;
|
|
3537
3536
|
if (previousValue === newIsInternal) return;
|
|
3538
3537
|
isInternal.value = newIsInternal;
|
|
@@ -3541,16 +3540,16 @@ function useComment(params2) {
|
|
|
3541
3540
|
changes: [{ key: "isInternal", value: newIsInternal, previousValue }],
|
|
3542
3541
|
comment: getValues()
|
|
3543
3542
|
};
|
|
3544
|
-
propagateUpdate(
|
|
3545
|
-
const activeEditor =
|
|
3543
|
+
propagateUpdate(superdoc2, emitData);
|
|
3544
|
+
const activeEditor = superdoc2.activeEditor;
|
|
3546
3545
|
if (!activeEditor) return;
|
|
3547
3546
|
activeEditor.commands.setCommentInternal({ commentId, importedId, isInternal: newIsInternal });
|
|
3548
3547
|
};
|
|
3549
|
-
const setActive = (
|
|
3550
|
-
const { activeEditor } =
|
|
3548
|
+
const setActive = (superdoc2) => {
|
|
3549
|
+
const { activeEditor } = superdoc2;
|
|
3551
3550
|
activeEditor?.commands.setActiveComment({ commentId, importedId });
|
|
3552
3551
|
};
|
|
3553
|
-
const setText = ({ text, superdoc, suppressUpdate }) => {
|
|
3552
|
+
const setText = ({ text, superdoc: superdoc2, suppressUpdate }) => {
|
|
3554
3553
|
commentText.value = text;
|
|
3555
3554
|
mentions.value = extractMentions(text);
|
|
3556
3555
|
if (suppressUpdate) return;
|
|
@@ -3559,7 +3558,7 @@ function useComment(params2) {
|
|
|
3559
3558
|
changes: [{ key: "text", value: text }],
|
|
3560
3559
|
comment: getValues()
|
|
3561
3560
|
};
|
|
3562
|
-
propagateUpdate(
|
|
3561
|
+
propagateUpdate(superdoc2, emitData);
|
|
3563
3562
|
};
|
|
3564
3563
|
const extractMentions = (htmlString) => {
|
|
3565
3564
|
const parser = new DOMParser();
|
|
@@ -3596,9 +3595,9 @@ function useComment(params2) {
|
|
|
3596
3595
|
const user = importedAuthor.value ? { name: importedAuthor.value.name || "(Imported)", email: importedAuthor.value.email } : { name: creatorName, email: creatorEmail, image: creatorImage };
|
|
3597
3596
|
return user;
|
|
3598
3597
|
};
|
|
3599
|
-
const propagateUpdate = (
|
|
3600
|
-
|
|
3601
|
-
syncCommentsToClients(
|
|
3598
|
+
const propagateUpdate = (superdoc2, event) => {
|
|
3599
|
+
superdoc2.emit("comments-update", event);
|
|
3600
|
+
syncCommentsToClients(superdoc2, event);
|
|
3602
3601
|
};
|
|
3603
3602
|
const getValues = () => {
|
|
3604
3603
|
return {
|
|
@@ -4023,21 +4022,21 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4023
4022
|
if (id === void 0 || id === null) return null;
|
|
4024
4023
|
return commentsList.value.find((c2) => c2.commentId == id || c2.importedId == id);
|
|
4025
4024
|
};
|
|
4026
|
-
const setActiveComment = (
|
|
4025
|
+
const setActiveComment = (superdoc2, id) => {
|
|
4027
4026
|
if (id === void 0 || id === null) {
|
|
4028
4027
|
activeComment.value = null;
|
|
4029
|
-
if (
|
|
4030
|
-
|
|
4028
|
+
if (superdoc2.activeEditor) {
|
|
4029
|
+
superdoc2.activeEditor.commands?.setActiveComment({ commentId: null });
|
|
4031
4030
|
}
|
|
4032
4031
|
return;
|
|
4033
4032
|
}
|
|
4034
4033
|
const comment = getComment(id);
|
|
4035
4034
|
if (comment) activeComment.value = comment.commentId;
|
|
4036
|
-
if (
|
|
4037
|
-
|
|
4035
|
+
if (superdoc2.activeEditor) {
|
|
4036
|
+
superdoc2.activeEditor.commands?.setActiveComment({ commentId: activeComment.value });
|
|
4038
4037
|
}
|
|
4039
4038
|
};
|
|
4040
|
-
const handleTrackedChangeUpdate = ({ superdoc, params: params2 }) => {
|
|
4039
|
+
const handleTrackedChangeUpdate = ({ superdoc: superdoc2, params: params2 }) => {
|
|
4041
4040
|
const {
|
|
4042
4041
|
event,
|
|
4043
4042
|
changeId,
|
|
@@ -4070,7 +4069,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4070
4069
|
}
|
|
4071
4070
|
});
|
|
4072
4071
|
if (event === "add") {
|
|
4073
|
-
addComment({ superdoc, comment });
|
|
4072
|
+
addComment({ superdoc: superdoc2, comment });
|
|
4074
4073
|
} else if (event === "update") {
|
|
4075
4074
|
const existingTrackedChange = commentsList.value.find((comment2) => comment2.commentId === changeId);
|
|
4076
4075
|
if (!existingTrackedChange) return;
|
|
@@ -4082,33 +4081,33 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4082
4081
|
type: COMMENT_EVENTS.UPDATE,
|
|
4083
4082
|
comment: existingTrackedChange.getValues()
|
|
4084
4083
|
};
|
|
4085
|
-
syncCommentsToClients(
|
|
4086
|
-
debounceEmit(changeId, emitData,
|
|
4084
|
+
syncCommentsToClients(superdoc2, emitData);
|
|
4085
|
+
debounceEmit(changeId, emitData, superdoc2);
|
|
4087
4086
|
}
|
|
4088
4087
|
};
|
|
4089
|
-
const debounceEmit = (commentId, event,
|
|
4088
|
+
const debounceEmit = (commentId, event, superdoc2, delay = 1e3) => {
|
|
4090
4089
|
if (debounceTimers[commentId]) {
|
|
4091
4090
|
clearTimeout(debounceTimers[commentId]);
|
|
4092
4091
|
}
|
|
4093
4092
|
debounceTimers[commentId] = setTimeout(() => {
|
|
4094
|
-
if (
|
|
4095
|
-
|
|
4093
|
+
if (superdoc2) {
|
|
4094
|
+
superdoc2.emit("comments-update", event);
|
|
4096
4095
|
}
|
|
4097
4096
|
delete debounceTimers[commentId];
|
|
4098
4097
|
}, delay);
|
|
4099
4098
|
};
|
|
4100
|
-
const showAddComment = (
|
|
4099
|
+
const showAddComment = (superdoc2) => {
|
|
4101
4100
|
const event = { type: COMMENT_EVENTS.PENDING };
|
|
4102
|
-
|
|
4101
|
+
superdoc2.emit("comments-update", event);
|
|
4103
4102
|
const selection = { ...superdocStore.activeSelection };
|
|
4104
4103
|
selection.selectionBounds = { ...selection.selectionBounds };
|
|
4105
4104
|
if (superdocStore.selectionPosition?.source) {
|
|
4106
4105
|
superdocStore.selectionPosition.source = null;
|
|
4107
4106
|
}
|
|
4108
4107
|
pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
|
|
4109
|
-
if (!
|
|
4110
|
-
if (
|
|
4111
|
-
|
|
4108
|
+
if (!superdoc2.config.isInternal) pendingComment.value.isInternal = false;
|
|
4109
|
+
if (superdoc2.activeEditor?.commands) {
|
|
4110
|
+
superdoc2.activeEditor.commands.insertComment({
|
|
4112
4111
|
...pendingComment.value.getValues(),
|
|
4113
4112
|
commentId: "pending",
|
|
4114
4113
|
skipEmit: true
|
|
@@ -4178,14 +4177,14 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4178
4177
|
...options
|
|
4179
4178
|
});
|
|
4180
4179
|
};
|
|
4181
|
-
const removePendingComment = (
|
|
4180
|
+
const removePendingComment = (superdoc2) => {
|
|
4182
4181
|
currentCommentText.value = "";
|
|
4183
4182
|
pendingComment.value = null;
|
|
4184
4183
|
activeComment.value = null;
|
|
4185
4184
|
superdocStore.selectionPosition = null;
|
|
4186
|
-
|
|
4185
|
+
superdoc2.activeEditor?.commands.removeComment({ commentId: "pending" });
|
|
4187
4186
|
};
|
|
4188
|
-
const addComment = ({ superdoc, comment, skipEditorUpdate = false }) => {
|
|
4187
|
+
const addComment = ({ superdoc: superdoc2, comment, skipEditorUpdate = false }) => {
|
|
4189
4188
|
let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
|
|
4190
4189
|
if (!parentComment) parentComment = comment;
|
|
4191
4190
|
const newComment = useComment(comment.getValues());
|
|
@@ -4196,22 +4195,22 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4196
4195
|
const isParentInternal = parentComment.isInternal;
|
|
4197
4196
|
newComment.isInternal = isParentInternal;
|
|
4198
4197
|
}
|
|
4199
|
-
if (!
|
|
4198
|
+
if (!superdoc2.config.isInternal) newComment.isInternal = false;
|
|
4200
4199
|
commentsList.value.push(newComment);
|
|
4201
|
-
removePendingComment(
|
|
4202
|
-
if (!skipEditorUpdate && !comment.trackedChange &&
|
|
4203
|
-
|
|
4200
|
+
removePendingComment(superdoc2);
|
|
4201
|
+
if (!skipEditorUpdate && !comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
|
|
4202
|
+
superdoc2.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
|
|
4204
4203
|
}
|
|
4205
4204
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
4206
|
-
syncCommentsToClients(
|
|
4207
|
-
|
|
4205
|
+
syncCommentsToClients(superdoc2, event);
|
|
4206
|
+
superdoc2.emit("comments-update", event);
|
|
4208
4207
|
};
|
|
4209
|
-
const deleteComment = ({ commentId: commentIdToDelete, superdoc }) => {
|
|
4208
|
+
const deleteComment = ({ commentId: commentIdToDelete, superdoc: superdoc2 }) => {
|
|
4210
4209
|
const commentIndex = commentsList.value.findIndex((c2) => c2.commentId === commentIdToDelete);
|
|
4211
4210
|
const comment = commentsList.value[commentIndex];
|
|
4212
4211
|
const { commentId, importedId } = comment;
|
|
4213
4212
|
const { fileId } = comment;
|
|
4214
|
-
|
|
4213
|
+
superdoc2.activeEditor?.commands?.removeComment({ commentId, importedId });
|
|
4215
4214
|
commentsList.value.splice(commentIndex, 1);
|
|
4216
4215
|
const childCommentIds = commentsList.value.filter((c2) => c2.parentCommentId === commentId).map((c2) => c2.commentId || c2.importedId);
|
|
4217
4216
|
commentsList.value = commentsList.value.filter((c2) => !childCommentIds.includes(c2.commentId));
|
|
@@ -4220,13 +4219,13 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4220
4219
|
comment: comment.getValues(),
|
|
4221
4220
|
changes: [{ key: "deleted", commentId, fileId }]
|
|
4222
4221
|
};
|
|
4223
|
-
|
|
4224
|
-
syncCommentsToClients(
|
|
4222
|
+
superdoc2.emit("comments-update", event);
|
|
4223
|
+
syncCommentsToClients(superdoc2, event);
|
|
4225
4224
|
};
|
|
4226
|
-
const cancelComment = (
|
|
4227
|
-
removePendingComment(
|
|
4225
|
+
const cancelComment = (superdoc2) => {
|
|
4226
|
+
removePendingComment(superdoc2);
|
|
4228
4227
|
};
|
|
4229
|
-
const processLoadedDocxComments = async ({ superdoc, editor, comments, documentId }) => {
|
|
4228
|
+
const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
|
|
4230
4229
|
const document2 = superdocStore.getDocument(documentId);
|
|
4231
4230
|
comments.forEach((comment) => {
|
|
4232
4231
|
const htmlContent = getHtmlFromComment(comment.textJson);
|
|
@@ -4258,7 +4257,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4258
4257
|
trackedChangeType: comment.trackedChangeType,
|
|
4259
4258
|
deletedText: comment.trackedDeletedText
|
|
4260
4259
|
});
|
|
4261
|
-
addComment({ superdoc, comment: newComment });
|
|
4260
|
+
addComment({ superdoc: superdoc2, comment: newComment });
|
|
4262
4261
|
});
|
|
4263
4262
|
setTimeout(() => {
|
|
4264
4263
|
createCommentForTrackChanges(editor);
|
|
@@ -16538,12 +16537,12 @@ class SuperComments extends eventemitter3.EventEmitter {
|
|
|
16538
16537
|
element: null,
|
|
16539
16538
|
commentsStore: null
|
|
16540
16539
|
};
|
|
16541
|
-
constructor(options,
|
|
16540
|
+
constructor(options, superdoc2) {
|
|
16542
16541
|
super();
|
|
16543
16542
|
this.config = { ...this.config, ...options };
|
|
16544
16543
|
this.element = this.config.element;
|
|
16545
16544
|
this.app = null;
|
|
16546
|
-
this.superdoc =
|
|
16545
|
+
this.superdoc = superdoc2;
|
|
16547
16546
|
this.open();
|
|
16548
16547
|
}
|
|
16549
16548
|
createVueApp() {
|
|
@@ -16772,8 +16771,7 @@ const _sfc_main$9 = {
|
|
|
16772
16771
|
measurementTimeoutId.value = null;
|
|
16773
16772
|
}
|
|
16774
16773
|
const totalComments = getFloatingComments.value.length;
|
|
16775
|
-
|
|
16776
|
-
if (totalComments === 0 || measuredComments === 0) {
|
|
16774
|
+
if (totalComments === 0) {
|
|
16777
16775
|
return;
|
|
16778
16776
|
}
|
|
16779
16777
|
vue.nextTick(processLocations);
|
|
@@ -16854,7 +16852,7 @@ const _sfc_main$9 = {
|
|
|
16854
16852
|
};
|
|
16855
16853
|
}
|
|
16856
16854
|
};
|
|
16857
|
-
const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-
|
|
16855
|
+
const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-6905dd07"]]);
|
|
16858
16856
|
const _sfc_main$8 = {
|
|
16859
16857
|
__name: "TextField",
|
|
16860
16858
|
props: {
|
|
@@ -17482,7 +17480,7 @@ const _sfc_main = {
|
|
|
17482
17480
|
__name: "SuperDoc",
|
|
17483
17481
|
emits: ["selection-update"],
|
|
17484
17482
|
setup(__props, { emit: __emit }) {
|
|
17485
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17483
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-cVGt7Ne7.cjs")));
|
|
17486
17484
|
const superdocStore = useSuperdocStore();
|
|
17487
17485
|
const commentsStore = useCommentsStore();
|
|
17488
17486
|
const {
|
|
@@ -18386,7 +18384,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18386
18384
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18387
18385
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18388
18386
|
this.colorIndex = 0;
|
|
18389
|
-
this.version = "1.0.0-next.
|
|
18387
|
+
this.version = "1.0.0-next.3";
|
|
18390
18388
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18391
18389
|
this.superdocId = config.superdocId || uuid.v4();
|
|
18392
18390
|
this.colors = this.config.colors;
|