@harbour-enterprises/superdoc 0.14.9 → 0.14.10

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 (40) hide show
  1. package/dist/chunks/{super-editor.es-CRo90k3Y.cjs → super-editor.es-D2ZGswk-.cjs} +216 -44
  2. package/dist/chunks/{super-editor.es-Chr_NZUl.es.js → super-editor.es-GusbWHfd.es.js} +216 -44
  3. package/dist/core/SuperDoc.d.ts +1 -1
  4. package/dist/core/SuperDoc.d.ts.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/super-editor/ai-writer.es.js +2 -2
  7. package/dist/super-editor/chunks/{converter-B5dGyUBl.js → converter-CCqKj0f_.js} +193 -45
  8. package/dist/super-editor/chunks/{docx-zipper-DpKkn-tn.js → docx-zipper-ekKB1ke6.js} +1 -1
  9. package/dist/super-editor/chunks/{editor-DCx_vuYP.js → editor-CCZuUhkY.js} +32 -21
  10. package/dist/super-editor/chunks/{toolbar-CDzVNwBH.js → toolbar-CpaI75X4.js} +8 -6
  11. package/dist/super-editor/components/toolbar/defaultItems.d.ts.map +1 -1
  12. package/dist/super-editor/components/toolbar/toolbarIcons.d.ts +1 -0
  13. package/dist/super-editor/components/toolbar/toolbarTexts.d.ts +1 -0
  14. package/dist/super-editor/converter.es.js +1 -1
  15. package/dist/super-editor/core/Editor.d.ts +3 -10
  16. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  17. package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts +2 -0
  18. package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts.map +1 -1
  19. package/dist/super-editor/core/inputRules/html/html-helpers.d.ts +4 -0
  20. package/dist/super-editor/core/inputRules/html/html-helpers.d.ts.map +1 -1
  21. package/dist/super-editor/core/migrations/0.14-listsv2/listsv2migration.d.ts.map +1 -1
  22. package/dist/super-editor/core/super-converter/SuperConverter.d.ts +5 -0
  23. package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
  24. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  25. package/dist/super-editor/core/super-converter/v2/importer/annotationImporter.d.ts.map +1 -1
  26. package/dist/super-editor/docx-zipper.es.js +2 -2
  27. package/dist/super-editor/editor.es.js +3 -3
  28. package/dist/super-editor/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  29. package/dist/super-editor/extensions/image/image.d.ts.map +1 -1
  30. package/dist/super-editor/file-zipper.es.js +1 -1
  31. package/dist/super-editor/style.css +1 -1
  32. package/dist/super-editor/super-editor.es.js +18 -6
  33. package/dist/super-editor/toolbar.es.js +2 -2
  34. package/dist/super-editor.cjs +1 -1
  35. package/dist/super-editor.es.js +1 -1
  36. package/dist/superdoc.cjs +4 -4
  37. package/dist/superdoc.es.js +5 -5
  38. package/dist/superdoc.umd.js +219 -47
  39. package/dist/superdoc.umd.js.map +1 -1
  40. package/package.json +2 -2
