@harbour-enterprises/superdoc 0.19.0 → 0.20.0-next.1

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 (49) hide show
  1. package/dist/chunks/{PdfViewer-DJb0akn3.cjs → PdfViewer-BLwxuMWh.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-D0lSSW0x.es.js → PdfViewer-t_JS3Mbo.es.js} +1 -1
  3. package/dist/chunks/{index-CeLW_JxI.cjs → index-CBTSdULo.cjs} +4 -3
  4. package/dist/chunks/{index-BZOsYVVo.es.js → index-Vp2WxlNm.es.js} +4 -3
  5. package/dist/chunks/{super-editor.es-FNewwzSy.cjs → super-editor.es-Cten5oWF.cjs} +11140 -10923
  6. package/dist/chunks/{super-editor.es-B1rC4GHL.es.js → super-editor.es-DGV2_J23.es.js} +11140 -10923
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/style.css +6 -6
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CFVPKGqT.js → converter-Dq0PLazx.js} +11885 -11803
  11. package/dist/super-editor/chunks/{docx-zipper-CGdYHGDa.js → docx-zipper-jT0gaoep.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-DrhZRXX9.js → editor-BEtv1kuN.js} +231 -101
  13. package/dist/super-editor/chunks/{toolbar-CKQ-GucL.js → toolbar-CJfSHfLU.js} +2 -2
  14. package/dist/super-editor/converter.es.js +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/file-zipper.es.js +1 -1
  18. package/dist/super-editor/src/core/Editor.d.ts +2 -0
  19. package/dist/super-editor/src/core/inputRules/html/transform-copied-lists.d.ts +3 -0
  20. package/dist/super-editor/src/core/super-converter/exporter.d.ts +19 -1
  21. package/dist/super-editor/src/core/super-converter/v2/exporter/index.d.ts +0 -1
  22. package/dist/super-editor/src/core/super-converter/v2/importer/sdtNodeImporter.d.ts +8 -0
  23. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-annotation-node.d.ts +22 -0
  24. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +6 -0
  25. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-document-section-node.d.ts +6 -0
  26. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-structured-content-node.d.ts +5 -0
  27. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/parse-tag-value-json.d.ts +5 -0
  28. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/sdt-node-type-strategy.d.ts +9 -0
  29. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-section.d.ts +7 -0
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-field-annotation.d.ts +80 -0
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-structured-content.d.ts +5 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/index.d.ts +1 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/sdt-translator.d.ts +6 -0
  34. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +8 -8
  35. package/dist/super-editor/style.css +6 -6
  36. package/dist/super-editor/super-editor.es.js +13 -8
  37. package/dist/super-editor/toolbar.es.js +2 -2
  38. package/dist/super-editor.cjs +1 -1
  39. package/dist/super-editor.es.js +1 -1
  40. package/dist/superdoc.cjs +2 -2
  41. package/dist/superdoc.es.js +2 -2
  42. package/dist/superdoc.umd.js +11265 -11047
  43. package/dist/superdoc.umd.js.map +1 -1
  44. package/package.json +1 -1
  45. package/dist/super-editor/src/core/super-converter/v2/exporter/documentSectionExporter.d.ts +0 -1
  46. package/dist/super-editor/src/core/super-converter/v2/importer/annotationImporter.d.ts +0 -9
  47. package/dist/super-editor/src/core/super-converter/v2/importer/docPartGalleryImporter.d.ts +0 -1
  48. package/dist/super-editor/src/core/super-converter/v2/importer/docPartObjImporter.d.ts +0 -4
  49. package/dist/super-editor/src/core/super-converter/v2/importer/structuredDocumentNodeImporter.d.ts +0 -8
@@ -1,4 +1,4 @@
1
- import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-CFVPKGqT.js";
1
+ import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-Dq0PLazx.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
  }
@@ -9,12 +9,12 @@ 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 __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
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, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_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, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
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, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_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, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_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 InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as htmlHandler } from "./converter-CFVPKGqT.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 InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as htmlHandler } from "./converter-Dq0PLazx.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-CGdYHGDa.js";
17
+ import { D as DocxZipper } from "./docx-zipper-jT0gaoep.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -13893,6 +13893,77 @@ analyzeDocument_fn = function() {
13893
13893
  doc2.descendants(collectElements);
13894
13894
  return analysis;
13895
13895
  };
