@harbour-enterprises/superdoc 0.23.0-next.1 → 0.23.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-C9SGNZr6.cjs → PdfViewer-CxsRHFKK.cjs} +2 -2
- package/dist/chunks/{PdfViewer-D9atA783.es.js → PdfViewer-itEb8CY_.es.js} +2 -2
- package/dist/chunks/{eventemitter3-CZv6vEhA.es.js → eventemitter3-CR2eBWft.es.js} +1 -1
- package/dist/chunks/{eventemitter3-B_kO1Pxm.cjs → eventemitter3-DSRogsNq.cjs} +1 -1
- package/dist/chunks/{index-C8q6lenv.es.js → index-CTFsQkQh.es.js} +75 -28
- package/dist/chunks/{index-CIbe1VMu.cjs → index-DO0hDjEd.cjs} +75 -28
- package/dist/chunks/{jszip-b7l8QkfH.cjs → jszip-B4LDL19y.cjs} +1 -1
- package/dist/chunks/{jszip-B8KIZSNe.es.js → jszip-DAXEPCUv.es.js} +1 -1
- package/dist/chunks/{super-editor.es-DxScE0ep.cjs → super-editor.es-Ck_zDasU.cjs} +259 -86
- package/dist/chunks/{super-editor.es-Dj6Sxtr7.es.js → super-editor.es-D2K5zQwY.es.js} +259 -86
- package/dist/chunks/{vue-DWle4Cai.cjs → vue-DKMj1I9B.cjs} +39 -42
- package/dist/chunks/{vue-CXxsqYcP.es.js → vue-ZWZLQtoU.es.js} +39 -42
- package/dist/chunks/xml-js-Bbc0NeKa.es.js +2 -0
- package/dist/chunks/xml-js-CWV8R-ek.cjs +3 -0
- package/dist/core/SuperDoc.d.ts +5 -18
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +29 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/stores/comments-store.d.ts +3 -3
- package/dist/stores/comments-store.d.ts.map +1 -1
- package/dist/stores/superdoc-store.d.ts.map +1 -1
- package/dist/style.css +73 -54
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-C08GQjNi.js → converter-ClnqoStR.js} +18 -19
- package/dist/super-editor/chunks/{docx-zipper-C3-uf2tI.js → docx-zipper-DC28ucAi.js} +1 -1
- package/dist/super-editor/chunks/{editor-C2IwVkIp.js → editor-C3VH8Ia2.js} +240 -66
- package/dist/super-editor/chunks/{toolbar-De8G_9NV.js → toolbar-BG1F_1RK.js} +4 -4
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/src/core/Attribute.d.ts +2 -2
- package/dist/super-editor/src/core/Schema.d.ts +2 -2
- package/dist/super-editor/src/extensions/comment/comments-plugin.d.ts +60 -0
- package/dist/super-editor/src/extensions/comment/helpers/index.d.ts +2 -0
- package/dist/super-editor/src/extensions/comment/helpers/normalize-comment-event-payload.d.ts +1 -0
- package/dist/super-editor/src/extensions/comment/helpers/update-position.d.ts +7 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/handleBase64.d.ts +4 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/imageRegistrationPlugin.d.ts +1 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/startImageUpload.d.ts +5 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsByAlias.d.ts +8 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +1 -0
- package/dist/super-editor/style.css +46 -27
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +4 -4
- package/dist/superdoc.es.js +4 -4
- package/dist/superdoc.umd.js +362 -142
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-CX8FH0He.cjs +0 -3
- package/dist/chunks/xml-js-D0tLGmKu.es.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const vue = require("./vue-
|
|
4
|
-
const superdoc = require("./index-
|
|
3
|
+
const vue = require("./vue-DKMj1I9B.cjs");
|
|
4
|
+
const superdoc = require("./index-DO0hDjEd.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-
|
|
2
|
-
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-
|
|
1
|
+
import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
|
|
2
|
+
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CTFsQkQh.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
2
|
-
import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-
|
|
3
|
-
import { B as Buffer$2 } from "./jszip-
|
|
1
|
+
import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-D2K5zQwY.es.js";
|
|
2
|
+
import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
|
|
3
|
+
import { B as Buffer$2 } from "./jszip-DAXEPCUv.es.js";
|
|
4
4
|
import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
|
|
5
|
-
import { E as EventEmitter } from "./eventemitter3-
|
|
5
|
+
import { E as EventEmitter } from "./eventemitter3-CR2eBWft.es.js";
|
|
6
6
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
7
7
|
import * as Y from "yjs";
|
|
8
8
|
import { Doc, Map as Map$2 } from "yjs";
|
|
@@ -4008,6 +4008,9 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4008
4008
|
documentUsers.value = configUsers || [];
|
|
4009
4009
|
Object.assign(user, configUser);
|
|
4010
4010
|
Object.assign(modules, configModules);
|
|
4011
|
+
if (!Object.prototype.hasOwnProperty.call(modules, "comments")) {
|
|
4012
|
+
modules.comments = {};
|
|
4013
|
+
}
|
|
4011
4014
|
if (!configDocs?.length && !config.modules.collaboration) {
|
|
4012
4015
|
const newDoc = await getFileObject(BlankDOCX, "blank.docx", DOCX);
|
|
4013
4016
|
const newDocConfig = {
|
|
@@ -4309,7 +4312,11 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4309
4312
|
pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
|
|
4310
4313
|
if (!superdoc2.config.isInternal) pendingComment.value.isInternal = false;
|
|
4311
4314
|
if (superdoc2.activeEditor?.commands) {
|
|
4312
|
-
superdoc2.activeEditor.commands.insertComment({
|
|
4315
|
+
superdoc2.activeEditor.commands.insertComment({
|
|
4316
|
+
...pendingComment.value.getValues(),
|
|
4317
|
+
commentId: "pending",
|
|
4318
|
+
skipEmit: true
|
|
4319
|
+
});
|
|
4313
4320
|
}
|
|
4314
4321
|
if (pendingComment.value.selection.source === "super-editor" && superdocStore.selectionPosition) {
|
|
4315
4322
|
superdocStore.selectionPosition.source = "super-editor";
|
|
@@ -4381,7 +4388,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4381
4388
|
superdocStore.selectionPosition = null;
|
|
4382
4389
|
superdoc2.activeEditor?.commands.removeComment({ commentId: "pending" });
|
|
4383
4390
|
};
|
|
4384
|
-
const addComment = ({ superdoc: superdoc2, comment }) => {
|
|
4391
|
+
const addComment = ({ superdoc: superdoc2, comment, skipEditorUpdate = false }) => {
|
|
4385
4392
|
let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
|
|
4386
4393
|
if (!parentComment) parentComment = comment;
|
|
4387
4394
|
const newComment = useComment(comment.getValues());
|
|
@@ -4395,8 +4402,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4395
4402
|
if (!superdoc2.config.isInternal) newComment.isInternal = false;
|
|
4396
4403
|
commentsList.value.push(newComment);
|
|
4397
4404
|
removePendingComment(superdoc2);
|
|
4398
|
-
if (!comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
|
|
4399
|
-
superdoc2.activeEditor.commands.insertComment(newComment.getValues());
|
|
4405
|
+
if (!skipEditorUpdate && !comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
|
|
4406
|
+
superdoc2.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
|
|
4400
4407
|
}
|
|
4401
4408
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
4402
4409
|
syncCommentsToClients(superdoc2, event);
|
|
@@ -17397,7 +17404,7 @@ const _sfc_main = {
|
|
|
17397
17404
|
__name: "SuperDoc",
|
|
17398
17405
|
emits: ["selection-update"],
|
|
17399
17406
|
setup(__props, { emit: __emit }) {
|
|
17400
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17407
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-itEb8CY_.es.js"));
|
|
17401
17408
|
const superdocStore = useSuperdocStore();
|
|
17402
17409
|
const commentsStore = useCommentsStore();
|
|
17403
17410
|
const {
|
|
@@ -17426,10 +17433,22 @@ const _sfc_main = {
|
|
|
17426
17433
|
hasInitializedLocations,
|
|
17427
17434
|
isCommentHighlighted
|
|
17428
17435
|
} = storeToRefs(commentsStore);
|
|
17429
|
-
const {
|
|
17436
|
+
const {
|
|
17437
|
+
showAddComment,
|
|
17438
|
+
handleEditorLocationsUpdate,
|
|
17439
|
+
handleTrackedChangeUpdate,
|
|
17440
|
+
addComment,
|
|
17441
|
+
getComment,
|
|
17442
|
+
COMMENT_EVENTS
|
|
17443
|
+
} = commentsStore;
|
|
17430
17444
|
const { proxy } = getCurrentInstance();
|
|
17431
17445
|
commentsStore.proxy = proxy;
|
|
17432
17446
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
17447
|
+
const commentsModuleConfig = computed(() => {
|
|
17448
|
+
const config = modules.comments;
|
|
17449
|
+
if (config === false || config == null) return null;
|
|
17450
|
+
return config;
|
|
17451
|
+
});
|
|
17433
17452
|
const layers = ref(null);
|
|
17434
17453
|
const commentsLayer = ref(null);
|
|
17435
17454
|
const toolsMenuPosition = reactive({ top: null, right: "-25px", zIndex: 101 });
|
|
@@ -17577,7 +17596,7 @@ const _sfc_main = {
|
|
|
17577
17596
|
rulers: doc.rulers,
|
|
17578
17597
|
isInternal: proxy.$superdoc.config.isInternal,
|
|
17579
17598
|
annotations: proxy.$superdoc.config.annotations,
|
|
17580
|
-
isCommentsEnabled:
|
|
17599
|
+
isCommentsEnabled: Boolean(commentsModuleConfig.value),
|
|
17581
17600
|
isAiEnabled: proxy.$superdoc.config.modules?.ai,
|
|
17582
17601
|
slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
|
|
17583
17602
|
onBeforeCreate: onEditorBeforeCreate,
|
|
@@ -17608,11 +17627,38 @@ const _sfc_main = {
|
|
|
17608
17627
|
return options;
|
|
17609
17628
|
};
|
|
17610
17629
|
const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
|
|
17611
|
-
|
|
17630
|
+
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
17631
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17612
17632
|
handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
|
|
17613
17633
|
};
|
|
17614
17634
|
const onEditorCommentsUpdate = (params2 = {}) => {
|
|
17615
|
-
|
|
17635
|
+
let { activeCommentId, type, comment: commentPayload } = params2;
|
|
17636
|
+
if (COMMENT_EVENTS?.ADD && type === COMMENT_EVENTS.ADD && commentPayload) {
|
|
17637
|
+
if (!commentPayload.commentText && commentPayload.text) {
|
|
17638
|
+
commentPayload.commentText = commentPayload.text;
|
|
17639
|
+
}
|
|
17640
|
+
const currentUser = proxy.$superdoc?.user;
|
|
17641
|
+
if (currentUser) {
|
|
17642
|
+
if (!commentPayload.creatorName) commentPayload.creatorName = currentUser.name;
|
|
17643
|
+
if (!commentPayload.creatorEmail) commentPayload.creatorEmail = currentUser.email;
|
|
17644
|
+
}
|
|
17645
|
+
if (!commentPayload.createdTime) commentPayload.createdTime = Date.now();
|
|
17646
|
+
const primaryDocumentId = commentPayload.documentId || documents.value?.[0]?.id;
|
|
17647
|
+
if (!commentPayload.documentId && primaryDocumentId) {
|
|
17648
|
+
commentPayload.documentId = primaryDocumentId;
|
|
17649
|
+
}
|
|
17650
|
+
if (!commentPayload.fileId && primaryDocumentId) {
|
|
17651
|
+
commentPayload.fileId = primaryDocumentId;
|
|
17652
|
+
}
|
|
17653
|
+
const id = commentPayload.commentId || commentPayload.importedId;
|
|
17654
|
+
if (id && !getComment(id)) {
|
|
17655
|
+
const commentModel = useComment(commentPayload);
|
|
17656
|
+
addComment({ superdoc: proxy.$superdoc, comment: commentModel, skipEditorUpdate: true });
|
|
17657
|
+
}
|
|
17658
|
+
if (!activeCommentId && id) {
|
|
17659
|
+
activeCommentId = id;
|
|
17660
|
+
}
|
|
17661
|
+
}
|
|
17616
17662
|
if (type === "trackedChange") {
|
|
17617
17663
|
handleTrackedChangeUpdate({ superdoc: proxy.$superdoc, params: params2 });
|
|
17618
17664
|
}
|
|
@@ -17630,7 +17676,7 @@ const _sfc_main = {
|
|
|
17630
17676
|
proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
|
|
17631
17677
|
}
|
|
17632
17678
|
};
|
|
17633
|
-
const isCommentsEnabled = computed(() =>
|
|
17679
|
+
const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
|
|
17634
17680
|
const showCommentsSidebar = computed(() => {
|
|
17635
17681
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
17636
17682
|
});
|
|
@@ -17640,13 +17686,14 @@ const _sfc_main = {
|
|
|
17640
17686
|
});
|
|
17641
17687
|
computed(() => {
|
|
17642
17688
|
if (!isCommentsEnabled.value) return false;
|
|
17643
|
-
!getConfig?.readOnly && selectionPosition.value;
|
|
17689
|
+
return !getConfig.value?.readOnly && selectionPosition.value;
|
|
17644
17690
|
});
|
|
17645
17691
|
watch(showCommentsSidebar, (value) => {
|
|
17646
17692
|
proxy.$superdoc.broadcastSidebarToggle(value);
|
|
17647
17693
|
});
|
|
17648
17694
|
const scrollToComment = (commentId) => {
|
|
17649
|
-
|
|
17695
|
+
const commentsConfig = proxy.$superdoc.config?.modules?.comments;
|
|
17696
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17650
17697
|
const element = document.querySelector(`[data-thread-id=${commentId}]`);
|
|
17651
17698
|
if (element) {
|
|
17652
17699
|
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
@@ -17654,7 +17701,8 @@ const _sfc_main = {
|
|
|
17654
17701
|
}
|
|
17655
17702
|
};
|
|
17656
17703
|
onMounted(() => {
|
|
17657
|
-
|
|
17704
|
+
const config = commentsModuleConfig.value;
|
|
17705
|
+
if (config && !config.readOnly) {
|
|
17658
17706
|
document.addEventListener("mousedown", handleDocumentMouseDown);
|
|
17659
17707
|
}
|
|
17660
17708
|
});
|
|
@@ -17776,6 +17824,7 @@ const _sfc_main = {
|
|
|
17776
17824
|
};
|
|
17777
17825
|
const shouldShowSelection = computed(() => {
|
|
17778
17826
|
const config = proxy.$superdoc.config.modules?.comments;
|
|
17827
|
+
if (!config || config === false) return false;
|
|
17779
17828
|
return !config.readOnly;
|
|
17780
17829
|
});
|
|
17781
17830
|
const handleSuperEditorPageMarginsChange = (doc, params2) => {
|
|
@@ -17942,7 +17991,7 @@ const _sfc_main = {
|
|
|
17942
17991
|
};
|
|
17943
17992
|
}
|
|
17944
17993
|
};
|
|
17945
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
17994
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-96983cf9"]]);
|
|
17946
17995
|
const createSuperdocVueApp = () => {
|
|
17947
17996
|
const app = createApp(App);
|
|
17948
17997
|
const pinia = createPinia();
|
|
@@ -18041,6 +18090,10 @@ class SuperDoc extends EventEmitter {
|
|
|
18041
18090
|
...this.config,
|
|
18042
18091
|
...config
|
|
18043
18092
|
};
|
|
18093
|
+
this.config.modules = this.config.modules || {};
|
|
18094
|
+
if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
|
|
18095
|
+
this.config.modules.comments = {};
|
|
18096
|
+
}
|
|
18044
18097
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18045
18098
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18046
18099
|
this.colorIndex = 0;
|
|
@@ -18175,7 +18228,8 @@ class SuperDoc extends EventEmitter {
|
|
|
18175
18228
|
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
18176
18229
|
}
|
|
18177
18230
|
this.superdocStore.init(this.config);
|
|
18178
|
-
this.
|
|
18231
|
+
const commentsModuleConfig = this.config.modules.comments;
|
|
18232
|
+
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
18179
18233
|
}
|
|
18180
18234
|
#initListeners() {
|
|
18181
18235
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -18525,15 +18579,8 @@ class SuperDoc extends EventEmitter {
|
|
|
18525
18579
|
}
|
|
18526
18580
|
/**
|
|
18527
18581
|
* Export the superdoc to a file
|
|
18528
|
-
* @param {
|
|
18529
|
-
* @
|
|
18530
|
-
* @param {string} [params.commentsType]
|
|
18531
|
-
* @param {string} [params.exportedName]
|
|
18532
|
-
* @param {Array} [params.additionalFiles]
|
|
18533
|
-
* @param {Array} [params.additionalFileNames]
|
|
18534
|
-
* @param {boolean} [params.isFinalDoc]
|
|
18535
|
-
* @param {boolean} [params.triggerDownload] Whether to trigger the download of the exported file
|
|
18536
|
-
* @returns {Promise<void | Blob>} Returns void if triggerDownload is false, otherwise returns the exported file
|
|
18582
|
+
* @param {ExportParams} params - Export configuration
|
|
18583
|
+
* @returns {Promise<void | Blob>}
|
|
18537
18584
|
*/
|
|
18538
18585
|
async export({
|
|
18539
18586
|
exportType = ["docx"],
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
-
const vue = require("./vue-
|
|
4
|
-
const jszip = require("./jszip-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-Ck_zDasU.cjs");
|
|
3
|
+
const vue = require("./vue-DKMj1I9B.cjs");
|
|
4
|
+
const jszip = require("./jszip-B4LDL19y.cjs");
|
|
5
5
|
const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
|
|
6
|
-
const eventemitter3 = require("./eventemitter3-
|
|
6
|
+
const eventemitter3 = require("./eventemitter3-DSRogsNq.cjs");
|
|
7
7
|
const provider = require("@hocuspocus/provider");
|
|
8
8
|
const Y = require("yjs");
|
|
9
9
|
const uuid = require("./uuid-CQzaMNgL.cjs");
|
|
@@ -4025,6 +4025,9 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
|
4025
4025
|
documentUsers.value = configUsers || [];
|
|
4026
4026
|
Object.assign(user, configUser);
|
|
4027
4027
|
Object.assign(modules, configModules);
|
|
4028
|
+
if (!Object.prototype.hasOwnProperty.call(modules, "comments")) {
|
|
4029
|
+
modules.comments = {};
|
|
4030
|
+
}
|
|
4028
4031
|
if (!configDocs?.length && !config.modules.collaboration) {
|
|
4029
4032
|
const newDoc = await getFileObject(blankDocx.BlankDOCX, "blank.docx", DOCX);
|
|
4030
4033
|
const newDocConfig = {
|
|
@@ -4326,7 +4329,11 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4326
4329
|
pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
|
|
4327
4330
|
if (!superdoc2.config.isInternal) pendingComment.value.isInternal = false;
|
|
4328
4331
|
if (superdoc2.activeEditor?.commands) {
|
|
4329
|
-
superdoc2.activeEditor.commands.insertComment({
|
|
4332
|
+
superdoc2.activeEditor.commands.insertComment({
|
|
4333
|
+
...pendingComment.value.getValues(),
|
|
4334
|
+
commentId: "pending",
|
|
4335
|
+
skipEmit: true
|
|
4336
|
+
});
|
|
4330
4337
|
}
|
|
4331
4338
|
if (pendingComment.value.selection.source === "super-editor" && superdocStore.selectionPosition) {
|
|
4332
4339
|
superdocStore.selectionPosition.source = "super-editor";
|
|
@@ -4398,7 +4405,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4398
4405
|
superdocStore.selectionPosition = null;
|
|
4399
4406
|
superdoc2.activeEditor?.commands.removeComment({ commentId: "pending" });
|
|
4400
4407
|
};
|
|
4401
|
-
const addComment = ({ superdoc: superdoc2, comment }) => {
|
|
4408
|
+
const addComment = ({ superdoc: superdoc2, comment, skipEditorUpdate = false }) => {
|
|
4402
4409
|
let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
|
|
4403
4410
|
if (!parentComment) parentComment = comment;
|
|
4404
4411
|
const newComment = useComment(comment.getValues());
|
|
@@ -4412,8 +4419,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4412
4419
|
if (!superdoc2.config.isInternal) newComment.isInternal = false;
|
|
4413
4420
|
commentsList.value.push(newComment);
|
|
4414
4421
|
removePendingComment(superdoc2);
|
|
4415
|
-
if (!comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
|
|
4416
|
-
superdoc2.activeEditor.commands.insertComment(newComment.getValues());
|
|
4422
|
+
if (!skipEditorUpdate && !comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
|
|
4423
|
+
superdoc2.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
|
|
4417
4424
|
}
|
|
4418
4425
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
4419
4426
|
syncCommentsToClients(superdoc2, event);
|
|
@@ -17414,7 +17421,7 @@ const _sfc_main = {
|
|
|
17414
17421
|
__name: "SuperDoc",
|
|
17415
17422
|
emits: ["selection-update"],
|
|
17416
17423
|
setup(__props, { emit: __emit }) {
|
|
17417
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17424
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CxsRHFKK.cjs")));
|
|
17418
17425
|
const superdocStore = useSuperdocStore();
|
|
17419
17426
|
const commentsStore = useCommentsStore();
|
|
17420
17427
|
const {
|
|
@@ -17443,10 +17450,22 @@ const _sfc_main = {
|
|
|
17443
17450
|
hasInitializedLocations,
|
|
17444
17451
|
isCommentHighlighted
|
|
17445
17452
|
} = storeToRefs(commentsStore);
|
|
17446
|
-
const {
|
|
17453
|
+
const {
|
|
17454
|
+
showAddComment,
|
|
17455
|
+
handleEditorLocationsUpdate,
|
|
17456
|
+
handleTrackedChangeUpdate,
|
|
17457
|
+
addComment,
|
|
17458
|
+
getComment,
|
|
17459
|
+
COMMENT_EVENTS
|
|
17460
|
+
} = commentsStore;
|
|
17447
17461
|
const { proxy } = vue.getCurrentInstance();
|
|
17448
17462
|
commentsStore.proxy = proxy;
|
|
17449
17463
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
17464
|
+
const commentsModuleConfig = vue.computed(() => {
|
|
17465
|
+
const config = modules.comments;
|
|
17466
|
+
if (config === false || config == null) return null;
|
|
17467
|
+
return config;
|
|
17468
|
+
});
|
|
17450
17469
|
const layers = vue.ref(null);
|
|
17451
17470
|
const commentsLayer = vue.ref(null);
|
|
17452
17471
|
const toolsMenuPosition = vue.reactive({ top: null, right: "-25px", zIndex: 101 });
|
|
@@ -17594,7 +17613,7 @@ const _sfc_main = {
|
|
|
17594
17613
|
rulers: doc.rulers,
|
|
17595
17614
|
isInternal: proxy.$superdoc.config.isInternal,
|
|
17596
17615
|
annotations: proxy.$superdoc.config.annotations,
|
|
17597
|
-
isCommentsEnabled:
|
|
17616
|
+
isCommentsEnabled: Boolean(commentsModuleConfig.value),
|
|
17598
17617
|
isAiEnabled: proxy.$superdoc.config.modules?.ai,
|
|
17599
17618
|
slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
|
|
17600
17619
|
onBeforeCreate: onEditorBeforeCreate,
|
|
@@ -17625,11 +17644,38 @@ const _sfc_main = {
|
|
|
17625
17644
|
return options;
|
|
17626
17645
|
};
|
|
17627
17646
|
const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
|
|
17628
|
-
|
|
17647
|
+
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
17648
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17629
17649
|
handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
|
|
17630
17650
|
};
|
|
17631
17651
|
const onEditorCommentsUpdate = (params2 = {}) => {
|
|
17632
|
-
|
|
17652
|
+
let { activeCommentId, type, comment: commentPayload } = params2;
|
|
17653
|
+
if (COMMENT_EVENTS?.ADD && type === COMMENT_EVENTS.ADD && commentPayload) {
|
|
17654
|
+
if (!commentPayload.commentText && commentPayload.text) {
|
|
17655
|
+
commentPayload.commentText = commentPayload.text;
|
|
17656
|
+
}
|
|
17657
|
+
const currentUser = proxy.$superdoc?.user;
|
|
17658
|
+
if (currentUser) {
|
|
17659
|
+
if (!commentPayload.creatorName) commentPayload.creatorName = currentUser.name;
|
|
17660
|
+
if (!commentPayload.creatorEmail) commentPayload.creatorEmail = currentUser.email;
|
|
17661
|
+
}
|
|
17662
|
+
if (!commentPayload.createdTime) commentPayload.createdTime = Date.now();
|
|
17663
|
+
const primaryDocumentId = commentPayload.documentId || documents.value?.[0]?.id;
|
|
17664
|
+
if (!commentPayload.documentId && primaryDocumentId) {
|
|
17665
|
+
commentPayload.documentId = primaryDocumentId;
|
|
17666
|
+
}
|
|
17667
|
+
if (!commentPayload.fileId && primaryDocumentId) {
|
|
17668
|
+
commentPayload.fileId = primaryDocumentId;
|
|
17669
|
+
}
|
|
17670
|
+
const id = commentPayload.commentId || commentPayload.importedId;
|
|
17671
|
+
if (id && !getComment(id)) {
|
|
17672
|
+
const commentModel = useComment(commentPayload);
|
|
17673
|
+
addComment({ superdoc: proxy.$superdoc, comment: commentModel, skipEditorUpdate: true });
|
|
17674
|
+
}
|
|
17675
|
+
if (!activeCommentId && id) {
|
|
17676
|
+
activeCommentId = id;
|
|
17677
|
+
}
|
|
17678
|
+
}
|
|
17633
17679
|
if (type === "trackedChange") {
|
|
17634
17680
|
handleTrackedChangeUpdate({ superdoc: proxy.$superdoc, params: params2 });
|
|
17635
17681
|
}
|
|
@@ -17647,7 +17693,7 @@ const _sfc_main = {
|
|
|
17647
17693
|
proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
|
|
17648
17694
|
}
|
|
17649
17695
|
};
|
|
17650
|
-
const isCommentsEnabled = vue.computed(() =>
|
|
17696
|
+
const isCommentsEnabled = vue.computed(() => Boolean(commentsModuleConfig.value));
|
|
17651
17697
|
const showCommentsSidebar = vue.computed(() => {
|
|
17652
17698
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
17653
17699
|
});
|
|
@@ -17657,13 +17703,14 @@ const _sfc_main = {
|
|
|
17657
17703
|
});
|
|
17658
17704
|
vue.computed(() => {
|
|
17659
17705
|
if (!isCommentsEnabled.value) return false;
|
|
17660
|
-
!getConfig?.readOnly && selectionPosition.value;
|
|
17706
|
+
return !getConfig.value?.readOnly && selectionPosition.value;
|
|
17661
17707
|
});
|
|
17662
17708
|
vue.watch(showCommentsSidebar, (value) => {
|
|
17663
17709
|
proxy.$superdoc.broadcastSidebarToggle(value);
|
|
17664
17710
|
});
|
|
17665
17711
|
const scrollToComment = (commentId) => {
|
|
17666
|
-
|
|
17712
|
+
const commentsConfig = proxy.$superdoc.config?.modules?.comments;
|
|
17713
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17667
17714
|
const element = document.querySelector(`[data-thread-id=${commentId}]`);
|
|
17668
17715
|
if (element) {
|
|
17669
17716
|
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
@@ -17671,7 +17718,8 @@ const _sfc_main = {
|
|
|
17671
17718
|
}
|
|
17672
17719
|
};
|
|
17673
17720
|
vue.onMounted(() => {
|
|
17674
|
-
|
|
17721
|
+
const config = commentsModuleConfig.value;
|
|
17722
|
+
if (config && !config.readOnly) {
|
|
17675
17723
|
document.addEventListener("mousedown", handleDocumentMouseDown);
|
|
17676
17724
|
}
|
|
17677
17725
|
});
|
|
@@ -17793,6 +17841,7 @@ const _sfc_main = {
|
|
|
17793
17841
|
};
|
|
17794
17842
|
const shouldShowSelection = vue.computed(() => {
|
|
17795
17843
|
const config = proxy.$superdoc.config.modules?.comments;
|
|
17844
|
+
if (!config || config === false) return false;
|
|
17796
17845
|
return !config.readOnly;
|
|
17797
17846
|
});
|
|
17798
17847
|
const handleSuperEditorPageMarginsChange = (doc, params2) => {
|
|
@@ -17959,7 +18008,7 @@ const _sfc_main = {
|
|
|
17959
18008
|
};
|
|
17960
18009
|
}
|
|
17961
18010
|
};
|
|
17962
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
18011
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-96983cf9"]]);
|
|
17963
18012
|
const createSuperdocVueApp = () => {
|
|
17964
18013
|
const app = vue.createApp(App);
|
|
17965
18014
|
const pinia = createPinia();
|
|
@@ -18058,6 +18107,10 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18058
18107
|
...this.config,
|
|
18059
18108
|
...config
|
|
18060
18109
|
};
|
|
18110
|
+
this.config.modules = this.config.modules || {};
|
|
18111
|
+
if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
|
|
18112
|
+
this.config.modules.comments = {};
|
|
18113
|
+
}
|
|
18061
18114
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18062
18115
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18063
18116
|
this.colorIndex = 0;
|
|
@@ -18192,7 +18245,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18192
18245
|
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
18193
18246
|
}
|
|
18194
18247
|
this.superdocStore.init(this.config);
|
|
18195
|
-
this.
|
|
18248
|
+
const commentsModuleConfig = this.config.modules.comments;
|
|
18249
|
+
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
18196
18250
|
}
|
|
18197
18251
|
#initListeners() {
|
|
18198
18252
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -18542,15 +18596,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18542
18596
|
}
|
|
18543
18597
|
/**
|
|
18544
18598
|
* Export the superdoc to a file
|
|
18545
|
-
* @param {
|
|
18546
|
-
* @
|
|
18547
|
-
* @param {string} [params.commentsType]
|
|
18548
|
-
* @param {string} [params.exportedName]
|
|
18549
|
-
* @param {Array} [params.additionalFiles]
|
|
18550
|
-
* @param {Array} [params.additionalFileNames]
|
|
18551
|
-
* @param {boolean} [params.isFinalDoc]
|
|
18552
|
-
* @param {boolean} [params.triggerDownload] Whether to trigger the download of the exported file
|
|
18553
|
-
* @returns {Promise<void | Blob>} Returns void if triggerDownload is false, otherwise returns the exported file
|
|
18599
|
+
* @param {ExportParams} params - Export configuration
|
|
18600
|
+
* @returns {Promise<void | Blob>}
|
|
18554
18601
|
*/
|
|
18555
18602
|
async export({
|
|
18556
18603
|
exportType = ["docx"],
|