@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,4 +1,4 @@
|
|
|
1
|
-
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
1
|
+
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-S9Kp_7dy.es.js";
|
|
2
2
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
3
3
|
import { E as EventEmitter } from "./eventemitter3-44XulWQe.es.js";
|
|
4
4
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -3310,17 +3310,17 @@ function setupAwarenessHandler(provider, superdocInstance, user) {
|
|
|
3310
3310
|
});
|
|
3311
3311
|
});
|
|
3312
3312
|
}
|
|
3313
|
-
const addYComment = (yArray, ydoc, event
|
|
3313
|
+
const addYComment = (yArray, ydoc, event) => {
|
|
3314
3314
|
const { comment } = event;
|
|
3315
3315
|
const yComment = new Map$2(Object.entries(comment));
|
|
3316
3316
|
ydoc.transact(
|
|
3317
3317
|
() => {
|
|
3318
3318
|
yArray.push([yComment]);
|
|
3319
3319
|
},
|
|
3320
|
-
{ user }
|
|
3320
|
+
{ user: superdoc.user }
|
|
3321
3321
|
);
|
|
3322
3322
|
};
|
|
3323
|
-
const updateYComment = (yArray, ydoc, event
|
|
3323
|
+
const updateYComment = (yArray, ydoc, event) => {
|
|
3324
3324
|
const { comment } = event;
|
|
3325
3325
|
const yComment = new Map$2(Object.entries(comment));
|
|
3326
3326
|
const commentIndex = getCommentIndex(yArray, comment);
|
|
@@ -3330,10 +3330,10 @@ const updateYComment = (yArray, ydoc, event, user) => {
|
|
|
3330
3330
|
yArray.delete(commentIndex, 1);
|
|
3331
3331
|
yArray.insert(commentIndex, [yComment]);
|
|
3332
3332
|
},
|
|
3333
|
-
{ user }
|
|
3333
|
+
{ user: superdoc.user }
|
|
3334
3334
|
);
|
|
3335
3335
|
};
|
|
3336
|
-
const deleteYComment = (yArray, ydoc, event
|
|
3336
|
+
const deleteYComment = (yArray, ydoc, event) => {
|
|
3337
3337
|
const { comment } = event;
|
|
3338
3338
|
const commentIndex = getCommentIndex(yArray, comment);
|
|
3339
3339
|
if (commentIndex === -1) return;
|
|
@@ -3341,26 +3341,26 @@ const deleteYComment = (yArray, ydoc, event, user) => {
|
|
|
3341
3341
|
() => {
|
|
3342
3342
|
yArray.delete(commentIndex, 1);
|
|
3343
3343
|
},
|
|
3344
|
-
{ user }
|
|
3344
|
+
{ user: superdoc.user }
|
|
3345
3345
|
);
|
|
3346
3346
|
};
|
|
3347
3347
|
const getCommentIndex = (yArray, comment) => {
|
|
3348
3348
|
const baseArray = yArray.toJSON();
|
|
3349
3349
|
return baseArray.findIndex((c2) => c2.commentId === comment.commentId);
|
|
3350
3350
|
};
|
|
3351
|
-
const initCollaborationComments = (
|
|
3352
|
-
if (!
|
|
3351
|
+
const initCollaborationComments = (superdoc2) => {
|
|
3352
|
+
if (!superdoc2.config.modules.comments || !superdoc2.provider) return;
|
|
3353
3353
|
const onSuperDocYdocSynced = () => {
|
|
3354
|
-
const parent =
|
|
3355
|
-
const ids =
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3354
|
+
const parent = superdoc2.commentsStore.commentsParentElement;
|
|
3355
|
+
const ids = superdoc2.commentsStore.editorCommentIds;
|
|
3356
|
+
superdoc2.commentsStore.handleEditorLocationsUpdate(parent, ids);
|
|
3357
|
+
superdoc2.commentsStore.hasSyncedCollaborationComments = true;
|
|
3358
|
+
superdoc2.provider.off("synced", onSuperDocYdocSynced);
|
|
3359
3359
|
};
|
|
3360
|
-
|
|
3361
|
-
const commentsArray =
|
|
3360
|
+
superdoc2.provider.on("synced", onSuperDocYdocSynced);
|
|
3361
|
+
const commentsArray = superdoc2.ydoc.getArray("comments");
|
|
3362
3362
|
commentsArray.observe((event) => {
|
|
3363
|
-
const currentUser =
|
|
3363
|
+
const currentUser = superdoc2.config.user;
|
|
3364
3364
|
const { user = {} } = event.transaction.origin;
|
|
3365
3365
|
if (currentUser.name === user.name && currentUser.email === user.email) return;
|
|
3366
3366
|
const comments = commentsArray.toJSON();
|
|
@@ -3372,60 +3372,59 @@ const initCollaborationComments = (superdoc) => {
|
|
|
3372
3372
|
filtered.push(c2);
|
|
3373
3373
|
}
|
|
3374
3374
|
});
|
|
3375
|
-
|
|
3375
|
+
superdoc2.commentsStore.commentsList = filtered.map((c2) => useComment(c2));
|
|
3376
3376
|
});
|
|
3377
3377
|
};
|
|
3378
|
-
const initSuperdocYdoc = (
|
|
3379
|
-
const { isInternal } =
|
|
3380
|
-
const baseName = `${
|
|
3381
|
-
if (!
|
|
3378
|
+
const initSuperdocYdoc = (superdoc2) => {
|
|
3379
|
+
const { isInternal } = superdoc2.config;
|
|
3380
|
+
const baseName = `${superdoc2.config.superdocId}-superdoc`;
|
|
3381
|
+
if (!superdoc2.config.superdocId) return;
|
|
3382
3382
|
const documentId = isInternal ? baseName : `${baseName}-external`;
|
|
3383
3383
|
const superdocCollaborationOptions = {
|
|
3384
|
-
config:
|
|
3385
|
-
user:
|
|
3384
|
+
config: superdoc2.config.modules.collaboration,
|
|
3385
|
+
user: superdoc2.config.user,
|
|
3386
3386
|
documentId,
|
|
3387
|
-
socket:
|
|
3388
|
-
superdocInstance:
|
|
3387
|
+
socket: superdoc2.config.socket,
|
|
3388
|
+
superdocInstance: superdoc2
|
|
3389
3389
|
};
|
|
3390
3390
|
const { provider: superdocProvider, ydoc: superdocYdoc } = createProvider(superdocCollaborationOptions);
|
|
3391
3391
|
return { ydoc: superdocYdoc, provider: superdocProvider };
|
|
3392
3392
|
};
|
|
3393
|
-
const makeDocumentsCollaborative = (
|
|
3393
|
+
const makeDocumentsCollaborative = (superdoc2) => {
|
|
3394
3394
|
const processedDocuments = [];
|
|
3395
|
-
|
|
3396
|
-
|
|
3395
|
+
superdoc2.config.documents.forEach((doc) => {
|
|
3396
|
+
superdoc2.config.user.color = superdoc2.colors[0];
|
|
3397
3397
|
const options = {
|
|
3398
|
-
config:
|
|
3399
|
-
user:
|
|
3398
|
+
config: superdoc2.config.modules.collaboration,
|
|
3399
|
+
user: superdoc2.config.user,
|
|
3400
3400
|
documentId: doc.id,
|
|
3401
|
-
socket:
|
|
3402
|
-
superdocInstance:
|
|
3401
|
+
socket: superdoc2.config.socket,
|
|
3402
|
+
superdocInstance: superdoc2
|
|
3403
3403
|
};
|
|
3404
3404
|
const { provider, ydoc } = createProvider(options);
|
|
3405
3405
|
doc.provider = provider;
|
|
3406
|
-
doc.socket =
|
|
3406
|
+
doc.socket = superdoc2.config.socket;
|
|
3407
3407
|
doc.ydoc = ydoc;
|
|
3408
|
-
doc.role =
|
|
3408
|
+
doc.role = superdoc2.config.role;
|
|
3409
3409
|
processedDocuments.push(doc);
|
|
3410
3410
|
});
|
|
3411
3411
|
return processedDocuments;
|
|
3412
3412
|
};
|
|
3413
|
-
const syncCommentsToClients = (
|
|
3414
|
-
if (!
|
|
3415
|
-
const yArray =
|
|
3416
|
-
const user = superdoc.config.user;
|
|
3413
|
+
const syncCommentsToClients = (superdoc2, event) => {
|
|
3414
|
+
if (!superdoc2.isCollaborative || !superdoc2.config.modules.comments) return;
|
|
3415
|
+
const yArray = superdoc2.ydoc.getArray("comments");
|
|
3417
3416
|
switch (event.type) {
|
|
3418
3417
|
case "add":
|
|
3419
|
-
addYComment(yArray,
|
|
3418
|
+
addYComment(yArray, superdoc2.ydoc, event);
|
|
3420
3419
|
break;
|
|
3421
3420
|
case "update":
|
|
3422
|
-
updateYComment(yArray,
|
|
3421
|
+
updateYComment(yArray, superdoc2.ydoc, event);
|
|
3423
3422
|
break;
|
|
3424
3423
|
case "resolved":
|
|
3425
|
-
updateYComment(yArray,
|
|
3424
|
+
updateYComment(yArray, superdoc2.ydoc, event);
|
|
3426
3425
|
break;
|
|
3427
3426
|
case "deleted":
|
|
3428
|
-
deleteYComment(yArray,
|
|
3427
|
+
deleteYComment(yArray, superdoc2.ydoc, event);
|
|
3429
3428
|
break;
|
|
3430
3429
|
}
|
|
3431
3430
|
};
|
|
@@ -3500,22 +3499,22 @@ function useComment(params2) {
|
|
|
3500
3499
|
const resolvedTime = ref(params2.resolvedTime || null);
|
|
3501
3500
|
const resolvedByEmail = ref(params2.resolvedByEmail || null);
|
|
3502
3501
|
const resolvedByName = ref(params2.resolvedByName || null);
|
|
3503
|
-
const resolveComment = ({ email, name, superdoc }) => {
|
|
3502
|
+
const resolveComment = ({ email, name, superdoc: superdoc2 }) => {
|
|
3504
3503
|
if (resolvedTime.value) return;
|
|
3505
3504
|
resolvedTime.value = Date.now();
|
|
3506
3505
|
resolvedByEmail.value = email;
|
|
3507
3506
|
resolvedByName.value = name;
|
|
3508
3507
|
if (trackedChange.value) {
|
|
3509
3508
|
const emitData2 = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
3510
|
-
propagateUpdate(
|
|
3511
|
-
|
|
3509
|
+
propagateUpdate(superdoc2, emitData2);
|
|
3510
|
+
superdoc2.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
3512
3511
|
return;
|
|
3513
3512
|
}
|
|
3514
3513
|
const emitData = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
3515
|
-
propagateUpdate(
|
|
3516
|
-
|
|
3514
|
+
propagateUpdate(superdoc2, emitData);
|
|
3515
|
+
superdoc2.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
3517
3516
|
};
|
|
3518
|
-
const setIsInternal = ({ isInternal: newIsInternal, superdoc }) => {
|
|
3517
|
+
const setIsInternal = ({ isInternal: newIsInternal, superdoc: superdoc2 }) => {
|
|
3519
3518
|
const previousValue = isInternal.value;
|
|
3520
3519
|
if (previousValue === newIsInternal) return;
|
|
3521
3520
|
isInternal.value = newIsInternal;
|
|
@@ -3524,16 +3523,16 @@ function useComment(params2) {
|
|
|
3524
3523
|
changes: [{ key: "isInternal", value: newIsInternal, previousValue }],
|
|
3525
3524
|
comment: getValues()
|
|
3526
3525
|
};
|
|
3527
|
-
propagateUpdate(
|
|
3528
|
-
const activeEditor =
|
|
3526
|
+
propagateUpdate(superdoc2, emitData);
|
|
3527
|
+
const activeEditor = superdoc2.activeEditor;
|
|
3529
3528
|
if (!activeEditor) return;
|
|
3530
3529
|
activeEditor.commands.setCommentInternal({ commentId, importedId, isInternal: newIsInternal });
|
|
3531
3530
|
};
|
|
3532
|
-
const setActive = (
|
|
3533
|
-
const { activeEditor } =
|
|
3531
|
+
const setActive = (superdoc2) => {
|
|
3532
|
+
const { activeEditor } = superdoc2;
|
|
3534
3533
|
activeEditor?.commands.setActiveComment({ commentId, importedId });
|
|
3535
3534
|
};
|
|
3536
|
-
const setText = ({ text, superdoc, suppressUpdate }) => {
|
|
3535
|
+
const setText = ({ text, superdoc: superdoc2, suppressUpdate }) => {
|
|
3537
3536
|
commentText.value = text;
|
|
3538
3537
|
mentions.value = extractMentions(text);
|
|
3539
3538
|
if (suppressUpdate) return;
|
|
@@ -3542,7 +3541,7 @@ function useComment(params2) {
|
|
|
3542
3541
|
changes: [{ key: "text", value: text }],
|
|
3543
3542
|
comment: getValues()
|
|
3544
3543
|
};
|
|
3545
|
-
propagateUpdate(
|
|
3544
|
+
propagateUpdate(superdoc2, emitData);
|
|
3546
3545
|
};
|
|
3547
3546
|
const extractMentions = (htmlString) => {
|
|
3548
3547
|
const parser = new DOMParser();
|
|
@@ -3579,9 +3578,9 @@ function useComment(params2) {
|
|
|
3579
3578
|
const user = importedAuthor.value ? { name: importedAuthor.value.name || "(Imported)", email: importedAuthor.value.email } : { name: creatorName, email: creatorEmail, image: creatorImage };
|
|
3580
3579
|
return user;
|
|
3581
3580
|
};
|
|
3582
|
-
const propagateUpdate = (
|
|
3583
|
-
|
|
3584
|
-
syncCommentsToClients(
|
|
3581
|
+
const propagateUpdate = (superdoc2, event) => {
|
|
3582
|
+
superdoc2.emit("comments-update", event);
|
|
3583
|
+
syncCommentsToClients(superdoc2, event);
|
|
3585
3584
|
};
|
|
3586
3585
|
const getValues = () => {
|
|
3587
3586
|
return {
|
|
@@ -4006,21 +4005,21 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4006
4005
|
if (id === void 0 || id === null) return null;
|
|
4007
4006
|
return commentsList.value.find((c2) => c2.commentId == id || c2.importedId == id);
|
|
4008
4007
|
};
|
|
4009
|
-
const setActiveComment = (
|
|
4008
|
+
const setActiveComment = (superdoc2, id) => {
|
|
4010
4009
|
if (id === void 0 || id === null) {
|
|
4011
4010
|
activeComment.value = null;
|
|
4012
|
-
if (
|
|
4013
|
-
|
|
4011
|
+
if (superdoc2.activeEditor) {
|
|
4012
|
+
superdoc2.activeEditor.commands?.setActiveComment({ commentId: null });
|
|
4014
4013
|
}
|
|
4015
4014
|
return;
|
|
4016
4015
|
}
|
|
4017
4016
|
const comment = getComment(id);
|
|
4018
4017
|
if (comment) activeComment.value = comment.commentId;
|
|
4019
|
-
if (
|
|
4020
|
-
|
|
4018
|
+
if (superdoc2.activeEditor) {
|
|
4019
|
+
superdoc2.activeEditor.commands?.setActiveComment({ commentId: activeComment.value });
|
|
4021
4020
|
}
|
|
4022
4021
|
};
|
|
4023
|
-
const handleTrackedChangeUpdate = ({ superdoc, params: params2 }) => {
|
|
4022
|
+
const handleTrackedChangeUpdate = ({ superdoc: superdoc2, params: params2 }) => {
|
|
4024
4023
|
const {
|
|
4025
4024
|
event,
|
|
4026
4025
|
changeId,
|
|
@@ -4053,7 +4052,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4053
4052
|
}
|
|
4054
4053
|
});
|
|
4055
4054
|
if (event === "add") {
|
|
4056
|
-
addComment({ superdoc, comment });
|
|
4055
|
+
addComment({ superdoc: superdoc2, comment });
|
|
4057
4056
|
} else if (event === "update") {
|
|
4058
4057
|
const existingTrackedChange = commentsList.value.find((comment2) => comment2.commentId === changeId);
|
|
4059
4058
|
if (!existingTrackedChange) return;
|
|
@@ -4065,33 +4064,33 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4065
4064
|
type: COMMENT_EVENTS.UPDATE,
|
|
4066
4065
|
comment: existingTrackedChange.getValues()
|
|
4067
4066
|
};
|
|
4068
|
-
syncCommentsToClients(
|
|
4069
|
-
debounceEmit(changeId, emitData,
|
|
4067
|
+
syncCommentsToClients(superdoc2, emitData);
|
|
4068
|
+
debounceEmit(changeId, emitData, superdoc2);
|
|
4070
4069
|
}
|
|
4071
4070
|
};
|
|
4072
|
-
const debounceEmit = (commentId, event,
|
|
4071
|
+
const debounceEmit = (commentId, event, superdoc2, delay = 1e3) => {
|
|
4073
4072
|
if (debounceTimers[commentId]) {
|
|
4074
4073
|
clearTimeout(debounceTimers[commentId]);
|
|
4075
4074
|
}
|
|
4076
4075
|
debounceTimers[commentId] = setTimeout(() => {
|
|
4077
|
-
if (
|
|
4078
|
-
|
|
4076
|
+
if (superdoc2) {
|
|
4077
|
+
superdoc2.emit("comments-update", event);
|
|
4079
4078
|
}
|
|
4080
4079
|
delete debounceTimers[commentId];
|
|
4081
4080
|
}, delay);
|
|
4082
4081
|
};
|
|
4083
|
-
const showAddComment = (
|
|
4082
|
+
const showAddComment = (superdoc2) => {
|
|
4084
4083
|
const event = { type: COMMENT_EVENTS.PENDING };
|
|
4085
|
-
|
|
4084
|
+
superdoc2.emit("comments-update", event);
|
|
4086
4085
|
const selection = { ...superdocStore.activeSelection };
|
|
4087
4086
|
selection.selectionBounds = { ...selection.selectionBounds };
|
|
4088
4087
|
if (superdocStore.selectionPosition?.source) {
|
|
4089
4088
|
superdocStore.selectionPosition.source = null;
|
|
4090
4089
|
}
|
|
4091
4090
|
pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
|
|
4092
|
-
if (!
|
|
4093
|
-
if (
|
|
4094
|
-
|
|
4091
|
+
if (!superdoc2.config.isInternal) pendingComment.value.isInternal = false;
|
|
4092
|
+
if (superdoc2.activeEditor?.commands) {
|
|
4093
|
+
superdoc2.activeEditor.commands.insertComment({
|
|
4095
4094
|
...pendingComment.value.getValues(),
|
|
4096
4095
|
commentId: "pending",
|
|
4097
4096
|
skipEmit: true
|
|
@@ -4161,14 +4160,14 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4161
4160
|
...options
|
|
4162
4161
|
});
|
|
4163
4162
|
};
|
|
4164
|
-
const removePendingComment = (
|
|
4163
|
+
const removePendingComment = (superdoc2) => {
|
|
4165
4164
|
currentCommentText.value = "";
|
|
4166
4165
|
pendingComment.value = null;
|
|
4167
4166
|
activeComment.value = null;
|
|
4168
4167
|
superdocStore.selectionPosition = null;
|
|
4169
|
-
|
|
4168
|
+
superdoc2.activeEditor?.commands.removeComment({ commentId: "pending" });
|
|
4170
4169
|
};
|
|
4171
|
-
const addComment = ({ superdoc, comment, skipEditorUpdate = false }) => {
|
|
4170
|
+
const addComment = ({ superdoc: superdoc2, comment, skipEditorUpdate = false }) => {
|
|
4172
4171
|
let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
|
|
4173
4172
|
if (!parentComment) parentComment = comment;
|
|
4174
4173
|
const newComment = useComment(comment.getValues());
|
|
@@ -4179,22 +4178,22 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4179
4178
|
const isParentInternal = parentComment.isInternal;
|
|
4180
4179
|
newComment.isInternal = isParentInternal;
|
|
4181
4180
|
}
|
|
4182
|
-
if (!
|
|
4181
|
+
if (!superdoc2.config.isInternal) newComment.isInternal = false;
|
|
4183
4182
|
commentsList.value.push(newComment);
|
|
4184
|
-
removePendingComment(
|
|
4185
|
-
if (!skipEditorUpdate && !comment.trackedChange &&
|
|
4186
|
-
|
|
4183
|
+
removePendingComment(superdoc2);
|
|
4184
|
+
if (!skipEditorUpdate && !comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
|
|
4185
|
+
superdoc2.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
|
|
4187
4186
|
}
|
|
4188
4187
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
4189
|
-
syncCommentsToClients(
|
|
4190
|
-
|
|
4188
|
+
syncCommentsToClients(superdoc2, event);
|
|
4189
|
+
superdoc2.emit("comments-update", event);
|
|
4191
4190
|
};
|
|
4192
|
-
const deleteComment = ({ commentId: commentIdToDelete, superdoc }) => {
|
|
4191
|
+
const deleteComment = ({ commentId: commentIdToDelete, superdoc: superdoc2 }) => {
|
|
4193
4192
|
const commentIndex = commentsList.value.findIndex((c2) => c2.commentId === commentIdToDelete);
|
|
4194
4193
|
const comment = commentsList.value[commentIndex];
|
|
4195
4194
|
const { commentId, importedId } = comment;
|
|
4196
4195
|
const { fileId } = comment;
|
|
4197
|
-
|
|
4196
|
+
superdoc2.activeEditor?.commands?.removeComment({ commentId, importedId });
|
|
4198
4197
|
commentsList.value.splice(commentIndex, 1);
|
|
4199
4198
|
const childCommentIds = commentsList.value.filter((c2) => c2.parentCommentId === commentId).map((c2) => c2.commentId || c2.importedId);
|
|
4200
4199
|
commentsList.value = commentsList.value.filter((c2) => !childCommentIds.includes(c2.commentId));
|
|
@@ -4203,13 +4202,13 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4203
4202
|
comment: comment.getValues(),
|
|
4204
4203
|
changes: [{ key: "deleted", commentId, fileId }]
|
|
4205
4204
|
};
|
|
4206
|
-
|
|
4207
|
-
syncCommentsToClients(
|
|
4205
|
+
superdoc2.emit("comments-update", event);
|
|
4206
|
+
syncCommentsToClients(superdoc2, event);
|
|
4208
4207
|
};
|
|
4209
|
-
const cancelComment = (
|
|
4210
|
-
removePendingComment(
|
|
4208
|
+
const cancelComment = (superdoc2) => {
|
|
4209
|
+
removePendingComment(superdoc2);
|
|
4211
4210
|
};
|
|
4212
|
-
const processLoadedDocxComments = async ({ superdoc, editor, comments, documentId }) => {
|
|
4211
|
+
const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
|
|
4213
4212
|
const document2 = superdocStore.getDocument(documentId);
|
|
4214
4213
|
comments.forEach((comment) => {
|
|
4215
4214
|
const htmlContent = getHtmlFromComment(comment.textJson);
|
|
@@ -4241,7 +4240,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4241
4240
|
trackedChangeType: comment.trackedChangeType,
|
|
4242
4241
|
deletedText: comment.trackedDeletedText
|
|
4243
4242
|
});
|
|
4244
|
-
addComment({ superdoc, comment: newComment });
|
|
4243
|
+
addComment({ superdoc: superdoc2, comment: newComment });
|
|
4245
4244
|
});
|
|
4246
4245
|
setTimeout(() => {
|
|
4247
4246
|
createCommentForTrackChanges(editor);
|
|
@@ -16521,12 +16520,12 @@ class SuperComments extends EventEmitter {
|
|
|
16521
16520
|
element: null,
|
|
16522
16521
|
commentsStore: null
|
|
16523
16522
|
};
|
|
16524
|
-
constructor(options,
|
|
16523
|
+
constructor(options, superdoc2) {
|
|
16525
16524
|
super();
|
|
16526
16525
|
this.config = { ...this.config, ...options };
|
|
16527
16526
|
this.element = this.config.element;
|
|
16528
16527
|
this.app = null;
|
|
16529
|
-
this.superdoc =
|
|
16528
|
+
this.superdoc = superdoc2;
|
|
16530
16529
|
this.open();
|
|
16531
16530
|
}
|
|
16532
16531
|
createVueApp() {
|
|
@@ -16755,8 +16754,7 @@ const _sfc_main$9 = {
|
|
|
16755
16754
|
measurementTimeoutId.value = null;
|
|
16756
16755
|
}
|
|
16757
16756
|
const totalComments = getFloatingComments.value.length;
|
|
16758
|
-
|
|
16759
|
-
if (totalComments === 0 || measuredComments === 0) {
|
|
16757
|
+
if (totalComments === 0) {
|
|
16760
16758
|
return;
|
|
16761
16759
|
}
|
|
16762
16760
|
nextTick(processLocations);
|
|
@@ -16837,7 +16835,7 @@ const _sfc_main$9 = {
|
|
|
16837
16835
|
};
|
|
16838
16836
|
}
|
|
16839
16837
|
};
|
|
16840
|
-
const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-
|
|
16838
|
+
const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-6905dd07"]]);
|
|
16841
16839
|
const _sfc_main$8 = {
|
|
16842
16840
|
__name: "TextField",
|
|
16843
16841
|
props: {
|
|
@@ -17465,7 +17463,7 @@ const _sfc_main = {
|
|
|
17465
17463
|
__name: "SuperDoc",
|
|
17466
17464
|
emits: ["selection-update"],
|
|
17467
17465
|
setup(__props, { emit: __emit }) {
|
|
17468
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17466
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-PUn0q_lG.es.js"));
|
|
17469
17467
|
const superdocStore = useSuperdocStore();
|
|
17470
17468
|
const commentsStore = useCommentsStore();
|
|
17471
17469
|
const {
|
|
@@ -18369,7 +18367,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18369
18367
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18370
18368
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18371
18369
|
this.colorIndex = 0;
|
|
18372
|
-
this.version = "1.0.0-next.
|
|
18370
|
+
this.version = "1.0.0-next.3";
|
|
18373
18371
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18374
18372
|
this.superdocId = config.superdocId || v4();
|
|
18375
18373
|
this.colors = this.config.colors;
|