superdoc 0.34.4 → 0.34.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.
Files changed (31) hide show
  1. package/dist/chunks/{PdfViewer-CcDvbfeP.cjs → PdfViewer-DRQmW5MW.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CL_-YyBC.es.js → PdfViewer-DTAOrhGM.es.js} +1 -1
  3. package/dist/chunks/{index-DPjn4rpi-Bs9-iTbY.cjs → index-BO0dc2dg-BiqxnA1k.cjs} +1 -1
  4. package/dist/chunks/{index-DPjn4rpi-BwmVppCt.es.js → index-BO0dc2dg-DpvJHkle.es.js} +1 -1
  5. package/dist/chunks/{index-Cp_Yy4vP.cjs → index-C_RM2IcG.cjs} +3 -3
  6. package/dist/chunks/{index-oLU8CBCH.es.js → index-wvwkg6PD.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-C350__qM.es.js → super-editor.es-CfMROBHl.es.js} +52 -16
  8. package/dist/chunks/{super-editor.es-C2FJLfJa.cjs → super-editor.es-VtmcJzKs.cjs} +52 -16
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-KW3z-Mzc.js → converter-PA_XpTWF.js} +20 -6
  11. package/dist/super-editor/chunks/{docx-zipper-CYtxqNuc.js → docx-zipper-gaQWcuwh.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-CTHJwQNA.js → editor-CAqYW4R2.js} +34 -12
  13. package/dist/super-editor/chunks/{index-DPjn4rpi.js → index-BO0dc2dg.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-BUz0UuKQ.js → toolbar-BgNvrbei.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/del/del-translator.d.ts.map +1 -1
  20. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ins/ins-translator.d.ts.map +1 -1
  21. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +5 -0
  22. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +1 -1
  23. package/dist/super-editor/super-editor.es.js +6 -6
  24. package/dist/super-editor/toolbar.es.js +2 -2
  25. package/dist/super-editor.cjs +1 -1
  26. package/dist/super-editor.es.js +1 -1
  27. package/dist/superdoc.cjs +2 -2
  28. package/dist/superdoc.es.js +2 -2
  29. package/dist/superdoc.umd.js +54 -18
  30. package/dist/superdoc.umd.js.map +1 -1
  31. package/package.json +1 -1
@@ -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-Cp_Yy4vP.cjs");
4
+ const superdoc = require("./index-C_RM2IcG.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -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-oLU8CBCH.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-wvwkg6PD.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  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-C2FJLfJa.cjs");
3
+ const superEditor_es = require("./super-editor.es-VtmcJzKs.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-C350__qM.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-CfMROBHl.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-C2FJLfJa.cjs");
2
+ const superEditor_es = require("./super-editor.es-VtmcJzKs.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-CcDvbfeP.cjs")));
17222
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DRQmW5MW.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.4";
17986
+ this.version = "0.34.5";
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-C350__qM.es.js";
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-CfMROBHl.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-CL_-YyBC.es.js"));
17205
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DTAOrhGM.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.4";
17969
+ this.version = "0.34.5";
17970
17970
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17971
17971
  this.superdocId = config.superdocId || v4();
17972
17972
  this.colors = this.config.colors;
@@ -32341,8 +32341,15 @@ const encode$4 = (params2, encodedAttrs = {}) => {
32341
32341
  });
32342
32342
  encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
32343
32343
  subs.forEach((subElement) => {
32344
- if (subElement.marks === void 0) subElement.marks = [];
32345
- subElement.marks.push({ type: "trackDelete", attrs: encodedAttrs });
32344
+ subElement.marks = [];
32345
+ if (subElement?.content?.[0]) {
32346
+ if (subElement.content[0].marks === void 0) {
32347
+ subElement.content[0].marks = [];
32348
+ }
32349
+ if (subElement.content[0].type === "text") {
32350
+ subElement.content[0].marks.push({ type: "trackDelete", attrs: encodedAttrs });
32351
+ }
32352
+ }
32346
32353
  });
