@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
|
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,
|
|
@@ -30414,9 +30414,10 @@ const updateCommentsXml = (commentDefs = [], commentsXml) => {
|
|
|
30414
30414
|
const updateCommentsExtendedXml = (comments = [], commentsExtendedXml) => {
|
|
30415
30415
|
const xmlCopy = carbonCopy(commentsExtendedXml);
|
|
30416
30416
|
const commentsEx = comments.map((comment) => {
|
|
30417
|
+
const isResolved = comment.resolvedTime || comment.isDone;
|
|
30417
30418
|
const attributes = {
|
|
30418
30419
|
"w15:paraId": comment.commentParaId,
|
|
30419
|
-
"w15:done":
|
|
30420
|
+
"w15:done": isResolved ? "1" : "0"
|
|
30420
30421
|
};
|
|
30421
30422
|
const parentId = comment.parentCommentId;
|
|
30422
30423
|
if (parentId) {
|
|
@@ -31007,7 +31008,7 @@ class SuperConverter {
|
|
|
31007
31008
|
static getStoredSuperdocVersion(docx) {
|
|
31008
31009
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
31009
31010
|
}
|
|
31010
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.
|
|
31011
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.4.0-next.1") {
|
|
31011
31012
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
31012
31013
|
}
|
|
31013
31014
|
/**
|
|
@@ -30415,9 +30415,10 @@ const updateCommentsXml = (commentDefs = [], commentsXml) => {
|
|
|
30415
30415
|
const updateCommentsExtendedXml = (comments = [], commentsExtendedXml) => {
|
|
30416
30416
|
const xmlCopy = carbonCopy(commentsExtendedXml);
|
|
30417
30417
|
const commentsEx = comments.map((comment) => {
|
|
30418
|
+
const isResolved = comment.resolvedTime || comment.isDone;
|
|
30418
30419
|
const attributes = {
|
|
30419
30420
|
"w15:paraId": comment.commentParaId,
|
|
30420
|
-
"w15:done":
|
|
30421
|
+
"w15:done": isResolved ? "1" : "0"
|
|
30421
30422
|
};
|
|
30422
30423
|
const parentId = comment.parentCommentId;
|
|
30423
30424
|
if (parentId) {
|
|
@@ -31008,7 +31009,7 @@ class SuperConverter {
|
|
|
31008
31009
|
static getStoredSuperdocVersion(docx) {
|
|
31009
31010
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
31010
31011
|
}
|
|
31011
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.
|
|
31012
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.4.0-next.1") {
|
|
31012
31013
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
31013
31014
|
}
|
|
31014
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,
|
|
@@ -6200,12 +6230,13 @@ const _sfc_main$c = {
|
|
|
6200
6230
|
return currentCommentText.value && currentCommentText.value !== "<p></p>";
|
|
6201
6231
|
});
|
|
6202
6232
|
const setFocus = () => {
|
|
6203
|
-
if (props.comment.resolvedTime) return;
|
|
6204
6233
|
const editor = proxy.$superdoc.activeEditor;
|
|
6205
|
-
|
|
6206
|
-
|
|
6234
|
+
if (!props.comment.resolvedTime) {
|
|
6235
|
+
activeComment.value = props.comment.commentId;
|
|
6236
|
+
props.comment.setActive(proxy.$superdoc);
|
|
6237
|
+
}
|
|
6207
6238
|
if (editor) {
|
|
6208
|
-
const cursorId = props.comment.importedId || props.comment.commentId;
|
|
6239
|
+
const cursorId = props.comment.resolvedTime ? props.comment.commentId : props.comment.importedId || props.comment.commentId;
|
|
6209
6240
|
editor.commands?.setCursorById(cursorId);
|
|
6210
6241
|
}
|
|
6211
6242
|
};
|
|
@@ -6441,7 +6472,7 @@ const _sfc_main$c = {
|
|
|
6441
6472
|
};
|
|
6442
6473
|
}
|
|
6443
6474
|
};
|
|
6444
|
-
const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
|
6475
|
+
const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-d50fd675"]]);
|
|
6445
6476
|
const _hoisted_1$a = { class: "comments-list" };
|
|
6446
6477
|
const _hoisted_2$5 = { key: 0 };
|
|
6447
6478
|
const _hoisted_3$3 = { class: "comment-item" };
|
|
@@ -6558,7 +6589,7 @@ const _sfc_main$a = {
|
|
|
6558
6589
|
const superdocStore = useSuperdocStore();
|
|
6559
6590
|
const commentsStore = useCommentsStore();
|
|
6560
6591
|
const { COMMENT_EVENTS } = commentsStore;
|
|
6561
|
-
const { documentsWithConverations, activeComment, floatingCommentsOffset,
|
|
6592
|
+
const { documentsWithConverations, activeComment, floatingCommentsOffset, getGroupedComments } = storeToRefs(commentsStore);
|
|
6562
6593
|
const { documents, activeZoom } = storeToRefs(superdocStore);
|
|
6563
6594
|
const { proxy } = getCurrentInstance();
|
|
6564
6595
|
const emit = __emit;
|
|
@@ -6620,7 +6651,7 @@ const _sfc_main$a = {
|
|
|
6620
6651
|
emit("highlight-click", comment);
|
|
6621
6652
|
};
|
|
6622
6653
|
const getCurrentComments = computed(() => {
|
|
6623
|
-
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");
|
|
6624
6655
|
});
|
|
6625
6656
|
watch(activeComment, (newVal) => {
|
|
6626
6657
|
if (!newVal) return;
|
|
@@ -6648,7 +6679,7 @@ const _sfc_main$a = {
|
|
|
6648
6679
|
};
|
|
6649
6680
|
}
|
|
6650
6681
|
};
|
|
6651
|
-
const CommentsLayer = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-
|
|
6682
|
+
const CommentsLayer = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-7d21d613"]]);
|
|
6652
6683
|
const _hoisted_1$8 = { class: "sidebar-container calculation-container" };
|
|
6653
6684
|
const _hoisted_2$3 = ["id"];
|
|
6654
6685
|
const _sfc_main$9 = {
|
|
@@ -7448,7 +7479,7 @@ const _sfc_main = {
|
|
|
7448
7479
|
__name: "SuperDoc",
|
|
7449
7480
|
emits: ["selection-update"],
|
|
7450
7481
|
setup(__props, { emit: __emit }) {
|
|
7451
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
7482
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DRTk3dY6.es.js"));
|
|
7452
7483
|
const superdocStore = useSuperdocStore();
|
|
7453
7484
|
const commentsStore = useCommentsStore();
|
|
7454
7485
|
const {
|
|
@@ -7490,6 +7521,16 @@ const _sfc_main = {
|
|
|
7490
7521
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
7491
7522
|
const { uiFontFamily } = useUiFontFamily();
|
|
7492
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
|
+
});
|
|
7493
7534
|
const commentsModuleConfig = computed(() => {
|
|
7494
7535
|
const config = modules.comments;
|
|
7495
7536
|
if (config === false || config == null) return null;
|
|
@@ -7584,7 +7625,7 @@ const _sfc_main = {
|
|
|
7584
7625
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7585
7626
|
if (!commentsConfig || commentsConfig === false) return;
|
|
7586
7627
|
if (!positions || Object.keys(positions).length === 0) return;
|
|
7587
|
-
if (
|
|
7628
|
+
if (!shouldRenderCommentsInViewing.value) {
|
|
7588
7629
|
commentsStore.clearEditorCommentPositions?.();
|
|
7589
7630
|
return;
|
|
7590
7631
|
}
|
|
@@ -7779,7 +7820,9 @@ const _sfc_main = {
|
|
|
7779
7820
|
layoutEngineOptions: useLayoutEngine ? {
|
|
7780
7821
|
...proxy.$superdoc.config.layoutEngineOptions || {},
|
|
7781
7822
|
debugLabel: proxy.$superdoc.config.layoutEngineOptions?.debugLabel ?? doc.name ?? doc.id,
|
|
7782
|
-
zoom: (activeZoom.value ?? 100) / 100
|
|
7823
|
+
zoom: (activeZoom.value ?? 100) / 100,
|
|
7824
|
+
emitCommentPositionsInViewing: isViewingMode() && shouldRenderCommentsInViewing.value,
|
|
7825
|
+
enableCommentsInViewing: isViewingCommentsVisible.value
|
|
7783
7826
|
} : void 0,
|
|
7784
7827
|
permissionResolver: (payload = {}) => proxy.$superdoc.canPerformPermission({
|
|
7785
7828
|
role: proxy.$superdoc.config.role,
|
|
@@ -7792,7 +7835,7 @@ const _sfc_main = {
|
|
|
7792
7835
|
const onEditorCommentLocationsUpdate = (doc, { allCommentIds: activeThreadId, allCommentPositions } = {}) => {
|
|
7793
7836
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7794
7837
|
if (!commentsConfig || commentsConfig === false) return;
|
|
7795
|
-
if (
|
|
7838
|
+
if (!shouldRenderCommentsInViewing.value) {
|
|
7796
7839
|
commentsStore.clearEditorCommentPositions?.();
|
|
7797
7840
|
return;
|
|
7798
7841
|
}
|
|
@@ -7851,7 +7894,7 @@ const _sfc_main = {
|
|
|
7851
7894
|
};
|
|
7852
7895
|
const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
|
|
7853
7896
|
const showCommentsSidebar = computed(() => {
|
|
7854
|
-
if (
|
|
7897
|
+
if (!shouldRenderCommentsInViewing.value) return false;
|
|
7855
7898
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
7856
7899
|
});
|
|
7857
7900
|
const showToolsFloatingMenu = computed(() => {
|
|
@@ -8193,7 +8236,7 @@ const _sfc_main = {
|
|
|
8193
8236
|
};
|
|
8194
8237
|
}
|
|
8195
8238
|
};
|
|
8196
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
8239
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-78737564"]]);
|
|
8197
8240
|
const createSuperdocVueApp = () => {
|
|
8198
8241
|
const app = createApp(App);
|
|
8199
8242
|
const pinia = createPinia();
|
|
@@ -8299,6 +8342,8 @@ class SuperDoc extends EventEmitter {
|
|
|
8299
8342
|
title: "SuperDoc",
|
|
8300
8343
|
conversations: [],
|
|
8301
8344
|
isInternal: false,
|
|
8345
|
+
comments: { visible: false },
|
|
8346
|
+
trackChanges: { visible: false },
|
|
8302
8347
|
// toolbar config
|
|
8303
8348
|
toolbar: null,
|
|
8304
8349
|
// Optional DOM element to render the toolbar in
|
|
@@ -8348,6 +8393,16 @@ class SuperDoc extends EventEmitter {
|
|
|
8348
8393
|
...this.config,
|
|
8349
8394
|
...config
|
|
8350
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
|
+
}
|
|
8351
8406
|
const incomingUser = this.config.user;
|
|
8352
8407
|
if (!incomingUser || typeof incomingUser !== "object") {
|
|
8353
8408
|
this.config.user = { ...DEFAULT_USER };
|
|
@@ -8365,9 +8420,10 @@ class SuperDoc extends EventEmitter {
|
|
|
8365
8420
|
}
|
|
8366
8421
|
if (!this.config.layoutEngineOptions.trackedChanges) {
|
|
8367
8422
|
const isViewingMode = this.config.documentMode === "viewing";
|
|
8423
|
+
const viewingTrackedChangesVisible = isViewingMode && this.config.trackChanges?.visible === true;
|
|
8368
8424
|
this.config.layoutEngineOptions.trackedChanges = {
|
|
8369
|
-
mode: isViewingMode ? "
|
|
8370
|
-
enabled:
|
|
8425
|
+
mode: isViewingMode ? viewingTrackedChangesVisible ? "review" : "original" : "review",
|
|
8426
|
+
enabled: true
|
|
8371
8427
|
};
|
|
8372
8428
|
}
|
|
8373
8429
|
this.config.modules = this.config.modules || {};
|
|
@@ -8377,7 +8433,7 @@ class SuperDoc extends EventEmitter {
|
|
|
8377
8433
|
this.config.colors = shuffleArray(this.config.colors);
|
|
8378
8434
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
8379
8435
|
this.colorIndex = 0;
|
|
8380
|
-
this.version = "1.
|
|
8436
|
+
this.version = "1.4.0-next.1";
|
|
8381
8437
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
8382
8438
|
this.superdocId = config.superdocId || v4();
|
|
8383
8439
|
this.colors = this.config.colors;
|
|
@@ -8514,6 +8570,7 @@ class SuperDoc extends EventEmitter {
|
|
|
8514
8570
|
this.superdocStore.init(this.config);
|
|
8515
8571
|
const commentsModuleConfig = this.config.modules.comments;
|
|
8516
8572
|
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
8573
|
+
this.#syncViewingVisibility();
|
|
8517
8574
|
}
|
|
8518
8575
|
#initListeners() {
|
|
8519
8576
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -8815,6 +8872,7 @@ class SuperDoc extends EventEmitter {
|
|
|
8815
8872
|
if (!type) return;
|
|
8816
8873
|
type = type.toLowerCase();
|
|
8817
8874
|
this.config.documentMode = type;
|
|
8875
|
+
this.#syncViewingVisibility();
|
|
8818
8876
|
const types = {
|
|
8819
8877
|
viewing: () => this.#setModeViewing(),
|
|
8820
8878
|
editing: () => this.#setModeEditing(),
|
|
@@ -8894,10 +8952,20 @@ class SuperDoc extends EventEmitter {
|
|
|
8894
8952
|
}
|
|
8895
8953
|
#setModeViewing() {
|
|
8896
8954
|
this.toolbar.activeEditor = null;
|
|
8897
|
-
this.
|
|
8898
|
-
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
|
+
}
|
|
8899
8963
|
this.superdocStore.documents.forEach((doc) => {
|
|
8900
|
-
|
|
8964
|
+
if (commentsVisible || trackChangesVisible) {
|
|
8965
|
+
doc.restoreComments();
|
|
8966
|
+
} else {
|
|
8967
|
+
doc.removeComments();
|
|
8968
|
+
}
|
|
8901
8969
|
this.#applyDocumentMode(doc, "viewing");
|
|
8902
8970
|
});
|
|
8903
8971
|
if (this.toolbar) {
|
|
@@ -8905,6 +8973,31 @@ class SuperDoc extends EventEmitter {
|
|
|
8905
8973
|
this.toolbar.updateToolbarState();
|
|
8906
8974
|
}
|
|
8907
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
|
+
}
|
|
8908
9001
|
/**
|
|
8909
9002
|
* Search for text or regex in the active editor
|
|
8910
9003
|
* @param {string | RegExp} text The text or regex to search for
|