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
@@ -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-BzpPOfBo.js";
16
- import { D as DocxZipper } from "./docx-zipper-DV16Zhx0.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-DDw53iRX.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.3");
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-BzpPOfBo.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-BzpPOfBo.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CnvutAwV.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-BzpPOfBo.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-BzpPOfBo.js";
2
- import { D } from "./chunks/docx-zipper-DV16Zhx0.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-CnvutAwV.js";
2
- import "./chunks/converter-BzpPOfBo.js";
3
- import "./chunks/docx-zipper-DV16Zhx0.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
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-DV16Zhx0.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-gaQWcuwh.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -1 +1 @@
1
- {"version":3,"file":"del-translator.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/super-converter/v3/handlers/w/del/del-translator.js"],"names":[],"mappings":"AAkFA,yDAAyD;AACzD,qBADW,OAAO,aAAa,EAAE,oBAAoB,CAQnD;AAEF;;;GAGG;AACH,yBAFU,OAAO,aAAa,EAAE,cAAc,CAEQ"}
1
+ {"version":3,"file":"del-translator.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/super-converter/v3/handlers/w/del/del-translator.js"],"names":[],"mappings":"AAyFA,yDAAyD;AACzD,qBADW,OAAO,aAAa,EAAE,oBAAoB,CAQnD;AAEF;;;GAGG;AACH,yBAFU,OAAO,aAAa,EAAE,cAAc,CAEQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"ins-translator.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/super-converter/v3/handlers/w/ins/ins-translator.js"],"names":[],"mappings":"AAgFA,yDAAyD;AACzD,qBADW,OAAO,aAAa,EAAE,oBAAoB,CAQnD;AAEF;;;GAGG;AACH,yBAFU,OAAO,aAAa,EAAE,cAAc,CAEQ"}
1
+ {"version":3,"file":"ins-translator.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/super-converter/v3/handlers/w/ins/ins-translator.js"],"names":[],"mappings":"AAsFA,yDAAyD;AACzD,qBADW,OAAO,aAAa,EAAE,oBAAoB,CAQnD;AAEF;;;GAGG;AACH,yBAFU,OAAO,aAAa,EAAE,cAAc,CAEQ"}
@@ -18,6 +18,7 @@
18
18
  * @property {string} [html] - Replace content with HTML (only for structured content block)
19
19
  * @property {Object} [json] - Replace content with ProseMirror JSON (overrides html)
20
20
  * @property {Object} [attrs] - Update attributes only (preserves content)
21
+ * @property {boolean} [keepTextNodeStyles] - When true, preserves marks from the first text node (only applies with text option)
21
22
  */
22
23
  /**
23
24
  * @typedef {Object} StructuredContentTableAppendRowsOptions
@@ -76,6 +77,10 @@ export type StructuredContentUpdate = {
76
77
  * - Update attributes only (preserves content)
77
78
  */
78
79
  attrs?: any;
80
+ /**
81
+ * - When true, preserves marks from the first text node (only applies with text option)
82
+ */
83
+ keepTextNodeStyles?: boolean;
79
84
  };