@@ -19224,7 +19224,7 @@ function parseMarks(property, unknownMarks = [], docx = null) {
19224
19224
  seen.add(m.type);
19225
19225
  const { attributes = {} } = element;
19226
19226
  const newMark = { type: m.type };
19227
- if (attributes["w:val"] == "0" || attributes["w:val"] === "none") {
19227
+ if (attributes["w:val"] === "0" || attributes["w:val"] === "none") {
19228
19228
  return;
19229
19229
  }
19230
19230
  if (m.mark) newMark.type = m.mark;
@@ -19282,7 +19282,8 @@ function getMarkValue(markType, attributes, docx) {
19282
19282
  underline: () => attributes["w:val"],
19283
19283
  bold: () => attributes?.["w:val"] || null,
19284
19284
  italic: () => attributes?.["w:val"] || null,
19285
- highlight: () => getHighLightValue(attributes)
19285
+ highlight: () => getHighLightValue(attributes),
19286
+ strike: () => getStrikeValue(attributes)
19286
19287
  };
19287
19288
  if (!(markType in markValueMapper)) {
19288
19289
  console.debug("❗️❗️ No value mapper for:", markType, "Attributes:", attributes);
@@ -19325,6 +19326,9 @@ function getHighLightValue(attributes) {
19325
19326
  if (isValidHexColor(attributes?.["w:val"])) return `#${attributes["w:val"]}`;
19326
19327
  return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
19327
19328
  }
19329
+ function getStrikeValue(attributes) {
19330
+ return attributes?.["w:val"] === "1" ? attributes["w:val"] : null;
19331
+ }
19328
19332
  function parseProperties(node2, docx) {
19329
19333
  const marks = [];
19330
19334
  const unknownMarks = [];
@@ -20463,9 +20467,9 @@ const getAbstractDefinition = (numId, docx) => {
20463
20467
  const { elements } = def;
20464
20468
  const listData = elements[0];
20465
20469
  const numberingElements = listData.elements;
20466
- const abstractDefinitions = numberingElements.filter((style) => style.name === "w:abstractNum");
20467
- const numDefinitions = numberingElements.filter((style) => style.name === "w:num");
20468
- const numDefinition = numDefinitions.find((style) => style.attributes["w:numId"] == numId);
20470
+ const abstractDefinitions = numberingElements?.filter((style) => style.name === "w:abstractNum");
20471
+ const numDefinitions = numberingElements?.filter((style) => style.name === "w:num");
20472
+ const numDefinition = numDefinitions?.find((style) => style.attributes["w:numId"] == numId);
20469
20473
  const abstractNumId = numDefinition?.elements[0].attributes["w:val"];
20470
20474
  let listDefinitionForThisNumId = abstractDefinitions?.find(
20471
20475
  (style) => style.attributes["w:abstractNumId"] === abstractNumId
@@ -22333,6 +22337,24 @@ const generateNewListDefinition = ({ numId, listType, editor }) => {
22333
22337
  editor.emit("list-definitions-change", { change, numbering: newNumbering, editor });
22334
22338
  return { abstract: newAbstractDef, definition: newNumDef };
22335
22339
  };
22340
+ const changeNumIdSameAbstract = (numId, level, listType, editor) => {
22341
+ const newId = getNewListId(editor, "definitions");
22342
+ const { abstract } = ListHelpers.getListDefinitionDetails({ numId, level, listType, editor });
22343
+ const numbering = editor.converter.numbering;
22344
+ const newNumbering = { ...numbering };
22345
+ const newAbstractId = getNewListId(editor, "abstracts");
22346
+ const newAbstractDef = {
22347
+ ...abstract,
22348
+ attributes: {
22349
+ ...abstract.attributes,
22350
+ "w:abstractNumId": String(newAbstractId)
22351
+ }
22352
+ };
22353
+ newNumbering.abstracts[newAbstractId] = newAbstractDef;
22354
+ const newNumDef = getBasicNumIdTag(newId, newAbstractId);
22355
+ newNumbering.definitions[newId] = newNumDef;
22356
+ return newId;
22357
+ };
22336
22358
  const getBasicNumIdTag = (numId, abstractId) => {
22337
22359
  return {
22338
22360
  type: "element",
@@ -22367,7 +22389,7 @@ const getListDefinitionDetails = ({ numId, level, listType, editor }) => {
22367
22389
  const listNumberingType = listDefinition?.elements?.find((item) => item.name === "w:numFmt")?.attributes["w:val"];
22368
22390
  let customFormat;
22369
22391
  if (numFmt === "custom") customFormat = numFmtTag?.attributes?.["w:format"];
22370
- return { start, numFmt, lvlText, listNumberingType, customFormat, abstract };
22392
+ return { start, numFmt, lvlText, listNumberingType, customFormat, abstract, abstractId };
22371
22393
  };
22372
22394
  const removeListDefinitions = (listId, editor) => {
22373
22395
  const { numbering } = editor.converter;
@@ -22534,6 +22556,7 @@ const ListHelpers = {
22534
22556
  createSchemaOrderedListNode,
22535
22557
  createListItemNodeJSON,
22536
22558
  addInlineTextMarks,
22559
+ changeNumIdSameAbstract,
22537
22560
  // Base list definitions
22538
22561
  baseOrderedListDef,
22539
22562
  baseBulletList
@@ -22734,6 +22757,113 @@ function createSingleItemList(li, tag, rootNumId, level, editor, NodeInterface)
22734
22757
  newList.appendChild(newLi);
22735
22758
  return newList;
22736
22759
  }
22760
+ function unflattenListsInHtml(html) {
22761
+ const parser = new DOMParser();
22762
+ const doc2 = parser.parseFromString(html, "text/html");
22763
+ const allNodes = [...doc2.body.children];
22764
+ const listSequences = [];
22765
+ let currentSequence = null;
22766
+ allNodes.forEach((node2, index) => {
22767
+ const isFlattenList = node2.tagName && (node2.tagName === "OL" || node2.tagName === "UL") && node2.hasAttribute("data-list-id");
22768
+ if (isFlattenList) {
22769
+ const listId = node2.getAttribute("data-list-id");
22770
+ if (currentSequence && currentSequence.id === listId) {
22771
+ currentSequence.lists.push({ element: node2, index });
22772
+ } else {
22773
+ currentSequence = {
22774
+ id: listId,
22775
+ lists: [{ element: node2, index }]
22776
+ };
22777
+ listSequences.push(currentSequence);
22778
+ }
22779
+ } else {
22780
+ currentSequence = null;
22781
+ }
22782
+ });
22783
+ listSequences.reverse().forEach((sequence) => {
22784
+ const sequenceLists = sequence.lists;
22785
+ if (sequenceLists.length === 0) {
22786
+ return;
22787
+ }
22788
+ const items = sequenceLists.map(({ element: list }) => {
22789
+ const liElement = list.querySelector("li");
22790
+ if (!liElement) return null;
22791
+ return {
22792
+ element: liElement,
22793
+ level: parseInt(liElement.getAttribute("data-level") || "0"),
22794
+ numFmt: liElement.getAttribute("data-num-fmt") || "bullet",
22795
+ listLevel: JSON.parse(liElement.getAttribute("data-list-level") || "[1]")
22796
+ };
22797
+ }).filter((item) => item !== null);
22798
+ if (items.length === 0) {
22799
+ return;
22800
+ }
22801
+ const rootList = buildNestedList({ items });
22802
+ const firstOriginalList = sequenceLists[0].element;
22803
+ firstOriginalList?.parentNode?.insertBefore(rootList, firstOriginalList);
22804
+ sequenceLists.forEach(({ element: list }) => {
22805
+ if (list.parentNode) list.parentNode.removeChild(list);
22806
+ });
22807
+ });
22808
+ return doc2.body.innerHTML;
22809
+ }
22810
+ function buildNestedList({ items }) {
22811
+ if (!items.length) {
22812
+ return null;
22813
+ }
22814
+ const [rootItem] = items;
22815
+ const doc2 = rootItem.element.ownerDocument;
22816
+ const isOrderedList = rootItem.numFmt && !["bullet", "none"].includes(rootItem.numFmt);
22817
+ const rootList = doc2.createElement(isOrderedList ? "ol" : "ul");
22818
+ if (isOrderedList && rootItem.listLevel?.[0] && rootItem.listLevel[0] > 1) {
22819
+ rootList.setAttribute("start", rootItem.listLevel[0]);
22820
+ }
22821
+ const lastLevelItem = /* @__PURE__ */ new Map();
22822
+ items.forEach((item) => {
22823
+ const { element: liElement, level, numFmt, listLevel } = item;
22824
+ const cleanLi = cleanListItem(liElement.cloneNode(true));
22825
+ if (level === 0) {
22826
+ rootList.append(cleanLi);
22827
+ lastLevelItem.set(0, cleanLi);
22828
+ } else {
22829
+ const parentLi = lastLevelItem.get(level - 1);
22830
+ if (!parentLi) {
22831
+ rootList.append(cleanLi);
22832
+ lastLevelItem.set(level, cleanLi);
22833
+ return;
22834
+ }
22835
+ let nestedList = null;
22836
+ [...parentLi.children].forEach((child) => {
22837
+ if (child.tagName && (child.tagName === "OL" || child.tagName === "UL")) {
22838
+ nestedList = child;
22839
+ }
22840
+ });
22841
+ if (!nestedList) {
22842
+ const listType = numFmt && !["bullet", "none"].includes(numFmt) ? "ol" : "ul";
22843
+ nestedList = doc2.createElement(listType);
22844
+ parentLi.append(nestedList);
22845
+ }
22846
+ nestedList.append(cleanLi);
22847
+ lastLevelItem.set(level, cleanLi);
22848
+ }
22849
+ });
22850
+ return rootList;
22851
+ }
22852
+ function cleanListItem(listItem) {
22853
+ const attrs = [
22854
+ "data-num-id",
22855
+ "data-level",
22856
+ "data-num-fmt",
22857
+ "data-lvl-text",
22858
+ "data-list-level",
22859
+ "data-marker-type",
22860
+ "aria-label"
22861
+ ];
22862
+ attrs.forEach((attr) => {
22863
+ listItem.removeAttribute(attr);
22864
+ });
22865
+ return listItem;
22866
+ }
22737
22867
  class InputRule {
22738
22868
  constructor(config) {
22739
22869
  __publicField(this, "match");
@@ -23938,6 +24068,7 @@ function translateImageNode(params, imageSize) {
23938
24068
  let imageId = attrs.rId;
23939
24069
  const src = attrs.src || attrs.imageSrc;
23940
24070
  const { originalWidth, originalHeight } = getPngDimensions(src);
24071
+ const imageName = params.node.type === "image" ? src?.split("word/media/")[1] : attrs.fieldId?.replace("-", "_");
23941
24072
  let size = attrs.size ? {
23942
24073
  w: pixelsToEmu(attrs.size.width),
23943
24074
  h: pixelsToEmu(attrs.size.height)
@@ -23967,11 +24098,9 @@ function translateImageNode(params, imageSize) {
23967
24098
  if (!type2) {
23968
24099
  return prepareTextAnnotation(params);
23969
24100
  }
23970
- const hash = generateDocxRandomId(4);
23971
- const cleanUrl = attrs.fieldId.replace("-", "_");
23972
- const imageUrl = `media/${cleanUrl}_${hash}.${type2}`;
24101
+ const imageUrl = `media/${imageName}_${attrs.hash}.${type2}`;
23973
24102
  imageId = addNewImageRelationship(params, imageUrl);
23974
- params.media[`${cleanUrl}_${hash}.${type2}`] = src;
24103
+ params.media[`${imageName}_${attrs.hash}.${type2}`] = src;
23975
24104
  }
23976
24105
  let inlineAttrs = attrs.originalPadding || {
23977
24106
  distT: 0,
@@ -24096,8 +24225,7 @@ function translateImageNode(params, imageSize) {
24096
24225
  name: "wp:docPr",
24097
24226
  attributes: {
24098
24227
  id: attrs.id || 0,
24099
- name: attrs.alt,
24100
- descr: attrs.title
24228
+ name: attrs.alt || `Picture ${imageName}`
24101
24229
  }
24102
24230
  },
24103
24231
  {
@@ -24131,7 +24259,7 @@ function translateImageNode(params, imageSize) {
24131
24259
  name: "pic:cNvPr",
24132
24260
  attributes: {
24133
24261
  id: attrs.id || 0,
24134
- name: attrs.title
24262
+ name: attrs.title || `Picture ${imageName}`
24135
24263
  }
24136
24264
  },
24137
24265
  {
@@ -24241,12 +24369,31 @@ function prepareHtmlAnnotation(params) {
24241
24369
  state2 = applyMarksToHtmlAnnotation(state2, allMarks);
24242
24370
  }
24243
24371
  const htmlAnnotationNode = state2.doc.toJSON();
24372
+ const listTypes = ["bulletList", "orderedList"];
24373
+ const { editor } = params;
24374
+ const seenLists = /* @__PURE__ */ new Map();
24375
+ state2.doc.descendants((node2, pos) => {
24376
+ if (listTypes.includes(node2.type.name)) {
24377
+ const listItem = node2.firstChild;
24378
+ const { attrs: attrs2 } = listItem;
24379
+ const { level, numId } = attrs2;
24380
+ if (!seenLists.has(numId)) {
24381
+ const newNumId = ListHelpers.changeNumIdSameAbstract(numId, level, node2.type.name, editor);
24382
+ listItem.attrs.numId = newNumId;
24383
+ seenLists.set(numId, newNumId);
24384
+ } else {
24385
+ const newNumId = seenLists.get(numId);
24386
+ listItem.attrs.numId = newNumId;
24387
+ }
24388
+ }
24389
+ });
24390
+ const elements = translateChildNodes({
24391
+ ...params,
24392
+ node: htmlAnnotationNode
24393
+ });
24244
24394
  return {
24245
24395
  name: "htmlAnnotation",
24246
- elements: translateChildNodes({
24247
- ...params,
24248
- node: htmlAnnotationNode
24249
- })
24396
+ elements
24250
24397
  };
24251
24398
  }
24252
24399
  function prepareImageAnnotation(params, imageSize) {
@@ -25383,6 +25530,7 @@ const handleAnnotationNode = (params) => {
25383
25530
  }
25384
25531
  const { attrs: marksAsAttrs, marks } = parseAnnotationMarks(sdtContent);
25385
25532
  const allAttrs = { ...attrs, ...marksAsAttrs };
25533
+ allAttrs.hash = generateDocxRandomId(4);
25386
25534
  if (!attrs.fieldId || !attrs.displayLabel) {
25387
25535
  return { nodes: [], consumed: 0 };
25388
25536
  }
@@ -26378,7 +26526,7 @@ const _SuperConverter = class _SuperConverter {
26378
26526
  return;
26379
26527
  }
26380
26528
  }
26381
- static updateDocumentVersion(docx = this.convertedXml, version = "0.14.9") {
26529
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.14.10") {
26382
26530
  const customLocation = "docProps/custom.xml";
26383
26531
  if (!docx[customLocation]) {
26384
26532
  docx[customLocation] = generateCustomXml();
@@ -26769,7 +26917,6 @@ exportProcessNewRelationships_fn = function(rels = []) {
26769
26917
  newRels.push(rel);
26770
26918
  });
26771
26919
  relationships.elements = [...relationships.elements, ...newRels];
26772
- this.convertedXml["word/_rels/document.xml.rels"] = relsData;
26773
26920
  };
26774
26921
  exportProcessMediaFiles_fn = async function(media, editor) {
26775
26922
  const processedData = {};
@@ -26813,7 +26960,7 @@ __publicField(_SuperConverter, "markTypes", [
26813
26960
  { name: "w:i", type: "italic" },
26814
26961
  { name: "w:iCs", type: "italic" },
26815
26962
  { name: "w:u", type: "underline", mark: "underline", property: "underlineType" },
26816
- { name: "w:strike", type: "strike" },
26963
+ { name: "w:strike", type: "strike", mark: "strike" },
26817
26964
  { name: "w:color", type: "color", mark: "textStyle", property: "color" },
26818
26965
  { name: "w:sz", type: "fontSize", mark: "textStyle", property: "fontSize" },
26819
26966
  { name: "w:szCs", type: "fontSize", mark: "textStyle", property: "fontSize" },
@@ -26857,7 +27004,7 @@ function storeSuperdocVersion(docx) {
26857
27004
  function generateCustomXml() {
26858
27005
  return DEFAULT_CUSTOM_XML;
26859
27006
  }
26860
- function generateSuperdocVersion(pid = 2, version = "0.14.9") {
27007
+ function generateSuperdocVersion(pid = 2, version = "0.14.10") {
26861
27008
  return {
26862
27009
  type: "element",
26863
27010
  name: "property",
@@ -26920,30 +27067,31 @@ export {
26920
27067
  EditorState as a7,
26921
27068
  hasSomeParentWithClass as a8,
26922
27069
  isActive as a9,
26923
- parseSizeUnit as aa,
26924
- minMax as ab,
26925
- getLineHeightValueString as ac,
26926
- InputRule as ad,
26927
- kebabCase as ae,
26928
- generateOrderedListIndex as af,
26929
- getListItemStyleDefinitions as ag,
26930
- docxNumberigHelpers as ah,
26931
- parseIndentElement as ai,
26932
- combineIndents as aj,
26933
- getColStyleDeclaration as ak,
26934
- SelectionRange as al,
26935
- Transform as am,
26936
- isInTable as an,
26937
- createColGroup as ao,
26938
- generateDocxRandomId as ap,
26939
- commonjsGlobal as aq,
26940
- getDefaultExportFromCjs$1 as ar,
26941
- getContentTypesFromXml as as,
26942
- xmljs as at,
26943
- vClickOutside as au,
26944
- getActiveFormatting as av,
26945
- readFromClipboard as aw,
26946
- handleClipboardPaste as ax,
27070
+ unflattenListsInHtml as aa,
27071
+ parseSizeUnit as ab,
27072
+ minMax as ac,
27073
+ getLineHeightValueString as ad,
27074
+ InputRule as ae,
27075
+ kebabCase as af,
27076
+ generateOrderedListIndex as ag,
27077
+ getListItemStyleDefinitions as ah,
27078
+ docxNumberigHelpers as ai,
27079
+ parseIndentElement as aj,
27080
+ combineIndents as ak,
27081
+ getColStyleDeclaration as al,
27082
+ SelectionRange as am,
27083
+ Transform as an,
27084
+ isInTable as ao,
27085
+ createColGroup as ap,
27086
+ generateDocxRandomId as aq,
27087
+ commonjsGlobal as ar,
27088
+ getDefaultExportFromCjs$1 as as,
27089
+ getContentTypesFromXml as at,
27090
+ xmljs as au,
27091
+ vClickOutside as av,
27092
+ getActiveFormatting as aw,
27093
+ readFromClipboard as ax,
27094
+ handleClipboardPaste as ay,
26947
27095
  getMarkType as b,
26948
27096
  callOrGet as c,
26949
27097
  getMarksFromSelection as d,
@@ -1,4 +1,4 @@
1
- import { H as process$1, aq as commonjsGlobal, I as Buffer, ar as getDefaultExportFromCjs, as as getContentTypesFromXml, at as xmljs } from "./converter-B5dGyUBl.js";
1
+ import { H as process$1, ar as commonjsGlobal, I as Buffer, as as getDefaultExportFromCjs, at as getContentTypesFromXml, au as xmljs } from "./converter-CCqKj0f_.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ 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, _commandService, _css, _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, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _ListItemNodeView_instances, init_fn2, _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, c as callOrGet, g as getExtensionConfigField, b as getMarkType, d as getMarksFromSelection, e as getNodeType, f as getSchemaTypeNameByName, S as Schema$1, h as cleanSchemaItem, T as TextSelection, i as canSplit, l as liftTarget, A as AllSelection, j as canJoin, k as joinPoint, N as NodeSelection, m as Selection, r as replaceStep$1, F as Fragment, R as ReplaceAroundStep$1, n as Slice, o as defaultBlockAt$1, p as isTextSelection, q as getMarkRange, s as isMarkActive, t as isNodeActive, u as deleteProps, D as DOMParser$1, v as ReplaceStep, w as NodeRange, x as findWrapping, y as findParentNode, L as ListHelpers, z as isMacOS, B as isIOS, C as DOMSerializer, E as Mark$1, G as dropPoint, H as process$1, I as Buffer2, J as getSchemaTypeByName, K as inputRulesPlugin, O as TrackDeleteMarkName, Q as TrackInsertMarkName, U as v4, V as TrackFormatMarkName, W as comments_module_events, X as findMark, Y as objectIncludes, Z as AddMarkStep, _ as RemoveMarkStep, $ as twipsToLines, a0 as pixelsToTwips, a1 as findParentNodeClosestToPos, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as EditorState, a8 as hasSomeParentWithClass, a9 as isActive, aa as parseSizeUnit, ab as minMax, ac as getLineHeightValueString, ad as InputRule, ae as kebabCase, af as generateOrderedListIndex, ag as getListItemStyleDefinitions, ah as docxNumberigHelpers, ai as parseIndentElement, aj as combineIndents, ak as getColStyleDeclaration, al as SelectionRange, am as Transform, an as isInTable$1, ao as createColGroup, ap as generateDocxRandomId } from "./converter-B5dGyUBl.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, g as getExtensionConfigField, b as getMarkType, d as getMarksFromSelection, e as getNodeType, f as getSchemaTypeNameByName, S as Schema$1, h as cleanSchemaItem, T as TextSelection, i as canSplit, l as liftTarget, A as AllSelection, j as canJoin, k as joinPoint, N as NodeSelection, m as Selection, r as replaceStep$1, F as Fragment, R as ReplaceAroundStep$1, n as Slice, o as defaultBlockAt$1, p as isTextSelection, q as getMarkRange, s as isMarkActive, t as isNodeActive, u as deleteProps, D as DOMParser$1, v as ReplaceStep, w as NodeRange, x as findWrapping, y as findParentNode, L as ListHelpers, z as isMacOS, B as isIOS, C as DOMSerializer, E as Mark$1, G as dropPoint, H as process$1, I as Buffer2, J as getSchemaTypeByName, K as inputRulesPlugin, O as TrackDeleteMarkName, Q as TrackInsertMarkName, U as v4, V as TrackFormatMarkName, W as comments_module_events, X as findMark, Y as objectIncludes, Z as AddMarkStep, _ as RemoveMarkStep, $ as twipsToLines, a0 as pixelsToTwips, a1 as findParentNodeClosestToPos, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as EditorState, a8 as hasSomeParentWithClass, a9 as isActive, aa as unflattenListsInHtml, ab as parseSizeUnit, ac as minMax, ad as getLineHeightValueString, ae as InputRule, af as kebabCase, ag as generateOrderedListIndex, ah as getListItemStyleDefinitions, ai as docxNumberigHelpers, aj as parseIndentElement, ak as combineIndents, al as getColStyleDeclaration, am as SelectionRange, an as Transform, ao as isInTable$1, ap as createColGroup, aq as generateDocxRandomId } from "./converter-CCqKj0f_.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-DpKkn-tn.js";
17
+ import { D as DocxZipper } from "./docx-zipper-ekKB1ke6.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -12751,6 +12751,9 @@ const generateMissingListDefinition = (listNode, editor) => {
12751
12751
  const migrateParagraphFieldsListsV2 = async (annotationValues = [], editor) => {
12752
12752
  const annotations = getAllFieldAnnotations(editor.state);
12753
12753
  const newValues = [];
12754
+ if (!annotations.length) {
12755
+ return annotationValues;
12756
+ }
12754
12757
  for (const annotation of annotations) {
12755
12758
  const type = annotation.node?.attrs?.type;
12756
12759
  const matchedAnnotation = annotationValues.find((v) => v.input_id === annotation.node.attrs.fieldId);
@@ -13405,9 +13408,6 @@ const _Editor = class _Editor extends EventEmitter {
13405
13408
  const attributes = typeof nameOrAttributes === "string" ? attributesOrUndefined : nameOrAttributes;
13406
13409
  return isActive(this.state, name, attributes);
13407
13410
  }
13408
- /**
13409
- * Get the document as JSON.
13410
- */
13411
13411
  /**
13412
13412
  * Get the editor content as JSON
13413
13413
  * @returns {Object} Editor content as JSON
@@ -13415,18 +13415,20 @@ const _Editor = class _Editor extends EventEmitter {
13415
13415
  getJSON() {
13416
13416
  return this.state.doc.toJSON();
13417
13417
  }
13418
- /**
13419
- * Get HTML string of the document
13420
- */
13421
13418
  /**
13422
13419
  * Get the editor content as HTML
13423
13420
  * @returns {string} Editor content as HTML
13424
13421
  */
13425
- getHTML() {
13426
- const div2 = document.createElement("div");
13422
+ getHTML({ unflattenLists = false } = {}) {
13423
+ const tempDocument = document.implementation.createHTMLDocument();
13424
+ const container = tempDocument.createElement("div");
13427
13425
  const fragment = DOMSerializer.fromSchema(this.schema).serializeFragment(this.state.doc.content);
13428
- div2.appendChild(fragment);
13429
- return div2.innerHTML;
13426
+ container.appendChild(fragment);
13427
+ let html = container.innerHTML;
13428
+ if (unflattenLists) {
13429
+ html = unflattenListsInHtml(html);
13430
+ }
13431
+ return html;
13430
13432
  }
13431
13433
  /**
13432
13434
  * Create a child editor linked to this editor.
@@ -13438,9 +13440,6 @@ const _Editor = class _Editor extends EventEmitter {
13438
13440
  createChildEditor(options) {
13439
13441
  return createLinkedChildEditor(this, options);
13440
13442
  }
13441
- /**
13442
- * Get page styles
13443
- */
13444
13443
  /**
13445
13444
  * Get page styles
13446
13445
  * @returns {Object} Page styles
@@ -13605,7 +13604,7 @@ const _Editor = class _Editor extends EventEmitter {
13605
13604
  * @returns {Object | void} Migration results
13606
13605
  */
13607
13606
  processCollaborationMigrations() {
13608
- console.debug("[checkVersionMigrations] Current editor version", "0.14.9");
13607
+ console.debug("[checkVersionMigrations] Current editor version", "0.14.10");
13609
13608
  if (!this.options.ydoc) return;
13610
13609
  const metaMap = this.options.ydoc.getMap("meta");
13611
13610
  let docVersion = metaMap.get("version");
@@ -13735,7 +13734,8 @@ const _Editor = class _Editor extends EventEmitter {
13735
13734
  */
13736
13735
  async migrateParagraphFields(annotationValues = []) {
13737
13736
  if (!Array.isArray(annotationValues) || !annotationValues.length) return annotationValues;
13738
- return await migrateParagraphFieldsListsV2(annotationValues, this);
13737
+ const result = await migrateParagraphFieldsListsV2(annotationValues, this);
13738
+ return result;
13739
13739
  }
13740
13740
  /**
13741
13741
  * Annotate the document with the given annotation values.
@@ -16274,7 +16274,7 @@ const ListItem = Node$1.create({
16274
16274
  renderDOM: (attrs) => {
16275
16275
  if (attrs.level === void 0 || attrs.level === null) return {};
16276
16276
  return {
16277
- "data-level": JSON.stringify(attrs.level)
16277
+ "data-level": attrs.level
16278
16278
  };
16279
16279
  }
16280
16280
  },
@@ -20564,6 +20564,10 @@ const FieldAnnotation = Node$1.create({
20564
20564
  generatorIndex: {
20565
20565
  rendered: false,
20566
20566
  default: null
20567
+ },
20568
+ hash: {
20569
+ rendered: false,
20570
+ default: null
20567
20571
  }
20568
20572
  };
20569
20573
  },
@@ -20673,6 +20677,7 @@ const FieldAnnotation = Node$1.create({
20673
20677
  currentMarks = currentMarks.length ? [...currentMarks] : null;
20674
20678
  let formatAttrs = getFormatAttrsFromMarks(currentMarks);
20675
20679
  let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
20680
+ attrs.hash = generateDocxRandomId(4);
20676
20681
  let node = schema.nodes[this.name].create({
20677
20682
  ...attrs,
20678
20683
  ...formatAttrs,
@@ -20710,6 +20715,7 @@ const FieldAnnotation = Node$1.create({
20710
20715
  let newPosFrom = tr.mapping.map(from2);
20711
20716
  let newPosTo = tr.mapping.map(to);
20712
20717
  let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
20718
+ attrs.hash = generateDocxRandomId(4);
20713
20719
  let node = schema.nodes[this.name].create({
20714
20720
  ...attrs,
20715
20721
  defaultDisplayLabel
@@ -21376,7 +21382,7 @@ const Image = Node$1.create({
21376
21382
  }
21377
21383
  },
21378
21384
  alt: {
21379
- default: null
21385
+ default: "Uploaded picture"
21380
21386
  },
21381
21387
  id: { rendered: false },
21382
21388
  title: {
@@ -21423,11 +21429,16 @@ const Image = Node$1.create({
21423
21429
  },
21424
21430
  marginOffset: {
21425
21431
  default: {},
21426
- renderDOM: ({ marginOffset }) => {
21432
+ renderDOM: ({ marginOffset, anchorData }) => {
21433
+ const relativeFromPageV = anchorData?.vRelativeFrom === "page";
21434
+ const maxMarginV = 500;
21427
21435
  const { left: left2 = 0, top: top2 = 0 } = marginOffset ?? {};
21428
21436
  let style = "";
21429
21437
  if (left2) style += `margin-left: ${left2}px;`;
21430
- if (top2) style += `margin-top: ${top2}px;`;
21438
+ if (top2) {
21439
+ if (relativeFromPageV && top2 >= maxMarginV) style += `margin-top: ${maxMarginV}px;`;
21440
+ else style += `margin-top: ${top2}px;`;
21441
+ }
21431
21442
  return { style };
21432
21443
  }
21433
21444
  },
@@ -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 { H as process$1 } from "./converter-B5dGyUBl.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DCx_vuYP.js";
2
+ import { H as process$1 } from "./converter-CCqKj0f_.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CCZuUhkY.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -87,6 +87,7 @@ const magnifyingGlassSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0
87
87
  const scissorsIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M278.1 256L444.5 89.6c4.7-4.7 4.7-12.3 0-17-32.8-32.8-86-32.8-118.8 0L210.2 188.1l-24.9-24.9c4.3-10.9 6.7-22.8 6.7-35.3 0-53-43-96-96-96S0 75 0 128s43 96 96 96c4.5 0 9-.3 13.4-.9L142.3 256l-32.9 32.9c-4.4-.6-8.8-.9-13.4-.9-53 0-96 43-96 96s43 96 96 96 96-43 96-96c0-12.5-2.4-24.3-6.7-35.3l24.9-24.9L325.7 439.4c32.8 32.8 86 32.8 118.8 0 4.7-4.7 4.7-12.3 0-17L278.1 256zM96 160c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32zm0 256c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32z"/></svg>';
88
88
  const copyIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 448v40c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V120c0-13.3 10.7-24 24-24h72v296c0 30.9 25.1 56 56 56h168zm0-344V0H152c-13.3 0-24 10.7-24 24v368c0 13.3 10.7 24 24 24h272c13.3 0 24-10.7 24-24V128H344c-13.2 0-24-10.8-24-24zm121-31L375 7A24 24 0 0 0 358.1 0H352v96h96v-6.1a24 24 0 0 0 -7-17z"/></svg>';
89
89
  const pasteIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 184c0-30.9 25.1-56 56-56h136V56c0-13.3-10.7-24-24-24h-80.6C204.3 12.9 183.6 0 160 0s-44.3 12.9-55.4 32H24C10.7 32 0 42.7 0 56v336c0 13.3 10.7 24 24 24h104V184zm32-144c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm184 248h104v200c0 13.3-10.7 24-24 24H184c-13.3 0-24-10.7-24-24V184c0-13.3 10.7-24 24-24h136v104c0 13.2 10.8 24 24 24zm104-38.1V256h-96v-96h6.1a24 24 0 0 1 17 7l65.9 65.9a24 24 0 0 1 7 17z"/></svg>';
90
+ const strikethroughSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"/></svg>\n';
90
91
  const toolbarIcons = {
91
92
  undo: rotateLeftIconSvg,
92
93
  redo: rotateRightIconSvg,
@@ -133,7 +134,8 @@ const toolbarIcons = {
133
134
  search: magnifyingGlassSvg,
134
135
  cut: scissorsIconSvg,
135
136
  copy: copyIconSvg,
136
- paste: pasteIconSvg
137
+ paste: pasteIconSvg,
138
+ strikethrough: strikethroughSvg
137
139
  };
138
140
  const _hoisted_1$4 = { class: "toolbar-icon" };
139
141
  const _hoisted_2$3 = ["innerHTML"];
@@ -9785,11 +9787,11 @@ const _sfc_main$1 = {
9785
9787
  const isMobile = window.matchMedia("(max-width: 768px)").matches;
9786
9788
  const styleMap = {
9787
9789
  left: {
9788
- minWidth: "140px",
9790
+ minWidth: "120px",
9789
9791
  justifyContent: "flex-start"
9790
9792
  },
9791
9793
  right: {
9792
- minWidth: "140px",
9794
+ minWidth: "120px",
9793
9795
  justifyContent: "flex-end"
9794
9796
  },
9795
9797
  default: {
@@ -10022,7 +10024,7 @@ const _sfc_main$1 = {
10022
10024
  };
10023
10025
  }
10024
10026
  };
10025
- const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-630d1841"]]);
10027
+ const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-a40b6226"]]);
10026
10028
  const _sfc_main = {
10027
10029
  __name: "Toolbar",
10028
10030
  emits: ["command", "toggle", "select"],
@@ -1 +1 @@
1
- {"version":3,"file":"defaultItems.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar/defaultItems.js"],"names":[],"mappings":"AAsBO;;;;;EAy+BN;AAEM,sEAEJ;;;CAAuB,UASvB"}
1
+ {"version":3,"file":"defaultItems.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar/defaultItems.js"],"names":[],"mappings":"AAsBO;;;;;EAs/BN;AAEM,sEAEJ;;;CAAuB,UASvB"}
@@ -45,5 +45,6 @@ export namespace toolbarIcons {
45
45
  export { scissorsIconSvg as cut };
46
46
  export { copyIconSvg as copy };
47
47
  export { pasteIconSvg as paste };
48
+ export { strikethroughSvg as strikethrough };
48
49
  }
49
50
  //# sourceMappingURL=toolbarIcons.d.ts.map
@@ -6,6 +6,7 @@ export namespace toolbarTexts {
6
6
  let italic: string;
7
7
  let underline: string;
8
8
  let highlight: string;
9
+ let strikethrough: string;
9
10
  let color: string;
10
11
  let search: string;
11
12
  let link: string;
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-B5dGyUBl.js";
1
+ import { a5 } from "./chunks/converter-CCqKj0f_.js";
2
2
  export {
3
3
  a5 as SuperConverter
4
4
  };
@@ -390,22 +390,18 @@ export class Editor extends EventEmitter {
390
390
  * editor.isActive({ textAlign: 'center' })
391
391
  */
392
392
  isActive(nameOrAttributes: string | any, attributesOrUndefined?: any): boolean;
393
- /**
394
- * Get the document as JSON.
395
- */
396
393
  /**
397
394
  * Get the editor content as JSON
398
395
  * @returns {Object} Editor content as JSON
399
396
  */
400
397
  getJSON(): any;
401
- /**
402
- * Get HTML string of the document
403
- */
404
398
  /**
405
399
  * Get the editor content as HTML
406
400
  * @returns {string} Editor content as HTML
407
401
  */
408
- getHTML(): string;
402
+ getHTML({ unflattenLists }?: {
403
+ unflattenLists?: boolean;
404
+ }): string;
409
405
  /**
410
406
  * Create a child editor linked to this editor.
411
407
  * This is useful for creating header/footer editors that are linked to the main editor.
@@ -414,9 +410,6 @@ export class Editor extends EventEmitter {
414
410
  * @returns {Editor} A new child editor instance linked to this editor
415
411
  */
416
412
  createChildEditor(options: EditorOptions): Editor;
417
- /**
418
- * Get page styles
419
- */
420
413
  /**
421
414
  * Get page styles
422
415
  * @returns {Object} Page styles