@harbour-enterprises/superdoc 0.22.1 → 0.23.0-next.10
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-D2BPnEBG.cjs → PdfViewer-BsnSIYxD.cjs} +2 -2
- package/dist/chunks/{PdfViewer-CBmOiHsj.es.js → PdfViewer-CPZ7QD5u.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-BSDcfSFc.es.js → index-Cd9h9gMj.es.js} +32 -22
- package/dist/chunks/{index-B0CI50e4.cjs → index-DOd9uvCv.cjs} +32 -22
- 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-DOOwW-Iv.cjs → super-editor.es-DAS3_Nt9.cjs} +1786 -1085
- package/dist/chunks/{super-editor.es-BW1T3N2-.es.js → super-editor.es-l3dTZlZX.es.js} +1786 -1085
- 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/superdoc-store.d.ts.map +1 -1
- package/dist/style.css +76 -54
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-UuZxU-p8.js → converter-ClnqoStR.js} +1476 -1043
- package/dist/super-editor/chunks/{docx-zipper-Bss48sB0.js → docx-zipper-DC28ucAi.js} +1 -1
- package/dist/super-editor/chunks/{editor--v3HbUU0.js → editor-B2aHhS9B.js} +310 -42
- package/dist/super-editor/chunks/{toolbar-BeXlvdV8.js → toolbar-Cgyf_4bW.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/core/super-converter/exporter.d.ts +4 -4
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/hyperlink-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/num-pages-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-ref-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/toc-preprocessor.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/field-references/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/field-references/preProcessNodesForFldChar.d.ts +21 -0
- package/dist/super-editor/src/core/super-converter/v2/exporter/helpers/translateChildNodes.d.ts +3 -3
- package/dist/super-editor/src/core/super-converter/v2/importer/pageReferenceImporter.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/tableOfContentsImporter.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +7 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/pageReference-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/tableOfContents-translator.d.ts +10 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +0 -2
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +9 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-part-obj.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -2
- 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/page-reference/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/page-reference/page-reference.d.ts +2 -0
- package/dist/super-editor/src/extensions/structured-content/document-part-object.d.ts +2 -0
- package/dist/super-editor/src/extensions/structured-content/index.d.ts +1 -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/src/extensions/tab/helpers/tabDecorations.d.ts +2 -2
- package/dist/super-editor/src/extensions/table-of-contents/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +2 -0
- package/dist/super-editor/style.css +49 -27
- package/dist/super-editor/super-editor.es.js +10 -8
- 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 +1846 -1135
- 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-DOd9uvCv.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-Cd9h9gMj.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-l3dTZlZX.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 = {
|
|
@@ -17397,7 +17400,7 @@ const _sfc_main = {
|
|
|
17397
17400
|
__name: "SuperDoc",
|
|
17398
17401
|
emits: ["selection-update"],
|
|
17399
17402
|
setup(__props, { emit: __emit }) {
|
|
17400
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17403
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CPZ7QD5u.es.js"));
|
|
17401
17404
|
const superdocStore = useSuperdocStore();
|
|
17402
17405
|
const commentsStore = useCommentsStore();
|
|
17403
17406
|
const {
|
|
@@ -17430,6 +17433,11 @@ const _sfc_main = {
|
|
|
17430
17433
|
const { proxy } = getCurrentInstance();
|
|
17431
17434
|
commentsStore.proxy = proxy;
|
|
17432
17435
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
17436
|
+
const commentsModuleConfig = computed(() => {
|
|
17437
|
+
const config = modules.comments;
|
|
17438
|
+
if (config === false || config == null) return null;
|
|
17439
|
+
return config;
|
|
17440
|
+
});
|
|
17433
17441
|
const layers = ref(null);
|
|
17434
17442
|
const commentsLayer = ref(null);
|
|
17435
17443
|
const toolsMenuPosition = reactive({ top: null, right: "-25px", zIndex: 101 });
|
|
@@ -17577,7 +17585,7 @@ const _sfc_main = {
|
|
|
17577
17585
|
rulers: doc.rulers,
|
|
17578
17586
|
isInternal: proxy.$superdoc.config.isInternal,
|
|
17579
17587
|
annotations: proxy.$superdoc.config.annotations,
|
|
17580
|
-
isCommentsEnabled:
|
|
17588
|
+
isCommentsEnabled: Boolean(commentsModuleConfig.value),
|
|
17581
17589
|
isAiEnabled: proxy.$superdoc.config.modules?.ai,
|
|
17582
17590
|
slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
|
|
17583
17591
|
onBeforeCreate: onEditorBeforeCreate,
|
|
@@ -17608,7 +17616,8 @@ const _sfc_main = {
|
|
|
17608
17616
|
return options;
|
|
17609
17617
|
};
|
|
17610
17618
|
const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
|
|
17611
|
-
|
|
17619
|
+
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
17620
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17612
17621
|
handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
|
|
17613
17622
|
};
|
|
17614
17623
|
const onEditorCommentsUpdate = (params2 = {}) => {
|
|
@@ -17630,7 +17639,7 @@ const _sfc_main = {
|
|
|
17630
17639
|
proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
|
|
17631
17640
|
}
|
|
17632
17641
|
};
|
|
17633
|
-
const isCommentsEnabled = computed(() =>
|
|
17642
|
+
const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
|
|
17634
17643
|
const showCommentsSidebar = computed(() => {
|
|
17635
17644
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
17636
17645
|
});
|
|
@@ -17640,13 +17649,14 @@ const _sfc_main = {
|
|
|
17640
17649
|
});
|
|
17641
17650
|
computed(() => {
|
|
17642
17651
|
if (!isCommentsEnabled.value) return false;
|
|
17643
|
-
!getConfig?.readOnly && selectionPosition.value;
|
|
17652
|
+
return !getConfig.value?.readOnly && selectionPosition.value;
|
|
17644
17653
|
});
|
|
17645
17654
|
watch(showCommentsSidebar, (value) => {
|
|
17646
17655
|
proxy.$superdoc.broadcastSidebarToggle(value);
|
|
17647
17656
|
});
|
|
17648
17657
|
const scrollToComment = (commentId) => {
|
|
17649
|
-
|
|
17658
|
+
const commentsConfig = proxy.$superdoc.config?.modules?.comments;
|
|
17659
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17650
17660
|
const element = document.querySelector(`[data-thread-id=${commentId}]`);
|
|
17651
17661
|
if (element) {
|
|
17652
17662
|
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
@@ -17654,7 +17664,8 @@ const _sfc_main = {
|
|
|
17654
17664
|
}
|
|
17655
17665
|
};
|
|
17656
17666
|
onMounted(() => {
|
|
17657
|
-
|
|
17667
|
+
const config = commentsModuleConfig.value;
|
|
17668
|
+
if (config && !config.readOnly) {
|
|
17658
17669
|
document.addEventListener("mousedown", handleDocumentMouseDown);
|
|
17659
17670
|
}
|
|
17660
17671
|
});
|
|
@@ -17776,6 +17787,7 @@ const _sfc_main = {
|
|
|
17776
17787
|
};
|
|
17777
17788
|
const shouldShowSelection = computed(() => {
|
|
17778
17789
|
const config = proxy.$superdoc.config.modules?.comments;
|
|
17790
|
+
if (!config || config === false) return false;
|
|
17779
17791
|
return !config.readOnly;
|
|
17780
17792
|
});
|
|
17781
17793
|
const handleSuperEditorPageMarginsChange = (doc, params2) => {
|
|
@@ -17942,7 +17954,7 @@ const _sfc_main = {
|
|
|
17942
17954
|
};
|
|
17943
17955
|
}
|
|
17944
17956
|
};
|
|
17945
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
17957
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-45f44b6e"]]);
|
|
17946
17958
|
const createSuperdocVueApp = () => {
|
|
17947
17959
|
const app = createApp(App);
|
|
17948
17960
|
const pinia = createPinia();
|
|
@@ -18041,6 +18053,10 @@ class SuperDoc extends EventEmitter {
|
|
|
18041
18053
|
...this.config,
|
|
18042
18054
|
...config
|
|
18043
18055
|
};
|
|
18056
|
+
this.config.modules = this.config.modules || {};
|
|
18057
|
+
if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
|
|
18058
|
+
this.config.modules.comments = {};
|
|
18059
|
+
}
|
|
18044
18060
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18045
18061
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18046
18062
|
this.colorIndex = 0;
|
|
@@ -18175,7 +18191,8 @@ class SuperDoc extends EventEmitter {
|
|
|
18175
18191
|
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
18176
18192
|
}
|
|
18177
18193
|
this.superdocStore.init(this.config);
|
|
18178
|
-
this.
|
|
18194
|
+
const commentsModuleConfig = this.config.modules.comments;
|
|
18195
|
+
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
18179
18196
|
}
|
|
18180
18197
|
#initListeners() {
|
|
18181
18198
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -18525,15 +18542,8 @@ class SuperDoc extends EventEmitter {
|
|
|
18525
18542
|
}
|
|
18526
18543
|
/**
|
|
18527
18544
|
* 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
|
|
18545
|
+
* @param {ExportParams} params - Export configuration
|
|
18546
|
+
* @returns {Promise<void | Blob>}
|
|
18537
18547
|
*/
|
|
18538
18548
|
async export({
|
|
18539
18549
|
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-DAS3_Nt9.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 = {
|
|
@@ -17414,7 +17417,7 @@ const _sfc_main = {
|
|
|
17414
17417
|
__name: "SuperDoc",
|
|
17415
17418
|
emits: ["selection-update"],
|
|
17416
17419
|
setup(__props, { emit: __emit }) {
|
|
17417
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17420
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BsnSIYxD.cjs")));
|
|
17418
17421
|
const superdocStore = useSuperdocStore();
|
|
17419
17422
|
const commentsStore = useCommentsStore();
|
|
17420
17423
|
const {
|
|
@@ -17447,6 +17450,11 @@ const _sfc_main = {
|
|
|
17447
17450
|
const { proxy } = vue.getCurrentInstance();
|
|
17448
17451
|
commentsStore.proxy = proxy;
|
|
17449
17452
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
17453
|
+
const commentsModuleConfig = vue.computed(() => {
|
|
17454
|
+
const config = modules.comments;
|
|
17455
|
+
if (config === false || config == null) return null;
|
|
17456
|
+
return config;
|
|
17457
|
+
});
|
|
17450
17458
|
const layers = vue.ref(null);
|
|
17451
17459
|
const commentsLayer = vue.ref(null);
|
|
17452
17460
|
const toolsMenuPosition = vue.reactive({ top: null, right: "-25px", zIndex: 101 });
|
|
@@ -17594,7 +17602,7 @@ const _sfc_main = {
|
|
|
17594
17602
|
rulers: doc.rulers,
|
|
17595
17603
|
isInternal: proxy.$superdoc.config.isInternal,
|
|
17596
17604
|
annotations: proxy.$superdoc.config.annotations,
|
|
17597
|
-
isCommentsEnabled:
|
|
17605
|
+
isCommentsEnabled: Boolean(commentsModuleConfig.value),
|
|
17598
17606
|
isAiEnabled: proxy.$superdoc.config.modules?.ai,
|
|
17599
17607
|
slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
|
|
17600
17608
|
onBeforeCreate: onEditorBeforeCreate,
|
|
@@ -17625,7 +17633,8 @@ const _sfc_main = {
|
|
|
17625
17633
|
return options;
|
|
17626
17634
|
};
|
|
17627
17635
|
const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
|
|
17628
|
-
|
|
17636
|
+
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
17637
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17629
17638
|
handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
|
|
17630
17639
|
};
|
|
17631
17640
|
const onEditorCommentsUpdate = (params2 = {}) => {
|
|
@@ -17647,7 +17656,7 @@ const _sfc_main = {
|
|
|
17647
17656
|
proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
|
|
17648
17657
|
}
|
|
17649
17658
|
};
|
|
17650
|
-
const isCommentsEnabled = vue.computed(() =>
|
|
17659
|
+
const isCommentsEnabled = vue.computed(() => Boolean(commentsModuleConfig.value));
|
|
17651
17660
|
const showCommentsSidebar = vue.computed(() => {
|
|
17652
17661
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
17653
17662
|
});
|
|
@@ -17657,13 +17666,14 @@ const _sfc_main = {
|
|
|
17657
17666
|
});
|
|
17658
17667
|
vue.computed(() => {
|
|
17659
17668
|
if (!isCommentsEnabled.value) return false;
|
|
17660
|
-
!getConfig?.readOnly && selectionPosition.value;
|
|
17669
|
+
return !getConfig.value?.readOnly && selectionPosition.value;
|
|
17661
17670
|
});
|
|
17662
17671
|
vue.watch(showCommentsSidebar, (value) => {
|
|
17663
17672
|
proxy.$superdoc.broadcastSidebarToggle(value);
|
|
17664
17673
|
});
|
|
17665
17674
|
const scrollToComment = (commentId) => {
|
|
17666
|
-
|
|
17675
|
+
const commentsConfig = proxy.$superdoc.config?.modules?.comments;
|
|
17676
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17667
17677
|
const element = document.querySelector(`[data-thread-id=${commentId}]`);
|
|
17668
17678
|
if (element) {
|
|
17669
17679
|
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
@@ -17671,7 +17681,8 @@ const _sfc_main = {
|
|
|
17671
17681
|
}
|
|
17672
17682
|
};
|
|
17673
17683
|
vue.onMounted(() => {
|
|
17674
|
-
|
|
17684
|
+
const config = commentsModuleConfig.value;
|
|
17685
|
+
if (config && !config.readOnly) {
|
|
17675
17686
|
document.addEventListener("mousedown", handleDocumentMouseDown);
|
|
17676
17687
|
}
|
|
17677
17688
|
});
|
|
@@ -17793,6 +17804,7 @@ const _sfc_main = {
|
|
|
17793
17804
|
};
|
|
17794
17805
|
const shouldShowSelection = vue.computed(() => {
|
|
17795
17806
|
const config = proxy.$superdoc.config.modules?.comments;
|
|
17807
|
+
if (!config || config === false) return false;
|
|
17796
17808
|
return !config.readOnly;
|
|
17797
17809
|
});
|
|
17798
17810
|
const handleSuperEditorPageMarginsChange = (doc, params2) => {
|
|
@@ -17959,7 +17971,7 @@ const _sfc_main = {
|
|
|
17959
17971
|
};
|
|
17960
17972
|
}
|
|
17961
17973
|
};
|
|
17962
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
17974
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-45f44b6e"]]);
|
|
17963
17975
|
const createSuperdocVueApp = () => {
|
|
17964
17976
|
const app = vue.createApp(App);
|
|
17965
17977
|
const pinia = createPinia();
|
|
@@ -18058,6 +18070,10 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18058
18070
|
...this.config,
|
|
18059
18071
|
...config
|
|
18060
18072
|
};
|
|
18073
|
+
this.config.modules = this.config.modules || {};
|
|
18074
|
+
if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
|
|
18075
|
+
this.config.modules.comments = {};
|
|
18076
|
+
}
|
|
18061
18077
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18062
18078
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18063
18079
|
this.colorIndex = 0;
|
|
@@ -18192,7 +18208,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18192
18208
|
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
18193
18209
|
}
|
|
18194
18210
|
this.superdocStore.init(this.config);
|
|
18195
|
-
this.
|
|
18211
|
+
const commentsModuleConfig = this.config.modules.comments;
|
|
18212
|
+
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
18196
18213
|
}
|
|
18197
18214
|
#initListeners() {
|
|
18198
18215
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -18542,15 +18559,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18542
18559
|
}
|
|
18543
18560
|
/**
|
|
18544
18561
|
* 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
|
|
18562
|
+
* @param {ExportParams} params - Export configuration
|
|
18563
|
+
* @returns {Promise<void | Blob>}
|
|
18554
18564
|
*/
|
|
18555
18565
|
async export({
|
|
18556
18566
|
exportType = ["docx"],
|