@harbour-enterprises/superdoc 0.15.2-next.8 → 0.15.2

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 (41) hide show
  1. package/dist/chunks/{eventemitter3-CLT6oufV.cjs → eventemitter3-BgTTc0kr.cjs} +1 -1
  2. package/dist/chunks/{eventemitter3-BKLF7Ip6.es.js → eventemitter3-DESeWqCF.es.js} +1 -1
  3. package/dist/chunks/{index-B5xS6OKK.cjs → index-5s0lZrRi.cjs} +2 -2
  4. package/dist/chunks/{index-BqH3eQTm.es.js → index-BDb18xQR.es.js} +2 -2
  5. package/dist/chunks/{index-D612mw4O.es.js → index-CEIbpU5u.es.js} +4 -4
  6. package/dist/chunks/{index-DhQaJbc2.cjs → index-CjAcITPh.cjs} +2 -2
  7. package/dist/chunks/{index-ibuaxW1X.cjs → index-Dz0ZMALg.cjs} +4 -4
  8. package/dist/chunks/{index-DzFLdJgk.es.js → index-gYvWcHA-.es.js} +2 -2
  9. package/dist/chunks/{jszip-DWfnW2xV.cjs → jszip-BgN565V6.cjs} +1 -1
  10. package/dist/chunks/{jszip-BwJb6_S5.es.js → jszip-eJOLo2UN.es.js} +1 -1
  11. package/dist/chunks/{super-editor.es-YwSAYGdN.es.js → super-editor.es--mxXaBhy.es.js} +190 -176
  12. package/dist/chunks/{super-editor.es-oQYBh9s8.cjs → super-editor.es-ixOVdl5w.cjs} +190 -176
  13. package/dist/chunks/{url-CNqDAz7z.es.js → url-D1vPFtjG.es.js} +2 -2
  14. package/dist/chunks/{url-7PXI9_kJ.cjs → url-yluXzDeN.cjs} +2 -2
  15. package/dist/chunks/{vue-CfKg12kH.cjs → vue-BLDJYAe8.cjs} +14 -7
  16. package/dist/chunks/{vue-B_OPNNfX.es.js → vue-aMYj79Bx.es.js} +14 -7
  17. package/dist/chunks/{xml-js-Bn0K9fTK.es.js → xml-js-BWZkA4YC.es.js} +2 -2
  18. package/dist/chunks/{xml-js-B_rfwhrZ.cjs → xml-js-DahUgrqx.cjs} +2 -2
  19. package/dist/super-editor/ai-writer.es.js +2 -2
  20. package/dist/super-editor/chunks/{converter-biyNTHw8.js → converter-CoSpKabV.js} +178 -171
  21. package/dist/super-editor/chunks/{docx-zipper-CXO6CzeD.js → docx-zipper-IPjAUcig.js} +1 -1
  22. package/dist/super-editor/chunks/{editor-T5EC5Unz.js → editor-BGJUMlyF.js} +11 -4
  23. package/dist/super-editor/chunks/{toolbar-4HLoQxad.js → toolbar-NgyyBTav.js} +2 -2
  24. package/dist/super-editor/converter.es.js +1 -1
  25. package/dist/super-editor/core/inputRules/docx-paste/docx-paste.d.ts +1 -0
  26. package/dist/super-editor/core/inputRules/docx-paste/docx-paste.d.ts.map +1 -1
  27. package/dist/super-editor/core/super-converter/v2/importer/listImporter.d.ts.map +1 -1
  28. package/dist/super-editor/docx-zipper.es.js +2 -2
  29. package/dist/super-editor/editor.es.js +3 -3
  30. package/dist/super-editor/extensions/list-item/list-item.d.ts.map +1 -1
  31. package/dist/super-editor/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts.map +1 -1
  32. package/dist/super-editor/file-zipper.es.js +1 -1
  33. package/dist/super-editor/super-editor.es.js +8 -8
  34. package/dist/super-editor/toolbar.es.js +2 -2
  35. package/dist/super-editor.cjs +2 -2
  36. package/dist/super-editor.es.js +2 -2
  37. package/dist/superdoc.cjs +8 -8
  38. package/dist/superdoc.es.js +9 -9
  39. package/dist/superdoc.umd.js +204 -183
  40. package/dist/superdoc.umd.js.map +1 -1
  41. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