80
85
  export type StructuredContentTableAppendRowsOptions = {
81
86
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"structured-content-commands.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/structured-content/structured-content-commands.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH,kDA2cG;;;;;WAzeW,MAAM;;;;;;;;YAGjB;QAA0B,KAAK,GAApB,MAAM;KACnB;;;;;;WAIa,MAAM;;;;;;;;YAGjB;QAA0B,KAAK,GAApB,MAAM;KACnB;;;;;;WAIa,MAAM;;;;WACN,MAAM;;;;;;;;;;;;;;QAON,MAAM;;;;iBACN,MAAM;;;;UACN,KAAK,CAAC,MAAM,EAAE,CAAC,GAAC,KAAK,CAAC,MAAM,CAAC;;;;mBAC7B,OAAO;;0BAxCK,aAAa"}
1
+ {"version":3,"file":"structured-content-commands.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/structured-content/structured-content-commands.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;;;;;GAMG;AAEH,kDAgfG;;;;;WA/gBW,MAAM;;;;;;;;YAGjB;QAA0B,KAAK,GAApB,MAAM;KACnB;;;;;;WAIa,MAAM;;;;;;;;YAGjB;QAA0B,KAAK,GAApB,MAAM;KACnB;;;;;;WAIa,MAAM;;;;WACN,MAAM;;;;;;;;;;;;yBAGN,OAAO;;;;;;QAKP,MAAM;;;;iBACN,MAAM;;;;UACN,KAAK,CAAC,MAAM,EAAE,CAAC,GAAC,KAAK,CAAC,MAAM,CAAC;;;;mBAC7B,OAAO;;0BAzCK,aAAa"}
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn;
12
- import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-BzpPOfBo.js";
13
- import { a5, i, a2 } from "./chunks/converter-BzpPOfBo.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as collectTargetListItemPositions, d as getFileOpener, e as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, f as uploadAndInsertImage, h as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, j as undoDepth, k as redoDepth, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as isHeadless, E as Editor, n as getStarterExtensions, P as Placeholder, o as getRichTextExtensions, D as DecorationSet, p as Decoration, M as Mark, q as Extension, A as Attribute, N as Node } from "./chunks/editor-CnvutAwV.js";
15
- import { w, C, x, T, t, z, v } from "./chunks/editor-CnvutAwV.js";
12
+ import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-PA_XpTWF.js";
13
+ import { a5, i, a2 } from "./chunks/converter-PA_XpTWF.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as collectTargetListItemPositions, d as getFileOpener, e as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, f as uploadAndInsertImage, h as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, j as undoDepth, k as redoDepth, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as isHeadless, E as Editor, n as getStarterExtensions, P as Placeholder, o as getRichTextExtensions, D as DecorationSet, p as Decoration, M as Mark, q as Extension, A as Attribute, N as Node } from "./chunks/editor-CAqYW4R2.js";
15
+ import { w, C, x, T, t, z, v } from "./chunks/editor-CAqYW4R2.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, defineComponent, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-DxFf5Lpm.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-BgNvrbei.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-DV16Zhx0.js";
19
+ import { D } from "./chunks/docx-zipper-gaQWcuwh.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-DxFf5Lpm.js";
3
- import "./chunks/editor-CnvutAwV.js";
2
+ import { T } from "./chunks/toolbar-BgNvrbei.js";
3
+ import "./chunks/editor-CAqYW4R2.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-7qQdECHJ.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-VtmcJzKs.cjs");
4
4
  require("./chunks/vue-Cwv-wUpm.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-S5OsPWFz.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-CfMROBHl.es.js";
2
2
  import "./chunks/vue-CKmzTNVs.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-7qQdECHJ.cjs");
4
- const superdoc = require("./chunks/index-BEgo7CG6.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-VtmcJzKs.cjs");
4
+ const superdoc = require("./chunks/index-C_RM2IcG.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
7
7
  exports.Editor = superEditor_es.Editor;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-S5OsPWFz.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-opnRvm2I.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-CfMROBHl.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-wvwkg6PD.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -32359,8 +32359,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32359
32359
  });
32360
32360
  encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
32361
32361
  subs.forEach((subElement) => {
32362
- if (subElement.marks === void 0) subElement.marks = [];
32363
- subElement.marks.push({ type: "trackDelete", attrs: encodedAttrs });
32362
+ subElement.marks = [];
32363
+ if (subElement?.content?.[0]) {
32364
+ if (subElement.content[0].marks === void 0) {
32365
+ subElement.content[0].marks = [];
32366
+ }
32367
+ if (subElement.content[0].type === "text") {
32368
+ subElement.content[0].marks.push({ type: "trackDelete", attrs: encodedAttrs });
32369
+ }
32370
+ }
32364
32371
  });
32365
32372
  return subs;
32366
32373
  };
@@ -32419,8 +32426,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32419
32426
  });
32420
32427
  encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
32421
32428
  subs.forEach((subElement) => {
32422
- if (subElement.marks === void 0) subElement.marks = [];
32423
- subElement.marks.push({ type: "trackInsert", attrs: encodedAttrs });
32429
+ subElement.marks = [];
32430
+ if (subElement?.content?.[0]) {
32431
+ if (subElement.content[0].marks === void 0) {
32432
+ subElement.content[0].marks = [];
32433
+ }
32434
+ if (subElement.content[0].type === "text") {
32435
+ subElement.content[0].marks.push({ type: "trackInsert", attrs: encodedAttrs });
32436
+ }
32437
+ }
32424
32438
  });
32425
32439
  return subs;
32426
32440
  };
@@ -35463,7 +35477,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35463
35477
  name: "w16cex:commentExtensible",
