@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,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-q8FicN0U.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-DfbOKJbz.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-D_13cWx3.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, user) => {
|
|
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 }
|
|
3338
3338
|
);
|
|
3339
3339
|
};
|
|
3340
|
-
const updateYComment = (yArray, ydoc, event) => {
|
|
3340
|
+
const updateYComment = (yArray, ydoc, event, user) => {
|
|
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) => {
|
|
|
3347
3347
|
yArray.delete(commentIndex, 1);
|
|
3348
3348
|
yArray.insert(commentIndex, [yComment]);
|
|
3349
3349
|
},
|
|
3350
|
-
{ user
|
|
3350
|
+
{ user }
|
|
3351
3351
|
);
|
|
3352
3352
|
};
|
|
3353
|
-
const deleteYComment = (yArray, ydoc, event) => {
|
|
3353
|
+
const deleteYComment = (yArray, ydoc, event, user) => {
|
|
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) => {
|
|
|
3358
3358
|
() => {
|
|
3359
3359
|
yArray.delete(commentIndex, 1);
|
|
3360
3360
|
},
|
|
3361
|
-
{ user
|
|
3361
|
+
{ 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 = (superdoc) => {
|
|
3369
|
+
if (!superdoc.config.modules.comments || !superdoc.provider) return;
|
|
3370
3370
|
const onSuperDocYdocSynced = () => {
|
|
3371
|
-
const parent =
|
|
3372
|
-
const ids =
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3371
|
+
const parent = superdoc.commentsStore.commentsParentElement;
|
|
3372
|
+
const ids = superdoc.commentsStore.editorCommentIds;
|
|
3373
|
+
superdoc.commentsStore.handleEditorLocationsUpdate(parent, ids);
|
|
3374
|
+
superdoc.commentsStore.hasSyncedCollaborationComments = true;
|
|
3375
|
+
superdoc.provider.off("synced", onSuperDocYdocSynced);
|
|
3376
3376
|
};
|
|
3377
|
-
|
|
3378
|
-
const commentsArray =
|
|
3377
|
+
superdoc.provider.on("synced", onSuperDocYdocSynced);
|
|
3378
|
+
const commentsArray = superdoc.ydoc.getArray("comments");
|
|
3379
3379
|
commentsArray.observe((event) => {
|
|
3380
|
-
const currentUser =
|
|
3380
|
+
const currentUser = superdoc.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,59 +3389,60 @@ const initCollaborationComments = (superdoc2) => {
|
|
|
3389
3389
|
filtered.push(c2);
|
|
3390
3390
|
}
|
|
3391
3391
|
});
|
|
3392
|
-
|
|
3392
|
+
superdoc.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 = (superdoc) => {
|
|
3396
|
+
const { isInternal } = superdoc.config;
|
|
3397
|
+
const baseName = `${superdoc.config.superdocId}-superdoc`;
|
|
3398
|
+
if (!superdoc.config.superdocId) return;
|
|
3399
3399
|
const documentId = isInternal ? baseName : `${baseName}-external`;
|
|
3400
3400
|
const superdocCollaborationOptions = {
|
|
3401
|
-
config:
|
|
3402
|
-
user:
|
|
3401
|
+
config: superdoc.config.modules.collaboration,
|
|
3402
|
+
user: superdoc.config.user,
|
|
3403
3403
|
documentId,
|
|
3404
|
-
socket:
|
|
3405
|
-
superdocInstance:
|
|
3404
|
+
socket: superdoc.config.socket,
|
|
3405
|
+
superdocInstance: superdoc
|
|
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 = (superdoc) => {
|
|
3411
3411
|
const processedDocuments = [];
|
|
3412
|
-
|
|
3413
|
-
|
|
3412
|
+
superdoc.config.documents.forEach((doc) => {
|
|
3413
|
+
superdoc.config.user.color = superdoc.colors[0];
|
|
3414
3414
|
const options = {
|
|
3415
|
-
config:
|
|
3416
|
-
user:
|
|
3415
|
+
config: superdoc.config.modules.collaboration,
|
|
3416
|
+
user: superdoc.config.user,
|
|
3417
3417
|
documentId: doc.id,
|
|
3418
|
-
socket:
|
|
3419
|
-
superdocInstance:
|
|
3418
|
+
socket: superdoc.config.socket,
|
|
3419
|
+
superdocInstance: superdoc
|
|
3420
3420
|
};
|
|
3421
3421
|
const { provider: provider2, ydoc } = createProvider(options);
|
|
3422
3422
|
doc.provider = provider2;
|
|
3423
|
-
doc.socket =
|
|
3423
|
+
doc.socket = superdoc.config.socket;
|
|
3424
3424
|
doc.ydoc = ydoc;
|
|
3425
|
-
doc.role =
|
|
3425
|
+
doc.role = superdoc.config.role;
|
|
3426
3426
|
processedDocuments.push(doc);
|
|
3427
3427
|
});
|
|
3428
3428
|
return processedDocuments;
|
|
3429
3429
|
};
|
|
3430
|
-
const syncCommentsToClients = (
|
|
3431
|
-
if (!
|
|
3432
|
-
const yArray =
|
|
3430
|
+
const syncCommentsToClients = (superdoc, event) => {
|
|
3431
|
+
if (!superdoc.isCollaborative || !superdoc.config.modules.comments) return;
|
|
3432
|
+
const yArray = superdoc.ydoc.getArray("comments");
|
|
3433
|
+
const user = superdoc.config.user;
|
|
3433
3434
|
switch (event.type) {
|
|
3434
3435
|
case "add":
|
|
3435
|
-
addYComment(yArray,
|
|
3436
|
+
addYComment(yArray, superdoc.ydoc, event, user);
|
|
3436
3437
|
break;
|
|
3437
3438
|
case "update":
|
|
3438
|
-
updateYComment(yArray,
|
|
3439
|
+
updateYComment(yArray, superdoc.ydoc, event, user);
|
|
3439
3440
|
break;
|
|
3440
3441
|
case "resolved":
|
|
3441
|
-
updateYComment(yArray,
|
|
3442
|
+
updateYComment(yArray, superdoc.ydoc, event, user);
|
|
3442
3443
|
break;
|
|
3443
3444
|
case "deleted":
|
|
3444
|
-
deleteYComment(yArray,
|
|
3445
|
+
deleteYComment(yArray, superdoc.ydoc, event, user);
|
|
3445
3446
|
break;
|
|
3446
3447
|
}
|
|
3447
3448
|
};
|
|
@@ -3516,22 +3517,22 @@ function useComment(params2) {
|
|
|
3516
3517
|
const resolvedTime = vue.ref(params2.resolvedTime || null);
|
|
3517
3518
|
const resolvedByEmail = vue.ref(params2.resolvedByEmail || null);
|
|
3518
3519
|
const resolvedByName = vue.ref(params2.resolvedByName || null);
|
|
3519
|
-
const resolveComment = ({ email, name, superdoc
|
|
3520
|
+
const resolveComment = ({ email, name, superdoc }) => {
|
|
3520
3521
|
if (resolvedTime.value) return;
|
|
3521
3522
|
resolvedTime.value = Date.now();
|
|
3522
3523
|
resolvedByEmail.value = email;
|
|
3523
3524
|
resolvedByName.value = name;
|
|
3524
3525
|
if (trackedChange.value) {
|
|
3525
3526
|
const emitData2 = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
3526
|
-
propagateUpdate(
|
|
3527
|
-
|
|
3527
|
+
propagateUpdate(superdoc, emitData2);
|
|
3528
|
+
superdoc.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
3528
3529
|
return;
|
|
3529
3530
|
}
|
|
3530
3531
|
const emitData = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
3531
|
-
propagateUpdate(
|
|
3532
|
-
|
|
3532
|
+
propagateUpdate(superdoc, emitData);
|
|
3533
|
+
superdoc.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
3533
3534
|
};
|
|
3534
|
-
const setIsInternal = ({ isInternal: newIsInternal, superdoc
|
|
3535
|
+
const setIsInternal = ({ isInternal: newIsInternal, superdoc }) => {
|
|
3535
3536
|
const previousValue = isInternal.value;
|
|
3536
3537
|
if (previousValue === newIsInternal) return;
|
|
3537
3538
|
isInternal.value = newIsInternal;
|
|
@@ -3540,16 +3541,16 @@ function useComment(params2) {
|
|
|
3540
3541
|
changes: [{ key: "isInternal", value: newIsInternal, previousValue }],
|
|
3541
3542
|
comment: getValues()
|
|
3542
3543
|
};
|
|
3543
|
-
propagateUpdate(
|
|
3544
|
-
const activeEditor =
|
|
3544
|
+
propagateUpdate(superdoc, emitData);
|
|
3545
|
+
const activeEditor = superdoc.activeEditor;
|
|
3545
3546
|
if (!activeEditor) return;
|
|
3546
3547
|
activeEditor.commands.setCommentInternal({ commentId, importedId, isInternal: newIsInternal });
|
|
3547
3548
|
};
|
|
3548
|
-
const setActive = (
|
|
3549
|
-
const { activeEditor } =
|
|
3549
|
+
const setActive = (superdoc) => {
|
|
3550
|
+
const { activeEditor } = superdoc;
|
|
3550
3551
|
activeEditor?.commands.setActiveComment({ commentId, importedId });
|
|
3551
3552
|
};
|
|
3552
|
-
const setText = ({ text, superdoc
|
|
3553
|
+
const setText = ({ text, superdoc, suppressUpdate }) => {
|
|
3553
3554
|
commentText.value = text;
|
|
3554
3555
|
mentions.value = extractMentions(text);
|
|
3555
3556
|
if (suppressUpdate) return;
|
|
@@ -3558,7 +3559,7 @@ function useComment(params2) {
|
|
|
3558
3559
|
changes: [{ key: "text", value: text }],
|
|
3559
3560
|
comment: getValues()
|
|
3560
3561
|
};
|
|
3561
|
-
propagateUpdate(
|
|
3562
|
+
propagateUpdate(superdoc, emitData);
|
|
3562
3563
|
};
|
|
3563
3564
|
const extractMentions = (htmlString) => {
|
|
3564
3565
|
const parser = new DOMParser();
|
|
@@ -3595,9 +3596,9 @@ function useComment(params2) {
|
|
|
3595
3596
|
const user = importedAuthor.value ? { name: importedAuthor.value.name || "(Imported)", email: importedAuthor.value.email } : { name: creatorName, email: creatorEmail, image: creatorImage };
|
|
3596
3597
|
return user;
|
|
3597
3598
|
};
|
|
3598
|
-
const propagateUpdate = (
|
|
3599
|
-
|
|
3600
|
-
syncCommentsToClients(
|
|
3599
|
+
const propagateUpdate = (superdoc, event) => {
|
|
3600
|
+
superdoc.emit("comments-update", event);
|
|
3601
|
+
syncCommentsToClients(superdoc, event);
|
|
3601
3602
|
};
|
|
3602
3603
|
const getValues = () => {
|
|
3603
3604
|
return {
|
|
@@ -4022,21 +4023,21 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4022
4023
|
if (id === void 0 || id === null) return null;
|
|
4023
4024
|
return commentsList.value.find((c2) => c2.commentId == id || c2.importedId == id);
|
|
4024
4025
|
};
|
|
4025
|
-
const setActiveComment = (
|
|
4026
|
+
const setActiveComment = (superdoc, id) => {
|
|
4026
4027
|
if (id === void 0 || id === null) {
|
|
4027
4028
|
activeComment.value = null;
|
|
4028
|
-
if (
|
|
4029
|
-
|
|
4029
|
+
if (superdoc.activeEditor) {
|
|
4030
|
+
superdoc.activeEditor.commands?.setActiveComment({ commentId: null });
|
|
4030
4031
|
}
|
|
4031
4032
|
return;
|
|
4032
4033
|
}
|
|
4033
4034
|
const comment = getComment(id);
|
|
4034
4035
|
if (comment) activeComment.value = comment.commentId;
|
|
4035
|
-
if (
|
|
4036
|
-
|
|
4036
|
+
if (superdoc.activeEditor) {
|
|
4037
|
+
superdoc.activeEditor.commands?.setActiveComment({ commentId: activeComment.value });
|
|
4037
4038
|
}
|
|
4038
4039
|
};
|
|
4039
|
-
const handleTrackedChangeUpdate = ({ superdoc
|
|
4040
|
+
const handleTrackedChangeUpdate = ({ superdoc, params: params2 }) => {
|
|
4040
4041
|
const {
|
|
4041
4042
|
event,
|
|
4042
4043
|
changeId,
|
|
@@ -4069,7 +4070,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4069
4070
|
}
|
|
4070
4071
|
});
|
|
4071
4072
|
if (event === "add") {
|
|
4072
|
-
addComment({ superdoc
|
|
4073
|
+
addComment({ superdoc, comment });
|
|
4073
4074
|
} else if (event === "update") {
|
|
4074
4075
|
const existingTrackedChange = commentsList.value.find((comment2) => comment2.commentId === changeId);
|
|
4075
4076
|
if (!existingTrackedChange) return;
|
|
@@ -4081,33 +4082,33 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4081
4082
|
type: COMMENT_EVENTS.UPDATE,
|
|
4082
4083
|
comment: existingTrackedChange.getValues()
|
|
4083
4084
|
};
|
|
4084
|
-
syncCommentsToClients(
|
|
4085
|
-
debounceEmit(changeId, emitData,
|
|
4085
|
+
syncCommentsToClients(superdoc, emitData);
|
|
4086
|
+
debounceEmit(changeId, emitData, superdoc);
|
|
4086
4087
|
}
|
|
4087
4088
|
};
|
|
4088
|
-
const debounceEmit = (commentId, event,
|
|
4089
|
+
const debounceEmit = (commentId, event, superdoc, delay = 1e3) => {
|
|
4089
4090
|
if (debounceTimers[commentId]) {
|
|
4090
4091
|
clearTimeout(debounceTimers[commentId]);
|
|
4091
4092
|
}
|
|
4092
4093
|
debounceTimers[commentId] = setTimeout(() => {
|
|
4093
|
-
if (
|
|
4094
|
-
|
|
4094
|
+
if (superdoc) {
|
|
4095
|
+
superdoc.emit("comments-update", event);
|
|
4095
4096
|
}
|
|
4096
4097
|
delete debounceTimers[commentId];
|
|
4097
4098
|
}, delay);
|
|
4098
4099
|
};
|
|
4099
|
-
const showAddComment = (
|
|
4100
|
+
const showAddComment = (superdoc) => {
|
|
4100
4101
|
const event = { type: COMMENT_EVENTS.PENDING };
|
|
4101
|
-
|
|
4102
|
+
superdoc.emit("comments-update", event);
|
|
4102
4103
|
const selection = { ...superdocStore.activeSelection };
|
|
4103
4104
|
selection.selectionBounds = { ...selection.selectionBounds };
|
|
4104
4105
|
if (superdocStore.selectionPosition?.source) {
|
|
4105
4106
|
superdocStore.selectionPosition.source = null;
|
|
4106
4107
|
}
|
|
4107
4108
|
pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
|
|
4108
|
-
if (!
|
|
4109
|
-
if (
|
|
4110
|
-
|
|
4109
|
+
if (!superdoc.config.isInternal) pendingComment.value.isInternal = false;
|
|
4110
|
+
if (superdoc.activeEditor?.commands) {
|
|
4111
|
+
superdoc.activeEditor.commands.insertComment({
|
|
4111
4112
|
...pendingComment.value.getValues(),
|
|
4112
4113
|
commentId: "pending",
|
|
4113
4114
|
skipEmit: true
|
|
@@ -4177,14 +4178,14 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4177
4178
|
...options
|
|
4178
4179
|
});
|
|
4179
4180
|
};
|
|
4180
|
-
const removePendingComment = (
|
|
4181
|
+
const removePendingComment = (superdoc) => {
|
|
4181
4182
|
currentCommentText.value = "";
|
|
4182
4183
|
pendingComment.value = null;
|
|
4183
4184
|
activeComment.value = null;
|
|
4184
4185
|
superdocStore.selectionPosition = null;
|
|
4185
|
-
|
|
4186
|
+
superdoc.activeEditor?.commands.removeComment({ commentId: "pending" });
|
|
4186
4187
|
};
|
|
4187
|
-
const addComment = ({ superdoc
|
|
4188
|
+
const addComment = ({ superdoc, comment, skipEditorUpdate = false }) => {
|
|
4188
4189
|
let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
|
|
4189
4190
|
if (!parentComment) parentComment = comment;
|
|
4190
4191
|
const newComment = useComment(comment.getValues());
|
|
@@ -4195,22 +4196,22 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4195
4196
|
const isParentInternal = parentComment.isInternal;
|
|
4196
4197
|
newComment.isInternal = isParentInternal;
|
|
4197
4198
|
}
|
|
4198
|
-
if (!
|
|
4199
|
+
if (!superdoc.config.isInternal) newComment.isInternal = false;
|
|
4199
4200
|
commentsList.value.push(newComment);
|
|
4200
|
-
removePendingComment(
|
|
4201
|
-
if (!skipEditorUpdate && !comment.trackedChange &&
|
|
4202
|
-
|
|
4201
|
+
removePendingComment(superdoc);
|
|
4202
|
+
if (!skipEditorUpdate && !comment.trackedChange && superdoc.activeEditor?.commands && !comment.parentCommentId) {
|
|
4203
|
+
superdoc.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
|
|
4203
4204
|
}
|
|
4204
4205
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
4205
|
-
syncCommentsToClients(
|
|
4206
|
-
|
|
4206
|
+
syncCommentsToClients(superdoc, event);
|
|
4207
|
+
superdoc.emit("comments-update", event);
|
|
4207
4208
|
};
|
|
4208
|
-
const deleteComment = ({ commentId: commentIdToDelete, superdoc
|
|
4209
|
+
const deleteComment = ({ commentId: commentIdToDelete, superdoc }) => {
|
|
4209
4210
|
const commentIndex = commentsList.value.findIndex((c2) => c2.commentId === commentIdToDelete);
|
|
4210
4211
|
const comment = commentsList.value[commentIndex];
|
|
4211
4212
|
const { commentId, importedId } = comment;
|
|
4212
4213
|
const { fileId } = comment;
|
|
4213
|
-
|
|
4214
|
+
superdoc.activeEditor?.commands?.removeComment({ commentId, importedId });
|
|
4214
4215
|
commentsList.value.splice(commentIndex, 1);
|
|
4215
4216
|
const childCommentIds = commentsList.value.filter((c2) => c2.parentCommentId === commentId).map((c2) => c2.commentId || c2.importedId);
|
|
4216
4217
|
commentsList.value = commentsList.value.filter((c2) => !childCommentIds.includes(c2.commentId));
|
|
@@ -4219,13 +4220,13 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4219
4220
|
comment: comment.getValues(),
|
|
4220
4221
|
changes: [{ key: "deleted", commentId, fileId }]
|
|
4221
4222
|
};
|
|
4222
|
-
|
|
4223
|
-
syncCommentsToClients(
|
|
4223
|
+
superdoc.emit("comments-update", event);
|
|
4224
|
+
syncCommentsToClients(superdoc, event);
|
|
4224
4225
|
};
|
|
4225
|
-
const cancelComment = (
|
|
4226
|
-
removePendingComment(
|
|
4226
|
+
const cancelComment = (superdoc) => {
|
|
4227
|
+
removePendingComment(superdoc);
|
|
4227
4228
|
};
|
|
4228
|
-
const processLoadedDocxComments = async ({ superdoc
|
|
4229
|
+
const processLoadedDocxComments = async ({ superdoc, editor, comments, documentId }) => {
|
|
4229
4230
|
const document2 = superdocStore.getDocument(documentId);
|
|
4230
4231
|
comments.forEach((comment) => {
|
|
4231
4232
|
const htmlContent = getHtmlFromComment(comment.textJson);
|
|
@@ -4257,7 +4258,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4257
4258
|
trackedChangeType: comment.trackedChangeType,
|
|
4258
4259
|
deletedText: comment.trackedDeletedText
|
|
4259
4260
|
});
|
|
4260
|
-
addComment({ superdoc
|
|
4261
|
+
addComment({ superdoc, comment: newComment });
|
|
4261
4262
|
});
|
|
4262
4263
|
setTimeout(() => {
|
|
4263
4264
|
createCommentForTrackChanges(editor);
|
|
@@ -16537,12 +16538,12 @@ class SuperComments extends eventemitter3.EventEmitter {
|
|
|
16537
16538
|
element: null,
|
|
16538
16539
|
commentsStore: null
|
|
16539
16540
|
};
|
|
16540
|
-
constructor(options,
|
|
16541
|
+
constructor(options, superdoc) {
|
|
16541
16542
|
super();
|
|
16542
16543
|
this.config = { ...this.config, ...options };
|
|
16543
16544
|
this.element = this.config.element;
|
|
16544
16545
|
this.app = null;
|
|
16545
|
-
this.superdoc =
|
|
16546
|
+
this.superdoc = superdoc;
|
|
16546
16547
|
this.open();
|
|
16547
16548
|
}
|
|
16548
16549
|
createVueApp() {
|
|
@@ -17481,7 +17482,7 @@ const _sfc_main = {
|
|
|
17481
17482
|
__name: "SuperDoc",
|
|
17482
17483
|
emits: ["selection-update"],
|
|
17483
17484
|
setup(__props, { emit: __emit }) {
|
|
17484
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17485
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Ca1KqMaU.cjs")));
|
|
17485
17486
|
const superdocStore = useSuperdocStore();
|
|
17486
17487
|
const commentsStore = useCommentsStore();
|
|
17487
17488
|
const {
|
|
@@ -18385,7 +18386,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18385
18386
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18386
18387
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18387
18388
|
this.colorIndex = 0;
|
|
18388
|
-
this.version = "1.0.0-next.
|
|
18389
|
+
this.version = "1.0.0-next.7";
|
|
18389
18390
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18390
18391
|
this.superdocId = config.superdocId || uuid.v4();
|
|
18391
18392
|
this.colors = this.config.colors;
|
|
@@ -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-D_13cWx3.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|