@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
@@ -19222,7 +19222,7 @@ function parseMarks(property2, unknownMarks = [], docx = null) {
19222
19222
  seen.add(m.type);
19223
19223
  const { attributes = {} } = element;
19224
19224
  const newMark = { type: m.type };
19225
- if (attributes["w:val"] == "0" || attributes["w:val"] === "none") {
19225
+ if (attributes["w:val"] === "0" || attributes["w:val"] === "none") {
19226
19226
  return;
19227
19227
  }
19228
19228
  if (m.mark) newMark.type = m.mark;
@@ -19280,7 +19280,8 @@ function getMarkValue(markType, attributes, docx) {
19280
19280
  underline: () => attributes["w:val"],
19281
19281
  bold: () => attributes?.["w:val"] || null,
19282
19282
  italic: () => attributes?.["w:val"] || null,
19283
- highlight: () => getHighLightValue(attributes)
19283
+ highlight: () => getHighLightValue(attributes),
19284
+ strike: () => getStrikeValue(attributes)
19284
19285
  };
19285
19286
  if (!(markType in markValueMapper)) {
19286
19287
  console.debug("❗️❗️ No value mapper for:", markType, "Attributes:", attributes);
@@ -19323,6 +19324,9 @@ function getHighLightValue(attributes) {
19323
19324
  if (isValidHexColor(attributes?.["w:val"])) return `#${attributes["w:val"]}`;
19324
19325
  return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
19325
19326
  }
19327
+ function getStrikeValue(attributes) {
19328
+ return attributes?.["w:val"] === "1" ? attributes["w:val"] : null;
19329
+ }
19326
19330
  function parseProperties(node2, docx) {
19327
19331
  const marks = [];
19328
19332
  const unknownMarks = [];
@@ -20461,9 +20465,9 @@ const getAbstractDefinition = (numId, docx) => {
20461
20465
  const { elements } = def;
20462
20466
  const listData = elements[0];
20463
20467
  const numberingElements = listData.elements;
20464
- const abstractDefinitions = numberingElements.filter((style2) => style2.name === "w:abstractNum");
20465
- const numDefinitions = numberingElements.filter((style2) => style2.name === "w:num");
20466
- const numDefinition = numDefinitions.find((style2) => style2.attributes["w:numId"] == numId);
20468
+ const abstractDefinitions = numberingElements?.filter((style2) => style2.name === "w:abstractNum");
20469
+ const numDefinitions = numberingElements?.filter((style2) => style2.name === "w:num");
20470
+ const numDefinition = numDefinitions?.find((style2) => style2.attributes["w:numId"] == numId);
20467
20471
  const abstractNumId = numDefinition?.elements[0].attributes["w:val"];
20468
20472
  let listDefinitionForThisNumId = abstractDefinitions?.find(
20469
20473
  (style2) => style2.attributes["w:abstractNumId"] === abstractNumId
@@ -22331,6 +22335,24 @@ const generateNewListDefinition = ({ numId, listType, editor }) => {
22331
22335
  editor.emit("list-definitions-change", { change, numbering: newNumbering, editor });
22332
22336
  return { abstract: newAbstractDef, definition: newNumDef };
22333
22337
  };
22338
+ const changeNumIdSameAbstract = (numId, level, listType, editor) => {
22339
+ const newId = getNewListId(editor, "definitions");
22340
+ const { abstract } = ListHelpers.getListDefinitionDetails({ numId, level, listType, editor });
22341
+ const numbering = editor.converter.numbering;
22342
+ const newNumbering = { ...numbering };
22343
+ const newAbstractId = getNewListId(editor, "abstracts");
22344
+ const newAbstractDef = {
22345
+ ...abstract,
22346
+ attributes: {
22347
+ ...abstract.attributes,
22348
+ "w:abstractNumId": String(newAbstractId)
22349
+ }
22350
+ };
22351
+ newNumbering.abstracts[newAbstractId] = newAbstractDef;
22352
+ const newNumDef = getBasicNumIdTag(newId, newAbstractId);
22353
+ newNumbering.definitions[newId] = newNumDef;
22354
+ return newId;
22355
+ };
22334
22356
  const getBasicNumIdTag = (numId, abstractId) => {
22335
22357
  return {
22336
22358
  type: "element",
@@ -22365,7 +22387,7 @@ const getListDefinitionDetails = ({ numId, level, listType, editor }) => {
22365
22387
  const listNumberingType = listDefinition?.elements?.find((item) => item.name === "w:numFmt")?.attributes["w:val"];
22366
22388
  let customFormat;
22367
22389
  if (numFmt === "custom") customFormat = numFmtTag?.attributes?.["w:format"];
22368
- return { start: start2, numFmt, lvlText, listNumberingType, customFormat, abstract };
22390
+ return { start: start2, numFmt, lvlText, listNumberingType, customFormat, abstract, abstractId };
22369
22391
  };
22370
22392
  const removeListDefinitions = (listId, editor) => {
22371
22393
  const { numbering } = editor.converter;
@@ -22532,6 +22554,7 @@ const ListHelpers = {
22532
22554
  createSchemaOrderedListNode,
22533
22555
  createListItemNodeJSON,
22534
22556
  addInlineTextMarks,
22557
+ changeNumIdSameAbstract,
22535
22558
  // Base list definitions
22536
22559
  baseOrderedListDef,
22537
22560
  baseBulletList
@@ -22732,6 +22755,113 @@ function createSingleItemList(li, tag, rootNumId, level, editor, NodeInterface)
22732
22755
  newList.appendChild(newLi);
22733
22756
  return newList;
22734
22757
  }
22758
+ function unflattenListsInHtml(html) {
22759
+ const parser = new DOMParser();
22760
+ const doc2 = parser.parseFromString(html, "text/html");
22761
+ const allNodes = [...doc2.body.children];
22762
+ const listSequences = [];
22763
+ let currentSequence = null;
22764
+ allNodes.forEach((node2, index2) => {
22765
+ const isFlattenList = node2.tagName && (node2.tagName === "OL" || node2.tagName === "UL") && node2.hasAttribute("data-list-id");
22766
+ if (isFlattenList) {
22767
+ const listId = node2.getAttribute("data-list-id");
22768
+ if (currentSequence && currentSequence.id === listId) {
22769
+ currentSequence.lists.push({ element: node2, index: index2 });
22770
+ } else {
22771
+ currentSequence = {
22772
+ id: listId,
22773
+ lists: [{ element: node2, index: index2 }]
22774
+ };
22775
+ listSequences.push(currentSequence);
22776
+ }
22777
+ } else {
22778
+ currentSequence = null;
22779
+ }
22780
+ });
22781
+ listSequences.reverse().forEach((sequence) => {
22782
+ const sequenceLists = sequence.lists;
22783
+ if (sequenceLists.length === 0) {
22784
+ return;
22785
+ }
22786
+ const items = sequenceLists.map(({ element: list }) => {
22787
+ const liElement = list.querySelector("li");
22788
+ if (!liElement) return null;
22789
+ return {
22790
+ element: liElement,
22791
+ level: parseInt(liElement.getAttribute("data-level") || "0"),
22792
+ numFmt: liElement.getAttribute("data-num-fmt") || "bullet",
22793
+ listLevel: JSON.parse(liElement.getAttribute("data-list-level") || "[1]")
22794
+ };
22795
+ }).filter((item) => item !== null);
22796
+ if (items.length === 0) {
22797
+ return;
22798
+ }
22799
+ const rootList = buildNestedList({ items });
22800
+ const firstOriginalList = sequenceLists[0].element;
22801
+ firstOriginalList?.parentNode?.insertBefore(rootList, firstOriginalList);
22802
+ sequenceLists.forEach(({ element: list }) => {
22803
+ if (list.parentNode) list.parentNode.removeChild(list);
22804
+ });
22805
+ });
22806
+ return doc2.body.innerHTML;
22807
+ }
22808
+ function buildNestedList({ items }) {
22809
+ if (!items.length) {
22810
+ return null;
22811
+ }
22812
+ const [rootItem] = items;
22813
+ const doc2 = rootItem.element.ownerDocument;
22814
+ const isOrderedList = rootItem.numFmt && !["bullet", "none"].includes(rootItem.numFmt);
22815
+ const rootList = doc2.createElement(isOrderedList ? "ol" : "ul");
22816
+ if (isOrderedList && rootItem.listLevel?.[0] && rootItem.listLevel[0] > 1) {
22817
+ rootList.setAttribute("start", rootItem.listLevel[0]);
22818
+ }
22819
+ const lastLevelItem = /* @__PURE__ */ new Map();
22820
+ items.forEach((item) => {
22821
+ const { element: liElement, level, numFmt, listLevel } = item;
22822
+ const cleanLi = cleanListItem(liElement.cloneNode(true));
22823
+ if (level === 0) {
22824
+ rootList.append(cleanLi);
22825
+ lastLevelItem.set(0, cleanLi);
22826
+ } else {
22827
+ const parentLi = lastLevelItem.get(level - 1);
22828
+ if (!parentLi) {
22829
+ rootList.append(cleanLi);
22830
+ lastLevelItem.set(level, cleanLi);
22831
+ return;
22832
+ }
22833
+ let nestedList = null;
22834
+ [...parentLi.children].forEach((child) => {
22835
+ if (child.tagName && (child.tagName === "OL" || child.tagName === "UL")) {
22836
+ nestedList = child;
22837
+ }
22838
+ });
22839
+ if (!nestedList) {
22840
+ const listType = numFmt && !["bullet", "none"].includes(numFmt) ? "ol" : "ul";
22841
+ nestedList = doc2.createElement(listType);
22842
+ parentLi.append(nestedList);
22843
+ }
22844
+ nestedList.append(cleanLi);
22845
+ lastLevelItem.set(level, cleanLi);
22846
+ }
22847
+ });
22848
+ return rootList;
22849
+ }
22850
+ function cleanListItem(listItem) {
22851
+ const attrs = [
22852
+ "data-num-id",
22853
+ "data-level",
22854
+ "data-num-fmt",
22855
+ "data-lvl-text",
22856
+ "data-list-level",
22857
+ "data-marker-type",
22858
+ "aria-label"
22859
+ ];
22860
+ attrs.forEach((attr) => {
22861
+ listItem.removeAttribute(attr);
22862
+ });
22863
+ return listItem;
22864
+ }
22735
22865
  class InputRule {
22736
22866
  constructor(config) {
22737
22867
  __publicField$2(this, "match");
@@ -23936,6 +24066,7 @@ function translateImageNode(params2, imageSize) {
23936
24066
  let imageId = attrs.rId;
23937
24067
  const src = attrs.src || attrs.imageSrc;
23938
24068
  const { originalWidth, originalHeight } = getPngDimensions(src);
24069
+ const imageName = params2.node.type === "image" ? src?.split("word/media/")[1] : attrs.fieldId?.replace("-", "_");
23939
24070
  let size2 = attrs.size ? {
23940
24071
  w: pixelsToEmu(attrs.size.width),
23941
24072
  h: pixelsToEmu(attrs.size.height)
@@ -23965,11 +24096,9 @@ function translateImageNode(params2, imageSize) {
23965
24096
  if (!type2) {
23966
24097
  return prepareTextAnnotation(params2);
23967
24098
  }
23968
- const hash2 = generateDocxRandomId(4);
23969
- const cleanUrl = attrs.fieldId.replace("-", "_");
23970
- const imageUrl = `media/${cleanUrl}_${hash2}.${type2}`;
24099
+ const imageUrl = `media/${imageName}_${attrs.hash}.${type2}`;
23971
24100
  imageId = addNewImageRelationship(params2, imageUrl);
23972
- params2.media[`${cleanUrl}_${hash2}.${type2}`] = src;
24101
+ params2.media[`${imageName}_${attrs.hash}.${type2}`] = src;
23973
24102
  }
23974
24103
  let inlineAttrs = attrs.originalPadding || {
23975
24104
  distT: 0,
@@ -24094,8 +24223,7 @@ function translateImageNode(params2, imageSize) {
24094
24223
  name: "wp:docPr",
24095
24224
  attributes: {
24096
24225
  id: attrs.id || 0,
24097
- name: attrs.alt,
24098
- descr: attrs.title
24226
+ name: attrs.alt || `Picture ${imageName}`
24099
24227
  }
24100
24228
  },
24101
24229
  {
@@ -24129,7 +24257,7 @@ function translateImageNode(params2, imageSize) {
24129
24257
  name: "pic:cNvPr",
24130
24258
  attributes: {
24131
24259
  id: attrs.id || 0,
24132
- name: attrs.title
24260
+ name: attrs.title || `Picture ${imageName}`
24133
24261
  }
24134
24262
  },
24135
24263
  {
@@ -24239,12 +24367,31 @@ function prepareHtmlAnnotation(params2) {
24239
24367
  state2 = applyMarksToHtmlAnnotation(state2, allMarks);
24240
24368
  }
24241
24369
  const htmlAnnotationNode = state2.doc.toJSON();
24370
+ const listTypes = ["bulletList", "orderedList"];
24371
+ const { editor } = params2;
24372
+ const seenLists = /* @__PURE__ */ new Map();
24373
+ state2.doc.descendants((node2, pos) => {
24374
+ if (listTypes.includes(node2.type.name)) {
24375
+ const listItem = node2.firstChild;
24376
+ const { attrs: attrs2 } = listItem;
24377
+ const { level, numId } = attrs2;
24378
+ if (!seenLists.has(numId)) {
24379
+ const newNumId = ListHelpers.changeNumIdSameAbstract(numId, level, node2.type.name, editor);
24380
+ listItem.attrs.numId = newNumId;
24381
+ seenLists.set(numId, newNumId);
24382
+ } else {
24383
+ const newNumId = seenLists.get(numId);
24384
+ listItem.attrs.numId = newNumId;
24385
+ }
24386
+ }
24387
+ });
24388
+ const elements = translateChildNodes({
24389
+ ...params2,
24390
+ node: htmlAnnotationNode
24391
+ });
24242
24392
  return {
24243
24393
  name: "htmlAnnotation",
24244
- elements: translateChildNodes({
24245
- ...params2,
24246
- node: htmlAnnotationNode
24247
- })
24394
+ elements
24248
24395
  };
24249
24396
  }
24250
24397
  function prepareImageAnnotation(params2, imageSize) {
@@ -25381,6 +25528,7 @@ const handleAnnotationNode = (params2) => {
25381
25528
  }
25382
25529
  const { attrs: marksAsAttrs, marks } = parseAnnotationMarks(sdtContent);
25383
25530
  const allAttrs = { ...attrs, ...marksAsAttrs };
25531
+ allAttrs.hash = generateDocxRandomId(4);
25384
25532
  if (!attrs.fieldId || !attrs.displayLabel) {
25385
25533
  return { nodes: [], consumed: 0 };
25386
25534
  }
@@ -26376,7 +26524,7 @@ const _SuperConverter = class _SuperConverter2 {
26376
26524
  return;
26377
26525
  }
26378
26526
  }
26379
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.9") {
26527
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.10") {
26380
26528
  const customLocation = "docProps/custom.xml";
26381
26529
  if (!docx[customLocation]) {
26382
26530
  docx[customLocation] = generateCustomXml();
@@ -26764,7 +26912,6 @@ exportProcessNewRelationships_fn = function(rels = []) {
26764
26912
  newRels.push(rel);
26765
26913
  });
26766
26914
  relationships.elements = [...relationships.elements, ...newRels];
26767
- this.convertedXml["word/_rels/document.xml.rels"] = relsData;
26768
26915
  };
26769
26916
  exportProcessMediaFiles_fn = async function(media, editor) {
26770
26917
  const processedData = {};
@@ -26808,7 +26955,7 @@ __publicField$2(_SuperConverter, "markTypes", [
26808
26955
  { name: "w:i", type: "italic" },
26809
26956
  { name: "w:iCs", type: "italic" },
26810
26957
  { name: "w:u", type: "underline", mark: "underline", property: "underlineType" },
26811
- { name: "w:strike", type: "strike" },
26958
+ { name: "w:strike", type: "strike", mark: "strike" },
26812
26959
  { name: "w:color", type: "color", mark: "textStyle", property: "color" },
26813
26960
  { name: "w:sz", type: "fontSize", mark: "textStyle", property: "fontSize" },
26814
26961
  { name: "w:szCs", type: "fontSize", mark: "textStyle", property: "fontSize" },
@@ -26852,7 +26999,7 @@ function storeSuperdocVersion(docx) {
26852
26999
  function generateCustomXml() {
26853
27000
  return DEFAULT_CUSTOM_XML;
26854
27001
  }
26855
- function generateSuperdocVersion(pid = 2, version2 = "0.14.9") {
27002
+ function generateSuperdocVersion(pid = 2, version2 = "0.14.10") {
26856
27003
  return {
26857
27004
  type: "element",
26858
27005
  name: "property",
@@ -42113,6 +42260,9 @@ const generateMissingListDefinition = (listNode, editor) => {
42113
42260
  const migrateParagraphFieldsListsV2 = async (annotationValues = [], editor) => {
42114
42261
  const annotations = getAllFieldAnnotations(editor.state);
42115
42262
  const newValues = [];
42263
+ if (!annotations.length) {
42264
+ return annotationValues;
42265
+ }
42116
42266
  for (const annotation of annotations) {
42117
42267
  const type2 = annotation.node?.attrs?.type;
42118
42268
  const matchedAnnotation = annotationValues.find((v) => v.input_id === annotation.node.attrs.fieldId);
@@ -42739,9 +42889,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
42739
42889
  const attributes = typeof nameOrAttributes === "string" ? attributesOrUndefined : nameOrAttributes;
42740
42890
  return isActive(this.state, name, attributes);
42741
42891
  }
42742
- /**
42743
- * Get the document as JSON.
42744
- */
42745
42892
  /**
42746
42893
  * Get the editor content as JSON
42747
42894
  * @returns {Object} Editor content as JSON
@@ -42749,18 +42896,20 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
42749
42896
  getJSON() {
42750
42897
  return this.state.doc.toJSON();
42751
42898
  }
42752
- /**
42753
- * Get HTML string of the document
42754
- */
42755
42899
  /**
42756
42900
  * Get the editor content as HTML
42757
42901
  * @returns {string} Editor content as HTML
42758
42902
  */
42759
- getHTML() {
42760
- const div2 = document.createElement("div");
42903
+ getHTML({ unflattenLists = false } = {}) {
42904
+ const tempDocument = document.implementation.createHTMLDocument();
42905
+ const container = tempDocument.createElement("div");
42761
42906
  const fragment = DOMSerializer.fromSchema(this.schema).serializeFragment(this.state.doc.content);
42762
- div2.appendChild(fragment);
42763
- return div2.innerHTML;
42907
+ container.appendChild(fragment);
42908
+ let html = container.innerHTML;
42909
+ if (unflattenLists) {
42910
+ html = unflattenListsInHtml(html);
42911
+ }
42912
+ return html;
42764
42913
  }
42765
42914
  /**
42766
42915
  * Create a child editor linked to this editor.
@@ -42772,9 +42921,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
42772
42921
  createChildEditor(options2) {
42773
42922
  return createLinkedChildEditor(this, options2);
42774
42923
  }
42775
- /**
42776
- * Get page styles
42777
- */
42778
42924
  /**
42779
42925
  * Get page styles
42780
42926
  * @returns {Object} Page styles
@@ -42939,7 +43085,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
42939
43085
  * @returns {Object | void} Migration results
42940
43086
  */
42941
43087
  processCollaborationMigrations() {
42942
- console.debug("[checkVersionMigrations] Current editor version", "0.14.9");
43088
+ console.debug("[checkVersionMigrations] Current editor version", "0.14.10");
42943
43089
  if (!this.options.ydoc) return;
42944
43090
  const metaMap = this.options.ydoc.getMap("meta");
42945
43091
  let docVersion = metaMap.get("version");
@@ -43069,7 +43215,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
43069
43215
  */
43070
43216
  async migrateParagraphFields(annotationValues = []) {
43071
43217
  if (!Array.isArray(annotationValues) || !annotationValues.length) return annotationValues;
43072
- return await migrateParagraphFieldsListsV2(annotationValues, this);
43218
+ const result = await migrateParagraphFieldsListsV2(annotationValues, this);
43219
+ return result;
43073
43220
  }
43074
43221
  /**
43075
43222
  * Annotate the document with the given annotation values.
@@ -45471,7 +45618,7 @@ const ListItem = Node$1.create({
45471
45618
  renderDOM: (attrs) => {
45472
45619
  if (attrs.level === void 0 || attrs.level === null) return {};
45473
45620
  return {
45474
- "data-level": JSON.stringify(attrs.level)
45621
+ "data-level": attrs.level
45475
45622
  };
45476
45623
  }
45477
45624
  },
@@ -49761,6 +49908,10 @@ const FieldAnnotation = Node$1.create({
49761
49908
  generatorIndex: {
49762
49909
  rendered: false,
49763
49910
  default: null
49911
+ },
49912
+ hash: {
49913
+ rendered: false,
49914
+ default: null
49764
49915
  }
49765
49916
  };
49766
49917
  },
@@ -49870,6 +50021,7 @@ const FieldAnnotation = Node$1.create({
49870
50021
  currentMarks = currentMarks.length ? [...currentMarks] : null;
49871
50022
  let formatAttrs = getFormatAttrsFromMarks(currentMarks);
49872
50023
  let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
50024
+ attrs.hash = generateDocxRandomId(4);
49873
50025
  let node2 = schema.nodes[this.name].create({
49874
50026
  ...attrs,
49875
50027
  ...formatAttrs,
@@ -49907,6 +50059,7 @@ const FieldAnnotation = Node$1.create({
49907
50059
  let newPosFrom = tr.mapping.map(from2);
49908
50060
  let newPosTo = tr.mapping.map(to);
49909
50061
  let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
50062
+ attrs.hash = generateDocxRandomId(4);
49910
50063
  let node2 = schema.nodes[this.name].create({
49911
50064
  ...attrs,
49912
50065
  defaultDisplayLabel
@@ -50573,7 +50726,7 @@ const Image = Node$1.create({
50573
50726
  }
50574
50727
  },
50575
50728
  alt: {
50576
- default: null
50729
+ default: "Uploaded picture"
50577
50730
  },
50578
50731
  id: { rendered: false },
50579
50732
  title: {
@@ -50620,11 +50773,16 @@ const Image = Node$1.create({
50620
50773
  },
50621
50774
  marginOffset: {
50622
50775
  default: {},
50623
- renderDOM: ({ marginOffset }) => {
50776
+ renderDOM: ({ marginOffset, anchorData }) => {
50777
+ const relativeFromPageV = anchorData?.vRelativeFrom === "page";
50778
+ const maxMarginV = 500;
50624
50779
  const { left: left2 = 0, top: top2 = 0 } = marginOffset ?? {};
50625
50780
  let style2 = "";
50626
50781
  if (left2) style2 += `margin-left: ${left2}px;`;
50627
- if (top2) style2 += `margin-top: ${top2}px;`;
50782
+ if (top2) {
50783
+ if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
50784
+ else style2 += `margin-top: ${top2}px;`;
50785
+ }
50628
50786
  return { style: style2 };
50629
50787
  }
50630
50788
  },
@@ -57630,6 +57788,7 @@ const magnifyingGlassSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0
57630
57788
  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>';
57631
57789
  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>';
57632
57790
  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>';
57791
+ 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';
57633
57792
  const toolbarIcons = {
57634
57793
  undo: rotateLeftIconSvg,
57635
57794
  redo: rotateRightIconSvg,
@@ -57676,7 +57835,8 @@ const toolbarIcons = {
57676
57835
  search: magnifyingGlassSvg,
57677
57836
  cut: scissorsIconSvg,
57678
57837
  copy: copyIconSvg,
57679
- paste: pasteIconSvg
57838
+ paste: pasteIconSvg,
57839
+ strikethrough: strikethroughSvg
57680
57840
  };
57681
57841
  const _hoisted_1$4$1 = { class: "toolbar-icon" };
57682
57842
  const _hoisted_2$3$1 = ["innerHTML"];
@@ -67328,11 +67488,11 @@ const _sfc_main$1$1 = {
67328
67488
  const isMobile = window.matchMedia("(max-width: 768px)").matches;
67329
67489
  const styleMap = {
67330
67490
  left: {
67331
- minWidth: "140px",
67491
+ minWidth: "120px",
67332
67492
  justifyContent: "flex-start"
67333
67493
  },
67334
67494
  right: {
67335
- minWidth: "140px",
67495
+ minWidth: "120px",
67336
67496
  justifyContent: "flex-end"
67337
67497
  },
67338
67498
  default: {
@@ -67565,7 +67725,7 @@ const _sfc_main$1$1 = {
67565
67725
  };
67566
67726
  }
67567
67727
  };
67568
- const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-630d1841"]]);
67728
+ const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-a40b6226"]]);
67569
67729
  const _sfc_main$g = {
67570
67730
  __name: "Toolbar",
67571
67731
  emits: ["command", "toggle", "select"],
@@ -69678,6 +69838,16 @@ const makeDefaultItems = ({
69678
69838
  ariaLabel: "Underline"
69679
69839
  }
69680
69840
  });
69841
+ const strikethrough = useToolbarItem({
69842
+ type: "button",
69843
+ name: "strikethrough",
69844
+ command: "toggleStrike",
69845
+ icon: toolbarIcons2.strikethrough,
69846
+ tooltip: toolbarTexts2.strikethrough,
69847
+ attributes: {
69848
+ ariaLabel: "Strikethrough"
69849
+ }
69850
+ });
69681
69851
  const highlight = useToolbarItem({
69682
69852
  type: "dropdown",
69683
69853
  name: "highlight",
@@ -70301,6 +70471,7 @@ const makeDefaultItems = ({
70301
70471
  bold,
70302
70472
  italic,
70303
70473
  underline,
70474
+ strikethrough,
70304
70475
  colorButton,
70305
70476
  highlight,
70306
70477
  separator,
@@ -70391,6 +70562,7 @@ const toolbarTexts = {
70391
70562
  italic: "Italic",
70392
70563
  underline: "Underline",
70393
70564
  highlight: "Highlight color",
70565
+ strikethrough: "Strikethrough",
70394
70566
  color: "Text color",
70395
70567
  search: "Search",
70396
70568
  link: "Link",