35464
35478
  attributes: {
35465
35479
  "w16cex:durableId": newDurableId,
35466
- "w16cex:dateUtc": toIsoNoFractional()
35480
+ "w16cex:dateUtc": toIsoNoFractional(comment2.createdTime)
35467
35481
  }
35468
35482
  };
35469
35483
  extensibleUpdated.elements[0].elements.push(newExtensible);
@@ -35776,7 +35790,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35776
35790
  static getStoredSuperdocVersion(docx) {
35777
35791
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35778
35792
  }
35779
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.3") {
35793
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.5") {
35780
35794
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35781
35795
  }
35782
35796
  /**
@@ -61813,7 +61827,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61813
61827
  { default: remarkStringify2 },
61814
61828
  { default: remarkGfm2 }
61815
61829
  ] = await Promise.all([
61816
- Promise.resolve().then(() => indexDDw53iRX),
61830
+ Promise.resolve().then(() => indexBO0dc2dg),
61817
61831
  Promise.resolve().then(() => indexDRCvimau),
61818
61832
  Promise.resolve().then(() => indexC_x_N6Uh),
61819
61833
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -62031,7 +62045,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62031
62045
  * @returns {Object | void} Migration results
62032
62046
  */
62033
62047
  processCollaborationMigrations() {
62034
- console.debug("[checkVersionMigrations] Current editor version", "0.34.3");
62048
+ console.debug("[checkVersionMigrations] Current editor version", "0.34.5");
62035
62049
  if (!this.options.ydoc) return;
62036
62050
  const metaMap = this.options.ydoc.getMap("meta");
62037
62051
  let docVersion = metaMap.get("version");
@@ -64668,7 +64682,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64668
64682
  * @param {string} id - Unique identifier of the field
64669
64683
  * @param {StructuredContentUpdate} options
64670
64684
  * @example
64671
- * editor.commands.updateStructuredContentById('123', { text: 'Jane Doe' });
64685
+ * editor.commands.updateStructuredContentById('123', { text: 'Jane Doe', keepTextNodeStyles: true });
64672
64686
  * editor.commands.updateStructuredContentById('123', {
64673
64687
  * json: { type: 'text', text: 'Jane Doe' },
64674
64688
  * });
@@ -64689,7 +64703,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64689
64703
  const posTo = pos + node2.nodeSize;
64690
64704
  let content2 = null;
64691
64705
  if (options.text) {
64692
- content2 = schema.text(options.text);
64706
+ const firstTextNode = options.keepTextNodeStyles === true ? node2.content.content.find((n) => n.type.name === "text") : null;
64707
+ const textMarks = firstTextNode ? firstTextNode.marks : [];
64708
+ content2 = schema.text(options.text, textMarks);
64693
64709
  }
64694
64710
  if (options.html) {
64695
64711
  const html2 = htmlHandler(options.html, editor);
@@ -64703,6 +64719,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64703
64719
  content2 = node2.content;
64704
64720
  }
64705
64721
  const updatedNode = node2.type.create({ ...node2.attrs, ...options.attrs }, content2, node2.marks);
64722
+ try {
64723
+ const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
64724
+ nodeForValidation.check();
64725
+ } catch (error) {
64726
+ console.error("Invalid content.", "Passed value:", content2, "Error:", error);
64727
+ return false;
64728
+ }
64706
64729
  tr.replaceWith(posFrom, posTo, updatedNode);
64707
64730
  }
64708
64731
  return true;
@@ -64787,7 +64810,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64787
64810
  * @param {StructuredContentUpdate} options
64788
64811
  * @example
64789
64812
  * // Update all fields in the customer-info group
64790
- * editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe' });
64813
+ * editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe', keepTextNodeStyles: true });
64791
64814
  *
64792
64815
  * // Update block content in a group
