@harbour-enterprises/superdoc 1.0.0-beta.8 → 1.0.0
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-DJ7BWUbW.cjs → PdfViewer-C3_5zd7y.cjs} +2 -2
- package/dist/chunks/{PdfViewer-BfEwF25T.es.js → PdfViewer-OoqzzuS4.es.js} +2 -2
- package/dist/chunks/{eventemitter3-ByBH0NYV.es.js → eventemitter3-CcXAdeql.es.js} +1 -1
- package/dist/chunks/{eventemitter3-CFCpOk3d.cjs → eventemitter3-DQmQUge-.cjs} +1 -1
- package/dist/chunks/{index-BCZ82zY5.es.js → index-BwFit1xu.es.js} +112 -41
- package/dist/chunks/{index-DJrRlj1_-HA-nVwDO.es.js → index-CDIpuWy0-DcqcEnVR.es.js} +1 -1
- package/dist/chunks/{index-DJrRlj1_-E5dmStMF.cjs → index-CDIpuWy0-v1ZRfNmH.cjs} +1 -1
- package/dist/chunks/{index-DMwWcmrk.cjs → index-CVDEHD5c.cjs} +112 -41
- package/dist/chunks/{jszip-BwsONqK5.es.js → jszip-5vvIqAEE.es.js} +1 -1
- package/dist/chunks/{jszip-B99MTu59.cjs → jszip-BdEez1WM.cjs} +1 -1
- package/dist/chunks/{super-editor.es-Bo_fWMy6.cjs → super-editor.es-CWr0w1Tk.cjs} +37747 -20889
- package/dist/chunks/{super-editor.es-MRWI4sfo.es.js → super-editor.es-Ddl20DOa.es.js} +37747 -20889
- package/dist/chunks/{vue-CztqUvm1.es.js → vue-Dysv_7z5.es.js} +101 -12
- package/dist/chunks/{vue-ARQSyfaw.cjs → vue-jWLMl8Ts.cjs} +89 -0
- package/dist/chunks/xml-js-ClO_jHnq.es.js +2 -0
- package/dist/chunks/xml-js-Dz51sEbr.cjs +3 -0
- package/dist/packages/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -1
- package/dist/packages/superdoc/src/composables/use-document.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts +2 -2
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/collaboration/collaboration.d.ts +11 -0
- package/dist/packages/superdoc/src/core/collaboration/collaboration.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/types/index.d.ts +66 -3
- package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
- package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/style.css +90 -51
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CflxlFnM.js → converter-CuIVo-Y-.js} +7295 -811
- package/dist/super-editor/chunks/{docx-zipper-DKWL4mo2.js → docx-zipper-D24ieyrf.js} +15 -11
- package/dist/super-editor/chunks/{editor-B9V7oJbW.js → editor-DyocbwIp.js} +18722 -8867
- package/dist/super-editor/chunks/{index-DJrRlj1_.js → index-CDIpuWy0.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-B5WlPN4s.js → toolbar-WQTQjgeN.js} +36 -22
- 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 +2 -2
- package/dist/super-editor/style.css +57 -18
- package/dist/super-editor/super-editor.es.js +1025 -226
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +4 -4
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +37527 -20522
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-BZPSMmVo.es.js +0 -2
- package/dist/chunks/xml-js-DQa4Ye5C.cjs +0 -3
|
@@ -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-jWLMl8Ts.cjs");
|
|
4
|
+
const superdoc = require("./index-CVDEHD5c.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { y as defineComponent, z as h, O as Transition,
|
|
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 { y as defineComponent, z as h, O as Transition, a0 as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-Dysv_7z5.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-BwFit1xu.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
1
|
+
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-Ddl20DOa.es.js";
|
|
2
2
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
3
|
-
import { E as EventEmitter } from "./eventemitter3-
|
|
3
|
+
import { E as EventEmitter } from "./eventemitter3-CcXAdeql.es.js";
|
|
4
4
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
5
|
-
import {
|
|
5
|
+
import { a1 as effectScope, r as ref, X as markRaw, a0 as process$1, a2 as toRaw, a as computed, a3 as isRef, a4 as isReactive, E as toRef, i as inject, m as getCurrentInstance, l as watch, v as unref, a5 as hasInjectionContext, M as reactive, q as nextTick, a6 as getCurrentScope, a7 as onScopeDispose, a8 as toRefs, g as global$1, B as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, p as onDeactivated, D as createTextVNode, F as Fragment, Q as Comment, y as defineComponent, G as provide, I as withDirectives, z as h, U as Teleport, R as renderSlot, V as isVNode, J as watchEffect, O as Transition, a9 as TransitionGroup, A as mergeProps, P as vShow, H as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, u as createVNode, C as withCtx, f as createBaseVNode, x as normalizeStyle, e as createCommentVNode, s as createBlock, w as withModifiers, n as normalizeClass, aa as resolveDirective, d as renderList, c as createApp, Y as resolveDynamicComponent, ab as defineAsyncComponent } from "./vue-Dysv_7z5.es.js";
|
|
6
6
|
import * as Y from "yjs";
|
|
7
7
|
import { Doc, Map as Map$2 } from "yjs";
|
|
8
|
-
import { B as Buffer$2 } from "./jszip-
|
|
8
|
+
import { B as Buffer$2 } from "./jszip-5vvIqAEE.es.js";
|
|
9
9
|
import { v as v4 } from "./uuid-CjlX8hrF.es.js";
|
|
10
10
|
const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
11
11
|
const PDF = "application/pdf";
|
|
@@ -3235,6 +3235,9 @@ function awarenessHandler(context, { changes = {}, states }) {
|
|
|
3235
3235
|
context.emit("awareness-update", payload);
|
|
3236
3236
|
}
|
|
3237
3237
|
function createProvider({ config, user, documentId, socket, superdocInstance }) {
|
|
3238
|
+
console.warn(
|
|
3239
|
+
"[superdoc] Internal provider creation is deprecated. Pass { ydoc, provider } to modules.collaboration instead."
|
|
3240
|
+
);
|
|
3238
3241
|
if (!config.providerType) config.providerType = "superdoc";
|
|
3239
3242
|
const providers = {
|
|
3240
3243
|
hocuspocus: () => createHocuspocusProvider({ config, user, documentId, socket, superdocInstance }),
|
|
@@ -3291,6 +3294,22 @@ const onDisconnect = (superdocInstance, documentId) => {
|
|
|
3291
3294
|
const onDestroy = (superdocInstance, documentId) => {
|
|
3292
3295
|
console.warn("🔌 [superdoc] Destroyed", documentId);
|
|
3293
3296
|
};
|
|
3297
|
+
function setupAwarenessHandler(provider, superdocInstance, user) {
|
|
3298
|
+
const awareness = provider.awareness;
|
|
3299
|
+
if (!awareness) {
|
|
3300
|
+
console.warn("[superdoc] External provider missing awareness property");
|
|
3301
|
+
return;
|
|
3302
|
+
}
|
|
3303
|
+
if (user && awareness.setLocalStateField) {
|
|
3304
|
+
awareness.setLocalStateField("user", user);
|
|
3305
|
+
}
|
|
3306
|
+
awareness.on("change", (changes = {}) => {
|
|
3307
|
+
awarenessHandler(superdocInstance, {
|
|
3308
|
+
changes,
|
|
3309
|
+
states: awareness.getStates()
|
|
3310
|
+
});
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3294
3313
|
const addYComment = (yArray, ydoc, event) => {
|
|
3295
3314
|
const { comment } = event;
|
|
3296
3315
|
const yComment = new Map$2(Object.entries(comment));
|
|
@@ -3465,6 +3484,7 @@ function useComment(params2) {
|
|
|
3465
3484
|
const creatorImage = params2.creatorImage;
|
|
3466
3485
|
const createdTime = params2.createdTime || Date.now();
|
|
3467
3486
|
const importedAuthor = ref(params2.importedAuthor || null);
|
|
3487
|
+
const docxCommentJSON = params2.docxCommentJSON || null;
|
|
3468
3488
|
const commentText = ref(params2.commentText || "");
|
|
3469
3489
|
const selection = params2.selection ? useSelection(params2.selection) : useSelection({
|
|
3470
3490
|
documentId: fileId,
|
|
@@ -3579,6 +3599,7 @@ function useComment(params2) {
|
|
|
3579
3599
|
creatorImage,
|
|
3580
3600
|
createdTime,
|
|
3581
3601
|
importedAuthor: importedAuthor.value,
|
|
3602
|
+
docxCommentJSON,
|
|
3582
3603
|
isInternal: isInternal.value,
|
|
3583
3604
|
commentText: commentText.value,
|
|
3584
3605
|
selection: selection ? selection.getValues() : null,
|
|
@@ -3617,6 +3638,7 @@ function useComment(params2) {
|
|
|
3617
3638
|
resolvedByEmail,
|
|
3618
3639
|
resolvedByName,
|
|
3619
3640
|
importedAuthor,
|
|
3641
|
+
docxCommentJSON,
|
|
3620
3642
|
// Actions
|
|
3621
3643
|
setText,
|
|
3622
3644
|
getValues,
|
|
@@ -3652,8 +3674,8 @@ function useDocument(params2, superdocConfig) {
|
|
|
3652
3674
|
const getPresentationEditor = () => presentationEditorRef.value;
|
|
3653
3675
|
function initDocumentType({ type: type2, data: data2 }) {
|
|
3654
3676
|
if (data2?.type) return data2.type;
|
|
3655
|
-
if (type2) return
|
|
3656
|
-
throw new Error("Document type not specified
|
|
3677
|
+
if (type2) return documentTypes[type2] || type2;
|
|
3678
|
+
throw new Error("Document type not specified");
|
|
3657
3679
|
}
|
|
3658
3680
|
const removeComments = () => {
|
|
3659
3681
|
conversationsBackup.value = conversations.value;
|
|
@@ -4198,6 +4220,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4198
4220
|
const newComment = useComment({
|
|
4199
4221
|
fileId: documentId,
|
|
4200
4222
|
fileType: document2.type,
|
|
4223
|
+
docxCommentJSON: comment.textJson,
|
|
4201
4224
|
commentId: comment.commentId,
|
|
4202
4225
|
isInternal: false,
|
|
4203
4226
|
parentCommentId: comment.parentCommentId,
|
|
@@ -4258,7 +4281,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4258
4281
|
commentsList.value.forEach((comment) => {
|
|
4259
4282
|
const values = comment.getValues();
|
|
4260
4283
|
const richText = values.commentText;
|
|
4261
|
-
const schema = convertHtmlToSchema(richText);
|
|
4284
|
+
const schema = values.docxCommentJSON || convertHtmlToSchema(richText);
|
|
4262
4285
|
processedComments.push({
|
|
4263
4286
|
...values,
|
|
4264
4287
|
commentJSON: schema
|
|
@@ -16445,26 +16468,14 @@ const _sfc_main$9 = {
|
|
|
16445
16468
|
const firstGroupRendered = ref(false);
|
|
16446
16469
|
const verticalOffset = ref(0);
|
|
16447
16470
|
const commentsRenderKey = ref(0);
|
|
16471
|
+
const measurementTimeoutId = ref(null);
|
|
16448
16472
|
const getCommentPosition = computed(() => (comment) => {
|
|
16449
16473
|
if (!floatingCommentsContainer.value) return { top: "0px" };
|
|
16450
|
-
floatingCommentsContainer.value.getBoundingClientRect();
|
|
16451
16474
|
if (typeof comment.top !== "number" || isNaN(comment.top)) {
|
|
16452
16475
|
return { display: "none" };
|
|
16453
16476
|
}
|
|
16454
16477
|
return { top: `${comment.top}px` };
|
|
16455
16478
|
});
|
|
16456
|
-
const findScrollParent = (element) => {
|
|
16457
|
-
if (!element) return window;
|
|
16458
|
-
let parent = element.parentNode;
|
|
16459
|
-
while (parent && parent !== document) {
|
|
16460
|
-
const style2 = getComputedStyle(parent);
|
|
16461
|
-
if (/(auto|scroll|overlay)/.test(style2.overflow + style2.overflowY + style2.overflowX)) {
|
|
16462
|
-
return parent;
|
|
16463
|
-
}
|
|
16464
|
-
parent = parent.parentNode;
|
|
16465
|
-
}
|
|
16466
|
-
return window;
|
|
16467
|
-
};
|
|
16468
16479
|
const handleDialog = (dialog) => {
|
|
16469
16480
|
if (!dialog) return;
|
|
16470
16481
|
const { elementRef, commentId } = dialog;
|
|
@@ -16472,44 +16483,68 @@ const _sfc_main$9 = {
|
|
|
16472
16483
|
nextTick(() => {
|
|
16473
16484
|
const id = commentId;
|
|
16474
16485
|
if (renderedSizes.value.some((item) => item.id == id)) return;
|
|
16475
|
-
const editorBounds = props.parent.getBoundingClientRect();
|
|
16476
16486
|
const comment = getFloatingComments.value.find((c2) => c2.commentId === id || c2.importedId == id);
|
|
16477
16487
|
const positionKey = id || comment?.importedId;
|
|
16478
|
-
|
|
16488
|
+
const positionEntry = editorCommentPositions.value[positionKey];
|
|
16489
|
+
const position = positionEntry?.bounds || {};
|
|
16479
16490
|
if (props.currentDocument.type === "application/pdf") {
|
|
16480
16491
|
Object.entries(comment.selection?.selectionBounds).forEach(([key, value]) => {
|
|
16481
16492
|
position[key] = Number(value);
|
|
16482
16493
|
});
|
|
16483
|
-
position.top += editorBounds.top;
|
|
16484
16494
|
}
|
|
16485
16495
|
if (!position) return;
|
|
16486
|
-
const scrollParent = findScrollParent(props.parent);
|
|
16487
|
-
scrollParent === window ? window.scrollY : scrollParent.scrollTop;
|
|
16488
16496
|
const bounds = elementRef.value?.getBoundingClientRect();
|
|
16497
|
+
const top = Number(position.top);
|
|
16498
|
+
if (!Number.isFinite(top)) return;
|
|
16489
16499
|
const placement = {
|
|
16490
16500
|
id,
|
|
16491
|
-
top
|
|
16501
|
+
top,
|
|
16492
16502
|
height: bounds.height,
|
|
16493
16503
|
commentRef: comment,
|
|
16494
|
-
elementRef
|
|
16504
|
+
elementRef,
|
|
16505
|
+
pageIndex: positionEntry?.pageIndex ?? 0
|
|
16495
16506
|
};
|
|
16496
16507
|
renderedSizes.value.push(placement);
|
|
16497
16508
|
});
|
|
16498
16509
|
};
|
|
16499
16510
|
const processLocations = async () => {
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
if (
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16511
|
+
const groupedByPage = renderedSizes.value.reduce((acc, comment) => {
|
|
16512
|
+
const key = comment.pageIndex ?? 0;
|
|
16513
|
+
if (!acc[key]) acc[key] = [];
|
|
16514
|
+
acc[key].push(comment);
|
|
16515
|
+
return acc;
|
|
16516
|
+
}, {});
|
|
16517
|
+
Object.values(groupedByPage).forEach((comments) => {
|
|
16518
|
+
comments.sort((a, b) => a.top - b.top).forEach((comment, idx, arr) => {
|
|
16519
|
+
if (idx === 0) return;
|
|
16520
|
+
const prev = arr[idx - 1];
|
|
16521
|
+
const minTop = prev.top + prev.height + 15;
|
|
16522
|
+
if (comment.top < minTop) {
|
|
16523
|
+
comment.top = minTop;
|
|
16524
|
+
}
|
|
16525
|
+
});
|
|
16506
16526
|
});
|
|
16507
16527
|
await nextTick();
|
|
16508
16528
|
firstGroupRendered.value = true;
|
|
16509
16529
|
};
|
|
16510
16530
|
watchEffect(() => {
|
|
16511
|
-
if (
|
|
16531
|
+
if (measurementTimeoutId.value) {
|
|
16532
|
+
clearTimeout(measurementTimeoutId.value);
|
|
16533
|
+
measurementTimeoutId.value = null;
|
|
16534
|
+
}
|
|
16535
|
+
const totalComments = getFloatingComments.value.length;
|
|
16536
|
+
const measuredComments = renderedSizes.value.length;
|
|
16537
|
+
if (totalComments === 0) {
|
|
16538
|
+
return;
|
|
16539
|
+
}
|
|
16540
|
+
if (measuredComments === totalComments) {
|
|
16512
16541
|
nextTick(processLocations);
|
|
16542
|
+
} else if (measuredComments > 0 && !firstGroupRendered.value) {
|
|
16543
|
+
measurementTimeoutId.value = setTimeout(() => {
|
|
16544
|
+
if (!firstGroupRendered.value && renderedSizes.value.length > 0) {
|
|
16545
|
+
processLocations();
|
|
16546
|
+
}
|
|
16547
|
+
}, 100);
|
|
16513
16548
|
}
|
|
16514
16549
|
});
|
|
16515
16550
|
watch(activeComment, (newVal, oldVal) => {
|
|
@@ -16532,6 +16567,12 @@ const _sfc_main$9 = {
|
|
|
16532
16567
|
}, 200);
|
|
16533
16568
|
});
|
|
16534
16569
|
});
|
|
16570
|
+
onBeforeUnmount(() => {
|
|
16571
|
+
if (measurementTimeoutId.value) {
|
|
16572
|
+
clearTimeout(measurementTimeoutId.value);
|
|
16573
|
+
measurementTimeoutId.value = null;
|
|
16574
|
+
}
|
|
16575
|
+
});
|
|
16535
16576
|
return (_ctx, _cache) => {
|
|
16536
16577
|
return openBlock(), createElementBlock("div", {
|
|
16537
16578
|
class: "section-wrapper",
|
|
@@ -16582,7 +16623,7 @@ const _sfc_main$9 = {
|
|
|
16582
16623
|
};
|
|
16583
16624
|
}
|
|
16584
16625
|
};
|
|
16585
|
-
const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-
|
|
16626
|
+
const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-eab6fbfa"]]);
|
|
16586
16627
|
const _sfc_main$8 = {
|
|
16587
16628
|
__name: "TextField",
|
|
16588
16629
|
props: {
|
|
@@ -17210,7 +17251,7 @@ const _sfc_main = {
|
|
|
17210
17251
|
__name: "SuperDoc",
|
|
17211
17252
|
emits: ["selection-update"],
|
|
17212
17253
|
setup(__props, { emit: __emit }) {
|
|
17213
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17254
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-OoqzzuS4.es.js"));
|
|
17214
17255
|
const superdocStore = useSuperdocStore();
|
|
17215
17256
|
const commentsStore = useCommentsStore();
|
|
17216
17257
|
const {
|
|
@@ -17337,6 +17378,13 @@ const _sfc_main = {
|
|
|
17337
17378
|
presentationEditor.onTelemetry((telemetryPayload) => {
|
|
17338
17379
|
proxy.$superdoc.captureLayoutPipelineEvent(telemetryPayload);
|
|
17339
17380
|
});
|
|
17381
|
+
presentationEditor.on("commentPositions", ({ positions }) => {
|
|
17382
|
+
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
17383
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
17384
|
+
if (!positions || Object.keys(positions).length === 0) return;
|
|
17385
|
+
const mappedPositions = presentationEditor.getCommentBounds(positions, layers.value);
|
|
17386
|
+
handleEditorLocationsUpdate(mappedPositions);
|
|
17387
|
+
});
|
|
17340
17388
|
};
|
|
17341
17389
|
const onEditorDestroy = () => {
|
|
17342
17390
|
proxy.$superdoc.broadcastEditorDestroy();
|
|
@@ -17883,7 +17931,7 @@ const _sfc_main = {
|
|
|
17883
17931
|
};
|
|
17884
17932
|
}
|
|
17885
17933
|
};
|
|
17886
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
17934
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3c3356b6"]]);
|
|
17887
17935
|
const createSuperdocVueApp = () => {
|
|
17888
17936
|
const app = createApp(App);
|
|
17889
17937
|
const pinia = createPinia();
|
|
@@ -18063,7 +18111,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18063
18111
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18064
18112
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18065
18113
|
this.colorIndex = 0;
|
|
18066
|
-
this.version = "1.0.0
|
|
18114
|
+
this.version = "1.0.0";
|
|
18067
18115
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18068
18116
|
this.superdocId = config.superdocId || v4();
|
|
18069
18117
|
this.colors = this.config.colors;
|
|
@@ -18224,6 +18272,28 @@ class SuperDoc extends EventEmitter {
|
|
|
18224
18272
|
async #initCollaboration({ collaboration: collaborationModuleConfig, comments: commentsConfig = {} } = {}) {
|
|
18225
18273
|
if (!collaborationModuleConfig) return this.config.documents;
|
|
18226
18274
|
this.isCollaborative = true;
|
|
18275
|
+
const { ydoc: externalYdoc, provider: externalProvider } = collaborationModuleConfig;
|
|
18276
|
+
if (externalYdoc && externalProvider) {
|
|
18277
|
+
this.ydoc = externalYdoc;
|
|
18278
|
+
this.provider = externalProvider;
|
|
18279
|
+
setupAwarenessHandler(externalProvider, this, this.config.user);
|
|
18280
|
+
if (!this.config.documents || this.config.documents.length === 0) {
|
|
18281
|
+
this.config.documents = [
|
|
18282
|
+
{
|
|
18283
|
+
id: v4(),
|
|
18284
|
+
type: DOCX,
|
|
18285
|
+
name: "document.docx"
|
|
18286
|
+
}
|
|
18287
|
+
];
|
|
18288
|
+
}
|
|
18289
|
+
this.config.documents.forEach((doc) => {
|
|
18290
|
+
doc.ydoc = externalYdoc;
|
|
18291
|
+
doc.provider = externalProvider;
|
|
18292
|
+
doc.role = this.config.role;
|
|
18293
|
+
});
|
|
18294
|
+
initCollaborationComments(this);
|
|
18295
|
+
return this.config.documents;
|
|
18296
|
+
}
|
|
18227
18297
|
if (collaborationModuleConfig.providerType === "hocuspocus") {
|
|
18228
18298
|
this.config.socket = new HocuspocusProviderWebsocket({
|
|
18229
18299
|
url: collaborationModuleConfig.url
|
|
@@ -18411,7 +18481,6 @@ class SuperDoc extends EventEmitter {
|
|
|
18411
18481
|
*/
|
|
18412
18482
|
addCommentsList(element) {
|
|
18413
18483
|
if (!this.config?.modules?.comments || this.config.role === "viewer") return;
|
|
18414
|
-
this.#log("🦋 [superdoc] Adding comments list to:", element);
|
|
18415
18484
|
if (element) this.config.modules.comments.element = element;
|
|
18416
18485
|
this.commentsList = new SuperComments(this.config.modules?.comments, this);
|
|
18417
18486
|
if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true });
|
|
@@ -18474,7 +18543,9 @@ class SuperDoc extends EventEmitter {
|
|
|
18474
18543
|
editing: () => this.#setModeEditing(),
|
|
18475
18544
|
suggesting: () => this.#setModeSuggesting()
|
|
18476
18545
|
};
|
|
18477
|
-
if (types[type])
|
|
18546
|
+
if (types[type]) {
|
|
18547
|
+
types[type]();
|
|
18548
|
+
}
|
|
18478
18549
|
}
|
|
18479
18550
|
/**
|
|
18480
18551
|
* Set the document mode on a document's editor (PresentationEditor or Editor).
|
|
@@ -18546,7 +18617,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18546
18617
|
}
|
|
18547
18618
|
#setModeViewing() {
|
|
18548
18619
|
this.toolbar.activeEditor = null;
|
|
18549
|
-
this.setTrackedChangesPreferences({ mode: "
|
|
18620
|
+
this.setTrackedChangesPreferences({ mode: "original", enabled: false });
|
|
18550
18621
|
this.superdocStore.documents.forEach((doc) => {
|
|
18551
18622
|
doc.removeComments();
|
|
18552
18623
|
this.#applyDocumentMode(doc, "viewing");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
+
const superEditor_es = require("./super-editor.es-CWr0w1Tk.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|