13896
+ const transformListsInCopiedContent = (html) => {
13897
+ const container = document.createElement("div");
13898
+ container.innerHTML = html;
13899
+ const result = [];
13900
+ const stack = [];
13901
+ const flushStackUntil = (level) => {
13902
+ while (stack.length && stack[stack.length - 1].level >= level) {
13903
+ const top2 = stack.pop();
13904
+ if (stack.length) {
13905
+ stack[stack.length - 1].el.appendChild(top2.el);
13906
+ } else {
13907
+ result.push(top2.el.outerHTML);
13908
+ }
13909
+ }
13910
+ };
13911
+ Array.from(container.childNodes).forEach((node) => {
13912
+ if (node.nodeType !== Node.ELEMENT_NODE) {
13913
+ result.push(node.outerHTML || node.textContent);
13914
+ return;
13915
+ }
13916
+ if (node.tagName.toLowerCase() === "ol" || node.tagName.toLowerCase() === "ul") {
13917
+ const child = getFirstElementChild(node);
13918
+ const level = getLevel(child);
13919
+ const numFmt = child.getAttribute("data-num-fmt");
13920
+ const lvlText = child.getAttribute("data-lvl-text");
13921
+ const tag = node.tagName.toLowerCase();
13922
+ const li = child.cloneNode(true);
13923
+ li.setAttribute("aria-level", level + 1);
13924
+ li.style["list-style-type"] = getListStyleType(numFmt, lvlText);
13925
+ if (!stack.length || stack[stack.length - 1].level < level) {
13926
+ const newList = document.createElement(tag);
13927
+ stack.push({ tag, level, el: newList });
13928
+ } else if (stack[stack.length - 1].level > level) {
13929
+ flushStackUntil(level + 1);
13930
+ } else if (stack[stack.length - 1].tag !== tag) {
13931
+ flushStackUntil(level);
13932
+ const newList = document.createElement(tag);
13933
+ stack.push({ tag, level, el: newList });
13934
+ }
13935
+ stack[stack.length - 1].el.appendChild(li);
13936
+ } else {
13937
+ flushStackUntil(0);
13938
+ result.push(node.outerHTML);
13939
+ }
13940
+ });
13941
+ flushStackUntil(0);
13942
+ return result.join("");
13943
+ };
13944
+ const getListStyleType = (numFmt, lvlText) => {
13945
+ const bulletFmtMap = /* @__PURE__ */ new Map([
13946
+ ["●", "disc"],
13947
+ ["◦", "circle"],
13948
+ ["▪", "square"]
13949
+ ]);
13950
+ if (numFmt === "bullet") return bulletFmtMap.get(lvlText) || "disc";
13951
+ const fmtMap = /* @__PURE__ */ new Map([
13952
+ ["decimal", "decimal"],
13953
+ ["lowerLetter", "lower-alpha"],
13954
+ ["upperLetter", "upper-alpha"],
13955
+ ["lowerRoman", "lower-roman"],
13956
+ ["upperRoman", "upper-roman"]
13957
+ ]);
13958
+ return lvlText.startsWith("0") ? "decimal-leading-zero" : fmtMap.get(numFmt);
13959
+ };
13960
+ function getFirstElementChild(node) {
13961
+ return Array.from(node.childNodes).find((n) => n.nodeType === Node.ELEMENT_NODE) || null;
13962
+ }
13963
+ const getLevel = (node) => {
13964
+ const lvl = node.getAttribute("data-level");
13965
+ return lvl ? parseInt(lvl, 10) : 0;
13966
+ };
13896
13967
  const _Editor = class _Editor extends EventEmitter {
13897
13968
  /**
13898
13969
  * Create a new Editor instance
@@ -14471,6 +14542,8 @@ const _Editor = class _Editor extends EventEmitter {
14471
14542
  }
14472
14543
  /**
14473
14544
  * Get the editor content as HTML
14545
+ * @param {Object} options - Options for the HTML serializer
14546
+ * @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
14474
14547
  * @returns {string} Editor content as HTML
14475
14548
  */
14476
14549
  getHTML({ unflattenLists = false } = {}) {
@@ -14549,85 +14622,89 @@ const _Editor = class _Editor extends EventEmitter {
14549
14622
  getUpdatedDocs = false,
14550
14623
  fieldsHighlightColor = null
14551
14624
  } = {}) {
14552
- const json = __privateMethod(this, _Editor_instances, prepareDocumentForExport_fn).call(this, comments);
14553
- const documentXml = await this.converter.exportToDocx(
14554
- json,
14555
- this.schema,
14556
- this.storage.image.media,
14557
- isFinalDoc,
14558
- commentsType,
14559
- comments,
14560
- this,
14561
- exportJsonOnly,
14562
- fieldsHighlightColor
14563
- );
14564
- __privateMethod(this, _Editor_instances, validateDocumentExport_fn).call(this);
14565
- if (exportXmlOnly || exportJsonOnly) return documentXml;
14566
- const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
14567
- const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
14568
- const customSettings = this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]);
14569
- const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
14570
- const media = this.converter.addedMedia;
14571
- const updatedHeadersFooters = {};
14572
- Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
14573
- if (name.includes("header") || name.includes("footer")) {
14574
- const resultXml = this.converter.schemaToXml(json2.elements[0]);
14575
- updatedHeadersFooters[name] = String(resultXml);
14576
- }
14577
- });
14578
- const numberingData = this.converter.convertedXml["word/numbering.xml"];
14579
- const numbering = this.converter.schemaToXml(numberingData.elements[0]);
14580
- const updatedDocs = {
14581
- ...this.options.customUpdatedFiles,
14582
- "word/document.xml": String(documentXml),
14583
- "docProps/custom.xml": String(customXml),
14584
- "word/settings.xml": String(customSettings),
14585
- "word/_rels/document.xml.rels": String(rels),
14586
- "word/numbering.xml": String(numbering),
14587
- // Replace & with &amp; in styles.xml as DOCX viewers can't handle it
14588
- "word/styles.xml": String(styles).replace(/&/gi, "&amp;"),
14589
- ...updatedHeadersFooters
14590
- };
14591
- if (comments.length) {
14592
- const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
14593
- const commentsExtendedXml = this.converter.schemaToXml(
14594
- this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
14595
- );
14596
- const commentsExtensibleXml = this.converter.schemaToXml(
14597
- this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
14598
- );
14599
- const commentsIdsXml = this.converter.schemaToXml(
14600
- this.converter.convertedXml["word/commentsIds.xml"].elements[0]
14625
+ try {
14626
+ const json = __privateMethod(this, _Editor_instances, prepareDocumentForExport_fn).call(this, comments);
14627
+ const documentXml = await this.converter.exportToDocx(
14628
+ json,
14629
+ this.schema,
14630
+ this.storage.image.media,
14631
+ isFinalDoc,
14632
+ commentsType,
14633
+ comments,
14634
+ this,
14635
+ exportJsonOnly,
14636
+ fieldsHighlightColor
14601
14637
  );
14602
- updatedDocs["word/comments.xml"] = String(commentsXml);
14603
- updatedDocs["word/commentsExtended.xml"] = String(commentsExtendedXml);
14604
- updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
14605
- updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
14606
- }
14607
- const zipper = new DocxZipper();
14608
- if (getUpdatedDocs) {
14609
- updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes(
14610
- {
14611
- files: this.options.content
14612
- },
14638
+ __privateMethod(this, _Editor_instances, validateDocumentExport_fn).call(this);
14639
+ if (exportXmlOnly || exportJsonOnly) return documentXml;
14640
+ const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
14641
+ const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
14642
+ const customSettings = this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]);
14643
+ const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
14644
+ const media = this.converter.addedMedia;
14645
+ const updatedHeadersFooters = {};
14646
+ Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
14647
+ if (name.includes("header") || name.includes("footer")) {
14648
+ const resultXml = this.converter.schemaToXml(json2.elements[0]);
14649
+ updatedHeadersFooters[name] = String(resultXml);
14650
+ }
14651
+ });
14652
+ const numberingData = this.converter.convertedXml["word/numbering.xml"];
14653
+ const numbering = this.converter.schemaToXml(numberingData.elements[0]);
14654
+ const updatedDocs = {
14655
+ ...this.options.customUpdatedFiles,
14656
+ "word/document.xml": String(documentXml),
14657
+ "docProps/custom.xml": String(customXml),
14658
+ "word/settings.xml": String(customSettings),
14659
+ "word/_rels/document.xml.rels": String(rels),
14660
+ "word/numbering.xml": String(numbering),
14661
+ // Replace & with &amp; in styles.xml as DOCX viewers can't handle it
14662
+ "word/styles.xml": String(styles).replace(/&/gi, "&amp;"),
14663
+ ...updatedHeadersFooters
14664
+ };
14665
+ if (comments.length) {
14666
+ const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
14667
+ const commentsExtendedXml = this.converter.schemaToXml(
14668
+ this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
14669
+ );
14670
+ const commentsExtensibleXml = this.converter.schemaToXml(
14671
+ this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
14672
+ );
14673
+ const commentsIdsXml = this.converter.schemaToXml(
14674
+ this.converter.convertedXml["word/commentsIds.xml"].elements[0]
14675
+ );
14676
+ updatedDocs["word/comments.xml"] = String(commentsXml);
14677
+ updatedDocs["word/commentsExtended.xml"] = String(commentsExtendedXml);
14678
+ updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
14679
+ updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
14680
+ }
14681
+ const zipper = new DocxZipper();
14682
+ if (getUpdatedDocs) {
14683
+ updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes(
14684
+ {
14685
+ files: this.options.content
14686
+ },
14687
+ media,
14688
+ true
14689
+ );
14690
+ return updatedDocs;
14691
+ }
14692
+ const result = await zipper.updateZip({
14693
+ docx: this.options.content,
14694
+ updatedDocs,
14695
+ originalDocxFile: this.options.fileSource,
14613
14696
  media,
14614
- true
14615
- );
14616
- return updatedDocs;
14697
+ fonts: this.options.fonts,
14698
+ isHeadless: this.options.isHeadless
14699
+ });
14700
+ this.options.telemetry?.trackUsage("document_export", {
14701
+ documentType: "docx",
14702
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
14703
+ });
14704
+ return result;
14705
+ } catch (error) {
14706
+ this.emit("exception", { error, editor: this });
14617
14707
  }