64793
64816
  * editor.commands.updateStructuredContentByGroup('terms-section', {
@@ -64801,13 +64824,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64801
64824
  }
64802
64825
  const { schema } = editor;
64803
64826
  if (dispatch) {
64804
- structuredContentTags.forEach((structuredContent) => {
64827
+ const updates = [];
64828
+ for (const structuredContent of structuredContentTags) {
64805
64829
  const { pos, node: node2 } = structuredContent;
64806
- const posFrom = tr.mapping.map(pos);
64807
- const posTo = tr.mapping.map(pos + node2.nodeSize);
64808
64830
  let content2 = null;
64809
64831
  if (options.text) {
64810
- content2 = schema.text(options.text);
64832
+ const firstTextNode = options.keepTextNodeStyles === true ? node2.content.content.find((n) => n.type.name === "text") : null;
64833
+ const textMarks = firstTextNode ? firstTextNode.marks : [];
64834
+ content2 = schema.text(options.text, textMarks);
64811
64835
  }
64812
64836
  if (options.html) {
64813
64837
  const html2 = htmlHandler(options.html, editor);
@@ -64821,11 +64845,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64821
64845
  content2 = node2.content;
64822
64846
  }
64823
64847
  const updatedNode = node2.type.create({ ...node2.attrs, ...options.attrs }, content2, node2.marks);
64848
+ try {
64849
+ const nodeForValidation = editor.validateJSON(updatedNode.toJSON());
64850
+ nodeForValidation.check();
64851
+ } catch (error) {
64852
+ console.error("Invalid content.", "Passed value:", content2, "Error:", error);
64853
+ return false;
64854
+ }
64855
+ updates.push({ pos, node: node2, updatedNode });
64856
+ }
64857
+ for (const { pos, node: node2, updatedNode } of updates) {
64858
+ const posFrom = tr.mapping.map(pos);
64859
+ const posTo = tr.mapping.map(pos + node2.nodeSize);
64824
64860
  const currentNode = tr.doc.nodeAt(posFrom);
64825
64861
  if (currentNode && node2.eq(currentNode)) {
64826
64862
  tr.replaceWith(posFrom, posTo, updatedNode);
64827
64863
  }
64828
- });
64864
+ }
64829
64865
  }
64830
64866
  return true;
64831
64867
  },
@@ -104525,7 +104561,7 @@ ${reason}`);
104525
104561
  const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
104526
104562
  const document2 = superdocStore.getDocument(documentId);
104527
104563
  comments.forEach((comment2) => {
104528
- const htmlContent = getHTmlFromComment(comment2.textJson);
104564
+ const htmlContent = getHtmlFromComment(comment2.textJson);
104529
104565
  if (!htmlContent && !comment2.trackedChange) {
104530
104566
  return;
104531
104567
  }
@@ -104538,12 +104574,13 @@ ${reason}`);
104538
104574
  isInternal: false,
104539
104575
  parentCommentId: comment2.parentCommentId,
104540
104576
  creatorName,
104577
+ createdTime: comment2.createdTime,
104541
104578
  creatorEmail: comment2.creatorEmail,
104542
104579
  importedAuthor: {
104543
104580
  name: importedName,
104544
104581
  email: comment2.creatorEmail
104545
104582
  },
104546
- commentText: getHTmlFromComment(comment2.textJson),
104583
+ commentText: getHtmlFromComment(comment2.textJson),
104547
104584
  resolvedTime: comment2.isDone ? Date.now() : null,
104548
104585
  resolvedByEmail: comment2.isDone ? comment2.creatorEmail : null,
104549
104586
  resolvedByName: comment2.isDone ? importedName : null,
@@ -104651,7 +104688,7 @@ ${reason}`);
104651
104688
  content: normalizedChildren
104652
104689
  };
104653
104690
  };
104654
- const getHTmlFromComment = (commentTextJson) => {
104691
+ const getHtmlFromComment = (commentTextJson) => {
104655
104692
  if (!commentTextJson.content?.length) return;
104656
104693
  try {
104657
104694
  const normalizedContent = normalizeCommentForEditor(commentTextJson);
@@ -118477,7 +118514,7 @@ ${style2}
118477
118514
  this.config.colors = shuffleArray(this.config.colors);
118478
118515
  this.userColorMap = /* @__PURE__ */ new Map();
118479
118516
  this.colorIndex = 0;
118480
- this.version = "0.34.3";
118517
+ this.version = "0.34.5";
118481
118518
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
118482
118519
  this.superdocId = config2.superdocId || v4();
118483
118520
  this.colors = this.config.colors;
@@ -120877,7 +120914,7 @@ ${style2}
120877
120914
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
120878
120915
  );
120879
120916
  }
120880
- const indexDDw53iRX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120917
+ const indexBO0dc2dg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120881
120918
  __proto__: null,
120882
120919
  unified
120883
120920
  }, Symbol.toStringTag, { value: "Module" }));