@harbour-enterprises/superdoc 0.15.11 → 0.15.12-next.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-DESeWqCF.es.js → eventemitter3-BKLF7Ip6.es.js} +1 -1
  2. package/dist/chunks/{eventemitter3-BgTTc0kr.cjs → eventemitter3-CLT6oufV.cjs} +1 -1
  3. package/dist/chunks/{index-5s0lZrRi.cjs → index-B5xS6OKK.cjs} +2 -2
  4. package/dist/chunks/{index-BDb18xQR.es.js → index-BqH3eQTm.es.js} +2 -2
  5. package/dist/chunks/{index-CEIbpU5u.es.js → index-D612mw4O.es.js} +4 -4
  6. package/dist/chunks/{index-CjAcITPh.cjs → index-DhQaJbc2.cjs} +2 -2
  7. package/dist/chunks/{index-gYvWcHA-.es.js → index-DzFLdJgk.es.js} +2 -2
  8. package/dist/chunks/{index-Dz0ZMALg.cjs → index-ibuaxW1X.cjs} +4 -4
  9. package/dist/chunks/{jszip-eJOLo2UN.es.js → jszip-BwJb6_S5.es.js} +1 -1
  10. package/dist/chunks/{jszip-BgN565V6.cjs → jszip-DWfnW2xV.cjs} +1 -1
  11. package/dist/chunks/{super-editor.es-C0chUOpB.cjs → super-editor.es-BJj4yabz.cjs} +97 -28
  12. package/dist/chunks/{super-editor.es-DumS7mlS.es.js → super-editor.es-B_MUM4e0.es.js} +97 -28
  13. package/dist/chunks/{url-yluXzDeN.cjs → url-7PXI9_kJ.cjs} +2 -2
  14. package/dist/chunks/{url-D1vPFtjG.es.js → url-CNqDAz7z.es.js} +2 -2
  15. package/dist/chunks/{vue-aMYj79Bx.es.js → vue-B_OPNNfX.es.js} +7 -14
  16. package/dist/chunks/{vue-BLDJYAe8.cjs → vue-CfKg12kH.cjs} +7 -14
  17. package/dist/chunks/{xml-js-DahUgrqx.cjs → xml-js-B_rfwhrZ.cjs} +2 -2
  18. package/dist/chunks/{xml-js-BWZkA4YC.es.js → xml-js-Bn0K9fTK.es.js} +2 -2
  19. package/dist/super-editor/ai-writer.es.js +2 -2
  20. package/dist/super-editor/chunks/{converter-dhjACh39.js → converter-COwzTiDl.js} +7 -7
  21. package/dist/super-editor/chunks/{docx-zipper-BG5IuQq_.js → docx-zipper-BVDmFwyE.js} +1 -1
  22. package/dist/super-editor/chunks/{editor-FUXak2H0.js → editor-D3_sVoPs.js} +89 -20
  23. package/dist/super-editor/chunks/{toolbar-Bc9HbKLO.js → toolbar-DMMCkOPG.js} +2 -2
  24. package/dist/super-editor/converter.es.js +1 -1
  25. package/dist/super-editor/core/Attribute.d.ts +2 -2
  26. package/dist/super-editor/core/Attribute.d.ts.map +1 -1
  27. package/dist/super-editor/core/Schema.d.ts +2 -2
  28. package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts.map +1 -1
  29. package/dist/super-editor/docx-zipper.es.js +2 -2
  30. package/dist/super-editor/editor.es.js +3 -3
  31. package/dist/super-editor/extensions/list-item/ListItemNodeView.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 +104 -42
  40. package/dist/superdoc.umd.js.map +1 -1
  41. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-eJOLo2UN.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-BwJb6_S5.es.js";
2
2
  var eventemitter3 = { exports: {} };
3
3
  var hasRequiredEventemitter3;
