@harbour-enterprises/superdoc 0.23.0-next.1 → 0.23.0-next.11
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-C9SGNZr6.cjs → PdfViewer-CxsRHFKK.cjs} +2 -2
- package/dist/chunks/{PdfViewer-D9atA783.es.js → PdfViewer-itEb8CY_.es.js} +2 -2
- package/dist/chunks/{eventemitter3-CZv6vEhA.es.js → eventemitter3-CR2eBWft.es.js} +1 -1
- package/dist/chunks/{eventemitter3-B_kO1Pxm.cjs → eventemitter3-DSRogsNq.cjs} +1 -1
- package/dist/chunks/{index-C8q6lenv.es.js → index-CTFsQkQh.es.js} +75 -28
- package/dist/chunks/{index-CIbe1VMu.cjs → index-DO0hDjEd.cjs} +75 -28
- package/dist/chunks/{jszip-b7l8QkfH.cjs → jszip-B4LDL19y.cjs} +1 -1
- package/dist/chunks/{jszip-B8KIZSNe.es.js → jszip-DAXEPCUv.es.js} +1 -1
- package/dist/chunks/{super-editor.es-DxScE0ep.cjs → super-editor.es-Ck_zDasU.cjs} +259 -86
- package/dist/chunks/{super-editor.es-Dj6Sxtr7.es.js → super-editor.es-D2K5zQwY.es.js} +259 -86
- package/dist/chunks/{vue-DWle4Cai.cjs → vue-DKMj1I9B.cjs} +39 -42
- package/dist/chunks/{vue-CXxsqYcP.es.js → vue-ZWZLQtoU.es.js} +39 -42
- package/dist/chunks/xml-js-Bbc0NeKa.es.js +2 -0
- package/dist/chunks/xml-js-CWV8R-ek.cjs +3 -0
- package/dist/core/SuperDoc.d.ts +5 -18
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +29 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/stores/comments-store.d.ts +3 -3
- package/dist/stores/comments-store.d.ts.map +1 -1
- package/dist/stores/superdoc-store.d.ts.map +1 -1
- package/dist/style.css +73 -54
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-C08GQjNi.js → converter-ClnqoStR.js} +18 -19
- package/dist/super-editor/chunks/{docx-zipper-C3-uf2tI.js → docx-zipper-DC28ucAi.js} +1 -1
- package/dist/super-editor/chunks/{editor-C2IwVkIp.js → editor-C3VH8Ia2.js} +240 -66
- package/dist/super-editor/chunks/{toolbar-De8G_9NV.js → toolbar-BG1F_1RK.js} +4 -4
- 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/src/core/Attribute.d.ts +2 -2
- package/dist/super-editor/src/core/Schema.d.ts +2 -2
- package/dist/super-editor/src/extensions/comment/comments-plugin.d.ts +60 -0
- package/dist/super-editor/src/extensions/comment/helpers/index.d.ts +2 -0
- package/dist/super-editor/src/extensions/comment/helpers/normalize-comment-event-payload.d.ts +1 -0
- package/dist/super-editor/src/extensions/comment/helpers/update-position.d.ts +7 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/handleBase64.d.ts +4 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/imageRegistrationPlugin.d.ts +1 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/startImageUpload.d.ts +5 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsByAlias.d.ts +8 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +1 -0
- package/dist/super-editor/style.css +46 -27
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +4 -4
- package/dist/superdoc.es.js +4 -4
- package/dist/superdoc.umd.js +362 -142
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-CX8FH0He.cjs +0 -3
- package/dist/chunks/xml-js-D0tLGmKu.es.js +0 -2
package/dist/superdoc.umd.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
const Y__namespace = /* @__PURE__ */ _interopNamespaceDefault(Y);
|
|
22
22
|
/**
|
|
23
|
-
* @vue/shared v3.5.
|
|
23
|
+
* @vue/shared v3.5.22
|
|
24
24
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
25
25
|
* @license MIT
|
|
26
26
|
**/
|
|
@@ -915,7 +915,7 @@
|
|
|
915
915
|
iter._next = iter.next;
|
|
916
916
|
iter.next = () => {
|
|
917
917
|
const result = iter._next();
|
|
918
|
-
if (result.
|
|
918
|
+
if (!result.done) {
|
|
919
919
|
result.value = wrapValue(result.value);
|
|
920
920
|
}
|
|
921
921
|
return result;
|
|
@@ -1041,7 +1041,8 @@
|
|
|
1041
1041
|
return res;
|
|
1042
1042
|
}
|
|
1043
1043
|
if (isRef(res)) {
|
|
1044
|
-
|
|
1044
|
+
const value = targetIsArray && isIntegerKey(key2) ? res : res.value;
|
|
1045
|
+
return isReadonly2 && isObject$3(value) ? readonly(value) : value;
|
|
1045
1046
|
}
|
|
1046
1047
|
if (isObject$3(res)) {
|
|
1047
1048
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
@@ -2214,9 +2215,6 @@
|
|
|
2214
2215
|
insert(mainAnchor, container, anchor);
|
|
2215
2216
|
const mount2 = (container2, anchor2) => {
|
|
2216
2217
|
if (shapeFlag & 16) {
|
|
2217
|
-
if (parentComponent && parentComponent.isCE) {
|
|
2218
|
-
parentComponent.ce._teleportTarget = container2;
|
|
2219
|
-
}
|
|
2220
2218
|
mountChildren(
|
|
2221
2219
|
children,
|
|
2222
2220
|
container2,
|
|
@@ -2238,6 +2236,9 @@
|
|
|
2238
2236
|
} else if (namespace2 !== "mathml" && isTargetMathML(target)) {
|
|
2239
2237
|
namespace2 = "mathml";
|
|
2240
2238
|
}
|
|
2239
|
+
if (parentComponent && parentComponent.isCE) {
|
|
2240
|
+
(parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2241
|
+
}
|
|
2241
2242
|
if (!disabled) {
|
|
2242
2243
|
mount2(target, targetAnchor);
|
|
2243
2244
|
updateCssVars(n2, false);
|
|
@@ -3326,11 +3327,12 @@
|
|
|
3326
3327
|
}
|
|
3327
3328
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
3328
3329
|
if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
|
|
3330
|
+
const hasProps = Object.keys(props).length > 0;
|
|
3329
3331
|
return openBlock(), createBlock(
|
|
3330
3332
|
Fragment$1,
|
|
3331
3333
|
null,
|
|
3332
3334
|
[createVNode("slot", props, fallback)],
|
|
3333
|
-
64
|
|
3335
|
+
hasProps ? -2 : 64
|
|
3334
3336
|
);
|
|
3335
3337
|
}
|
|
3336
3338
|
let slot = slots[name];
|
|
@@ -6720,34 +6722,31 @@
|
|
|
6720
6722
|
return c2;
|
|
6721
6723
|
};
|
|
6722
6724
|
function h$1(type2, propsOrChildren, children) {
|
|
6723
|
-
|
|
6725
|
+
try {
|
|
6724
6726
|
setBlockTracking(-1);
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
if (isVNode(propsOrChildren)) {
|
|
6735
|
-
return doCreateVNode(type2, null, [propsOrChildren]);
|
|
6727
|
+
const l = arguments.length;
|
|
6728
|
+
if (l === 2) {
|
|
6729
|
+
if (isObject$3(propsOrChildren) && !isArray$3(propsOrChildren)) {
|
|
6730
|
+
if (isVNode(propsOrChildren)) {
|
|
6731
|
+
return createVNode(type2, null, [propsOrChildren]);
|
|
6732
|
+
}
|
|
6733
|
+
return createVNode(type2, propsOrChildren);
|
|
6734
|
+
} else {
|
|
6735
|
+
return createVNode(type2, null, propsOrChildren);
|
|
6736
6736
|
}
|
|
6737
|
-
return doCreateVNode(type2, propsOrChildren);
|
|
6738
6737
|
} else {
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
children = [children];
|
|
6738
|
+
if (l > 3) {
|
|
6739
|
+
children = Array.prototype.slice.call(arguments, 2);
|
|
6740
|
+
} else if (l === 3 && isVNode(children)) {
|
|
6741
|
+
children = [children];
|
|
6742
|
+
}
|
|
6743
|
+
return createVNode(type2, propsOrChildren, children);
|
|
6746
6744
|
}
|
|
6747
|
-
|
|
6745
|
+
} finally {
|
|
6746
|
+
setBlockTracking(1);
|
|
6748
6747
|
}
|
|
6749
6748
|
}
|
|
6750
|
-
const version$1 = "3.5.
|
|
6749
|
+
const version$1 = "3.5.22";
|
|
6751
6750
|
let policy = void 0;
|
|
6752
6751
|
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
6753
6752
|
if (tt) {
|
|
@@ -6953,11 +6952,11 @@
|
|
|
6953
6952
|
const resolve2 = () => finishLeave(el, done);
|
|
6954
6953
|
addTransitionClass(el, leaveFromClass);
|
|
6955
6954
|
if (!el._enterCancelled) {
|
|
6956
|
-
forceReflow();
|
|
6955
|
+
forceReflow(el);
|
|
6957
6956
|
addTransitionClass(el, leaveActiveClass);
|
|
6958
6957
|
} else {
|
|
6959
6958
|
addTransitionClass(el, leaveActiveClass);
|
|
6960
|
-
forceReflow();
|
|
6959
|
+
forceReflow(el);
|
|
6961
6960
|
}
|
|
6962
6961
|
nextFrame(() => {
|
|
6963
6962
|
if (!el._isLeaving) {
|
|
@@ -7100,8 +7099,9 @@
|
|
|
7100
7099
|
if (s === "auto") return 0;
|
|
7101
7100
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
7102
7101
|
}
|
|
7103
|
-
function forceReflow() {
|
|
7104
|
-
|
|
7102
|
+
function forceReflow(el) {
|
|
7103
|
+
const targetDocument = el ? el.ownerDocument : document;
|
|
7104
|
+
return targetDocument.body.offsetHeight;
|
|
7105
7105
|
}
|
|
7106
7106
|
function patchClass(el, value, isSVG2) {
|
|
7107
7107
|
const transitionClasses = el[vtcKey];
|
|
@@ -7487,7 +7487,7 @@
|
|
|
7487
7487
|
prevChildren.forEach(callPendingCbs);
|
|
7488
7488
|
prevChildren.forEach(recordPosition);
|
|
7489
7489
|
const movedChildren = prevChildren.filter(applyTranslation);
|
|
7490
|
-
forceReflow();
|
|
7490
|
+
forceReflow(instance.vnode.el);
|
|
7491
7491
|
movedChildren.forEach((c2) => {
|
|
7492
7492
|
const el = c2.el;
|
|
7493
7493
|
const style2 = el.style;
|
|
@@ -12836,6 +12836,19 @@
|
|
|
12836
12836
|
};
|
|
12837
12837
|
return safeRegexTest;
|
|
12838
12838
|
}
|
|
12839
|
+
var generatorFunction;
|
|
12840
|
+
var hasRequiredGeneratorFunction;
|
|
12841
|
+
function requireGeneratorFunction() {
|
|
12842
|
+
if (hasRequiredGeneratorFunction) return generatorFunction;
|
|
12843
|
+
hasRequiredGeneratorFunction = 1;
|
|
12844
|
+
const cached = (
|
|
12845
|
+
/** @type {GeneratorFunctionConstructor} */
|
|
12846
|
+
function* () {
|
|
12847
|
+
}.constructor
|
|
12848
|
+
);
|
|
12849
|
+
generatorFunction = () => cached;
|
|
12850
|
+
return generatorFunction;
|
|
12851
|
+
}
|
|
12839
12852
|
var isGeneratorFunction;
|
|
12840
12853
|
var hasRequiredIsGeneratorFunction;
|
|
12841
12854
|
function requireIsGeneratorFunction() {
|
|
@@ -12848,16 +12861,7 @@
|
|
|
12848
12861
|
var getProto2 = requireGetProto();
|
|
12849
12862
|
var toStr = callBound2("Object.prototype.toString");
|
|
12850
12863
|
var fnToStr = callBound2("Function.prototype.toString");
|
|
12851
|
-
var
|
|
12852
|
-
if (!hasToStringTag) {
|
|
12853
|
-
return false;
|
|
12854
|
-
}
|
|
12855
|
-
try {
|
|
12856
|
-
return Function("return function*() {}")();
|
|
12857
|
-
} catch (e) {
|
|
12858
|
-
}
|
|
12859
|
-
};
|
|
12860
|
-
var GeneratorFunction;
|
|
12864
|
+
var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
|
|
12861
12865
|
isGeneratorFunction = function isGeneratorFunction2(fn) {
|
|
12862
12866
|
if (typeof fn !== "function") {
|
|
12863
12867
|
return false;
|
|
@@ -12872,14 +12876,8 @@
|
|
|
12872
12876
|
if (!getProto2) {
|
|
12873
12877
|
return false;
|
|
12874
12878
|
}
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
GeneratorFunction = generatorFunc ? (
|
|
12878
|
-
/** @type {GeneratorFunctionConstructor} */
|
|
12879
|
-
getProto2(generatorFunc)
|
|
12880
|
-
) : false;
|
|
12881
|
-
}
|
|
12882
|
-
return getProto2(fn) === GeneratorFunction;
|
|
12879
|
+
var GeneratorFunction = getGeneratorFunction();
|
|
12880
|
+
return GeneratorFunction && getProto2(fn) === GeneratorFunction.prototype;
|
|
12883
12881
|
};
|
|
12884
12882
|
return isGeneratorFunction;
|
|
12885
12883
|
}
|
|
@@ -39620,7 +39618,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39620
39618
|
}
|
|
39621
39619
|
if (elements) {
|
|
39622
39620
|
if (name === "w:instrText") {
|
|
39623
|
-
|
|
39621
|
+
const textContent2 = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
|
|
39622
|
+
tags.push(__privateMethod$2(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, textContent2));
|
|
39624
39623
|
} else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset") {
|
|
39625
39624
|
try {
|
|
39626
39625
|
let text = String(elements[0].text);
|
|
@@ -49789,8 +49788,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
49789
49788
|
let $to = parse.doc.resolveNoCache(change.endB - parse.from);
|
|
49790
49789
|
let $fromA = doc2.resolve(change.start);
|
|
49791
49790
|
let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
|
|
49792
|
-
|
|
49793
|
-
if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head > $from.pos) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
|
|
49791
|
+
if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
|
|
49794
49792
|
view.input.lastIOSEnter = 0;
|
|
49795
49793
|
return;
|
|
49796
49794
|
}
|
|
@@ -56444,26 +56442,100 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56444
56442
|
const setEditorToolbar = ({ editor }, mainEditor) => {
|
|
56445
56443
|
editor.setToolbar(mainEditor.toolbar);
|
|
56446
56444
|
};
|
|
56445
|
+
const normalizeCommentEventPayload = ({ conversation, editorOptions, fallbackCommentId, fallbackInternal }) => {
|
|
56446
|
+
const { user, documentId } = editorOptions || {};
|
|
56447
|
+
const normalized = {
|
|
56448
|
+
...conversation,
|
|
56449
|
+
commentId: conversation?.commentId ?? fallbackCommentId,
|
|
56450
|
+
isInternal: conversation?.isInternal ?? fallbackInternal
|
|
56451
|
+
};
|
|
56452
|
+
if (!normalized.commentText && normalized.text) {
|
|
56453
|
+
normalized.commentText = normalized.text;
|
|
56454
|
+
delete normalized.text;
|
|
56455
|
+
}
|
|
56456
|
+
if ("skipEmit" in normalized) delete normalized.skipEmit;
|
|
56457
|
+
if (!normalized.creatorName && user?.name) {
|
|
56458
|
+
normalized.creatorName = user.name;
|
|
56459
|
+
}
|
|
56460
|
+
if (!normalized.creatorEmail && user?.email) {
|
|
56461
|
+
normalized.creatorEmail = user.email;
|
|
56462
|
+
}
|
|
56463
|
+
if (!normalized.createdTime) {
|
|
56464
|
+
normalized.createdTime = Date.now();
|
|
56465
|
+
}
|
|
56466
|
+
if (!normalized.fileId && documentId) {
|
|
56467
|
+
normalized.fileId = documentId;
|
|
56468
|
+
}
|
|
56469
|
+
if (!normalized.documentId && documentId) {
|
|
56470
|
+
normalized.documentId = documentId;
|
|
56471
|
+
}
|
|
56472
|
+
return normalized;
|
|
56473
|
+
};
|
|
56474
|
+
const updatePosition = ({ allCommentPositions, threadId, pos, currentBounds, node }) => {
|
|
56475
|
+
let bounds = {};
|
|
56476
|
+
if (currentBounds instanceof DOMRect) {
|
|
56477
|
+
bounds = {
|
|
56478
|
+
top: currentBounds.top,
|
|
56479
|
+
bottom: currentBounds.bottom,
|
|
56480
|
+
left: currentBounds.left,
|
|
56481
|
+
right: currentBounds.right
|
|
56482
|
+
};
|
|
56483
|
+
} else {
|
|
56484
|
+
bounds = { ...currentBounds };
|
|
56485
|
+
}
|
|
56486
|
+
if (!allCommentPositions[threadId]) {
|
|
56487
|
+
allCommentPositions[threadId] = {
|
|
56488
|
+
threadId,
|
|
56489
|
+
start: pos,
|
|
56490
|
+
end: pos + node.nodeSize,
|
|
56491
|
+
bounds
|
|
56492
|
+
};
|
|
56493
|
+
} else {
|
|
56494
|
+
const existing = allCommentPositions[threadId];
|
|
56495
|
+
existing.start = Math.min(existing.start, pos);
|
|
56496
|
+
existing.end = Math.max(existing.end, pos + node.nodeSize);
|
|
56497
|
+
existing.bounds.top = Math.min(existing.bounds.top, currentBounds.top);
|
|
56498
|
+
existing.bounds.bottom = Math.max(existing.bounds.bottom, currentBounds.bottom);
|
|
56499
|
+
}
|
|
56500
|
+
};
|
|
56447
56501
|
const TRACK_CHANGE_MARKS = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
|
|
56448
56502
|
const CommentsPluginKey = new PluginKey("comments");
|
|
56449
56503
|
const CommentsPlugin = Extension.create({
|
|
56450
56504
|
name: "comments",
|
|
56451
56505
|
addCommands() {
|
|
56452
56506
|
return {
|
|
56453
|
-
insertComment: (conversation) => ({ tr, dispatch }) => {
|
|
56507
|
+
insertComment: (conversation = {}) => ({ tr, dispatch }) => {
|
|
56454
56508
|
const { selection } = tr;
|
|
56455
56509
|
const { $from, $to } = selection;
|
|
56456
|
-
const
|
|
56510
|
+
const skipEmit = conversation?.skipEmit;
|
|
56511
|
+
const resolvedCommentId = conversation?.commentId ?? v4$1();
|
|
56512
|
+
const resolvedInternal = conversation?.isInternal ?? false;
|
|
56457
56513
|
tr.setMeta(CommentsPluginKey, { event: "add" });
|
|
56458
56514
|
tr.addMark(
|
|
56459
56515
|
$from.pos,
|
|
56460
56516
|
$to.pos,
|
|
56461
56517
|
this.editor.schema.marks[CommentMarkName].create({
|
|
56462
|
-
commentId,
|
|
56463
|
-
internal:
|
|
56518
|
+
commentId: resolvedCommentId,
|
|
56519
|
+
internal: resolvedInternal
|
|
56464
56520
|
})
|
|
56465
56521
|
);
|
|
56466
|
-
dispatch(tr);
|
|
56522
|
+
if (dispatch) dispatch(tr);
|
|
56523
|
+
const shouldEmit = !skipEmit && resolvedCommentId !== "pending";
|
|
56524
|
+
if (shouldEmit) {
|
|
56525
|
+
const commentPayload = normalizeCommentEventPayload({
|
|
56526
|
+
conversation,
|
|
56527
|
+
editorOptions: this.editor.options,
|
|
56528
|
+
fallbackCommentId: resolvedCommentId,
|
|
56529
|
+
fallbackInternal: resolvedInternal
|
|
56530
|
+
});
|
|
56531
|
+
const activeCommentId = commentPayload.commentId || commentPayload.importedId || null;
|
|
56532
|
+
const event = {
|
|
56533
|
+
type: comments_module_events$1.ADD,
|
|
56534
|
+
comment: commentPayload,
|
|
56535
|
+
...activeCommentId && { activeCommentId }
|
|
56536
|
+
};
|
|
56537
|
+
this.editor.emit("commentsUpdate", event);
|
|
56538
|
+
}
|
|
56467
56539
|
return true;
|
|
56468
56540
|
},
|
|
56469
56541
|
removeComment: ({ commentId, importedId }) => ({ tr, dispatch, state: state2 }) => {
|
|
@@ -56699,33 +56771,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56699
56771
|
return [commentsPlugin];
|
|
56700
56772
|
}
|
|
56701
56773
|
});
|
|
56702
|
-
const updatePosition = ({ allCommentPositions, threadId, pos, currentBounds, node }) => {
|
|
56703
|
-
let bounds = {};
|
|
56704
|
-
if (currentBounds instanceof DOMRect) {
|
|
56705
|
-
bounds = {
|
|
56706
|
-
top: currentBounds.top,
|
|
56707
|
-
bottom: currentBounds.bottom,
|
|
56708
|
-
left: currentBounds.left,
|
|
56709
|
-
right: currentBounds.right
|
|
56710
|
-
};
|
|
56711
|
-
} else {
|
|
56712
|
-
bounds = { ...currentBounds };
|
|
56713
|
-
}
|
|
56714
|
-
if (!allCommentPositions[threadId]) {
|
|
56715
|
-
allCommentPositions[threadId] = {
|
|
56716
|
-
threadId,
|
|
56717
|
-
start: pos,
|
|
56718
|
-
end: pos + node.nodeSize,
|
|
56719
|
-
bounds
|
|
56720
|
-
};
|
|
56721
|
-
} else {
|
|
56722
|
-
const existing = allCommentPositions[threadId];
|
|
56723
|
-
existing.start = Math.min(existing.start, pos);
|
|
56724
|
-
existing.end = Math.max(existing.end, pos + node.nodeSize);
|
|
56725
|
-
existing.bounds.top = Math.min(existing.bounds.top, currentBounds.top);
|
|
56726
|
-
existing.bounds.bottom = Math.max(existing.bounds.bottom, currentBounds.bottom);
|
|
56727
|
-
}
|
|
56728
|
-
};
|
|
56729
56774
|
const getActiveCommentId = (doc2, selection) => {
|
|
56730
56775
|
if (!selection) return;
|
|
56731
56776
|
const { $from, $to } = selection;
|
|
@@ -61934,6 +61979,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61934
61979
|
});
|
|
61935
61980
|
return result;
|
|
61936
61981
|
}
|
|
61982
|
+
function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
|
|
61983
|
+
const result = findChildren$5(state2.doc, (node) => {
|
|
61984
|
+
const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
|
|
61985
|
+
if (Array.isArray(aliasOrAliases)) {
|
|
61986
|
+
return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
|
|
61987
|
+
} else {
|
|
61988
|
+
return isStructuredContent && node.attrs.alias === aliasOrAliases;
|
|
61989
|
+
}
|
|
61990
|
+
});
|
|
61991
|
+
return result;
|
|
61992
|
+
}
|
|
61937
61993
|
function getStructuredContentTags(state2) {
|
|
61938
61994
|
const result = findChildren$5(state2.doc, (node) => {
|
|
61939
61995
|
return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
|
|
@@ -61953,6 +62009,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61953
62009
|
getStructuredContentBlockTags,
|
|
61954
62010
|
getStructuredContentInlineTags,
|
|
61955
62011
|
getStructuredContentTags,
|
|
62012
|
+
getStructuredContentTagsByAlias,
|
|
61956
62013
|
getStructuredContentTagsById
|
|
61957
62014
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
61958
62015
|
const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
|
|
@@ -62041,10 +62098,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62041
62098
|
return true;
|
|
62042
62099
|
},
|
|
62043
62100
|
/**
|
|
62044
|
-
* Updates a structured content
|
|
62101
|
+
* Updates a single structured content field by its unique ID.
|
|
62102
|
+
* IDs are unique identifiers, so this will update at most one field.
|
|
62045
62103
|
* If the updated node does not match the schema, it will not be updated.
|
|
62046
62104
|
* @category Command
|
|
62047
|
-
* @param {string} id
|
|
62105
|
+
* @param {string} id - Unique identifier of the field
|
|
62048
62106
|
* @param {StructuredContentUpdate} options
|
|
62049
62107
|
*/
|
|
62050
62108
|
updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
@@ -62084,6 +62142,58 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62084
62142
|
}
|
|
62085
62143
|
return true;
|
|
62086
62144
|
},
|
|
62145
|
+
/**
|
|
62146
|
+
* Updates all structured content fields with the same alias.
|
|
62147
|
+
* Unlike IDs (which are unique), aliases can be shared across multiple fields.
|
|
62148
|
+
* This will update every field that matches the given alias.
|
|
62149
|
+
* If any updated node does not match the schema, no updates will be applied.
|
|
62150
|
+
* @category Command
|
|
62151
|
+
* @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
|
|
62152
|
+
* @param {StructuredContentUpdate} options
|
|
62153
|
+
*/
|
|
62154
|
+
updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
62155
|
+
const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
|
|
62156
|
+
if (!structuredContentTags.length) {
|
|
62157
|
+
return true;
|
|
62158
|
+
}
|
|
62159
|
+
const { schema } = editor;
|
|
62160
|
+
const createContent = (node) => {
|
|
62161
|
+
if (options.text) {
|
|
62162
|
+
return schema.text(options.text);
|
|
62163
|
+
}
|
|
62164
|
+
if (options.html) {
|
|
62165
|
+
const html = htmlHandler(options.html, editor);
|
|
62166
|
+
const doc2 = DOMParser$1.fromSchema(schema).parse(html);
|
|
62167
|
+
return doc2.content;
|
|
62168
|
+
}
|
|
62169
|
+
if (options.json) {
|
|
62170
|
+
return schema.nodeFromJSON(options.json);
|
|
62171
|
+
}
|
|
62172
|
+
return node.content;
|
|
62173
|
+
};
|
|
62174
|
+
for (const { node } of structuredContentTags) {
|
|
62175
|
+
const content = createContent(node);
|
|
62176
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
62177
|
+
try {
|
|
62178
|
+
updatedNode.check();
|
|
62179
|
+
} catch {
|
|
62180
|
+
console.error("Updated node does not conform to the schema");
|
|
62181
|
+
return false;
|
|
62182
|
+
}
|
|
62183
|
+
}
|
|
62184
|
+
if (dispatch) {
|
|
62185
|
+
structuredContentTags.forEach(({ pos, node }) => {
|
|
62186
|
+
const mappedPos = tr.mapping.map(pos);
|
|
62187
|
+
const currentNode = tr.doc.nodeAt(mappedPos);
|
|
62188
|
+
if (currentNode && node.eq(currentNode)) {
|
|
62189
|
+
const content = createContent(node);
|
|
62190
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
62191
|
+
tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
|
|
62192
|
+
}
|
|
62193
|
+
});
|
|
62194
|
+
}
|
|
62195
|
+
return true;
|
|
62196
|
+
},
|
|
62087
62197
|
/**
|
|
62088
62198
|
* Removes a structured content.
|
|
62089
62199
|
* @category Command
|
|
@@ -70225,6 +70335,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70225
70335
|
}
|
|
70226
70336
|
return formatAttrs;
|
|
70227
70337
|
}
|
|
70338
|
+
const DEFAULT_MIME_TYPE = "application/octet-stream";
|
|
70228
70339
|
const simpleHash = (str) => {
|
|
70229
70340
|
let hash2 = 0;
|
|
70230
70341
|
for (let i2 = 0; i2 < str.length; i2++) {
|
|
@@ -70234,21 +70345,40 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70234
70345
|
}
|
|
70235
70346
|
return Math.abs(hash2).toString();
|
|
70236
70347
|
};
|
|
70237
|
-
const
|
|
70238
|
-
|
|
70239
|
-
|
|
70240
|
-
|
|
70241
|
-
|
|
70242
|
-
|
|
70348
|
+
const decodeBase64ToBinaryString = (data) => {
|
|
70349
|
+
if (!data) return "";
|
|
70350
|
+
if (typeof atob === "function") {
|
|
70351
|
+
return atob(data);
|
|
70352
|
+
}
|
|
70353
|
+
if (typeof Buffer2 !== "undefined" && typeof Buffer2.from === "function") {
|
|
70354
|
+
return Buffer2.from(data, "base64").toString("binary");
|
|
70355
|
+
}
|
|
70356
|
+
throw new Error("Unable to decode base64 payload in the current environment.");
|
|
70357
|
+
};
|
|
70358
|
+
const extractBase64Meta = (base64String) => {
|
|
70359
|
+
const [meta = "", payload = ""] = base64String.split(",");
|
|
70360
|
+
const mimeMatch = meta.match(/:(.*?);/);
|
|
70361
|
+
const rawMimeType = mimeMatch ? mimeMatch[1] : "";
|
|
70362
|
+
const mimeType = rawMimeType || DEFAULT_MIME_TYPE;
|
|
70363
|
+
const binaryString = decodeBase64ToBinaryString(payload);
|
|
70243
70364
|
const hash2 = simpleHash(binaryString);
|
|
70244
70365
|
const extension = mimeType.split("/")[1] || "bin";
|
|
70245
70366
|
const filename = `image-${hash2}.${extension}`;
|
|
70367
|
+
return { mimeType, binaryString, filename };
|
|
70368
|
+
};
|
|
70369
|
+
const getBase64FileMeta = (base64String) => {
|
|
70370
|
+
const { mimeType, filename } = extractBase64Meta(base64String);
|
|
70371
|
+
return { mimeType, filename };
|
|
70372
|
+
};
|
|
70373
|
+
const base64ToFile = (base64String) => {
|
|
70374
|
+
const { mimeType, binaryString, filename } = extractBase64Meta(base64String);
|
|
70375
|
+
const fileType = mimeType || DEFAULT_MIME_TYPE;
|
|
70246
70376
|
const bytes = new Uint8Array(binaryString.length);
|
|
70247
70377
|
for (let i2 = 0; i2 < binaryString.length; i2++) {
|
|
70248
70378
|
bytes[i2] = binaryString.charCodeAt(i2);
|
|
70249
70379
|
}
|
|
70250
|
-
const blob = new Blob([bytes], { type:
|
|
70251
|
-
return new File([blob], filename, { type:
|
|
70380
|
+
const blob = new Blob([bytes], { type: fileType });
|
|
70381
|
+
return new File([blob], filename, { type: fileType });
|
|
70252
70382
|
};
|
|
70253
70383
|
const urlToFile = async (url, filename, mimeType) => {
|
|
70254
70384
|
try {
|
|
@@ -70624,6 +70754,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70624
70754
|
}
|
|
70625
70755
|
}
|
|
70626
70756
|
const key = new PluginKey("ImageRegistration");
|
|
70757
|
+
const WORD_MEDIA_PREFIX = "word/";
|
|
70627
70758
|
const ImageRegistrationPlugin = ({ editor }) => {
|
|
70628
70759
|
const { view } = editor;
|
|
70629
70760
|
return new Plugin({
|
|
@@ -70644,16 +70775,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70644
70775
|
},
|
|
70645
70776
|
appendTransaction: (trs, _oldState, state2) => {
|
|
70646
70777
|
let foundImages = [];
|
|
70647
|
-
trs.forEach((
|
|
70648
|
-
if (
|
|
70649
|
-
|
|
70778
|
+
trs.forEach((tr) => {
|
|
70779
|
+
if (tr.docChanged) {
|
|
70780
|
+
tr.steps.forEach((step, index2) => {
|
|
70650
70781
|
const stepMap = step.getMap();
|
|
70651
70782
|
foundImages = foundImages.map(({ node, pos, id }) => {
|
|
70652
70783
|
const mappedPos = stepMap.map(pos, -1);
|
|
70653
70784
|
return { node, pos: mappedPos, id };
|
|
70654
70785
|
});
|
|
70655
70786
|
if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
|
|
70656
|
-
(
|
|
70787
|
+
(tr.docs[index2 + 1] || tr.doc).nodesBetween(
|
|
70657
70788
|
stepMap.map(step.from, -1),
|
|
70658
70789
|
stepMap.map(step.to, 1),
|
|
70659
70790
|
(node, pos) => {
|
|
@@ -70672,22 +70803,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70672
70803
|
if (!foundImages || foundImages.length === 0) {
|
|
70673
70804
|
return null;
|
|
70674
70805
|
}
|
|
70675
|
-
|
|
70676
|
-
|
|
70677
|
-
|
|
70678
|
-
foundImages
|
|
70679
|
-
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
70680
|
-
side: -1,
|
|
70681
|
-
id
|
|
70682
|
-
});
|
|
70683
|
-
set = set.add(tr.doc, [deco]);
|
|
70684
|
-
});
|
|
70685
|
-
foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
|
|
70686
|
-
tr.delete(pos, pos + node.nodeSize);
|
|
70687
|
-
});
|
|
70688
|
-
set = set.map(tr.mapping, tr.doc);
|
|
70689
|
-
tr.setMeta(key, { set });
|
|
70690
|
-
return tr;
|
|
70806
|
+
if (editor.options.isHeadless) {
|
|
70807
|
+
return handleNodePath(foundImages, editor, state2);
|
|
70808
|
+
}
|
|
70809
|
+
return handleBrowserPath(foundImages, editor, view, state2);
|
|
70691
70810
|
},
|
|
70692
70811
|
props: {
|
|
70693
70812
|
decorations(state2) {
|
|
@@ -70697,6 +70816,59 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70697
70816
|
}
|
|
70698
70817
|
});
|
|
70699
70818
|
};
|
|
70819
|
+
const derivePreferredFileName = (src) => {
|
|
70820
|
+
if (typeof src !== "string" || src.length === 0) {
|
|
70821
|
+
return "image.bin";
|
|
70822
|
+
}
|
|
70823
|
+
if (src.startsWith("data:")) {
|
|
70824
|
+
return getBase64FileMeta(src).filename;
|
|
70825
|
+
}
|
|
70826
|
+
const lastSegment = src.split("/").pop() ?? "";
|
|
70827
|
+
const trimmed = lastSegment.split(/[?#]/)[0];
|
|
70828
|
+
return trimmed || "image.bin";
|
|
70829
|
+
};
|
|
70830
|
+
const handleNodePath = (foundImages, editor, state2) => {
|
|
70831
|
+
const { tr } = state2;
|
|
70832
|
+
const mediaStore = editor.storage.image.media ?? {};
|
|
70833
|
+
if (!editor.storage.image.media) {
|
|
70834
|
+
editor.storage.image.media = mediaStore;
|
|
70835
|
+
}
|
|
70836
|
+
const existingFileNames = new Set(Object.keys(mediaStore).map((key2) => key2.split("/").pop()));
|
|
70837
|
+
foundImages.forEach(({ node, pos }) => {
|
|
70838
|
+
const { src } = node.attrs;
|
|
70839
|
+
const preferredFileName = derivePreferredFileName(src);
|
|
70840
|
+
const uniqueFileName = ensureUniqueFileName(preferredFileName, existingFileNames);
|
|
70841
|
+
existingFileNames.add(uniqueFileName);
|
|
70842
|
+
const mediaPath = buildMediaPath(uniqueFileName);
|
|
70843
|
+
mediaStore[mediaPath] = src;
|
|
70844
|
+
const path = mediaPath.startsWith(WORD_MEDIA_PREFIX) ? mediaPath.slice(WORD_MEDIA_PREFIX.length) : mediaPath;
|
|
70845
|
+
const rId = addImageRelationship({ editor, path });
|
|
70846
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
70847
|
+
...node.attrs,
|
|
70848
|
+
src: mediaPath,
|
|
70849
|
+
rId
|
|
70850
|
+
});
|
|
70851
|
+
});
|
|
70852
|
+
return tr;
|
|
70853
|
+
};
|
|
70854
|
+
const handleBrowserPath = (foundImages, editor, view, state2) => {
|
|
70855
|
+
registerImages(foundImages, editor, view);
|
|
70856
|
+
const tr = state2.tr;
|
|
70857
|
+
let { set } = key.getState(state2);
|
|
70858
|
+
foundImages.slice().sort((a, b2) => a.pos - b2.pos).forEach(({ pos, id }) => {
|
|
70859
|
+
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
70860
|
+
side: -1,
|
|
70861
|
+
id
|
|
70862
|
+
});
|
|
70863
|
+
set = set.add(tr.doc, [deco]);
|
|
70864
|
+
});
|
|
70865
|
+
foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
|
|
70866
|
+
tr.delete(pos, pos + node.nodeSize);
|
|
70867
|
+
});
|
|
70868
|
+
set = set.map(tr.mapping, tr.doc);
|
|
70869
|
+
tr.setMeta(key, { set });
|
|
70870
|
+
return tr;
|
|
70871
|
+
};
|
|
70700
70872
|
const findPlaceholder = (state2, id) => {
|
|
70701
70873
|
let { set } = key.getState(state2);
|
|
70702
70874
|
let found2 = set?.find(null, null, (spec) => spec.id === id);
|
|
@@ -77814,6 +77986,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77814
77986
|
return actualBreak;
|
|
77815
77987
|
}
|
|
77816
77988
|
const onImageLoad = (editor) => {
|
|
77989
|
+
if (typeof requestAnimationFrame !== "function") return;
|
|
77817
77990
|
requestAnimationFrame(() => {
|
|
77818
77991
|
const newTr = editor.view.state.tr;
|
|
77819
77992
|
newTr.setMeta("forceUpdatePagination", true);
|
|
@@ -79025,7 +79198,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
79025
79198
|
};
|
|
79026
79199
|
const handleInputSubmit = () => {
|
|
79027
79200
|
const value = inlineTextInput.value;
|
|
79028
|
-
const cleanValue = value.
|
|
79201
|
+
const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
|
|
79029
79202
|
emit2("textSubmit", cleanValue);
|
|
79030
79203
|
inlineTextInput.value = cleanValue;
|
|
79031
79204
|
};
|
|
@@ -79107,7 +79280,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
79107
79280
|
};
|
|
79108
79281
|
}
|
|
79109
79282
|
};
|
|
79110
|
-
const ToolbarButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$4$2, [["__scopeId", "data-v-
|
|
79283
|
+
const ToolbarButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$4$2, [["__scopeId", "data-v-cea02a58"]]);
|
|
79111
79284
|
const _hoisted_1$2$2 = {
|
|
79112
79285
|
class: "toolbar-separator",
|
|
79113
79286
|
role: "separator",
|
|
@@ -97456,6 +97629,9 @@ ${reason}`);
|
|
|
97456
97629
|
documentUsers.value = configUsers || [];
|
|
97457
97630
|
Object.assign(user, configUser);
|
|
97458
97631
|
Object.assign(modules, configModules);
|
|
97632
|
+
if (!Object.prototype.hasOwnProperty.call(modules, "comments")) {
|
|
97633
|
+
modules.comments = {};
|
|
97634
|
+
}
|
|
97459
97635
|
if (!configDocs?.length && !config2.modules.collaboration) {
|
|
97460
97636
|
const newDoc = await getFileObject(BlankDOCX, "blank.docx", DOCX);
|
|
97461
97637
|
const newDocConfig = {
|
|
@@ -97757,7 +97933,11 @@ ${reason}`);
|
|
|
97757
97933
|
pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
|
|
97758
97934
|
if (!superdoc2.config.isInternal) pendingComment.value.isInternal = false;
|
|
97759
97935
|
if (superdoc2.activeEditor?.commands) {
|
|
97760
|
-
superdoc2.activeEditor.commands.insertComment({
|
|
97936
|
+
superdoc2.activeEditor.commands.insertComment({
|
|
97937
|
+
...pendingComment.value.getValues(),
|
|
97938
|
+
commentId: "pending",
|
|
97939
|
+
skipEmit: true
|
|
97940
|
+
});
|
|
97761
97941
|
}
|
|
97762
97942
|
if (pendingComment.value.selection.source === "super-editor" && superdocStore.selectionPosition) {
|
|
97763
97943
|
superdocStore.selectionPosition.source = "super-editor";
|
|
@@ -97829,7 +98009,7 @@ ${reason}`);
|
|
|
97829
98009
|
superdocStore.selectionPosition = null;
|
|
97830
98010
|
superdoc2.activeEditor?.commands.removeComment({ commentId: "pending" });
|
|
97831
98011
|
};
|
|
97832
|
-
const addComment = ({ superdoc: superdoc2, comment }) => {
|
|
98012
|
+
const addComment = ({ superdoc: superdoc2, comment, skipEditorUpdate = false }) => {
|
|
97833
98013
|
let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
|
|
97834
98014
|
if (!parentComment) parentComment = comment;
|
|
97835
98015
|
const newComment = useComment(comment.getValues());
|
|
@@ -97843,8 +98023,8 @@ ${reason}`);
|
|
|
97843
98023
|
if (!superdoc2.config.isInternal) newComment.isInternal = false;
|
|
97844
98024
|
commentsList.value.push(newComment);
|
|
97845
98025
|
removePendingComment(superdoc2);
|
|
97846
|
-
if (!comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
|
|
97847
|
-
superdoc2.activeEditor.commands.insertComment(newComment.getValues());
|
|
98026
|
+
if (!skipEditorUpdate && !comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
|
|
98027
|
+
superdoc2.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
|
|
97848
98028
|
}
|
|
97849
98029
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
97850
98030
|
syncCommentsToClients(superdoc2, event);
|
|
@@ -111042,10 +111222,22 @@ ${style2}
|
|
|
111042
111222
|
hasInitializedLocations,
|
|
111043
111223
|
isCommentHighlighted
|
|
111044
111224
|
} = storeToRefs(commentsStore);
|
|
111045
|
-
const {
|
|
111225
|
+
const {
|
|
111226
|
+
showAddComment,
|
|
111227
|
+
handleEditorLocationsUpdate,
|
|
111228
|
+
handleTrackedChangeUpdate,
|
|
111229
|
+
addComment,
|
|
111230
|
+
getComment,
|
|
111231
|
+
COMMENT_EVENTS
|
|
111232
|
+
} = commentsStore;
|
|
111046
111233
|
const { proxy } = getCurrentInstance();
|
|
111047
111234
|
commentsStore.proxy = proxy;
|
|
111048
111235
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
111236
|
+
const commentsModuleConfig = computed(() => {
|
|
111237
|
+
const config2 = modules.comments;
|
|
111238
|
+
if (config2 === false || config2 == null) return null;
|
|
111239
|
+
return config2;
|
|
111240
|
+
});
|
|
111049
111241
|
const layers = ref$1(null);
|
|
111050
111242
|
const commentsLayer = ref$1(null);
|
|
111051
111243
|
const toolsMenuPosition = reactive({ top: null, right: "-25px", zIndex: 101 });
|
|
@@ -111193,7 +111385,7 @@ ${style2}
|
|
|
111193
111385
|
rulers: doc2.rulers,
|
|
111194
111386
|
isInternal: proxy.$superdoc.config.isInternal,
|
|
111195
111387
|
annotations: proxy.$superdoc.config.annotations,
|
|
111196
|
-
isCommentsEnabled:
|
|
111388
|
+
isCommentsEnabled: Boolean(commentsModuleConfig.value),
|
|
111197
111389
|
isAiEnabled: proxy.$superdoc.config.modules?.ai,
|
|
111198
111390
|
slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
|
|
111199
111391
|
onBeforeCreate: onEditorBeforeCreate,
|
|
@@ -111224,11 +111416,38 @@ ${style2}
|
|
|
111224
111416
|
return options;
|
|
111225
111417
|
};
|
|
111226
111418
|
const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
|
|
111227
|
-
|
|
111419
|
+
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
111420
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
111228
111421
|
handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
|
|
111229
111422
|
};
|
|
111230
111423
|
const onEditorCommentsUpdate = (params2 = {}) => {
|
|
111231
|
-
|
|
111424
|
+
let { activeCommentId, type: type2, comment: commentPayload } = params2;
|
|
111425
|
+
if (COMMENT_EVENTS?.ADD && type2 === COMMENT_EVENTS.ADD && commentPayload) {
|
|
111426
|
+
if (!commentPayload.commentText && commentPayload.text) {
|
|
111427
|
+
commentPayload.commentText = commentPayload.text;
|
|
111428
|
+
}
|
|
111429
|
+
const currentUser = proxy.$superdoc?.user;
|
|
111430
|
+
if (currentUser) {
|
|
111431
|
+
if (!commentPayload.creatorName) commentPayload.creatorName = currentUser.name;
|
|
111432
|
+
if (!commentPayload.creatorEmail) commentPayload.creatorEmail = currentUser.email;
|
|
111433
|
+
}
|
|
111434
|
+
if (!commentPayload.createdTime) commentPayload.createdTime = Date.now();
|
|
111435
|
+
const primaryDocumentId = commentPayload.documentId || documents.value?.[0]?.id;
|
|
111436
|
+
if (!commentPayload.documentId && primaryDocumentId) {
|
|
111437
|
+
commentPayload.documentId = primaryDocumentId;
|
|
111438
|
+
}
|
|
111439
|
+
if (!commentPayload.fileId && primaryDocumentId) {
|
|
111440
|
+
commentPayload.fileId = primaryDocumentId;
|
|
111441
|
+
}
|
|
111442
|
+
const id = commentPayload.commentId || commentPayload.importedId;
|
|
111443
|
+
if (id && !getComment(id)) {
|
|
111444
|
+
const commentModel = useComment(commentPayload);
|
|
111445
|
+
addComment({ superdoc: proxy.$superdoc, comment: commentModel, skipEditorUpdate: true });
|
|
111446
|
+
}
|
|
111447
|
+
if (!activeCommentId && id) {
|
|
111448
|
+
activeCommentId = id;
|
|
111449
|
+
}
|
|
111450
|
+
}
|
|
111232
111451
|
if (type2 === "trackedChange") {
|
|
111233
111452
|
handleTrackedChangeUpdate({ superdoc: proxy.$superdoc, params: params2 });
|
|
111234
111453
|
}
|
|
@@ -111246,7 +111465,7 @@ ${style2}
|
|
|
111246
111465
|
proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
|
|
111247
111466
|
}
|
|
111248
111467
|
};
|
|
111249
|
-
const isCommentsEnabled = computed(() =>
|
|
111468
|
+
const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
|
|
111250
111469
|
const showCommentsSidebar = computed(() => {
|
|
111251
111470
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
111252
111471
|
});
|
|
@@ -111256,13 +111475,14 @@ ${style2}
|
|
|
111256
111475
|
});
|
|
111257
111476
|
computed(() => {
|
|
111258
111477
|
if (!isCommentsEnabled.value) return false;
|
|
111259
|
-
!getConfig?.readOnly && selectionPosition.value;
|
|
111478
|
+
return !getConfig.value?.readOnly && selectionPosition.value;
|
|
111260
111479
|
});
|
|
111261
111480
|
watch(showCommentsSidebar, (value) => {
|
|
111262
111481
|
proxy.$superdoc.broadcastSidebarToggle(value);
|
|
111263
111482
|
});
|
|
111264
111483
|
const scrollToComment = (commentId) => {
|
|
111265
|
-
|
|
111484
|
+
const commentsConfig = proxy.$superdoc.config?.modules?.comments;
|
|
111485
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
111266
111486
|
const element = document.querySelector(`[data-thread-id=${commentId}]`);
|
|
111267
111487
|
if (element) {
|
|
111268
111488
|
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
@@ -111270,7 +111490,8 @@ ${style2}
|
|
|
111270
111490
|
}
|
|
111271
111491
|
};
|
|
111272
111492
|
onMounted(() => {
|
|
111273
|
-
|
|
111493
|
+
const config2 = commentsModuleConfig.value;
|
|
111494
|
+
if (config2 && !config2.readOnly) {
|
|
111274
111495
|
document.addEventListener("mousedown", handleDocumentMouseDown);
|
|
111275
111496
|
}
|
|
111276
111497
|
});
|
|
@@ -111392,6 +111613,7 @@ ${style2}
|
|
|
111392
111613
|
};
|
|
111393
111614
|
const shouldShowSelection = computed(() => {
|
|
111394
111615
|
const config2 = proxy.$superdoc.config.modules?.comments;
|
|
111616
|
+
if (!config2 || config2 === false) return false;
|
|
111395
111617
|
return !config2.readOnly;
|
|
111396
111618
|
});
|
|
111397
111619
|
const handleSuperEditorPageMarginsChange = (doc2, params2) => {
|
|
@@ -111558,7 +111780,7 @@ ${style2}
|
|
|
111558
111780
|
};
|
|
111559
111781
|
}
|
|
111560
111782
|
};
|
|
111561
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
111783
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-96983cf9"]]);
|
|
111562
111784
|
const createSuperdocVueApp = () => {
|
|
111563
111785
|
const app = createApp(App);
|
|
111564
111786
|
const pinia = createPinia();
|
|
@@ -111657,6 +111879,10 @@ ${style2}
|
|
|
111657
111879
|
...this.config,
|
|
111658
111880
|
...config2
|
|
111659
111881
|
};
|
|
111882
|
+
this.config.modules = this.config.modules || {};
|
|
111883
|
+
if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
|
|
111884
|
+
this.config.modules.comments = {};
|
|
111885
|
+
}
|
|
111660
111886
|
this.config.colors = shuffleArray(this.config.colors);
|
|
111661
111887
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
111662
111888
|
this.colorIndex = 0;
|
|
@@ -111791,7 +112017,8 @@ ${style2}
|
|
|
111791
112017
|
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
111792
112018
|
}
|
|
111793
112019
|
this.superdocStore.init(this.config);
|
|
111794
|
-
this.
|
|
112020
|
+
const commentsModuleConfig = this.config.modules.comments;
|
|
112021
|
+
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
111795
112022
|
}
|
|
111796
112023
|
#initListeners() {
|
|
111797
112024
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -112141,15 +112368,8 @@ ${style2}
|
|
|
112141
112368
|
}
|
|
112142
112369
|
/**
|
|
112143
112370
|
* Export the superdoc to a file
|
|
112144
|
-
* @param {
|
|
112145
|
-
* @
|
|
112146
|
-
* @param {string} [params.commentsType]
|
|
112147
|
-
* @param {string} [params.exportedName]
|
|
112148
|
-
* @param {Array} [params.additionalFiles]
|
|
112149
|
-
* @param {Array} [params.additionalFileNames]
|
|
112150
|
-
* @param {boolean} [params.isFinalDoc]
|
|
112151
|
-
* @param {boolean} [params.triggerDownload] Whether to trigger the download of the exported file
|
|
112152
|
-
* @returns {Promise<void | Blob>} Returns void if triggerDownload is false, otherwise returns the exported file
|
|
112371
|
+
* @param {ExportParams} params - Export configuration
|
|
112372
|
+
* @returns {Promise<void | Blob>}
|
|
112153
112373
|
*/
|
|
112154
112374
|
async export({
|
|
112155
112375
|
exportType = ["docx"],
|