@harbour-enterprises/superdoc 1.3.1-next.3 → 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-CPnVLLJm.es.js → PdfViewer-DRTk3dY6.es.js} +2 -2
- package/dist/chunks/{PdfViewer-BXbmY3Fc.cjs → PdfViewer-H9_8IbtN.cjs} +2 -2
- package/dist/chunks/{SuperConverter-BQ6PNaJ8.es.js → SuperConverter-CFRB4XNw.es.js} +1 -1
- package/dist/chunks/{SuperConverter-p1tQGIew.cjs → SuperConverter-CgY28MJz.cjs} +1 -1
- package/dist/chunks/{index-DXSUcHli.es.js → index-BP9aFfwI.es.js} +109 -17
- package/dist/chunks/{index-BQYtE-5U.cjs → index-BdaseaBw.cjs} +109 -17
- package/dist/chunks/{index-DLX_v-vr.cjs → index-C3KRKogJ.cjs} +52 -10
- package/dist/chunks/{index-CJec1cbb.es.js → index-CEcYlysg.es.js} +52 -10
- package/dist/style.css +32 -32
- 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 +158 -24
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
- 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
|
import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
|
|
2
|
-
import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-
|
|
3
|
-
import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-
|
|
2
|
+
import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-BP9aFfwI.es.js";
|
|
3
|
+
import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-CEcYlysg.es.js";
|
|
4
4
|
function self(vars) {
|
|
5
5
|
const {
|
|
6
6
|
opacityDisabled,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
5
|
-
const index = require("./index-
|
|
4
|
+
const superdoc = require("./index-BdaseaBw.cjs");
|
|
5
|
+
const index = require("./index-C3KRKogJ.cjs");
|
|
6
6
|
function self(vars) {
|
|
7
7
|
const {
|
|
8
8
|
opacityDisabled,
|
|
@@ -31008,7 +31008,7 @@ class SuperConverter {
|
|
|
31008
31008
|
static getStoredSuperdocVersion(docx) {
|
|
31009
31009
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
31010
31010
|
}
|
|
31011
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.
|
|
31011
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.4.0-next.1") {
|
|
31012
31012
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
31013
31013
|
}
|
|
31014
31014
|
/**
|
|
@@ -31009,7 +31009,7 @@ class SuperConverter {
|
|
|
31009
31009
|
static getStoredSuperdocVersion(docx) {
|
|
31010
31010
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
31011
31011
|
}
|
|
31012
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.
|
|
31012
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.4.0-next.1") {
|
|
31013
31013
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
31014
31014
|
}
|
|
31015
31015
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-
|
|
2
|
-
import "./SuperConverter-
|
|
1
|
+
import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-CEcYlysg.es.js";
|
|
2
|
+
import "./SuperConverter-CFRB4XNw.es.js";
|
|
3
3
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
4
4
|
import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
|
|
5
5
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -5144,6 +5144,11 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5144
5144
|
allowResolve: true,
|
|
5145
5145
|
showResolved: false
|
|
5146
5146
|
});
|
|
5147
|
+
const viewingVisibility = reactive({
|
|
5148
|
+
documentMode: "editing",
|
|
5149
|
+
commentsVisible: false,
|
|
5150
|
+
trackChangesVisible: false
|
|
5151
|
+
});
|
|
5147
5152
|
const isDebugging = false;
|
|
5148
5153
|
const debounceTimers = {};
|
|
5149
5154
|
const COMMENT_EVENTS = comments_module_events;
|
|
@@ -5170,6 +5175,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5170
5175
|
const isFloatingCommentsReady = ref(false);
|
|
5171
5176
|
const generalCommentIds = ref([]);
|
|
5172
5177
|
const pendingComment = ref(null);
|
|
5178
|
+
const isViewingMode = computed(() => viewingVisibility.documentMode === "viewing");
|
|
5173
5179
|
const init = (config = {}) => {
|
|
5174
5180
|
const updatedConfig = { ...commentsConfig, ...config };
|
|
5175
5181
|
Object.assign(commentsConfig, updatedConfig);
|
|
@@ -5182,6 +5188,17 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5182
5188
|
if (id === void 0 || id === null) return null;
|
|
5183
5189
|
return commentsList.value.find((c2) => c2.commentId == id || c2.importedId == id);
|
|
5184
5190
|
};
|
|
5191
|
+
const getThreadParent = (comment) => {
|
|
5192
|
+
if (!comment?.parentCommentId) return comment;
|
|
5193
|
+
return getComment(comment.parentCommentId);
|
|
5194
|
+
};
|
|
5195
|
+
const isThreadVisible = (comment) => {
|
|
5196
|
+
if (!isViewingMode.value) return true;
|
|
5197
|
+
const parent = getThreadParent(comment);
|
|
5198
|
+
if (!parent && comment?.parentCommentId) return false;
|
|
5199
|
+
const isTrackedChange = Boolean(parent?.trackedChange);
|
|
5200
|
+
return isTrackedChange ? viewingVisibility.trackChangesVisible : viewingVisibility.commentsVisible;
|
|
5201
|
+
};
|
|
5185
5202
|
const setActiveComment = (superdoc, id) => {
|
|
5186
5203
|
if (id === void 0 || id === null) {
|
|
5187
5204
|
activeComment.value = null;
|
|
@@ -5283,6 +5300,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5283
5300
|
const resolvedComments = [];
|
|
5284
5301
|
const childCommentMap = /* @__PURE__ */ new Map();
|
|
5285
5302
|
commentsList.value.forEach((comment) => {
|
|
5303
|
+
if (!isThreadVisible(comment)) return;
|
|
5286
5304
|
if (comment.resolvedTime) {
|
|
5287
5305
|
resolvedComments.push(comment);
|
|
5288
5306
|
} else if (!comment.parentCommentId && !comment.resolvedTime) {
|
|
@@ -5491,6 +5509,17 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5491
5509
|
});
|
|
5492
5510
|
return comments;
|
|
5493
5511
|
});
|
|
5512
|
+
const setViewingVisibility = ({ documentMode, commentsVisible, trackChangesVisible } = {}) => {
|
|
5513
|
+
if (typeof documentMode === "string") {
|
|
5514
|
+
viewingVisibility.documentMode = documentMode;
|
|
5515
|
+
}
|
|
5516
|
+
if (typeof commentsVisible === "boolean") {
|
|
5517
|
+
viewingVisibility.commentsVisible = commentsVisible;
|
|
5518
|
+
}
|
|
5519
|
+
if (typeof trackChangesVisible === "boolean") {
|
|
5520
|
+
viewingVisibility.trackChangesVisible = trackChangesVisible;
|
|
5521
|
+
}
|
|
5522
|
+
};
|
|
5494
5523
|
const normalizeCommentForEditor = (node) => {
|
|
5495
5524
|
if (!node || typeof node !== "object") return node;
|
|
5496
5525
|
const cloneMarks = (marks) => Array.isArray(marks) ? marks.filter(Boolean).map((mark) => ({
|
|
@@ -5570,6 +5599,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
5570
5599
|
getFloatingComments,
|
|
5571
5600
|
// Actions
|
|
5572
5601
|
init,
|
|
5602
|
+
setViewingVisibility,
|
|
5573
5603
|
getComment,
|
|
5574
5604
|
setActiveComment,
|
|
5575
5605
|
getCommentLocation,
|
|
@@ -6559,7 +6589,7 @@ const _sfc_main$a = {
|
|
|
6559
6589
|
const superdocStore = useSuperdocStore();
|
|
6560
6590
|
const commentsStore = useCommentsStore();
|
|
6561
6591
|
const { COMMENT_EVENTS } = commentsStore;
|
|
6562
|
-
const { documentsWithConverations, activeComment, floatingCommentsOffset,
|
|
6592
|
+
const { documentsWithConverations, activeComment, floatingCommentsOffset, getGroupedComments } = storeToRefs(commentsStore);
|
|
6563
6593
|
const { documents, activeZoom } = storeToRefs(superdocStore);
|
|
6564
6594
|
const { proxy } = getCurrentInstance();
|
|
6565
6595
|
const emit = __emit;
|
|
@@ -6621,7 +6651,7 @@ const _sfc_main$a = {
|
|
|
6621
6651
|
emit("highlight-click", comment);
|
|
6622
6652
|
};
|
|
6623
6653
|
const getCurrentComments = computed(() => {
|
|
6624
|
-
return
|
|
6654
|
+
return getGroupedComments.value?.parentComments.filter((c2) => c2.selection && c2.selection.selectionBounds?.top).filter((c2) => !c2.resolvedTime).filter((c2) => c2.selection?.source !== "super-editor");
|
|
6625
6655
|
});
|
|
6626
6656
|
watch(activeComment, (newVal) => {
|
|
6627
6657
|
if (!newVal) return;
|
|
@@ -6649,7 +6679,7 @@ const _sfc_main$a = {
|
|
|
6649
6679
|
};
|
|
6650
6680
|
}
|
|
6651
6681
|
};
|
|
6652
|
-
const CommentsLayer = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-
|
|
6682
|
+
const CommentsLayer = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-7d21d613"]]);
|
|
6653
6683
|
const _hoisted_1$8 = { class: "sidebar-container calculation-container" };
|
|
6654
6684
|
const _hoisted_2$3 = ["id"];
|
|
6655
6685
|
const _sfc_main$9 = {
|
|
@@ -7449,7 +7479,7 @@ const _sfc_main = {
|
|
|
7449
7479
|
__name: "SuperDoc",
|
|
7450
7480
|
emits: ["selection-update"],
|
|
7451
7481
|
setup(__props, { emit: __emit }) {
|
|
7452
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
7482
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DRTk3dY6.es.js"));
|
|
7453
7483
|
const superdocStore = useSuperdocStore();
|
|
7454
7484
|
const commentsStore = useCommentsStore();
|
|
7455
7485
|
const {
|
|
@@ -7491,6 +7521,16 @@ const _sfc_main = {
|
|
|
7491
7521
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
7492
7522
|
const { uiFontFamily } = useUiFontFamily();
|
|
7493
7523
|
const isViewingMode = () => proxy?.$superdoc?.config?.documentMode === "viewing";
|
|
7524
|
+
const isViewingCommentsVisible = computed(
|
|
7525
|
+
() => isViewingMode() && proxy?.$superdoc?.config?.comments?.visible === true
|
|
7526
|
+
);
|
|
7527
|
+
const isViewingTrackChangesVisible = computed(
|
|
7528
|
+
() => isViewingMode() && proxy?.$superdoc?.config?.trackChanges?.visible === true
|
|
7529
|
+
);
|
|
7530
|
+
const shouldRenderCommentsInViewing = computed(() => {
|
|
7531
|
+
if (!isViewingMode()) return true;
|
|
7532
|
+
return isViewingCommentsVisible.value || isViewingTrackChangesVisible.value;
|
|
7533
|
+
});
|
|
7494
7534
|
const commentsModuleConfig = computed(() => {
|
|
7495
7535
|
const config = modules.comments;
|
|
7496
7536
|
if (config === false || config == null) return null;
|
|
@@ -7585,7 +7625,7 @@ const _sfc_main = {
|
|
|
7585
7625
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7586
7626
|
if (!commentsConfig || commentsConfig === false) return;
|
|
7587
7627
|
if (!positions || Object.keys(positions).length === 0) return;
|
|
7588
|
-
if (
|
|
7628
|
+
if (!shouldRenderCommentsInViewing.value) {
|
|
7589
7629
|
commentsStore.clearEditorCommentPositions?.();
|
|
7590
7630
|
return;
|
|
7591
7631
|
}
|
|
@@ -7780,7 +7820,9 @@ const _sfc_main = {
|
|
|
7780
7820
|
layoutEngineOptions: useLayoutEngine ? {
|
|
7781
7821
|
...proxy.$superdoc.config.layoutEngineOptions || {},
|
|
7782
7822
|
debugLabel: proxy.$superdoc.config.layoutEngineOptions?.debugLabel ?? doc.name ?? doc.id,
|
|
7783
|
-
zoom: (activeZoom.value ?? 100) / 100
|
|
7823
|
+
zoom: (activeZoom.value ?? 100) / 100,
|
|
7824
|
+
emitCommentPositionsInViewing: isViewingMode() && shouldRenderCommentsInViewing.value,
|
|
7825
|
+
enableCommentsInViewing: isViewingCommentsVisible.value
|
|
7784
7826
|
} : void 0,
|
|
7785
7827
|
permissionResolver: (payload = {}) => proxy.$superdoc.canPerformPermission({
|
|
7786
7828
|
role: proxy.$superdoc.config.role,
|
|
@@ -7793,7 +7835,7 @@ const _sfc_main = {
|
|
|
7793
7835
|
const onEditorCommentLocationsUpdate = (doc, { allCommentIds: activeThreadId, allCommentPositions } = {}) => {
|
|
7794
7836
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7795
7837
|
if (!commentsConfig || commentsConfig === false) return;
|
|
7796
|
-
if (
|
|
7838
|
+
if (!shouldRenderCommentsInViewing.value) {
|
|
7797
7839
|
commentsStore.clearEditorCommentPositions?.();
|
|
7798
7840
|
return;
|
|
7799
7841
|
}
|
|
@@ -7852,7 +7894,7 @@ const _sfc_main = {
|
|
|
7852
7894
|
};
|
|
7853
7895
|
const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
|
|
7854
7896
|
const showCommentsSidebar = computed(() => {
|
|
7855
|
-
if (
|
|
7897
|
+
if (!shouldRenderCommentsInViewing.value) return false;
|
|
7856
7898
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
7857
7899
|
});
|
|
7858
7900
|
const showToolsFloatingMenu = computed(() => {
|
|
@@ -8194,7 +8236,7 @@ const _sfc_main = {
|
|
|
8194
8236
|
};
|
|
8195
8237
|
}
|
|
8196
8238
|
};
|
|
8197
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
8239
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-78737564"]]);
|
|
8198
8240
|
const createSuperdocVueApp = () => {
|
|
8199
8241
|
const app = createApp(App);
|
|
8200
8242
|
const pinia = createPinia();
|
|
@@ -8300,6 +8342,8 @@ class SuperDoc extends EventEmitter {
|
|
|
8300
8342
|
title: "SuperDoc",
|
|
8301
8343
|
conversations: [],
|
|
8302
8344
|
isInternal: false,
|
|
8345
|
+
comments: { visible: false },
|
|
8346
|
+
trackChanges: { visible: false },
|
|
8303
8347
|
// toolbar config
|
|
8304
8348
|
toolbar: null,
|
|
8305
8349
|
// Optional DOM element to render the toolbar in
|
|
@@ -8349,6 +8393,16 @@ class SuperDoc extends EventEmitter {
|
|
|
8349
8393
|
...this.config,
|
|
8350
8394
|
...config
|
|
8351
8395
|
};
|
|
8396
|
+
if (!this.config.comments || typeof this.config.comments !== "object") {
|
|
8397
|
+
this.config.comments = { visible: false };
|
|
8398
|
+
} else if (typeof this.config.comments.visible !== "boolean") {
|
|
8399
|
+
this.config.comments.visible = false;
|
|
8400
|
+
}
|
|
8401
|
+
if (!this.config.trackChanges || typeof this.config.trackChanges !== "object") {
|
|
8402
|
+
this.config.trackChanges = { visible: false };
|
|
8403
|
+
} else if (typeof this.config.trackChanges.visible !== "boolean") {
|
|
8404
|
+
this.config.trackChanges.visible = false;
|
|
8405
|
+
}
|
|
8352
8406
|
const incomingUser = this.config.user;
|
|
8353
8407
|
if (!incomingUser || typeof incomingUser !== "object") {
|
|
8354
8408
|
this.config.user = { ...DEFAULT_USER };
|
|
@@ -8366,9 +8420,10 @@ class SuperDoc extends EventEmitter {
|
|
|
8366
8420
|
}
|
|
8367
8421
|
if (!this.config.layoutEngineOptions.trackedChanges) {
|
|
8368
8422
|
const isViewingMode = this.config.documentMode === "viewing";
|
|
8423
|
+
const viewingTrackedChangesVisible = isViewingMode && this.config.trackChanges?.visible === true;
|
|
8369
8424
|
this.config.layoutEngineOptions.trackedChanges = {
|
|
8370
|
-
mode: isViewingMode ? "
|
|
8371
|
-
enabled:
|
|
8425
|
+
mode: isViewingMode ? viewingTrackedChangesVisible ? "review" : "original" : "review",
|
|
8426
|
+
enabled: true
|
|
8372
8427
|
};
|
|
8373
8428
|
}
|
|
8374
8429
|
this.config.modules = this.config.modules || {};
|
|
@@ -8378,7 +8433,7 @@ class SuperDoc extends EventEmitter {
|
|
|
8378
8433
|
this.config.colors = shuffleArray(this.config.colors);
|
|
8379
8434
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
8380
8435
|
this.colorIndex = 0;
|
|
8381
|
-
this.version = "1.
|
|
8436
|
+
this.version = "1.4.0-next.1";
|
|
8382
8437
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
8383
8438
|
this.superdocId = config.superdocId || v4();
|
|
8384
8439
|
this.colors = this.config.colors;
|
|
@@ -8515,6 +8570,7 @@ class SuperDoc extends EventEmitter {
|
|
|
8515
8570
|
this.superdocStore.init(this.config);
|
|
8516
8571
|
const commentsModuleConfig = this.config.modules.comments;
|
|
8517
8572
|
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
8573
|
+
this.#syncViewingVisibility();
|
|
8518
8574
|
}
|
|
8519
8575
|
#initListeners() {
|
|
8520
8576
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -8816,6 +8872,7 @@ class SuperDoc extends EventEmitter {
|
|
|
8816
8872
|
if (!type) return;
|
|
8817
8873
|
type = type.toLowerCase();
|
|
8818
8874
|
this.config.documentMode = type;
|
|
8875
|
+
this.#syncViewingVisibility();
|
|
8819
8876
|
const types = {
|
|
8820
8877
|
viewing: () => this.#setModeViewing(),
|
|
8821
8878
|
editing: () => this.#setModeEditing(),
|
|
@@ -8895,10 +8952,20 @@ class SuperDoc extends EventEmitter {
|
|
|
8895
8952
|
}
|
|
8896
8953
|
#setModeViewing() {
|
|
8897
8954
|
this.toolbar.activeEditor = null;
|
|
8898
|
-
this.
|
|
8899
|
-
this.
|
|
8955
|
+
const commentsVisible = this.config.comments?.visible === true;
|
|
8956
|
+
const trackChangesVisible = this.config.trackChanges?.visible === true;
|
|
8957
|
+
this.setTrackedChangesPreferences(
|
|
8958
|
+
trackChangesVisible ? { mode: "review", enabled: true } : { mode: "original", enabled: true }
|
|
8959
|
+
);
|
|
8960
|
+
if (!commentsVisible && !trackChangesVisible) {
|
|
8961
|
+
this.commentsStore?.clearEditorCommentPositions?.();
|
|
8962
|
+
}
|
|
8900
8963
|
this.superdocStore.documents.forEach((doc) => {
|
|
8901
|
-
|
|
8964
|
+
if (commentsVisible || trackChangesVisible) {
|
|
8965
|
+
doc.restoreComments();
|
|
8966
|
+
} else {
|
|
8967
|
+
doc.removeComments();
|
|
8968
|
+
}
|
|
8902
8969
|
this.#applyDocumentMode(doc, "viewing");
|
|
8903
8970
|
});
|
|
8904
8971
|
if (this.toolbar) {
|
|
@@ -8906,6 +8973,31 @@ class SuperDoc extends EventEmitter {
|
|
|
8906
8973
|
this.toolbar.updateToolbarState();
|
|
8907
8974
|
}
|
|
8908
8975
|
}
|
|
8976
|
+
#syncViewingVisibility() {
|
|
8977
|
+
const commentsVisible = this.config.comments?.visible === true;
|
|
8978
|
+
const trackChangesVisible = this.config.trackChanges?.visible === true;
|
|
8979
|
+
const isViewingMode = this.config.documentMode === "viewing";
|
|
8980
|
+
const shouldRenderCommentsInViewing = commentsVisible || trackChangesVisible;
|
|
8981
|
+
if (this.commentsStore?.setViewingVisibility) {
|
|
8982
|
+
this.commentsStore.setViewingVisibility({
|
|
8983
|
+
documentMode: this.config.documentMode,
|
|
8984
|
+
commentsVisible,
|
|
8985
|
+
trackChangesVisible
|
|
8986
|
+
});
|
|
8987
|
+
}
|
|
8988
|
+
const docs = this.superdocStore?.documents;
|
|
8989
|
+
if (Array.isArray(docs) && docs.length > 0) {
|
|
8990
|
+
docs.forEach((doc) => {
|
|
8991
|
+
const presentationEditor = typeof doc.getPresentationEditor === "function" ? doc.getPresentationEditor() : null;
|
|
8992
|
+
if (presentationEditor?.setViewingCommentOptions) {
|
|
8993
|
+
presentationEditor.setViewingCommentOptions({
|
|
8994
|
+
emitCommentPositionsInViewing: isViewingMode && shouldRenderCommentsInViewing,
|
|
8995
|
+
enableCommentsInViewing: isViewingMode && commentsVisible
|
|
8996
|
+
});
|
|
8997
|
+
}
|
|
8998
|
+
});
|
|
8999
|
+
}
|
|
9000
|
+
}
|
|
8909
9001
|
/**
|
|
8910
9002
|
* Search for text or regex in the active editor
|
|
8911
9003
|
* @param {string | RegExp} text The text or regex to search for
|
|
@@ -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,
|
|
@@ -6576,7 +6606,7 @@ const _sfc_main$a = {
|
|
|
6576
6606
|
const superdocStore = useSuperdocStore();
|
|
6577
6607
|
const commentsStore = useCommentsStore();
|
|
6578
6608
|
const { COMMENT_EVENTS } = commentsStore;
|
|
6579
|
-
const { documentsWithConverations, activeComment, floatingCommentsOffset,
|
|
6609
|
+
const { documentsWithConverations, activeComment, floatingCommentsOffset, getGroupedComments } = storeToRefs(commentsStore);
|
|
6580
6610
|
const { documents, activeZoom } = storeToRefs(superdocStore);
|
|
6581
6611
|
const { proxy } = vue.getCurrentInstance();
|
|
6582
6612
|
const emit = __emit;
|
|
@@ -6638,7 +6668,7 @@ const _sfc_main$a = {
|
|
|
6638
6668
|
emit("highlight-click", comment);
|
|
6639
6669
|
};
|
|
6640
6670
|
const getCurrentComments = vue.computed(() => {
|
|
6641
|
-
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");
|
|
6642
6672
|
});
|
|
6643
6673
|
vue.watch(activeComment, (newVal) => {
|
|
6644
6674
|
if (!newVal) return;
|
|
@@ -6666,7 +6696,7 @@ const _sfc_main$a = {
|
|
|
6666
6696
|
};
|
|
6667
6697
|
}
|
|
6668
6698
|
};
|
|
6669
|
-
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"]]);
|
|
6670
6700
|
const _hoisted_1$8 = { class: "sidebar-container calculation-container" };
|
|
6671
6701
|
const _hoisted_2$3 = ["id"];
|
|
6672
6702
|
const _sfc_main$9 = {
|
|
@@ -7466,7 +7496,7 @@ const _sfc_main = {
|
|
|
7466
7496
|
__name: "SuperDoc",
|
|
7467
7497
|
emits: ["selection-update"],
|
|
7468
7498
|
setup(__props, { emit: __emit }) {
|
|
7469
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
7499
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-H9_8IbtN.cjs")));
|
|
7470
7500
|
const superdocStore = useSuperdocStore();
|
|
7471
7501
|
const commentsStore = useCommentsStore();
|
|
7472
7502
|
const {
|
|
@@ -7508,6 +7538,16 @@ const _sfc_main = {
|
|
|
7508
7538
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
7509
7539
|
const { uiFontFamily } = useUiFontFamily();
|
|
7510
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
|
+
});
|
|
7511
7551
|
const commentsModuleConfig = vue.computed(() => {
|
|
7512
7552
|
const config = modules.comments;
|
|
7513
7553
|
if (config === false || config == null) return null;
|
|
@@ -7602,7 +7642,7 @@ const _sfc_main = {
|
|
|
7602
7642
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7603
7643
|
if (!commentsConfig || commentsConfig === false) return;
|
|
7604
7644
|
if (!positions || Object.keys(positions).length === 0) return;
|
|
7605
|
-
if (
|
|
7645
|
+
if (!shouldRenderCommentsInViewing.value) {
|
|
7606
7646
|
commentsStore.clearEditorCommentPositions?.();
|
|
7607
7647
|
return;
|
|
7608
7648
|
}
|
|
@@ -7797,7 +7837,9 @@ const _sfc_main = {
|
|
|
7797
7837
|
layoutEngineOptions: useLayoutEngine ? {
|
|
7798
7838
|
...proxy.$superdoc.config.layoutEngineOptions || {},
|
|
7799
7839
|
debugLabel: proxy.$superdoc.config.layoutEngineOptions?.debugLabel ?? doc.name ?? doc.id,
|
|
7800
|
-
zoom: (activeZoom.value ?? 100) / 100
|
|
7840
|
+
zoom: (activeZoom.value ?? 100) / 100,
|
|
7841
|
+
emitCommentPositionsInViewing: isViewingMode() && shouldRenderCommentsInViewing.value,
|
|
7842
|
+
enableCommentsInViewing: isViewingCommentsVisible.value
|
|
7801
7843
|
} : void 0,
|
|
7802
7844
|
permissionResolver: (payload = {}) => proxy.$superdoc.canPerformPermission({
|
|
7803
7845
|
role: proxy.$superdoc.config.role,
|
|
@@ -7810,7 +7852,7 @@ const _sfc_main = {
|
|
|
7810
7852
|
const onEditorCommentLocationsUpdate = (doc, { allCommentIds: activeThreadId, allCommentPositions } = {}) => {
|
|
7811
7853
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7812
7854
|
if (!commentsConfig || commentsConfig === false) return;
|
|
7813
|
-
if (
|
|
7855
|
+
if (!shouldRenderCommentsInViewing.value) {
|
|
7814
7856
|
commentsStore.clearEditorCommentPositions?.();
|
|
7815
7857
|
return;
|
|
7816
7858
|
}
|
|
@@ -7869,7 +7911,7 @@ const _sfc_main = {
|
|
|
7869
7911
|
};
|
|
7870
7912
|
const isCommentsEnabled = vue.computed(() => Boolean(commentsModuleConfig.value));
|
|
7871
7913
|
const showCommentsSidebar = vue.computed(() => {
|
|
7872
|
-
if (
|
|
7914
|
+
if (!shouldRenderCommentsInViewing.value) return false;
|
|
7873
7915
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
7874
7916
|
});
|
|
7875
7917
|
const showToolsFloatingMenu = vue.computed(() => {
|
|
@@ -8211,7 +8253,7 @@ const _sfc_main = {
|
|
|
8211
8253
|
};
|
|
8212
8254
|
}
|
|
8213
8255
|
};
|
|
8214
|
-
const App = /* @__PURE__ */ index._export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
8256
|
+
const App = /* @__PURE__ */ index._export_sfc(_sfc_main, [["__scopeId", "data-v-78737564"]]);
|
|
8215
8257
|
const createSuperdocVueApp = () => {
|
|
8216
8258
|
const app = vue.createApp(App);
|
|
8217
8259
|
const pinia = createPinia();
|
|
@@ -8317,6 +8359,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8317
8359
|
title: "SuperDoc",
|
|
8318
8360
|
conversations: [],
|
|
8319
8361
|
isInternal: false,
|
|
8362
|
+
comments: { visible: false },
|
|
8363
|
+
trackChanges: { visible: false },
|
|
8320
8364
|
// toolbar config
|
|
8321
8365
|
toolbar: null,
|
|
8322
8366
|
// Optional DOM element to render the toolbar in
|
|
@@ -8366,6 +8410,16 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8366
8410
|
...this.config,
|
|
8367
8411
|
...config
|
|
8368
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
|
+
}
|
|
8369
8423
|
const incomingUser = this.config.user;
|
|
8370
8424
|
if (!incomingUser || typeof incomingUser !== "object") {
|
|
8371
8425
|
this.config.user = { ...DEFAULT_USER };
|
|
@@ -8383,9 +8437,10 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8383
8437
|
}
|
|
8384
8438
|
if (!this.config.layoutEngineOptions.trackedChanges) {
|
|
8385
8439
|
const isViewingMode = this.config.documentMode === "viewing";
|
|
8440
|
+
const viewingTrackedChangesVisible = isViewingMode && this.config.trackChanges?.visible === true;
|
|
8386
8441
|
this.config.layoutEngineOptions.trackedChanges = {
|
|
8387
|
-
mode: isViewingMode ? "
|
|
8388
|
-
enabled:
|
|
8442
|
+
mode: isViewingMode ? viewingTrackedChangesVisible ? "review" : "original" : "review",
|
|
8443
|
+
enabled: true
|
|
8389
8444
|
};
|
|
8390
8445
|
}
|
|
8391
8446
|
this.config.modules = this.config.modules || {};
|
|
@@ -8395,7 +8450,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8395
8450
|
this.config.colors = shuffleArray(this.config.colors);
|
|
8396
8451
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
8397
8452
|
this.colorIndex = 0;
|
|
8398
|
-
this.version = "1.
|
|
8453
|
+
this.version = "1.4.0-next.1";
|
|
8399
8454
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
8400
8455
|
this.superdocId = config.superdocId || uuid.v4();
|
|
8401
8456
|
this.colors = this.config.colors;
|
|
@@ -8532,6 +8587,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8532
8587
|
this.superdocStore.init(this.config);
|
|
8533
8588
|
const commentsModuleConfig = this.config.modules.comments;
|
|
8534
8589
|
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
8590
|
+
this.#syncViewingVisibility();
|
|
8535
8591
|
}
|
|
8536
8592
|
#initListeners() {
|
|
8537
8593
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -8833,6 +8889,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8833
8889
|
if (!type) return;
|
|
8834
8890
|
type = type.toLowerCase();
|
|
8835
8891
|
this.config.documentMode = type;
|
|
8892
|
+
this.#syncViewingVisibility();
|
|
8836
8893
|
const types = {
|
|
8837
8894
|
viewing: () => this.#setModeViewing(),
|
|
8838
8895
|
editing: () => this.#setModeEditing(),
|
|
@@ -8912,10 +8969,20 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8912
8969
|
}
|
|
8913
8970
|
#setModeViewing() {
|
|
8914
8971
|
this.toolbar.activeEditor = null;
|
|
8915
|
-
this.
|
|
8916
|
-
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
|
+
}
|
|
8917
8980
|
this.superdocStore.documents.forEach((doc) => {
|
|
8918
|
-
|
|
8981
|
+
if (commentsVisible || trackChangesVisible) {
|
|
8982
|
+
doc.restoreComments();
|
|
8983
|
+
} else {
|
|
8984
|
+
doc.removeComments();
|
|
8985
|
+
}
|
|
8919
8986
|
this.#applyDocumentMode(doc, "viewing");
|
|
8920
8987
|
});
|
|
8921
8988
|
if (this.toolbar) {
|
|
@@ -8923,6 +8990,31 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8923
8990
|
this.toolbar.updateToolbarState();
|
|
8924
8991
|
}
|
|
8925
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
|
+
}
|
|
8926
9018
|
/**
|
|
8927
9019
|
* Search for text or regex in the active editor
|
|
8928
9020
|
* @param {string | RegExp} text The text or regex to search for
|