@harbour-enterprises/superdoc 1.3.1-next.2 → 1.4.0-next.1
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-B0cx-Fxj.es.js → PdfViewer-DRTk3dY6.es.js} +2 -2
- package/dist/chunks/{PdfViewer-BFIKd3-b.cjs → PdfViewer-H9_8IbtN.cjs} +2 -2
- package/dist/chunks/{SuperConverter-BE5tNyQz.es.js → SuperConverter-CFRB4XNw.es.js} +3 -2
- package/dist/chunks/{SuperConverter-Cu6cvHlN.cjs → SuperConverter-CgY28MJz.cjs} +3 -2
- package/dist/chunks/{index-Dp7mSzy1.es.js → index-BP9aFfwI.es.js} +115 -22
- package/dist/chunks/{index-DWfzQ0RN.cjs → index-BdaseaBw.cjs} +115 -22
- package/dist/chunks/{index-BjQU1XSp.cjs → index-C3KRKogJ.cjs} +119 -21
- package/dist/chunks/{index-SYGYHKb5.es.js → index-CEcYlysg.es.js} +119 -21
- package/dist/style.css +49 -49
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc/src/components/CommentsLayer/types.d.ts +3 -157
- package/dist/superdoc/src/components/CommentsLayer/types.d.ts.map +1 -1
- package/dist/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/superdoc/src/core/types/index.d.ts +12 -0
- package/dist/superdoc/src/core/types/index.d.ts.map +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +4 -1
- package/dist/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/superdoc/src/stores/superdoc-store.d.ts +12 -3
- package/dist/superdoc/src/stores/superdoc-store.d.ts.map +1 -1
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +233 -41
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/super-editor/src/core/Extension.d.ts +0 -33
- package/dist/super-editor/src/core/Extension.d.ts.map +0 -1
- package/dist/super-editor/src/core/helpers/getExtensionConfigField.d.ts +0 -35
- package/dist/super-editor/src/core/helpers/getExtensionConfigField.d.ts.map +0 -1
- package/dist/super-editor/src/core/utilities/callOrGet.d.ts +0 -13
- package/dist/super-editor/src/core/utilities/callOrGet.d.ts.map +0 -1
- package/dist/super-editor/src/extensions/comment/comments-constants.d.ts +0 -2
- package/dist/super-editor/src/extensions/comment/comments-constants.d.ts.map +0 -1
- package/dist/super-editor/src/extensions/comment/comments-plugin.d.ts +0 -1
- package/dist/superdoc/src/SuperDoc.test.d.ts +0 -2
- package/dist/superdoc/src/SuperDoc.test.d.ts.map +0 -1
- package/dist/superdoc/src/components/CommentsLayer/CommentDialog.test.d.ts +0 -2
- package/dist/superdoc/src/components/CommentsLayer/CommentDialog.test.d.ts.map +0 -1
- package/dist/superdoc/src/components/CommentsLayer/use-comment.test.d.ts +0 -2
- package/dist/superdoc/src/components/CommentsLayer/use-comment.test.d.ts.map +0 -1
- package/dist/superdoc/src/core/SuperDoc.test.d.ts +0 -2
- package/dist/superdoc/src/core/SuperDoc.test.d.ts.map +0 -1
- package/dist/superdoc/src/core/collaboration/collaboration.test.d.ts +0 -2
- package/dist/superdoc/src/core/collaboration/collaboration.test.d.ts.map +0 -1
- package/dist/superdoc/src/core/helpers/export.test.d.ts +0 -2
- package/dist/superdoc/src/core/helpers/export.test.d.ts.map +0 -1
- package/dist/superdoc/src/core/helpers/file.test.d.ts +0 -2
- package/dist/superdoc/src/core/helpers/file.test.d.ts.map +0 -1
- package/dist/superdoc/src/stores/comments-store.test.d.ts +0 -2
- package/dist/superdoc/src/stores/comments-store.test.d.ts.map +0 -1
- package/dist/superdoc/src/stores/hrbr-fields-store.test.d.ts +0 -2
- package/dist/superdoc/src/stores/hrbr-fields-store.test.d.ts.map +0 -1
- package/dist/superdoc/src/stores/superdoc-store.test.d.ts +0 -2
- package/dist/superdoc/src/stores/superdoc-store.test.d.ts.map +0 -1
- package/dist/superdoc/src/tests/helpers/group-changes.test.d.ts +0 -2
- package/dist/superdoc/src/tests/helpers/group-changes.test.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const index = require("./index-
|
|
3
|
-
require("./SuperConverter-
|
|
2
|
+
const index = require("./index-C3KRKogJ.cjs");
|
|
3
|
+
require("./SuperConverter-CgY28MJz.cjs");
|
|
4
4
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
5
5
|
const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
|
|
6
6
|
const provider = require("@hocuspocus/provider");
|
|
@@ -5161,6 +5161,11 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5161
5161
|
allowResolve: true,
|
|
5162
5162
|
showResolved: false
|
|
5163
5163
|
});
|
|
5164
|
+
const viewingVisibility = vue.reactive({
|
|
5165
|
+
documentMode: "editing",
|
|
5166
|
+
commentsVisible: false,
|
|
5167
|
+
trackChangesVisible: false
|
|
5168
|
+
});
|
|
5164
5169
|
const isDebugging = false;
|
|
5165
5170
|
const debounceTimers = {};
|
|
5166
5171
|
const COMMENT_EVENTS = index.comments_module_events;
|
|
@@ -5187,6 +5192,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5187
5192
|
const isFloatingCommentsReady = vue.ref(false);
|
|
5188
5193
|
const generalCommentIds = vue.ref([]);
|
|
5189
5194
|
const pendingComment = vue.ref(null);
|
|
5195
|
+
const isViewingMode = vue.computed(() => viewingVisibility.documentMode === "viewing");
|
|
5190
5196
|
const init = (config = {}) => {
|
|
5191
5197
|
const updatedConfig = { ...commentsConfig, ...config };
|
|
5192
5198
|
Object.assign(commentsConfig, updatedConfig);
|
|
@@ -5199,6 +5205,17 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5199
5205
|
if (id === void 0 || id === null) return null;
|
|
5200
5206
|
return commentsList.value.find((c) => c.commentId == id || c.importedId == id);
|
|
5201
5207
|
};
|
|
5208
|
+
const getThreadParent = (comment) => {
|
|
5209
|
+
if (!comment?.parentCommentId) return comment;
|
|
5210
|
+
return getComment(comment.parentCommentId);
|
|
5211
|
+
};
|
|
5212
|
+
const isThreadVisible = (comment) => {
|
|
5213
|
+
if (!isViewingMode.value) return true;
|
|
5214
|
+
const parent = getThreadParent(comment);
|
|
5215
|
+
if (!parent && comment?.parentCommentId) return false;
|
|
5216
|
+
const isTrackedChange = Boolean(parent?.trackedChange);
|
|
5217
|
+
return isTrackedChange ? viewingVisibility.trackChangesVisible : viewingVisibility.commentsVisible;
|
|
5218
|
+
};
|
|
5202
5219
|
const setActiveComment = (superdoc, id) => {
|
|
5203
5220
|
if (id === void 0 || id === null) {
|
|
5204
5221
|
activeComment.value = null;
|
|
@@ -5300,6 +5317,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5300
5317
|
const resolvedComments = [];
|
|
5301
5318
|
const childCommentMap = /* @__PURE__ */ new Map();
|
|
5302
5319
|
commentsList.value.forEach((comment) => {
|
|
5320
|
+
if (!isThreadVisible(comment)) return;
|
|
5303
5321
|
if (comment.resolvedTime) {
|
|
5304
5322
|
resolvedComments.push(comment);
|
|
5305
5323
|
} else if (!comment.parentCommentId && !comment.resolvedTime) {
|
|
@@ -5508,6 +5526,17 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5508
5526
|
});
|
|
5509
5527
|
return comments;
|
|
5510
5528
|
});
|
|
5529
|
+
const setViewingVisibility = ({ documentMode, commentsVisible, trackChangesVisible } = {}) => {
|
|
5530
|
+
if (typeof documentMode === "string") {
|
|
5531
|
+
viewingVisibility.documentMode = documentMode;
|
|
5532
|
+
}
|
|
5533
|
+
if (typeof commentsVisible === "boolean") {
|
|
5534
|
+
viewingVisibility.commentsVisible = commentsVisible;
|
|
5535
|
+
}
|
|
5536
|
+
if (typeof trackChangesVisible === "boolean") {
|
|
5537
|
+
viewingVisibility.trackChangesVisible = trackChangesVisible;
|
|
5538
|
+
}
|
|
5539
|
+
};
|
|
5511
5540
|
const normalizeCommentForEditor = (node) => {
|
|
5512
5541
|
if (!node || typeof node !== "object") return node;
|
|
5513
5542
|
const cloneMarks = (marks) => Array.isArray(marks) ? marks.filter(Boolean).map((mark) => ({
|
|
@@ -5587,6 +5616,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5587
5616
|
getFloatingComments,
|
|
5588
5617
|
// Actions
|
|
5589
5618
|
init,
|
|
5619
|
+
setViewingVisibility,
|
|
5590
5620
|
getComment,
|
|
5591
5621
|
setActiveComment,
|
|
5592
5622
|
getCommentLocation,
|
|
@@ -6217,12 +6247,13 @@ const _sfc_main$c = {
|
|
|
6217
6247
|
return currentCommentText.value && currentCommentText.value !== "<p></p>";
|
|
6218
6248
|
});
|
|
6219
6249
|
const setFocus = () => {
|
|
6220
|
-
if (props.comment.resolvedTime) return;
|
|
6221
6250
|
const editor = proxy.$superdoc.activeEditor;
|
|
6222
|
-
|
|
6223
|
-
|
|
6251
|
+
if (!props.comment.resolvedTime) {
|
|
6252
|
+
activeComment.value = props.comment.commentId;
|
|
6253
|
+
props.comment.setActive(proxy.$superdoc);
|
|
6254
|
+
}
|
|
6224
6255
|
if (editor) {
|
|
6225
|
-
const cursorId = props.comment.importedId || props.comment.commentId;
|
|
6256
|
+
const cursorId = props.comment.resolvedTime ? props.comment.commentId : props.comment.importedId || props.comment.commentId;
|
|
6226
6257
|
editor.commands?.setCursorById(cursorId);
|
|
6227
6258
|
}
|
|
6228
6259
|
};
|
|
@@ -6458,7 +6489,7 @@ const _sfc_main$c = {
|
|
|
6458
6489
|
};
|
|
6459
6490
|
}
|
|
6460
6491
|
};
|
|
6461
|
-
const CommentDialog = /* @__PURE__ */ index._export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
|
6492
|
+
const CommentDialog = /* @__PURE__ */ index._export_sfc(_sfc_main$c, [["__scopeId", "data-v-d50fd675"]]);
|
|
6462
6493
|
const _hoisted_1$a = { class: "comments-list" };
|
|
6463
6494
|
const _hoisted_2$5 = { key: 0 };
|
|
6464
6495
|
const _hoisted_3$3 = { class: "comment-item" };
|
|
@@ -6575,7 +6606,7 @@ const _sfc_main$a = {
|
|
|
6575
6606
|
const superdocStore = useSuperdocStore();
|
|
6576
6607
|
const commentsStore = useCommentsStore();
|
|
6577
6608
|
const { COMMENT_EVENTS } = commentsStore;
|
|
6578
|
-
const { documentsWithConverations, activeComment, floatingCommentsOffset,
|
|
6609
|
+
const { documentsWithConverations, activeComment, floatingCommentsOffset, getGroupedComments } = storeToRefs(commentsStore);
|
|
6579
6610
|
const { documents, activeZoom } = storeToRefs(superdocStore);
|
|
6580
6611
|
const { proxy } = vue.getCurrentInstance();
|
|
6581
6612
|
const emit = __emit;
|
|
@@ -6637,7 +6668,7 @@ const _sfc_main$a = {
|
|
|
6637
6668
|
emit("highlight-click", comment);
|
|
6638
6669
|
};
|
|
6639
6670
|
const getCurrentComments = vue.computed(() => {
|
|
6640
|
-
return
|
|
6671
|
+
return getGroupedComments.value?.parentComments.filter((c) => c.selection && c.selection.selectionBounds?.top).filter((c) => !c.resolvedTime).filter((c) => c.selection?.source !== "super-editor");
|
|
6641
6672
|
});
|
|
6642
6673
|
vue.watch(activeComment, (newVal) => {
|
|
6643
6674
|
if (!newVal) return;
|
|
@@ -6665,7 +6696,7 @@ const _sfc_main$a = {
|
|
|
6665
6696
|
};
|
|
6666
6697
|
}
|
|
6667
6698
|
};
|
|
6668
|
-
const CommentsLayer = /* @__PURE__ */ index._export_sfc(_sfc_main$a, [["__scopeId", "data-v-
|
|
6699
|
+
const CommentsLayer = /* @__PURE__ */ index._export_sfc(_sfc_main$a, [["__scopeId", "data-v-7d21d613"]]);
|
|
6669
6700
|
const _hoisted_1$8 = { class: "sidebar-container calculation-container" };
|
|
6670
6701
|
const _hoisted_2$3 = ["id"];
|
|
6671
6702
|
const _sfc_main$9 = {
|
|
@@ -7465,7 +7496,7 @@ const _sfc_main = {
|
|
|
7465
7496
|
__name: "SuperDoc",
|
|
7466
7497
|
emits: ["selection-update"],
|
|
7467
7498
|
setup(__props, { emit: __emit }) {
|
|
7468
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
7499
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-H9_8IbtN.cjs")));
|
|
7469
7500
|
const superdocStore = useSuperdocStore();
|
|
7470
7501
|
const commentsStore = useCommentsStore();
|
|
7471
7502
|
const {
|
|
@@ -7507,6 +7538,16 @@ const _sfc_main = {
|
|
|
7507
7538
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
7508
7539
|
const { uiFontFamily } = useUiFontFamily();
|
|
7509
7540
|
const isViewingMode = () => proxy?.$superdoc?.config?.documentMode === "viewing";
|
|
7541
|
+
const isViewingCommentsVisible = vue.computed(
|
|
7542
|
+
() => isViewingMode() && proxy?.$superdoc?.config?.comments?.visible === true
|
|
7543
|
+
);
|
|
7544
|
+
const isViewingTrackChangesVisible = vue.computed(
|
|
7545
|
+
() => isViewingMode() && proxy?.$superdoc?.config?.trackChanges?.visible === true
|
|
7546
|
+
);
|
|
7547
|
+
const shouldRenderCommentsInViewing = vue.computed(() => {
|
|
7548
|
+
if (!isViewingMode()) return true;
|
|
7549
|
+
return isViewingCommentsVisible.value || isViewingTrackChangesVisible.value;
|
|
7550
|
+
});
|
|
7510
7551
|
const commentsModuleConfig = vue.computed(() => {
|
|
7511
7552
|
const config = modules.comments;
|
|
7512
7553
|
if (config === false || config == null) return null;
|
|
@@ -7601,7 +7642,7 @@ const _sfc_main = {
|
|
|
7601
7642
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7602
7643
|
if (!commentsConfig || commentsConfig === false) return;
|
|
7603
7644
|
if (!positions || Object.keys(positions).length === 0) return;
|
|
7604
|
-
if (
|
|
7645
|
+
if (!shouldRenderCommentsInViewing.value) {
|
|
7605
7646
|
commentsStore.clearEditorCommentPositions?.();
|
|
7606
7647
|
return;
|
|
7607
7648
|
}
|
|
@@ -7796,7 +7837,9 @@ const _sfc_main = {
|
|
|
7796
7837
|
layoutEngineOptions: useLayoutEngine ? {
|
|
7797
7838
|
...proxy.$superdoc.config.layoutEngineOptions || {},
|
|
7798
7839
|
debugLabel: proxy.$superdoc.config.layoutEngineOptions?.debugLabel ?? doc.name ?? doc.id,
|
|
7799
|
-
zoom: (activeZoom.value ?? 100) / 100
|
|
7840
|
+
zoom: (activeZoom.value ?? 100) / 100,
|
|
7841
|
+
emitCommentPositionsInViewing: isViewingMode() && shouldRenderCommentsInViewing.value,
|
|
7842
|
+
enableCommentsInViewing: isViewingCommentsVisible.value
|
|
7800
7843
|
} : void 0,
|
|
7801
7844
|
permissionResolver: (payload = {}) => proxy.$superdoc.canPerformPermission({
|
|
7802
7845
|
role: proxy.$superdoc.config.role,
|
|
@@ -7809,7 +7852,7 @@ const _sfc_main = {
|
|
|
7809
7852
|
const onEditorCommentLocationsUpdate = (doc, { allCommentIds: activeThreadId, allCommentPositions } = {}) => {
|
|
7810
7853
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7811
7854
|
if (!commentsConfig || commentsConfig === false) return;
|
|
7812
|
-
if (
|
|
7855
|
+
if (!shouldRenderCommentsInViewing.value) {
|
|
7813
7856
|
commentsStore.clearEditorCommentPositions?.();
|
|
7814
7857
|
return;
|
|
7815
7858
|
}
|
|
@@ -7868,7 +7911,7 @@ const _sfc_main = {
|
|
|
7868
7911
|
};
|
|
7869
7912
|
const isCommentsEnabled = vue.computed(() => Boolean(commentsModuleConfig.value));
|
|
7870
7913
|
const showCommentsSidebar = vue.computed(() => {
|
|
7871
|
-
if (
|
|
7914
|
+
if (!shouldRenderCommentsInViewing.value) return false;
|
|
7872
7915
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
7873
7916
|
});
|
|
7874
7917
|
const showToolsFloatingMenu = vue.computed(() => {
|
|
@@ -8210,7 +8253,7 @@ const _sfc_main = {
|
|
|
8210
8253
|
};
|
|
8211
8254
|
}
|
|
8212
8255
|
};
|
|
8213
|
-
const App = /* @__PURE__ */ index._export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
8256
|
+
const App = /* @__PURE__ */ index._export_sfc(_sfc_main, [["__scopeId", "data-v-78737564"]]);
|
|
8214
8257
|
const createSuperdocVueApp = () => {
|
|
8215
8258
|
const app = vue.createApp(App);
|
|
8216
8259
|
const pinia = createPinia();
|
|
@@ -8316,6 +8359,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8316
8359
|
title: "SuperDoc",
|
|
8317
8360
|
conversations: [],
|
|
8318
8361
|
isInternal: false,
|
|
8362
|
+
comments: { visible: false },
|
|
8363
|
+
trackChanges: { visible: false },
|
|
8319
8364
|
// toolbar config
|
|
8320
8365
|
toolbar: null,
|
|
8321
8366
|
// Optional DOM element to render the toolbar in
|
|
@@ -8365,6 +8410,16 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8365
8410
|
...this.config,
|
|
8366
8411
|
...config
|
|
8367
8412
|
};
|
|
8413
|
+
if (!this.config.comments || typeof this.config.comments !== "object") {
|
|
8414
|
+
this.config.comments = { visible: false };
|
|
8415
|
+
} else if (typeof this.config.comments.visible !== "boolean") {
|
|
8416
|
+
this.config.comments.visible = false;
|
|
8417
|
+
}
|
|
8418
|
+
if (!this.config.trackChanges || typeof this.config.trackChanges !== "object") {
|
|
8419
|
+
this.config.trackChanges = { visible: false };
|
|
8420
|
+
} else if (typeof this.config.trackChanges.visible !== "boolean") {
|
|
8421
|
+
this.config.trackChanges.visible = false;
|
|
8422
|
+
}
|
|
8368
8423
|
const incomingUser = this.config.user;
|
|
8369
8424
|
if (!incomingUser || typeof incomingUser !== "object") {
|
|
8370
8425
|
this.config.user = { ...DEFAULT_USER };
|
|
@@ -8382,9 +8437,10 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8382
8437
|
}
|
|
8383
8438
|
if (!this.config.layoutEngineOptions.trackedChanges) {
|
|
8384
8439
|
const isViewingMode = this.config.documentMode === "viewing";
|
|
8440
|
+
const viewingTrackedChangesVisible = isViewingMode && this.config.trackChanges?.visible === true;
|
|
8385
8441
|
this.config.layoutEngineOptions.trackedChanges = {
|
|
8386
|
-
mode: isViewingMode ? "
|
|
8387
|
-
enabled:
|
|
8442
|
+
mode: isViewingMode ? viewingTrackedChangesVisible ? "review" : "original" : "review",
|
|
8443
|
+
enabled: true
|
|
8388
8444
|
};
|
|
8389
8445
|
}
|
|
8390
8446
|
this.config.modules = this.config.modules || {};
|
|
@@ -8394,7 +8450,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8394
8450
|
this.config.colors = shuffleArray(this.config.colors);
|
|
8395
8451
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
8396
8452
|
this.colorIndex = 0;
|
|
8397
|
-
this.version = "1.
|
|
8453
|
+
this.version = "1.4.0-next.1";
|
|
8398
8454
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
8399
8455
|
this.superdocId = config.superdocId || uuid.v4();
|
|
8400
8456
|
this.colors = this.config.colors;
|
|
@@ -8531,6 +8587,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8531
8587
|
this.superdocStore.init(this.config);
|
|
8532
8588
|
const commentsModuleConfig = this.config.modules.comments;
|
|
8533
8589
|
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
8590
|
+
this.#syncViewingVisibility();
|
|
8534
8591
|
}
|
|
8535
8592
|
#initListeners() {
|
|
8536
8593
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -8832,6 +8889,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8832
8889
|
if (!type) return;
|
|
8833
8890
|
type = type.toLowerCase();
|
|
8834
8891
|
this.config.documentMode = type;
|
|
8892
|
+
this.#syncViewingVisibility();
|
|
8835
8893
|
const types = {
|
|
8836
8894
|
viewing: () => this.#setModeViewing(),
|
|
8837
8895
|
editing: () => this.#setModeEditing(),
|
|
@@ -8911,10 +8969,20 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8911
8969
|
}
|
|
8912
8970
|
#setModeViewing() {
|
|
8913
8971
|
this.toolbar.activeEditor = null;
|
|
8914
|
-
this.
|
|
8915
|
-
this.
|
|
8972
|
+
const commentsVisible = this.config.comments?.visible === true;
|
|
8973
|
+
const trackChangesVisible = this.config.trackChanges?.visible === true;
|
|
8974
|
+
this.setTrackedChangesPreferences(
|
|
8975
|
+
trackChangesVisible ? { mode: "review", enabled: true } : { mode: "original", enabled: true }
|
|
8976
|
+
);
|
|
8977
|
+
if (!commentsVisible && !trackChangesVisible) {
|
|
8978
|
+
this.commentsStore?.clearEditorCommentPositions?.();
|
|
8979
|
+
}
|
|
8916
8980
|
this.superdocStore.documents.forEach((doc) => {
|
|
8917
|
-
|
|
8981
|
+
if (commentsVisible || trackChangesVisible) {
|
|
8982
|
+
doc.restoreComments();
|
|
8983
|
+
} else {
|
|
8984
|
+
doc.removeComments();
|
|
8985
|
+
}
|
|
8918
8986
|
this.#applyDocumentMode(doc, "viewing");
|
|
8919
8987
|
});
|
|
8920
8988
|
if (this.toolbar) {
|
|
@@ -8922,6 +8990,31 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8922
8990
|
this.toolbar.updateToolbarState();
|
|
8923
8991
|
}
|
|
8924
8992
|
}
|
|
8993
|
+
#syncViewingVisibility() {
|
|
8994
|
+
const commentsVisible = this.config.comments?.visible === true;
|
|
8995
|
+
const trackChangesVisible = this.config.trackChanges?.visible === true;
|
|
8996
|
+
const isViewingMode = this.config.documentMode === "viewing";
|
|
8997
|
+
const shouldRenderCommentsInViewing = commentsVisible || trackChangesVisible;
|
|
8998
|
+
if (this.commentsStore?.setViewingVisibility) {
|
|
8999
|
+
this.commentsStore.setViewingVisibility({
|
|
9000
|
+
documentMode: this.config.documentMode,
|
|
9001
|
+
commentsVisible,
|
|
9002
|
+
trackChangesVisible
|
|
9003
|
+
});
|
|
9004
|
+
}
|
|
9005
|
+
const docs = this.superdocStore?.documents;
|
|
9006
|
+
if (Array.isArray(docs) && docs.length > 0) {
|
|
9007
|
+
docs.forEach((doc) => {
|
|
9008
|
+
const presentationEditor = typeof doc.getPresentationEditor === "function" ? doc.getPresentationEditor() : null;
|
|
9009
|
+
if (presentationEditor?.setViewingCommentOptions) {
|
|
9010
|
+
presentationEditor.setViewingCommentOptions({
|
|
9011
|
+
emitCommentPositionsInViewing: isViewingMode && shouldRenderCommentsInViewing,
|
|
9012
|
+
enableCommentsInViewing: isViewingMode && commentsVisible
|
|
9013
|
+
});
|
|
9014
|
+
}
|
|
9015
|
+
});
|
|
9016
|
+
}
|
|
9017
|
+
}
|
|
8925
9018
|
/**
|
|
8926
9019
|
* Search for text or regex in the active editor
|
|
8927
9020
|
* @param {string | RegExp} text The text or regex to search for
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-C8_CqJxM.cjs");
|
|
3
3
|
const helpers$1 = require("./helpers-nOdwpmwb.cjs");
|
|
4
|
-
const superEditor_converter = require("./SuperConverter-
|
|
4
|
+
const superEditor_converter = require("./SuperConverter-CgY28MJz.cjs");
|
|
5
5
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
6
6
|
require("./jszip.min-BPh2MMAa.cjs");
|
|
7
7
|
const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
|
|
@@ -13559,6 +13559,12 @@ function findRangeById(doc2, id) {
|
|
|
13559
13559
|
if (from3 === null || pos < from3) from3 = pos;
|
|
13560
13560
|
if (to === null || pos + node.nodeSize > to) to = pos + node.nodeSize;
|
|
13561
13561
|
}
|
|
13562
|
+
if (node.type.name === "commentRangeStart" && node.attrs["w:id"] === id) {
|
|
13563
|
+
from3 = pos;
|
|
13564
|
+
}
|
|
13565
|
+
if (node.type.name === "commentRangeEnd" && node.attrs["w:id"] === id) {
|
|
13566
|
+
to = pos;
|
|
13567
|
+
}
|
|
13562
13568
|
});
|
|
13563
13569
|
return from3 !== null && to !== null ? { from: from3, to } : null;
|
|
13564
13570
|
}
|
|
@@ -15451,7 +15457,7 @@ const canUseDOM = () => {
|
|
|
15451
15457
|
return false;
|
|
15452
15458
|
}
|
|
15453
15459
|
};
|
|
15454
|
-
const summaryVersion = "1.
|
|
15460
|
+
const summaryVersion = "1.4.0-next.1";
|
|
15455
15461
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
15456
15462
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
15457
15463
|
function mapAttributes(attrs) {
|
|
@@ -18083,7 +18089,7 @@ class Editor extends EventEmitter {
|
|
|
18083
18089
|
* Process collaboration migrations
|
|
18084
18090
|
*/
|
|
18085
18091
|
processCollaborationMigrations() {
|
|
18086
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.
|
|
18092
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.4.0-next.1");
|
|
18087
18093
|
if (!this.options.ydoc) return;
|
|
18088
18094
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
18089
18095
|
let docVersion = metaMap.get("version");
|
|
@@ -31693,8 +31699,15 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
31693
31699
|
} else if (vRelativeFrom === "paragraph") {
|
|
31694
31700
|
const baseAnchorY = state.cursorY;
|
|
31695
31701
|
const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
|
|
31696
|
-
|
|
31697
|
-
|
|
31702
|
+
if (alignV === "top") {
|
|
31703
|
+
anchorY = baseAnchorY + offsetV;
|
|
31704
|
+
} else if (alignV === "bottom") {
|
|
31705
|
+
anchorY = baseAnchorY + firstLineHeight - imageHeight + offsetV;
|
|
31706
|
+
} else if (alignV === "center") {
|
|
31707
|
+
anchorY = baseAnchorY + (firstLineHeight - imageHeight) / 2 + offsetV;
|
|
31708
|
+
} else {
|
|
31709
|
+
anchorY = baseAnchorY + offsetV;
|
|
31710
|
+
}
|
|
31698
31711
|
} else {
|
|
31699
31712
|
const baseAnchorY = state.cursorY;
|
|
31700
31713
|
anchorY = baseAnchorY + offsetV;
|
|
@@ -32755,6 +32768,13 @@ function collectPreRegisteredAnchors(blocks, measures) {
|
|
|
32755
32768
|
function collectAnchoredDrawings(blocks, measures) {
|
|
32756
32769
|
const map3 = /* @__PURE__ */ new Map();
|
|
32757
32770
|
const len = Math.min(blocks.length, measures.length);
|
|
32771
|
+
const paragraphIndexById = /* @__PURE__ */ new Map();
|
|
32772
|
+
for (let i = 0; i < len; i += 1) {
|
|
32773
|
+
const block = blocks[i];
|
|
32774
|
+
if (block.kind === "paragraph") {
|
|
32775
|
+
paragraphIndexById.set(block.id, i);
|
|
32776
|
+
}
|
|
32777
|
+
}
|
|
32758
32778
|
const nearestPrevParagraph = (fromIndex) => {
|
|
32759
32779
|
for (let i = fromIndex - 1; i >= 0; i -= 1) {
|
|
32760
32780
|
if (blocks[i].kind === "paragraph") return i;
|
|
@@ -32781,7 +32801,11 @@ function collectAnchoredDrawings(blocks, measures) {
|
|
|
32781
32801
|
if (isPageRelativeAnchor(drawingBlock)) {
|
|
32782
32802
|
continue;
|
|
32783
32803
|
}
|
|
32784
|
-
|
|
32804
|
+
const anchorParagraphId = typeof drawingBlock.attrs === "object" && drawingBlock.attrs ? drawingBlock.attrs.anchorParagraphId : void 0;
|
|
32805
|
+
let anchorParaIndex = typeof anchorParagraphId === "string" ? paragraphIndexById.get(anchorParagraphId) ?? null : null;
|
|
32806
|
+
if (anchorParaIndex == null) {
|
|
32807
|
+
anchorParaIndex = nearestPrevParagraph(i);
|
|
32808
|
+
}
|
|
32785
32809
|
if (anchorParaIndex == null) anchorParaIndex = nearestNextParagraph(i);
|
|
32786
32810
|
if (anchorParaIndex == null) continue;
|
|
32787
32811
|
const list = map3.get(anchorParaIndex) ?? [];
|
|
@@ -32792,6 +32816,13 @@ function collectAnchoredDrawings(blocks, measures) {
|
|
|
32792
32816
|
}
|
|
32793
32817
|
function collectAnchoredTables(blocks, measures) {
|
|
32794
32818
|
const map3 = /* @__PURE__ */ new Map();
|
|
32819
|
+
const paragraphIndexById = /* @__PURE__ */ new Map();
|
|
32820
|
+
for (let i = 0; i < blocks.length; i += 1) {
|
|
32821
|
+
const block = blocks[i];
|
|
32822
|
+
if (block.kind === "paragraph") {
|
|
32823
|
+
paragraphIndexById.set(block.id, i);
|
|
32824
|
+
}
|
|
32825
|
+
}
|
|
32795
32826
|
const nearestPrevParagraph = (fromIndex) => {
|
|
32796
32827
|
for (let i = fromIndex - 1; i >= 0; i -= 1) {
|
|
32797
32828
|
if (blocks[i].kind === "paragraph") return i;
|
|
@@ -32811,7 +32842,11 @@ function collectAnchoredTables(blocks, measures) {
|
|
|
32811
32842
|
const tableBlock = block;
|
|
32812
32843
|
const tableMeasure = measure;
|
|
32813
32844
|
if (!tableBlock.anchor?.isAnchored) continue;
|
|
32814
|
-
|
|
32845
|
+
const anchorParagraphId = typeof tableBlock.attrs === "object" && tableBlock.attrs ? tableBlock.attrs.anchorParagraphId : void 0;
|
|
32846
|
+
let anchorParaIndex = typeof anchorParagraphId === "string" ? paragraphIndexById.get(anchorParagraphId) ?? null : null;
|
|
32847
|
+
if (anchorParaIndex == null) {
|
|
32848
|
+
anchorParaIndex = nearestPrevParagraph(i);
|
|
32849
|
+
}
|
|
32815
32850
|
if (anchorParaIndex == null) anchorParaIndex = nearestNextParagraph(i);
|
|
32816
32851
|
if (anchorParaIndex == null) continue;
|
|
32817
32852
|
const list = map3.get(anchorParaIndex) ?? [];
|
|
@@ -41833,7 +41868,13 @@ const spacingPxToPt = (spacing) => {
|
|
|
41833
41868
|
const result = {};
|
|
41834
41869
|
if (spacing.before != null) result.before = pxToPt(spacing.before);
|
|
41835
41870
|
if (spacing.after != null) result.after = pxToPt(spacing.after);
|
|
41836
|
-
if (spacing.line != null)
|
|
41871
|
+
if (spacing.line != null) {
|
|
41872
|
+
if (spacing.lineRule === "auto" && spacing.line > 0 && spacing.line <= MAX_AUTO_LINE_MULTIPLIER) {
|
|
41873
|
+
result.line = spacing.line;
|
|
41874
|
+
} else {
|
|
41875
|
+
result.line = pxToPt(spacing.line);
|
|
41876
|
+
}
|
|
41877
|
+
}
|
|
41837
41878
|
if (spacing.lineRule) result.lineRule = spacing.lineRule;
|
|
41838
41879
|
return result;
|
|
41839
41880
|
};
|
|
@@ -41857,8 +41898,13 @@ const spacingPtToPx = (spacing, rawSpacing) => {
|
|
|
41857
41898
|
if (after != null) result.after = after;
|
|
41858
41899
|
}
|
|
41859
41900
|
if (rawSpacing.line != null) {
|
|
41860
|
-
const
|
|
41861
|
-
if (
|
|
41901
|
+
const isAutoMultiplier = spacing.lineRule === "auto" && spacing.line != null && spacing.line > 0 && spacing.line <= MAX_AUTO_LINE_MULTIPLIER;
|
|
41902
|
+
if (isAutoMultiplier) {
|
|
41903
|
+
result.line = spacing.line;
|
|
41904
|
+
} else {
|
|
41905
|
+
const line = ptToPx(spacing.line);
|
|
41906
|
+
if (line != null) result.line = line;
|
|
41907
|
+
}
|
|
41862
41908
|
if (spacing.lineRule) result.lineRule = spacing.lineRule;
|
|
41863
41909
|
}
|
|
41864
41910
|
}
|
|
@@ -41938,7 +41984,7 @@ const normalizeLineValue = (value, lineRule) => {
|
|
|
41938
41984
|
if (value > 0 && value <= MAX_AUTO_LINE_MULTIPLIER) {
|
|
41939
41985
|
return value;
|
|
41940
41986
|
}
|
|
41941
|
-
return
|
|
41987
|
+
return value / 240;
|
|
41942
41988
|
}
|
|
41943
41989
|
return twipsToPx$1(value);
|
|
41944
41990
|
};
|
|
@@ -45213,6 +45259,20 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45213
45259
|
let partIndex = 0;
|
|
45214
45260
|
let tabOrdinal = 0;
|
|
45215
45261
|
const nextId = () => partIndex === 0 ? baseBlockId : `${baseBlockId}-${partIndex}`;
|
|
45262
|
+
const attachAnchorParagraphId = (block, anchorParagraphId) => {
|
|
45263
|
+
const applicableKinds = /* @__PURE__ */ new Set(["drawing", "image", "table"]);
|
|
45264
|
+
if (!applicableKinds.has(block.kind)) {
|
|
45265
|
+
return block;
|
|
45266
|
+
}
|
|
45267
|
+
const blockWithAttrs = block;
|
|
45268
|
+
return {
|
|
45269
|
+
...blockWithAttrs,
|
|
45270
|
+
attrs: {
|
|
45271
|
+
...blockWithAttrs.attrs ?? {},
|
|
45272
|
+
anchorParagraphId
|
|
45273
|
+
}
|
|
45274
|
+
};
|
|
45275
|
+
};
|
|
45216
45276
|
const flushParagraph = () => {
|
|
45217
45277
|
if (currentRuns.length === 0) {
|
|
45218
45278
|
return;
|
|
@@ -45444,6 +45504,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45444
45504
|
}
|
|
45445
45505
|
return;
|
|
45446
45506
|
}
|
|
45507
|
+
const anchorParagraphId = nextId();
|
|
45447
45508
|
flushParagraph();
|
|
45448
45509
|
const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
|
|
45449
45510
|
const trackedMeta = trackedChanges?.enabled ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
|
|
@@ -45454,7 +45515,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45454
45515
|
const imageBlock = converters.imageNodeToBlock(node, nextBlockId, positions, trackedMeta, trackedChanges);
|
|
45455
45516
|
if (imageBlock && imageBlock.kind === "image") {
|
|
45456
45517
|
annotateBlockWithTrackedChange(imageBlock, trackedMeta, trackedChanges);
|
|
45457
|
-
blocks.push(imageBlock);
|
|
45518
|
+
blocks.push(attachAnchorParagraphId(imageBlock, anchorParagraphId));
|
|
45458
45519
|
}
|
|
45459
45520
|
}
|
|
45460
45521
|
return;
|
|
@@ -45462,6 +45523,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45462
45523
|
if (node.type === "contentBlock") {
|
|
45463
45524
|
const attrs = node.attrs ?? {};
|
|
45464
45525
|
if (attrs.horizontalRule === true) {
|
|
45526
|
+
const anchorParagraphId = nextId();
|
|
45465
45527
|
flushParagraph();
|
|
45466
45528
|
const indent = paragraphAttrs?.indent;
|
|
45467
45529
|
const hrIndentLeft = typeof indent?.left === "number" ? indent.left : void 0;
|
|
@@ -45471,52 +45533,57 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45471
45533
|
const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
|
|
45472
45534
|
const drawingBlock = convert(hrNode, nextBlockId, positions);
|
|
45473
45535
|
if (drawingBlock) {
|
|
45474
|
-
blocks.push(drawingBlock);
|
|
45536
|
+
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
45475
45537
|
}
|
|
45476
45538
|
}
|
|
45477
45539
|
return;
|
|
45478
45540
|
}
|
|
45479
45541
|
if (node.type === "vectorShape") {
|
|
45542
|
+
const anchorParagraphId = nextId();
|
|
45480
45543
|
flushParagraph();
|
|
45481
45544
|
if (converters?.vectorShapeNodeToDrawingBlock) {
|
|
45482
45545
|
const drawingBlock = converters.vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
|
|
45483
45546
|
if (drawingBlock) {
|
|
45484
|
-
blocks.push(drawingBlock);
|
|
45547
|
+
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
45485
45548
|
}
|
|
45486
45549
|
}
|
|
45487
45550
|
return;
|
|
45488
45551
|
}
|
|
45489
45552
|
if (node.type === "shapeGroup") {
|
|
45553
|
+
const anchorParagraphId = nextId();
|
|
45490
45554
|
flushParagraph();
|
|
45491
45555
|
if (converters?.shapeGroupNodeToDrawingBlock) {
|
|
45492
45556
|
const drawingBlock = converters.shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
|
|
45493
45557
|
if (drawingBlock) {
|
|
45494
|
-
blocks.push(drawingBlock);
|
|
45558
|
+
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
45495
45559
|
}
|
|
45496
45560
|
}
|
|
45497
45561
|
return;
|
|
45498
45562
|
}
|
|
45499
45563
|
if (node.type === "shapeContainer") {
|
|
45564
|
+
const anchorParagraphId = nextId();
|
|
45500
45565
|
flushParagraph();
|
|
45501
45566
|
if (converters?.shapeContainerNodeToDrawingBlock) {
|
|
45502
45567
|
const drawingBlock = converters.shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
|
|
45503
45568
|
if (drawingBlock) {
|
|
45504
|
-
blocks.push(drawingBlock);
|
|
45569
|
+
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
45505
45570
|
}
|
|
45506
45571
|
}
|
|
45507
45572
|
return;
|
|
45508
45573
|
}
|
|
45509
45574
|
if (node.type === "shapeTextbox") {
|
|
45575
|
+
const anchorParagraphId = nextId();
|
|
45510
45576
|
flushParagraph();
|
|
45511
45577
|
if (converters?.shapeTextboxNodeToDrawingBlock) {
|
|
45512
45578
|
const drawingBlock = converters.shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
|
|
45513
45579
|
if (drawingBlock) {
|
|
45514
|
-
blocks.push(drawingBlock);
|
|
45580
|
+
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
45515
45581
|
}
|
|
45516
45582
|
}
|
|
45517
45583
|
return;
|
|
45518
45584
|
}
|
|
45519
45585
|
if (node.type === "table") {
|
|
45586
|
+
const anchorParagraphId = nextId();
|
|
45520
45587
|
flushParagraph();
|
|
45521
45588
|
if (converters?.tableNodeToBlock) {
|
|
45522
45589
|
const tableBlock = converters.tableNodeToBlock(
|
|
@@ -45533,7 +45600,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45533
45600
|
...converterContext !== void 0 ? [converterContext] : []
|
|
45534
45601
|
);
|
|
45535
45602
|
if (tableBlock) {
|
|
45536
|
-
blocks.push(tableBlock);
|
|
45603
|
+
blocks.push(attachAnchorParagraphId(tableBlock, anchorParagraphId));
|
|
45537
45604
|
}
|
|
45538
45605
|
}
|
|
45539
45606
|
return;
|
|
@@ -50058,7 +50125,8 @@ const resolveLineHeight = (spacing, baseLineHeight) => {
|
|
|
50058
50125
|
return baseLineHeight;
|
|
50059
50126
|
}
|
|
50060
50127
|
const raw = spacing.line;
|
|
50061
|
-
const
|
|
50128
|
+
const isAuto = spacing.lineRule === "auto";
|
|
50129
|
+
const treatAsMultiplier = (isAuto || spacing.lineRule == null) && raw > 0 && (isAuto || raw <= 10);
|
|
50062
50130
|
if (treatAsMultiplier) {
|
|
50063
50131
|
return raw * baseLineHeight;
|
|
50064
50132
|
}
|
|
@@ -50405,6 +50473,8 @@ class PresentationEditor extends EventEmitter {
|
|
|
50405
50473
|
debugLabel: options.layoutEngineOptions?.debugLabel,
|
|
50406
50474
|
layoutMode: options.layoutEngineOptions?.layoutMode ?? "vertical",
|
|
50407
50475
|
trackedChanges: options.layoutEngineOptions?.trackedChanges,
|
|
50476
|
+
emitCommentPositionsInViewing: options.layoutEngineOptions?.emitCommentPositionsInViewing,
|
|
50477
|
+
enableCommentsInViewing: options.layoutEngineOptions?.enableCommentsInViewing,
|
|
50408
50478
|
presence: validatedPresence
|
|
50409
50479
|
};
|
|
50410
50480
|
this.#trackedChangesOverrides = options.layoutEngineOptions?.trackedChanges;
|
|
@@ -50993,6 +51063,33 @@ class PresentationEditor extends EventEmitter {
|
|
|
50993
51063
|
this.#scheduleRerender();
|
|
50994
51064
|
}
|
|
50995
51065
|
}
|
|
51066
|
+
/**
|
|
51067
|
+
* Update viewing-mode comment rendering behavior and re-render if needed.
|
|
51068
|
+
*
|
|
51069
|
+
* @param options - Viewing mode comment options.
|
|
51070
|
+
*/
|
|
51071
|
+
setViewingCommentOptions(options = {}) {
|
|
51072
|
+
if (options !== void 0 && (typeof options !== "object" || options === null || Array.isArray(options))) {
|
|
51073
|
+
throw new TypeError("[PresentationEditor] setViewingCommentOptions expects an object or undefined");
|
|
51074
|
+
}
|
|
51075
|
+
let hasChanges = false;
|
|
51076
|
+
if (typeof options.emitCommentPositionsInViewing === "boolean") {
|
|
51077
|
+
if (this.#layoutOptions.emitCommentPositionsInViewing !== options.emitCommentPositionsInViewing) {
|
|
51078
|
+
this.#layoutOptions.emitCommentPositionsInViewing = options.emitCommentPositionsInViewing;
|
|
51079
|
+
hasChanges = true;
|
|
51080
|
+
}
|
|
51081
|
+
}
|
|
51082
|
+
if (typeof options.enableCommentsInViewing === "boolean") {
|
|
51083
|
+
if (this.#layoutOptions.enableCommentsInViewing !== options.enableCommentsInViewing) {
|
|
51084
|
+
this.#layoutOptions.enableCommentsInViewing = options.enableCommentsInViewing;
|
|
51085
|
+
hasChanges = true;
|
|
51086
|
+
}
|
|
51087
|
+
}
|
|
51088
|
+
if (hasChanges) {
|
|
51089
|
+
this.#pendingDocChange = true;
|
|
51090
|
+
this.#scheduleRerender();
|
|
51091
|
+
}
|
|
51092
|
+
}
|
|
50996
51093
|
/**
|
|
50997
51094
|
* Toggle the custom context menu at runtime to respect host-level guardrails.
|
|
50998
51095
|
*/
|
|
@@ -53374,7 +53471,7 @@ class PresentationEditor extends EventEmitter {
|
|
|
53374
53471
|
} : void 0;
|
|
53375
53472
|
const atomNodeTypes = getAtomNodeTypes(this.#editor?.schema ?? null);
|
|
53376
53473
|
const positionMap = this.#editor?.state?.doc && docJson ? buildPositionMapFromPmDoc(this.#editor.state.doc, docJson) : null;
|
|
53377
|
-
const commentsEnabled = this.#documentMode !== "viewing";
|
|
53474
|
+
const commentsEnabled = this.#documentMode !== "viewing" || this.#layoutOptions.enableCommentsInViewing === true;
|
|
53378
53475
|
const result = toFlowBlocks(docJson, {
|
|
53379
53476
|
mediaFiles: this.#editor?.storage?.image?.media,
|
|
53380
53477
|
emitSectionBreaks: true,
|
|
@@ -53514,7 +53611,8 @@ class PresentationEditor extends EventEmitter {
|
|
|
53514
53611
|
const payload = { layout, blocks, measures, metrics };
|
|
53515
53612
|
this.emit("layoutUpdated", payload);
|
|
53516
53613
|
this.emit("paginationUpdate", payload);
|
|
53517
|
-
|
|
53614
|
+
const allowViewingCommentPositions = this.#layoutOptions.emitCommentPositionsInViewing === true;
|
|
53615
|
+
if (this.#documentMode !== "viewing" || allowViewingCommentPositions) {
|
|
53518
53616
|
const commentPositions = this.#collectCommentPositions();
|
|
53519
53617
|
const positionKeys = Object.keys(commentPositions);
|
|
53520
53618
|
if (positionKeys.length > 0) {
|