@harbour-enterprises/superdoc 0.13.0-next.3 → 0.13.0-next.5
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/{super-editor.es-CaiAvJmI.es.js → super-editor.es-BUhPIiSe.es.js} +66 -11
- package/dist/chunks/{super-editor.es-C1r2fKvd.cjs → super-editor.es-DiMCL_ka.cjs} +66 -11
- 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-DifQiKXL.js → converter-DOyDZC9F.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-0V4s80fa.js → docx-zipper-DZ-zYy-E.js} +1 -1
- package/dist/super-editor/chunks/{editor-Cu6WivrX.js → editor-Dz35c20r.js} +66 -11
- package/dist/super-editor/chunks/{toolbar-VX_23hqe.js → toolbar-BXs-eLuz.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Editor.d.ts +14 -0
- package/dist/super-editor/core/Editor.d.ts.map +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/extensions/image/imageHelpers/imagePositionPlugin.d.ts.map +1 -1
- package/dist/super-editor/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts.map +1 -1
- package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
- package/dist/super-editor/extensions/tab/tab.d.ts.map +1 -1
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- 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 +23 -7
- package/dist/superdoc.es.js +24 -8
- package/dist/superdoc.umd.js +88 -17
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imagePositionPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image/imageHelpers/imagePositionPlugin.js"],"names":[],"mappings":"AAKO;;
|
|
1
|
+
{"version":3,"file":"imagePositionPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image/imageHelpers/imagePositionPlugin.js"],"names":[],"mappings":"AAKO;;0BA0CN;8BA9CyC,kBAAkB;uBAD1B,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderedListSyncPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ordered-list/helpers/orderedListSyncPlugin.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"orderedListSyncPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ordered-list/helpers/orderedListSyncPlugin.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,2DAyEC;AAED,mCAEC;uBAlFiC,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../src/extensions/paragraph/paragraph.js"],"names":[],"mappings":"AAMA,
|
|
1
|
+
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../src/extensions/paragraph/paragraph.js"],"names":[],"mappings":"AAMA,4BAoJG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/extensions/tab/tab.js"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/extensions/tab/tab.js"],"names":[],"mappings":"AAIA,0BAkEG"}
|
|
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
11
11
|
var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
|
|
12
|
-
import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-
|
|
13
|
-
import { O } from "./chunks/converter-
|
|
14
|
-
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, f as findParentNode, c as getFileOpener, s as startImageUpload, d as getActiveFormatting, i as isInTable, e as undoDepth, r as redoDepth, E as Editor, h as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-
|
|
15
|
-
import { o, C, T, m, q, p, l, n } from "./chunks/editor-
|
|
12
|
+
import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-DOyDZC9F.js";
|
|
13
|
+
import { O } from "./chunks/converter-DOyDZC9F.js";
|
|
14
|
+
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, f as findParentNode, c as getFileOpener, s as startImageUpload, d as getActiveFormatting, i as isInTable, e as undoDepth, r as redoDepth, E as Editor, h as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-Dz35c20r.js";
|
|
15
|
+
import { o, C, T, m, q, p, l, n } from "./chunks/editor-Dz35c20r.js";
|
|
16
16
|
import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, getCurrentInstance, computed, watch, createCommentVNode, withDirectives, withKeys, vModelText, createTextVNode, toDisplayString, normalizeStyle, createVNode, h, createApp, reactive, onUnmounted, shallowRef, onBeforeUnmount, createBlock } from "vue";
|
|
17
|
-
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-
|
|
17
|
+
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-BXs-eLuz.js";
|
|
18
18
|
import AIWriter from "./ai-writer.es.js";
|
|
19
|
-
import { D } from "./chunks/docx-zipper-
|
|
19
|
+
import { D } from "./chunks/docx-zipper-DZ-zYy-E.js";
|
|
20
20
|
import { createZip } from "./file-zipper.es.js";
|
|
21
21
|
var eventemitter3 = { exports: {} };
|
|
22
22
|
(function(module) {
|
package/dist/super-editor.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-DiMCL_ka.cjs");
|
|
4
4
|
require("./chunks/vue-HIY1g7dm.cjs");
|
|
5
5
|
exports.AIWriter = superEditor_es.AIWriter;
|
|
6
6
|
exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
|
package/dist/super-editor.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, a, _, C, D, E, b, S, c, d, e, T, f, g, i, h, j, k, l, m, n, o } from "./chunks/super-editor.es-
|
|
1
|
+
import { A, a, _, C, D, E, b, S, c, d, e, T, f, g, i, h, j, k, l, m, n, o } from "./chunks/super-editor.es-BUhPIiSe.es.js";
|
|
2
2
|
import "./chunks/vue-Bi1uWinj.es.js";
|
|
3
3
|
export {
|
|
4
4
|
A as AIWriter,
|
package/dist/superdoc.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-DiMCL_ka.cjs");
|
|
4
4
|
const vue = require("./chunks/vue-HIY1g7dm.cjs");
|
|
5
5
|
const jszip = require("./chunks/jszip-BTAcmbVg.cjs");
|
|
6
6
|
const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
|
|
@@ -4351,14 +4351,29 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4351
4351
|
});
|
|
4352
4352
|
addComment({ superdoc: superdoc2, comment: newComment });
|
|
4353
4353
|
});
|
|
4354
|
-
|
|
4355
|
-
|
|
4354
|
+
setTimeout(() => {
|
|
4355
|
+
createCommentForTrackChanges(editor);
|
|
4356
|
+
}, 0);
|
|
4357
|
+
};
|
|
4358
|
+
const createCommentForTrackChanges = (editor) => {
|
|
4359
|
+
let trackedChanges = superEditor_es.index.getTrackChanges(editor.state);
|
|
4360
|
+
let isLargeDoc = editor.state.doc.nodeSize >= 1e5;
|
|
4361
|
+
if (isLargeDoc && trackedChanges.length) {
|
|
4362
|
+
trackedChanges = trackedChanges.slice(0, 100);
|
|
4363
|
+
}
|
|
4364
|
+
trackedChanges.forEach(({ mark }, index2) => {
|
|
4365
|
+
console.debug(`Create comment for track change: ${index2}`);
|
|
4366
|
+
const { dispatch } = editor.view;
|
|
4367
|
+
const { tr } = editor.view.state;
|
|
4356
4368
|
const foundComment = commentsList.value.find((i) => i.commentId === mark.attrs.id);
|
|
4369
|
+
const isLastIteration = trackedChanges.length === index2 + 1;
|
|
4357
4370
|
if (foundComment) {
|
|
4371
|
+
if (isLastIteration) {
|
|
4372
|
+
tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
|
|
4373
|
+
dispatch(tr);
|
|
4374
|
+
}
|
|
4358
4375
|
return;
|
|
4359
4376
|
}
|
|
4360
|
-
const { dispatch } = editor.view;
|
|
4361
|
-
const { tr } = editor.view.state;
|
|
4362
4377
|
const markMetaKeys = {
|
|
4363
4378
|
trackInsert: "insertedMark",
|
|
4364
4379
|
trackDelete: "deletionMark",
|
|
@@ -4366,7 +4381,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4366
4381
|
};
|
|
4367
4382
|
const markKeyName = markMetaKeys[mark.type.name];
|
|
4368
4383
|
if (markKeyName) {
|
|
4369
|
-
tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
|
|
4384
|
+
if (isLastIteration) tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
|
|
4385
|
+
tr.setMeta(superEditor_es.CommentsPluginKey, { type: "forceTrackChanges" });
|
|
4370
4386
|
tr.setMeta(superEditor_es.TrackChangesBasePluginKey, { [markKeyName]: mark });
|
|
4371
4387
|
dispatch(tr);
|
|
4372
4388
|
}
|
|
@@ -47790,7 +47806,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
47790
47806
|
this.config.colors = shuffleArray(this.config.colors);
|
|
47791
47807
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
47792
47808
|
this.colorIndex = 0;
|
|
47793
|
-
this.version = "0.13.0-next.
|
|
47809
|
+
this.version = "0.13.0-next.5";
|
|
47794
47810
|
console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
47795
47811
|
this.superdocId = config.superdocId || uuid.v4();
|
|
47796
47812
|
this.colors = this.config.colors;
|
package/dist/superdoc.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as index$1, C as CommentsPluginKey, f as TrackChangesBasePluginKey, E as Editor, l as getRichTextExtensions, d as SuperInput, A as AIWriter, c as SuperEditor, e as SuperToolbar, g as createZip } from "./chunks/super-editor.es-
|
|
2
|
-
import { a, S, i, n } from "./chunks/super-editor.es-
|
|
1
|
+
import { o as index$1, C as CommentsPluginKey, f as TrackChangesBasePluginKey, E as Editor, l as getRichTextExtensions, d as SuperInput, A as AIWriter, c as SuperEditor, e as SuperToolbar, g as createZip } from "./chunks/super-editor.es-BUhPIiSe.es.js";
|
|
2
|
+
import { a, S, i, n } from "./chunks/super-editor.es-BUhPIiSe.es.js";
|
|
3
3
|
import { Y as effectScope, r as ref, Z as markRaw, p as process$1, _ as toRaw, a as computed, $ as isRef, a0 as isReactive, D as toRef, i as inject, q as getCurrentInstance, l as watch, y as unref, a1 as hasInjectionContext, N as reactive, u as nextTick, a2 as getCurrentScope, a3 as onScopeDispose, a4 as toRefs, g as global$1, K as shallowRef, O as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, U as onActivated, s as onDeactivated, A as createTextVNode, F as Fragment, R as Comment, m as defineComponent, E as provide, I as withDirectives, C as h, V as Teleport, S as renderSlot, W as isVNode, J as watchEffect, P as Transition, G as mergeProps, Q as vShow, H as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, x as createVNode, z as withCtx, f as createBaseVNode, B as normalizeStyle, e as createCommentVNode, v as createBlock, w as withModifiers, n as normalizeClass, a5 as resolveDirective, d as renderList, c as createApp, X as onUnmounted, a6 as resolveDynamicComponent } from "./chunks/vue-Bi1uWinj.es.js";
|
|
4
4
|
import { B as Buffer$2 } from "./chunks/jszip-DckFs3A7.es.js";
|
|
5
5
|
import { B as BlankDOCX } from "./chunks/blank-docx-iwdyG9RH.es.js";
|
|
@@ -4334,14 +4334,29 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4334
4334
|
});
|
|
4335
4335
|
addComment({ superdoc: superdoc2, comment: newComment });
|
|
4336
4336
|
});
|
|
4337
|
-
|
|
4338
|
-
|
|
4337
|
+
setTimeout(() => {
|
|
4338
|
+
createCommentForTrackChanges(editor);
|
|
4339
|
+
}, 0);
|
|
4340
|
+
};
|
|
4341
|
+
const createCommentForTrackChanges = (editor) => {
|
|
4342
|
+
let trackedChanges = index$1.getTrackChanges(editor.state);
|
|
4343
|
+
let isLargeDoc = editor.state.doc.nodeSize >= 1e5;
|
|
4344
|
+
if (isLargeDoc && trackedChanges.length) {
|
|
4345
|
+
trackedChanges = trackedChanges.slice(0, 100);
|
|
4346
|
+
}
|
|
4347
|
+
trackedChanges.forEach(({ mark }, index2) => {
|
|
4348
|
+
console.debug(`Create comment for track change: ${index2}`);
|
|
4349
|
+
const { dispatch } = editor.view;
|
|
4350
|
+
const { tr } = editor.view.state;
|
|
4339
4351
|
const foundComment = commentsList.value.find((i2) => i2.commentId === mark.attrs.id);
|
|
4352
|
+
const isLastIteration = trackedChanges.length === index2 + 1;
|
|
4340
4353
|
if (foundComment) {
|
|
4354
|
+
if (isLastIteration) {
|
|
4355
|
+
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
4356
|
+
dispatch(tr);
|
|
4357
|
+
}
|
|
4341
4358
|
return;
|
|
4342
4359
|
}
|
|
4343
|
-
const { dispatch } = editor.view;
|
|
4344
|
-
const { tr } = editor.view.state;
|
|
4345
4360
|
const markMetaKeys = {
|
|
4346
4361
|
trackInsert: "insertedMark",
|
|
4347
4362
|
trackDelete: "deletionMark",
|
|
@@ -4349,7 +4364,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
|
|
|
4349
4364
|
};
|
|
4350
4365
|
const markKeyName = markMetaKeys[mark.type.name];
|
|
4351
4366
|
if (markKeyName) {
|
|
4352
|
-
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
4367
|
+
if (isLastIteration) tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
4368
|
+
tr.setMeta(CommentsPluginKey, { type: "forceTrackChanges" });
|
|
4353
4369
|
tr.setMeta(TrackChangesBasePluginKey, { [markKeyName]: mark });
|
|
4354
4370
|
dispatch(tr);
|
|
4355
4371
|
}
|
|
@@ -47773,7 +47789,7 @@ class SuperDoc extends EventEmitter {
|
|
|
47773
47789
|
this.config.colors = shuffleArray(this.config.colors);
|
|
47774
47790
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
47775
47791
|
this.colorIndex = 0;
|
|
47776
|
-
this.version = "0.13.0-next.
|
|
47792
|
+
this.version = "0.13.0-next.5";
|
|
47777
47793
|
console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
47778
47794
|
this.superdocId = config.superdocId || v4();
|
|
47779
47795
|
this.colors = this.config.colors;
|
package/dist/superdoc.umd.js
CHANGED
|
@@ -30770,7 +30770,7 @@
|
|
|
30770
30770
|
return;
|
|
30771
30771
|
}
|
|
30772
30772
|
}
|
|
30773
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.
|
|
30773
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.5") {
|
|
30774
30774
|
const customLocation = "docProps/custom.xml";
|
|
30775
30775
|
if (!docx[customLocation]) {
|
|
30776
30776
|
docx[customLocation] = generateCustomXml();
|
|
@@ -31237,7 +31237,7 @@
|
|
|
31237
31237
|
function generateCustomXml() {
|
|
31238
31238
|
return DEFAULT_CUSTOM_XML;
|
|
31239
31239
|
}
|
|
31240
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.
|
|
31240
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.5") {
|
|
31241
31241
|
return {
|
|
31242
31242
|
type: "element",
|
|
31243
31243
|
name: "property",
|
|
@@ -46759,7 +46759,7 @@
|
|
|
46759
46759
|
if (isPaginationInit) shouldUpdate = true;
|
|
46760
46760
|
const meta = tr.getMeta(CommentsPluginKey);
|
|
46761
46761
|
const { type: type2 } = meta || {};
|
|
46762
|
-
if (type2 === "force") shouldUpdate = true;
|
|
46762
|
+
if (type2 === "force" || type2 === "forceTrackChanges") shouldUpdate = true;
|
|
46763
46763
|
if (!isPaginationInit && !shouldUpdate && meta && meta.decorations) {
|
|
46764
46764
|
return {
|
|
46765
46765
|
...pluginState,
|
|
@@ -48041,7 +48041,9 @@
|
|
|
48041
48041
|
// async (file) => url;
|
|
48042
48042
|
handleImageUpload: null,
|
|
48043
48043
|
// telemetry
|
|
48044
|
-
telemetry: null
|
|
48044
|
+
telemetry: null,
|
|
48045
|
+
// Docx xml updated by User
|
|
48046
|
+
customUpdatedFiles: {}
|
|
48045
48047
|
});
|
|
48046
48048
|
__privateMethod$1(this, _Editor_instances, initContainerElement_fn).call(this, options2);
|
|
48047
48049
|
__privateMethod$1(this, _Editor_instances, checkHeadless_fn).call(this, options2);
|
|
@@ -48547,6 +48549,7 @@
|
|
|
48547
48549
|
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
48548
48550
|
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
48549
48551
|
const updatedDocs = {
|
|
48552
|
+
...this.options.customUpdatedFiles,
|
|
48550
48553
|
"word/document.xml": String(documentXml),
|
|
48551
48554
|
"docProps/custom.xml": String(customXml),
|
|
48552
48555
|
"word/settings.xml": String(customSettings),
|
|
@@ -48614,7 +48617,7 @@
|
|
|
48614
48617
|
* @returns {Object | void} Migration results
|
|
48615
48618
|
*/
|
|
48616
48619
|
processCollaborationMigrations() {
|
|
48617
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.
|
|
48620
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.5");
|
|
48618
48621
|
if (!this.options.ydoc) return;
|
|
48619
48622
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
48620
48623
|
let docVersion = metaMap.get("version");
|
|
@@ -48667,6 +48670,35 @@
|
|
|
48667
48670
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
48668
48671
|
}
|
|
48669
48672
|
}
|
|
48673
|
+
/**
|
|
48674
|
+
* Get internal docx file content
|
|
48675
|
+
* @param {string} name - File name
|
|
48676
|
+
* @param {string} type - type of result (json, string)
|
|
48677
|
+
* @returns {Object|String} - file content
|
|
48678
|
+
*/
|
|
48679
|
+
getInternalXmlFile(name, type2 = "json") {
|
|
48680
|
+
if (!this.converter.convertedXml[name]) {
|
|
48681
|
+
console.warn("Cannot find file in docx");
|
|
48682
|
+
return null;
|
|
48683
|
+
}
|
|
48684
|
+
if (type2 === "json") {
|
|
48685
|
+
return this.converter.convertedXml[name].elements[0] || null;
|
|
48686
|
+
}
|
|
48687
|
+
return this.converter.schemaToXml(this.converter.convertedXml[name].elements[0]);
|
|
48688
|
+
}
|
|
48689
|
+
/**
|
|
48690
|
+
* Update internal docx file content
|
|
48691
|
+
* @param {string} name - File name
|
|
48692
|
+
* @param {string} updatedContent - new file content
|
|
48693
|
+
*/
|
|
48694
|
+
updateInternalXmlFile(name, updatedContent) {
|
|
48695
|
+
if (typeof updatedContent === "string") {
|
|
48696
|
+
this.options.customUpdatedFiles[name] = String(updatedContent);
|
|
48697
|
+
} else {
|
|
48698
|
+
const internalFileXml = this.converter.schemaToXml(updatedContent);
|
|
48699
|
+
this.options.customUpdatedFiles[name] = String(internalFileXml);
|
|
48700
|
+
}
|
|
48701
|
+
}
|
|
48670
48702
|
/**
|
|
48671
48703
|
* Get all nodes of a specific type
|
|
48672
48704
|
* @param {string} type - Node type
|
|
@@ -50313,6 +50345,9 @@
|
|
|
50313
50345
|
let { doc: doc2, tr } = newState;
|
|
50314
50346
|
let listsBySyncId = {};
|
|
50315
50347
|
doc2.descendants((node2, pos) => {
|
|
50348
|
+
if (node2.type.name === "paragraph") {
|
|
50349
|
+
return false;
|
|
50350
|
+
}
|
|
50316
50351
|
if (node2.type.name === "orderedList" && !!node2.attrs.syncId) {
|
|
50317
50352
|
let syncId = node2.attrs.syncId;
|
|
50318
50353
|
if (!listsBySyncId[syncId]) listsBySyncId[syncId] = [];
|
|
@@ -50442,6 +50477,9 @@
|
|
|
50442
50477
|
let { doc: doc2 } = state2;
|
|
50443
50478
|
let map2 = /* @__PURE__ */ new Map();
|
|
50444
50479
|
doc2.descendants((node2, pos) => {
|
|
50480
|
+
if (node2.type.name === "paragraph") {
|
|
50481
|
+
return false;
|
|
50482
|
+
}
|
|
50445
50483
|
let { attrs } = node2;
|
|
50446
50484
|
let isListItem = node2.type.name === "listItem";
|
|
50447
50485
|
let hasListLevel = !!attrs.listLevel?.length;
|
|
@@ -50462,6 +50500,9 @@
|
|
|
50462
50500
|
let { doc: doc2 } = state2;
|
|
50463
50501
|
let allItems = [];
|
|
50464
50502
|
doc2.descendants((node2, pos) => {
|
|
50503
|
+
if (node2.type.name === "paragraph") {
|
|
50504
|
+
return false;
|
|
50505
|
+
}
|
|
50465
50506
|
let isListItem = node2.type.name === "listItem";
|
|
50466
50507
|
let $pos = doc2.resolve(pos);
|
|
50467
50508
|
if (isListItem && $pos.parent === list) {
|
|
@@ -50837,7 +50878,15 @@
|
|
|
50837
50878
|
let { doc: doc2, storedMarks } = state2;
|
|
50838
50879
|
let decorations = [];
|
|
50839
50880
|
if (Array.isArray(storedMarks)) marks.push(...storedMarks);
|
|
50840
|
-
let listItems =
|
|
50881
|
+
let listItems = [];
|
|
50882
|
+
doc2.descendants((node2, pos) => {
|
|
50883
|
+
if (node2.type.name === "paragraph") {
|
|
50884
|
+
return false;
|
|
50885
|
+
}
|
|
50886
|
+
if (node2.type.name === "listItem") {
|
|
50887
|
+
listItems.push({ node: node2, pos });
|
|
50888
|
+
}
|
|
50889
|
+
});
|
|
50841
50890
|
if (!listItems.length) {
|
|
50842
50891
|
return decorations;
|
|
50843
50892
|
}
|
|
@@ -51414,6 +51463,7 @@
|
|
|
51414
51463
|
return DecorationSet.create(state2.doc, decorations);
|
|
51415
51464
|
},
|
|
51416
51465
|
apply(tr, oldDecorationSet, oldState, newState) {
|
|
51466
|
+
if (!tr.docChanged) return oldDecorationSet;
|
|
51417
51467
|
const decorations = getDropcapDecorations(newState, view);
|
|
51418
51468
|
return DecorationSet.create(newState.doc, decorations);
|
|
51419
51469
|
}
|
|
@@ -51430,11 +51480,14 @@
|
|
|
51430
51480
|
const getDropcapDecorations = (state2, view) => {
|
|
51431
51481
|
let decorations = [];
|
|
51432
51482
|
state2.doc.descendants((node2, pos) => {
|
|
51433
|
-
if (node2.
|
|
51434
|
-
|
|
51435
|
-
|
|
51436
|
-
|
|
51437
|
-
|
|
51483
|
+
if (node2.type.name === "paragraph") {
|
|
51484
|
+
if (node2.attrs.dropcap?.type === "margin") {
|
|
51485
|
+
const width = getDropcapWidth(view, pos);
|
|
51486
|
+
decorations.push(
|
|
51487
|
+
Decoration.inline(pos, pos + node2.nodeSize, { style: `margin-left: -${width}px;` })
|
|
51488
|
+
);
|
|
51489
|
+
}
|
|
51490
|
+
return false;
|
|
51438
51491
|
}
|
|
51439
51492
|
});
|
|
51440
51493
|
return decorations;
|
|
@@ -51670,6 +51723,7 @@
|
|
|
51670
51723
|
return DecorationSet.create(state2.doc, decorations);
|
|
51671
51724
|
},
|
|
51672
51725
|
apply(tr, oldDecorationSet, oldState, newState) {
|
|
51726
|
+
if (!tr.docChanged) return oldDecorationSet;
|
|
51673
51727
|
const decorations = getTabDecorations(newState, view);
|
|
51674
51728
|
return DecorationSet.create(newState.doc, decorations);
|
|
51675
51729
|
}
|
|
@@ -56005,6 +56059,7 @@
|
|
|
56005
56059
|
return DecorationSet.empty;
|
|
56006
56060
|
},
|
|
56007
56061
|
apply(tr, oldDecorationSet, oldState, newState) {
|
|
56062
|
+
if (!tr.docChanged) return oldDecorationSet;
|
|
56008
56063
|
const decorations = getImagePositionDecorations(newState, view);
|
|
56009
56064
|
return DecorationSet.create(newState.doc, decorations);
|
|
56010
56065
|
}
|
|
@@ -80448,14 +80503,29 @@ ${reason}`);
|
|
|
80448
80503
|
});
|
|
80449
80504
|
addComment({ superdoc: superdoc2, comment: newComment });
|
|
80450
80505
|
});
|
|
80451
|
-
|
|
80452
|
-
|
|
80506
|
+
setTimeout(() => {
|
|
80507
|
+
createCommentForTrackChanges(editor);
|
|
80508
|
+
}, 0);
|
|
80509
|
+
};
|
|
80510
|
+
const createCommentForTrackChanges = (editor) => {
|
|
80511
|
+
let trackedChanges = index$2.getTrackChanges(editor.state);
|
|
80512
|
+
let isLargeDoc = editor.state.doc.nodeSize >= 1e5;
|
|
80513
|
+
if (isLargeDoc && trackedChanges.length) {
|
|
80514
|
+
trackedChanges = trackedChanges.slice(0, 100);
|
|
80515
|
+
}
|
|
80516
|
+
trackedChanges.forEach(({ mark }, index2) => {
|
|
80517
|
+
console.debug(`Create comment for track change: ${index2}`);
|
|
80518
|
+
const { dispatch } = editor.view;
|
|
80519
|
+
const { tr } = editor.view.state;
|
|
80453
80520
|
const foundComment = commentsList.value.find((i2) => i2.commentId === mark.attrs.id);
|
|
80521
|
+
const isLastIteration = trackedChanges.length === index2 + 1;
|
|
80454
80522
|
if (foundComment) {
|
|
80523
|
+
if (isLastIteration) {
|
|
80524
|
+
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
80525
|
+
dispatch(tr);
|
|
80526
|
+
}
|
|
80455
80527
|
return;
|
|
80456
80528
|
}
|
|
80457
|
-
const { dispatch } = editor.view;
|
|
80458
|
-
const { tr } = editor.view.state;
|
|
80459
80529
|
const markMetaKeys = {
|
|
80460
80530
|
trackInsert: "insertedMark",
|
|
80461
80531
|
trackDelete: "deletionMark",
|
|
@@ -80463,7 +80533,8 @@ ${reason}`);
|
|
|
80463
80533
|
};
|
|
80464
80534
|
const markKeyName = markMetaKeys[mark.type.name];
|
|
80465
80535
|
if (markKeyName) {
|
|
80466
|
-
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
80536
|
+
if (isLastIteration) tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
80537
|
+
tr.setMeta(CommentsPluginKey, { type: "forceTrackChanges" });
|
|
80467
80538
|
tr.setMeta(TrackChangesBasePluginKey, { [markKeyName]: mark });
|
|
80468
80539
|
dispatch(tr);
|
|
80469
80540
|
}
|
|
@@ -93238,7 +93309,7 @@ ${style2}
|
|
|
93238
93309
|
this.config.colors = shuffleArray(this.config.colors);
|
|
93239
93310
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
93240
93311
|
this.colorIndex = 0;
|
|
93241
|
-
this.version = "0.13.0-next.
|
|
93312
|
+
this.version = "0.13.0-next.5";
|
|
93242
93313
|
console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
93243
93314
|
this.superdocId = config.superdocId || v4();
|
|
93244
93315
|
this.colors = this.config.colors;
|