32347
32354
  return subs;
32348
32355
  };
@@ -32401,8 +32408,15 @@ const encode$3 = (params2, encodedAttrs = {}) => {
32401
32408
  });
32402
32409
  encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
32403
32410
  subs.forEach((subElement) => {
32404
- if (subElement.marks === void 0) subElement.marks = [];
32405
- subElement.marks.push({ type: "trackInsert", attrs: encodedAttrs });
32411
+ subElement.marks = [];
32412
+ if (subElement?.content?.[0]) {
32413
+ if (subElement.content[0].marks === void 0) {
32414
+ subElement.content[0].marks = [];
32415
+ }
32416
+ if (subElement.content[0].type === "text") {
32417
+ subElement.content[0].marks.push({ type: "trackInsert", attrs: encodedAttrs });
32418
+ }
32419
+ }
32406
32420
  });
32407
32421
  return subs;
32408
32422
  };
@@ -35445,7 +35459,7 @@ const updateCommentsIdsAndExtensible = (comments = [], commentsIds, extensible)
35445
35459
  name: "w16cex:commentExtensible",
35446
35460
  attributes: {
35447
35461
  "w16cex:durableId": newDurableId,
35448
- "w16cex:dateUtc": toIsoNoFractional()
35462
+ "w16cex:dateUtc": toIsoNoFractional(comment.createdTime)
35449
35463
  }
35450
35464
  };
35451
35465
  extensibleUpdated.elements[0].elements.push(newExtensible);
@@ -35758,7 +35772,7 @@ const _SuperConverter = class _SuperConverter2 {
35758
35772
  static getStoredSuperdocVersion(docx) {
35759
35773
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35760
35774
  }
35761
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.4") {
35775
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.5") {
35762
35776
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35763
35777
  }
35764
35778
  /**
@@ -54054,7 +54068,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
54054
54068
  { default: remarkStringify },
54055
54069
  { default: remarkGfm }
54056
54070
  ] = await Promise.all([
54057
- import("./index-DPjn4rpi-BwmVppCt.es.js"),
54071
+ import("./index-BO0dc2dg-DpvJHkle.es.js"),
54058
54072
  import("./index-DRCvimau-Cw339678.es.js"),
54059
54073
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
54060
54074
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -54272,7 +54286,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
54272
54286
  * @returns {Object | void} Migration results
54273
54287
  */
