superdoc 0.34.4 → 0.34.6
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-CL_-YyBC.es.js → PdfViewer-BrE01k0i.es.js} +1 -1
- package/dist/chunks/{PdfViewer-CcDvbfeP.cjs → PdfViewer-BrSBsHiz.cjs} +1 -1
- package/dist/chunks/{index-DPjn4rpi-Bs9-iTbY.cjs → index-DD7_Re-5-B48aEbZz.cjs} +1 -1
- package/dist/chunks/{index-DPjn4rpi-BwmVppCt.es.js → index-DD7_Re-5-CzvmaphZ.es.js} +1 -1
- package/dist/chunks/{index-Cp_Yy4vP.cjs → index-GFozhkXc.cjs} +3 -3
- package/dist/chunks/{index-oLU8CBCH.es.js → index-ZlsBnxiE.es.js} +3 -3
- package/dist/chunks/{super-editor.es-C350__qM.es.js → super-editor.es-DyBhGWdJ.es.js} +55 -16
- package/dist/chunks/{super-editor.es-C2FJLfJa.cjs → super-editor.es-k87Y2gby.cjs} +55 -16
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-KW3z-Mzc.js → converter-DW2wtoOn.js} +23 -6
- package/dist/super-editor/chunks/{docx-zipper-CYtxqNuc.js → docx-zipper-Bo5xY0tG.js} +1 -1
- package/dist/super-editor/chunks/{editor-CTHJwQNA.js → editor-VFipfW_y.js} +34 -12
- package/dist/super-editor/chunks/{index-DPjn4rpi.js → index-DD7_Re-5.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-BUz0UuKQ.js → toolbar-B1x6Bp3N.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/super-editor/src/core/super-converter/helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/del/del-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ins/ins-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +5 -0
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +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 +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +57 -18
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as defineComponent, y as h, O as Transition, $ 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, v as createVNode, x as unref } from "./vue-CKmzTNVs.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-ZlsBnxiE.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-Cwv-wUpm.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-GFozhkXc.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -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-k87Y2gby.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-k87Y2gby.cjs");
|
|
3
3
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
4
4
|
const eventemitter3 = require("./eventemitter3-DmHNHvFX.cjs");
|
|
5
5
|
const provider = require("@hocuspocus/provider");
|
|
@@ -17219,7 +17219,7 @@ const _sfc_main = {
|
|
|
17219
17219
|
__name: "SuperDoc",
|
|
17220
17220
|
emits: ["selection-update"],
|
|
17221
17221
|
setup(__props, { emit: __emit }) {
|
|
17222
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17222
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BrSBsHiz.cjs")));
|
|
17223
17223
|
const superdocStore = useSuperdocStore();
|
|
17224
17224
|
const commentsStore = useCommentsStore();
|
|
17225
17225
|
const {
|
|
@@ -17983,7 +17983,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
17983
17983
|
this.config.colors = shuffleArray(this.config.colors);
|
|
17984
17984
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
17985
17985
|
this.colorIndex = 0;
|
|
17986
|
-
this.version = "0.34.
|
|
17986
|
+
this.version = "0.34.6";
|
|
17987
17987
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
17988
17988
|
this.superdocId = config.superdocId || uuid.v4();
|
|
17989
17989
|
this.colors = this.config.colors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as index, 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, 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-DyBhGWdJ.es.js";
|
|
2
2
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
3
3
|
import { E as EventEmitter } from "./eventemitter3-hYlnBzSA.es.js";
|
|
4
4
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -17202,7 +17202,7 @@ const _sfc_main = {
|
|
|
17202
17202
|
__name: "SuperDoc",
|
|
17203
17203
|
emits: ["selection-update"],
|
|
17204
17204
|
setup(__props, { emit: __emit }) {
|
|
17205
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17205
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BrE01k0i.es.js"));
|
|
17206
17206
|
const superdocStore = useSuperdocStore();
|
|
17207
17207
|
const commentsStore = useCommentsStore();
|
|
17208
17208
|
const {
|
|
@@ -17966,7 +17966,7 @@ class SuperDoc extends EventEmitter {
|
|
|
17966
17966
|
this.config.colors = shuffleArray(this.config.colors);
|
|
17967
17967
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
17968
17968
|
this.colorIndex = 0;
|
|
17969
|
-
this.version = "0.34.
|
|
17969
|
+
this.version = "0.34.6";
|
|
17970
17970
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
17971
17971
|
this.superdocId = config.superdocId || v4();
|
|
17972
17972
|
this.colors = this.config.colors;
|
|
@@ -15380,6 +15380,9 @@ const getLineHeightValueString = (lineHeight2, defaultUnit, lineRule = "", isObj
|
|
|
15380
15380
|
let [value, unit] = parseSizeUnit(lineHeight2);
|
|
15381
15381
|
if (Number.isNaN(value) || value === 0) return {};
|
|
15382
15382
|
if (lineRule === "atLeast" && value < 1) return {};
|
|
15383
|
+
if (!unit && value < 1) {
|
|
15384
|
+
value = 1;
|
|
15385
|
+
}
|
|
15383
15386
|
unit = unit ? unit : defaultUnit;
|
|
15384
15387
|
return isObject2 ? { ["line-height"]: `${value}${unit}` } : `line-height: ${value}${unit}`;
|
|
15385
15388
|
};
|
|
@@ -32341,8 +32344,15 @@ const encode$4 = (params2, encodedAttrs = {}) => {
|
|
|
32341
32344
|
});
|
|
32342
32345
|
encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
|
|
32343
32346
|
subs.forEach((subElement) => {
|
|
32344
|
-
|
|
32345
|
-
subElement
|
|
32347
|
+
subElement.marks = [];
|
|
32348
|
+
if (subElement?.content?.[0]) {
|
|
32349
|
+
if (subElement.content[0].marks === void 0) {
|
|
32350
|
+
subElement.content[0].marks = [];
|
|
32351
|
+
}
|
|
32352
|
+
if (subElement.content[0].type === "text") {
|
|
32353
|
+
subElement.content[0].marks.push({ type: "trackDelete", attrs: encodedAttrs });
|
|
32354
|
+
}
|
|
32355
|
+
}
|
|
32346
32356
|
});
|
|
32347
32357
|
return subs;
|
|
32348
32358
|
};
|
|
@@ -32401,8 +32411,15 @@ const encode$3 = (params2, encodedAttrs = {}) => {
|
|
|
32401
32411
|
});
|
|
32402
32412
|
encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
|
|
32403
32413
|
subs.forEach((subElement) => {
|
|
32404
|
-
|
|
32405
|
-
subElement
|
|
32414
|
+
subElement.marks = [];
|
|
32415
|
+
if (subElement?.content?.[0]) {
|
|
32416
|
+
if (subElement.content[0].marks === void 0) {
|
|
32417
|
+
subElement.content[0].marks = [];
|
|
32418
|
+
}
|
|
32419
|
+
if (subElement.content[0].type === "text") {
|
|
32420
|
+
subElement.content[0].marks.push({ type: "trackInsert", attrs: encodedAttrs });
|
|
32421
|
+
}
|
|
32422
|
+
}
|
|
32406
32423
|
});
|
|
32407
32424
|
return subs;
|
|
32408
32425
|
};
|
|
@@ -35445,7 +35462,7 @@ const updateCommentsIdsAndExtensible = (comments = [], commentsIds, extensible)
|
|
|
35445
35462
|
name: "w16cex:commentExtensible",
|
|
35446
35463
|
attributes: {
|
|
35447
35464
|
"w16cex:durableId": newDurableId,
|
|
35448
|
-
"w16cex:dateUtc": toIsoNoFractional()
|
|
35465
|
+
"w16cex:dateUtc": toIsoNoFractional(comment.createdTime)
|
|
35449
35466
|
}
|
|
35450
35467
|
};
|
|
35451
35468
|
extensibleUpdated.elements[0].elements.push(newExtensible);
|
|
@@ -35758,7 +35775,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35758
35775
|
static getStoredSuperdocVersion(docx) {
|
|
35759
35776
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35760
35777
|
}
|
|
35761
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.
|
|
35778
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.6") {
|
|
35762
35779
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35763
35780
|
}
|
|
35764
35781
|
/**
|
|
@@ -54054,7 +54071,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54054
54071
|
{ default: remarkStringify },
|
|
54055
54072
|
{ default: remarkGfm }
|
|
54056
54073
|
] = await Promise.all([
|
|
54057
|
-
import("./index-
|
|
54074
|
+
import("./index-DD7_Re-5-CzvmaphZ.es.js"),
|
|
54058
54075
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
54059
54076
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
54060
54077
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -54272,7 +54289,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54272
54289
|
* @returns {Object | void} Migration results
|
|
54273
54290
|
*/
|
|
54274
54291
|
processCollaborationMigrations() {
|
|
54275
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.34.
|
|
54292
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.34.6");
|
|
54276
54293
|
if (!this.options.ydoc) return;
|
|
54277
54294
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
54278
54295
|
let docVersion = metaMap.get("version");
|
|
@@ -56909,7 +56926,7 @@ const StructuredContentCommands = Extension.create({
|
|
|
56909
56926
|
* @param {string} id - Unique identifier of the field
|
|
56910
56927
|
* @param {StructuredContentUpdate} options
|
|
56911
56928
|
* @example
|
|
56912
|
-
* editor.commands.updateStructuredContentById('123', { text: 'Jane Doe' });
|
|
56929
|
+
* editor.commands.updateStructuredContentById('123', { text: 'Jane Doe', keepTextNodeStyles: true });
|
|
56913
56930
|
* editor.commands.updateStructuredContentById('123', {
|
|
56914
56931
|
* json: { type: 'text', text: 'Jane Doe' },
|
|
56915
56932
|
* });
|
|
@@ -56930,7 +56947,9 @@ const StructuredContentCommands = Extension.create({
|
|
|
56930
56947
|
const posTo = pos + node.nodeSize;
|
|
56931
56948
|
let content = null;
|
|
56932
56949
|
if (options.text) {
|
|
56933
|
-
|
|
56950
|
+
const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
|
|
56951
|
+
const textMarks = firstTextNode ? firstTextNode.marks : [];
|
|
56952
|
+
content = schema.text(options.text, textMarks);
|
|
56934
56953
|
}
|
|
56935
56954
|
if (options.html) {
|
|
56936
56955
|
const html = htmlHandler(options.html, editor);
|
|
@@ -56944,6 +56963,13 @@ const StructuredContentCommands = Extension.create({
|
|
|
56944
56963
|
content = node.content;
|
|
56945
56964
|
}
|
|
56946
56965
|
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
56966
|
+
try {
|
|
56967
|
+
const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
|
|
56968
|
+
nodeForValidation.check();
|
|
56969
|
+
} catch (error) {
|
|
56970
|
+
console.error("Invalid content.", "Passed value:", content, "Error:", error);
|
|
56971
|
+
return false;
|
|
56972
|
+
}
|
|
56947
56973
|
tr.replaceWith(posFrom, posTo, updatedNode);
|
|
56948
56974
|
}
|
|
56949
56975
|
return true;
|
|
@@ -57028,7 +57054,7 @@ const StructuredContentCommands = Extension.create({
|
|
|
57028
57054
|
* @param {StructuredContentUpdate} options
|
|
57029
57055
|
* @example
|
|
57030
57056
|
* // Update all fields in the customer-info group
|
|
57031
|
-
* editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe' });
|
|
57057
|
+
* editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe', keepTextNodeStyles: true });
|
|
57032
57058
|
*
|
|
57033
57059
|
* // Update block content in a group
|
|
57034
57060
|
* editor.commands.updateStructuredContentByGroup('terms-section', {
|
|
@@ -57042,13 +57068,14 @@ const StructuredContentCommands = Extension.create({
|
|
|
57042
57068
|
}
|
|
57043
57069
|
const { schema } = editor;
|
|
57044
57070
|
if (dispatch) {
|
|
57045
|
-
|
|
57071
|
+
const updates = [];
|
|
57072
|
+
for (const structuredContent of structuredContentTags) {
|
|
57046
57073
|
const { pos, node } = structuredContent;
|
|
57047
|
-
const posFrom = tr.mapping.map(pos);
|
|
57048
|
-
const posTo = tr.mapping.map(pos + node.nodeSize);
|
|
57049
57074
|
let content = null;
|
|
57050
57075
|
if (options.text) {
|
|
57051
|
-
|
|
57076
|
+
const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
|
|
57077
|
+
const textMarks = firstTextNode ? firstTextNode.marks : [];
|
|
57078
|
+
content = schema.text(options.text, textMarks);
|
|
57052
57079
|
}
|
|
57053
57080
|
if (options.html) {
|
|
57054
57081
|
const html = htmlHandler(options.html, editor);
|
|
@@ -57062,11 +57089,23 @@ const StructuredContentCommands = Extension.create({
|
|
|
57062
57089
|
content = node.content;
|
|
57063
57090
|
}
|
|
57064
57091
|
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
57092
|
+
try {
|
|
57093
|
+
const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
|
|
57094
|
+
nodeForValidation.check();
|
|
57095
|
+
} catch (error) {
|
|
57096
|
+
console.error("Invalid content.", "Passed value:", content, "Error:", error);
|
|
57097
|
+
return false;
|
|
57098
|
+
}
|
|
57099
|
+
updates.push({ pos, node, updatedNode });
|
|
57100
|
+
}
|
|
57101
|
+
for (const { pos, node, updatedNode } of updates) {
|
|
57102
|
+
const posFrom = tr.mapping.map(pos);
|
|
57103
|
+
const posTo = tr.mapping.map(pos + node.nodeSize);
|
|
57065
57104
|
const currentNode = tr.doc.nodeAt(posFrom);
|
|
57066
57105
|
if (currentNode && node.eq(currentNode)) {
|
|
57067
57106
|
tr.replaceWith(posFrom, posTo, updatedNode);
|
|
57068
57107
|
}
|
|
57069
|
-
}
|
|
57108
|
+
}
|
|
57070
57109
|
}
|
|
57071
57110
|
return true;
|
|
57072
57111
|
},
|
|
@@ -15397,6 +15397,9 @@ const getLineHeightValueString = (lineHeight2, defaultUnit, lineRule = "", isObj
|
|
|
15397
15397
|
let [value, unit] = parseSizeUnit(lineHeight2);
|
|
15398
15398
|
if (Number.isNaN(value) || value === 0) return {};
|
|
15399
15399
|
if (lineRule === "atLeast" && value < 1) return {};
|
|
15400
|
+
if (!unit && value < 1) {
|
|
15401
|
+
value = 1;
|
|
15402
|
+
}
|
|
15400
15403
|
unit = unit ? unit : defaultUnit;
|
|
15401
15404
|
return isObject2 ? { ["line-height"]: `${value}${unit}` } : `line-height: ${value}${unit}`;
|
|
15402
15405
|
};
|
|
@@ -32358,8 +32361,15 @@ const encode$4 = (params2, encodedAttrs = {}) => {
|
|
|
32358
32361
|
});
|
|
32359
32362
|
encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
|
|
32360
32363
|
subs.forEach((subElement) => {
|
|
32361
|
-
|
|
32362
|
-
subElement
|
|
32364
|
+
subElement.marks = [];
|
|
32365
|
+
if (subElement?.content?.[0]) {
|
|
32366
|
+
if (subElement.content[0].marks === void 0) {
|
|
32367
|
+
subElement.content[0].marks = [];
|
|
32368
|
+
}
|
|
32369
|
+
if (subElement.content[0].type === "text") {
|
|
32370
|
+
subElement.content[0].marks.push({ type: "trackDelete", attrs: encodedAttrs });
|
|
32371
|
+
}
|
|
32372
|
+
}
|
|
32363
32373
|
});
|
|
32364
32374
|
return subs;
|
|
32365
32375
|
};
|
|
@@ -32418,8 +32428,15 @@ const encode$3 = (params2, encodedAttrs = {}) => {
|
|
|
32418
32428
|
});
|
|
32419
32429
|
encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
|
|
32420
32430
|
subs.forEach((subElement) => {
|
|
32421
|
-
|
|
32422
|
-
subElement
|
|
32431
|
+
subElement.marks = [];
|
|
32432
|
+
if (subElement?.content?.[0]) {
|
|
32433
|
+
if (subElement.content[0].marks === void 0) {
|
|
32434
|
+
subElement.content[0].marks = [];
|
|
32435
|
+
}
|
|
32436
|
+
if (subElement.content[0].type === "text") {
|
|
32437
|
+
subElement.content[0].marks.push({ type: "trackInsert", attrs: encodedAttrs });
|
|
32438
|
+
}
|
|
32439
|
+
}
|
|
32423
32440
|
});
|
|
32424
32441
|
return subs;
|
|
32425
32442
|
};
|
|
@@ -35462,7 +35479,7 @@ const updateCommentsIdsAndExtensible = (comments = [], commentsIds, extensible)
|
|
|
35462
35479
|
name: "w16cex:commentExtensible",
|
|
35463
35480
|
attributes: {
|
|
35464
35481
|
"w16cex:durableId": newDurableId,
|
|
35465
|
-
"w16cex:dateUtc": toIsoNoFractional()
|
|
35482
|
+
"w16cex:dateUtc": toIsoNoFractional(comment.createdTime)
|
|
35466
35483
|
}
|
|
35467
35484
|
};
|
|
35468
35485
|
extensibleUpdated.elements[0].elements.push(newExtensible);
|
|
@@ -35775,7 +35792,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35775
35792
|
static getStoredSuperdocVersion(docx) {
|
|
35776
35793
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35777
35794
|
}
|
|
35778
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.
|
|
35795
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.6") {
|
|
35779
35796
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35780
35797
|
}
|
|
35781
35798
|
/**
|
|
@@ -54071,7 +54088,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54071
54088
|
{ default: remarkStringify },
|
|
54072
54089
|
{ default: remarkGfm }
|
|
54073
54090
|
] = await Promise.all([
|
|
54074
|
-
Promise.resolve().then(() => require("./index-
|
|
54091
|
+
Promise.resolve().then(() => require("./index-DD7_Re-5-B48aEbZz.cjs")),
|
|
54075
54092
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
54076
54093
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
54077
54094
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -54289,7 +54306,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54289
54306
|
* @returns {Object | void} Migration results
|
|
54290
54307
|
*/
|
|
54291
54308
|
processCollaborationMigrations() {
|
|
54292
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.34.
|
|
54309
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.34.6");
|
|
54293
54310
|
if (!this.options.ydoc) return;
|
|
54294
54311
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
54295
54312
|
let docVersion = metaMap.get("version");
|
|
@@ -56926,7 +56943,7 @@ const StructuredContentCommands = Extension.create({
|
|
|
56926
56943
|
* @param {string} id - Unique identifier of the field
|
|
56927
56944
|
* @param {StructuredContentUpdate} options
|
|
56928
56945
|
* @example
|
|
56929
|
-
* editor.commands.updateStructuredContentById('123', { text: 'Jane Doe' });
|
|
56946
|
+
* editor.commands.updateStructuredContentById('123', { text: 'Jane Doe', keepTextNodeStyles: true });
|
|
56930
56947
|
* editor.commands.updateStructuredContentById('123', {
|
|
56931
56948
|
* json: { type: 'text', text: 'Jane Doe' },
|
|
56932
56949
|
* });
|
|
@@ -56947,7 +56964,9 @@ const StructuredContentCommands = Extension.create({
|
|
|
56947
56964
|
const posTo = pos + node.nodeSize;
|
|
56948
56965
|
let content = null;
|
|
56949
56966
|
if (options.text) {
|
|
56950
|
-
|
|
56967
|
+
const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
|
|
56968
|
+
const textMarks = firstTextNode ? firstTextNode.marks : [];
|
|
56969
|
+
content = schema.text(options.text, textMarks);
|
|
56951
56970
|
}
|
|
56952
56971
|
if (options.html) {
|
|
56953
56972
|
const html = htmlHandler(options.html, editor);
|
|
@@ -56961,6 +56980,13 @@ const StructuredContentCommands = Extension.create({
|
|
|
56961
56980
|
content = node.content;
|
|
56962
56981
|
}
|
|
56963
56982
|
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
56983
|
+
try {
|
|
56984
|
+
const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
|
|
56985
|
+
nodeForValidation.check();
|
|
56986
|
+
} catch (error) {
|
|
56987
|
+
console.error("Invalid content.", "Passed value:", content, "Error:", error);
|
|
56988
|
+
return false;
|
|
56989
|
+
}
|
|
56964
56990
|
tr.replaceWith(posFrom, posTo, updatedNode);
|
|
56965
56991
|
}
|
|
56966
56992
|
return true;
|
|
@@ -57045,7 +57071,7 @@ const StructuredContentCommands = Extension.create({
|
|
|
57045
57071
|
* @param {StructuredContentUpdate} options
|
|
57046
57072
|
* @example
|
|
57047
57073
|
* // Update all fields in the customer-info group
|
|
57048
|
-
* editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe' });
|
|
57074
|
+
* editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe', keepTextNodeStyles: true });
|
|
57049
57075
|
*
|
|
57050
57076
|
* // Update block content in a group
|
|
57051
57077
|
* editor.commands.updateStructuredContentByGroup('terms-section', {
|
|
@@ -57059,13 +57085,14 @@ const StructuredContentCommands = Extension.create({
|
|
|
57059
57085
|
}
|
|
57060
57086
|
const { schema } = editor;
|
|
57061
57087
|
if (dispatch) {
|
|
57062
|
-
|
|
57088
|
+
const updates = [];
|
|
57089
|
+
for (const structuredContent of structuredContentTags) {
|
|
57063
57090
|
const { pos, node } = structuredContent;
|
|
57064
|
-
const posFrom = tr.mapping.map(pos);
|
|
57065
|
-
const posTo = tr.mapping.map(pos + node.nodeSize);
|
|
57066
57091
|
let content = null;
|
|
57067
57092
|
if (options.text) {
|
|
57068
|
-
|
|
57093
|
+
const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
|
|
57094
|
+
const textMarks = firstTextNode ? firstTextNode.marks : [];
|
|
57095
|
+
content = schema.text(options.text, textMarks);
|
|
57069
57096
|
}
|
|
57070
57097
|
if (options.html) {
|
|
57071
57098
|
const html = htmlHandler(options.html, editor);
|
|
@@ -57079,11 +57106,23 @@ const StructuredContentCommands = Extension.create({
|
|
|
57079
57106
|
content = node.content;
|
|
57080
57107
|
}
|
|
57081
57108
|
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
57109
|
+
try {
|
|
57110
|
+
const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
|
|
57111
|
+
nodeForValidation.check();
|
|
57112
|
+
} catch (error) {
|
|
57113
|
+
console.error("Invalid content.", "Passed value:", content, "Error:", error);
|
|
57114
|
+
return false;
|
|
57115
|
+
}
|
|
57116
|
+
updates.push({ pos, node, updatedNode });
|
|
57117
|
+
}
|
|
57118
|
+
for (const { pos, node, updatedNode } of updates) {
|
|
57119
|
+
const posFrom = tr.mapping.map(pos);
|
|
57120
|
+
const posTo = tr.mapping.map(pos + node.nodeSize);
|
|
57082
57121
|
const currentNode = tr.doc.nodeAt(posFrom);
|
|
57083
57122
|
if (currentNode && node.eq(currentNode)) {
|
|
57084
57123
|
tr.replaceWith(posFrom, posTo, updatedNode);
|
|
57085
57124
|
}
|
|
57086
|
-
}
|
|
57125
|
+
}
|
|
57087
57126
|
}
|
|
57088
57127
|
return true;
|
|
57089
57128
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
|
|
2
|
-
import { T as TextSelection } from "./chunks/converter-
|
|
3
|
-
import { _ as _export_sfc } from "./chunks/editor-
|
|
2
|
+
import { T as TextSelection } from "./chunks/converter-DW2wtoOn.js";
|
|
3
|
+
import { _ as _export_sfc } from "./chunks/editor-VFipfW_y.js";
|
|
4
4
|
const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
|
|
5
5
|
const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
|
|
6
6
|
async function baseInsightsFetch(payload, options = {}) {
|
|
@@ -15377,6 +15377,9 @@ const getLineHeightValueString = (lineHeight, defaultUnit, lineRule = "", isObje
|
|
|
15377
15377
|
let [value, unit] = parseSizeUnit(lineHeight);
|
|
15378
15378
|
if (Number.isNaN(value) || value === 0) return {};
|
|
15379
15379
|
if (lineRule === "atLeast" && value < 1) return {};
|
|
15380
|
+
if (!unit && value < 1) {
|
|
15381
|
+
value = 1;
|
|
15382
|
+
}
|
|
15380
15383
|
unit = unit ? unit : defaultUnit;
|
|
15381
15384
|
return isObject ? { ["line-height"]: `${value}${unit}` } : `line-height: ${value}${unit}`;
|
|
15382
15385
|
};
|
|
@@ -32347,8 +32350,15 @@ const encode$4 = (params, encodedAttrs = {}) => {
|
|
|
32347
32350
|
});
|
|
32348
32351
|
encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
|
|
32349
32352
|
subs.forEach((subElement) => {
|
|
32350
|
-
|
|
32351
|
-
subElement
|
|
32353
|
+
subElement.marks = [];
|
|
32354
|
+
if (subElement?.content?.[0]) {
|
|
32355
|
+
if (subElement.content[0].marks === void 0) {
|
|
32356
|
+
subElement.content[0].marks = [];
|
|
32357
|
+
}
|
|
32358
|
+
if (subElement.content[0].type === "text") {
|
|
32359
|
+
subElement.content[0].marks.push({ type: "trackDelete", attrs: encodedAttrs });
|
|
32360
|
+
}
|
|
32361
|
+
}
|
|
32352
32362
|
});
|
|
32353
32363
|
return subs;
|
|
32354
32364
|
};
|
|
@@ -32407,8 +32417,15 @@ const encode$3 = (params, encodedAttrs = {}) => {
|
|
|
32407
32417
|
});
|
|
32408
32418
|
encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
|
|
32409
32419
|
subs.forEach((subElement) => {
|
|
32410
|
-
|
|
32411
|
-
subElement
|
|
32420
|
+
subElement.marks = [];
|
|
32421
|
+
if (subElement?.content?.[0]) {
|
|
32422
|
+
if (subElement.content[0].marks === void 0) {
|
|
32423
|
+
subElement.content[0].marks = [];
|
|
32424
|
+
}
|
|
32425
|
+
if (subElement.content[0].type === "text") {
|
|
32426
|
+
subElement.content[0].marks.push({ type: "trackInsert", attrs: encodedAttrs });
|
|
32427
|
+
}
|
|
32428
|
+
}
|
|
32412
32429
|
});
|
|
32413
32430
|
return subs;
|
|
32414
32431
|
};
|
|
@@ -35726,7 +35743,7 @@ const updateCommentsIdsAndExtensible = (comments = [], commentsIds, extensible)
|
|
|
35726
35743
|
name: "w16cex:commentExtensible",
|
|
35727
35744
|
attributes: {
|
|
35728
35745
|
"w16cex:durableId": newDurableId,
|
|
35729
|
-
"w16cex:dateUtc": toIsoNoFractional()
|
|
35746
|
+
"w16cex:dateUtc": toIsoNoFractional(comment.createdTime)
|
|
35730
35747
|
}
|
|
35731
35748
|
};
|
|
35732
35749
|
extensibleUpdated.elements[0].elements.push(newExtensible);
|
|
@@ -36039,7 +36056,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
36039
36056
|
static getStoredSuperdocVersion(docx) {
|
|
36040
36057
|
return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36041
36058
|
}
|
|
36042
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.34.
|
|
36059
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.34.6") {
|
|
36043
36060
|
return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
36044
36061
|
}
|
|
36045
36062
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-
|
|
1
|
+
import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-DW2wtoOn.js";
|
|
2
2
|
function commonjsRequire(path) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|
|
@@ -12,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, applyIndentStyling_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-DW2wtoOn.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-Bo5xY0tG.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -15179,7 +15179,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
15179
15179
|
{ default: remarkStringify },
|
|
15180
15180
|
{ default: remarkGfm }
|
|
15181
15181
|
] = await Promise.all([
|
|
15182
|
-
import("./index-
|
|
15182
|
+
import("./index-DD7_Re-5.js"),
|
|
15183
15183
|
import("./index-DRCvimau.js"),
|
|
15184
15184
|
import("./index-C_x_N6Uh.js"),
|
|
15185
15185
|
import("./index-D_sWOSiG.js"),
|
|
@@ -15397,7 +15397,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
15397
15397
|
* @returns {Object | void} Migration results
|
|
15398
15398
|
*/
|
|
15399
15399
|
processCollaborationMigrations() {
|
|
15400
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.34.
|
|
15400
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.34.6");
|
|
15401
15401
|
if (!this.options.ydoc) return;
|
|
15402
15402
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
15403
15403
|
let docVersion = metaMap.get("version");
|
|
@@ -18155,7 +18155,7 @@ const StructuredContentCommands = Extension.create({
|
|
|
18155
18155
|
* @param {string} id - Unique identifier of the field
|
|
18156
18156
|
* @param {StructuredContentUpdate} options
|
|
18157
18157
|
* @example
|
|
18158
|
-
* editor.commands.updateStructuredContentById('123', { text: 'Jane Doe' });
|
|
18158
|
+
* editor.commands.updateStructuredContentById('123', { text: 'Jane Doe', keepTextNodeStyles: true });
|
|
18159
18159
|
* editor.commands.updateStructuredContentById('123', {
|
|
18160
18160
|
* json: { type: 'text', text: 'Jane Doe' },
|
|
18161
18161
|
* });
|
|
@@ -18176,7 +18176,9 @@ const StructuredContentCommands = Extension.create({
|
|
|
18176
18176
|
const posTo = pos + node.nodeSize;
|
|
18177
18177
|
let content = null;
|
|
18178
18178
|
if (options.text) {
|
|
18179
|
-
|
|
18179
|
+
const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
|
|
18180
|
+
const textMarks = firstTextNode ? firstTextNode.marks : [];
|
|
18181
|
+
content = schema.text(options.text, textMarks);
|
|
18180
18182
|
}
|
|
18181
18183
|
if (options.html) {
|
|
18182
18184
|
const html = htmlHandler(options.html, editor);
|
|
@@ -18190,6 +18192,13 @@ const StructuredContentCommands = Extension.create({
|
|
|
18190
18192
|
content = node.content;
|
|
18191
18193
|
}
|
|
18192
18194
|
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
18195
|
+
try {
|
|
18196
|
+
const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
|
|
18197
|
+
nodeForValidation.check();
|
|
18198
|
+
} catch (error) {
|
|
18199
|
+
console.error("Invalid content.", "Passed value:", content, "Error:", error);
|
|
18200
|
+
return false;
|
|
18201
|
+
}
|
|
18193
18202
|
tr.replaceWith(posFrom, posTo, updatedNode);
|
|
18194
18203
|
}
|
|
18195
18204
|
return true;
|
|
@@ -18274,7 +18283,7 @@ const StructuredContentCommands = Extension.create({
|
|
|
18274
18283
|
* @param {StructuredContentUpdate} options
|
|
18275
18284
|
* @example
|
|
18276
18285
|
* // Update all fields in the customer-info group
|
|
18277
|
-
* editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe' });
|
|
18286
|
+
* editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe', keepTextNodeStyles: true });
|
|
18278
18287
|
*
|
|
18279
18288
|
* // Update block content in a group
|
|
18280
18289
|
* editor.commands.updateStructuredContentByGroup('terms-section', {
|
|
@@ -18288,13 +18297,14 @@ const StructuredContentCommands = Extension.create({
|
|
|
18288
18297
|
}
|
|
18289
18298
|
const { schema } = editor;
|
|
18290
18299
|
if (dispatch) {
|
|
18291
|
-
|
|
18300
|
+
const updates = [];
|
|
18301
|
+
for (const structuredContent of structuredContentTags) {
|
|
18292
18302
|
const { pos, node } = structuredContent;
|
|
18293
|
-
const posFrom = tr.mapping.map(pos);
|
|
18294
|
-
const posTo = tr.mapping.map(pos + node.nodeSize);
|
|
18295
18303
|
let content = null;
|
|
18296
18304
|
if (options.text) {
|
|
18297
|
-
|
|
18305
|
+
const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
|
|
18306
|
+
const textMarks = firstTextNode ? firstTextNode.marks : [];
|
|
18307
|
+
content = schema.text(options.text, textMarks);
|
|
18298
18308
|
}
|
|
18299
18309
|
if (options.html) {
|
|
18300
18310
|
const html = htmlHandler(options.html, editor);
|
|
@@ -18308,11 +18318,23 @@ const StructuredContentCommands = Extension.create({
|
|
|
18308
18318
|
content = node.content;
|
|
18309
18319
|
}
|
|
18310
18320
|
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
18321
|
+
try {
|
|
18322
|
+
const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
|
|
18323
|
+
nodeForValidation.check();
|
|
18324
|
+
} catch (error) {
|
|
18325
|
+
console.error("Invalid content.", "Passed value:", content, "Error:", error);
|
|
18326
|
+
return false;
|
|
18327
|
+
}
|
|
18328
|
+
updates.push({ pos, node, updatedNode });
|
|
18329
|
+
}
|
|
18330
|
+
for (const { pos, node, updatedNode } of updates) {
|
|
18331
|
+
const posFrom = tr.mapping.map(pos);
|
|
18332
|
+
const posTo = tr.mapping.map(pos + node.nodeSize);
|
|
18311
18333
|
const currentNode = tr.doc.nodeAt(posFrom);
|
|
18312
18334
|
if (currentNode && node.eq(currentNode)) {
|
|
18313
18335
|
tr.replaceWith(posFrom, posTo, updatedNode);
|
|
18314
18336
|
}
|
|
18315
|
-
}
|
|
18337
|
+
}
|
|
18316
18338
|
}
|
|
18317
18339
|
return true;
|
|
18318
18340
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
|
|
2
|
-
import { p as process$1 } from "./converter-
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { p as process$1 } from "./converter-DW2wtoOn.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-VFipfW_y.js";
|
|
4
4
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
5
5
|
let sanitized = value.replace(/[^0-9.]/g, "");
|
|
6
6
|
sanitized = parseFloat(sanitized);
|