@harbour-enterprises/superdoc 0.15.11 → 0.15.12-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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-Bb7a0231.cjs} +93 -27
  12. package/dist/chunks/{super-editor.es-DumS7mlS.es.js → super-editor.es-DEJW2COM.es.js} +93 -27
  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-sNx7nIE0.js} +6 -6
  21. package/dist/super-editor/chunks/{docx-zipper-BG5IuQq_.js → docx-zipper-V8K1kCeT.js} +1 -1
  22. package/dist/super-editor/chunks/{editor-FUXak2H0.js → editor-Bqqf0dot.js} +86 -20
  23. package/dist/super-editor/chunks/{toolbar-Bc9HbKLO.js → toolbar-DqmSZWCD.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 +100 -41
  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) => {
@@ -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.1") {
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.1") {
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.1");
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,9 @@ 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;
48202
48205
  const activeListItemNodeViews = /* @__PURE__ */ new Set();
48203
48206
  class ListItemNodeView {
48204
48207
  constructor(node2, getPos, decorations, editor) {
@@ -48218,25 +48221,50 @@ class ListItemNodeView {
48218
48221
  const { styleId, numId, level, indent: inlineIndent } = attrs;
48219
48222
  const defs = getListItemStyleDefinitions({ styleId, node: this.node, numId, level, editor: this.editor });
48220
48223
  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`;
48224
+ const lvlJc = defs.numLvlJs?.attributes?.["w:val"] || "left";
48225
+ const contentLeft = visibleIndent.left || 0;
48226
+ const hanging = visibleIndent.hanging || 0;
48227
+ const handlers2 = {
48228
+ right: () => {
48229
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM);
48230
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
48231
+ const effectiveHanging = Math.max(hanging, minMarkerWidth);
48232
+ const markerLeft = contentLeft - effectiveHanging - MARKER_OFFSET_RIGHT;
48233
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
48234
+ this.numberingDOM.style.left = `${markerLeft}px`;
48235
+ this.numberingDOM.style.width = `${effectiveHanging}px`;
48236
+ this.numberingDOM.style.textAlign = "right";
48237
+ },
48238
+ left: () => {
48239
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM);
48240
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
48241
+ let markerLeft = contentLeft - hanging;
48242
+ if (markerLeft === contentLeft) {
48243
+ markerLeft -= minMarkerWidth;
48244
+ } else if (minMarkerWidth > hanging) {
48245
+ const diff = minMarkerWidth - hanging;
48246
+ markerLeft -= diff;
48247
+ }
48248
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
48249
+ this.numberingDOM.style.left = `${markerLeft}px`;
48250
+ this.numberingDOM.style.width = "";
48251
+ this.numberingDOM.style.textAlign = "";
48252
+ }
48253
+ };
48254
+ const handleStyles = handlers2[lvlJc] ?? handlers2.left;
48255
+ handleStyles();
48229
48256
  }
48230
48257
  update(node2, decorations) {
48231
48258
  this.node = node2;
48232
48259
  this.decorations = decorations;
48233
- const { fontSize: fontSize2, fontFamily: fontFamily2 } = getTextStyleMarksFromLinkedStyles({
48260
+ const { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 } = getTextStyleMarksFromLinkedStyles({
48234
48261
  node: node2,
48235
48262
  pos: this.getPos(),
48236
48263
  editor: this.editor
48237
48264
  });
48238
48265
  this.dom.style.fontSize = fontSize2;
48239
48266
  this.dom.style.fontFamily = fontFamily2 || "inherit";
48267
+ this.dom.style.lineHeight = lineHeight2 || "";
48240
48268
  }
48241
48269
  destroy() {
48242
48270
  activeListItemNodeViews.delete(this);
@@ -48261,7 +48289,7 @@ init_fn2 = function() {
48261
48289
  }
48262
48290
  }
48263
48291
  const pos = this.getPos();
48264
- const { fontSize: fontSize2, fontFamily: fontFamily2 } = getTextStyleMarksFromLinkedStyles({
48292
+ const { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 } = getTextStyleMarksFromLinkedStyles({
48265
48293
  node: this.node,
48266
48294
  pos,
48267
48295
  editor: this.editor
@@ -48270,6 +48298,7 @@ init_fn2 = function() {
48270
48298
  this.dom.className = "sd-editor-list-item-node-view";
48271
48299
  this.dom.style.fontSize = fontSize2;
48272
48300
  this.dom.style.fontFamily = fontFamily2 ? fontFamily2 : "inherit";
48301
+ this.dom.style.lineHeight = lineHeight2 || "";
48273
48302
  this.dom.setAttribute("data-marker-type", orderMarker);
48274
48303
  this.dom.setAttribute("data-num-id", numId);
48275
48304
  this.dom.setAttribute("data-list-level", JSON.stringify(listLevel));
@@ -48298,8 +48327,10 @@ function refreshAllListItemNodeViews() {
48298
48327
  }
48299
48328
  function getListItemTextStyleMarks(listItem, markType) {
48300
48329
  let textStyleMarks = [];
48330
+ let attrs = {};
48301
48331
  listItem.forEach((childNode) => {
48302
48332
  if (childNode.type.name !== "paragraph") return;
48333
+ attrs.lineHeight = childNode.attrs.lineHeight;
48303
48334
  childNode.forEach((textNode) => {
48304
48335
  let isTextNode = textNode.type.name === "text";
48305
48336
  let hasTextStyleMarks = markType.isInSet(textNode.marks);
@@ -48309,15 +48340,19 @@ function getListItemTextStyleMarks(listItem, markType) {
48309
48340
  }
48310
48341
  });
48311
48342
  });
48312
- return textStyleMarks;
48343
+ return {
48344
+ marks: textStyleMarks,
48345
+ attrs
48346
+ };
48313
48347
  }
48314
48348
  function getTextStyleMarksFromLinkedStyles({ node: node2, pos, editor }) {
48315
48349
  const { font: defaultFont, size: defaultSize } = getStylesFromLinkedStyles({ node: node2, pos, editor });
48316
48350
  const textStyleType = getMarkType("textStyle", editor.schema);
48317
- const allMarks = getListItemTextStyleMarks(node2, textStyleType);
48351
+ const { marks: allMarks, attrs: allAttrs } = getListItemTextStyleMarks(node2, textStyleType);
48318
48352
  const styleMarks = allMarks.filter((m) => m.type === textStyleType);
48319
48353
  const sizeMark = styleMarks.find((m) => m.attrs.fontSize);
48320
48354
  const familyMark = styleMarks.find((m) => m.attrs.fontFamily);
48355
+ const lineHeight2 = allAttrs.lineHeight;
48321
48356
  let fontSize2 = sizeMark ? (() => {
48322
48357
  const [value, unit = "pt"] = parseSizeUnit(sizeMark.attrs.fontSize);
48323
48358
  return Number.isNaN(value) ? defaultSize : `${value}${unit}`;
@@ -48335,13 +48370,25 @@ function getTextStyleMarksFromLinkedStyles({ node: node2, pos, editor }) {
48335
48370
  if (!familyMark && aFontFamily) fontFamily2 = aFontFamily;
48336
48371
  }
48337
48372
  }
48338
- return { fontSize: fontSize2, fontFamily: fontFamily2 };
48373
+ return { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 };
48339
48374
  }
48340
48375
  const getStylesFromLinkedStyles = ({ node: node2, pos, editor }) => {
48341
48376
  const { state: state2 } = editor.view;
48342
48377
  const linkedStyles = LinkedStylesPluginKey.getState(state2)?.decorations;
48343
48378
  const decorationsInPlace = linkedStyles?.find(pos, pos + node2.nodeSize);
48344
- const styleDeco = decorationsInPlace?.findLast((dec) => dec.type.attrs?.style);
48379
+ const predicates = [
48380
+ (style22) => style22.includes("font-size") && style22.includes("font-family"),
48381
+ (style22) => style22.includes("font-size"),
48382
+ (style22) => style22.includes("font-family")
48383
+ ];
48384
+ let styleDeco;
48385
+ for (const predicateFn of predicates) {
48386
+ styleDeco = decorationsInPlace?.find((dec) => {
48387
+ const style22 = dec.type.attrs?.style || "";
48388
+ return style22 && predicateFn(style22);
48389
+ });
48390
+ if (styleDeco) break;
48391
+ }
48345
48392
  const style2 = styleDeco?.type.attrs?.style;
48346
48393
  const stylesArray = style2?.split(";") || [];
48347
48394
  const fontSizeFromStyles = stylesArray.find((s) => s.includes("font-size"))?.split(":")[1].trim();
@@ -48357,8 +48404,27 @@ const getVisibleIndent = (stylePpr, numDefPpr, inlineIndent) => {
48357
48404
  const numDefIndentTag = numDefPpr?.elements?.find((el) => el.name === "w:ind") || {};
48358
48405
  const numDefIndent = parseIndentElement(numDefIndentTag);
48359
48406
  const indent = combineIndents(styleIndent, numDefIndent);
48360
- return combineIndents(indent, inlineIndent);
48407
+ const result = combineIndents(indent, inlineIndent);
48408
+ return result;
48361
48409
  };
48410
+ function calculateMarkerWidth(dom, numberingDOM, { withPadding = true } = {}) {
48411
+ const markerText = numberingDOM.textContent || "";
48412
+ const fontSize2 = dom.style.fontSize || "10pt";
48413
+ const fontValue = dom.style.fontFamily;
48414
+ const fontFamily2 = fontValue && fontValue !== "inherit" ? fontValue : "Arial";
48415
+ if (!markerText.trim()) return 0;
48416
+ try {
48417
+ const canvas = document.createElement("canvas");
48418
+ const context = canvas.getContext("2d");
48419
+ const fontSizePx = fontSize2.includes("pt") ? Number.parseFloat(fontSize2) * 1.33 : Number.parseFloat(fontSize2);
48420
+ context.font = `${fontSizePx}px ${fontFamily2}`;
48421
+ const textWidth = context.measureText(markerText).width;
48422
+ const resultWidth = withPadding ? Math.ceil(textWidth + MARKER_PADDING) : Math.ceil(textWidth);
48423
+ return resultWidth;
48424
+ } catch (err) {
48425
+ return 0;
48426
+ }
48427
+ }
48362
48428
  const orderedListSyncPluginKey = new PluginKey("orderedListSync");
48363
48429
  function orderedListSync(editor) {
48364
48430
  let hasInitialized = false;
@@ -72771,7 +72837,7 @@ const _sfc_main$b = {
72771
72837
  class: "remove-btn__icon",
72772
72838
  innerHTML: vue.unref(toolbarIcons).removeLink
72773
72839
  }, null, 8, _hoisted_12),
72774
- _cache[5] || (_cache[5] = vue.createTextVNode(" Remove ", -1))
72840
+ _cache[5] || (_cache[5] = vue.createTextVNode(" Remove "))
72775
72841
  ])) : vue.createCommentVNode("", true),
72776
72842
  vue.createBaseVNode("button", {
72777
72843
  class: vue.normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
@@ -72970,7 +73036,7 @@ const _sfc_main$9 = {
72970
73036
  innerHTML: vue.unref(DropIcon),
72971
73037
  class: "none-icon"
72972
73038
  }, null, 8, _hoisted_2$5),
72973
- _cache[1] || (_cache[1] = vue.createTextVNode(" None ", -1))
73039
+ _cache[1] || (_cache[1] = vue.createTextVNode(" None "))
72974
73040
  ])) : vue.createCommentVNode("", true),
72975
73041
  vue.createBaseVNode("div", _hoisted_3$4, [
72976
73042
  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) => {
@@ -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.1") {
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.1") {
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.1");
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,9 @@ 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;
48185
48188
  const activeListItemNodeViews = /* @__PURE__ */ new Set();
48186
48189
  class ListItemNodeView {
48187
48190
  constructor(node2, getPos, decorations, editor) {
@@ -48201,25 +48204,50 @@ class ListItemNodeView {
48201
48204
  const { styleId, numId, level, indent: inlineIndent } = attrs;
48202
48205
  const defs = getListItemStyleDefinitions({ styleId, node: this.node, numId, level, editor: this.editor });
48203
48206
  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`;
48207
+ const lvlJc = defs.numLvlJs?.attributes?.["w:val"] || "left";
48208
+ const contentLeft = visibleIndent.left || 0;
48209
+ const hanging = visibleIndent.hanging || 0;
48210
+ const handlers2 = {
48211
+ right: () => {
48212
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM);
48213
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
48214
+ const effectiveHanging = Math.max(hanging, minMarkerWidth);
48215
+ const markerLeft = contentLeft - effectiveHanging - MARKER_OFFSET_RIGHT;
48216
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
48217
+ this.numberingDOM.style.left = `${markerLeft}px`;
48218
+ this.numberingDOM.style.width = `${effectiveHanging}px`;
48219
+ this.numberingDOM.style.textAlign = "right";
48220
+ },
48221
+ left: () => {
48222
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM);
48223
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
48224
+ let markerLeft = contentLeft - hanging;
48225
+ if (markerLeft === contentLeft) {
48226
+ markerLeft -= minMarkerWidth;
48227
+ } else if (minMarkerWidth > hanging) {
48228
+ const diff = minMarkerWidth - hanging;
48229
+ markerLeft -= diff;
48230
+ }
48231
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
48232
+ this.numberingDOM.style.left = `${markerLeft}px`;
48233
+ this.numberingDOM.style.width = "";
48234
+ this.numberingDOM.style.textAlign = "";
48235
+ }
48236
+ };
48237
+ const handleStyles = handlers2[lvlJc] ?? handlers2.left;
48238
+ handleStyles();
48212
48239
  }
48213
48240
  update(node2, decorations) {
48214
48241
  this.node = node2;
48215
48242
  this.decorations = decorations;
48216
- const { fontSize: fontSize2, fontFamily: fontFamily2 } = getTextStyleMarksFromLinkedStyles({
48243
+ const { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 } = getTextStyleMarksFromLinkedStyles({
48217
48244
  node: node2,
48218
48245
  pos: this.getPos(),
48219
48246
  editor: this.editor
48220
48247
  });
48221
48248
  this.dom.style.fontSize = fontSize2;
48222
48249
  this.dom.style.fontFamily = fontFamily2 || "inherit";
48250
+ this.dom.style.lineHeight = lineHeight2 || "";
48223
48251
  }
48224
48252
  destroy() {
48225
48253
  activeListItemNodeViews.delete(this);
@@ -48244,7 +48272,7 @@ init_fn2 = function() {
48244
48272
  }
48245
48273
  }
48246
48274
  const pos = this.getPos();
48247
- const { fontSize: fontSize2, fontFamily: fontFamily2 } = getTextStyleMarksFromLinkedStyles({
48275
+ const { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 } = getTextStyleMarksFromLinkedStyles({
48248
48276
  node: this.node,
48249
48277
  pos,
48250
48278
  editor: this.editor
@@ -48253,6 +48281,7 @@ init_fn2 = function() {
48253
48281
  this.dom.className = "sd-editor-list-item-node-view";
48254
48282
  this.dom.style.fontSize = fontSize2;
48255
48283
  this.dom.style.fontFamily = fontFamily2 ? fontFamily2 : "inherit";
48284
+ this.dom.style.lineHeight = lineHeight2 || "";
48256
48285
  this.dom.setAttribute("data-marker-type", orderMarker);
48257
48286
  this.dom.setAttribute("data-num-id", numId);
48258
48287
  this.dom.setAttribute("data-list-level", JSON.stringify(listLevel));
@@ -48281,8 +48310,10 @@ function refreshAllListItemNodeViews() {
48281
48310
  }
48282
48311
  function getListItemTextStyleMarks(listItem, markType) {
48283
48312
  let textStyleMarks = [];
48313
+ let attrs = {};
48284
48314
  listItem.forEach((childNode) => {
48285
48315
  if (childNode.type.name !== "paragraph") return;
48316
+ attrs.lineHeight = childNode.attrs.lineHeight;
48286
48317
  childNode.forEach((textNode) => {
48287
48318
  let isTextNode = textNode.type.name === "text";
48288
48319
  let hasTextStyleMarks = markType.isInSet(textNode.marks);
@@ -48292,15 +48323,19 @@ function getListItemTextStyleMarks(listItem, markType) {
48292
48323
  }
48293
48324
  });
48294
48325
  });
48295
- return textStyleMarks;
48326
+ return {
48327
+ marks: textStyleMarks,
48328
+ attrs
48329
+ };
48296
48330
  }
48297
48331
  function getTextStyleMarksFromLinkedStyles({ node: node2, pos, editor }) {
48298
48332
  const { font: defaultFont, size: defaultSize } = getStylesFromLinkedStyles({ node: node2, pos, editor });
48299
48333
  const textStyleType = getMarkType("textStyle", editor.schema);
48300
- const allMarks = getListItemTextStyleMarks(node2, textStyleType);
48334
+ const { marks: allMarks, attrs: allAttrs } = getListItemTextStyleMarks(node2, textStyleType);
48301
48335
  const styleMarks = allMarks.filter((m) => m.type === textStyleType);
48302
48336
  const sizeMark = styleMarks.find((m) => m.attrs.fontSize);
48303
48337
  const familyMark = styleMarks.find((m) => m.attrs.fontFamily);
48338
+ const lineHeight2 = allAttrs.lineHeight;
48304
48339
  let fontSize2 = sizeMark ? (() => {
48305
48340
  const [value, unit = "pt"] = parseSizeUnit(sizeMark.attrs.fontSize);
48306
48341
  return Number.isNaN(value) ? defaultSize : `${value}${unit}`;
@@ -48318,13 +48353,25 @@ function getTextStyleMarksFromLinkedStyles({ node: node2, pos, editor }) {
48318
48353
  if (!familyMark && aFontFamily) fontFamily2 = aFontFamily;
48319
48354
  }
48320
48355
  }
48321
- return { fontSize: fontSize2, fontFamily: fontFamily2 };
48356
+ return { fontSize: fontSize2, fontFamily: fontFamily2, lineHeight: lineHeight2 };
48322
48357
  }
48323
48358
  const getStylesFromLinkedStyles = ({ node: node2, pos, editor }) => {
48324
48359
  const { state: state2 } = editor.view;
48325
48360
  const linkedStyles = LinkedStylesPluginKey.getState(state2)?.decorations;
48326
48361
  const decorationsInPlace = linkedStyles?.find(pos, pos + node2.nodeSize);
48327
- const styleDeco = decorationsInPlace?.findLast((dec) => dec.type.attrs?.style);
48362
+ const predicates = [
48363
+ (style22) => style22.includes("font-size") && style22.includes("font-family"),
48364
+ (style22) => style22.includes("font-size"),
48365
+ (style22) => style22.includes("font-family")
48366
+ ];
48367
+ let styleDeco;
48368
+ for (const predicateFn of predicates) {
48369
+ styleDeco = decorationsInPlace?.find((dec) => {
48370
+ const style22 = dec.type.attrs?.style || "";
48371
+ return style22 && predicateFn(style22);
48372
+ });
48373
+ if (styleDeco) break;
48374
+ }
48328
48375
  const style2 = styleDeco?.type.attrs?.style;
48329
48376
  const stylesArray = style2?.split(";") || [];
48330
48377
  const fontSizeFromStyles = stylesArray.find((s) => s.includes("font-size"))?.split(":")[1].trim();
@@ -48340,8 +48387,27 @@ const getVisibleIndent = (stylePpr, numDefPpr, inlineIndent) => {
48340
48387
  const numDefIndentTag = numDefPpr?.elements?.find((el) => el.name === "w:ind") || {};
48341
48388
  const numDefIndent = parseIndentElement(numDefIndentTag);
48342
48389
  const indent = combineIndents(styleIndent, numDefIndent);
48343
- return combineIndents(indent, inlineIndent);
48390
+ const result = combineIndents(indent, inlineIndent);
48391
+ return result;
48344
48392
  };
48393
+ function calculateMarkerWidth(dom, numberingDOM, { withPadding = true } = {}) {
48394
+ const markerText = numberingDOM.textContent || "";
48395
+ const fontSize2 = dom.style.fontSize || "10pt";
48396
+ const fontValue = dom.style.fontFamily;
48397
+ const fontFamily2 = fontValue && fontValue !== "inherit" ? fontValue : "Arial";
48398
+ if (!markerText.trim()) return 0;
48399
+ try {
48400
+ const canvas = document.createElement("canvas");
48401
+ const context = canvas.getContext("2d");
48402
+ const fontSizePx = fontSize2.includes("pt") ? Number.parseFloat(fontSize2) * 1.33 : Number.parseFloat(fontSize2);
48403
+ context.font = `${fontSizePx}px ${fontFamily2}`;
48404
+ const textWidth = context.measureText(markerText).width;
48405
+ const resultWidth = withPadding ? Math.ceil(textWidth + MARKER_PADDING) : Math.ceil(textWidth);
48406
+ return resultWidth;
48407
+ } catch (err) {
48408
+ return 0;
48409
+ }
48410
+ }
48345
48411
  const orderedListSyncPluginKey = new PluginKey("orderedListSync");
48346
48412
  function orderedListSync(editor) {
48347
48413
  let hasInitialized = false;
@@ -72754,7 +72820,7 @@ const _sfc_main$b = {
72754
72820
  class: "remove-btn__icon",
72755
72821
  innerHTML: unref(toolbarIcons).removeLink
72756
72822
  }, null, 8, _hoisted_12),
72757
- _cache[5] || (_cache[5] = createTextVNode(" Remove ", -1))
72823
+ _cache[5] || (_cache[5] = createTextVNode(" Remove "))
72758
72824
  ])) : createCommentVNode("", true),
72759
72825
  createBaseVNode("button", {
72760
72826
  class: normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
@@ -72953,7 +73019,7 @@ const _sfc_main$9 = {
72953
73019
  innerHTML: unref(DropIcon),
72954
73020
  class: "none-icon"
72955
73021
  }, null, 8, _hoisted_2$5),
72956
- _cache[1] || (_cache[1] = createTextVNode(" None ", -1))
73022
+ _cache[1] || (_cache[1] = createTextVNode(" None "))
72957
73023
  ])) : createCommentVNode("", true),
72958
73024
  createBaseVNode("div", _hoisted_3$4, [
72959
73025
  createVNode(IconGridRow, {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-BgN565V6.cjs");
3
- const xmlJs = require("./xml-js-DahUgrqx.cjs");
2
+ const jszip = require("./jszip-DWfnW2xV.cjs");
3
+ const xmlJs = require("./xml-js-B_rfwhrZ.cjs");
4
4
  const __viteBrowserExternal = require("./__vite-browser-external-DWbQq7bv.cjs");
5
5
  var punycode$2 = { exports: {} };
6
6
  /*! https://mths.be/punycode v1.4.1 by @mathias */
@@ -1,5 +1,5 @@
1
- import { c as commonjsGlobal, g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./jszip-eJOLo2UN.es.js";
2
- import { h as requireType, i as requireGetIntrinsic, j as requireCallBound } from "./xml-js-BWZkA4YC.es.js";
1
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./jszip-BwJb6_S5.es.js";
2
+ import { h as requireType, i as requireGetIntrinsic, j as requireCallBound } from "./xml-js-Bn0K9fTK.es.js";
3
3
  import { _ as __viteBrowserExternal } from "./__vite-browser-external-CURh0WXD.es.js";
4
4
  var punycode$2 = { exports: {} };
5
5
  /*! https://mths.be/punycode v1.4.1 by @mathias */