@harbour-enterprises/superdoc 1.0.0-next.5 → 1.0.0-next.7
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-BQ7d08ku.es.js → PdfViewer-CCU0Mzny.es.js} +1 -1
- package/dist/chunks/{PdfViewer-D8FKTxiO.cjs → PdfViewer-Ca1KqMaU.cjs} +1 -1
- package/dist/chunks/{index-BOkSE8Li.cjs → index-DfbOKJbz.cjs} +96 -95
- package/dist/chunks/{index-BUoOdDUj-CLmpIPsb.es.js → index-IZySkMqb-BRW0f_kL.es.js} +1 -1
- package/dist/chunks/{index-BUoOdDUj-CF4U3xYL.cjs → index-IZySkMqb-OvIaFsnt.cjs} +1 -1
- package/dist/chunks/{index-D3wrs960.es.js → index-q8FicN0U.es.js} +96 -95
- package/dist/chunks/{super-editor.es-vynpc_1U.es.js → super-editor.es--rLTKCxc.es.js} +330 -252
- package/dist/chunks/{super-editor.es-Bj_Ga0sp.cjs → super-editor.es-D_13cWx3.cjs} +330 -252
- 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/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-D6Kvbivo.js → converter-BUHD74_1.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DAS45uKP.js → docx-zipper-CtdkK288.js} +1 -1
- package/dist/super-editor/chunks/{editor-BMEPaiVS.js → editor-BV718qjr.js} +331 -253
- package/dist/super-editor/chunks/{index-BUoOdDUj.js → index-IZySkMqb.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CUWKY5Cx.js → toolbar-CnlEeYqx.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 +6 -6
- 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 +426 -347
- 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--rLTKCxc.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, user) => {
|
|
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 }
|
|
3321
3321
|
);
|
|
3322
3322
|
};
|
|
3323
|
-
const updateYComment = (yArray, ydoc, event) => {
|
|
3323
|
+
const updateYComment = (yArray, ydoc, event, user) => {
|
|
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) => {
|
|
|
3330
3330
|
yArray.delete(commentIndex, 1);
|
|
3331
3331
|
yArray.insert(commentIndex, [yComment]);
|
|
3332
3332
|
},
|
|
3333
|
-
{ user
|
|
3333
|
+
{ user }
|
|
3334
3334
|
);
|
|
3335
3335
|
};
|
|
3336
|
-
const deleteYComment = (yArray, ydoc, event) => {
|
|
3336
|
+
const deleteYComment = (yArray, ydoc, event, user) => {
|
|
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) => {
|
|
|
3341
3341
|
() => {
|
|
3342
3342
|
yArray.delete(commentIndex, 1);
|
|
3343
3343
|
},
|
|
3344
|
-
{ user
|
|
3344
|
+
{ 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 = (superdoc) => {
|
|
3352
|
+
if (!superdoc.config.modules.comments || !superdoc.provider) return;
|
|
3353
3353
|
const onSuperDocYdocSynced = () => {
|
|
3354
|
-
const parent =
|
|
3355
|
-
const ids =
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3354
|
+
const parent = superdoc.commentsStore.commentsParentElement;
|
|
3355
|
+
const ids = superdoc.commentsStore.editorCommentIds;
|
|
3356
|
+
superdoc.commentsStore.handleEditorLocationsUpdate(parent, ids);
|
|
3357
|
+
superdoc.commentsStore.hasSyncedCollaborationComments = true;
|
|
3358
|
+
superdoc.provider.off("synced", onSuperDocYdocSynced);
|
|
3359
3359
|
};
|
|
3360
|
-
|
|
3361
|
-
const commentsArray =
|
|
3360
|
+
superdoc.provider.on("synced", onSuperDocYdocSynced);
|
|
3361
|
+
const commentsArray = superdoc.ydoc.getArray("comments");
|
|
3362
3362
|
commentsArray.observe((event) => {
|
|
3363
|
-
const currentUser =
|
|
3363
|
+
const currentUser = superdoc.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,59 +3372,60 @@ const initCollaborationComments = (superdoc2) => {
|
|
|
3372
3372
|
filtered.push(c2);
|
|
3373
3373
|
}
|
|
3374
3374
|
});
|
|
3375
|
-
|
|
3375
|
+
superdoc.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 = (superdoc) => {
|
|
3379
|
+
const { isInternal } = superdoc.config;
|
|
3380
|
+
const baseName = `${superdoc.config.superdocId}-superdoc`;
|
|
3381
|
+
if (!superdoc.config.superdocId) return;
|
|
3382
3382
|
const documentId = isInternal ? baseName : `${baseName}-external`;
|
|
3383
3383
|
const superdocCollaborationOptions = {
|
|
3384
|
-
config:
|
|
3385
|
-
user:
|
|
3384
|
+
config: superdoc.config.modules.collaboration,
|
|
3385
|
+
user: superdoc.config.user,
|
|
3386
3386
|
documentId,
|
|
3387
|
-
socket:
|
|
3388
|
-
superdocInstance:
|
|
3387
|
+
socket: superdoc.config.socket,
|
|
3388
|
+
superdocInstance: superdoc
|
|
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 = (superdoc) => {
|
|
3394
3394
|
const processedDocuments = [];
|
|
3395
|
-
|
|
3396
|
-
|
|
3395
|
+
superdoc.config.documents.forEach((doc) => {
|
|
3396
|
+
superdoc.config.user.color = superdoc.colors[0];
|
|
3397
3397
|
const options = {
|
|
3398
|
-
config:
|
|
3399
|
-
user:
|
|
3398
|
+
config: superdoc.config.modules.collaboration,
|
|
3399
|
+
user: superdoc.config.user,
|
|
3400
3400
|
documentId: doc.id,
|
|
3401
|
-
socket:
|
|
3402
|
-
superdocInstance:
|
|
3401
|
+
socket: superdoc.config.socket,
|
|
3402
|
+
superdocInstance: superdoc
|
|
3403
3403
|
};
|
|
3404
3404
|
const { provider, ydoc } = createProvider(options);
|
|
3405
3405
|
doc.provider = provider;
|
|
3406
|
-
doc.socket =
|
|
3406
|
+
doc.socket = superdoc.config.socket;
|
|
3407
3407
|
doc.ydoc = ydoc;
|
|
3408
|
-
doc.role =
|
|
3408
|
+
doc.role = superdoc.config.role;
|
|
3409
3409
|
processedDocuments.push(doc);
|
|
3410
3410
|
});
|
|
3411
3411
|
return processedDocuments;
|
|
3412
3412
|
};
|
|
3413
|
-
const syncCommentsToClients = (
|
|
3414
|
-
if (!
|
|
3415
|
-
const yArray =
|
|
3413
|
+
const syncCommentsToClients = (superdoc, event) => {
|
|
3414
|
+
if (!superdoc.isCollaborative || !superdoc.config.modules.comments) return;
|
|
3415
|
+
const yArray = superdoc.ydoc.getArray("comments");
|
|
3416
|
+
const user = superdoc.config.user;
|
|
3416
3417
|
switch (event.type) {
|
|
3417
3418
|
case "add":
|
|
3418
|
-
addYComment(yArray,
|
|
3419
|
+
addYComment(yArray, superdoc.ydoc, event, user);
|
|
3419
3420
|
break;
|
|
3420
3421
|
case "update":
|
|
3421
|
-
updateYComment(yArray,
|
|
3422
|
+
updateYComment(yArray, superdoc.ydoc, event, user);
|
|
3422
3423
|
break;
|
|
3423
3424
|
case "resolved":
|
|
3424
|
-
updateYComment(yArray,
|
|
3425
|
+
updateYComment(yArray, superdoc.ydoc, event, user);
|
|
3425
3426
|
break;
|
|
3426
3427
|
case "deleted":
|
|
3427
|
-
deleteYComment(yArray,
|
|
3428
|
+
deleteYComment(yArray, superdoc.ydoc, event, user);
|
|
3428
3429
|
break;
|
|
3429
3430
|
}
|
|
3430
3431
|
};
|
|
@@ -3499,22 +3500,22 @@ function useComment(params2) {
|
|
|
3499
3500
|
const resolvedTime = ref(params2.resolvedTime || null);
|
|
3500
3501
|
const resolvedByEmail = ref(params2.resolvedByEmail || null);
|
|
3501
3502
|
const resolvedByName = ref(params2.resolvedByName || null);
|
|
3502
|
-
const resolveComment = ({ email, name, superdoc
|
|
3503
|
+
const resolveComment = ({ email, name, superdoc }) => {
|
|
3503
3504
|
if (resolvedTime.value) return;
|
|
3504
3505
|
resolvedTime.value = Date.now();
|
|
3505
3506
|
resolvedByEmail.value = email;
|
|
3506
3507
|
resolvedByName.value = name;
|
|
3507
3508
|
if (trackedChange.value) {
|
|
3508
3509
|
const emitData2 = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
3509
|
-
propagateUpdate(
|
|
3510
|
-
|
|
3510
|
+
propagateUpdate(superdoc, emitData2);
|
|
3511
|
+
superdoc.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
3511
3512
|
return;
|
|
3512
3513
|
}
|
|
3513
3514
|
const emitData = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
3514
|
-
propagateUpdate(
|
|
3515
|
-
|
|
3515
|
+
propagateUpdate(superdoc, emitData);
|
|
3516
|
+
superdoc.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
3516
3517
|
};
|
|
3517
|
-
const setIsInternal = ({ isInternal: newIsInternal, superdoc
|
|
3518
|
+
const setIsInternal = ({ isInternal: newIsInternal, superdoc }) => {
|
|
3518
3519
|
const previousValue = isInternal.value;
|
|
3519
3520
|
if (previousValue === newIsInternal) return;
|
|
3520
3521
|
isInternal.value = newIsInternal;
|
|
@@ -3523,16 +3524,16 @@ function useComment(params2) {
|
|
|
3523
3524
|
changes: [{ key: "isInternal", value: newIsInternal, previousValue }],
|
|
3524
3525
|
comment: getValues()
|
|
3525
3526
|
};
|
|
3526
|
-
propagateUpdate(
|
|
3527
|
-
const activeEditor =
|
|
3527
|
+
propagateUpdate(superdoc, emitData);
|
|
3528
|
+
const activeEditor = superdoc.activeEditor;
|
|
3528
3529
|
if (!activeEditor) return;
|
|
3529
3530
|
activeEditor.commands.setCommentInternal({ commentId, importedId, isInternal: newIsInternal });
|
|
3530
3531
|
};
|
|
3531
|
-
const setActive = (
|
|
3532
|
-
const { activeEditor } =
|
|
3532
|
+
const setActive = (superdoc) => {
|
|
3533
|
+
const { activeEditor } = superdoc;
|
|
3533
3534
|
activeEditor?.commands.setActiveComment({ commentId, importedId });
|
|
3534
3535
|
};
|
|
3535
|
-
const setText = ({ text, superdoc
|
|
3536
|
+
const setText = ({ text, superdoc, suppressUpdate }) => {
|
|
3536
3537
|
commentText.value = text;
|
|
3537
3538
|
mentions.value = extractMentions(text);
|
|
3538
3539
|
if (suppressUpdate) return;
|
|
@@ -3541,7 +3542,7 @@ function useComment(params2) {
|
|
|
3541
3542
|
changes: [{ key: "text", value: text }],
|
|
3542
3543
|
comment: getValues()
|
|
3543
3544
|
};
|
|
3544
|
-
propagateUpdate(
|
|
3545
|
+
propagateUpdate(superdoc, emitData);
|
|
3545
3546
|
};
|
|
3546
3547
|
const extractMentions = (htmlString) => {
|
|
3547
3548
|
const parser = new DOMParser();
|
|
@@ -3578,9 +3579,9 @@ function useComment(params2) {
|
|
|
3578
3579
|
const user = importedAuthor.value ? { name: importedAuthor.value.name || "(Imported)", email: importedAuthor.value.email } : { name: creatorName, email: creatorEmail, image: creatorImage };
|
|
3579
3580
|
return user;
|
|
3580
3581
|
};
|
|
3581
|
-
const propagateUpdate = (
|
|
3582
|
-
|
|
3583
|
-
syncCommentsToClients(
|
|
3582
|
+
const propagateUpdate = (superdoc, event) => {
|
|
3583
|
+
superdoc.emit("comments-update", event);
|
|
3584
|
+
syncCommentsToClients(superdoc, event);
|
|
3584
3585
|
};
|
|
3585
3586
|
const getValues = () => {
|
|
3586
3587
|
return {
|
|
@@ -4005,21 +4006,21 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4005
4006
|
if (id === void 0 || id === null) return null;
|
|
4006
4007
|
return commentsList.value.find((c2) => c2.commentId == id || c2.importedId == id);
|
|
4007
4008
|
};
|
|
4008
|
-
const setActiveComment = (
|
|
4009
|
+
const setActiveComment = (superdoc, id) => {
|
|
4009
4010
|
if (id === void 0 || id === null) {
|
|
4010
4011
|
activeComment.value = null;
|
|
4011
|
-
if (
|
|
4012
|
-
|
|
4012
|
+
if (superdoc.activeEditor) {
|
|
4013
|
+
superdoc.activeEditor.commands?.setActiveComment({ commentId: null });
|
|
4013
4014
|
}
|
|
4014
4015
|
return;
|
|
4015
4016
|
}
|
|
4016
4017
|
const comment = getComment(id);
|
|
4017
4018
|
if (comment) activeComment.value = comment.commentId;
|
|
4018
|
-
if (
|
|
4019
|
-
|
|
4019
|
+
if (superdoc.activeEditor) {
|
|
4020
|
+
superdoc.activeEditor.commands?.setActiveComment({ commentId: activeComment.value });
|
|
4020
4021
|
}
|
|
4021
4022
|
};
|
|
4022
|
-
const handleTrackedChangeUpdate = ({ superdoc
|
|
4023
|
+
const handleTrackedChangeUpdate = ({ superdoc, params: params2 }) => {
|
|
4023
4024
|
const {
|
|
4024
4025
|
event,
|
|
4025
4026
|
changeId,
|
|
@@ -4052,7 +4053,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4052
4053
|
}
|
|
4053
4054
|
});
|
|
4054
4055
|
if (event === "add") {
|
|
4055
|
-
addComment({ superdoc
|
|
4056
|
+
addComment({ superdoc, comment });
|
|
4056
4057
|
} else if (event === "update") {
|
|
4057
4058
|
const existingTrackedChange = commentsList.value.find((comment2) => comment2.commentId === changeId);
|
|
4058
4059
|
if (!existingTrackedChange) return;
|
|
@@ -4064,33 +4065,33 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4064
4065
|
type: COMMENT_EVENTS.UPDATE,
|
|
4065
4066
|
comment: existingTrackedChange.getValues()
|
|
4066
4067
|
};
|
|
4067
|
-
syncCommentsToClients(
|
|
4068
|
-
debounceEmit(changeId, emitData,
|
|
4068
|
+
syncCommentsToClients(superdoc, emitData);
|
|
4069
|
+
debounceEmit(changeId, emitData, superdoc);
|
|
4069
4070
|
}
|
|
4070
4071
|
};
|
|
4071
|
-
const debounceEmit = (commentId, event,
|
|
4072
|
+
const debounceEmit = (commentId, event, superdoc, delay = 1e3) => {
|
|
4072
4073
|
if (debounceTimers[commentId]) {
|
|
4073
4074
|
clearTimeout(debounceTimers[commentId]);
|
|
4074
4075
|
}
|
|
4075
4076
|
debounceTimers[commentId] = setTimeout(() => {
|
|
4076
|
-
if (
|
|
4077
|
-
|
|
4077
|
+
if (superdoc) {
|
|
4078
|
+
superdoc.emit("comments-update", event);
|
|
4078
4079
|
}
|
|
4079
4080
|
delete debounceTimers[commentId];
|
|
4080
4081
|
}, delay);
|
|
4081
4082
|
};
|
|
4082
|
-
const showAddComment = (
|
|
4083
|
+
const showAddComment = (superdoc) => {
|
|
4083
4084
|
const event = { type: COMMENT_EVENTS.PENDING };
|
|
4084
|
-
|
|
4085
|
+
superdoc.emit("comments-update", event);
|
|
4085
4086
|
const selection = { ...superdocStore.activeSelection };
|
|
4086
4087
|
selection.selectionBounds = { ...selection.selectionBounds };
|
|
4087
4088
|
if (superdocStore.selectionPosition?.source) {
|
|
4088
4089
|
superdocStore.selectionPosition.source = null;
|
|
4089
4090
|
}
|
|
4090
4091
|
pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
|
|
4091
|
-
if (!
|
|
4092
|
-
if (
|
|
4093
|
-
|
|
4092
|
+
if (!superdoc.config.isInternal) pendingComment.value.isInternal = false;
|
|
4093
|
+
if (superdoc.activeEditor?.commands) {
|
|
4094
|
+
superdoc.activeEditor.commands.insertComment({
|
|
4094
4095
|
...pendingComment.value.getValues(),
|
|
4095
4096
|
commentId: "pending",
|
|
4096
4097
|
skipEmit: true
|
|
@@ -4160,14 +4161,14 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4160
4161
|
...options
|
|
4161
4162
|
});
|
|
4162
4163
|
};
|
|
4163
|
-
const removePendingComment = (
|
|
4164
|
+
const removePendingComment = (superdoc) => {
|
|
4164
4165
|
currentCommentText.value = "";
|
|
4165
4166
|
pendingComment.value = null;
|
|
4166
4167
|
activeComment.value = null;
|
|
4167
4168
|
superdocStore.selectionPosition = null;
|
|
4168
|
-
|
|
4169
|
+
superdoc.activeEditor?.commands.removeComment({ commentId: "pending" });
|
|
4169
4170
|
};
|
|
4170
|
-
const addComment = ({ superdoc
|
|
4171
|
+
const addComment = ({ superdoc, comment, skipEditorUpdate = false }) => {
|
|
4171
4172
|
let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
|
|
4172
4173
|
if (!parentComment) parentComment = comment;
|
|
4173
4174
|
const newComment = useComment(comment.getValues());
|
|
@@ -4178,22 +4179,22 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4178
4179
|
const isParentInternal = parentComment.isInternal;
|
|
4179
4180
|
newComment.isInternal = isParentInternal;
|
|
4180
4181
|
}
|
|
4181
|
-
if (!
|
|
4182
|
+
if (!superdoc.config.isInternal) newComment.isInternal = false;
|
|
4182
4183
|
commentsList.value.push(newComment);
|
|
4183
|
-
removePendingComment(
|
|
4184
|
-
if (!skipEditorUpdate && !comment.trackedChange &&
|
|
4185
|
-
|
|
4184
|
+
removePendingComment(superdoc);
|
|
4185
|
+
if (!skipEditorUpdate && !comment.trackedChange && superdoc.activeEditor?.commands && !comment.parentCommentId) {
|
|
4186
|
+
superdoc.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
|
|
4186
4187
|
}
|
|
4187
4188
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
4188
|
-
syncCommentsToClients(
|
|
4189
|
-
|
|
4189
|
+
syncCommentsToClients(superdoc, event);
|
|
4190
|
+
superdoc.emit("comments-update", event);
|
|
4190
4191
|
};
|
|
4191
|
-
const deleteComment = ({ commentId: commentIdToDelete, superdoc
|
|
4192
|
+
const deleteComment = ({ commentId: commentIdToDelete, superdoc }) => {
|
|
4192
4193
|
const commentIndex = commentsList.value.findIndex((c2) => c2.commentId === commentIdToDelete);
|
|
4193
4194
|
const comment = commentsList.value[commentIndex];
|
|
4194
4195
|
const { commentId, importedId } = comment;
|
|
4195
4196
|
const { fileId } = comment;
|
|
4196
|
-
|
|
4197
|
+
superdoc.activeEditor?.commands?.removeComment({ commentId, importedId });
|
|
4197
4198
|
commentsList.value.splice(commentIndex, 1);
|
|
4198
4199
|
const childCommentIds = commentsList.value.filter((c2) => c2.parentCommentId === commentId).map((c2) => c2.commentId || c2.importedId);
|
|
4199
4200
|
commentsList.value = commentsList.value.filter((c2) => !childCommentIds.includes(c2.commentId));
|
|
@@ -4202,13 +4203,13 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4202
4203
|
comment: comment.getValues(),
|
|
4203
4204
|
changes: [{ key: "deleted", commentId, fileId }]
|
|
4204
4205
|
};
|
|
4205
|
-
|
|
4206
|
-
syncCommentsToClients(
|
|
4206
|
+
superdoc.emit("comments-update", event);
|
|
4207
|
+
syncCommentsToClients(superdoc, event);
|
|
4207
4208
|
};
|
|
4208
|
-
const cancelComment = (
|
|
4209
|
-
removePendingComment(
|
|
4209
|
+
const cancelComment = (superdoc) => {
|
|
4210
|
+
removePendingComment(superdoc);
|
|
4210
4211
|
};
|
|
4211
|
-
const processLoadedDocxComments = async ({ superdoc
|
|
4212
|
+
const processLoadedDocxComments = async ({ superdoc, editor, comments, documentId }) => {
|
|
4212
4213
|
const document2 = superdocStore.getDocument(documentId);
|
|
4213
4214
|
comments.forEach((comment) => {
|
|
4214
4215
|
const htmlContent = getHtmlFromComment(comment.textJson);
|
|
@@ -4240,7 +4241,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4240
4241
|
trackedChangeType: comment.trackedChangeType,
|
|
4241
4242
|
deletedText: comment.trackedDeletedText
|
|
4242
4243
|
});
|
|
4243
|
-
addComment({ superdoc
|
|
4244
|
+
addComment({ superdoc, comment: newComment });
|
|
4244
4245
|
});
|
|
4245
4246
|
setTimeout(() => {
|
|
4246
4247
|
createCommentForTrackChanges(editor);
|
|
@@ -16520,12 +16521,12 @@ class SuperComments extends EventEmitter {
|
|
|
16520
16521
|
element: null,
|
|
16521
16522
|
commentsStore: null
|
|
16522
16523
|
};
|
|
16523
|
-
constructor(options,
|
|
16524
|
+
constructor(options, superdoc) {
|
|
16524
16525
|
super();
|
|
16525
16526
|
this.config = { ...this.config, ...options };
|
|
16526
16527
|
this.element = this.config.element;
|
|
16527
16528
|
this.app = null;
|
|
16528
|
-
this.superdoc =
|
|
16529
|
+
this.superdoc = superdoc;
|
|
16529
16530
|
this.open();
|
|
16530
16531
|
}
|
|
16531
16532
|
createVueApp() {
|
|
@@ -17464,7 +17465,7 @@ const _sfc_main = {
|
|
|
17464
17465
|
__name: "SuperDoc",
|
|
17465
17466
|
emits: ["selection-update"],
|
|
17466
17467
|
setup(__props, { emit: __emit }) {
|
|
17467
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17468
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CCU0Mzny.es.js"));
|
|
17468
17469
|
const superdocStore = useSuperdocStore();
|
|
17469
17470
|
const commentsStore = useCommentsStore();
|
|
17470
17471
|
const {
|
|
@@ -18368,7 +18369,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18368
18369
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18369
18370
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18370
18371
|
this.colorIndex = 0;
|
|
18371
|
-
this.version = "1.0.0-next.
|
|
18372
|
+
this.version = "1.0.0-next.7";
|
|
18372
18373
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18373
18374
|
this.superdocId = config.superdocId || v4();
|
|
18374
18375
|
this.colors = this.config.colors;
|