@harbour-enterprises/superdoc 0.21.0 → 0.22.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-D3zo7tPo.es.js → PdfViewer-CJdQmuIm.es.js} +1 -1
- package/dist/chunks/{PdfViewer-OZDJ7gwT.cjs → PdfViewer-DE1NR4Ve.cjs} +1 -1
- package/dist/chunks/{index-MzW5BVNd.es.js → index-B9sHxXr_.es.js} +55 -27
- package/dist/chunks/{index-CfYf4T_z.cjs → index-nfoifSpX.cjs} +55 -27
- package/dist/chunks/{super-editor.es-U-GVCd_F.cjs → super-editor.es-DAP-fnHo.cjs} +3469 -2438
- package/dist/chunks/{super-editor.es-Bntob7Wd.es.js → super-editor.es-_iVPQ8J8.es.js} +3469 -2438
- package/dist/core/SuperDoc.d.ts +5 -0
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +12 -4
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/stores/comments-store.d.ts +4 -1
- package/dist/stores/comments-store.d.ts.map +1 -1
- package/dist/style.css +53 -44
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-3xnF_NHq.js → converter-DK1NMJZB.js} +1148 -748
- package/dist/super-editor/chunks/{docx-zipper-CZdELYi-.js → docx-zipper-CmK8TyNb.js} +73 -12
- package/dist/super-editor/chunks/{editor-BqYH4kDD.js → editor-YR4uV-dp.js} +1917 -1606
- package/dist/super-editor/chunks/{toolbar-TkaE2kKM.js → toolbar-DzJyRvb0.js} +2 -2
- 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/components/slash-menu/menuItems.d.ts +5 -1
- package/dist/super-editor/src/components/slash-menu/tests/testHelpers.d.ts +466 -0
- package/dist/super-editor/src/components/slash-menu/utils.d.ts +9 -2
- package/dist/super-editor/src/core/DocxZipper.d.ts +1 -1
- package/dist/super-editor/src/core/commands/__tests__/schemaWithLists.d.ts +2 -0
- package/dist/super-editor/src/core/commands/__tests__/testHelpers.d.ts +4 -0
- package/dist/super-editor/src/core/commands/__tests__/testSchema.d.ts +2 -0
- package/dist/super-editor/src/core/commands/tests/commandTestUtils.d.ts +7 -0
- package/dist/super-editor/src/core/commands/tests/test-schema.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +1 -13
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/helpers/tableFallbackHelpers.d.ts +24 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +5 -0
- package/dist/super-editor/src/extensions/index.d.ts +2 -1
- package/dist/super-editor/src/extensions/structured-content/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +67 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentBlockTags.d.ts +7 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentInlineTags.d.ts +7 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTags.d.ts +7 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsById.d.ts +8 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +4 -0
- package/dist/super-editor/src/tests/helpers/helpers.d.ts +1 -0
- package/dist/super-editor/src/utils/contextmenu-helpers.d.ts +24 -0
- package/dist/super-editor/style.css +9 -0
- package/dist/super-editor/super-editor.es.js +454 -154
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +3528 -2469
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/super-editor/src/extensions/run-item/index.d.ts +0 -1
- package/dist/super-editor/src/extensions/run-item/run-item.d.ts +0 -26
|
@@ -1,5 +1,5 @@
|
|
|
1
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-CXxsqYcP.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-
|
|
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-B9sHxXr_.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-DWle4Cai.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-nfoifSpX.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-_iVPQ8J8.es.js";
|
|
2
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-CXxsqYcP.es.js";
|
|
3
3
|
import { B as Buffer$2 } from "./jszip-B8KIZSNe.es.js";
|
|
4
4
|
import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
|
|
@@ -4161,7 +4161,7 @@ const groupChanges = (changes) => {
|
|
|
4161
4161
|
const c1 = changes[i];
|
|
4162
4162
|
const c2 = changes[i + 1];
|
|
4163
4163
|
const c1Key = markMetaKeys[c1.mark.type.name];
|
|
4164
|
-
if (c1 && c2 && c1.to === c2.from) {
|
|
4164
|
+
if (c1 && c2 && c1.to === c2.from && c1.mark.attrs.id === c2.mark.attrs.id) {
|
|
4165
4165
|
const c2Key = markMetaKeys[c2.mark.type.name];
|
|
4166
4166
|
grouped.push({
|
|
4167
4167
|
from: c1.from,
|
|
@@ -4206,6 +4206,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4206
4206
|
const isCommentsListVisible = ref(false);
|
|
4207
4207
|
const editorCommentIds = ref([]);
|
|
4208
4208
|
const editorCommentPositions = ref({});
|
|
4209
|
+
const isCommentHighlighted = ref(false);
|
|
4209
4210
|
const floatingCommentsOffset = ref(0);
|
|
4210
4211
|
const sortedConversations = ref([]);
|
|
4211
4212
|
const visibleConversations = ref([]);
|
|
@@ -4484,8 +4485,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4484
4485
|
tr.setMeta(CommentsPluginKey, { type: "forceTrackChanges" });
|
|
4485
4486
|
tr.setMeta(TrackChangesBasePluginKey, trackChangesPayload);
|
|
4486
4487
|
}
|
|
4488
|
+
dispatch(tr);
|
|
4487
4489
|
});
|
|
4488
|
-
dispatch(tr);
|
|
4489
4490
|
};
|
|
4490
4491
|
const translateCommentsForExport = () => {
|
|
4491
4492
|
const processedComments = [];
|
|
@@ -4555,6 +4556,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4555
4556
|
try {
|
|
4556
4557
|
const normalizedContent = normalizeCommentForEditor(commentTextJson);
|
|
4557
4558
|
const schemaContent = Array.isArray(normalizedContent) ? normalizedContent[0] : normalizedContent;
|
|
4559
|
+
if (!schemaContent.content.length) return null;
|
|
4558
4560
|
const editor = new Editor({
|
|
4559
4561
|
mode: "text",
|
|
4560
4562
|
isHeadless: true,
|
|
@@ -4588,6 +4590,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4588
4590
|
commentsParentElement,
|
|
4589
4591
|
editorCommentPositions,
|
|
4590
4592
|
hasInitializedLocations,
|
|
4593
|
+
isCommentHighlighted,
|
|
4591
4594
|
// Floating comments
|
|
4592
4595
|
floatingCommentsOffset,
|
|
4593
4596
|
sortedConversations,
|
|
@@ -16114,7 +16117,8 @@ const _sfc_main$c = {
|
|
|
16114
16117
|
currentCommentText,
|
|
16115
16118
|
isDebugging,
|
|
16116
16119
|
editingCommentId,
|
|
16117
|
-
editorCommentPositions
|
|
16120
|
+
editorCommentPositions,
|
|
16121
|
+
isCommentHighlighted
|
|
16118
16122
|
} = storeToRefs(commentsStore);
|
|
16119
16123
|
const { activeZoom } = storeToRefs(superdocStore);
|
|
16120
16124
|
const isInternal = ref(true);
|
|
@@ -16176,13 +16180,14 @@ const _sfc_main$c = {
|
|
|
16176
16180
|
"track-format",
|
|
16177
16181
|
"track-format-dec"
|
|
16178
16182
|
];
|
|
16179
|
-
if (excludedClasses.some((className) => e.target.classList.contains(className))) return;
|
|
16183
|
+
if (excludedClasses.some((className) => e.target.classList.contains(className)) || isCommentHighlighted.value) return;
|
|
16180
16184
|
if (activeComment.value === props.comment.commentId) {
|
|
16181
16185
|
floatingCommentsOffset.value = 0;
|
|
16182
16186
|
emit("dialog-exit");
|
|
16183
16187
|
}
|
|
16184
16188
|
activeComment.value = null;
|
|
16185
16189
|
commentsStore.setActiveComment(proxy.$superdoc, activeComment.value);
|
|
16190
|
+
isCommentHighlighted.value = false;
|
|
16186
16191
|
};
|
|
16187
16192
|
const handleAddComment = () => {
|
|
16188
16193
|
const options = {
|
|
@@ -16395,7 +16400,7 @@ const _sfc_main$c = {
|
|
|
16395
16400
|
};
|
|
16396
16401
|
}
|
|
16397
16402
|
};
|
|
16398
|
-
const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
|
16403
|
+
const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-e07f3426"]]);
|
|
16399
16404
|
const _hoisted_1$a = { class: "comments-list" };
|
|
16400
16405
|
const _hoisted_2$5 = { key: 0 };
|
|
16401
16406
|
const _hoisted_3$3 = { class: "comment-item" };
|
|
@@ -17392,7 +17397,7 @@ const _sfc_main = {
|
|
|
17392
17397
|
__name: "SuperDoc",
|
|
17393
17398
|
emits: ["selection-update"],
|
|
17394
17399
|
setup(__props, { emit: __emit }) {
|
|
17395
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17400
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CJdQmuIm.es.js"));
|
|
17396
17401
|
const superdocStore = useSuperdocStore();
|
|
17397
17402
|
const commentsStore = useCommentsStore();
|
|
17398
17403
|
const {
|
|
@@ -17418,7 +17423,8 @@ const _sfc_main = {
|
|
|
17418
17423
|
getFloatingComments,
|
|
17419
17424
|
hasSyncedCollaborationComments,
|
|
17420
17425
|
editorCommentPositions,
|
|
17421
|
-
hasInitializedLocations
|
|
17426
|
+
hasInitializedLocations,
|
|
17427
|
+
isCommentHighlighted
|
|
17422
17428
|
} = storeToRefs(commentsStore);
|
|
17423
17429
|
const { showAddComment, handleEditorLocationsUpdate, handleTrackedChangeUpdate } = commentsStore;
|
|
17424
17430
|
const { proxy } = getCurrentInstance();
|
|
@@ -17573,6 +17579,7 @@ const _sfc_main = {
|
|
|
17573
17579
|
annotations: proxy.$superdoc.config.annotations,
|
|
17574
17580
|
isCommentsEnabled: proxy.$superdoc.config.modules?.comments,
|
|
17575
17581
|
isAiEnabled: proxy.$superdoc.config.modules?.ai,
|
|
17582
|
+
slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
|
|
17576
17583
|
onBeforeCreate: onEditorBeforeCreate,
|
|
17577
17584
|
onCreate: onEditorCreate,
|
|
17578
17585
|
onDestroy: onEditorDestroy,
|
|
@@ -17612,6 +17619,7 @@ const _sfc_main = {
|
|
|
17612
17619
|
nextTick(() => {
|
|
17613
17620
|
if (pendingComment.value) return;
|
|
17614
17621
|
commentsStore.setActiveComment(proxy.$superdoc, activeCommentId);
|
|
17622
|
+
isCommentHighlighted.value = true;
|
|
17615
17623
|
});
|
|
17616
17624
|
if (typeof proxy.$superdoc.config.onCommentsUpdate === "function") {
|
|
17617
17625
|
proxy.$superdoc.config.onCommentsUpdate(params2);
|
|
@@ -17934,7 +17942,7 @@ const _sfc_main = {
|
|
|
17934
17942
|
};
|
|
17935
17943
|
}
|
|
17936
17944
|
};
|
|
17937
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
17945
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3f71b1bf"]]);
|
|
17938
17946
|
const createSuperdocVueApp = () => {
|
|
17939
17947
|
const app = createApp(App);
|
|
17940
17948
|
const pinia = createPinia();
|
|
@@ -18036,7 +18044,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18036
18044
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18037
18045
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18038
18046
|
this.colorIndex = 0;
|
|
18039
|
-
this.version = "0.
|
|
18047
|
+
this.version = "0.21.0";
|
|
18040
18048
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18041
18049
|
this.superdocId = config.superdocId || v4();
|
|
18042
18050
|
this.colors = this.config.colors;
|
|
@@ -18051,6 +18059,9 @@ class SuperDoc extends EventEmitter {
|
|
|
18051
18059
|
this.isDev = this.config.isDev || false;
|
|
18052
18060
|
this.activeEditor = null;
|
|
18053
18061
|
this.comments = [];
|
|
18062
|
+
if (!this.config.selector) {
|
|
18063
|
+
throw new Error("SuperDoc: selector is required");
|
|
18064
|
+
}
|
|
18054
18065
|
this.app.mount(this.config.selector);
|
|
18055
18066
|
this.readyEditors = 0;
|
|
18056
18067
|
this.isLocked = this.config.isLocked || false;
|
|
@@ -18070,6 +18081,16 @@ class SuperDoc extends EventEmitter {
|
|
|
18070
18081
|
users: this.users
|
|
18071
18082
|
};
|
|
18072
18083
|
}
|
|
18084
|
+
/**
|
|
18085
|
+
* Get the SuperDoc container element
|
|
18086
|
+
* @returns {HTMLElement | null}
|
|
18087
|
+
*/
|
|
18088
|
+
get element() {
|
|
18089
|
+
if (typeof this.config.selector === "string") {
|
|
18090
|
+
return document.querySelector(this.config.selector);
|
|
18091
|
+
}
|
|
18092
|
+
return this.config.selector;
|
|
18093
|
+
}
|
|
18073
18094
|
#patchNaiveUIStyles() {
|
|
18074
18095
|
const cspNonce = this.config.cspNonce;
|
|
18075
18096
|
const originalCreateElement = document.createElement;
|
|
@@ -18093,10 +18114,16 @@ class SuperDoc extends EventEmitter {
|
|
|
18093
18114
|
}
|
|
18094
18115
|
if (hasDocumentConfig) {
|
|
18095
18116
|
const normalized = normalizeDocumentEntry(this.config.document);
|
|
18096
|
-
this.config.documents = [
|
|
18117
|
+
this.config.documents = [
|
|
18118
|
+
{
|
|
18119
|
+
id: v4(),
|
|
18120
|
+
...normalized
|
|
18121
|
+
}
|
|
18122
|
+
];
|
|
18097
18123
|
} else if (hasDocumentUrl) {
|
|
18098
18124
|
this.config.documents = [
|
|
18099
18125
|
{
|
|
18126
|
+
id: v4(),
|
|
18100
18127
|
type: DOCX,
|
|
18101
18128
|
url: this.config.document,
|
|
18102
18129
|
name: "document.docx",
|
|
@@ -18104,33 +18131,34 @@ class SuperDoc extends EventEmitter {
|
|
|
18104
18131
|
}
|
|
18105
18132
|
];
|
|
18106
18133
|
} else if (hasDocumentFile) {
|
|
18134
|
+
const normalized = normalizeDocumentEntry(this.config.document);
|
|
18107
18135
|
this.config.documents = [
|
|
18108
18136
|
{
|
|
18109
|
-
|
|
18110
|
-
|
|
18111
|
-
name: this.config.document.name,
|
|
18112
|
-
isNewFile: true
|
|
18137
|
+
id: v4(),
|
|
18138
|
+
...normalized
|
|
18113
18139
|
}
|
|
18114
18140
|
];
|
|
18115
18141
|
} else if (hasDocumentBlob) {
|
|
18116
|
-
const
|
|
18117
|
-
let extension = ".docx";
|
|
18118
|
-
if (docType === PDF) {
|
|
18119
|
-
extension = ".pdf";
|
|
18120
|
-
} else if (docType === HTML) {
|
|
18121
|
-
extension = ".html";
|
|
18122
|
-
}
|
|
18142
|
+
const normalized = normalizeDocumentEntry(this.config.document);
|
|
18123
18143
|
this.config.documents = [
|
|
18124
18144
|
{
|
|
18125
|
-
|
|
18126
|
-
|
|
18127
|
-
name: `document${extension}`,
|
|
18128
|
-
isNewFile: true
|
|
18145
|
+
id: v4(),
|
|
18146
|
+
...normalized
|
|
18129
18147
|
}
|
|
18130
18148
|
];
|
|
18131
18149
|
}
|
|
18132
18150
|
if (Array.isArray(this.config.documents) && this.config.documents.length > 0) {
|
|
18133
|
-
this.config.documents = this.config.documents.map((d) =>
|
|
18151
|
+
this.config.documents = this.config.documents.map((d) => {
|
|
18152
|
+
const normalized = normalizeDocumentEntry(d);
|
|
18153
|
+
if (!normalized || typeof normalized !== "object") {
|
|
18154
|
+
return normalized;
|
|
18155
|
+
}
|
|
18156
|
+
const existingId = typeof normalized === "object" && "id" in normalized && normalized.id || d && typeof d === "object" && "id" in d && d.id;
|
|
18157
|
+
return {
|
|
18158
|
+
...normalized,
|
|
18159
|
+
id: existingId || v4()
|
|
18160
|
+
};
|
|
18161
|
+
});
|
|
18134
18162
|
}
|
|
18135
18163
|
}
|
|
18136
18164
|
#initVueApp() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-DAP-fnHo.cjs");
|
|
3
3
|
const vue = require("./vue-DWle4Cai.cjs");
|
|
4
4
|
const jszip = require("./jszip-b7l8QkfH.cjs");
|
|
5
5
|
const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
|
|
@@ -4178,7 +4178,7 @@ const groupChanges = (changes) => {
|
|
|
4178
4178
|
const c1 = changes[i];
|
|
4179
4179
|
const c2 = changes[i + 1];
|
|
4180
4180
|
const c1Key = markMetaKeys[c1.mark.type.name];
|
|
4181
|
-
if (c1 && c2 && c1.to === c2.from) {
|
|
4181
|
+
if (c1 && c2 && c1.to === c2.from && c1.mark.attrs.id === c2.mark.attrs.id) {
|
|
4182
4182
|
const c2Key = markMetaKeys[c2.mark.type.name];
|
|
4183
4183
|
grouped.push({
|
|
4184
4184
|
from: c1.from,
|
|
@@ -4223,6 +4223,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4223
4223
|
const isCommentsListVisible = vue.ref(false);
|
|
4224
4224
|
const editorCommentIds = vue.ref([]);
|
|
4225
4225
|
const editorCommentPositions = vue.ref({});
|
|
4226
|
+
const isCommentHighlighted = vue.ref(false);
|
|
4226
4227
|
const floatingCommentsOffset = vue.ref(0);
|
|
4227
4228
|
const sortedConversations = vue.ref([]);
|
|
4228
4229
|
const visibleConversations = vue.ref([]);
|
|
@@ -4501,8 +4502,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4501
4502
|
tr.setMeta(superEditor_es.CommentsPluginKey, { type: "forceTrackChanges" });
|
|
4502
4503
|
tr.setMeta(superEditor_es.TrackChangesBasePluginKey, trackChangesPayload);
|
|
4503
4504
|
}
|
|
4505
|
+
dispatch(tr);
|
|
4504
4506
|
});
|
|
4505
|
-
dispatch(tr);
|
|
4506
4507
|
};
|
|
4507
4508
|
const translateCommentsForExport = () => {
|
|
4508
4509
|
const processedComments = [];
|
|
@@ -4572,6 +4573,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4572
4573
|
try {
|
|
4573
4574
|
const normalizedContent = normalizeCommentForEditor(commentTextJson);
|
|
4574
4575
|
const schemaContent = Array.isArray(normalizedContent) ? normalizedContent[0] : normalizedContent;
|
|
4576
|
+
if (!schemaContent.content.length) return null;
|
|
4575
4577
|
const editor = new superEditor_es.Editor({
|
|
4576
4578
|
mode: "text",
|
|
4577
4579
|
isHeadless: true,
|
|
@@ -4605,6 +4607,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4605
4607
|
commentsParentElement,
|
|
4606
4608
|
editorCommentPositions,
|
|
4607
4609
|
hasInitializedLocations,
|
|
4610
|
+
isCommentHighlighted,
|
|
4608
4611
|
// Floating comments
|
|
4609
4612
|
floatingCommentsOffset,
|
|
4610
4613
|
sortedConversations,
|
|
@@ -16131,7 +16134,8 @@ const _sfc_main$c = {
|
|
|
16131
16134
|
currentCommentText,
|
|
16132
16135
|
isDebugging,
|
|
16133
16136
|
editingCommentId,
|
|
16134
|
-
editorCommentPositions
|
|
16137
|
+
editorCommentPositions,
|
|
16138
|
+
isCommentHighlighted
|
|
16135
16139
|
} = storeToRefs(commentsStore);
|
|
16136
16140
|
const { activeZoom } = storeToRefs(superdocStore);
|
|
16137
16141
|
const isInternal = vue.ref(true);
|
|
@@ -16193,13 +16197,14 @@ const _sfc_main$c = {
|
|
|
16193
16197
|
"track-format",
|
|
16194
16198
|
"track-format-dec"
|
|
16195
16199
|
];
|
|
16196
|
-
if (excludedClasses.some((className) => e.target.classList.contains(className))) return;
|
|
16200
|
+
if (excludedClasses.some((className) => e.target.classList.contains(className)) || isCommentHighlighted.value) return;
|
|
16197
16201
|
if (activeComment.value === props.comment.commentId) {
|
|
16198
16202
|
floatingCommentsOffset.value = 0;
|
|
16199
16203
|
emit("dialog-exit");
|
|
16200
16204
|
}
|
|
16201
16205
|
activeComment.value = null;
|
|
16202
16206
|
commentsStore.setActiveComment(proxy.$superdoc, activeComment.value);
|
|
16207
|
+
isCommentHighlighted.value = false;
|
|
16203
16208
|
};
|
|
16204
16209
|
const handleAddComment = () => {
|
|
16205
16210
|
const options = {
|
|
@@ -16412,7 +16417,7 @@ const _sfc_main$c = {
|
|
|
16412
16417
|
};
|
|
16413
16418
|
}
|
|
16414
16419
|
};
|
|
16415
|
-
const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
|
16420
|
+
const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-e07f3426"]]);
|
|
16416
16421
|
const _hoisted_1$a = { class: "comments-list" };
|
|
16417
16422
|
const _hoisted_2$5 = { key: 0 };
|
|
16418
16423
|
const _hoisted_3$3 = { class: "comment-item" };
|
|
@@ -17409,7 +17414,7 @@ const _sfc_main = {
|
|
|
17409
17414
|
__name: "SuperDoc",
|
|
17410
17415
|
emits: ["selection-update"],
|
|
17411
17416
|
setup(__props, { emit: __emit }) {
|
|
17412
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17417
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DE1NR4Ve.cjs")));
|
|
17413
17418
|
const superdocStore = useSuperdocStore();
|
|
17414
17419
|
const commentsStore = useCommentsStore();
|
|
17415
17420
|
const {
|
|
@@ -17435,7 +17440,8 @@ const _sfc_main = {
|
|
|
17435
17440
|
getFloatingComments,
|
|
17436
17441
|
hasSyncedCollaborationComments,
|
|
17437
17442
|
editorCommentPositions,
|
|
17438
|
-
hasInitializedLocations
|
|
17443
|
+
hasInitializedLocations,
|
|
17444
|
+
isCommentHighlighted
|
|
17439
17445
|
} = storeToRefs(commentsStore);
|
|
17440
17446
|
const { showAddComment, handleEditorLocationsUpdate, handleTrackedChangeUpdate } = commentsStore;
|
|
17441
17447
|
const { proxy } = vue.getCurrentInstance();
|
|
@@ -17590,6 +17596,7 @@ const _sfc_main = {
|
|
|
17590
17596
|
annotations: proxy.$superdoc.config.annotations,
|
|
17591
17597
|
isCommentsEnabled: proxy.$superdoc.config.modules?.comments,
|
|
17592
17598
|
isAiEnabled: proxy.$superdoc.config.modules?.ai,
|
|
17599
|
+
slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
|
|
17593
17600
|
onBeforeCreate: onEditorBeforeCreate,
|
|
17594
17601
|
onCreate: onEditorCreate,
|
|
17595
17602
|
onDestroy: onEditorDestroy,
|
|
@@ -17629,6 +17636,7 @@ const _sfc_main = {
|
|
|
17629
17636
|
vue.nextTick(() => {
|
|
17630
17637
|
if (pendingComment.value) return;
|
|
17631
17638
|
commentsStore.setActiveComment(proxy.$superdoc, activeCommentId);
|
|
17639
|
+
isCommentHighlighted.value = true;
|
|
17632
17640
|
});
|
|
17633
17641
|
if (typeof proxy.$superdoc.config.onCommentsUpdate === "function") {
|
|
17634
17642
|
proxy.$superdoc.config.onCommentsUpdate(params2);
|
|
@@ -17951,7 +17959,7 @@ const _sfc_main = {
|
|
|
17951
17959
|
};
|
|
17952
17960
|
}
|
|
17953
17961
|
};
|
|
17954
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
17962
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3f71b1bf"]]);
|
|
17955
17963
|
const createSuperdocVueApp = () => {
|
|
17956
17964
|
const app = vue.createApp(App);
|
|
17957
17965
|
const pinia = createPinia();
|
|
@@ -18053,7 +18061,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18053
18061
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18054
18062
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18055
18063
|
this.colorIndex = 0;
|
|
18056
|
-
this.version = "0.
|
|
18064
|
+
this.version = "0.21.0";
|
|
18057
18065
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18058
18066
|
this.superdocId = config.superdocId || uuid.v4();
|
|
18059
18067
|
this.colors = this.config.colors;
|
|
@@ -18068,6 +18076,9 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18068
18076
|
this.isDev = this.config.isDev || false;
|
|
18069
18077
|
this.activeEditor = null;
|
|
18070
18078
|
this.comments = [];
|
|
18079
|
+
if (!this.config.selector) {
|
|
18080
|
+
throw new Error("SuperDoc: selector is required");
|
|
18081
|
+
}
|
|
18071
18082
|
this.app.mount(this.config.selector);
|
|
18072
18083
|
this.readyEditors = 0;
|
|
18073
18084
|
this.isLocked = this.config.isLocked || false;
|
|
@@ -18087,6 +18098,16 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18087
18098
|
users: this.users
|
|
18088
18099
|
};
|
|
18089
18100
|
}
|
|
18101
|
+
/**
|
|
18102
|
+
* Get the SuperDoc container element
|
|
18103
|
+
* @returns {HTMLElement | null}
|
|
18104
|
+
*/
|
|
18105
|
+
get element() {
|
|
18106
|
+
if (typeof this.config.selector === "string") {
|
|
18107
|
+
return document.querySelector(this.config.selector);
|
|
18108
|
+
}
|
|
18109
|
+
return this.config.selector;
|
|
18110
|
+
}
|
|
18090
18111
|
#patchNaiveUIStyles() {
|
|
18091
18112
|
const cspNonce = this.config.cspNonce;
|
|
18092
18113
|
const originalCreateElement = document.createElement;
|
|
@@ -18110,10 +18131,16 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18110
18131
|
}
|
|
18111
18132
|
if (hasDocumentConfig) {
|
|
18112
18133
|
const normalized = normalizeDocumentEntry(this.config.document);
|
|
18113
|
-
this.config.documents = [
|
|
18134
|
+
this.config.documents = [
|
|
18135
|
+
{
|
|
18136
|
+
id: uuid.v4(),
|
|
18137
|
+
...normalized
|
|
18138
|
+
}
|
|
18139
|
+
];
|
|
18114
18140
|
} else if (hasDocumentUrl) {
|
|
18115
18141
|
this.config.documents = [
|
|
18116
18142
|
{
|
|
18143
|
+
id: uuid.v4(),
|
|
18117
18144
|
type: DOCX,
|
|
18118
18145
|
url: this.config.document,
|
|
18119
18146
|
name: "document.docx",
|
|
@@ -18121,33 +18148,34 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18121
18148
|
}
|
|
18122
18149
|
];
|
|
18123
18150
|
} else if (hasDocumentFile) {
|
|
18151
|
+
const normalized = normalizeDocumentEntry(this.config.document);
|
|
18124
18152
|
this.config.documents = [
|
|
18125
18153
|
{
|
|
18126
|
-
|
|
18127
|
-
|
|
18128
|
-
name: this.config.document.name,
|
|
18129
|
-
isNewFile: true
|
|
18154
|
+
id: uuid.v4(),
|
|
18155
|
+
...normalized
|
|
18130
18156
|
}
|
|
18131
18157
|
];
|
|
18132
18158
|
} else if (hasDocumentBlob) {
|
|
18133
|
-
const
|
|
18134
|
-
let extension = ".docx";
|
|
18135
|
-
if (docType === PDF) {
|
|
18136
|
-
extension = ".pdf";
|
|
18137
|
-
} else if (docType === HTML) {
|
|
18138
|
-
extension = ".html";
|
|
18139
|
-
}
|
|
18159
|
+
const normalized = normalizeDocumentEntry(this.config.document);
|
|
18140
18160
|
this.config.documents = [
|
|
18141
18161
|
{
|
|
18142
|
-
|
|
18143
|
-
|
|
18144
|
-
name: `document${extension}`,
|
|
18145
|
-
isNewFile: true
|
|
18162
|
+
id: uuid.v4(),
|
|
18163
|
+
...normalized
|
|
18146
18164
|
}
|
|
18147
18165
|
];
|
|
18148
18166
|
}
|
|
18149
18167
|
if (Array.isArray(this.config.documents) && this.config.documents.length > 0) {
|
|
18150
|
-
this.config.documents = this.config.documents.map((d) =>
|
|
18168
|
+
this.config.documents = this.config.documents.map((d) => {
|
|
18169
|
+
const normalized = normalizeDocumentEntry(d);
|
|
18170
|
+
if (!normalized || typeof normalized !== "object") {
|
|
18171
|
+
return normalized;
|
|
18172
|
+
}
|
|
18173
|
+
const existingId = typeof normalized === "object" && "id" in normalized && normalized.id || d && typeof d === "object" && "id" in d && d.id;
|
|
18174
|
+
return {
|
|
18175
|
+
...normalized,
|
|
18176
|
+
id: existingId || uuid.v4()
|
|
18177
|
+
};
|
|
18178
|
+
});
|
|
18151
18179
|
}
|
|
18152
18180
|
}
|
|
18153
18181
|
#initVueApp() {
|