54274
54288
  processCollaborationMigrations() {
54275
- console.debug("[checkVersionMigrations] Current editor version", "0.34.4");
54289
+ console.debug("[checkVersionMigrations] Current editor version", "0.34.5");
54276
54290
  if (!this.options.ydoc) return;
54277
54291
  const metaMap = this.options.ydoc.getMap("meta");
54278
54292
  let docVersion = metaMap.get("version");
@@ -56909,7 +56923,7 @@ const StructuredContentCommands = Extension.create({
56909
56923
  * @param {string} id - Unique identifier of the field
56910
56924
  * @param {StructuredContentUpdate} options
56911
56925
  * @example
56912
- * editor.commands.updateStructuredContentById('123', { text: 'Jane Doe' });
56926
+ * editor.commands.updateStructuredContentById('123', { text: 'Jane Doe', keepTextNodeStyles: true });
56913
56927
  * editor.commands.updateStructuredContentById('123', {
56914
56928
  * json: { type: 'text', text: 'Jane Doe' },
56915
56929
  * });
@@ -56930,7 +56944,9 @@ const StructuredContentCommands = Extension.create({
56930
56944
  const posTo = pos + node.nodeSize;
56931
56945
  let content = null;
56932
56946
  if (options.text) {
56933
- content = schema.text(options.text);
56947
+ const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
56948
+ const textMarks = firstTextNode ? firstTextNode.marks : [];
56949
+ content = schema.text(options.text, textMarks);
56934
56950
  }
56935
56951
  if (options.html) {
56936
56952
  const html = htmlHandler(options.html, editor);
@@ -56944,6 +56960,13 @@ const StructuredContentCommands = Extension.create({
56944
56960
  content = node.content;
56945
56961
  }
56946
56962
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
56963
+ try {
56964
+ const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
56965
+ nodeForValidation.check();
56966
+ } catch (error) {
56967
+ console.error("Invalid content.", "Passed value:", content, "Error:", error);
56968
+ return false;
56969
+ }
56947
56970
  tr.replaceWith(posFrom, posTo, updatedNode);
56948
56971
  }
56949
56972
  return true;
@@ -57028,7 +57051,7 @@ const StructuredContentCommands = Extension.create({
57028
57051
  * @param {StructuredContentUpdate} options
57029
57052
  * @example
57030
57053
  * // Update all fields in the customer-info group
57031
- * editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe' });
57054
+ * editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe', keepTextNodeStyles: true });
57032
57055
  *
57033
57056
  * // Update block content in a group
57034
57057
  * editor.commands.updateStructuredContentByGroup('terms-section', {
@@ -57042,13 +57065,14 @@ const StructuredContentCommands = Extension.create({
57042
57065
  }
57043
57066
  const { schema } = editor;
57044
57067
  if (dispatch) {
57045
- structuredContentTags.forEach((structuredContent) => {
57068
+ const updates = [];
57069
+ for (const structuredContent of structuredContentTags) {
57046
57070
  const { pos, node } = structuredContent;
57047
- const posFrom = tr.mapping.map(pos);
57048
- const posTo = tr.mapping.map(pos + node.nodeSize);
57049
57071
  let content = null;
57050
57072
  if (options.text) {
57051
- content = schema.text(options.text);
57073
+ const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
57074
+ const textMarks = firstTextNode ? firstTextNode.marks : [];
57075
+ content = schema.text(options.text, textMarks);
57052
57076
  }
57053
57077
  if (options.html) {
57054
57078
  const html = htmlHandler(options.html, editor);
@@ -57062,11 +57086,23 @@ const StructuredContentCommands = Extension.create({
57062
57086
  content = node.content;
57063
57087
  }
57064
57088
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
57089
+ try {
57090
+ const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
57091
+ nodeForValidation.check();
57092
+ } catch (error) {
57093
+ console.error("Invalid content.", "Passed value:", content, "Error:", error);
57094
+ return false;
57095
+ }
57096
+ updates.push({ pos, node, updatedNode });
57097
+ }
57098
+ for (const { pos, node, updatedNode } of updates) {
57099
+ const posFrom = tr.mapping.map(pos);
57100
+ const posTo = tr.mapping.map(pos + node.nodeSize);
57065
57101
  const currentNode = tr.doc.nodeAt(posFrom);
57066
57102
  if (currentNode && node.eq(currentNode)) {
57067
57103
  tr.replaceWith(posFrom, posTo, updatedNode);
57068
57104
  }
57069
- });
57105
+ }
57070
57106
  }
57071
57107
  return true;
57072
57108
  },
@@ -32358,8 +32358,15 @@ const encode$4 = (params2, encodedAttrs = {}) => {
32358
32358
  });
32359
32359
  encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
32360
32360
  subs.forEach((subElement) => {
32361
- if (subElement.marks === void 0) subElement.marks = [];
32362
- subElement.marks.push({ type: "trackDelete", attrs: encodedAttrs });
32361
+ subElement.marks = [];
32362
+ if (subElement?.content?.[0]) {
32363
+ if (subElement.content[0].marks === void 0) {
32364
+ subElement.content[0].marks = [];
32365
+ }
32366
+ if (subElement.content[0].type === "text") {
32367
+ subElement.content[0].marks.push({ type: "trackDelete", attrs: encodedAttrs });
32368
+ }
32369
+ }
32363
32370
  });
32364
32371
  return subs;
32365
32372
  };
@@ -32418,8 +32425,15 @@ const encode$3 = (params2, encodedAttrs = {}) => {
32418
32425
  });
32419
32426
  encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
32420
32427
  subs.forEach((subElement) => {
32421
- if (subElement.marks === void 0) subElement.marks = [];
32422
- subElement.marks.push({ type: "trackInsert", attrs: encodedAttrs });
32428
+ subElement.marks = [];
32429
+ if (subElement?.content?.[0]) {
32430
+ if (subElement.content[0].marks === void 0) {
32431
+ subElement.content[0].marks = [];
32432
+ }
32433
+ if (subElement.content[0].type === "text") {
32434
+ subElement.content[0].marks.push({ type: "trackInsert", attrs: encodedAttrs });
32435
+ }
32436
+ }
32423
32437
  });
32424
32438
  return subs;
32425
32439
  };
@@ -35462,7 +35476,7 @@ const updateCommentsIdsAndExtensible = (comments = [], commentsIds, extensible)
35462
35476
  name: "w16cex:commentExtensible",
35463
35477
  attributes: {
35464
35478
  "w16cex:durableId": newDurableId,
35465
- "w16cex:dateUtc": toIsoNoFractional()
35479
+ "w16cex:dateUtc": toIsoNoFractional(comment.createdTime)
35466
35480
  }
35467
35481
  };
35468
35482
  extensibleUpdated.elements[0].elements.push(newExtensible);
@@ -35775,7 +35789,7 @@ const _SuperConverter = class _SuperConverter2 {
35775
35789
  static getStoredSuperdocVersion(docx) {
35776
35790
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35777
35791
  }
35778
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.4") {
35792
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.5") {
35779
35793
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35780
35794
  }
35781
35795
  /**
@@ -54071,7 +54085,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
54071
54085
  { default: remarkStringify },
54072
54086
  { default: remarkGfm }
54073
54087
  ] = await Promise.all([
54074
- Promise.resolve().then(() => require("./index-DPjn4rpi-Bs9-iTbY.cjs")),
54088
+ Promise.resolve().then(() => require("./index-BO0dc2dg-BiqxnA1k.cjs")),
54075
54089
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
54076
54090
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
54077
54091
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -54289,7 +54303,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
54289
54303
  * @returns {Object | void} Migration results
54290
54304
  */
54291
54305
  processCollaborationMigrations() {
54292
- console.debug("[checkVersionMigrations] Current editor version", "0.34.4");
54306
+ console.debug("[checkVersionMigrations] Current editor version", "0.34.5");
54293
54307
  if (!this.options.ydoc) return;
54294
54308
  const metaMap = this.options.ydoc.getMap("meta");
54295
54309
  let docVersion = metaMap.get("version");
@@ -56926,7 +56940,7 @@ const StructuredContentCommands = Extension.create({
56926
56940
  * @param {string} id - Unique identifier of the field
56927
56941
  * @param {StructuredContentUpdate} options
56928
56942
  * @example
56929
- * editor.commands.updateStructuredContentById('123', { text: 'Jane Doe' });
56943
+ * editor.commands.updateStructuredContentById('123', { text: 'Jane Doe', keepTextNodeStyles: true });
56930
56944
  * editor.commands.updateStructuredContentById('123', {
56931
56945
  * json: { type: 'text', text: 'Jane Doe' },
56932
56946
  * });
@@ -56947,7 +56961,9 @@ const StructuredContentCommands = Extension.create({
56947
56961
  const posTo = pos + node.nodeSize;
56948
56962
  let content = null;
56949
56963
  if (options.text) {
56950
- content = schema.text(options.text);
56964
+ const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
56965
+ const textMarks = firstTextNode ? firstTextNode.marks : [];
56966
+ content = schema.text(options.text, textMarks);
56951
56967
  }
56952
56968
  if (options.html) {
56953
56969
  const html = htmlHandler(options.html, editor);
@@ -56961,6 +56977,13 @@ const StructuredContentCommands = Extension.create({
56961
56977
  content = node.content;
56962
56978
  }
56963
56979
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
56980
+ try {
56981
+ const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
56982
+ nodeForValidation.check();
56983
+ } catch (error) {
56984
+ console.error("Invalid content.", "Passed value:", content, "Error:", error);
56985
+ return false;
56986
+ }
56964
56987
  tr.replaceWith(posFrom, posTo, updatedNode);
56965
56988
  }
56966
56989
  return true;
@@ -57045,7 +57068,7 @@ const StructuredContentCommands = Extension.create({
57045
57068
  * @param {StructuredContentUpdate} options
57046
57069
  * @example
57047
57070
  * // Update all fields in the customer-info group
57048
- * editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe' });
57071
+ * editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe', keepTextNodeStyles: true });
57049
57072
  *
57050
57073
  * // Update block content in a group
57051
57074
  * editor.commands.updateStructuredContentByGroup('terms-section', {
@@ -57059,13 +57082,14 @@ const StructuredContentCommands = Extension.create({
57059
57082
  }
57060
57083
  const { schema } = editor;
57061
57084
  if (dispatch) {
57062
- structuredContentTags.forEach((structuredContent) => {
57085
+ const updates = [];
57086
+ for (const structuredContent of structuredContentTags) {
57063
57087
  const { pos, node } = structuredContent;
57064
- const posFrom = tr.mapping.map(pos);
57065
- const posTo = tr.mapping.map(pos + node.nodeSize);
57066
57088
  let content = null;
57067
57089
  if (options.text) {
57068
- content = schema.text(options.text);
57090
+ const firstTextNode = options.keepTextNodeStyles === true ? node.content.content.find((n) => n.type.name === "text") : null;
57091
+ const textMarks = firstTextNode ? firstTextNode.marks : [];
57092
+ content = schema.text(options.text, textMarks);
57069
57093
  }
57070
57094
  if (options.html) {
57071
57095
  const html = htmlHandler(options.html, editor);
@@ -57079,11 +57103,23 @@ const StructuredContentCommands = Extension.create({
57079
57103
  content = node.content;
57080
57104
  }
57081
57105
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
57106
+ try {
57107
+ const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
57108
+ nodeForValidation.check();
57109
+ } catch (error) {
57110
+ console.error("Invalid content.", "Passed value:", content, "Error:", error);
57111
+ return false;
57112
+ }
57113
+ updates.push({ pos, node, updatedNode });
57114
+ }
57115
+ for (const { pos, node, updatedNode } of updates) {
57116
+ const posFrom = tr.mapping.map(pos);
57117
+ const posTo = tr.mapping.map(pos + node.nodeSize);
57082
57118
  const currentNode = tr.doc.nodeAt(posFrom);
57083
57119
  if (currentNode && node.eq(currentNode)) {
57084
57120
  tr.replaceWith(posFrom, posTo, updatedNode);
57085
57121
  }
57086
- });
57122
+ }
57087
57123
  }
57088
57124
  return true;
57089
57125
  },
@@ -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-KW3z-Mzc.js";
3
- import { _ as _export_sfc } from "./chunks/editor-CTHJwQNA.js";
2
+ import { T as TextSelection } from "./chunks/converter-PA_XpTWF.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-CAqYW4R2.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 = {}) {
@@ -32347,8 +32347,15 @@ const encode$4 = (params, encodedAttrs = {}) => {
32347
32347
  });
32348
32348
  encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
32349
32349
  subs.forEach((subElement) => {
32350
- if (subElement.marks === void 0) subElement.marks = [];
32351
- subElement.marks.push({ type: "trackDelete", attrs: encodedAttrs });
32350
+ subElement.marks = [];
32351
+ if (subElement?.content?.[0]) {
32352
+ if (subElement.content[0].marks === void 0) {
32353
+ subElement.content[0].marks = [];
32354
+ }
32355
+ if (subElement.content[0].type === "text") {
32356
+ subElement.content[0].marks.push({ type: "trackDelete", attrs: encodedAttrs });
32357
+ }
32358
+ }
32352
32359
  });
32353
32360
  return subs;
32354
32361
  };
@@ -32407,8 +32414,15 @@ const encode$3 = (params, encodedAttrs = {}) => {
32407
32414
  });
32408
32415
  encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
32409
32416
  subs.forEach((subElement) => {
32410
- if (subElement.marks === void 0) subElement.marks = [];
32411
- subElement.marks.push({ type: "trackInsert", attrs: encodedAttrs });
32417
+ subElement.marks = [];
32418
+ if (subElement?.content?.[0]) {
32419
+ if (subElement.content[0].marks === void 0) {
32420
+ subElement.content[0].marks = [];
32421
+ }
32422
+ if (subElement.content[0].type === "text") {
32423
+ subElement.content[0].marks.push({ type: "trackInsert", attrs: encodedAttrs });
32424
+ }
32425
+ }
32412
32426
  });
32413
32427
  return subs;
32414
32428
  };
@@ -35726,7 +35740,7 @@ const updateCommentsIdsAndExtensible = (comments = [], commentsIds, extensible)
35726
35740
  name: "w16cex:commentExtensible",
35727
35741
  attributes: {
35728
35742
  "w16cex:durableId": newDurableId,
35729
- "w16cex:dateUtc": toIsoNoFractional()
35743
+ "w16cex:dateUtc": toIsoNoFractional(comment.createdTime)
35730
35744
  }
35731
35745
  };
35732
35746
  extensibleUpdated.elements[0].elements.push(newExtensible);
@@ -36039,7 +36053,7 @@ const _SuperConverter = class _SuperConverter {
36039
36053
  static getStoredSuperdocVersion(docx) {
36040
36054
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
36041
36055
  }
36042
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.34.4") {
36056
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.34.5") {
36043
36057
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
36044
36058
  }
36045
36059
  /**
@@ -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-KW3z-Mzc.js";
1
+ import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-PA_XpTWF.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-KW3z-Mzc.js";
16
- import { D as DocxZipper } from "./docx-zipper-CYtxqNuc.js";
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-PA_XpTWF.js";
16
+ import { D as DocxZipper } from "./docx-zipper-gaQWcuwh.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-DPjn4rpi.js"),
15182
+ import("./index-BO0dc2dg.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.4");
15400
+ console.debug("[checkVersionMigrations] Current editor version", "0.34.5");
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
- content = schema.text(options.text);
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
- structuredContentTags.forEach((structuredContent) => {
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
- content = schema.text(options.text);
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,4 +1,4 @@
1
- import { aA as getDefaultExportFromCjs } from "./converter-KW3z-Mzc.js";
1
+ import { aA as getDefaultExportFromCjs } from "./converter-PA_XpTWF.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -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-KW3z-Mzc.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CTHJwQNA.js";
2
+ import { p as process$1 } from "./converter-PA_XpTWF.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CAqYW4R2.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-KW3z-Mzc.js";
1
+ import { a5 } from "./chunks/converter-PA_XpTWF.js";
2
2
  export {
3
3
  a5 as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-KW3z-Mzc.js";
2
- import { D } from "./chunks/docx-zipper-CYtxqNuc.js";
1
+ import "./chunks/converter-PA_XpTWF.js";
2
+ import { D } from "./chunks/docx-zipper-gaQWcuwh.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-CTHJwQNA.js";
2
- import "./chunks/converter-KW3z-Mzc.js";
3
- import "./chunks/docx-zipper-CYtxqNuc.js";
1
+ import { E } from "./chunks/editor-CAqYW4R2.js";
2
+ import "./chunks/converter-PA_XpTWF.js";
3
+ import "./chunks/docx-zipper-gaQWcuwh.js";
4
4
  export {
5
5
  E as Editor
6
6
  };