3
  var eventemitter3 = { exports: {} };
4
4
  var hasRequiredEventemitter3;
5
5
  function requireEventemitter3() {
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-BwJb6_S5.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-eJOLo2UN.es.js";
2
2
  var eventemitter3 = { exports: {} };
3
3
  var hasRequiredEventemitter3;
4
4
  function requireEventemitter3() {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
3
- const index$2 = require("./index-ibuaxW1X.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
+ const index$2 = require("./index-Dz0ZMALg.cjs");
4
4
  function _mergeNamespaces(n, m) {
5
5
  for (var i = 0; i < m.length; i++) {
6
6
  const e = m[i];
@@ -1,5 +1,5 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-BwJb6_S5.es.js";
2
- import { r as requireStreamHttp } from "./index-D612mw4O.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-eJOLo2UN.es.js";
2
+ import { r as requireStreamHttp } from "./index-CEIbpU5u.es.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
5
5
  const e = m[i];
@@ -1,7 +1,7 @@
1
- import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace } from "./jszip-BwJb6_S5.es.js";
2
- import { p as process$1 } from "./vue-B_OPNNfX.es.js";
3
- import { r as require_stream_readable, a as require_stream_writable, b as require_stream_duplex, c as require_stream_transform, d as require_stream_passthrough, e as requireEndOfStream, f as requirePipeline, g as requireInherits_browser } from "./xml-js-Bn0K9fTK.es.js";
4
- import { u as url } from "./url-CNqDAz7z.es.js";
1
+ import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace } from "./jszip-eJOLo2UN.es.js";
2
+ import { p as process$1 } from "./vue-aMYj79Bx.es.js";
3
+ import { r as require_stream_readable, a as require_stream_writable, b as require_stream_duplex, c as require_stream_transform, d as require_stream_passthrough, e as requireEndOfStream, f as requirePipeline, g as requireInherits_browser } from "./xml-js-BWZkA4YC.es.js";
4
+ import { u as url } from "./url-D1vPFtjG.es.js";
5
5
  var streamHttp = {};
6
6
  var request = { exports: {} };
7
7
  var capability = {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
3
- const index$2 = require("./index-ibuaxW1X.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
+ const index$2 = require("./index-Dz0ZMALg.cjs");
4
4
  function _mergeNamespaces(n, m) {
5
5
  for (var i = 0; i < m.length; i++) {
6
6
  const e = m[i];
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
3
- const vue = require("./vue-CfKg12kH.cjs");
4
- const xmlJs = require("./xml-js-B_rfwhrZ.cjs");
5
- const url = require("./url-7PXI9_kJ.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
+ const vue = require("./vue-BLDJYAe8.cjs");
4
+ const xmlJs = require("./xml-js-DahUgrqx.cjs");
5
+ const url = require("./url-yluXzDeN.cjs");
6
6
  var streamHttp = {};
7
7
  var request = { exports: {} };
8
8
  var capability = {};
@@ -1,5 +1,5 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-BwJb6_S5.es.js";
2
- import { r as requireStreamHttp, a as require$$1 } from "./index-D612mw4O.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-eJOLo2UN.es.js";
2
+ import { r as requireStreamHttp, a as require$$1 } from "./index-CEIbpU5u.es.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
5
5
  const e = m[i];
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- require("./vue-CfKg12kH.cjs");
2
+ require("./vue-BLDJYAe8.cjs");
3
3
  var buffer = {};
4
4
  var base64Js = {};
5
5
  base64Js.byteLength = byteLength;
@@ -1,4 +1,4 @@
1
- import "./vue-B_OPNNfX.es.js";
1
+ import "./vue-aMYj79Bx.es.js";
2
2
  var buffer = {};
3
3
  var base64Js = {};
4
4
  base64Js.byteLength = byteLength;
@@ -1,4 +1,4 @@
1
- import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted, Y as resolveDynamicComponent, Z as normalizeProps, _ as guardReactiveProps, $ as markRaw } from "./vue-B_OPNNfX.es.js";
1
+ import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted, Y as resolveDynamicComponent, Z as normalizeProps, _ as guardReactiveProps, $ as markRaw } from "./vue-aMYj79Bx.es.js";
2
2
  import * as Y from "yjs";
3
3
  import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
4
4
  var __defProp$2 = Object.defineProperty;
@@ -19594,169 +19594,6 @@ const getTextContentFromNodes = ($from, maxMatch = 500) => {
19594
19594
  });
19595
19595
  return textBefore;
19596
19596
  };
19597
- const handleDocxPaste = (html, editor, view, plugin2) => {
19598
- const { converter } = editor;
19599
- if (!converter || !converter.convertedXml) return handleHtmlPaste(html, editor);
19600
- let cleanedHtml = convertEmToPt(html);
19601
- cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
19602
- const tempDiv = document.createElement("div");
19603
- tempDiv.innerHTML = cleanedHtml;
19604
- const paragraphs = tempDiv.querySelectorAll("p");
19605
- paragraphs.forEach((p) => {
19606
- const innerHTML3 = p.innerHTML;
19607
- if (!innerHTML3.includes("<!--[if !supportLists]")) return;
19608
- const styleAttr = p.getAttribute("style") || "";
19609
- const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)/);
19610
- if (msoListMatch) {
19611
- const [, abstractId, level] = msoListMatch;
19612
- const listNumId = getListNumIdFromAbstract(abstractId, editor);
19613
- if (!listNumId) return;
19614
- const abstractDefinition = getListAbstractDefinition(abstractId, editor);
19615
- const { lvlText, start: start2, numFmt } = getLevelDefinition(abstractDefinition, level - 1);
19616
- p.setAttribute("data-num-id", listNumId);
19617
- p.setAttribute("data-list-level", level - 1);
19618
- p.setAttribute("data-start", start2);
19619
- p.setAttribute("data-lvl-text", lvlText);
19620
- p.setAttribute("data-num-fmt", numFmt);
19621
- }
19622
- extractAndRemoveConditionalPrefix(p);
19623
- });
19624
- transformWordLists(tempDiv);
19625
- const doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
19626
- tempDiv.remove();
19627
- const { dispatch } = editor.view;
19628
- if (!dispatch) return false;
19629
- dispatch(view.state.tr.replaceSelectionWith(doc2, true));
19630
- return true;
19631
- };
19632
- const getLevelDefinition = (abstractDefinition, level) => {
19633
- if (!abstractDefinition || !abstractDefinition.elements) return null;
19634
- const levelElement = abstractDefinition.elements.find((el) => {
19635
- return el.name === "w:lvl" && el.attributes?.["w:ilvl"] == level;
19636
- });
19637
- if (!levelElement) return null;
19638
- const { elements } = levelElement;
19639
- const lvlText = elements.find((el) => el.name === "w:lvlText")?.attributes?.["w:val"];
19640
- const start2 = elements.find((el) => el.name === "w:start")?.attributes?.["w:val"];
19641
- const numFmt = elements.find((el) => el.name === "w:numFmt")?.attributes?.["w:val"];
19642
- return { lvlText, start: start2, numFmt, elements };
19643
- };
19644
- const getListNumIdFromAbstract = (abstractId, editor) => {
19645
- const { definitions } = editor?.converter?.numbering;
19646
- if (!definitions) return null;
19647
- const matchedDefinition = Object.values(definitions).find((def) => {
19648
- return def.elements.some((el) => el.name === "w:abstractNumId" && el.attributes?.["w:val"] == abstractId);
19649
- });
19650
- return matchedDefinition?.attributes?.["w:numId"];
19651
- };
19652
- const getListAbstractDefinition = (abstractId, editor) => {
19653
- const { abstracts = {} } = editor?.converter?.numbering;
19654
- return abstracts[abstractId] || null;
19655
- };
19656
- const transformWordLists = (container) => {
19657
- const paragraphs = Array.from(container.querySelectorAll("p[data-num-id]"));
19658
- const listMap = /* @__PURE__ */ new Map();
19659
- const listLevels = {};
19660
- for (const p of paragraphs) {
19661
- const listId = p.getAttribute("data-num-id");
19662
- const level = parseInt(p.getAttribute("data-list-level"));
19663
- const numFmt = p.getAttribute("data-num-fmt");
19664
- const start2 = p.getAttribute("data-start");
19665
- const lvlText = p.getAttribute("data-lvl-text");
19666
- if (!listMap.has(listId)) listMap.set(listId, []);
19667
- listMap.get(listId).push({ p, level, numFmt, start: start2, lvlText });
19668
- }
19669
- for (const [id, items] of listMap.entries()) {
19670
- if (!listLevels[id]) {
19671
- listLevels[id] = {
19672
- stack: [],
19673
- counts: {},
19674
- prevLevel: null
19675
- };
19676
- }
19677
- const parentStack = [];
19678
- items.forEach(({ p, level, numFmt, start: start2, lvlText }, index2) => {
19679
- const listLevel = generateListNestingPath(listLevels, id, level);
19680
- const li = document.createElement("li");
19681
- li.innerHTML = p.innerHTML;
19682
- li.setAttribute("data-list-level", JSON.stringify(listLevel));
19683
- li.setAttribute("data-num-id", id);
19684
- li.setAttribute("data-lvl-text", lvlText);
19685
- li.setAttribute("data-num-fmt", numFmt);
19686
- if (p.hasAttribute("data-font-family")) {
19687
- li.setAttribute("data-font-family", p.getAttribute("data-font-family"));
19688
- }
19689
- if (p.hasAttribute("data-font-size")) {
19690
- li.setAttribute("data-font-size", p.getAttribute("data-font-size"));
19691
- }
19692
- const parentNode2 = p.parentNode;
19693
- let listForLevel = parentStack[level];
19694
- if (!listForLevel) {
19695
- const newList = document.createElement("ol");
19696
- newList.setAttribute("data-list-id", id);
19697
- newList.level = level;
19698
- if (level > 0) {
19699
- const parentLi = parentStack[level - 1]?.querySelector("li:last-child");
19700
- if (parentLi) parentLi.appendChild(newList);
19701
- } else {
19702
- parentNode2.insertBefore(newList, p);
19703
- }
19704
- parentStack[level] = newList;
19705
- parentStack.length = level + 1;
19706
- listForLevel = newList;
19707
- }
19708
- listForLevel.appendChild(li);
19709
- p.remove();
19710
- });
19711
- }
19712
- };
19713
- function generateListNestingPath(listLevels, listId, currentLevel) {
19714
- const levelState = listLevels[listId];
19715
- if (!levelState.stack) levelState.stack = [];
19716
- if (levelState.prevLevel === void 0) levelState.prevLevel = null;
19717
- if (levelState.prevLevel === null) {
19718
- levelState.stack = Array(currentLevel).fill(1).concat(1);
19719
- } else {
19720
- if (currentLevel > levelState.prevLevel) {
19721
- levelState.stack.push(1);
19722
- } else if (currentLevel === levelState.prevLevel) {
19723
- levelState.stack[levelState.stack.length - 1]++;
19724
- } else {
19725
- levelState.stack = levelState.stack.slice(0, currentLevel + 1);
19726
- levelState.stack[currentLevel] = (levelState.stack[currentLevel] || 1) + 1;
19727
- }
19728
- }
19729
- levelState.prevLevel = currentLevel;
19730
- return [...levelState.stack];
19731
- }
19732
- function extractAndRemoveConditionalPrefix(p) {
19733
- const nodes = Array.from(p.childNodes);
19734
- let fontFamily2 = null;
19735
- let fontSize2 = null;
19736
- let start2 = -1, end2 = -1;
19737
- nodes.forEach((node2, index2) => {
19738
- if (node2.nodeType === Node.COMMENT_NODE && node2.nodeValue.includes("[if !supportLists]")) {
19739
- start2 = index2;
19740
- }
19741
- if (start2 !== -1 && node2.nodeType === Node.COMMENT_NODE && node2.nodeValue.includes("[endif]")) {
19742
- end2 = index2;
19743
- }
19744
- });
19745
- if (start2 !== -1 && end2 !== -1) {
19746
- for (let i = start2 + 1; i < end2; i++) {
19747
- const node2 = nodes[i];
19748
- if (node2.nodeType === Node.ELEMENT_NODE && node2.style) {
19749
- fontFamily2 = fontFamily2 || node2.style.fontFamily;
19750
- fontSize2 = fontSize2 || node2.style.fontSize;
19751
- }
19752
- }
19753
- for (let i = end2; i >= start2; i--) {
19754
- p.removeChild(p.childNodes[i]);
19755
- }
19756
- if (fontFamily2) p.setAttribute("data-font-family", fontFamily2);
19757
- if (fontSize2) p.setAttribute("data-font-size", fontSize2);
19758
- }
19759
- }
19760
19597
  function parseMarks(property2, unknownMarks = [], docx = null) {
19761
19598
  const marks = [];
19762
19599
  const seen = /* @__PURE__ */ new Set();
@@ -20865,7 +20702,7 @@ function handleListNodes(params2, node2) {
20865
20702
  delete currentListByNumId.levels[level];
20866
20703
  }
20867
20704
  });
20868
- const path = generateListPath(iLvl, currentListNumId, styleId, currentListByNumId.levels, docx);
20705
+ const path = generateListPath$1(iLvl, currentListNumId, styleId, currentListByNumId.levels, docx);
20869
20706
  if (!path.length) path.push(currentListByNumId.levels[iLvl]);
20870
20707
  const attrs = {};
20871
20708
  attrs.lvlText = lvlText;
@@ -21074,7 +20911,7 @@ const getAbstractDefinition = (numId, docx) => {
21074
20911
  }
21075
20912
  return listDefinitionForThisNumId;
21076
20913
  };
