superdoc 0.34.3 → 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 (32) hide show
  1. package/dist/chunks/{PdfViewer-wWL8kFLM.cjs → PdfViewer-DRQmW5MW.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-B1Nr6djN.es.js → PdfViewer-DTAOrhGM.es.js} +1 -1
  3. package/dist/chunks/{index-DDw53iRX-BWYh7yFU.cjs → index-BO0dc2dg-BiqxnA1k.cjs} +1 -1
  4. package/dist/chunks/{index-DDw53iRX-C9XrtmQK.es.js → index-BO0dc2dg-DpvJHkle.es.js} +1 -1
  5. package/dist/chunks/{index-BEgo7CG6.cjs → index-C_RM2IcG.cjs} +7 -6
  6. package/dist/chunks/{index-opnRvm2I.es.js → index-wvwkg6PD.es.js} +7 -6
  7. package/dist/chunks/{super-editor.es-S5OsPWFz.es.js → super-editor.es-CfMROBHl.es.js} +52 -16
  8. package/dist/chunks/{super-editor.es-7qQdECHJ.cjs → super-editor.es-VtmcJzKs.cjs} +52 -16
  9. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-BzpPOfBo.js → converter-PA_XpTWF.js} +20 -6
  12. package/dist/super-editor/chunks/{docx-zipper-DV16Zhx0.js → docx-zipper-gaQWcuwh.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-CnvutAwV.js → editor-CAqYW4R2.js} +34 -12
  14. package/dist/super-editor/chunks/{index-DDw53iRX.js → index-BO0dc2dg.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-DxFf5Lpm.js → toolbar-BgNvrbei.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/del/del-translator.d.ts.map +1 -1
  21. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ins/ins-translator.d.ts.map +1 -1
  22. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +5 -0
  23. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +1 -1
  24. package/dist/super-editor/super-editor.es.js +6 -6
  25. package/dist/super-editor/toolbar.es.js +2 -2
  26. package/dist/super-editor.cjs +1 -1
  27. package/dist/super-editor.es.js +1 -1
  28. package/dist/superdoc.cjs +2 -2
  29. package/dist/superdoc.es.js +2 -2
  30. package/dist/superdoc.umd.js +58 -21
  31. package/dist/superdoc.umd.js.map +1 -1
  32. 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-BEgo7CG6.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-opnRvm2I.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-7qQdECHJ.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-S5OsPWFz.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-7qQdECHJ.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");
@@ -4198,7 +4198,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4198
4198
  const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
4199
4199
  const document2 = superdocStore.getDocument(documentId);
4200
4200
  comments.forEach((comment) => {
4201
- const htmlContent = getHTmlFromComment(comment.textJson);
4201
+ const htmlContent = getHtmlFromComment(comment.textJson);
4202
4202
  if (!htmlContent && !comment.trackedChange) {
4203
4203
  return;
4204
4204
  }
@@ -4211,12 +4211,13 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4211
4211
  isInternal: false,
4212
4212
  parentCommentId: comment.parentCommentId,
4213
4213
  creatorName,
4214
+ createdTime: comment.createdTime,
4214
4215
  creatorEmail: comment.creatorEmail,
4215
4216
  importedAuthor: {
4216
4217
  name: importedName,
4217
4218
  email: comment.creatorEmail
4218
4219
  },
4219
- commentText: getHTmlFromComment(comment.textJson),
4220
+ commentText: getHtmlFromComment(comment.textJson),
4220
4221
  resolvedTime: comment.isDone ? Date.now() : null,
4221
4222
  resolvedByEmail: comment.isDone ? comment.creatorEmail : null,
4222
4223
  resolvedByName: comment.isDone ? importedName : null,
@@ -4324,7 +4325,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4324
4325
  content: normalizedChildren
4325
4326
  };
4326
4327
  };
4327
- const getHTmlFromComment = (commentTextJson) => {
4328
+ const getHtmlFromComment = (commentTextJson) => {
4328
4329
  if (!commentTextJson.content?.length) return;
4329
4330
  try {
4330
4331
  const normalizedContent = normalizeCommentForEditor(commentTextJson);
@@ -17218,7 +17219,7 @@ const _sfc_main = {
17218
17219
  __name: "SuperDoc",
17219
17220
  emits: ["selection-update"],
17220
17221
  setup(__props, { emit: __emit }) {
17221
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-wWL8kFLM.cjs")));
17222
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DRQmW5MW.cjs")));
17222
17223
  const superdocStore = useSuperdocStore();
17223
17224
  const commentsStore = useCommentsStore();
17224
17225
  const {
@@ -17982,7 +17983,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
17982
17983
  this.config.colors = shuffleArray(this.config.colors);
17983
17984
  this.userColorMap = /* @__PURE__ */ new Map();
17984
17985
  this.colorIndex = 0;
17985
- this.version = "0.34.3";
17986
+ this.version = "0.34.5";
17986
17987
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17987
17988
  this.superdocId = config.superdocId || uuid.v4();
17988
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-S5OsPWFz.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";
@@ -4181,7 +4181,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4181
4181
  const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
4182
4182
  const document2 = superdocStore.getDocument(documentId);
4183
4183
  comments.forEach((comment) => {
4184
- const htmlContent = getHTmlFromComment(comment.textJson);
4184
+ const htmlContent = getHtmlFromComment(comment.textJson);
4185
4185
  if (!htmlContent && !comment.trackedChange) {
4186
4186
  return;
4187
4187
  }
@@ -4194,12 +4194,13 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4194
4194
  isInternal: false,
4195
4195
  parentCommentId: comment.parentCommentId,
4196
4196
  creatorName,
4197
+ createdTime: comment.createdTime,
4197
4198
  creatorEmail: comment.creatorEmail,
4198
4199
  importedAuthor: {
4199
4200
  name: importedName,
4200
4201
  email: comment.creatorEmail
4201
4202
  },
4202
- commentText: getHTmlFromComment(comment.textJson),
4203
+ commentText: getHtmlFromComment(comment.textJson),
4203
4204
  resolvedTime: comment.isDone ? Date.now() : null,
4204
4205
  resolvedByEmail: comment.isDone ? comment.creatorEmail : null,
4205
4206
  resolvedByName: comment.isDone ? importedName : null,
@@ -4307,7 +4308,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4307
4308
  content: normalizedChildren
4308
4309
  };
4309
4310
  };
4310
- const getHTmlFromComment = (commentTextJson) => {
4311
+ const getHtmlFromComment = (commentTextJson) => {
4311
4312
  if (!commentTextJson.content?.length) return;
4312
4313
  try {
4313
4314
  const normalizedContent = normalizeCommentForEditor(commentTextJson);
@@ -17201,7 +17202,7 @@ const _sfc_main = {
17201
17202
  __name: "SuperDoc",
17202
17203
  emits: ["selection-update"],
17203
17204
  setup(__props, { emit: __emit }) {
17204
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-B1Nr6djN.es.js"));
17205
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DTAOrhGM.es.js"));
17205
17206
  const superdocStore = useSuperdocStore();
17206
17207
  const commentsStore = useCommentsStore();
17207
17208
  const {
@@ -17965,7 +17966,7 @@ class SuperDoc extends EventEmitter {
17965
17966
  this.config.colors = shuffleArray(this.config.colors);
17966
17967
  this.userColorMap = /* @__PURE__ */ new Map();
17967
17968
  this.colorIndex = 0;
17968
- this.version = "0.34.3";
17969
+ this.version = "0.34.5";
17969
17970
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17970
17971
  this.superdocId = config.superdocId || v4();
17971
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.3") {
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-DDw53iRX-C9XrtmQK.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.3");
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.3") {
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-DDw53iRX-BWYh7yFU.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.3");
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 +1 @@
1
- {"version":3,"file":"comments-store.d.ts","sourceRoot":"","sources":["../../../../../src/stores/comments-store.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA4Ce,IAAI;qBAiBN,MAAM;0CAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;0DAqDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DAuHJ,IAAI;sDA9ad;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAvDJ,IAAI;qBAiBN,MAAM;0CAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;0DAqDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DAuHJ,IAAI;sDA9ad;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAvDJ,IAAI;qBAiBN,MAAM;0CAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;0DAqDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DAuHJ,IAAI;sDA9ad;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;wUAsjBhB"}
1
+ {"version":3,"file":"comments-store.d.ts","sourceRoot":"","sources":["../../../../../src/stores/comments-store.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA4Ce,IAAI;qBAiBN,MAAM;0CAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;0DAqDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DAwHJ,IAAI;sDA/ad;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAvDJ,IAAI;qBAiBN,MAAM;0CAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;0DAqDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DAwHJ,IAAI;sDA/ad;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAvDJ,IAAI;qBAiBN,MAAM;0CAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;0DAqDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DAwHJ,IAAI;sDA/ad;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;wUAujBhB"}
@@ -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-BzpPOfBo.js";
3
- import { _ as _export_sfc } from "./chunks/editor-CnvutAwV.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.3") {
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-BzpPOfBo.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
  }