@harbour-enterprises/superdoc 0.20.0-next.13 → 0.20.0-next.15
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/README.md +4 -4
- package/dist/chunks/{PdfViewer-Beoed5G0.es.js → PdfViewer-D3gJ5ozH.es.js} +1 -1
- package/dist/chunks/{PdfViewer-Dh2tr2ag.cjs → PdfViewer-DuEWa8ox.cjs} +1 -1
- package/dist/chunks/{index-BFe2eMYK.cjs → index-D2h9q27o.cjs} +32 -9
- package/dist/chunks/{index-OC4NDn1G.es.js → index-DiSIyVKk.es.js} +32 -9
- package/dist/chunks/{super-editor.es-cgub83Px.es.js → super-editor.es-4Ig7dBJr.es.js} +2901 -902
- package/dist/chunks/{super-editor.es-4ltXjey_.cjs → super-editor.es-lzaBZOn2.cjs} +2901 -902
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/stores/comments-store.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CTJIyTAA.js → converter-BJVy6JMW.js} +1996 -657
- package/dist/super-editor/chunks/{docx-zipper-BwicJKh2.js → docx-zipper-DWDJGX0b.js} +1 -1
- package/dist/super-editor/chunks/{editor-B97u3IuY.js → editor-BUCOmU2Y.js} +1027 -411
- package/dist/super-editor/chunks/{toolbar-BcdsHEOP.js → toolbar-CiBIcgiI.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/toolbar/format-negation.d.ts +5 -0
- package/dist/super-editor/src/core/commands/index.d.ts +1 -0
- package/dist/super-editor/src/core/commands/toggleMarkCascade.d.ts +42 -0
- package/dist/super-editor/src/core/commands/types/index.d.ts +29 -1
- package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/helpers.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +12 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/runNodeImporter.d.ts +6 -6
- package/dist/super-editor/src/core/super-converter/v3/handlers/constants/east-asian-regex.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/constants/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/index.d.ts +2 -12
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/index.d.ts +3 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/b-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-color.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-shade.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-tint.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/color-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/highlight-translator.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/i-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-del.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r-pr.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/helpers.d.ts +40 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/index.d.ts +3 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/split-run-properties.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/track-change-helpers.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/r-translator.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-ascii.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-cs.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-east-asia.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-hansi.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/rFonts-translator.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/rstyle-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/rpr-translator.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/run-property-translators.d.ts +11 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/strike-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/sz-translator.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/szcs-translator.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-color.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-color.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-shade.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-tint.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/u-translator.d.ts +7 -0
- package/dist/super-editor/src/extensions/index.d.ts +2 -2
- package/dist/super-editor/src/extensions/linked-styles/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/linked-styles/underline-css.d.ts +17 -0
- package/dist/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts +62 -0
- package/dist/super-editor/src/extensions/run/commands/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/run/commands/split-run.d.ts +1 -0
- package/dist/super-editor/src/extensions/run/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/run/run.d.ts +6 -0
- package/dist/super-editor/src/extensions/shared/cascade-toggle.d.ts +8 -0
- package/dist/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +12 -0
- package/dist/super-editor/src/extensions/tab/tab.d.ts +4 -0
- package/dist/super-editor/src/tests/helpers/getParagraphText.d.ts +2 -0
- package/dist/super-editor/super-editor.es.js +90 -21
- 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 +2933 -911
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://docs.superdoc.dev/)
|
|
6
6
|
[](https://www.gnu.org/licenses/agpl-3.0)
|
|
7
|
-
[](https://www.npmjs.com/package/superdoc)
|
|
8
8
|
[](https://discord.gg/FBeRDqWy)
|
|
9
9
|
|
|
10
10
|
SuperDoc is a powerful document editor that brings Microsoft Word-level capabilities to your web applications. With real-time collaboration, extensive formatting options, and seamless integration capabilities, SuperDoc makes document editing on the web better for everyone.
|
|
@@ -23,14 +23,14 @@ SuperDoc is a powerful document editor that brings Microsoft Word-level capabili
|
|
|
23
23
|
### Installation
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm install
|
|
26
|
+
npm install superdoc
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
### Basic Usage
|
|
30
30
|
|
|
31
31
|
```javascript
|
|
32
|
-
import '
|
|
33
|
-
import { SuperDoc } from '
|
|
32
|
+
import 'superdoc/style.css';
|
|
33
|
+
import { SuperDoc } from 'superdoc';
|
|
34
34
|
|
|
35
35
|
const superdoc = new SuperDoc({
|
|
36
36
|
selector: '#superdoc',
|
|
@@ -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-DiSIyVKk.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-D2h9q27o.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-lzaBZOn2.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");
|
|
@@ -4309,7 +4309,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4309
4309
|
}
|
|
4310
4310
|
debounceTimers[commentId] = setTimeout(() => {
|
|
4311
4311
|
if (superdoc2) {
|
|
4312
|
-
console.debug("[debounceEmit] tracked change update emitting...", event);
|
|
4313
4312
|
superdoc2.emit("comments-update", event);
|
|
4314
4313
|
}
|
|
4315
4314
|
delete debounceTimers[commentId];
|
|
@@ -4317,7 +4316,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4317
4316
|
};
|
|
4318
4317
|
const showAddComment = (superdoc2) => {
|
|
4319
4318
|
const event = { type: COMMENT_EVENTS.PENDING };
|
|
4320
|
-
console.debug("[showAddComment] emitting...", event);
|
|
4321
4319
|
superdoc2.emit("comments-update", event);
|
|
4322
4320
|
const selection = { ...superdocStore.activeSelection };
|
|
4323
4321
|
selection.selectionBounds = { ...selection.selectionBounds };
|
|
@@ -4418,7 +4416,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4418
4416
|
}
|
|
4419
4417
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
4420
4418
|
syncCommentsToClients(superdoc2, event);
|
|
4421
|
-
console.debug("[addComment] emitting...", event);
|
|
4422
4419
|
superdoc2.emit("comments-update", event);
|
|
4423
4420
|
};
|
|
4424
4421
|
const deleteComment = ({ commentId: commentIdToDelete, superdoc: superdoc2 }) => {
|
|
@@ -4435,7 +4432,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4435
4432
|
comment: comment.getValues(),
|
|
4436
4433
|
changes: [{ key: "deleted", commentId, fileId }]
|
|
4437
4434
|
};
|
|
4438
|
-
console.debug("[deleteComment] emitting...", event);
|
|
4439
4435
|
superdoc2.emit("comments-update", event);
|
|
4440
4436
|
syncCommentsToClients(superdoc2, event);
|
|
4441
4437
|
};
|
|
@@ -4444,7 +4440,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4444
4440
|
};
|
|
4445
4441
|
const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
|
|
4446
4442
|
const document2 = superdocStore.getDocument(documentId);
|
|
4447
|
-
console.debug("[processLoadedDocxComments] processing comments...", comments);
|
|
4448
4443
|
comments.forEach((comment) => {
|
|
4449
4444
|
const htmlContent = getHTmlFromComment(comment.textJson);
|
|
4450
4445
|
if (!htmlContent && !comment.trackedChange) {
|
|
@@ -4546,13 +4541,41 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4546
4541
|
});
|
|
4547
4542
|
return comments;
|
|
4548
4543
|
});
|
|
4544
|
+
const normalizeCommentForEditor = (node) => {
|
|
4545
|
+
if (!node || typeof node !== "object") return node;
|
|
4546
|
+
const cloneMarks = (marks) => Array.isArray(marks) ? marks.filter(Boolean).map((mark) => ({
|
|
4547
|
+
...mark,
|
|
4548
|
+
attrs: mark?.attrs ? { ...mark.attrs } : void 0
|
|
4549
|
+
})) : void 0;
|
|
4550
|
+
const cloneAttrs = (attrs) => attrs && typeof attrs === "object" ? { ...attrs } : void 0;
|
|
4551
|
+
if (!Array.isArray(node.content)) {
|
|
4552
|
+
return {
|
|
4553
|
+
type: node.type,
|
|
4554
|
+
...node.text !== void 0 ? { text: node.text } : {},
|
|
4555
|
+
...node.attrs ? { attrs: cloneAttrs(node.attrs) } : {},
|
|
4556
|
+
...node.marks ? { marks: cloneMarks(node.marks) } : {}
|
|
4557
|
+
};
|
|
4558
|
+
}
|
|
4559
|
+
const normalizedChildren = node.content.map((child) => normalizeCommentForEditor(child)).flat().filter(Boolean);
|
|
4560
|
+
if (node.type === "run") {
|
|
4561
|
+
return normalizedChildren;
|
|
4562
|
+
}
|
|
4563
|
+
return {
|
|
4564
|
+
type: node.type,
|
|
4565
|
+
...node.attrs ? { attrs: cloneAttrs(node.attrs) } : {},
|
|
4566
|
+
...node.marks ? { marks: cloneMarks(node.marks) } : {},
|
|
4567
|
+
content: normalizedChildren
|
|
4568
|
+
};
|
|
4569
|
+
};
|
|
4549
4570
|
const getHTmlFromComment = (commentTextJson) => {
|
|
4550
4571
|
if (!commentTextJson.content?.length) return;
|
|
4551
4572
|
try {
|
|
4573
|
+
const normalizedContent = normalizeCommentForEditor(commentTextJson);
|
|
4574
|
+
const schemaContent = Array.isArray(normalizedContent) ? normalizedContent[0] : normalizedContent;
|
|
4552
4575
|
const editor = new superEditor_es.Editor({
|
|
4553
4576
|
mode: "text",
|
|
4554
4577
|
isHeadless: true,
|
|
4555
|
-
content:
|
|
4578
|
+
content: schemaContent,
|
|
4556
4579
|
loadFromSchema: true,
|
|
4557
4580
|
extensions: superEditor_es.getRichTextExtensions()
|
|
4558
4581
|
});
|
|
@@ -17386,7 +17409,7 @@ const _sfc_main = {
|
|
|
17386
17409
|
__name: "SuperDoc",
|
|
17387
17410
|
emits: ["selection-update"],
|
|
17388
17411
|
setup(__props, { emit: __emit }) {
|
|
17389
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17412
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DuEWa8ox.cjs")));
|
|
17390
17413
|
const superdocStore = useSuperdocStore();
|
|
17391
17414
|
const commentsStore = useCommentsStore();
|
|
17392
17415
|
const {
|
|
@@ -18030,7 +18053,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18030
18053
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18031
18054
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18032
18055
|
this.colorIndex = 0;
|
|
18033
|
-
this.version = "0.20.0";
|
|
18056
|
+
this.version = "0.20.0-next.13";
|
|
18034
18057
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18035
18058
|
this.superdocId = config.superdocId || uuid.v4();
|
|
18036
18059
|
this.colors = this.config.colors;
|
|
@@ -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-4Ig7dBJr.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";
|
|
@@ -4292,7 +4292,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4292
4292
|
}
|
|
4293
4293
|
debounceTimers[commentId] = setTimeout(() => {
|
|
4294
4294
|
if (superdoc2) {
|
|
4295
|
-
console.debug("[debounceEmit] tracked change update emitting...", event);
|
|
4296
4295
|
superdoc2.emit("comments-update", event);
|
|
4297
4296
|
}
|
|
4298
4297
|
delete debounceTimers[commentId];
|
|
@@ -4300,7 +4299,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4300
4299
|
};
|
|
4301
4300
|
const showAddComment = (superdoc2) => {
|
|
4302
4301
|
const event = { type: COMMENT_EVENTS.PENDING };
|
|
4303
|
-
console.debug("[showAddComment] emitting...", event);
|
|
4304
4302
|
superdoc2.emit("comments-update", event);
|
|
4305
4303
|
const selection = { ...superdocStore.activeSelection };
|
|
4306
4304
|
selection.selectionBounds = { ...selection.selectionBounds };
|
|
@@ -4401,7 +4399,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4401
4399
|
}
|
|
4402
4400
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
4403
4401
|
syncCommentsToClients(superdoc2, event);
|
|
4404
|
-
console.debug("[addComment] emitting...", event);
|
|
4405
4402
|
superdoc2.emit("comments-update", event);
|
|
4406
4403
|
};
|
|
4407
4404
|
const deleteComment = ({ commentId: commentIdToDelete, superdoc: superdoc2 }) => {
|
|
@@ -4418,7 +4415,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4418
4415
|
comment: comment.getValues(),
|
|
4419
4416
|
changes: [{ key: "deleted", commentId, fileId }]
|
|
4420
4417
|
};
|
|
4421
|
-
console.debug("[deleteComment] emitting...", event);
|
|
4422
4418
|
superdoc2.emit("comments-update", event);
|
|
4423
4419
|
syncCommentsToClients(superdoc2, event);
|
|
4424
4420
|
};
|
|
@@ -4427,7 +4423,6 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4427
4423
|
};
|
|
4428
4424
|
const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
|
|
4429
4425
|
const document2 = superdocStore.getDocument(documentId);
|
|
4430
|
-
console.debug("[processLoadedDocxComments] processing comments...", comments);
|
|
4431
4426
|
comments.forEach((comment) => {
|
|
4432
4427
|
const htmlContent = getHTmlFromComment(comment.textJson);
|
|
4433
4428
|
if (!htmlContent && !comment.trackedChange) {
|
|
@@ -4529,13 +4524,41 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4529
4524
|
});
|
|
4530
4525
|
return comments;
|
|
4531
4526
|
});
|
|
4527
|
+
const normalizeCommentForEditor = (node) => {
|
|
4528
|
+
if (!node || typeof node !== "object") return node;
|
|
4529
|
+
const cloneMarks = (marks) => Array.isArray(marks) ? marks.filter(Boolean).map((mark) => ({
|
|
4530
|
+
...mark,
|
|
4531
|
+
attrs: mark?.attrs ? { ...mark.attrs } : void 0
|
|
4532
|
+
})) : void 0;
|
|
4533
|
+
const cloneAttrs = (attrs) => attrs && typeof attrs === "object" ? { ...attrs } : void 0;
|
|
4534
|
+
if (!Array.isArray(node.content)) {
|
|
4535
|
+
return {
|
|
4536
|
+
type: node.type,
|
|
4537
|
+
...node.text !== void 0 ? { text: node.text } : {},
|
|
4538
|
+
...node.attrs ? { attrs: cloneAttrs(node.attrs) } : {},
|
|
4539
|
+
...node.marks ? { marks: cloneMarks(node.marks) } : {}
|
|
4540
|
+
};
|
|
4541
|
+
}
|
|
4542
|
+
const normalizedChildren = node.content.map((child) => normalizeCommentForEditor(child)).flat().filter(Boolean);
|
|
4543
|
+
if (node.type === "run") {
|
|
4544
|
+
return normalizedChildren;
|
|
4545
|
+
}
|
|
4546
|
+
return {
|
|
4547
|
+
type: node.type,
|
|
4548
|
+
...node.attrs ? { attrs: cloneAttrs(node.attrs) } : {},
|
|
4549
|
+
...node.marks ? { marks: cloneMarks(node.marks) } : {},
|
|
4550
|
+
content: normalizedChildren
|
|
4551
|
+
};
|
|
4552
|
+
};
|
|
4532
4553
|
const getHTmlFromComment = (commentTextJson) => {
|
|
4533
4554
|
if (!commentTextJson.content?.length) return;
|
|
4534
4555
|
try {
|
|
4556
|
+
const normalizedContent = normalizeCommentForEditor(commentTextJson);
|
|
4557
|
+
const schemaContent = Array.isArray(normalizedContent) ? normalizedContent[0] : normalizedContent;
|
|
4535
4558
|
const editor = new Editor({
|
|
4536
4559
|
mode: "text",
|
|
4537
4560
|
isHeadless: true,
|
|
4538
|
-
content:
|
|
4561
|
+
content: schemaContent,
|
|
4539
4562
|
loadFromSchema: true,
|
|
4540
4563
|
extensions: getRichTextExtensions()
|
|
4541
4564
|
});
|
|
@@ -17369,7 +17392,7 @@ const _sfc_main = {
|
|
|
17369
17392
|
__name: "SuperDoc",
|
|
17370
17393
|
emits: ["selection-update"],
|
|
17371
17394
|
setup(__props, { emit: __emit }) {
|
|
17372
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17395
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-D3gJ5ozH.es.js"));
|
|
17373
17396
|
const superdocStore = useSuperdocStore();
|
|
17374
17397
|
const commentsStore = useCommentsStore();
|
|
17375
17398
|
const {
|
|
@@ -18013,7 +18036,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18013
18036
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18014
18037
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18015
18038
|
this.colorIndex = 0;
|
|
18016
|
-
this.version = "0.20.0";
|
|
18039
|
+
this.version = "0.20.0-next.13";
|
|
18017
18040
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18018
18041
|
this.superdocId = config.superdocId || v4();
|
|
18019
18042
|
this.colors = this.config.colors;
|