superdoc 2.28.0-next.12 → 2.28.0-next.13
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/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layered.css +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +1 -55
- package/dist/superdoc/src/stores/superdoc-store.d.ts +3 -165
- package/dist/superdoc.cjs +9 -897
- package/dist/superdoc.es.js +9 -897
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +42 -42
- package/package.json +2 -2
- package/dist/superdoc/src/helpers/group-changes.d.ts +0 -1
package/dist/superdoc.es.js
CHANGED
|
@@ -258,7 +258,7 @@ var v_click_outside_default = {
|
|
|
258
258
|
var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
259
259
|
function getSuperdocVersion() {
|
|
260
260
|
try {
|
|
261
|
-
return "2.28.0-next.
|
|
261
|
+
return "2.28.0-next.13";
|
|
262
262
|
} catch {
|
|
263
263
|
return "unknown";
|
|
264
264
|
}
|
|
@@ -6841,87 +6841,6 @@ var useSuperdocStore = defineStore("superdoc", () => {
|
|
|
6841
6841
|
};
|
|
6842
6842
|
});
|
|
6843
6843
|
//#endregion
|
|
6844
|
-
//#region src/helpers/group-changes.js
|
|
6845
|
-
/**
|
|
6846
|
-
* Track changes helper
|
|
6847
|
-
* Combines replace transactions which are represented by insertion + deletion
|
|
6848
|
-
*
|
|
6849
|
-
* @param {Array} changes - Array of tracked changes from the editor
|
|
6850
|
-
* @returns {Array} Grouped track changes array with combined replacements
|
|
6851
|
-
*/
|
|
6852
|
-
var groupChanges = (changes) => {
|
|
6853
|
-
const markMetaKeys = {
|
|
6854
|
-
trackInsert: "insertedMark",
|
|
6855
|
-
trackDelete: "deletionMark",
|
|
6856
|
-
trackFormat: "formatMark"
|
|
6857
|
-
};
|
|
6858
|
-
const byId = /* @__PURE__ */ new Map();
|
|
6859
|
-
for (const change of changes) {
|
|
6860
|
-
const id = change.mark.attrs.id;
|
|
6861
|
-
if (!byId.has(id)) byId.set(id, []);
|
|
6862
|
-
byId.get(id).push(change);
|
|
6863
|
-
}
|
|
6864
|
-
const grouped = [];
|
|
6865
|
-
for (const [, group] of byId) {
|
|
6866
|
-
if (group.length === 1) {
|
|
6867
|
-
const c = group[0];
|
|
6868
|
-
const key = markMetaKeys[c.mark.type.name];
|
|
6869
|
-
grouped.push({
|
|
6870
|
-
from: c.from,
|
|
6871
|
-
to: c.to,
|
|
6872
|
-
[key]: c
|
|
6873
|
-
});
|
|
6874
|
-
continue;
|
|
6875
|
-
}
|
|
6876
|
-
const processed = /* @__PURE__ */ new Set();
|
|
6877
|
-
for (let i = 0; i < group.length; i++) {
|
|
6878
|
-
if (processed.has(i)) continue;
|
|
6879
|
-
const c1 = group[i];
|
|
6880
|
-
const c1Key = markMetaKeys[c1.mark.type.name];
|
|
6881
|
-
const c2 = group[i + 1];
|
|
6882
|
-
if (c2 && !processed.has(i + 1) && c1.to === c2.from && c1.mark.type.name !== c2.mark.type.name) {
|
|
6883
|
-
const c2Key = markMetaKeys[c2.mark.type.name];
|
|
6884
|
-
grouped.push({
|
|
6885
|
-
from: c1.from,
|
|
6886
|
-
to: c2.to,
|
|
6887
|
-
[c1Key]: c1,
|
|
6888
|
-
[c2Key]: c2
|
|
6889
|
-
});
|
|
6890
|
-
processed.add(i);
|
|
6891
|
-
processed.add(i + 1);
|
|
6892
|
-
continue;
|
|
6893
|
-
}
|
|
6894
|
-
let foundMatch = false;
|
|
6895
|
-
for (let j = i + 1; j < group.length; j++) {
|
|
6896
|
-
if (processed.has(j)) continue;
|
|
6897
|
-
const cj = group[j];
|
|
6898
|
-
if (c1.mark.type.name !== cj.mark.type.name) {
|
|
6899
|
-
const cjKey = markMetaKeys[cj.mark.type.name];
|
|
6900
|
-
grouped.push({
|
|
6901
|
-
from: Math.min(c1.from, cj.from),
|
|
6902
|
-
to: Math.max(c1.to, cj.to),
|
|
6903
|
-
[c1Key]: c1,
|
|
6904
|
-
[cjKey]: cj
|
|
6905
|
-
});
|
|
6906
|
-
processed.add(i);
|
|
6907
|
-
processed.add(j);
|
|
6908
|
-
foundMatch = true;
|
|
6909
|
-
break;
|
|
6910
|
-
}
|
|
6911
|
-
}
|
|
6912
|
-
if (!foundMatch) {
|
|
6913
|
-
grouped.push({
|
|
6914
|
-
from: c1.from,
|
|
6915
|
-
to: c1.to,
|
|
6916
|
-
[c1Key]: c1
|
|
6917
|
-
});
|
|
6918
|
-
processed.add(i);
|
|
6919
|
-
}
|
|
6920
|
-
}
|
|
6921
|
-
}
|
|
6922
|
-
return grouped;
|
|
6923
|
-
};
|
|
6924
|
-
//#endregion
|
|
6925
6844
|
//#region src/stores/helpers/floating-comment-instances.js
|
|
6926
6845
|
var HEADER_FOOTER_TRACKED_CHANGE_STORY_TYPE = "headerFooterPart";
|
|
6927
6846
|
var toFinitePageIndex = (value) => {
|
|
@@ -7482,20 +7401,11 @@ var buildTrackedChangeDecisionLinkIndex = (allComments, previous = /* @__PURE__
|
|
|
7482
7401
|
};
|
|
7483
7402
|
//#endregion
|
|
7484
7403
|
//#region src/stores/comments-store.js
|
|
7485
|
-
var Editor = class {
|
|
7486
|
-
constructor() {
|
|
7487
|
-
throw new Error("SuperDoc v2 beta: v1 editor-backed comment import paths are not available.");
|
|
7488
|
-
}
|
|
7489
|
-
};
|
|
7490
7404
|
var trackChangesHelpers = {
|
|
7491
7405
|
getTrackChanges: () => [],
|
|
7492
7406
|
enumerateStructuralRowChanges: () => []
|
|
7493
7407
|
};
|
|
7494
|
-
var CommentsPluginKey = Symbol("comments-plugin-disabled");
|
|
7495
|
-
var getRichTextExtensions = () => [];
|
|
7496
|
-
var createOrUpdateTrackedChangeComment = () => null;
|
|
7497
7408
|
var getTrackedChangeIndex = () => null;
|
|
7498
|
-
var resolveTrackedChangeInStory = () => null;
|
|
7499
7409
|
var makeTrackedChangeAnchorKey = ({ storyKey, rawId }) => `tc::${storyKey}::${rawId}`;
|
|
7500
7410
|
var COMMENT_DRAFT_BR_TAG = /<br(?:\s[^>]*)?\s*\/?>/gi;
|
|
7501
7411
|
var COMMENT_DRAFT_BLOCK_BOUNDARY = /(?:<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>\s*)+(?:<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>)+/gi;
|
|
@@ -7640,25 +7550,6 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
7640
7550
|
rawId: String(rawId)
|
|
7641
7551
|
});
|
|
7642
7552
|
};
|
|
7643
|
-
/**
|
|
7644
|
-
* Compute the stable public id for a structural (whole-table) tracked change.
|
|
7645
|
-
*
|
|
7646
|
-
* This MUST match the public id the document-api projects for the same change
|
|
7647
|
-
* (`tracked-change-resolver.groupTrackedChanges`), otherwise the right-rail
|
|
7648
|
-
* accept/reject would route `trackChanges.decide` to a change that does not
|
|
7649
|
-
* exist. The doc-api derives the public id as `word:structural:<sourceId>`
|
|
7650
|
-
* for imported Word revisions, falling back to the per-import logical id.
|
|
7651
|
-
* Reuse the exact rule here so the bubble id is the decide id.
|
|
7652
|
-
*
|
|
7653
|
-
* @param {{ sourceId?: string, id?: string }} structural
|
|
7654
|
-
* @returns {string | null}
|
|
7655
|
-
*/
|
|
7656
|
-
const buildStructuralTrackedChangeId = (structural) => {
|
|
7657
|
-
if (!structural) return null;
|
|
7658
|
-
const sourceId = structural.sourceId ? String(structural.sourceId) : "";
|
|
7659
|
-
if (sourceId) return `word:structural:${sourceId}`;
|
|
7660
|
-
return structural.id ? String(structural.id) : null;
|
|
7661
|
-
};
|
|
7662
7553
|
const superdocStore = useSuperdocStore();
|
|
7663
7554
|
const commentsConfig = reactive({
|
|
7664
7555
|
name: "comments",
|
|
@@ -7690,8 +7581,6 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
7690
7581
|
const isDebugging = false;
|
|
7691
7582
|
const debounceTimers = {};
|
|
7692
7583
|
const trackedChangeResolutionSnapshots = /* @__PURE__ */ new WeakMap();
|
|
7693
|
-
const importedTrackedChangeBootstrapTasks = /* @__PURE__ */ new Map();
|
|
7694
|
-
let importedTrackedChangeBootstrapGeneration = 0;
|
|
7695
7584
|
const isBenchmarkCommentsDebugEnabled = () => {
|
|
7696
7585
|
if (typeof window === "undefined") return false;
|
|
7697
7586
|
return "__labsSuperDocV2BenchmarkDebug" in window;
|
|
@@ -8553,38 +8442,6 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
8553
8442
|
endInteractionSpan(span);
|
|
8554
8443
|
}
|
|
8555
8444
|
};
|
|
8556
|
-
const collectTrackedChangeMarksByType = (trackedChanges = []) => ({
|
|
8557
|
-
insertedMark: trackedChanges.find(({ mark }) => mark?.type?.name === "trackInsert")?.mark ?? null,
|
|
8558
|
-
deletionMark: trackedChanges.find(({ mark }) => mark?.type?.name === "trackDelete")?.mark ?? null,
|
|
8559
|
-
formatMark: trackedChanges.find(({ mark }) => mark?.type?.name === "trackFormat")?.mark ?? null
|
|
8560
|
-
});
|
|
8561
|
-
const refreshTrackedChangeCommentsByIds = ({ superdoc, editor, changeIds, broadcastChanges = true }) => {
|
|
8562
|
-
if (!superdoc || !editor?.state || !Array.isArray(changeIds) || !changeIds.length) return;
|
|
8563
|
-
const documentId = editor?.options?.documentId != null ? String(editor.options.documentId) : null;
|
|
8564
|
-
if (!documentId) return;
|
|
8565
|
-
for (const changeId of new Set(changeIds.map((id) => id != null ? String(id) : null).filter(Boolean))) {
|
|
8566
|
-
const trackedChangesForId = trackChangesHelpers.getTrackChanges(editor.state, changeId);
|
|
8567
|
-
if (!trackedChangesForId.length) continue;
|
|
8568
|
-
const params = createOrUpdateTrackedChangeComment({
|
|
8569
|
-
event: "update",
|
|
8570
|
-
marks: collectTrackedChangeMarksByType(trackedChangesForId),
|
|
8571
|
-
nodes: [],
|
|
8572
|
-
newEditorState: editor.state,
|
|
8573
|
-
documentId,
|
|
8574
|
-
trackedChangesForId
|
|
8575
|
-
});
|
|
8576
|
-
if (!params) continue;
|
|
8577
|
-
params.trackedChangeStory = BODY_TRACKED_CHANGE_STORY;
|
|
8578
|
-
params.trackedChangeStoryKind = "body";
|
|
8579
|
-
params.trackedChangeStoryLabel = "";
|
|
8580
|
-
params.trackedChangeAnchorKey = buildBodyTrackedChangeAnchorKey(params.changeId ?? changeId);
|
|
8581
|
-
handleTrackedChangeUpdate({
|
|
8582
|
-
superdoc,
|
|
8583
|
-
params,
|
|
8584
|
-
broadcastChanges
|
|
8585
|
-
});
|
|
8586
|
-
}
|
|
8587
|
-
};
|
|
8588
8445
|
const requestInstantSidebarAlignment = (targetY = null, threadId = null, instanceId = null) => {
|
|
8589
8446
|
const hasTargetY = Number.isFinite(targetY);
|
|
8590
8447
|
instantSidebarAlignmentTargetY.value = hasTargetY ? targetY : null;
|
|
@@ -10194,178 +10051,6 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
10194
10051
|
removePendingComment(superdoc);
|
|
10195
10052
|
};
|
|
10196
10053
|
/**
|
|
10197
|
-
* Imported DOCX comments can omit the normalized author string.
|
|
10198
|
-
* Strip the exporter suffix when present and tolerate missing metadata.
|
|
10199
|
-
*
|
|
10200
|
-
* @param {string | null | undefined} creatorName
|
|
10201
|
-
* @returns {string | null}
|
|
10202
|
-
*/
|
|
10203
|
-
const normalizeImportedCreatorName = (creatorName) => {
|
|
10204
|
-
if (typeof creatorName !== "string") return null;
|
|
10205
|
-
return creatorName.replace(/\s*\(imported\)\s*$/u, "").trim() || null;
|
|
10206
|
-
};
|
|
10207
|
-
/**
|
|
10208
|
-
* Read the mounted editor view and state without touching `editor.state`.
|
|
10209
|
-
* The editor convenience getter delegates to `view.state` and throws after
|
|
10210
|
-
* teardown, which is precisely when a deferred import callback can run.
|
|
10211
|
-
*
|
|
10212
|
-
* @param {Object | null | undefined} editor
|
|
10213
|
-
* @returns {{ view: Object, state: Object } | null}
|
|
10214
|
-
*/
|
|
10215
|
-
const readMountedEditorSnapshot = (editor) => {
|
|
10216
|
-
if (!editor) return null;
|
|
10217
|
-
try {
|
|
10218
|
-
if (editor.isDestroyed === true) return null;
|
|
10219
|
-
const view = editor.view;
|
|
10220
|
-
if (!view || view.isDestroyed === true || view.destroyed === true) return null;
|
|
10221
|
-
const state = view.state;
|
|
10222
|
-
if (!state) return null;
|
|
10223
|
-
return {
|
|
10224
|
-
view,
|
|
10225
|
-
state
|
|
10226
|
-
};
|
|
10227
|
-
} catch {
|
|
10228
|
-
return null;
|
|
10229
|
-
}
|
|
10230
|
-
};
|
|
10231
|
-
const normalizeBootstrapDocumentId = (documentId) => documentId !== void 0 && documentId !== null && String(documentId).length > 0 ? String(documentId) : null;
|
|
10232
|
-
/**
|
|
10233
|
-
* Cancel deferred imported tracked-change comment work. Passing a document
|
|
10234
|
-
* id cancels only that document; omitting it cancels every pending task.
|
|
10235
|
-
*
|
|
10236
|
-
* @param {string | null | undefined} documentId
|
|
10237
|
-
* @returns {number} number of invalidated tasks
|
|
10238
|
-
*/
|
|
10239
|
-
const cancelImportedTrackedChangeBootstrap = (documentId) => {
|
|
10240
|
-
const normalizedDocumentId = normalizeBootstrapDocumentId(documentId);
|
|
10241
|
-
const entries = normalizedDocumentId ? [[normalizedDocumentId, importedTrackedChangeBootstrapTasks.get(normalizedDocumentId)]] : Array.from(importedTrackedChangeBootstrapTasks.entries());
|
|
10242
|
-
let canceled = 0;
|
|
10243
|
-
for (const [taskDocumentId, task] of entries) {
|
|
10244
|
-
if (!task) continue;
|
|
10245
|
-
importedTrackedChangeBootstrapTasks.delete(taskDocumentId);
|
|
10246
|
-
if (task.timeoutHandle !== null && task.timeoutHandle !== void 0) clearTimeout(task.timeoutHandle);
|
|
10247
|
-
canceled += 1;
|
|
10248
|
-
}
|
|
10249
|
-
return canceled;
|
|
10250
|
-
};
|
|
10251
|
-
const captureImportedTrackedChangeBootstrapSnapshot = (editor) => {
|
|
10252
|
-
const mountedEditor = readMountedEditorSnapshot(editor);
|
|
10253
|
-
if (!mountedEditor) return null;
|
|
10254
|
-
let trackedChanges = [];
|
|
10255
|
-
try {
|
|
10256
|
-
trackedChanges = trackChangesHelpers.getTrackChanges(mountedEditor.state) ?? [];
|
|
10257
|
-
} catch {
|
|
10258
|
-
return null;
|
|
10259
|
-
}
|
|
10260
|
-
const enumerateStructuralChanges = trackChangesHelpers?.enumerateStructuralRowChanges;
|
|
10261
|
-
let structuralChanges = [];
|
|
10262
|
-
if (typeof enumerateStructuralChanges === "function") try {
|
|
10263
|
-
structuralChanges = enumerateStructuralChanges(mountedEditor.state) ?? [];
|
|
10264
|
-
} catch {
|
|
10265
|
-
structuralChanges = [];
|
|
10266
|
-
}
|
|
10267
|
-
let storySnapshots = [];
|
|
10268
|
-
if (typeof getTrackedChangeIndex === "function") try {
|
|
10269
|
-
storySnapshots = getTrackedChangeIndex(editor)?.getAll?.() ?? [];
|
|
10270
|
-
} catch {
|
|
10271
|
-
storySnapshots = [];
|
|
10272
|
-
}
|
|
10273
|
-
return {
|
|
10274
|
-
...mountedEditor,
|
|
10275
|
-
trackedChanges,
|
|
10276
|
-
structuralChanges,
|
|
10277
|
-
storySnapshots
|
|
10278
|
-
};
|
|
10279
|
-
};
|
|
10280
|
-
/**
|
|
10281
|
-
* Bootstrap tracked-change comment threads after a DOCX import finishes.
|
|
10282
|
-
*
|
|
10283
|
-
* Initial import historically rebuilt only body tracked-change threads so
|
|
10284
|
-
* resolved imported body comments stayed resolved. Header/footer and note
|
|
10285
|
-
* tracked changes live outside the body PM state, so they need an additional
|
|
10286
|
-
* story-aware bootstrap pass here.
|
|
10287
|
-
*
|
|
10288
|
-
* We intentionally keep the existing body-only rebuild instead of switching
|
|
10289
|
-
* to the broader syncTrackedChangeComments() path so imported resolved body
|
|
10290
|
-
* tracked-change threads preserve their initial resolved state.
|
|
10291
|
-
*
|
|
10292
|
-
* @param {Object | null | undefined} editor
|
|
10293
|
-
* @param {Object | null | undefined} superdoc
|
|
10294
|
-
* @param {Object | null | undefined} snapshot
|
|
10295
|
-
* @returns {boolean}
|
|
10296
|
-
*/
|
|
10297
|
-
const bootstrapImportedTrackedChangeComments = (editor, superdoc, snapshot = null) => {
|
|
10298
|
-
if (!editor || !superdoc) return false;
|
|
10299
|
-
const captured = snapshot ?? captureImportedTrackedChangeBootstrapSnapshot(editor);
|
|
10300
|
-
if (!captured) return false;
|
|
10301
|
-
createCommentForTrackChanges(editor, superdoc, captured.trackedChanges, {
|
|
10302
|
-
editorState: captured.state,
|
|
10303
|
-
editorView: captured.view
|
|
10304
|
-
});
|
|
10305
|
-
syncStoryTrackedChangeComments({
|
|
10306
|
-
superdoc,
|
|
10307
|
-
editor,
|
|
10308
|
-
snapshots: captured.storySnapshots,
|
|
10309
|
-
documentState: captured.state,
|
|
10310
|
-
resolveFromEditor: false
|
|
10311
|
-
});
|
|
10312
|
-
syncStructuralTrackedChangeComments({
|
|
10313
|
-
superdoc,
|
|
10314
|
-
editor,
|
|
10315
|
-
structuralChanges: captured.structuralChanges
|
|
10316
|
-
});
|
|
10317
|
-
return true;
|
|
10318
|
-
};
|
|
10319
|
-
const isCurrentImportedTrackedChangeBootstrap = (task) => {
|
|
10320
|
-
if (!task) return false;
|
|
10321
|
-
if (importedTrackedChangeBootstrapTasks.get(task.documentId) !== task) return false;
|
|
10322
|
-
try {
|
|
10323
|
-
const editorDocumentId = task.editor?.options?.documentId;
|
|
10324
|
-
if (editorDocumentId != null && String(editorDocumentId) !== task.documentId) return false;
|
|
10325
|
-
const mountedDocument = superdocStore.getDocument(task.documentId);
|
|
10326
|
-
if (!mountedDocument) return false;
|
|
10327
|
-
if (mountedDocument.getEditor?.() !== task.editor) return false;
|
|
10328
|
-
} catch {
|
|
10329
|
-
return false;
|
|
10330
|
-
}
|
|
10331
|
-
return true;
|
|
10332
|
-
};
|
|
10333
|
-
const runImportedTrackedChangeBootstrap = (task) => {
|
|
10334
|
-
if (!isCurrentImportedTrackedChangeBootstrap(task)) {
|
|
10335
|
-
if (importedTrackedChangeBootstrapTasks.get(task?.documentId) === task) importedTrackedChangeBootstrapTasks.delete(task.documentId);
|
|
10336
|
-
return false;
|
|
10337
|
-
}
|
|
10338
|
-
const snapshot = captureImportedTrackedChangeBootstrapSnapshot(task.editor);
|
|
10339
|
-
if (!snapshot || !isCurrentImportedTrackedChangeBootstrap(task)) {
|
|
10340
|
-
if (importedTrackedChangeBootstrapTasks.get(task.documentId) === task) importedTrackedChangeBootstrapTasks.delete(task.documentId);
|
|
10341
|
-
return false;
|
|
10342
|
-
}
|
|
10343
|
-
try {
|
|
10344
|
-
return bootstrapImportedTrackedChangeComments(task.editor, task.superdoc, snapshot);
|
|
10345
|
-
} finally {
|
|
10346
|
-
if (importedTrackedChangeBootstrapTasks.get(task.documentId) === task) importedTrackedChangeBootstrapTasks.delete(task.documentId);
|
|
10347
|
-
}
|
|
10348
|
-
};
|
|
10349
|
-
const scheduleImportedTrackedChangeBootstrap = ({ editor, superdoc, documentId, defer = true }) => {
|
|
10350
|
-
const normalizedDocumentId = normalizeBootstrapDocumentId(documentId);
|
|
10351
|
-
if (!normalizedDocumentId || !editor || !superdoc) return false;
|
|
10352
|
-
cancelImportedTrackedChangeBootstrap(normalizedDocumentId);
|
|
10353
|
-
const task = {
|
|
10354
|
-
documentId: normalizedDocumentId,
|
|
10355
|
-
editor,
|
|
10356
|
-
superdoc,
|
|
10357
|
-
generation: ++importedTrackedChangeBootstrapGeneration,
|
|
10358
|
-
timeoutHandle: null
|
|
10359
|
-
};
|
|
10360
|
-
importedTrackedChangeBootstrapTasks.set(normalizedDocumentId, task);
|
|
10361
|
-
if (!defer) return runImportedTrackedChangeBootstrap(task);
|
|
10362
|
-
task.timeoutHandle = setTimeout(() => {
|
|
10363
|
-
task.timeoutHandle = null;
|
|
10364
|
-
runImportedTrackedChangeBootstrap(task);
|
|
10365
|
-
}, 0);
|
|
10366
|
-
return true;
|
|
10367
|
-
};
|
|
10368
|
-
/**
|
|
10369
10054
|
* Drop imported threads and cached positions for one document id.
|
|
10370
10055
|
*
|
|
10371
10056
|
* Replace-file swaps call this before hydrating the replacement so stale
|
|
@@ -10382,7 +10067,6 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
10382
10067
|
delete next[activeDocumentId];
|
|
10383
10068
|
committedReviewPresentations.value = next;
|
|
10384
10069
|
}
|
|
10385
|
-
cancelImportedTrackedChangeBootstrap(activeDocumentId);
|
|
10386
10070
|
const removedComments = commentsList.value.filter((comment) => belongsToDocument(comment, activeDocumentId, { allowSingleDocumentMismatch: true }));
|
|
10387
10071
|
if (!removedComments.length) return;
|
|
10388
10072
|
const removedAliasIds = /* @__PURE__ */ new Set();
|
|
@@ -10400,170 +10084,6 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
10400
10084
|
const activeCommentId = activeComment.value != null ? String(activeComment.value) : null;
|
|
10401
10085
|
if (activeCommentId && removedAliasIds.has(activeCommentId)) clearActiveCommentSelection();
|
|
10402
10086
|
}
|
|
10403
|
-
function resetCommentsForReplacedDocument(documentId) {
|
|
10404
|
-
removeCommentsForDocument(documentId);
|
|
10405
|
-
}
|
|
10406
|
-
/**
|
|
10407
|
-
* Initialize loaded comments into SuperDoc by mapping the imported
|
|
10408
|
-
* comment data to SuperDoc useComment objects.
|
|
10409
|
-
*
|
|
10410
|
-
* Updates the commentsList ref with the new comments.
|
|
10411
|
-
*
|
|
10412
|
-
* @param {Object} param0
|
|
10413
|
-
* @param {Array} param0.comments The comments to be loaded
|
|
10414
|
-
* @param {String} param0.documentId The document ID
|
|
10415
|
-
* @param {boolean} [param0.replacedFile] Whether this load replaces an existing document in place
|
|
10416
|
-
* @returns {void}
|
|
10417
|
-
*/
|
|
10418
|
-
const processLoadedDocxComments = async ({ superdoc, editor, comments, documentId, replacedFile = false }) => {
|
|
10419
|
-
const document = superdocStore.getDocument(documentId);
|
|
10420
|
-
if (document?.commentThreadingProfile) document.commentThreadingProfile.value = editor?.converter?.commentThreadingProfile || null;
|
|
10421
|
-
if (replacedFile) resetCommentsForReplacedDocument(documentId);
|
|
10422
|
-
comments.forEach((comment) => {
|
|
10423
|
-
const textElements = Array.isArray(comment.elements) ? comment.elements : [];
|
|
10424
|
-
const htmlContent = getHtmlFromComment(textElements);
|
|
10425
|
-
if (!htmlContent && !comment.trackedChange) return;
|
|
10426
|
-
const creatorName = normalizeImportedCreatorName(comment.creatorName);
|
|
10427
|
-
const importedName = creatorName ? `${creatorName} (imported)` : null;
|
|
10428
|
-
const newComment = useComment({
|
|
10429
|
-
fileId: documentId,
|
|
10430
|
-
fileType: document.type,
|
|
10431
|
-
docxCommentJSON: textElements.length ? textElements : null,
|
|
10432
|
-
commentId: comment.commentId,
|
|
10433
|
-
isInternal: false,
|
|
10434
|
-
parentCommentId: comment.parentCommentId,
|
|
10435
|
-
trackedChangeParentId: comment.trackedChangeParentId,
|
|
10436
|
-
trackedChangeThreadParentId: comment.trackedChangeThreadParentId,
|
|
10437
|
-
creatorId: null,
|
|
10438
|
-
creatorName,
|
|
10439
|
-
createdTime: comment.createdTime,
|
|
10440
|
-
creatorEmail: comment.creatorEmail,
|
|
10441
|
-
importedAuthor: {
|
|
10442
|
-
...importedName ? { name: importedName } : {},
|
|
10443
|
-
email: comment.creatorEmail
|
|
10444
|
-
},
|
|
10445
|
-
commentText: htmlContent,
|
|
10446
|
-
resolvedTime: comment.isDone ? Date.now() : null,
|
|
10447
|
-
resolvedById: null,
|
|
10448
|
-
resolvedByEmail: comment.isDone ? comment.creatorEmail : null,
|
|
10449
|
-
resolvedByName: comment.isDone ? importedName || "(Imported)" : null,
|
|
10450
|
-
trackedChange: comment.trackedChange || false,
|
|
10451
|
-
trackedChangeText: comment.trackedChangeText,
|
|
10452
|
-
trackedChangeType: comment.trackedChangeType,
|
|
10453
|
-
trackedChangeDisplayType: comment.trackedChangeDisplayType,
|
|
10454
|
-
deletedText: comment.trackedDeletedText,
|
|
10455
|
-
origin: comment.origin || "word",
|
|
10456
|
-
threadingMethod: comment.threadingMethod,
|
|
10457
|
-
threadingStyleOverride: comment.threadingStyleOverride,
|
|
10458
|
-
threadingParentCommentId: comment.threadingParentCommentId,
|
|
10459
|
-
originalXmlStructure: comment.originalXmlStructure
|
|
10460
|
-
});
|
|
10461
|
-
addHydratedComment({
|
|
10462
|
-
superdoc,
|
|
10463
|
-
comment: newComment
|
|
10464
|
-
});
|
|
10465
|
-
});
|
|
10466
|
-
if (replacedFile) {
|
|
10467
|
-
scheduleImportedTrackedChangeBootstrap({
|
|
10468
|
-
editor,
|
|
10469
|
-
superdoc,
|
|
10470
|
-
documentId,
|
|
10471
|
-
defer: false
|
|
10472
|
-
});
|
|
10473
|
-
return;
|
|
10474
|
-
}
|
|
10475
|
-
scheduleImportedTrackedChangeBootstrap({
|
|
10476
|
-
editor,
|
|
10477
|
-
superdoc,
|
|
10478
|
-
documentId
|
|
10479
|
-
});
|
|
10480
|
-
};
|
|
10481
|
-
const createCommentForTrackChanges = (editor, superdoc, trackedChangesOverride = null, options = {}) => {
|
|
10482
|
-
const { reopenResolved = false, refreshExisting = false, broadcastChanges = true, editorState: editorStateOverride = null, editorView: editorViewOverride = null } = options;
|
|
10483
|
-
const mountedEditor = editorStateOverride ? {
|
|
10484
|
-
state: editorStateOverride,
|
|
10485
|
-
view: editorViewOverride
|
|
10486
|
-
} : readMountedEditorSnapshot(editor);
|
|
10487
|
-
if (!mountedEditor?.state) return;
|
|
10488
|
-
const editorState = mountedEditor.state;
|
|
10489
|
-
const trackedChanges = trackedChangesOverride ?? trackChangesHelpers.getTrackChanges(editorState);
|
|
10490
|
-
const groupedChanges = groupChanges(trackedChanges);
|
|
10491
|
-
const activeDocumentId = editor?.options?.documentId != null ? String(editor.options.documentId) : null;
|
|
10492
|
-
if (!activeDocumentId) return;
|
|
10493
|
-
const skipIds = /* @__PURE__ */ new Set();
|
|
10494
|
-
const existingTrackedChangeById = /* @__PURE__ */ new Map();
|
|
10495
|
-
commentsList.value.forEach((comment) => {
|
|
10496
|
-
if (!comment?.trackedChange) return;
|
|
10497
|
-
if (!belongsToTrackedChangeSyncDocument(comment, activeDocumentId)) return;
|
|
10498
|
-
if (!isBodyTrackedChangeComment(comment)) return;
|
|
10499
|
-
const commentIds = [comment.commentId, comment.importedId].map((id) => id != null ? String(id) : null).filter(Boolean);
|
|
10500
|
-
if (comment.resolvedTime) {
|
|
10501
|
-
if (!reopenResolved) commentIds.forEach((id) => skipIds.add(id));
|
|
10502
|
-
return;
|
|
10503
|
-
}
|
|
10504
|
-
commentIds.forEach((id) => {
|
|
10505
|
-
existingTrackedChangeById.set(id, comment);
|
|
10506
|
-
if (!refreshExisting) skipIds.add(id);
|
|
10507
|
-
});
|
|
10508
|
-
});
|
|
10509
|
-
const changesByIdMap = /* @__PURE__ */ new Map();
|
|
10510
|
-
for (const change of trackedChanges) {
|
|
10511
|
-
const id = change.mark.attrs.id;
|
|
10512
|
-
if (!changesByIdMap.has(id)) changesByIdMap.set(id, []);
|
|
10513
|
-
changesByIdMap.get(id).push(change);
|
|
10514
|
-
}
|
|
10515
|
-
const documentId = activeDocumentId;
|
|
10516
|
-
const processedIds = /* @__PURE__ */ new Set();
|
|
10517
|
-
groupedChanges.forEach(({ insertedMark, deletionMark, formatMark }) => {
|
|
10518
|
-
const id = insertedMark?.mark.attrs.id || deletionMark?.mark.attrs.id || formatMark?.mark.attrs.id;
|
|
10519
|
-
if (id == null) return;
|
|
10520
|
-
const normalizedId = String(id);
|
|
10521
|
-
if (processedIds.has(normalizedId)) return;
|
|
10522
|
-
processedIds.add(normalizedId);
|
|
10523
|
-
if (!refreshExisting && skipIds.has(normalizedId)) return;
|
|
10524
|
-
const existingTrackedChange = existingTrackedChangeById.get(normalizedId);
|
|
10525
|
-
const marks = {
|
|
10526
|
-
...insertedMark && { insertedMark: insertedMark.mark },
|
|
10527
|
-
...deletionMark && { deletionMark: deletionMark.mark },
|
|
10528
|
-
...formatMark && { formatMark: formatMark.mark }
|
|
10529
|
-
};
|
|
10530
|
-
const params = createOrUpdateTrackedChangeComment({
|
|
10531
|
-
event: existingTrackedChange ? "update" : "add",
|
|
10532
|
-
marks,
|
|
10533
|
-
nodes: [],
|
|
10534
|
-
newEditorState: editorState,
|
|
10535
|
-
documentId,
|
|
10536
|
-
trackedChangesForId: changesByIdMap.get(id) || []
|
|
10537
|
-
});
|
|
10538
|
-
if (params) {
|
|
10539
|
-
const anchorKey = buildBodyTrackedChangeAnchorKey(params.changeId ?? id);
|
|
10540
|
-
params.trackedChangeStory = BODY_TRACKED_CHANGE_STORY;
|
|
10541
|
-
params.trackedChangeStoryKind = "body";
|
|
10542
|
-
params.trackedChangeStoryLabel = "";
|
|
10543
|
-
params.trackedChangeAnchorKey = anchorKey;
|
|
10544
|
-
handleTrackedChangeUpdate({
|
|
10545
|
-
superdoc,
|
|
10546
|
-
params,
|
|
10547
|
-
broadcastChanges,
|
|
10548
|
-
documentState: editorState
|
|
10549
|
-
});
|
|
10550
|
-
if (!existingTrackedChange) {
|
|
10551
|
-
skipIds.add(normalizedId);
|
|
10552
|
-
if (params.changeId != null) skipIds.add(String(params.changeId));
|
|
10553
|
-
if (params.importedId != null) skipIds.add(String(params.importedId));
|
|
10554
|
-
}
|
|
10555
|
-
}
|
|
10556
|
-
});
|
|
10557
|
-
const editorView = mountedEditor.view;
|
|
10558
|
-
try {
|
|
10559
|
-
if (!editorView || editor.view !== editorView || editorView.isDestroyed === true || editorView.destroyed === true) return;
|
|
10560
|
-
} catch {
|
|
10561
|
-
return;
|
|
10562
|
-
}
|
|
10563
|
-
const { tr } = editorState;
|
|
10564
|
-
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
10565
|
-
editorView.dispatch(tr);
|
|
10566
|
-
};
|
|
10567
10087
|
/**
|
|
10568
10088
|
* Remove inline tracked-change comments whose change id is subsumed by a
|
|
10569
10089
|
* tracked whole-table change. Mirrors the deletion-event emission of
|
|
@@ -11466,286 +10986,6 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
11466
10986
|
return rowDocumentId != null && String(rowDocumentId) === normalizedDocumentId;
|
|
11467
10987
|
}).length;
|
|
11468
10988
|
};
|
|
11469
|
-
const syncTrackedChangeComments = ({ superdoc, editor, broadcastChanges = true }) => {
|
|
11470
|
-
if (!superdoc || !editor) return;
|
|
11471
|
-
const activeDocumentId = editor?.options?.documentId != null ? String(editor.options.documentId) : null;
|
|
11472
|
-
if (!activeDocumentId) return;
|
|
11473
|
-
const captured = captureImportedTrackedChangeBootstrapSnapshot(editor);
|
|
11474
|
-
if (!captured) return;
|
|
11475
|
-
const trackedChanges = captured.trackedChanges;
|
|
11476
|
-
const liveTrackedChangeIds = /* @__PURE__ */ new Set();
|
|
11477
|
-
trackedChanges.forEach((change) => {
|
|
11478
|
-
const id = change?.mark?.attrs?.id;
|
|
11479
|
-
if (id == null) return;
|
|
11480
|
-
liveTrackedChangeIds.add(String(id));
|
|
11481
|
-
});
|
|
11482
|
-
const storySnapshots = captured.storySnapshots;
|
|
11483
|
-
const liveTrackedChangeAnchorKeys = new Set(storySnapshots.map((snapshot) => snapshot?.anchorKey).filter((anchorKey) => typeof anchorKey === "string" && anchorKey.length > 0));
|
|
11484
|
-
pruneStaleTrackedChangeComments(liveTrackedChangeIds, liveTrackedChangeAnchorKeys, activeDocumentId, superdoc, { broadcastChanges });
|
|
11485
|
-
createCommentForTrackChanges(editor, superdoc, trackedChanges, {
|
|
11486
|
-
reopenResolved: true,
|
|
11487
|
-
refreshExisting: true,
|
|
11488
|
-
broadcastChanges,
|
|
11489
|
-
editorState: captured.state,
|
|
11490
|
-
editorView: captured.view
|
|
11491
|
-
});
|
|
11492
|
-
syncStoryTrackedChangeComments({
|
|
11493
|
-
superdoc,
|
|
11494
|
-
editor,
|
|
11495
|
-
broadcastChanges,
|
|
11496
|
-
snapshots: storySnapshots,
|
|
11497
|
-
documentState: captured.state
|
|
11498
|
-
});
|
|
11499
|
-
syncStructuralTrackedChangeComments({
|
|
11500
|
-
superdoc,
|
|
11501
|
-
editor,
|
|
11502
|
-
broadcastChanges,
|
|
11503
|
-
structuralChanges: captured.structuralChanges
|
|
11504
|
-
});
|
|
11505
|
-
};
|
|
11506
|
-
/**
|
|
11507
|
-
* Surface decidable whole-table structural tracked changes (table insert /
|
|
11508
|
-
* table delete) as right-rail bubbles, mirroring the inline tracked-change
|
|
11509
|
-
* path. Structural row revisions live on node attrs (not inline marks), so
|
|
11510
|
-
* the inline `getTrackChanges` enumerator never sees them — they are
|
|
11511
|
-
* enumerated separately here.
|
|
11512
|
-
*
|
|
11513
|
-
* Only `decidable` whole-table changes are surfaced; partial/mixed shapes are
|
|
11514
|
-
* not actionable (the decision engine fails them closed) so they get no
|
|
11515
|
-
* bubble. The bubble id is the document-api public id so accept/reject in the
|
|
11516
|
-
* sidebar routes `trackChanges.decide` to the same change.
|
|
11517
|
-
*
|
|
11518
|
-
* Positioning: the bubble carries a body-story anchorKey (matching the
|
|
11519
|
-
* tracked-change index snapshot) and a body PM range (table start/end). The
|
|
11520
|
-
* DocumentRendererRuntime position pass emits a body-story position entry for that
|
|
11521
|
-
* anchorKey, whose bounds resolve through the same `getRangeRects` path inline
|
|
11522
|
-
* body comments/TC use — so it lines up with the table in layout-engine
|
|
11523
|
-
* viewing mode.
|
|
11524
|
-
*/
|
|
11525
|
-
const syncStructuralTrackedChangeComments = ({ superdoc, editor, broadcastChanges = true, structuralChanges: structuralChangesOverride = null }) => {
|
|
11526
|
-
const activeDocumentId = editor?.options?.documentId != null ? String(editor.options.documentId) : null;
|
|
11527
|
-
if (!activeDocumentId) return;
|
|
11528
|
-
const enumerate = trackChangesHelpers?.enumerateStructuralRowChanges;
|
|
11529
|
-
if (typeof enumerate !== "function") return;
|
|
11530
|
-
let structuralChanges = structuralChangesOverride;
|
|
11531
|
-
if (!Array.isArray(structuralChanges)) {
|
|
11532
|
-
const mountedEditor = readMountedEditorSnapshot(editor);
|
|
11533
|
-
if (!mountedEditor) return;
|
|
11534
|
-
try {
|
|
11535
|
-
structuralChanges = enumerate(mountedEditor.state) ?? [];
|
|
11536
|
-
} catch {
|
|
11537
|
-
structuralChanges = [];
|
|
11538
|
-
}
|
|
11539
|
-
}
|
|
11540
|
-
for (const structural of structuralChanges) {
|
|
11541
|
-
if (!structural?.decidable || !structural?.wholeTable) continue;
|
|
11542
|
-
const publicId = buildStructuralTrackedChangeId(structural);
|
|
11543
|
-
if (!publicId) continue;
|
|
11544
|
-
const anchorKey = buildBodyTrackedChangeAnchorKey(publicId);
|
|
11545
|
-
const displayType = structural.subtype === "table-insert" ? "tableInsert" : "tableDelete";
|
|
11546
|
-
const trackedChangeType = structural.side === "insertion" ? "trackInsert" : "trackDelete";
|
|
11547
|
-
const normalizedPublicId = String(publicId);
|
|
11548
|
-
const normalizedAnchorKey = anchorKey != null ? String(anchorKey) : null;
|
|
11549
|
-
const params = {
|
|
11550
|
-
event: commentsList.value.find((comment) => {
|
|
11551
|
-
if (!comment?.trackedChange) return false;
|
|
11552
|
-
if (!belongsToTrackedChangeSyncDocument(comment, activeDocumentId)) return false;
|
|
11553
|
-
const commentAnchorKey = comment.trackedChangeAnchorKey != null ? String(comment.trackedChangeAnchorKey) : null;
|
|
11554
|
-
if (normalizedAnchorKey && commentAnchorKey) return commentAnchorKey === normalizedAnchorKey;
|
|
11555
|
-
const commentId = comment.commentId != null ? String(comment.commentId) : null;
|
|
11556
|
-
const importedId = comment.importedId != null ? String(comment.importedId) : null;
|
|
11557
|
-
return commentId === normalizedPublicId || importedId === normalizedPublicId;
|
|
11558
|
-
}) ? "update" : "add",
|
|
11559
|
-
changeId: publicId,
|
|
11560
|
-
trackedChangeText: "",
|
|
11561
|
-
trackedChangeType,
|
|
11562
|
-
trackedChangeDisplayType: displayType,
|
|
11563
|
-
deletedText: null,
|
|
11564
|
-
authorId: null,
|
|
11565
|
-
authorEmail: structural.authorEmail || null,
|
|
11566
|
-
authorImage: structural.authorImage || null,
|
|
11567
|
-
date: structural.date || null,
|
|
11568
|
-
author: structural.author || null,
|
|
11569
|
-
importedAuthor: structural.importedAuthor ? { name: structural.importedAuthor } : null,
|
|
11570
|
-
semanticColorKey: structural.semanticColorKey ?? null,
|
|
11571
|
-
semanticColor: structural.semanticColor ?? null,
|
|
11572
|
-
documentId: activeDocumentId,
|
|
11573
|
-
coords: null,
|
|
11574
|
-
trackedChangeStory: BODY_TRACKED_CHANGE_STORY,
|
|
11575
|
-
trackedChangeStoryKind: "body",
|
|
11576
|
-
trackedChangeStoryLabel: "",
|
|
11577
|
-
trackedChangeAnchorKey: anchorKey
|
|
11578
|
-
};
|
|
11579
|
-
handleTrackedChangeUpdate({
|
|
11580
|
-
superdoc,
|
|
11581
|
-
params,
|
|
11582
|
-
broadcastChanges
|
|
11583
|
-
});
|
|
11584
|
-
}
|
|
11585
|
-
};
|
|
11586
|
-
const syncStoryTrackedChangeComments = ({ superdoc, editor, broadcastChanges = true, snapshots = null, documentState = void 0, resolveFromEditor = true }) => {
|
|
11587
|
-
const activeDocumentId = editor?.options?.documentId != null ? String(editor.options.documentId) : null;
|
|
11588
|
-
if (!activeDocumentId) return;
|
|
11589
|
-
let resolvedSnapshots = snapshots;
|
|
11590
|
-
if (!Array.isArray(resolvedSnapshots)) {
|
|
11591
|
-
if (typeof getTrackedChangeIndex !== "function") return;
|
|
11592
|
-
if (!readMountedEditorSnapshot(editor)) return;
|
|
11593
|
-
let index = null;
|
|
11594
|
-
try {
|
|
11595
|
-
index = getTrackedChangeIndex(editor);
|
|
11596
|
-
} catch {
|
|
11597
|
-
return;
|
|
11598
|
-
}
|
|
11599
|
-
if (!index) return;
|
|
11600
|
-
try {
|
|
11601
|
-
resolvedSnapshots = index.getAll();
|
|
11602
|
-
} catch {
|
|
11603
|
-
return;
|
|
11604
|
-
}
|
|
11605
|
-
}
|
|
11606
|
-
for (const snapshot of resolvedSnapshots) {
|
|
11607
|
-
if (snapshot.storyKind === "body") continue;
|
|
11608
|
-
upsertStoryTrackedChangeComment({
|
|
11609
|
-
superdoc,
|
|
11610
|
-
editor,
|
|
11611
|
-
snapshot,
|
|
11612
|
-
documentId: activeDocumentId,
|
|
11613
|
-
broadcastChanges,
|
|
11614
|
-
documentState,
|
|
11615
|
-
resolveFromEditor
|
|
11616
|
-
});
|
|
11617
|
-
}
|
|
11618
|
-
};
|
|
11619
|
-
const getStoryTrackedChangeDisplayType = (snapshot) => {
|
|
11620
|
-
if (snapshot?.type !== "structural") return snapshot?.type ?? null;
|
|
11621
|
-
return snapshot?.subtype === "table-delete" ? "tableDelete" : "tableInsert";
|
|
11622
|
-
};
|
|
11623
|
-
const getStoryTrackedChangeType = (snapshot) => {
|
|
11624
|
-
if (snapshot?.type !== "structural") return snapshot?.type ?? null;
|
|
11625
|
-
return snapshot?.subtype === "table-delete" ? "trackDelete" : "trackInsert";
|
|
11626
|
-
};
|
|
11627
|
-
const isStoryTrackedChangeDeletion = (snapshot) => {
|
|
11628
|
-
if (!snapshot) return false;
|
|
11629
|
-
if (snapshot.type === "delete") return true;
|
|
11630
|
-
return snapshot.type === "structural" && snapshot.subtype === "table-delete";
|
|
11631
|
-
};
|
|
11632
|
-
const buildStoryTrackedChangeParams = ({ editor, snapshot, documentId, event, resolveFromEditor = true }) => {
|
|
11633
|
-
const trackedChangeType = getStoryTrackedChangeType(snapshot);
|
|
11634
|
-
const trackedChangeDisplayType = getStoryTrackedChangeDisplayType(snapshot);
|
|
11635
|
-
const fallbackParams = {
|
|
11636
|
-
event,
|
|
11637
|
-
changeId: snapshot.runtimeRef.rawId,
|
|
11638
|
-
trackedChangeText: isStoryTrackedChangeDeletion(snapshot) ? "" : snapshot.excerpt ?? "",
|
|
11639
|
-
trackedChangeType,
|
|
11640
|
-
trackedChangeDisplayType,
|
|
11641
|
-
semanticColorKey: snapshot.semanticColorKey ?? null,
|
|
11642
|
-
semanticColor: snapshot.semanticColor ?? null,
|
|
11643
|
-
deletedText: isStoryTrackedChangeDeletion(snapshot) ? snapshot.excerpt ?? "" : null,
|
|
11644
|
-
authorId: snapshot.authorId,
|
|
11645
|
-
authorEmail: snapshot.authorEmail,
|
|
11646
|
-
authorImage: snapshot.authorImage,
|
|
11647
|
-
date: snapshot.date,
|
|
11648
|
-
author: snapshot.author,
|
|
11649
|
-
documentId,
|
|
11650
|
-
coords: null,
|
|
11651
|
-
trackedChangeStory: snapshot.story,
|
|
11652
|
-
trackedChangeStoryKind: snapshot.storyKind,
|
|
11653
|
-
trackedChangeStoryLabel: snapshot.storyLabel,
|
|
11654
|
-
trackedChangeAnchorKey: snapshot.anchorKey
|
|
11655
|
-
};
|
|
11656
|
-
if (!resolveFromEditor || typeof resolveTrackedChangeInStory !== "function") return fallbackParams;
|
|
11657
|
-
let resolvedChange = null;
|
|
11658
|
-
try {
|
|
11659
|
-
resolvedChange = resolveTrackedChangeInStory(editor, {
|
|
11660
|
-
kind: "entity",
|
|
11661
|
-
entityType: "trackedChange",
|
|
11662
|
-
entityId: snapshot.runtimeRef.rawId,
|
|
11663
|
-
story: snapshot.story
|
|
11664
|
-
});
|
|
11665
|
-
} catch {
|
|
11666
|
-
resolvedChange = null;
|
|
11667
|
-
}
|
|
11668
|
-
const storyEditorState = resolvedChange?.editor?.state ?? null;
|
|
11669
|
-
if (!storyEditorState) return fallbackParams;
|
|
11670
|
-
let trackedChangesForId = [];
|
|
11671
|
-
try {
|
|
11672
|
-
trackedChangesForId = trackChangesHelpers.getTrackChanges(storyEditorState, resolvedChange.change.rawId) ?? [];
|
|
11673
|
-
} catch {
|
|
11674
|
-
trackedChangesForId = [];
|
|
11675
|
-
}
|
|
11676
|
-
const resolvedParams = createOrUpdateTrackedChangeComment({
|
|
11677
|
-
event,
|
|
11678
|
-
marks: collectTrackedChangeMarksByType(trackedChangesForId),
|
|
11679
|
-
nodes: [],
|
|
11680
|
-
newEditorState: storyEditorState,
|
|
11681
|
-
documentId,
|
|
11682
|
-
trackedChangesForId
|
|
11683
|
-
});
|
|
11684
|
-
if (!resolvedParams) return fallbackParams;
|
|
11685
|
-
if (resolvedParams.semanticColorKey == null && snapshot.semanticColorKey != null) resolvedParams.semanticColorKey = snapshot.semanticColorKey;
|
|
11686
|
-
if (resolvedParams.semanticColor == null && snapshot.semanticColor != null) resolvedParams.semanticColor = snapshot.semanticColor;
|
|
11687
|
-
resolvedParams.trackedChangeStory = snapshot.story;
|
|
11688
|
-
resolvedParams.trackedChangeStoryKind = snapshot.storyKind;
|
|
11689
|
-
resolvedParams.trackedChangeStoryLabel = snapshot.storyLabel;
|
|
11690
|
-
resolvedParams.trackedChangeAnchorKey = snapshot.anchorKey;
|
|
11691
|
-
return resolvedParams;
|
|
11692
|
-
};
|
|
11693
|
-
const upsertStoryTrackedChangeComment = ({ superdoc, editor, snapshot, documentId, broadcastChanges, documentState, resolveFromEditor }) => {
|
|
11694
|
-
if (!snapshot?.runtimeRef?.rawId) return;
|
|
11695
|
-
const existingComment = commentsList.value.find((comment) => {
|
|
11696
|
-
if (!comment?.trackedChange) return false;
|
|
11697
|
-
const commentAnchorKey = comment.trackedChangeAnchorKey != null ? String(comment.trackedChangeAnchorKey) : null;
|
|
11698
|
-
if (commentAnchorKey && snapshot.anchorKey) return commentAnchorKey === snapshot.anchorKey;
|
|
11699
|
-
if (commentAnchorKey || snapshot.anchorKey) return false;
|
|
11700
|
-
return comment.commentId === snapshot.runtimeRef.rawId || comment.importedId === snapshot.runtimeRef.rawId;
|
|
11701
|
-
});
|
|
11702
|
-
const params = buildStoryTrackedChangeParams({
|
|
11703
|
-
editor,
|
|
11704
|
-
snapshot,
|
|
11705
|
-
documentId,
|
|
11706
|
-
event: existingComment ? "update" : "add",
|
|
11707
|
-
resolveFromEditor
|
|
11708
|
-
});
|
|
11709
|
-
handleTrackedChangeUpdate({
|
|
11710
|
-
superdoc,
|
|
11711
|
-
params,
|
|
11712
|
-
broadcastChanges,
|
|
11713
|
-
documentState
|
|
11714
|
-
});
|
|
11715
|
-
if (existingComment) {
|
|
11716
|
-
existingComment.trackedChangeStory = snapshot.story;
|
|
11717
|
-
existingComment.trackedChangeStoryKind = snapshot.storyKind;
|
|
11718
|
-
existingComment.trackedChangeStoryLabel = snapshot.storyLabel;
|
|
11719
|
-
existingComment.trackedChangeAnchorKey = snapshot.anchorKey;
|
|
11720
|
-
}
|
|
11721
|
-
};
|
|
11722
|
-
const normalizeDocxSchemaForExport = (value) => {
|
|
11723
|
-
if (!value) return [];
|
|
11724
|
-
return (Array.isArray(value) ? value : [value]).filter(Boolean);
|
|
11725
|
-
};
|
|
11726
|
-
const translateCommentsForExport = () => {
|
|
11727
|
-
const processedComments = [];
|
|
11728
|
-
commentsList.value.forEach((comment) => {
|
|
11729
|
-
const values = comment.getValues();
|
|
11730
|
-
const richText = values.commentText;
|
|
11731
|
-
const docxSchema = normalizeDocxSchemaForExport(values.docxCommentJSON);
|
|
11732
|
-
const schema = docxSchema.length ? docxSchema : convertHtmlToSchema(richText);
|
|
11733
|
-
processedComments.push({
|
|
11734
|
-
...values,
|
|
11735
|
-
commentJSON: schema
|
|
11736
|
-
});
|
|
11737
|
-
});
|
|
11738
|
-
return processedComments;
|
|
11739
|
-
};
|
|
11740
|
-
const convertHtmlToSchema = (commentHTML) => {
|
|
11741
|
-
const json = new Editor({
|
|
11742
|
-
mode: "text",
|
|
11743
|
-
isHeadless: true,
|
|
11744
|
-
content: commentHTML,
|
|
11745
|
-
extensions: getRichTextExtensions()
|
|
11746
|
-
}).getJSON();
|
|
11747
|
-
return Array.isArray(json?.content) ? json.content.filter(Boolean) : [];
|
|
11748
|
-
};
|
|
11749
10989
|
/**
|
|
11750
10990
|
* Triggered when the editor locations are updated
|
|
11751
10991
|
* Updates floating comment locations from the editor
|
|
@@ -11996,75 +11236,6 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
11996
11236
|
if (typeof commentsVisible === "boolean") viewingVisibility.commentsVisible = commentsVisible;
|
|
11997
11237
|
if (typeof trackChangesVisible === "boolean") viewingVisibility.trackChangesVisible = trackChangesVisible;
|
|
11998
11238
|
};
|
|
11999
|
-
/**
|
|
12000
|
-
* Get HTML content from the comment text JSON (which uses DOCX schema)
|
|
12001
|
-
*
|
|
12002
|
-
* @param {Object} commentTextJson The comment text JSON
|
|
12003
|
-
* @returns {string} The HTML content
|
|
12004
|
-
*/
|
|
12005
|
-
const normalizeCommentForEditor = (node) => {
|
|
12006
|
-
if (Array.isArray(node)) return node.map((child) => normalizeCommentForEditor(child)).flat().filter(Boolean);
|
|
12007
|
-
if (!node || typeof node !== "object") return node;
|
|
12008
|
-
const stripTextStyleAttrs = (attrs) => {
|
|
12009
|
-
if (!attrs) return attrs;
|
|
12010
|
-
const rest = { ...attrs };
|
|
12011
|
-
delete rest.fontSize;
|
|
12012
|
-
delete rest.fontFamily;
|
|
12013
|
-
delete rest.eastAsiaFontFamily;
|
|
12014
|
-
return Object.keys(rest).length ? rest : void 0;
|
|
12015
|
-
};
|
|
12016
|
-
const normalizeMark = (mark) => {
|
|
12017
|
-
if (!mark) return mark;
|
|
12018
|
-
const typeName = typeof mark.type === "string" ? mark.type : mark.type?.name;
|
|
12019
|
-
const attrs = mark?.attrs ? { ...mark.attrs } : void 0;
|
|
12020
|
-
if (typeName === "textStyle" && attrs) return {
|
|
12021
|
-
...mark,
|
|
12022
|
-
attrs: stripTextStyleAttrs(attrs)
|
|
12023
|
-
};
|
|
12024
|
-
return {
|
|
12025
|
-
...mark,
|
|
12026
|
-
attrs
|
|
12027
|
-
};
|
|
12028
|
-
};
|
|
12029
|
-
const cloneMarks = (marks) => Array.isArray(marks) ? marks.filter(Boolean).map((mark) => normalizeMark(mark)) : void 0;
|
|
12030
|
-
const cloneAttrs = (attrs) => attrs && typeof attrs === "object" ? { ...attrs } : void 0;
|
|
12031
|
-
if (!Array.isArray(node.content)) return {
|
|
12032
|
-
type: node.type,
|
|
12033
|
-
...node.text !== void 0 ? { text: node.text } : {},
|
|
12034
|
-
...node.attrs ? { attrs: cloneAttrs(node.attrs) } : {},
|
|
12035
|
-
...node.marks ? { marks: cloneMarks(node.marks) } : {}
|
|
12036
|
-
};
|
|
12037
|
-
const normalizedChildren = node.content.map((child) => normalizeCommentForEditor(child)).flat().filter(Boolean);
|
|
12038
|
-
if (node.type === "run") return normalizedChildren;
|
|
12039
|
-
return {
|
|
12040
|
-
type: node.type,
|
|
12041
|
-
...node.attrs ? { attrs: cloneAttrs(node.attrs) } : {},
|
|
12042
|
-
...node.marks ? { marks: cloneMarks(node.marks) } : {},
|
|
12043
|
-
content: normalizedChildren
|
|
12044
|
-
};
|
|
12045
|
-
};
|
|
12046
|
-
const getHtmlFromComment = (commentTextElements) => {
|
|
12047
|
-
const elementsArray = Array.isArray(commentTextElements) ? commentTextElements : commentTextElements ? [commentTextElements] : [];
|
|
12048
|
-
if (!elementsArray.some((element) => element?.content?.length)) return;
|
|
12049
|
-
try {
|
|
12050
|
-
const normalizedContent = normalizeCommentForEditor(elementsArray);
|
|
12051
|
-
const contentArray = Array.isArray(normalizedContent) ? normalizedContent : normalizedContent ? [normalizedContent] : [];
|
|
12052
|
-
if (!contentArray.length) return null;
|
|
12053
|
-
return new Editor({
|
|
12054
|
-
mode: "text",
|
|
12055
|
-
isHeadless: true,
|
|
12056
|
-
content: {
|
|
12057
|
-
type: "doc",
|
|
12058
|
-
content: contentArray
|
|
12059
|
-
},
|
|
12060
|
-
loadFromSchema: true,
|
|
12061
|
-
extensions: getRichTextExtensions()
|
|
12062
|
-
}).getHTML();
|
|
12063
|
-
} catch (error) {
|
|
12064
|
-
console.warn("Failed to convert comment", error);
|
|
12065
|
-
return;
|
|
12066
|
-
}
|
|
12067
|
-
};
|
|
12068
11239
|
return {
|
|
12069
11240
|
COMMENT_EVENTS,
|
|
12070
11241
|
isDebugging,
|
|
@@ -12133,23 +11304,18 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
12133
11304
|
cancelComment,
|
|
12134
11305
|
deleteComment,
|
|
12135
11306
|
removePendingComment,
|
|
12136
|
-
cancelImportedTrackedChangeBootstrap,
|
|
12137
11307
|
removeCommentsForDocument,
|
|
12138
11308
|
setReviewDirectoryFromV2,
|
|
12139
11309
|
clearReviewDirectory,
|
|
12140
|
-
processLoadedDocxComments,
|
|
12141
|
-
translateCommentsForExport,
|
|
12142
11310
|
handleEditorLocationsUpdate,
|
|
12143
11311
|
clearEditorCommentPositions,
|
|
12144
11312
|
handleTrackedChangeUpdate,
|
|
12145
|
-
refreshTrackedChangeCommentsByIds,
|
|
12146
11313
|
syncResolvedCommentsWithDocument,
|
|
12147
11314
|
syncTrackedChangePositionsWithDocument,
|
|
12148
11315
|
setActiveFloatingCommentInstance,
|
|
12149
11316
|
requestInstantSidebarAlignment,
|
|
12150
11317
|
peekInstantSidebarAlignment,
|
|
12151
11318
|
clearInstantSidebarAlignment,
|
|
12152
|
-
syncTrackedChangeComments,
|
|
12153
11319
|
decideTrackedChangeFromSidebar,
|
|
12154
11320
|
v2CommentsAdapter,
|
|
12155
11321
|
setV2CommentsAdapter,
|
|
@@ -22128,7 +21294,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
22128
21294
|
}
|
|
22129
21295
|
});
|
|
22130
21296
|
const { getConfig, documentsWithConverations, commentsList, pendingComment, activeComment, skipSelectionUpdate, commentsByDocument, isCommentsListVisible, isFloatingCommentsReady, generalCommentIds, hasSyncedCollaborationComments, editorCommentPositions, hasInitializedLocations, isCommentHighlighted, hasOpenTrackedChanges } = storeToRefs(commentsStore);
|
|
22131
|
-
const { showAddComment, handleEditorLocationsUpdate, handleTrackedChangeUpdate,
|
|
21297
|
+
const { showAddComment, handleEditorLocationsUpdate, handleTrackedChangeUpdate, syncTrackedChangePositionsWithDocument, addComment, addHydratedComment, getComment, resolveCommentPositionEntry, belongsToDocument, COMMENT_EVENTS, requestInstantSidebarAlignment, peekInstantSidebarAlignment, clearInstantSidebarAlignment } = commentsStore;
|
|
22132
21298
|
const { proxy } = getCurrentInstance();
|
|
22133
21299
|
commentsStore.proxy = proxy;
|
|
22134
21300
|
const documentOpenTelemetry = createDocumentOpenTelemetry(proxy.$superdoc.config);
|
|
@@ -22180,7 +21346,6 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
22180
21346
|
const layers = ref(null);
|
|
22181
21347
|
const rightSidebarRef = ref(null);
|
|
22182
21348
|
const pdfViewerRef = ref(null);
|
|
22183
|
-
const pendingReplayTrackedChangeSync = ref(false);
|
|
22184
21349
|
const toolsMenuPosition = reactive({
|
|
22185
21350
|
top: null,
|
|
22186
21351
|
right: "-25px",
|
|
@@ -22243,20 +21408,6 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
22243
21408
|
}
|
|
22244
21409
|
});
|
|
22245
21410
|
const pdfConfig = proxy.$superdoc.config.modules?.pdf || {};
|
|
22246
|
-
const flushPendingReplayTrackedChangeSync = () => {
|
|
22247
|
-
if (!pendingReplayTrackedChangeSync.value) return;
|
|
22248
|
-
pendingReplayTrackedChangeSync.value = false;
|
|
22249
|
-
syncTrackedChangeComments({
|
|
22250
|
-
superdoc: proxy.$superdoc,
|
|
22251
|
-
editor: proxy.$superdoc?.activeEditor
|
|
22252
|
-
});
|
|
22253
|
-
};
|
|
22254
|
-
const scheduleReplayTrackedChangeSync = () => {
|
|
22255
|
-
pendingReplayTrackedChangeSync.value = true;
|
|
22256
|
-
nextTick(() => {
|
|
22257
|
-
flushPendingReplayTrackedChangeSync();
|
|
22258
|
-
});
|
|
22259
|
-
};
|
|
22260
21411
|
const handleDocumentReady = (documentId, container) => {
|
|
22261
21412
|
const doc = getDocument(documentId);
|
|
22262
21413
|
if (!doc || doc.loadScope && !doc.loadScope.finish()) return;
|
|
@@ -23256,7 +22407,6 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
23256
22407
|
v2PageMetricsSnapshot.value = null;
|
|
23257
22408
|
const clearedDocumentId = payload?.documentId == null ? null : String(payload.documentId);
|
|
23258
22409
|
clearV2MutationRejectionNotifications(clearedDocumentId);
|
|
23259
|
-
commentsStore.cancelImportedTrackedChangeBootstrap?.(clearedDocumentId ?? void 0);
|
|
23260
22410
|
if (clearedDocumentId) v2MountStagesByDocumentId.delete(clearedDocumentId);
|
|
23261
22411
|
if (latestV2MountStage && (clearedDocumentId == null || latestV2MountStage.dataset?.superdocV2DocumentId === clearedDocumentId)) latestV2MountStage = null;
|
|
23262
22412
|
v2ReviewWindowController.reset("render-cleared");
|
|
@@ -23272,7 +22422,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
23272
22422
|
...event,
|
|
23273
22423
|
documentId: document?.id ?? null
|
|
23274
22424
|
}));
|
|
23275
|
-
if (event.type === "mutation:committed" && event.
|
|
22425
|
+
if (event.type === "mutation:committed" && event.dryRun) return;
|
|
23276
22426
|
const documentId = document?.id ?? null;
|
|
23277
22427
|
if (event.type === "history:changed" && event.state) {
|
|
23278
22428
|
proxy.$superdoc.emit("history-change", {
|
|
@@ -23790,7 +22940,6 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
23790
22940
|
existingComment: null
|
|
23791
22941
|
};
|
|
23792
22942
|
};
|
|
23793
|
-
if (type === "replayCompleted") scheduleReplayTrackedChangeSync();
|
|
23794
22943
|
if (COMMENT_EVENTS?.ADD && type === COMMENT_EVENTS.ADD && commentPayload) {
|
|
23795
22944
|
commentPayload = normalizeReplayCommentModelPayload(commentPayload);
|
|
23796
22945
|
const currentUser = proxy.$superdoc?.user;
|
|
@@ -24099,7 +23248,6 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
24099
23248
|
handleFormattingMarksShortcut(e);
|
|
24100
23249
|
}
|
|
24101
23250
|
onBeforeUnmount(() => {
|
|
24102
|
-
commentsStore.cancelImportedTrackedChangeBootstrap?.();
|
|
24103
23251
|
passwordPrompt.destroy();
|
|
24104
23252
|
findReplace.destroy();
|
|
24105
23253
|
linkPopover.destroy();
|
|
@@ -24715,7 +23863,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
|
|
|
24715
23863
|
], 46, _hoisted_1$17);
|
|
24716
23864
|
};
|
|
24717
23865
|
}
|
|
24718
|
-
}, [["__scopeId", "data-v-
|
|
23866
|
+
}, [["__scopeId", "data-v-f7cc9a3c"]]);
|
|
24719
23867
|
//#endregion
|
|
24720
23868
|
//#region src/core/create-app.js
|
|
24721
23869
|
var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
|
|
@@ -46415,7 +45563,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
46415
45563
|
}
|
|
46416
45564
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
46417
45565
|
this.colorIndex = 0;
|
|
46418
|
-
this.version = "2.28.0-next.
|
|
45566
|
+
this.version = "2.28.0-next.13";
|
|
46419
45567
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
46420
45568
|
this.superdocId = config.superdocId || v4();
|
|
46421
45569
|
this.colors = this.config.colors ?? [];
|
|
@@ -48439,23 +47587,6 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
48439
47587
|
confirmed
|
|
48440
47588
|
};
|
|
48441
47589
|
}
|
|
48442
|
-
const legacyReplaceFile = activeEditor && !isV2ActiveEditorFacade(activeEditor) ? activeEditor.replaceFile : null;
|
|
48443
|
-
if (typeof legacyReplaceFile === "function") {
|
|
48444
|
-
const result = await legacyReplaceFile.call(activeEditor, source);
|
|
48445
|
-
const legacyState = result && typeof result === "object" ? result.state : void 0;
|
|
48446
|
-
const legacyConfirmed = legacyState === void 0 || legacyState === null || legacyState === "review-ready" || legacyState === "editing-ready";
|
|
48447
|
-
if (legacyConfirmed) {
|
|
48448
|
-
this.#replaceActiveDocumentData(activeEditor, source);
|
|
48449
|
-
this.emit("document-replaced", {
|
|
48450
|
-
editor: activeEditor,
|
|
48451
|
-
host: activeEditor?.host
|
|
48452
|
-
});
|
|
48453
|
-
}
|
|
48454
|
-
return {
|
|
48455
|
-
raw: result,
|
|
48456
|
-
confirmed: legacyConfirmed
|
|
48457
|
-
};
|
|
48458
|
-
}
|
|
48459
47590
|
throw new Error("SuperDoc: replaceFile is unavailable for the active editor");
|
|
48460
47591
|
}
|
|
48461
47592
|
/**
|
|
@@ -48468,19 +47599,6 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
48468
47599
|
commentsType,
|
|
48469
47600
|
isFinalDoc
|
|
48470
47601
|
});
|
|
48471
|
-
const uiStoreHydrated = this.config?.modules?.comments !== false;
|
|
48472
|
-
let legacyComments;
|
|
48473
|
-
let legacyCommentsComputed = false;
|
|
48474
|
-
const getLegacyCommentsForV1 = () => {
|
|
48475
|
-
if (legacyCommentsComputed) return legacyComments;
|
|
48476
|
-
legacyCommentsComputed = true;
|
|
48477
|
-
if (commentsType === "clean") legacyComments = [];
|
|
48478
|
-
else if (uiStoreHydrated && this.commentsStore && typeof this.commentsStore.translateCommentsForExport === "function") {
|
|
48479
|
-
legacyComments = this.commentsStore.translateCommentsForExport();
|
|
48480
|
-
if (!Array.isArray(legacyComments)) legacyComments = [];
|
|
48481
|
-
}
|
|
48482
|
-
return legacyComments;
|
|
48483
|
-
};
|
|
48484
47602
|
const bridgedExportErrors = /* @__PURE__ */ new WeakSet();
|
|
48485
47603
|
const rememberBridgedExportError = (payload) => {
|
|
48486
47604
|
if ("editor" in payload && payload.error && typeof payload.error === "object") bridgedExportErrors.add(payload.error);
|
|
@@ -48491,7 +47609,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
48491
47609
|
if (policies !== void 0 && documents.some((doc) => {
|
|
48492
47610
|
if (doc.type !== "application/vnd.openxmlformats-officedocument.wordprocessingml.document") return false;
|
|
48493
47611
|
const editor = doc.getEditor?.();
|
|
48494
|
-
return editor
|
|
47612
|
+
return !isV2ActiveEditorFacade(editor) || typeof editor.exportDocx !== "function";
|
|
48495
47613
|
})) throw new Error("Independent DOCX export policies require a mounted V2 exporter for every document.");
|
|
48496
47614
|
const docxPromises = documents.map(async (doc) => {
|
|
48497
47615
|
if (!doc || doc.type !== "application/vnd.openxmlformats-officedocument.wordprocessingml.document") return null;
|
|
@@ -48504,19 +47622,13 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
48504
47622
|
if (isDocumentByteSource(doc.data)) return this.#savedDocxToBlob(doc.data);
|
|
48505
47623
|
return null;
|
|
48506
47624
|
};
|
|
48507
|
-
if (!editor || typeof editor.exportDocx !== "function") return fallbackDocx();
|
|
48508
|
-
const isV2Editor = editor.editorVersion === 2;
|
|
47625
|
+
if (!isV2ActiveEditorFacade(editor) || typeof editor.exportDocx !== "function") return fallbackDocx();
|
|
48509
47626
|
try {
|
|
48510
|
-
const exported = await editor.exportDocx(
|
|
47627
|
+
const exported = await editor.exportDocx({
|
|
48511
47628
|
isFinalDoc,
|
|
48512
47629
|
commentsType,
|
|
48513
47630
|
policies,
|
|
48514
47631
|
fieldsHighlightColor
|
|
48515
|
-
} : {
|
|
48516
|
-
isFinalDoc,
|
|
48517
|
-
comments: getLegacyCommentsForV1(),
|
|
48518
|
-
commentsType,
|
|
48519
|
-
fieldsHighlightColor
|
|
48520
47632
|
});
|
|
48521
47633
|
if (exported) return exported;
|
|
48522
47634
|
} catch (error) {
|
|
@@ -48530,7 +47642,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
48530
47642
|
editor: null
|
|
48531
47643
|
}));
|
|
48532
47644
|
}
|
|
48533
|
-
|
|
47645
|
+
throw error;
|
|
48534
47646
|
}
|
|
48535
47647
|
return fallbackDocx();
|
|
48536
47648
|
});
|