@harbour-enterprises/superdoc 1.0.0-beta.86 → 1.0.0-beta.88

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-CykepcoV.es.js → PdfViewer-2DqlQMKM.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-SI3BgkBA.cjs → PdfViewer-DBW8dNGO.cjs} +1 -1
  3. package/dist/chunks/{index-DeSyD44U-BKmM9Hn7.es.js → index-BLlh97IN-75N3psN2.es.js} +1 -1
  4. package/dist/chunks/{index-DeSyD44U-Dxv0c3H-.cjs → index-BLlh97IN-BF_Nyujm.cjs} +1 -1
  5. package/dist/chunks/{index-xfoqV3U-.cjs → index-i17b8wYa.cjs} +3 -3
  6. package/dist/chunks/{index-BpJVC0Wc.es.js → index-nvs_L5an.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-DLa6Nlsi.cjs → super-editor.es-DB49uQPF.cjs} +244 -36
  8. package/dist/chunks/{super-editor.es-CEmkebDF.es.js → super-editor.es-DpbjE-x_.es.js} +244 -36
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-B25GbVbB.js → converter-CjKHGzQU.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-ROb6hWD8.js → docx-zipper-BDVppBrA.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-C2fZMnwi.js → editor-CgbApADp.js} +240 -32
  13. package/dist/super-editor/chunks/{index-DeSyD44U.js → index-BLlh97IN.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CzcKT6WT.js → toolbar-BEQMP5-e.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +246 -38
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -19632,9 +19632,9 @@
19632
19632
  const { spacing, indent: indent2, borders, justification } = paragraphProperties;
19633
19633
  const nextStyleId = nextParagraphProps?.styleId;
19634
19634
  if (spacing) {
19635
- const getEffectiveBefore = (nextSpacing, isListItem) => {
19635
+ const getEffectiveBefore = (nextSpacing, isListItem2) => {
19636
19636
  if (!nextSpacing) return 0;
19637
- if (nextSpacing.beforeAutospacing && isListItem) {
19637
+ if (nextSpacing.beforeAutospacing && isListItem2) {
19638
19638
  return 0;
19639
19639
  }
19640
19640
  return nextSpacing.before || 0;
@@ -20015,7 +20015,7 @@
20015
20015
  }
20016
20016
  String(value).split(/\s+/).map((entry) => entry.trim()).filter(Boolean).forEach((entry) => targetSet.add(entry));
20017
20017
  }
20018
- const getSpacingStyle = (spacing, isListItem) => {
20018
+ const getSpacingStyle = (spacing, isListItem2) => {
20019
20019
  let { before, after, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
20020
20020
  line = twipsToLines(line);
20021
20021
  if (line != null && line < 1) {
@@ -20026,13 +20026,13 @@
20026
20026
  }
20027
20027
  before = twipsToPixels$2(before);
20028
20028
  if (beforeAutospacing) {
20029
- if (isListItem) {
20029
+ if (isListItem2) {
20030
20030
  before = 0;
20031
20031
  }
20032
20032
  }
20033
20033
  after = twipsToPixels$2(after);
20034
20034
  if (afterAutospacing) {
20035
- if (isListItem) {
20035
+ if (isListItem2) {
20036
20036
  after = 0;
20037
20037
  }
20038
20038
  }
@@ -42398,7 +42398,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42398
42398
  static getStoredSuperdocVersion(docx) {
42399
42399
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42400
42400
  }
42401
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.86") {
42401
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.88") {
42402
42402
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42403
42403
  }
42404
42404
  /**
@@ -64421,6 +64421,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64421
64421
  };
64422
64422
  }
64423
64423
  });
64424
+ const nodeAtEndPosition = doc2.nodeAt(endPos);
64425
+ if (nodeAtEndPosition?.type?.name === "run") {
64426
+ const node2 = nodeAtEndPosition.content?.content?.[0];
64427
+ const isTextNode = node2?.type?.name === "text";
64428
+ if (isTextNode) {
64429
+ const mark2 = node2.marks.find(
64430
+ (mark22) => mark22.type.name === markName && Object.keys(attrs).every((attr) => mark22.attrs[attr] === attrs[attr])
64431
+ );
64432
+ if (mark2 && !markFound) {
64433
+ markFound = {
64434
+ from: endPos,
64435
+ to: endPos + node2.nodeSize,
64436
+ mark: mark2
64437
+ };
64438
+ }
64439
+ }
64440
+ }
64424
64441
  return markFound;
64425
64442
  };
64426
64443
  const markInsertion = ({ tr, from: from2, to, user, date }) => {
@@ -67444,7 +67461,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67444
67461
  const shouldSkipNodeView = (editor) => {
67445
67462
  return isHeadless(editor);
67446
67463
  };
67447
- const summaryVersion = "1.0.0-beta.86";
67464
+ const summaryVersion = "1.0.0-beta.88";
67448
67465
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67449
67466
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67450
67467
  function mapAttributes(attrs) {
@@ -68233,7 +68250,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68233
68250
  { default: remarkStringify2 },
68234
68251
  { default: remarkGfm2 }
68235
68252
  ] = await Promise.all([
68236
- Promise.resolve().then(() => indexDeSyD44U),
68253
+ Promise.resolve().then(() => indexBLlh97IN),
68237
68254
  Promise.resolve().then(() => indexDRCvimau),
68238
68255
  Promise.resolve().then(() => indexC_x_N6Uh),
68239
68256
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68438,7 +68455,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68438
68455
  * Process collaboration migrations
68439
68456
  */
68440
68457
  processCollaborationMigrations() {
68441
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.86");
68458
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.88");
68442
68459
  if (!this.options.ydoc) return;
68443
68460
  const metaMap = this.options.ydoc.getMap("meta");
68444
68461
  let docVersion = metaMap.get("version");
@@ -71514,7 +71531,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71514
71531
  let cellsChanged = false;
71515
71532
  const newCells = row2.cells.map((cell2) => {
71516
71533
  let cellChanged = false;
71517
- const hydratedBlocks = (cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : [])).map((cb) => hydrateBlock(cb));
71534
+ const hydratedBlocks = (cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : [])).map(
71535
+ (cb) => hydrateBlock(cb)
71536
+ );
71518
71537
  if (cell2.blocks && hydratedBlocks !== cell2.blocks) {
71519
71538
  cellChanged = true;
71520
71539
  }
@@ -71549,6 +71568,40 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71549
71568
  }
71550
71569
  return blk;
71551
71570
  }
71571
+ if (blk.kind === "drawing") {
71572
+ const drawingBlock = blk;
71573
+ if (drawingBlock.drawingKind !== "shapeGroup") {
71574
+ return blk;
71575
+ }
71576
+ const shapeGroupBlock = drawingBlock;
71577
+ if (!shapeGroupBlock.shapes || shapeGroupBlock.shapes.length === 0) {
71578
+ return blk;
71579
+ }
71580
+ let shapesChanged = false;
71581
+ const hydratedShapes = shapeGroupBlock.shapes.map((shape) => {
71582
+ if (shape.shapeType !== "image") {
71583
+ return shape;
71584
+ }
71585
+ const imageChild = shape;
71586
+ const src = imageChild.attrs?.src;
71587
+ if (!src || src.startsWith("data:")) {
71588
+ return shape;
71589
+ }
71590
+ const resolvedSrc = resolveImageSrc(src);
71591
+ if (resolvedSrc) {
71592
+ shapesChanged = true;
71593
+ return {
71594
+ ...imageChild,
71595
+ attrs: { ...imageChild.attrs, src: resolvedSrc }
71596
+ };
71597
+ }
71598
+ return shape;
71599
+ });
71600
+ if (shapesChanged) {
71601
+ return { ...shapeGroupBlock, shapes: hydratedShapes };
71602
+ }
71603
+ return blk;
71604
+ }
71552
71605
  return blk;
71553
71606
  };
71554
71607
  return hydrateBlock(block);
@@ -81112,6 +81165,7 @@ ${l}
81112
81165
  cell: cell2,
81113
81166
  borders,
81114
81167
  renderLine,
81168
+ renderDrawingContent,
81115
81169
  context,
81116
81170
  applySdtDataset,
81117
81171
  fromLine,
@@ -81254,6 +81308,11 @@ ${l}
81254
81308
  img2.style.height = "100%";
81255
81309
  img2.style.objectFit = block.objectFit ?? "contain";
81256
81310
  drawingInner.appendChild(img2);
81311
+ } else if (renderDrawingContent) {
81312
+ const drawingContent = renderDrawingContent(block);
81313
+ drawingContent.style.width = "100%";
81314
+ drawingContent.style.height = "100%";
81315
+ drawingInner.appendChild(drawingContent);
81257
81316
  } else {
81258
81317
  const placeholder = doc2.createElement("div");
81259
81318
  placeholder.style.width = "100%";
@@ -81379,6 +81438,7 @@ ${l}
81379
81438
  allRowHeights,
81380
81439
  context,
81381
81440
  renderLine,
81441
+ renderDrawingContent,
81382
81442
  applySdtDataset,
81383
81443
  continuesFromPrev,
81384
81444
  continuesOnNext,
@@ -81475,6 +81535,7 @@ ${l}
81475
81535
  cell: cell2,
81476
81536
  borders: resolvedBorders,
81477
81537
  renderLine,
81538
+ renderDrawingContent,
81478
81539
  context,
81479
81540
  applySdtDataset,
81480
81541
  fromLine,
@@ -81528,7 +81589,17 @@ ${l}
81528
81589
  container.appendChild(labelEl);
81529
81590
  }
81530
81591
  const renderTableFragment = (deps) => {
81531
- const { doc: doc2, fragment, blockLookup, context, renderLine, applyFragmentFrame, applySdtDataset, applyStyles: applyStyles2 } = deps;
81592
+ const {
81593
+ doc: doc2,
81594
+ fragment,
81595
+ blockLookup,
81596
+ context,
81597
+ renderLine,
81598
+ renderDrawingContent,
81599
+ applyFragmentFrame,
81600
+ applySdtDataset,
81601
+ applyStyles: applyStyles2
81602
+ } = deps;
81532
81603
  if (!doc2) {
81533
81604
  console.error("DomPainter: document is not available");
81534
81605
  if (typeof document !== "undefined") {
@@ -81658,6 +81729,7 @@ ${l}
81658
81729
  allRowHeights,
81659
81730
  context,
81660
81731
  renderLine,
81732
+ renderDrawingContent,
81661
81733
  applySdtDataset,
81662
81734
  // Headers are always rendered as-is (no border suppression)
81663
81735
  continuesFromPrev: false,
@@ -81687,6 +81759,7 @@ ${l}
81687
81759
  allRowHeights,
81688
81760
  context,
81689
81761
  renderLine,
81762
+ renderDrawingContent,
81690
81763
  applySdtDataset,
81691
81764
  // Draw top border if table continues from previous fragment (MS Word behavior)
81692
81765
  continuesFromPrev: isFirstRenderedBodyRow && fragment.continuesFromPrev === true,
@@ -83929,12 +84002,25 @@ ${l}
83929
84002
  const renderLineForTableCell = (block, line, ctx2) => {
83930
84003
  return this.renderLine(block, line, ctx2, void 0, void 0, true);
83931
84004
  };
84005
+ const renderDrawingContentForTableCell = (block) => {
84006
+ if (block.drawingKind === "image") {
84007
+ return this.createDrawingImageElement(block);
84008
+ }
84009
+ if (block.drawingKind === "shapeGroup") {
84010
+ return this.createShapeGroupElement(block);
84011
+ }
84012
+ if (block.drawingKind === "vectorShape") {
84013
+ return this.createVectorShapeElement(block, block.geometry, false);
84014
+ }
84015
+ return this.createDrawingPlaceholder();
84016
+ };
83932
84017
  return renderTableFragment({
83933
84018
  doc: this.doc,
83934
84019
  fragment,
83935
84020
  context,
83936
84021
  blockLookup: this.blockLookup,
83937
84022
  renderLine: renderLineForTableCell,
84023
+ renderDrawingContent: renderDrawingContentForTableCell,
83938
84024
  applyFragmentFrame: applyFragmentFrameWithSection,
83939
84025
  applySdtDataset: this.applySdtDataset.bind(this),
83940
84026
  applyStyles: applyStyles$2
@@ -86057,6 +86143,50 @@ ${l}
86057
86143
  }
86058
86144
  return index2;
86059
86145
  }
86146
+ function getWordLayoutConfig(block) {
86147
+ if (!block || block.kind !== "paragraph") {
86148
+ return void 0;
86149
+ }
86150
+ return block.attrs?.wordLayout;
86151
+ }
86152
+ function isListItem(markerWidth, block) {
86153
+ const hasMarkerWidth = markerWidth > 0;
86154
+ if (hasMarkerWidth) {
86155
+ return true;
86156
+ }
86157
+ if (!block || block.kind !== "paragraph") {
86158
+ return false;
86159
+ }
86160
+ const wordLayout = getWordLayoutConfig(block);
86161
+ const hasListAttrs = block.attrs?.listItem != null || wordLayout?.marker != null;
86162
+ if (hasListAttrs) {
86163
+ return true;
86164
+ }
86165
+ const hangingIndent = block.attrs?.indent?.hanging ?? 0;
86166
+ const paraIndentLeft = block.attrs?.indent?.left ?? 0;
86167
+ const hasHangingIndentPattern = hangingIndent > 0 && paraIndentLeft > 0;
86168
+ return hasHangingIndentPattern;
86169
+ }
86170
+ function calculateTextStartIndent(params2) {
86171
+ const { isFirstLine, isListItem: isListItem2, markerWidth, paraIndentLeft, firstLineIndent, hangingIndent, wordLayout } = params2;
86172
+ const firstLineOffset = firstLineIndent - hangingIndent;
86173
+ const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
86174
+ let indentAdjust = paraIndentLeft;
86175
+ if (isListItem2 && isFirstLine && isFirstLineIndentMode) {
86176
+ const textStartFallback = paraIndentLeft + Math.max(firstLineIndent, 0) + markerWidth;
86177
+ indentAdjust = typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : textStartFallback;
86178
+ } else if (isFirstLine && !isListItem2) {
86179
+ indentAdjust += firstLineOffset;
86180
+ }
86181
+ return indentAdjust;
86182
+ }
86183
+ function extractParagraphIndent(indent2) {
86184
+ const left2 = typeof indent2?.left === "number" && Number.isFinite(indent2.left) ? indent2.left : 0;
86185
+ const right2 = typeof indent2?.right === "number" && Number.isFinite(indent2.right) ? indent2.right : 0;
86186
+ const firstLine = typeof indent2?.firstLine === "number" && Number.isFinite(indent2.firstLine) ? indent2.firstLine : 0;
86187
+ const hanging = typeof indent2?.hanging === "number" && Number.isFinite(indent2.hanging) ? indent2.hanging : 0;
86188
+ return { left: left2, right: right2, firstLine, hanging };
86189
+ }
86060
86190
  const defaultHeaderFooterIdentifier = () => ({
86061
86191
  headerIds: { default: null, first: null, even: null, odd: null },
86062
86192
  footerIds: { default: null, first: null, even: null, odd: null },
@@ -91068,8 +91198,8 @@ ${l}
91068
91198
  );
91069
91199
  }
91070
91200
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
91071
- const isListItem = markerWidth > 0;
91072
- const alignmentOverride = isListItem ? "left" : void 0;
91201
+ const isListItem3 = markerWidth > 0;
91202
+ const alignmentOverride = isListItem3 ? "left" : void 0;
91073
91203
  const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
91074
91204
  if (pos == null) {
91075
91205
  logClickStage("warn", "no-position", {
@@ -91113,8 +91243,8 @@ ${l}
91113
91243
  );
91114
91244
  }
91115
91245
  const cellMarkerWidth = cellMeasure.marker?.markerWidth ?? 0;
91116
- const isListItem = cellMarkerWidth > 0;
91117
- const alignmentOverride = isListItem ? "left" : void 0;
91246
+ const isListItem3 = cellMarkerWidth > 0;
91247
+ const alignmentOverride = isListItem3 ? "left" : void 0;
91118
91248
  const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, alignmentOverride);
91119
91249
  if (pos != null) {
91120
91250
  logClickStage("log", "success", {
@@ -91272,17 +91402,22 @@ ${l}
91272
91402
  const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
91273
91403
  const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
91274
91404
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
91275
- const isListItem = markerWidth > 0;
91276
- const alignmentOverride = isListItem ? "left" : void 0;
91405
+ const isListItemFlag = isListItem(markerWidth, block);
91406
+ const alignmentOverride = isListItemFlag ? "left" : void 0;
91277
91407
  const startX = mapPmToX(block, line, charOffsetFrom, fragment.width, alignmentOverride);
91278
91408
  const endX = mapPmToX(block, line, charOffsetTo, fragment.width, alignmentOverride);
91279
- const paraIndentLeft = block.attrs?.indent?.left ?? 0;
91280
- const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
91409
+ const indent2 = extractParagraphIndent(block.attrs?.indent);
91410
+ const wordLayout = getWordLayoutConfig(block);
91281
91411
  const isFirstLine = index2 === fragment.fromLine;
91282
- let indentAdjust = paraIndentLeft;
91283
- if (isFirstLine && !isListItem) {
91284
- indentAdjust += firstLineOffset;
91285
- }
91412
+ const indentAdjust = calculateTextStartIndent({
91413
+ isFirstLine,
91414
+ isListItem: isListItemFlag,
91415
+ markerWidth,
91416
+ paraIndentLeft: indent2.left,
91417
+ firstLineIndent: indent2.firstLine,
91418
+ hangingIndent: indent2.hanging,
91419
+ wordLayout
91420
+ });
91286
91421
  const rectX = fragment.x + indentAdjust + Math.min(startX, endX);
91287
91422
  const rectWidth = Math.max(1, Math.abs(endX - startX));
91288
91423
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
@@ -91385,9 +91520,12 @@ ${l}
91385
91520
  let blockTopCursor = padding.top + verticalOffset;
91386
91521
  renderedBlocks.forEach((info) => {
91387
91522
  const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
91388
- const isListItem = paragraphMarkerWidth > 0;
91389
- const alignmentOverride = isListItem ? "left" : void 0;
91390
- const paraIndentLeft = info.block.kind === "paragraph" ? info.block.attrs?.indent?.left ?? 0 : 0;
91523
+ const cellIsListItem = isListItem(paragraphMarkerWidth, info.block);
91524
+ const alignmentOverride = cellIsListItem ? "left" : void 0;
91525
+ const cellIndent = extractParagraphIndent(
91526
+ info.block.kind === "paragraph" ? info.block.attrs?.indent : void 0
91527
+ );
91528
+ const cellWordLayout = getWordLayoutConfig(info.block);
91391
91529
  const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
91392
91530
  intersectingLines.forEach(({ line, index: index2 }) => {
91393
91531
  if (index2 < info.startLine || index2 >= info.endLine) {
@@ -91403,7 +91541,17 @@ ${l}
91403
91541
  const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
91404
91542
  const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth, alignmentOverride);
91405
91543
  const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth, alignmentOverride);
91406
- const rectX = fragment.x + cellX + padding.left + paraIndentLeft + Math.min(startX, endX);
91544
+ const isFirstLine = index2 === info.startLine;
91545
+ const textIndentAdjust = calculateTextStartIndent({
91546
+ isFirstLine,
91547
+ isListItem: cellIsListItem,
91548
+ markerWidth: paragraphMarkerWidth,
91549
+ paraIndentLeft: cellIndent.left,
91550
+ firstLineIndent: cellIndent.firstLine,
91551
+ hangingIndent: cellIndent.hanging,
91552
+ wordLayout: cellWordLayout
91553
+ });
91554
+ const rectX = fragment.x + cellX + padding.left + textIndentAdjust + Math.min(startX, endX);
91407
91555
  const rectWidth = Math.max(1, Math.abs(endX - startX));
91408
91556
  const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
91409
91557
  const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
@@ -98947,18 +99095,78 @@ ${l}
98947
99095
  if (range2.pmStart == null || range2.pmEnd == null) return null;
98948
99096
  const pmOffset = pmPosToCharOffset(block, line, pos);
98949
99097
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
98950
- const paraIndentLeft = block.attrs?.indent?.left ?? 0;
98951
- const paraIndentRight = block.attrs?.indent?.right ?? 0;
98952
- const availableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
99098
+ const indent2 = extractParagraphIndent(block.attrs?.indent);
99099
+ const availableWidth = Math.max(0, fragment.width - (indent2.left + indent2.right));
98953
99100
  const charX = measureCharacterX(block, line, pmOffset, availableWidth);
98954
- const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
98955
99101
  const isFirstLine = index2 === fragment.fromLine;
98956
- const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
98957
- let indentAdjust = 0;
98958
- if (!isListFirstLine) {
98959
- indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
99102
+ const isListItemFlag = isListItem(markerWidth, block);
99103
+ const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && isListItemFlag;
99104
+ const wordLayout = getWordLayoutConfig(block);
99105
+ const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
99106
+ if (isListFirstLine && isFirstLineIndentMode) {
99107
+ const textStartPx = calculateTextStartIndent({
99108
+ isFirstLine,
99109
+ isListItem: isListItemFlag,
99110
+ markerWidth,
99111
+ paraIndentLeft: indent2.left,
99112
+ firstLineIndent: indent2.firstLine,
99113
+ hangingIndent: indent2.hanging,
99114
+ wordLayout
99115
+ });
99116
+ const localX2 = fragment.x + textStartPx + charX;
99117
+ const lineOffset2 = __privateMethod$1(this, _PresentationEditor_instances, lineHeightBeforeIndex_fn).call(this, measure.lines, fragment.fromLine, index2);
99118
+ const localY2 = fragment.y + lineOffset2;
99119
+ const result2 = {
99120
+ pageIndex: hit.pageIndex,
99121
+ x: localX2,
99122
+ y: localY2,
99123
+ height: line.lineHeight
99124
+ };
99125
+ const pageEl2 = __privateGet$1(this, _painterHost)?.querySelector(
99126
+ `.superdoc-page[data-page-index="${hit.pageIndex}"]`
99127
+ );
99128
+ const pageRect2 = pageEl2?.getBoundingClientRect();
99129
+ const zoom2 = __privateGet$1(this, _layoutOptions).zoom ?? 1;
99130
+ let domCaretX2 = null;
99131
+ let domCaretY2 = null;
99132
+ const spanEls2 = pageEl2?.querySelectorAll("span[data-pm-start][data-pm-end]") ?? [];
99133
+ for (const spanEl of spanEls2) {
99134
+ const pmStart = Number(spanEl.dataset.pmStart);
99135
+ const pmEnd = Number(spanEl.dataset.pmEnd);
99136
+ if (pos >= pmStart && pos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
99137
+ const textNode = spanEl.firstChild;
99138
+ const charIndex = Math.min(pos - pmStart, textNode.length);
99139
+ const rangeObj = document.createRange();
99140
+ rangeObj.setStart(textNode, charIndex);
99141
+ rangeObj.setEnd(textNode, charIndex);
99142
+ const rangeRect = rangeObj.getBoundingClientRect();
99143
+ if (pageRect2) {
99144
+ domCaretX2 = (rangeRect.left - pageRect2.left) / zoom2;
99145
+ domCaretY2 = (rangeRect.top - pageRect2.top) / zoom2;
99146
+ }
99147
+ break;
99148
+ }
99149
+ }
99150
+ if (includeDomFallback && domCaretX2 != null && domCaretY2 != null) {
99151
+ return {
99152
+ pageIndex: hit.pageIndex,
99153
+ x: domCaretX2,
99154
+ y: domCaretY2,
99155
+ height: line.lineHeight
99156
+ };
99157
+ }
99158
+ return result2;
98960
99159
  }
98961
- const localX = fragment.x + markerWidth + indentAdjust + charX;
99160
+ const indentAdjust = calculateTextStartIndent({
99161
+ isFirstLine,
99162
+ isListItem: isListItemFlag,
99163
+ markerWidth,
99164
+ paraIndentLeft: indent2.left,
99165
+ firstLineIndent: indent2.firstLine,
99166
+ hangingIndent: indent2.hanging,
99167
+ wordLayout
99168
+ });
99169
+ const localX = fragment.x + indentAdjust + charX;
98962
99170
  const lineOffset = __privateMethod$1(this, _PresentationEditor_instances, lineHeightBeforeIndex_fn).call(this, measure.lines, fragment.fromLine, index2);
98963
99171
  const localY = fragment.y + lineOffset;
98964
99172
  const result = {
@@ -151307,7 +151515,7 @@ ${style2}
151307
151515
  this.config.colors = shuffleArray(this.config.colors);
151308
151516
  this.userColorMap = /* @__PURE__ */ new Map();
151309
151517
  this.colorIndex = 0;
151310
- this.version = "1.0.0-beta.86";
151518
+ this.version = "1.0.0-beta.88";
151311
151519
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
151312
151520
  this.superdocId = config2.superdocId || v4();
151313
151521
  this.colors = this.config.colors;
@@ -153779,7 +153987,7 @@ ${style2}
153779
153987
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
153780
153988
  );
153781
153989
  }
153782
- const indexDeSyD44U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
153990
+ const indexBLlh97IN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
153783
153991
  __proto__: null,
153784
153992
  unified
153785
153993
  }, Symbol.toStringTag, { value: "Module" }));