4
4
  function requireEventemitter3() {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-BgN565V6.cjs");
2
+ const jszip = require("./jszip-DWfnW2xV.cjs");
3
3
  var eventemitter3 = { exports: {} };
4
4
  var hasRequiredEventemitter3;
5
5
  function requireEventemitter3() {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-BgN565V6.cjs");
3
- const index$2 = require("./index-Dz0ZMALg.cjs");
2
+ const jszip = require("./jszip-DWfnW2xV.cjs");
3
+ const index$2 = require("./index-ibuaxW1X.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-eJOLo2UN.es.js";
2
- import { r as requireStreamHttp } from "./index-CEIbpU5u.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-BwJb6_S5.es.js";
2
+ import { r as requireStreamHttp } from "./index-D612mw4O.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-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";
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";
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-BgN565V6.cjs");
3
- const index$2 = require("./index-Dz0ZMALg.cjs");
2
+ const jszip = require("./jszip-DWfnW2xV.cjs");
3
+ const index$2 = require("./index-ibuaxW1X.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-eJOLo2UN.es.js";
2
- import { r as requireStreamHttp, a as require$$1 } from "./index-CEIbpU5u.es.js";
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";
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
5
5
  const e = m[i];
@@ -1,8 +1,8 @@
1
1
  "use strict";
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");
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");
6
6
  var streamHttp = {};
7
7
  var request = { exports: {} };
8
8
  var capability = {};
@@ -1,4 +1,4 @@
1
- import "./vue-aMYj79Bx.es.js";
1
+ import "./vue-B_OPNNfX.es.js";
2
2
  var buffer = {};
3
3
  var base64Js = {};
4
4
  base64Js.byteLength = byteLength;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- require("./vue-BLDJYAe8.cjs");
2
+ require("./vue-CfKg12kH.cjs");
3
3
  var buffer = {};
4
4
  var base64Js = {};
5
5
  base64Js.byteLength = byteLength;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const vue = require("./vue-BLDJYAe8.cjs");
2
+ const vue = require("./vue-CfKg12kH.cjs");
3
3
  const Y = require("yjs");
4
4
  function _interopNamespaceDefault(e) {
5
5
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -12356,11 +12356,9 @@ function removeRange(content, from2, to) {
12356
12356
  function insertInto(content, dist2, insert, parent) {
12357
12357
  let { index: index2, offset: offset2 } = content.findIndex(dist2), child = content.maybeChild(index2);
12358
12358
  if (offset2 == dist2 || child.isText) {
12359
- if (parent && !parent.canReplace(index2, index2, insert))
12360
- return null;
12361
12359
  return content.cut(0, dist2).append(insert).append(content.cut(dist2));
12362
12360
  }
12363
- let inner = insertInto(child.content, dist2 - offset2 - 1, insert, child);
12361
+ let inner = insertInto(child.content, dist2 - offset2 - 1, insert);
12364
12362
  return inner && content.replaceChild(index2, child.copy(inner));
12365
12363
  }
12366
12364
  function replace($from, $to, slice2) {
@@ -22173,9 +22171,11 @@ const getListItemStyleDefinitions = ({ styleId, numId, level, editor, tries }) =
22173
22171
  }
22174
22172
  const numDefinition = getDefinitionForLevel(abstractDefinition, level);
22175
22173
  const numDefPpr = numDefinition?.elements.find((el) => el.name === "w:pPr");
22174
+ const numLvlJs = numDefinition?.elements.find((el) => el.name === "w:lvlJc");
22176
22175
  return {
22177
22176
  stylePpr,
22178
- numDefPpr
22177
+ numDefPpr,
22178
+ numLvlJs
22179
22179
  };
22180
22180
  };
22181
22181
  const addInlineTextMarks = (currentNode, filteredMarks) => {
@@ -26877,7 +26877,7 @@ const handleRunNode = (params2) => {
26877
26877
  const hasRunProperties = node2.elements?.some((el) => el.name === "w:rPr");
26878
26878
  const defaultNodeStyles = getMarksFromStyles(docx, parentStyleId);
26879
26879
  if (hasRunProperties) {
26880
- const { marks = [], attributes = {} } = parseProperties(node2);
26880
+ const { marks = [] } = parseProperties(node2);
26881
26881
  let runStyleAttributes = [];
26882
26882
  const runStyleElement = node2.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rStyle");
26883
26883
  let runStyleId;
@@ -28785,7 +28785,7 @@ const _SuperConverter = class _SuperConverter2 {
28785
28785
  return;
28786
28786
  }
28787
28787
  }
28788
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.11") {
28788
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.12-next.2") {
28789
28789
  const customLocation = "docProps/custom.xml";
28790
28790
  if (!docx[customLocation]) {
28791
28791
  docx[customLocation] = generateCustomXml();
@@ -29265,7 +29265,7 @@ function storeSuperdocVersion(docx) {
29265
29265
  function generateCustomXml() {
29266
29266
  return DEFAULT_CUSTOM_XML;
29267
29267
  }
29268
- function generateSuperdocVersion(pid = 2, version2 = "0.15.11") {
29268
+ function generateSuperdocVersion(pid = 2, version2 = "0.15.12-next.2") {
29269
29269
  return {
29270
29270
  type: "element",
29271
29271
  name: "property",
@@ -34237,14 +34237,14 @@ const splitListItem = () => (props) => {
34237
34237
  secondList = editor.schema.nodes.orderedList.createAndFill(parentListNode.attrs, Fragment.from(secondListItem));
34238
34238
  } else {
34239
34239
  let firstParagraphContent = beforeCursor;
34240
- if (marks.length > 0 && beforeCursor.size === 0) {
34240
+ if (beforeCursor.size === 0) {
34241
34241
  firstParagraphContent = editor.schema.text(" ", marks);
34242
34242
  }
34243
34243
  const firstParagraph = editor.schema.nodes.paragraph.create(paragraphNode.attrs, firstParagraphContent);
34244
34244
  const firstListItem = editor.schema.nodes.listItem.create({ ...listItemNode.attrs }, firstParagraph);
34245
34245
  firstList = editor.schema.nodes.orderedList.createAndFill(parentListNode.attrs, Fragment.from(firstListItem));
34246
34246
  let secondParagraphContent = afterCursor;
34247
- if (marks.length > 0 && afterCursor.size === 0) {
34247
+ if (afterCursor.size === 0) {
34248
34248
  secondParagraphContent = editor.schema.text(" ", marks);
34249
34249
  }
34250
34250
  const secondParagraph = editor.schema.nodes.paragraph.create(paragraphNode.attrs, secondParagraphContent);
@@ -45605,7 +45605,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
45605
45605
  * @returns {Object | void} Migration results
45606
45606
  */
45607
45607
  processCollaborationMigrations() {
45608
- console.debug("[checkVersionMigrations] Current editor version", "0.15.11");
45608
+ console.debug("[checkVersionMigrations] Current editor version", "0.15.12-next.2");
45609
45609
  if (!this.options.ydoc) return;
45610
45610
  const metaMap = this.options.ydoc.getMap("meta");
45611
45611
  let docVersion = metaMap.get("version");
@@ -48199,6 +48199,12 @@ const intToAlpha = (num) => {
48199
48199
  }
48200
48200
  return result;
48201
48201
  };
48202
+ const MARKER_PADDING = 6;
48203
+ const MARKER_OFFSET_RIGHT = 4;
48204
+ const MIN_MARKER_WIDTH = 20;
48205
+ const POINT_TO_PIXEL_CONVERSION_FACTOR = 1.33;
48206
+ const DEFAULT_FONT_FAMILY = "Arial, sans-serif";
48207
+ const DEFAULT_FONT_SIZE = "10pt";
48202
48208
  const activeListItemNodeViews = /* @__PURE__ */ new Set();
48203
48209
  class ListItemNodeView {
48204
48210
  constructor(node2, getPos, decorations, editor) {
@@ -48218,25 +48224,50 @@ class ListItemNodeView {
48218
48224
  const { styleId, numId, level, indent: inlineIndent } = attrs;
48219
48225
  const defs = getListItemStyleDefinitions({ styleId, node: this.node, numId, level, editor: this.editor });
48220
48226
  const visibleIndent = getVisibleIndent(defs.stylePpr, defs.numDefPpr, inlineIndent);
48221
- let absoluteLeft = visibleIndent.left - (visibleIndent.hanging || 0);
48222
- if (!absoluteLeft && absoluteLeft !== 0) absoluteLeft = 0;
48223
- let contentLeft = visibleIndent.left;
48224
- if (visibleIndent.left === absoluteLeft) {
48225
- absoluteLeft -= 24;
48226
- }
48227
- this.contentDOM.style.marginLeft = `${contentLeft}px`;
48228
- this.numberingDOM.style.left = `${absoluteLeft}px`;
48227
+ const lvlJc = defs.numLvlJs?.attributes?.["w:val"] || "left";
48228
+ const contentLeft = visibleIndent.left || 0;
48229
+ const hanging = visibleIndent.hanging || 0;
48230
+ const handlers2 = {
48231
+ right: () => {
48232
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM);
48233
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
48234
+ const effectiveHanging = Math.max(hanging, minMarkerWidth);
48235
+ const markerLeft = contentLeft - effectiveHanging - MARKER_OFFSET_RIGHT;
48236
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
48237
+ this.numberingDOM.style.left = `${markerLeft}px`;
48238
+ this.numberingDOM.style.width = `${effectiveHanging}px`;
48239
+ this.numberingDOM.style.textAlign = "right";
48240
+ },
48241
+ left: () => {
48242
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM);
48243
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
48244
+ let markerLeft = contentLeft - hanging;
48245
+ if (markerLeft === contentLeft) {
48246
+ markerLeft -= minMarkerWidth;
48247
+ } else if (minMarkerWidth > hanging) {
48248
+ const diff = minMarkerWidth - hanging;
48249
+ markerLeft -= diff;
48250
+ }
48251
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
48252
+ this.numberingDOM.style.left = `${markerLeft}px`;
48253
+ this.numberingDOM.style.width = "";
48254
+ this.numberingDOM.style.textAlign = "";
48255
+ }
48256
+ };
48257
+ const handleStyles = handlers2[lvlJc] ?? handlers2.left;
48258
+ handleStyles();
48229
48259
  }
48230
48260
  update(node2, decorations) {
48231
48261
  this.node = node2;
48232
48262
  this.decorations = decorations;
48233
- const { fontSize: fontSize2, fontFamily: fontFamily2 } = getTextStyleMarksFromLinkedStyles({
48263
+ const { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 } = getTextStyleMarksFromLinkedStyles({
48234
48264
  node: node2,
48235
48265
  pos: this.getPos(),
48236
48266
  editor: this.editor
48237
48267
  });
48238
48268
  this.dom.style.fontSize = fontSize2;
48239
48269
  this.dom.style.fontFamily = fontFamily2 || "inherit";
48270
+ this.dom.style.lineHeight = lineHeight2 || "";
48240
48271
  }
48241
48272
  destroy() {
48242
48273
  activeListItemNodeViews.delete(this);
@@ -48261,7 +48292,7 @@ init_fn2 = function() {
48261
48292
  }
48262
48293
  }
48263
48294
  const pos = this.getPos();
48264
- const { fontSize: fontSize2, fontFamily: fontFamily2 } = getTextStyleMarksFromLinkedStyles({
48295
+ const { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 } = getTextStyleMarksFromLinkedStyles({
48265
48296
  node: this.node,
48266
48297
  pos,
48267
48298
  editor: this.editor
@@ -48270,6 +48301,7 @@ init_fn2 = function() {
48270
48301
  this.dom.className = "sd-editor-list-item-node-view";
48271
48302
  this.dom.style.fontSize = fontSize2;
48272
48303
  this.dom.style.fontFamily = fontFamily2 ? fontFamily2 : "inherit";
48304
+ this.dom.style.lineHeight = lineHeight2 || "";
48273
48305
  this.dom.setAttribute("data-marker-type", orderMarker);
48274
48306
  this.dom.setAttribute("data-num-id", numId);
48275
48307
  this.dom.setAttribute("data-list-level", JSON.stringify(listLevel));
@@ -48298,8 +48330,10 @@ function refreshAllListItemNodeViews() {
48298
48330
  }
48299
48331
  function getListItemTextStyleMarks(listItem, markType) {
48300
48332
  let textStyleMarks = [];
48333
+ let attrs = {};
48301
48334
  listItem.forEach((childNode) => {
48302
48335
  if (childNode.type.name !== "paragraph") return;
48336
+ attrs.lineHeight = childNode.attrs.lineHeight;
48303
48337
  childNode.forEach((textNode) => {
48304
48338
  let isTextNode = textNode.type.name === "text";
48305
48339
  let hasTextStyleMarks = markType.isInSet(textNode.marks);
@@ -48309,15 +48343,19 @@ function getListItemTextStyleMarks(listItem, markType) {
48309
48343
  }
48310
48344
  });
48311
48345
  });
48312
- return textStyleMarks;
48346
+ return {
48347
+ marks: textStyleMarks,
48348
+ attrs
48349
+ };
48313
48350
  }
48314
48351
  function getTextStyleMarksFromLinkedStyles({ node: node2, pos, editor }) {
48315
48352
  const { font: defaultFont, size: defaultSize } = getStylesFromLinkedStyles({ node: node2, pos, editor });
48316
48353
  const textStyleType = getMarkType("textStyle", editor.schema);
48317
- const allMarks = getListItemTextStyleMarks(node2, textStyleType);
48354
+ const { marks: allMarks, attrs: allAttrs } = getListItemTextStyleMarks(node2, textStyleType);
48318
48355
  const styleMarks = allMarks.filter((m) => m.type === textStyleType);
48319
48356
  const sizeMark = styleMarks.find((m) => m.attrs.fontSize);
48320
48357
  const familyMark = styleMarks.find((m) => m.attrs.fontFamily);
48358
+ const lineHeight2 = allAttrs.lineHeight;
48321
48359
  let fontSize2 = sizeMark ? (() => {
48322
48360
  const [value, unit = "pt"] = parseSizeUnit(sizeMark.attrs.fontSize);
48323
48361
  return Number.isNaN(value) ? defaultSize : `${value}${unit}`;
@@ -48335,13 +48373,25 @@ function getTextStyleMarksFromLinkedStyles({ node: node2, pos, editor }) {
48335
48373
  if (!familyMark && aFontFamily) fontFamily2 = aFontFamily;
48336
48374
  }
48337
48375
  }
48338
- return { fontSize: fontSize2, fontFamily: fontFamily2 };
48376
+ return { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 };
48339
48377
  }
48340
48378
  const getStylesFromLinkedStyles = ({ node: node2, pos, editor }) => {
48341
48379
  const { state: state2 } = editor.view;
48342
48380
  const linkedStyles = LinkedStylesPluginKey.getState(state2)?.decorations;
48343
48381
  const decorationsInPlace = linkedStyles?.find(pos, pos + node2.nodeSize);
48344
- const styleDeco = decorationsInPlace?.findLast((dec) => dec.type.attrs?.style);
48382
+ const predicates = [
48383
+ (style22) => style22.includes("font-size") && style22.includes("font-family"),
48384
+ (style22) => style22.includes("font-size"),
48385
+ (style22) => style22.includes("font-family")
48386
+ ];
48387
+ let styleDeco;
48388
+ for (const predicateFn of predicates) {
48389
+ styleDeco = decorationsInPlace?.find((dec) => {
48390
+ const style22 = dec.type.attrs?.style || "";
48391
+ return style22 && predicateFn(style22);
48392
+ });
48393
+ if (styleDeco) break;
48394
+ }
48345
48395
  const style2 = styleDeco?.type.attrs?.style;
48346
48396
  const stylesArray = style2?.split(";") || [];
48347
48397
  const fontSizeFromStyles = stylesArray.find((s) => s.includes("font-size"))?.split(":")[1].trim();
@@ -48357,8 +48407,27 @@ const getVisibleIndent = (stylePpr, numDefPpr, inlineIndent) => {
48357
48407
  const numDefIndentTag = numDefPpr?.elements?.find((el) => el.name === "w:ind") || {};
48358
48408
  const numDefIndent = parseIndentElement(numDefIndentTag);
48359
48409
  const indent = combineIndents(styleIndent, numDefIndent);
48360
- return combineIndents(indent, inlineIndent);
48410
+ const result = combineIndents(indent, inlineIndent);
48411
+ return result;
48361
48412
  };
48413
+ function calculateMarkerWidth(dom, numberingDOM, { withPadding = true } = {}) {
48414
+ const markerText = numberingDOM.textContent || "";
48415
+ const fontSize2 = dom.style.fontSize || DEFAULT_FONT_SIZE;
48416
+ const fontValue = dom.style.fontFamily;
48417
+ const fontFamily2 = fontValue && fontValue !== "inherit" ? fontValue : DEFAULT_FONT_FAMILY;
48418
+ if (!markerText.trim()) return 0;
48419
+ try {
48420
+ const canvas = document.createElement("canvas");
48421
+ const context = canvas.getContext("2d");
48422
+ const fontSizePx = fontSize2.includes("pt") ? Number.parseFloat(fontSize2) * POINT_TO_PIXEL_CONVERSION_FACTOR : Number.parseFloat(fontSize2);
48423
+ context.font = `${fontSizePx}px ${fontFamily2}`;
48424
+ const textWidth = context.measureText(markerText).width;
48425
+ const resultWidth = withPadding ? Math.ceil(textWidth + MARKER_PADDING) : Math.ceil(textWidth);
48426
+ return resultWidth;
48427
+ } catch {
48428
+ return 0;
48429
+ }
48430
+ }
48362
48431
  const orderedListSyncPluginKey = new PluginKey("orderedListSync");
48363
48432
  function orderedListSync(editor) {
48364
48433
  let hasInitialized = false;
@@ -72771,7 +72840,7 @@ const _sfc_main$b = {
72771
72840
  class: "remove-btn__icon",
72772
72841
  innerHTML: vue.unref(toolbarIcons).removeLink
72773
72842
  }, null, 8, _hoisted_12),
72774
- _cache[5] || (_cache[5] = vue.createTextVNode(" Remove ", -1))
72843
+ _cache[5] || (_cache[5] = vue.createTextVNode(" Remove "))
72775
72844
  ])) : vue.createCommentVNode("", true),
72776
72845
  vue.createBaseVNode("button", {
72777
72846
  class: vue.normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
@@ -72970,7 +73039,7 @@ const _sfc_main$9 = {
72970
73039
  innerHTML: vue.unref(DropIcon),
72971
73040
  class: "none-icon"
72972
73041
  }, null, 8, _hoisted_2$5),
72973
- _cache[1] || (_cache[1] = vue.createTextVNode(" None ", -1))
73042
+ _cache[1] || (_cache[1] = vue.createTextVNode(" None "))
72974
73043
  ])) : vue.createCommentVNode("", true),
72975
73044
  vue.createBaseVNode("div", _hoisted_3$4, [
72976
73045
  vue.createVNode(IconGridRow, {
@@ -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-aMYj79Bx.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-B_OPNNfX.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;
@@ -12339,11 +12339,9 @@ function removeRange(content, from2, to) {
12339
12339
  function insertInto(content, dist2, insert, parent) {
12340
12340
  let { index: index2, offset: offset2 } = content.findIndex(dist2), child = content.maybeChild(index2);
12341
12341
  if (offset2 == dist2 || child.isText) {
12342
- if (parent && !parent.canReplace(index2, index2, insert))
12343
- return null;
12344
12342
  return content.cut(0, dist2).append(insert).append(content.cut(dist2));
12345
12343
  }
12346
- let inner = insertInto(child.content, dist2 - offset2 - 1, insert, child);
12344
+ let inner = insertInto(child.content, dist2 - offset2 - 1, insert);
12347
12345
  return inner && content.replaceChild(index2, child.copy(inner));
12348
12346
  }
12349
12347
  function replace($from, $to, slice2) {
@@ -22156,9 +22154,11 @@ const getListItemStyleDefinitions = ({ styleId, numId, level, editor, tries }) =
22156
22154
  }
22157
22155
  const numDefinition = getDefinitionForLevel(abstractDefinition, level);
22158
22156
  const numDefPpr = numDefinition?.elements.find((el) => el.name === "w:pPr");
22157
+ const numLvlJs = numDefinition?.elements.find((el) => el.name === "w:lvlJc");
22159
22158
  return {
22160
22159
  stylePpr,
22161
- numDefPpr
22160
+ numDefPpr,
22161
+ numLvlJs
22162
22162
  };
22163
22163
  };
22164
22164
  const addInlineTextMarks = (currentNode, filteredMarks) => {
@@ -26860,7 +26860,7 @@ const handleRunNode = (params2) => {
26860
26860
  const hasRunProperties = node2.elements?.some((el) => el.name === "w:rPr");
26861
26861
  const defaultNodeStyles = getMarksFromStyles(docx, parentStyleId);
26862
26862
  if (hasRunProperties) {
26863
- const { marks = [], attributes = {} } = parseProperties(node2);
26863
+ const { marks = [] } = parseProperties(node2);
26864
26864
  let runStyleAttributes = [];
26865
26865
  const runStyleElement = node2.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rStyle");
26866
26866
  let runStyleId;
@@ -28768,7 +28768,7 @@ const _SuperConverter = class _SuperConverter2 {
28768
28768
  return;
28769
28769
  }
28770
28770
  }
28771
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.11") {
28771
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.12-next.2") {
28772
28772
  const customLocation = "docProps/custom.xml";
28773
28773
  if (!docx[customLocation]) {
28774
28774
  docx[customLocation] = generateCustomXml();
@@ -29248,7 +29248,7 @@ function storeSuperdocVersion(docx) {
29248
29248
  function generateCustomXml() {
29249
29249
  return DEFAULT_CUSTOM_XML;
29250
29250
  }
29251
- function generateSuperdocVersion(pid = 2, version2 = "0.15.11") {
29251
+ function generateSuperdocVersion(pid = 2, version2 = "0.15.12-next.2") {
29252
29252
  return {
29253
29253
  type: "element",
29254
29254
  name: "property",
@@ -34220,14 +34220,14 @@ const splitListItem = () => (props) => {
34220
34220
  secondList = editor.schema.nodes.orderedList.createAndFill(parentListNode.attrs, Fragment.from(secondListItem));
34221
34221
  } else {
34222
34222
  let firstParagraphContent = beforeCursor;
34223
- if (marks.length > 0 && beforeCursor.size === 0) {
34223
+ if (beforeCursor.size === 0) {
34224
34224
  firstParagraphContent = editor.schema.text(" ", marks);
34225
34225
  }
34226
34226
  const firstParagraph = editor.schema.nodes.paragraph.create(paragraphNode.attrs, firstParagraphContent);
34227
34227
  const firstListItem = editor.schema.nodes.listItem.create({ ...listItemNode.attrs }, firstParagraph);
34228
34228
  firstList = editor.schema.nodes.orderedList.createAndFill(parentListNode.attrs, Fragment.from(firstListItem));
34229
34229
  let secondParagraphContent = afterCursor;
34230
- if (marks.length > 0 && afterCursor.size === 0) {
34230
+ if (afterCursor.size === 0) {
34231
34231
  secondParagraphContent = editor.schema.text(" ", marks);
34232
34232
  }
34233
34233
  const secondParagraph = editor.schema.nodes.paragraph.create(paragraphNode.attrs, secondParagraphContent);
@@ -45588,7 +45588,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
45588
45588
  * @returns {Object | void} Migration results
45589
45589
  */
45590
45590
  processCollaborationMigrations() {
45591
- console.debug("[checkVersionMigrations] Current editor version", "0.15.11");
45591
+ console.debug("[checkVersionMigrations] Current editor version", "0.15.12-next.2");
45592
45592
  if (!this.options.ydoc) return;
45593
45593
  const metaMap = this.options.ydoc.getMap("meta");
45594
45594
  let docVersion = metaMap.get("version");
@@ -48182,6 +48182,12 @@ const intToAlpha = (num) => {
48182
48182
  }
48183
48183
  return result;
48184
48184
  };
48185
+ const MARKER_PADDING = 6;
48186
+ const MARKER_OFFSET_RIGHT = 4;
48187
+ const MIN_MARKER_WIDTH = 20;
48188
+ const POINT_TO_PIXEL_CONVERSION_FACTOR = 1.33;
48189
+ const DEFAULT_FONT_FAMILY = "Arial, sans-serif";
48190
+ const DEFAULT_FONT_SIZE = "10pt";
48185
48191
  const activeListItemNodeViews = /* @__PURE__ */ new Set();
48186
48192
  class ListItemNodeView {
48187
48193
  constructor(node2, getPos, decorations, editor) {
@@ -48201,25 +48207,50 @@ class ListItemNodeView {
48201
48207
  const { styleId, numId, level, indent: inlineIndent } = attrs;
48202
48208
  const defs = getListItemStyleDefinitions({ styleId, node: this.node, numId, level, editor: this.editor });
48203
48209
  const visibleIndent = getVisibleIndent(defs.stylePpr, defs.numDefPpr, inlineIndent);
48204
- let absoluteLeft = visibleIndent.left - (visibleIndent.hanging || 0);
48205
- if (!absoluteLeft && absoluteLeft !== 0) absoluteLeft = 0;
48206
- let contentLeft = visibleIndent.left;
48207
- if (visibleIndent.left === absoluteLeft) {
48208
- absoluteLeft -= 24;
48209
- }
48210
- this.contentDOM.style.marginLeft = `${contentLeft}px`;
48211
- this.numberingDOM.style.left = `${absoluteLeft}px`;
48210
+ const lvlJc = defs.numLvlJs?.attributes?.["w:val"] || "left";
48211
+ const contentLeft = visibleIndent.left || 0;
48212
+ const hanging = visibleIndent.hanging || 0;
48213
+ const handlers2 = {
48214
+ right: () => {
48215
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM);
48216
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
48217
+ const effectiveHanging = Math.max(hanging, minMarkerWidth);
48218
+ const markerLeft = contentLeft - effectiveHanging - MARKER_OFFSET_RIGHT;
48219
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
48220
+ this.numberingDOM.style.left = `${markerLeft}px`;
48221
+ this.numberingDOM.style.width = `${effectiveHanging}px`;
48222
+ this.numberingDOM.style.textAlign = "right";
48223
+ },
48224
+ left: () => {
48225
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM);
48226
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
48227
+ let markerLeft = contentLeft - hanging;
48228
+ if (markerLeft === contentLeft) {
48229
+ markerLeft -= minMarkerWidth;
48230
+ } else if (minMarkerWidth > hanging) {
48231
+ const diff = minMarkerWidth - hanging;
48232
+ markerLeft -= diff;
48233
+ }
48234
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
48235
+ this.numberingDOM.style.left = `${markerLeft}px`;
48236
+ this.numberingDOM.style.width = "";
48237
+ this.numberingDOM.style.textAlign = "";
48238
+ }
48239
+ };
48240
+ const handleStyles = handlers2[lvlJc] ?? handlers2.left;
48241
+ handleStyles();
48212
48242
  }
48213
48243
  update(node2, decorations) {
48214
48244
  this.node = node2;
48215
48245
  this.decorations = decorations;
48216
- const { fontSize: fontSize2, fontFamily: fontFamily2 } = getTextStyleMarksFromLinkedStyles({
48246
+ const { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 } = getTextStyleMarksFromLinkedStyles({
48217
48247
  node: node2,
48218
48248
  pos: this.getPos(),
48219
48249
  editor: this.editor
48220
48250
  });
48221
48251
  this.dom.style.fontSize = fontSize2;
48222
48252
  this.dom.style.fontFamily = fontFamily2 || "inherit";
48253
+ this.dom.style.lineHeight = lineHeight2 || "";
48223
48254
  }
48224
48255
  destroy() {
48225
48256
  activeListItemNodeViews.delete(this);
@@ -48244,7 +48275,7 @@ init_fn2 = function() {
48244
48275
  }
48245
48276
  }
48246
48277
  const pos = this.getPos();
48247
- const { fontSize: fontSize2, fontFamily: fontFamily2 } = getTextStyleMarksFromLinkedStyles({
48278
+ const { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 } = getTextStyleMarksFromLinkedStyles({
48248
48279
  node: this.node,
48249
48280
  pos,
48250
48281
  editor: this.editor
@@ -48253,6 +48284,7 @@ init_fn2 = function() {
48253
48284
  this.dom.className = "sd-editor-list-item-node-view";
48254
48285
  this.dom.style.fontSize = fontSize2;
48255
48286
  this.dom.style.fontFamily = fontFamily2 ? fontFamily2 : "inherit";
48287
+ this.dom.style.lineHeight = lineHeight2 || "";
48256
48288
  this.dom.setAttribute("data-marker-type", orderMarker);
48257
48289
  this.dom.setAttribute("data-num-id", numId);
48258
48290
  this.dom.setAttribute("data-list-level", JSON.stringify(listLevel));
@@ -48281,8 +48313,10 @@ function refreshAllListItemNodeViews() {
48281
48313
  }
48282
48314
  function getListItemTextStyleMarks(listItem, markType) {
48283
48315
  let textStyleMarks = [];
48316
+ let attrs = {};
48284
48317
  listItem.forEach((childNode) => {
48285
48318
  if (childNode.type.name !== "paragraph") return;
48319
+ attrs.lineHeight = childNode.attrs.lineHeight;
48286
48320
  childNode.forEach((textNode) => {
48287
48321
  let isTextNode = textNode.type.name === "text";
48288
48322
  let hasTextStyleMarks = markType.isInSet(textNode.marks);
@@ -48292,15 +48326,19 @@ function getListItemTextStyleMarks(listItem, markType) {
48292
48326
  }
48293
48327
  });
48294
48328
  });
48295
- return textStyleMarks;
48329
+ return {
48330
+ marks: textStyleMarks,
48331
+ attrs
48332
+ };
48296
48333
  }
48297
48334
  function getTextStyleMarksFromLinkedStyles({ node: node2, pos, editor }) {
48298
48335
  const { font: defaultFont, size: defaultSize } = getStylesFromLinkedStyles({ node: node2, pos, editor });
48299
48336
  const textStyleType = getMarkType("textStyle", editor.schema);
48300
- const allMarks = getListItemTextStyleMarks(node2, textStyleType);
48337
+ const { marks: allMarks, attrs: allAttrs } = getListItemTextStyleMarks(node2, textStyleType);
48301
48338
  const styleMarks = allMarks.filter((m) => m.type === textStyleType);
48302
48339
  const sizeMark = styleMarks.find((m) => m.attrs.fontSize);
48303
48340
  const familyMark = styleMarks.find((m) => m.attrs.fontFamily);
48341
+ const lineHeight2 = allAttrs.lineHeight;
48304
48342
  let fontSize2 = sizeMark ? (() => {
48305
48343
  const [value, unit = "pt"] = parseSizeUnit(sizeMark.attrs.fontSize);
48306
48344
  return Number.isNaN(value) ? defaultSize : `${value}${unit}`;
@@ -48318,13 +48356,25 @@ function getTextStyleMarksFromLinkedStyles({ node: node2, pos, editor }) {
48318
48356
  if (!familyMark && aFontFamily) fontFamily2 = aFontFamily;
48319
48357
  }
48320
48358
  }
48321
- return { fontSize: fontSize2, fontFamily: fontFamily2 };
48359
+ return { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 };
48322
48360
  }
48323
48361
  const getStylesFromLinkedStyles = ({ node: node2, pos, editor }) => {
48324
48362
  const { state: state2 } = editor.view;
48325
48363
  const linkedStyles = LinkedStylesPluginKey.getState(state2)?.decorations;
48326
48364
  const decorationsInPlace = linkedStyles?.find(pos, pos + node2.nodeSize);
48327
- const styleDeco = decorationsInPlace?.findLast((dec) => dec.type.attrs?.style);
48365
+ const predicates = [
48366
+ (style22) => style22.includes("font-size") && style22.includes("font-family"),
48367
+ (style22) => style22.includes("font-size"),
48368
+ (style22) => style22.includes("font-family")
48369
+ ];
48370
+ let styleDeco;
48371
+ for (const predicateFn of predicates) {
48372
+ styleDeco = decorationsInPlace?.find((dec) => {
48373
+ const style22 = dec.type.attrs?.style || "";
48374
+ return style22 && predicateFn(style22);
48375
+ });
48376
+ if (styleDeco) break;
48377
+ }
48328
48378
  const style2 = styleDeco?.type.attrs?.style;
48329
48379
  const stylesArray = style2?.split(";") || [];
48330
48380
  const fontSizeFromStyles = stylesArray.find((s) => s.includes("font-size"))?.split(":")[1].trim();
@@ -48340,8 +48390,27 @@ const getVisibleIndent = (stylePpr, numDefPpr, inlineIndent) => {
48340
48390
  const numDefIndentTag = numDefPpr?.elements?.find((el) => el.name === "w:ind") || {};
48341
48391
  const numDefIndent = parseIndentElement(numDefIndentTag);
48342
48392
  const indent = combineIndents(styleIndent, numDefIndent);
48343
- return combineIndents(indent, inlineIndent);
48393
+ const result = combineIndents(indent, inlineIndent);
48394
+ return result;
48344
48395
  };
48396
+ function calculateMarkerWidth(dom, numberingDOM, { withPadding = true } = {}) {
48397
+ const markerText = numberingDOM.textContent || "";
48398
+ const fontSize2 = dom.style.fontSize || DEFAULT_FONT_SIZE;
48399
+ const fontValue = dom.style.fontFamily;
48400
+ const fontFamily2 = fontValue && fontValue !== "inherit" ? fontValue : DEFAULT_FONT_FAMILY;
48401
+ if (!markerText.trim()) return 0;
48402
+ try {
48403
+ const canvas = document.createElement("canvas");
48404
+ const context = canvas.getContext("2d");
48405
+ const fontSizePx = fontSize2.includes("pt") ? Number.parseFloat(fontSize2) * POINT_TO_PIXEL_CONVERSION_FACTOR : Number.parseFloat(fontSize2);
48406
+ context.font = `${fontSizePx}px ${fontFamily2}`;
48407
+ const textWidth = context.measureText(markerText).width;
48408
+ const resultWidth = withPadding ? Math.ceil(textWidth + MARKER_PADDING) : Math.ceil(textWidth);
48409
+ return resultWidth;
48410
+ } catch {
48411
+ return 0;
48412
+ }
48413
+ }
48345
48414
  const orderedListSyncPluginKey = new PluginKey("orderedListSync");
48346
48415
  function orderedListSync(editor) {
48347
48416
  let hasInitialized = false;
@@ -72754,7 +72823,7 @@ const _sfc_main$b = {
72754
72823
  class: "remove-btn__icon",
72755
72824
  innerHTML: unref(toolbarIcons).removeLink
72756
72825
  }, null, 8, _hoisted_12),
72757
- _cache[5] || (_cache[5] = createTextVNode(" Remove ", -1))
72826
+ _cache[5] || (_cache[5] = createTextVNode(" Remove "))
72758
72827
  ])) : createCommentVNode("", true),
72759
72828
  createBaseVNode("button", {
72760
72829
  class: normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
@@ -72953,7 +73022,7 @@ const _sfc_main$9 = {
72953
73022
  innerHTML: unref(DropIcon),
72954
73023
  class: "none-icon"
72955
73024
  }, null, 8, _hoisted_2$5),
72956
- _cache[1] || (_cache[1] = createTextVNode(" None ", -1))
73025
+ _cache[1] || (_cache[1] = createTextVNode(" None "))
72957
73026
  ])) : createCommentVNode("", true),
72958
73027
  createBaseVNode("div", _hoisted_3$4, [
72959
73028
  createVNode(IconGridRow, {