14618
- const result = await zipper.updateZip({
14619
- docx: this.options.content,
14620
- updatedDocs,
14621
- originalDocxFile: this.options.fileSource,
14622
- media,
14623
- fonts: this.options.fonts,
14624
- isHeadless: this.options.isHeadless
14625
- });
14626
- this.options.telemetry?.trackUsage("document_export", {
14627
- documentType: "docx",
14628
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
14629
- });
14630
- return result;
14631
14708
  }
14632
14709
  /**
14633
14710
  * Destroy the editor and clean up resources
@@ -14648,7 +14725,8 @@ const _Editor = class _Editor extends EventEmitter {
14648
14725
  }
14649
14726
  this.converter.headerEditors.length = 0;
14650
14727
  this.converter.footerEditors.length = 0;
14651
- } catch {
14728
+ } catch (error) {
14729
+ this.emit("exception", { error, editor: this });
14652
14730
  }
14653
14731
  }
14654
14732
  /**
@@ -14668,7 +14746,7 @@ const _Editor = class _Editor extends EventEmitter {
14668
14746
  * @returns {Object | void} Migration results
14669
14747
  */
14670
14748
  processCollaborationMigrations() {
14671
- console.debug("[checkVersionMigrations] Current editor version", "0.18.1");
14749
+ console.debug("[checkVersionMigrations] Current editor version", "0.20.0");
14672
14750
  if (!this.options.ydoc) return;
14673
14751
  const metaMap = this.options.ydoc.getMap("meta");
14674
14752
  let docVersion = metaMap.get("version");
@@ -14713,7 +14791,7 @@ const _Editor = class _Editor extends EventEmitter {
14713
14791
  this.initDefaultStyles();
14714
14792
  if (this.options.ydoc && this.options.collaborationProvider) {
14715
14793
  updateYdocDocxData(this);
14716
- this.initializeCollaborationData(true);
14794
+ this.initializeCollaborationData();
14717
14795
  } else {
14718
14796
  __privateMethod(this, _Editor_instances, insertNewFileData_fn).call(this);
14719
14797
  }
@@ -14882,7 +14960,6 @@ init_fn = function() {
14882
14960
  this.on("beforeCreate", this.options.onBeforeCreate);
14883
14961
  this.emit("beforeCreate", { editor: this });
14884
14962
  this.on("contentError", this.options.onContentError);
14885
- this.on("exception", this.options.onException);
14886
14963
  this.mount(this.options.element);
14887
14964
  this.on("create", this.options.onCreate);
14888
14965
  this.on("update", this.options.onUpdate);
@@ -14900,11 +14977,14 @@ init_fn = function() {
14900
14977
  this.on("paginationUpdate", this.options.onPaginationUpdate);
14901
14978
  this.on("comment-positions", this.options.onCommentLocationsUpdate);
14902
14979
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
14980
+ this.on("exception", this.options.onException);
14903
14981
  if (!this.options.isHeadless) {
14904
14982
  this.initializeCollaborationData();
14905
14983
  this.initDefaultStyles();
14906
14984
  }
14907
- if (!this.options.ydoc) this.migrateListsToV2();
14985
+ if (!this.options.ydoc || this.options.markdown || this.options.html) {
14986
+ this.migrateListsToV2();
14987
+ }
14908
14988
  this.setDocumentMode(this.options.documentMode);
14909
14989
  if (!this.options.ydoc) {
14910
14990
  if (!this.options.isChildEditor) {
@@ -14914,6 +14994,7 @@ init_fn = function() {
14914
14994
  }
14915
14995
  }
14916
14996
  __privateMethod(this, _Editor_instances, initDevTools_fn).call(this);
14997
+ __privateMethod(this, _Editor_instances, registerCopyHandler_fn).call(this);
14917
14998
  };
14918
14999
  /**
14919
15000
  * Initialize the editor in rich text mode
@@ -14969,6 +15050,21 @@ checkHeadless_fn = function(options) {
14969
15050
  global.window = options.mockWindow;
14970
15051
  }
14971
15052
  };
15053
+ registerCopyHandler_fn = function() {
15054
+ this.view.dom.addEventListener("copy", (event) => {
15055
+ const clipboardData = event.clipboardData;
15056
+ if (!clipboardData) return;
15057
+ event.preventDefault();
15058
+ const { from: from2, to } = this.view.state.selection;
15059
+ const slice2 = this.view.state.doc.slice(from2, to);
15060
+ const fragment = slice2.content;
15061
+ const div2 = document.createElement("div");
15062
+ const serializer = DOMSerializer.fromSchema(this.view.state.schema);
15063
+ div2.appendChild(serializer.serializeFragment(fragment));
15064
+ const html = transformListsInCopiedContent(div2.innerHTML);
15065
+ clipboardData.setData("text/html", html);
15066
+ });
15067
+ };
14972
15068
  /**
14973
15069
  * Replace the current document with new data. Necessary for initializing a new collaboration file,
14974
15070
  * since we need to insert the data only after the provider has synced.
@@ -15326,7 +15422,8 @@ endCollaboration_fn = function() {
15326
15422
  console.debug("🔗 [super-editor] Ending collaboration");
15327
15423
  if (this.options.collaborationProvider) this.options.collaborationProvider.disconnect();
15328
15424
  if (this.options.ydoc) this.options.ydoc.destroy();
15329
- } catch {
15425
+ } catch (error) {
15426
+ this.emit("exception", { error, editor: this });
15330
15427
  }
15331
15428
  };
15332
15429
  /**
@@ -18596,13 +18693,30 @@ const Paragraph = OxmlNode.create({
18596
18693
  {
18597
18694
  tag: "p",
18598
18695
  getAttrs: (node) => {
18599
- let extra = {};
18696
+ const { styleid, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
18697
+ acc[attr.name] = attr.value;
18698
+ return acc;
18699
+ }, {});
18700
+ return {
18701
+ styleId: styleid || null,
18702
+ extraAttrs
18703
+ };
18704
+ }
18705
+ },
18706
+ {
18707
+ tag: "div",
18708
+ getAttrs: (node) => {
18709
+ const extra = {};
18600
18710
  Array.from(node.attributes).forEach((attr) => {
18601
18711
  extra[attr.name] = attr.value;
18602
18712
  });
18603
18713
  return { extraAttrs: extra };
18604
18714
  }
18605
18715
  },
18716
+ {
18717
+ tag: "blockquote",
18718
+ attrs: { styleId: "BlockQuote" }
18719
+ },
18606
18720
  ...this.options.headingLevels.map((level) => ({
18607
18721
  tag: `h${level}`,
18608
18722
  attrs: { level, styleId: `Heading${level}` }
@@ -24623,6 +24737,7 @@ const startImageUpload = async ({ editor, view, file }) => {
24623
24737
  file = processedImageResult.file;
24624
24738
  } catch (err) {
24625
24739
  console.warn("Error processing image:", err);
24740
+ editor.emit("exception", { error: err, editor });
24626
24741
  return;
24627
24742
  }
24628
24743
  await uploadImage({
@@ -24677,9 +24792,10 @@ async function uploadImage({ editor, view, file, size, uploadHandler }) {
24677
24792
  view.dispatch(
24678
24793
  view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
24679
24794
  );
24680
- } catch {
24795
+ } catch (error) {
24681
24796
  let removeMeta = { type: "remove", id };
24682
24797
  view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
24798
+ editor.emit("exception", { error, editor });
24683
24799
  }
24684
24800
  }
24685
24801
  function addImageRelationship({ editor, path }) {
@@ -24986,7 +25102,9 @@ class AutoPageNumberNodeView {
24986
25102
  this.dom = __privateMethod(this, _AutoPageNumberNodeView_instances, renderDom_fn).call(this, node, htmlAttributes);
24987
25103
  }
24988
25104
  update(node) {
24989
- if (node.type !== this.node.type) return false;
25105
+ const incomingType = node?.type?.name;
25106
+ const currentType = this.node?.type?.name;
25107
+ if (!incomingType || incomingType !== currentType) return false;
24990
25108
  this.node = node;
24991
25109
  return true;
24992
25110
  }
@@ -25333,18 +25451,24 @@ const StructuredContent = Node$1.create({
25333
25451
  }
25334
25452
  };
25335
25453
  },
25336
- parseDOM() {
25337
- return [{ tag: `span.${this.options.structuredContentClass}` }];
25338
- },
25339
- renderDOM({ htmlAttributes }) {
25340
- return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
25341
- },
25342
25454
  addAttributes() {
25343
25455
  return {
25344
25456
  sdtPr: {
25345
25457
  rendered: false
25346
25458
  }
25347
25459
  };
25460
+ },
25461
+ parseDOM() {
25462
+ return [{ tag: `span.${this.options.structuredContentClass}` }];
25463
+ },
25464
+ renderDOM({ htmlAttributes }) {
25465
+ return [
25466
+ "span",
25467
+ Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
25468
+ class: this.options.structuredContentClass
25469
+ }),
25470
+ 0
25471
+ ];
25348
25472
  }
25349
25473
  });
25350
25474
  const StructuredContentBlock = Node$1.create({
@@ -25353,24 +25477,30 @@ const StructuredContentBlock = Node$1.create({
25353
25477
  content: "block*",
25354
25478
  addOptions() {
25355
25479
  return {
25356
- structuredContentClass: "sd-structured-content-tag",
25480
+ structuredContentClass: "sd-structured-content-block-tag",
25357
25481
  htmlAttributes: {
25358
25482
  "aria-label": "Structured content block node"
25359
25483
  }
25360
25484
  };
25361
25485
  },
25362
- parseDOM() {
25363
- return [{ tag: `div.${this.options.structuredContentClass}` }];
25364
- },
25365
- renderDOM({ htmlAttributes }) {
25366
- return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
25367
- },
25368
25486
  addAttributes() {
25369
25487
  return {
25370
25488
  sdtPr: {
25371
25489
  rendered: false
25372
25490
  }
25373
25491
  };
25492
+ },
25493
+ parseDOM() {
25494
+ return [{ tag: `div.${this.options.structuredContentClass}` }];
25495
+ },
25496
+ renderDOM({ htmlAttributes }) {
25497
+ return [
25498
+ "div",
25499
+ Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
25500
+ class: this.options.structuredContentClass
25501
+ }),
25502
+ 0
25503
+ ];
25374
25504
  }
25375
25505
  });
25376
25506
  class DocumentSectionView {
@@ -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-CFVPKGqT.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DrhZRXX9.js";
2
+ import { p as process$1 } from "./converter-Dq0PLazx.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BEtv1kuN.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-CFVPKGqT.js";
1
+ import { a5 } from "./chunks/converter-Dq0PLazx.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-CFVPKGqT.js";
2
- import { D } from "./chunks/docx-zipper-CGdYHGDa.js";
1
+ import "./chunks/converter-Dq0PLazx.js";
2
+ import { D } from "./chunks/docx-zipper-jT0gaoep.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-DrhZRXX9.js";
2
- import "./chunks/converter-CFVPKGqT.js";
3
- import "./chunks/docx-zipper-CGdYHGDa.js";
1
+ import { E } from "./chunks/editor-BEtv1kuN.js";
2
+ import "./chunks/converter-Dq0PLazx.js";
3
+ import "./chunks/docx-zipper-jT0gaoep.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-CGdYHGDa.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-jT0gaoep.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -406,6 +406,8 @@ export class Editor extends EventEmitter {
406
406
  getJSON(): any;
407
407
  /**
408
408
  * Get the editor content as HTML
409
+ * @param {Object} options - Options for the HTML serializer
410
+ * @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
409
411
  * @returns {string} Editor content as HTML
410
412
  */
411
413
  getHTML({ unflattenLists }?: {
@@ -0,0 +1,3 @@
1
+ export function transformListsInCopiedContent(html: string): string;
2
+ export function getListStyleType(numFmt: any, lvlText: any): string;
3
+ export function getLevel(node: any): number;
@@ -44,6 +44,15 @@ export function exportSchemaToJson(params: ExportParams): XmlReadyNode;
44
44
  * @returns {XmlReadyNode} JSON of the XML-ready paragraph node
45
45
  */
46
46
  export function translateParagraphNode(params: any): XmlReadyNode;
47
+ /**
48
+ * Helper function to be used for text node translation
49
+ * Also used for transforming text annotations for the final submit
50
+ *
51
+ * @param {String} text Text node's content
52
+ * @param {Object[]} marks The marks to add to the run properties
53
+ * @returns {XmlReadyNode} The translated text node
54
+ */
55
+ export function getTextNodeForExport(text: string, marks: any[], params: any): XmlReadyNode;
47
56
  /**
48
57
  * Generate a w:rPr node (run properties) from marks
49
58
  *
@@ -61,6 +70,16 @@ export function generateRunProps(marks?: any[]): {
61
70
  * @returns
62
71
  */
63
72
  export function processOutputMarks(marks?: MarkType[]): any[];
73
+ export function processLinkContentNode(node: any): any;
74
+ /**
75
+ * Create a new link relationship and add it to the relationships array
76
+ *
77
+ * @param {ExportParams} params
78
+ * @param {string} link The URL of this link
79
+ * @returns {string} The new relationship ID
80
+ */
81
+ export function addNewLinkRelationship(params: ExportParams, link: string): string;
82
+ export function translateImageNode(params: any, imageSize: any): any;
64
83
  export function translateHardBreak(params: any): {
65
84
  name: string;
66
85
  elements: {
@@ -77,7 +96,6 @@ export class DocxExporter {
77
96
  schemaToXml(data: any, debug?: boolean): string;
78
97
  #private;
79
98
  }
80
- export function getFieldHighlightJson(fieldsHighlightColor: string): any;
81
99
  export type ExportParams = {
82
100
  /**
83
101
  * JSON node to translate (from PM schema)
@@ -1,2 +1 @@
1
- export * from "./documentSectionExporter.js";
2
1
  export * from "./commentsExporter.js";
@@ -0,0 +1,8 @@
1
+ export function handleSdtNode(params: any): {
2
+ nodes: any[];
3
+ consumed: number;
4
+ };
5
+ /**
6
+ * @type {Object}
7
+ */
8
+ export const sdtNodeHandlerEntity: any;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @param {Object} params
3
+ * @returns {Object|null}
4
+ */
5
+ export function handleAnnotationNode(params: any): any | null;
6
+ export function getAttrsFromElements({ sdtPr, tag, alias }: {
7
+ sdtPr: any;
8
+ tag: any;
9
+ alias: any;
10
+ }): {
11
+ type: any;
12
+ fieldId: any;
13
+ displayLabel: any;
14
+ fieldType: any;
15
+ fieldColor: any;
16
+ multipleImage: boolean;
17
+ fontFamily: any;
18
+ fontSize: any;
19
+ textColor: any;
20
+ textHighlight: any;
21
+ };
22
+ export function parseAnnotationMarks(content?: any): any;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {Object} params
3
+ * @returns {Array|null}
4
+ */
5
+ export function handleDocPartObj(params: any): any[] | null;
6
+ export function tableOfContentsHandler(params: any): any;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Handle document section node. Special case of w:sdt nodes
3
+ * @param {Object} params - The parameters containing nodes and nodeListHandler
4
+ * @returns {Object|null} An object containing the processed node and consumed count
5
+ */
6
+ export function handleDocumentSectionNode(params: any): any | null;