21077
- const generateListPath = (level, numId, styleId, levels, docx) => {
20914
+ const generateListPath$1 = (level, numId, styleId, levels, docx) => {
21078
20915
  const iLvl = Number(level);
21079
20916
  const path = [];
21080
20917
  if (iLvl > 0) {
@@ -21195,9 +21032,7 @@ function getAbstractNumIdByNumId(numId, docx) {
21195
21032
  const { elements } = numbering;
21196
21033
  const listData = elements[0];
21197
21034
  const numberingElements = listData.elements || [];
21198
- const numDef = numberingElements.find(
21199
- (el) => el.name === "w:num" && el.attributes?.["w:numId"] === numId
21200
- );
21035
+ const numDef = numberingElements.find((el) => el.name === "w:num" && el.attributes?.["w:numId"] === numId);
21201
21036
  if (!numDef) return null;
21202
21037
  const abstractNumIdRef = numDef.elements?.find((el) => el.name === "w:abstractNumId");
21203
21038
  return abstractNumIdRef?.attributes?.["w:val"];
@@ -21375,7 +21210,7 @@ const docxNumberigHelpers = {
21375
21210
  getListLevelDefinitionTag,
21376
21211
  combineIndents,
21377
21212
  parseIndentElement,
21378
- generateListPath,
21213
+ generateListPath: generateListPath$1,
21379
21214
  normalizeLvlTextChar
21380
21215
  };
21381
21216
  const baseOrderedListDef = {
@@ -23352,6 +23187,178 @@ const ListHelpers = {
23352
23187
  baseOrderedListDef,
23353
23188
  baseBulletList
23354
23189
  };
23190
+ function extractListLevelStyles(cssText, listId, level) {
23191
+ const pattern = new RegExp(`@list\\s+l${listId}:level${level}\\s*\\{([^}]+)\\}`, "i");
23192
+ const match = cssText.match(pattern);
23193
+ if (!match) return null;
23194
+ const rawStyles = match[1].split(";").map((line) => line.trim()).filter(Boolean);
23195
+ const styleMap = {};
23196
+ for (const style2 of rawStyles) {
23197
+ const [key, value] = style2.split(":").map((s) => s.trim());
23198
+ styleMap[key] = value;
23199
+ }
23200
+ return styleMap;
23201
+ }
23202
+ const numDefMap = /* @__PURE__ */ new Map([
23203
+ ["decimal", { def: "decimal", abstractNum: 1 }],
23204
+ ["alpha-lower", { def: "lowerLetter", abstractNum: 1 }],
23205
+ ["alpha-upper", { def: "upperLetter", abstractNum: 1 }],
23206
+ ["roman-lower", { def: "lowerRoman", abstractNum: 1 }],
23207
+ ["roman-upper", { def: "upperRoman", abstractNum: 1 }],
23208
+ ["bullet", { def: "bullet", abstractNum: 0 }]
23209
+ ]);
23210
+ const handleDocxPaste = (html, editor, view, plugin2) => {
23211
+ const { converter } = editor;
23212
+ if (!converter || !converter.convertedXml) return handleHtmlPaste(html, editor);
23213
+ let cleanedHtml = convertEmToPt(html);
23214
+ cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
23215
+ const tempDiv = document.createElement("div");
23216
+ tempDiv.innerHTML = cleanedHtml;
23217
+ const paragraphs = tempDiv.querySelectorAll("p");
23218
+ paragraphs.forEach((p) => {
23219
+ const innerHTML3 = p.innerHTML;
23220
+ if (!innerHTML3.includes("<!--[if !supportLists]")) return;
23221
+ const styleAttr = p.getAttribute("style") || "";
23222
+ const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)\s+lfo(\d+)/);
23223
+ const css = tempDiv.querySelector("style").innerHTML;
23224
+ if (msoListMatch) {
23225
+ const [, abstractId, level, numId] = msoListMatch;
23226
+ const styles = extractListLevelStyles(css, abstractId, level);
23227
+ const msoNumFormat = styles["mso-level-number-format"] || "decimal";
23228
+ const abstractOverride = numDefMap.get(msoNumFormat);
23229
+ if (!numId) return;
23230
+ const abstractDefinition = getListAbstractDefinition(
23231
+ abstractOverride ? abstractOverride.abstractNum : numId,
23232
+ editor
23233
+ );
23234
+ let { lvlText, start: start2, numFmt } = getLevelDefinition(abstractDefinition, level);
23235
+ if (abstractOverride.abstractNum === 1) lvlText = `%${level}.`;
23236
+ p.setAttribute("data-num-id", numId);
23237
+ p.setAttribute("data-list-level", level - 1);
23238
+ p.setAttribute("data-start", start2);
23239
+ p.setAttribute("data-lvl-text", styles["mso-level-text"] || lvlText);
23240
+ p.setAttribute("data-num-fmt", abstractOverride.def || numFmt);
23241
+ const ptToPxRatio = 1.333;
23242
+ const indent = parseInt(styles["margin-left"]) * ptToPxRatio || 0;
23243
+ if (indent > 0) p.setAttribute("data-left-indent", indent);
23244
+ }
23245
+ extractAndRemoveConditionalPrefix(p);
23246
+ });
23247
+ transformWordLists(tempDiv, editor);
23248
+ const doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
23249
+ tempDiv.remove();
23250
+ const { dispatch } = editor.view;
23251
+ if (!dispatch) return false;
23252
+ dispatch(view.state.tr.replaceSelectionWith(doc2, true));
23253
+ return true;
23254
+ };
23255
+ const getLevelDefinition = (abstractDefinition, level) => {
23256
+ if (!abstractDefinition || !abstractDefinition.elements) return null;
23257
+ const levelElement = abstractDefinition.elements.find((el) => {
23258
+ return el.name === "w:lvl" && el.attributes?.["w:ilvl"] == level;
23259
+ });
23260
+ if (!levelElement) return null;
23261
+ const { elements } = levelElement;
23262
+ const lvlText = elements.find((el) => el.name === "w:lvlText")?.attributes?.["w:val"];
23263
+ const start2 = elements.find((el) => el.name === "w:start")?.attributes?.["w:val"];
23264
+ const numFmt = elements.find((el) => el.name === "w:numFmt")?.attributes?.["w:val"];
23265
+ return { lvlText, start: start2, numFmt, elements };
23266
+ };
23267
+ const getListAbstractDefinition = (abstractId, editor) => {
23268
+ const { abstracts = {} } = editor?.converter?.numbering;
23269
+ return abstracts[abstractId] || null;
23270
+ };
23271
+ const transformWordLists = (container, editor) => {
23272
+ const paragraphs = Array.from(container.querySelectorAll("p[data-num-id]"));
23273
+ const lists = {};
23274
+ const mappedLists = {};
23275
+ for (const p of paragraphs) {
23276
+ const level = parseInt(p.getAttribute("data-list-level"));
23277
+ const numFmt = p.getAttribute("data-num-fmt");
23278
+ const start2 = p.getAttribute("data-start");
23279
+ const lvlText = p.getAttribute("data-lvl-text");
23280
+ const indent = p.getAttribute("data-left-indent");
23281
+ const importedId = p.getAttribute("data-num-id");
23282
+ if (!mappedLists[importedId]) mappedLists[importedId] = ListHelpers.getNewListId(editor);
23283
+ const id = mappedLists[importedId];
23284
+ const listType = numFmt === "bullet" ? "bulletList" : "orderedList";
23285
+ ListHelpers.generateNewListDefinition({ numId: id, listType, editor });
23286
+ if (!lists[id]) lists[id] = { levels: {} };
23287
+ const currentListByNumId = lists[id];
23288
+ if (!currentListByNumId.levels[level]) currentListByNumId.levels[level] = Number(start2) || 1;
23289
+ else currentListByNumId.levels[level]++;
23290
+ Object.keys(currentListByNumId.levels).forEach((key) => {
23291
+ const level1 = Number(key);
23292
+ if (level1 > level) {
23293
+ delete currentListByNumId.levels[level1];
23294
+ }
23295
+ });
23296
+ const path = generateListPath(level, currentListByNumId.levels, start2);
23297
+ if (!path.length) path.push(currentListByNumId.levels[level]);
23298
+ const li = document.createElement("li");
23299
+ li.innerHTML = p.innerHTML;
23300
+ li.setAttribute("data-num-id", id);
23301
+ li.setAttribute("data-list-level", JSON.stringify(path));
23302
+ li.setAttribute("data-level", level);
23303
+ li.setAttribute("data-lvl-text", lvlText);
23304
+ li.setAttribute("data-num-fmt", numFmt);
23305
+ if (indent) li.setAttribute("data-indent", JSON.stringify({ left: indent }));
23306
+ if (p.hasAttribute("data-font-family")) {
23307
+ li.setAttribute("data-font-family", p.getAttribute("data-font-family"));
23308
+ }
23309
+ if (p.hasAttribute("data-font-size")) {
23310
+ li.setAttribute("data-font-size", p.getAttribute("data-font-size"));
23311
+ }
23312
+ const parentNode2 = p.parentNode;
23313
+ let listForLevel;
23314
+ const newList = numFmt === "bullet" ? document.createElement("ul") : document.createElement("ol");
23315
+ newList.setAttribute("data-list-id", id);
23316
+ newList.level = level;
23317
+ parentNode2.insertBefore(newList, p);
23318
+ listForLevel = newList;
23319
+ listForLevel.appendChild(li);
23320
+ p.remove();
23321
+ }
23322
+ };
23323
+ const generateListPath = (level, levels, start2) => {
23324
+ const iLvl = Number(level);
23325
+ const path = [];
23326
+ if (iLvl > 0) {
23327
+ for (let i = iLvl; i >= 0; i--) {
23328
+ if (!levels[i]) levels[i] = Number(start2);
23329
+ path.unshift(levels[i]);
23330
+ }
23331
+ }
23332
+ return path;
23333
+ };
23334
+ function extractAndRemoveConditionalPrefix(p) {
23335
+ const nodes = Array.from(p.childNodes);
23336
+ let fontFamily2 = null;
23337
+ let fontSize2 = null;
23338
+ let start2 = -1, end2 = -1;
23339
+ nodes.forEach((node2, index2) => {
23340
+ if (node2.nodeType === Node.COMMENT_NODE && node2.nodeValue.includes("[if !supportLists]")) {
23341
+ start2 = index2;
23342
+ }
23343
+ if (start2 !== -1 && node2.nodeType === Node.COMMENT_NODE && node2.nodeValue.includes("[endif]")) {
23344
+ end2 = index2;
23345
+ }
23346
+ });
23347
+ if (start2 !== -1 && end2 !== -1) {
23348
+ for (let i = start2 + 1; i < end2; i++) {
23349
+ const node2 = nodes[i];
23350
+ if (node2.nodeType === Node.ELEMENT_NODE && node2.style) {
23351
+ fontFamily2 = fontFamily2 || node2.style.fontFamily;
23352
+ fontSize2 = fontSize2 || node2.style.fontSize;
23353
+ }
23354
+ }
23355
+ for (let i = end2; i >= start2; i--) {
23356
+ p.removeChild(p.childNodes[i]);
23357
+ }
23358
+ if (fontFamily2) p.setAttribute("data-font-family", fontFamily2);
23359
+ if (fontSize2) p.setAttribute("data-font-size", fontSize2);
23360
+ }
23361
+ }
23355
23362
  const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
23356
23363
  const handler = listIndexMap[listNumberingType];
23357
23364
  return handler ? handler(listLevel, lvlText, customFormat) : null;
@@ -28712,7 +28719,7 @@ const _SuperConverter = class _SuperConverter2 {
28712
28719
  return;
28713
28720
  }
28714
28721
  }
28715
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.2-next.8") {
28722
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.2") {
28716
28723
  const customLocation = "docProps/custom.xml";
28717
28724
  if (!docx[customLocation]) {
28718
28725
  docx[customLocation] = generateCustomXml();
@@ -29190,7 +29197,7 @@ function storeSuperdocVersion(docx) {
29190
29197
  function generateCustomXml() {
29191
29198
  return DEFAULT_CUSTOM_XML;
29192
29199
  }
29193
- function generateSuperdocVersion(pid = 2, version2 = "0.15.2-next.8") {
29200
+ function generateSuperdocVersion(pid = 2, version2 = "0.15.2") {
29194
29201
  return {
29195
29202
  type: "element",
29196
29203
  name: "property",
@@ -45373,7 +45380,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
45373
45380
  * @returns {Object | void} Migration results
45374
45381
  */
45375
45382
  processCollaborationMigrations() {
45376
- console.debug("[checkVersionMigrations] Current editor version", "0.15.2-next.8");
45383
+ console.debug("[checkVersionMigrations] Current editor version", "0.15.2");
45377
45384
  if (!this.options.ydoc) return;
45378
45385
  const metaMap = this.options.ydoc.getMap("meta");
45379
45386
  let docVersion = metaMap.get("version");
@@ -47732,12 +47739,18 @@ function orderedListSync(editor) {
47732
47739
  const { level: attrLvl, numId: attrNumId, styleId } = node2.attrs;
47733
47740
  const level = parseInt(attrLvl);
47734
47741
  const numId = parseInt(attrNumId);
47735
- const {
47742
+ let {
47736
47743
  lvlText,
47737
47744
  customFormat,
47738
47745
  listNumberingType,
47739
47746
  start: numberingDefStart
47740
47747
  } = ListHelpers.getListDefinitionDetails({ numId, level, editor });
47748
+ if (listNumberingType !== node2.attrs.listNumberingType) {
47749
+ listNumberingType = node2.attrs.listNumberingType;
47750
+ }
47751
+ if (lvlText !== node2.attrs.lvlText) {
47752
+ lvlText = node2.attrs.lvlText;
47753
+ }
47741
47754
  const start2 = parseInt(numberingDefStart) || 1;
47742
47755
  if (!listMap.has(numId)) {
47743
47756
  const generatedLevels = {};
@@ -47937,6 +47950,7 @@ const ListItem = Node$1.create({
47937
47950
  rendered: false
47938
47951
  },
47939
47952
  indent: {
47953
+ parseDOM: (elem) => JSON.parse(elem.getAttribute("data-indent")),
47940
47954
  keepOnSplit: true,
47941
47955
  default: null,
47942
47956
  rendered: false
@@ -71831,7 +71845,7 @@ const _sfc_main$b = {
71831
71845
  class: "remove-btn__icon",
71832
71846
  innerHTML: unref(toolbarIcons).removeLink
71833
71847
  }, null, 8, _hoisted_12),
71834
- _cache[5] || (_cache[5] = createTextVNode(" Remove "))
71848
+ _cache[5] || (_cache[5] = createTextVNode(" Remove ", -1))
71835
71849
  ])) : createCommentVNode("", true),
71836
71850
  createBaseVNode("button", {
71837
71851
  class: normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
@@ -72030,7 +72044,7 @@ const _sfc_main$9 = {
72030
72044
  innerHTML: unref(DropIcon),
72031
72045
  class: "none-icon"
72032
72046
  }, null, 8, _hoisted_2$5),
72033
- _cache[1] || (_cache[1] = createTextVNode(" None "))
72047
+ _cache[1] || (_cache[1] = createTextVNode(" None ", -1))
72034
72048
  ])) : createCommentVNode("", true),
72035
72049
  createBaseVNode("div", _hoisted_3$4, [
72036
72050
  createVNode(IconGridRow, {