@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
@@ -19614,9 +19614,9 @@ function encodeCSSFromPPr(paragraphProperties, hasPreviousParagraph, nextParagra
19614
19614
  const { spacing, indent, borders, justification } = paragraphProperties;
19615
19615
  const nextStyleId = nextParagraphProps?.styleId;
19616
19616
  if (spacing) {
19617
- const getEffectiveBefore = (nextSpacing, isListItem) => {
19617
+ const getEffectiveBefore = (nextSpacing, isListItem2) => {
19618
19618
  if (!nextSpacing) return 0;
19619
- if (nextSpacing.beforeAutospacing && isListItem) {
19619
+ if (nextSpacing.beforeAutospacing && isListItem2) {
19620
19620
  return 0;
19621
19621
  }
19622
19622
  return nextSpacing.before || 0;
@@ -19997,7 +19997,7 @@ function addTextDecorationEntries(targetSet, value) {
19997
19997
  }
19998
19998
  String(value).split(/\s+/).map((entry) => entry.trim()).filter(Boolean).forEach((entry) => targetSet.add(entry));
19999
19999
  }
20000
- const getSpacingStyle = (spacing, isListItem) => {
20000
+ const getSpacingStyle = (spacing, isListItem2) => {
20001
20001
  let { before, after, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
20002
20002
  line = twipsToLines(line);
20003
20003
  if (line != null && line < 1) {
@@ -20008,13 +20008,13 @@ const getSpacingStyle = (spacing, isListItem) => {
20008
20008
  }
20009
20009
  before = twipsToPixels$2(before);
20010
20010
  if (beforeAutospacing) {
20011
- if (isListItem) {
20011
+ if (isListItem2) {
20012
20012
  before = 0;
20013
20013
  }
20014
20014
  }
20015
20015
  after = twipsToPixels$2(after);
20016
20016
  if (afterAutospacing) {
20017
- if (isListItem) {
20017
+ if (isListItem2) {
20018
20018
  after = 0;
20019
20019
  }
20020
20020
  }
@@ -42380,7 +42380,7 @@ const _SuperConverter = class _SuperConverter2 {
42380
42380
  static getStoredSuperdocVersion(docx) {
42381
42381
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42382
42382
  }
42383
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.86") {
42383
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.88") {
42384
42384
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42385
42385
  }
42386
42386
  /**
@@ -56546,6 +56546,23 @@ const findTrackedMarkBetween = ({
56546
56546
  };
56547
56547
  }
56548
56548
  });
56549
+ const nodeAtEndPosition = doc2.nodeAt(endPos);
56550
+ if (nodeAtEndPosition?.type?.name === "run") {
56551
+ const node = nodeAtEndPosition.content?.content?.[0];
56552
+ const isTextNode = node?.type?.name === "text";
56553
+ if (isTextNode) {
56554
+ const mark = node.marks.find(
56555
+ (mark2) => mark2.type.name === markName && Object.keys(attrs).every((attr) => mark2.attrs[attr] === attrs[attr])
56556
+ );
56557
+ if (mark && !markFound) {
56558
+ markFound = {
56559
+ from: endPos,
56560
+ to: endPos + node.nodeSize,
56561
+ mark
56562
+ };
56563
+ }
56564
+ }
56565
+ }
56549
56566
  return markFound;
56550
56567
  };
56551
56568
  const markInsertion = ({ tr, from: from2, to, user, date }) => {
@@ -59569,7 +59586,7 @@ const isHeadless = (editor) => {
59569
59586
  const shouldSkipNodeView = (editor) => {
59570
59587
  return isHeadless(editor);
59571
59588
  };
59572
- const summaryVersion = "1.0.0-beta.86";
59589
+ const summaryVersion = "1.0.0-beta.88";
59573
59590
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59574
59591
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59575
59592
  function mapAttributes(attrs) {
@@ -60358,7 +60375,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60358
60375
  { default: remarkStringify },
60359
60376
  { default: remarkGfm }
60360
60377
  ] = await Promise.all([
60361
- import("./index-DeSyD44U-BKmM9Hn7.es.js"),
60378
+ import("./index-BLlh97IN-75N3psN2.es.js"),
60362
60379
  import("./index-DRCvimau-Cw339678.es.js"),
60363
60380
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60364
60381
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60563,7 +60580,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60563
60580
  * Process collaboration migrations
60564
60581
  */
60565
60582
  processCollaborationMigrations() {
60566
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.86");
60583
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.88");
60567
60584
  if (!this.options.ydoc) return;
60568
60585
  const metaMap = this.options.ydoc.getMap("meta");
60569
60586
  let docVersion = metaMap.get("version");
@@ -63639,7 +63656,9 @@ function hydrateImageBlocks(blocks, mediaFiles) {
63639
63656
  let cellsChanged = false;
63640
63657
  const newCells = row.cells.map((cell) => {
63641
63658
  let cellChanged = false;
63642
- const hydratedBlocks = (cell.blocks ?? (cell.paragraph ? [cell.paragraph] : [])).map((cb) => hydrateBlock(cb));
63659
+ const hydratedBlocks = (cell.blocks ?? (cell.paragraph ? [cell.paragraph] : [])).map(
63660
+ (cb) => hydrateBlock(cb)
63661
+ );
63643
63662
  if (cell.blocks && hydratedBlocks !== cell.blocks) {
63644
63663
  cellChanged = true;
63645
63664
  }
@@ -63674,6 +63693,40 @@ function hydrateImageBlocks(blocks, mediaFiles) {
63674
63693
  }
63675
63694
  return blk;
63676
63695
  }
63696
+ if (blk.kind === "drawing") {
63697
+ const drawingBlock = blk;
63698
+ if (drawingBlock.drawingKind !== "shapeGroup") {
63699
+ return blk;
63700
+ }
63701
+ const shapeGroupBlock = drawingBlock;
63702
+ if (!shapeGroupBlock.shapes || shapeGroupBlock.shapes.length === 0) {
63703
+ return blk;
63704
+ }
63705
+ let shapesChanged = false;
63706
+ const hydratedShapes = shapeGroupBlock.shapes.map((shape) => {
63707
+ if (shape.shapeType !== "image") {
63708
+ return shape;
63709
+ }
63710
+ const imageChild = shape;
63711
+ const src = imageChild.attrs?.src;
63712
+ if (!src || src.startsWith("data:")) {
63713
+ return shape;
63714
+ }
63715
+ const resolvedSrc = resolveImageSrc(src);
63716
+ if (resolvedSrc) {
63717
+ shapesChanged = true;
63718
+ return {
63719
+ ...imageChild,
63720
+ attrs: { ...imageChild.attrs, src: resolvedSrc }
63721
+ };
63722
+ }
63723
+ return shape;
63724
+ });
63725
+ if (shapesChanged) {
63726
+ return { ...shapeGroupBlock, shapes: hydratedShapes };
63727
+ }
63728
+ return blk;
63729
+ }
63677
63730
  return blk;
63678
63731
  };
63679
63732
  return hydrateBlock(block);
@@ -73237,6 +73290,7 @@ const renderTableCell = (deps) => {
73237
73290
  cell,
73238
73291
  borders,
73239
73292
  renderLine,
73293
+ renderDrawingContent,
73240
73294
  context,
73241
73295
  applySdtDataset,
73242
73296
  fromLine,
@@ -73379,6 +73433,11 @@ const renderTableCell = (deps) => {
73379
73433
  img.style.height = "100%";
73380
73434
  img.style.objectFit = block.objectFit ?? "contain";
73381
73435
  drawingInner.appendChild(img);
73436
+ } else if (renderDrawingContent) {
73437
+ const drawingContent = renderDrawingContent(block);
73438
+ drawingContent.style.width = "100%";
73439
+ drawingContent.style.height = "100%";
73440
+ drawingInner.appendChild(drawingContent);
73382
73441
  } else {
73383
73442
  const placeholder = doc2.createElement("div");
73384
73443
  placeholder.style.width = "100%";
@@ -73504,6 +73563,7 @@ const renderTableRow = (deps) => {
73504
73563
  allRowHeights,
73505
73564
  context,
73506
73565
  renderLine,
73566
+ renderDrawingContent,
73507
73567
  applySdtDataset,
73508
73568
  continuesFromPrev,
73509
73569
  continuesOnNext,
@@ -73600,6 +73660,7 @@ const renderTableRow = (deps) => {
73600
73660
  cell,
73601
73661
  borders: resolvedBorders,
73602
73662
  renderLine,
73663
+ renderDrawingContent,
73603
73664
  context,
73604
73665
  applySdtDataset,
73605
73666
  fromLine,
@@ -73653,7 +73714,17 @@ function applySdtContainerStyling(doc2, container, sdt, containerSdt) {
73653
73714
  container.appendChild(labelEl);
73654
73715
  }
73655
73716
  const renderTableFragment = (deps) => {
73656
- const { doc: doc2, fragment, blockLookup, context, renderLine, applyFragmentFrame, applySdtDataset, applyStyles: applyStyles2 } = deps;
73717
+ const {
73718
+ doc: doc2,
73719
+ fragment,
73720
+ blockLookup,
73721
+ context,
73722
+ renderLine,
73723
+ renderDrawingContent,
73724
+ applyFragmentFrame,
73725
+ applySdtDataset,
73726
+ applyStyles: applyStyles2
73727
+ } = deps;
73657
73728
  if (!doc2) {
73658
73729
  console.error("DomPainter: document is not available");
73659
73730
  if (typeof document !== "undefined") {
@@ -73783,6 +73854,7 @@ const renderTableFragment = (deps) => {
73783
73854
  allRowHeights,
73784
73855
  context,
73785
73856
  renderLine,
73857
+ renderDrawingContent,
73786
73858
  applySdtDataset,
73787
73859
  // Headers are always rendered as-is (no border suppression)
73788
73860
  continuesFromPrev: false,
@@ -73812,6 +73884,7 @@ const renderTableFragment = (deps) => {
73812
73884
  allRowHeights,
73813
73885
  context,
73814
73886
  renderLine,
73887
+ renderDrawingContent,
73815
73888
  applySdtDataset,
73816
73889
  // Draw top border if table continues from previous fragment (MS Word behavior)
73817
73890
  continuesFromPrev: isFirstRenderedBodyRow && fragment.continuesFromPrev === true,
@@ -76054,12 +76127,25 @@ const _DomPainter = class _DomPainter2 {
76054
76127
  const renderLineForTableCell = (block, line, ctx2) => {
76055
76128
  return this.renderLine(block, line, ctx2, void 0, void 0, true);
76056
76129
  };
76130
+ const renderDrawingContentForTableCell = (block) => {
76131
+ if (block.drawingKind === "image") {
76132
+ return this.createDrawingImageElement(block);
76133
+ }
76134
+ if (block.drawingKind === "shapeGroup") {
76135
+ return this.createShapeGroupElement(block);
76136
+ }
76137
+ if (block.drawingKind === "vectorShape") {
76138
+ return this.createVectorShapeElement(block, block.geometry, false);
76139
+ }
76140
+ return this.createDrawingPlaceholder();
76141
+ };
76057
76142
  return renderTableFragment({
76058
76143
  doc: this.doc,
76059
76144
  fragment,
76060
76145
  context,
76061
76146
  blockLookup: this.blockLookup,
76062
76147
  renderLine: renderLineForTableCell,
76148
+ renderDrawingContent: renderDrawingContentForTableCell,
76063
76149
  applyFragmentFrame: applyFragmentFrameWithSection,
76064
76150
  applySdtDataset: this.applySdtDataset.bind(this),
76065
76151
  applyStyles: applyStyles$2
@@ -78182,6 +78268,50 @@ function findCharIndexAtX(textNode, container, targetX) {
78182
78268
  }
78183
78269
  return index2;
78184
78270
  }
78271
+ function getWordLayoutConfig(block) {
78272
+ if (!block || block.kind !== "paragraph") {
78273
+ return void 0;
78274
+ }
78275
+ return block.attrs?.wordLayout;
78276
+ }
78277
+ function isListItem(markerWidth, block) {
78278
+ const hasMarkerWidth = markerWidth > 0;
78279
+ if (hasMarkerWidth) {
78280
+ return true;
78281
+ }
78282
+ if (!block || block.kind !== "paragraph") {
78283
+ return false;
78284
+ }
78285
+ const wordLayout = getWordLayoutConfig(block);
78286
+ const hasListAttrs = block.attrs?.listItem != null || wordLayout?.marker != null;
78287
+ if (hasListAttrs) {
78288
+ return true;
78289
+ }
78290
+ const hangingIndent = block.attrs?.indent?.hanging ?? 0;
78291
+ const paraIndentLeft = block.attrs?.indent?.left ?? 0;
78292
+ const hasHangingIndentPattern = hangingIndent > 0 && paraIndentLeft > 0;
78293
+ return hasHangingIndentPattern;
78294
+ }
78295
+ function calculateTextStartIndent(params2) {
78296
+ const { isFirstLine, isListItem: isListItem2, markerWidth, paraIndentLeft, firstLineIndent, hangingIndent, wordLayout } = params2;
78297
+ const firstLineOffset = firstLineIndent - hangingIndent;
78298
+ const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
78299
+ let indentAdjust = paraIndentLeft;
78300
+ if (isListItem2 && isFirstLine && isFirstLineIndentMode) {
78301
+ const textStartFallback = paraIndentLeft + Math.max(firstLineIndent, 0) + markerWidth;
78302
+ indentAdjust = typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : textStartFallback;
78303
+ } else if (isFirstLine && !isListItem2) {
78304
+ indentAdjust += firstLineOffset;
78305
+ }
78306
+ return indentAdjust;
78307
+ }
78308
+ function extractParagraphIndent(indent) {
78309
+ const left2 = typeof indent?.left === "number" && Number.isFinite(indent.left) ? indent.left : 0;
78310
+ const right2 = typeof indent?.right === "number" && Number.isFinite(indent.right) ? indent.right : 0;
78311
+ const firstLine = typeof indent?.firstLine === "number" && Number.isFinite(indent.firstLine) ? indent.firstLine : 0;
78312
+ const hanging = typeof indent?.hanging === "number" && Number.isFinite(indent.hanging) ? indent.hanging : 0;
78313
+ return { left: left2, right: right2, firstLine, hanging };
78314
+ }
78185
78315
  const defaultHeaderFooterIdentifier = () => ({
78186
78316
  headerIds: { default: null, first: null, even: null, odd: null },
78187
78317
  footerIds: { default: null, first: null, even: null, odd: null },
@@ -83193,8 +83323,8 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
83193
83323
  );
83194
83324
  }
83195
83325
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
83196
- const isListItem = markerWidth > 0;
83197
- const alignmentOverride = isListItem ? "left" : void 0;
83326
+ const isListItem3 = markerWidth > 0;
83327
+ const alignmentOverride = isListItem3 ? "left" : void 0;
83198
83328
  const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
83199
83329
  if (pos == null) {
83200
83330
  logClickStage("warn", "no-position", {
@@ -83238,8 +83368,8 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
83238
83368
  );
83239
83369
  }
83240
83370
  const cellMarkerWidth = cellMeasure.marker?.markerWidth ?? 0;
83241
- const isListItem = cellMarkerWidth > 0;
83242
- const alignmentOverride = isListItem ? "left" : void 0;
83371
+ const isListItem3 = cellMarkerWidth > 0;
83372
+ const alignmentOverride = isListItem3 ? "left" : void 0;
83243
83373
  const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, alignmentOverride);
83244
83374
  if (pos != null) {
83245
83375
  logClickStage("log", "success", {
@@ -83397,17 +83527,22 @@ function selectionToRects(layout, blocks, measures, from2, to) {
83397
83527
  const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
83398
83528
  const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
83399
83529
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
83400
- const isListItem = markerWidth > 0;
83401
- const alignmentOverride = isListItem ? "left" : void 0;
83530
+ const isListItemFlag = isListItem(markerWidth, block);
83531
+ const alignmentOverride = isListItemFlag ? "left" : void 0;
83402
83532
  const startX = mapPmToX(block, line, charOffsetFrom, fragment.width, alignmentOverride);
83403
83533
  const endX = mapPmToX(block, line, charOffsetTo, fragment.width, alignmentOverride);
83404
- const paraIndentLeft = block.attrs?.indent?.left ?? 0;
83405
- const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
83534
+ const indent = extractParagraphIndent(block.attrs?.indent);
83535
+ const wordLayout = getWordLayoutConfig(block);
83406
83536
  const isFirstLine = index2 === fragment.fromLine;
83407
- let indentAdjust = paraIndentLeft;
83408
- if (isFirstLine && !isListItem) {
83409
- indentAdjust += firstLineOffset;
83410
- }
83537
+ const indentAdjust = calculateTextStartIndent({
83538
+ isFirstLine,
83539
+ isListItem: isListItemFlag,
83540
+ markerWidth,
83541
+ paraIndentLeft: indent.left,
83542
+ firstLineIndent: indent.firstLine,
83543
+ hangingIndent: indent.hanging,
83544
+ wordLayout
83545
+ });
83411
83546
  const rectX = fragment.x + indentAdjust + Math.min(startX, endX);
83412
83547
  const rectWidth = Math.max(1, Math.abs(endX - startX));
83413
83548
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
@@ -83510,9 +83645,12 @@ function selectionToRects(layout, blocks, measures, from2, to) {
83510
83645
  let blockTopCursor = padding.top + verticalOffset;
83511
83646
  renderedBlocks.forEach((info) => {
83512
83647
  const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
83513
- const isListItem = paragraphMarkerWidth > 0;
83514
- const alignmentOverride = isListItem ? "left" : void 0;
83515
- const paraIndentLeft = info.block.kind === "paragraph" ? info.block.attrs?.indent?.left ?? 0 : 0;
83648
+ const cellIsListItem = isListItem(paragraphMarkerWidth, info.block);
83649
+ const alignmentOverride = cellIsListItem ? "left" : void 0;
83650
+ const cellIndent = extractParagraphIndent(
83651
+ info.block.kind === "paragraph" ? info.block.attrs?.indent : void 0
83652
+ );
83653
+ const cellWordLayout = getWordLayoutConfig(info.block);
83516
83654
  const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
83517
83655
  intersectingLines.forEach(({ line, index: index2 }) => {
83518
83656
  if (index2 < info.startLine || index2 >= info.endLine) {
@@ -83528,7 +83666,17 @@ function selectionToRects(layout, blocks, measures, from2, to) {
83528
83666
  const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
83529
83667
  const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth, alignmentOverride);
83530
83668
  const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth, alignmentOverride);
83531
- const rectX = fragment.x + cellX + padding.left + paraIndentLeft + Math.min(startX, endX);
83669
+ const isFirstLine = index2 === info.startLine;
83670
+ const textIndentAdjust = calculateTextStartIndent({
83671
+ isFirstLine,
83672
+ isListItem: cellIsListItem,
83673
+ markerWidth: paragraphMarkerWidth,
83674
+ paraIndentLeft: cellIndent.left,
83675
+ firstLineIndent: cellIndent.firstLine,
83676
+ hangingIndent: cellIndent.hanging,
83677
+ wordLayout: cellWordLayout
83678
+ });
83679
+ const rectX = fragment.x + cellX + padding.left + textIndentAdjust + Math.min(startX, endX);
83532
83680
  const rectWidth = Math.max(1, Math.abs(endX - startX));
83533
83681
  const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
83534
83682
  const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
@@ -91072,18 +91220,78 @@ computeCaretLayoutRectGeometry_fn = function(pos, includeDomFallback = true) {
91072
91220
  if (range2.pmStart == null || range2.pmEnd == null) return null;
91073
91221
  const pmOffset = pmPosToCharOffset(block, line, pos);
91074
91222
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
91075
- const paraIndentLeft = block.attrs?.indent?.left ?? 0;
91076
- const paraIndentRight = block.attrs?.indent?.right ?? 0;
91077
- const availableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
91223
+ const indent = extractParagraphIndent(block.attrs?.indent);
91224
+ const availableWidth = Math.max(0, fragment.width - (indent.left + indent.right));
91078
91225
  const charX = measureCharacterX(block, line, pmOffset, availableWidth);
91079
- const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
91080
91226
  const isFirstLine = index2 === fragment.fromLine;
91081
- const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
91082
- let indentAdjust = 0;
91083
- if (!isListFirstLine) {
91084
- indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
91227
+ const isListItemFlag = isListItem(markerWidth, block);
91228
+ const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && isListItemFlag;
91229
+ const wordLayout = getWordLayoutConfig(block);
91230
+ const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
91231
+ if (isListFirstLine && isFirstLineIndentMode) {
91232
+ const textStartPx = calculateTextStartIndent({
91233
+ isFirstLine,
91234
+ isListItem: isListItemFlag,
91235
+ markerWidth,
91236
+ paraIndentLeft: indent.left,
91237
+ firstLineIndent: indent.firstLine,
91238
+ hangingIndent: indent.hanging,
91239
+ wordLayout
91240
+ });
91241
+ const localX2 = fragment.x + textStartPx + charX;
91242
+ const lineOffset2 = __privateMethod$1(this, _PresentationEditor_instances, lineHeightBeforeIndex_fn).call(this, measure.lines, fragment.fromLine, index2);
91243
+ const localY2 = fragment.y + lineOffset2;
91244
+ const result2 = {
91245
+ pageIndex: hit.pageIndex,
91246
+ x: localX2,
91247
+ y: localY2,
91248
+ height: line.lineHeight
91249
+ };
91250
+ const pageEl2 = __privateGet$1(this, _painterHost)?.querySelector(
91251
+ `.superdoc-page[data-page-index="${hit.pageIndex}"]`
91252
+ );
91253
+ const pageRect2 = pageEl2?.getBoundingClientRect();
91254
+ const zoom2 = __privateGet$1(this, _layoutOptions).zoom ?? 1;
91255
+ let domCaretX2 = null;
91256
+ let domCaretY2 = null;
91257
+ const spanEls2 = pageEl2?.querySelectorAll("span[data-pm-start][data-pm-end]") ?? [];
91258
+ for (const spanEl of spanEls2) {
91259
+ const pmStart = Number(spanEl.dataset.pmStart);
91260
+ const pmEnd = Number(spanEl.dataset.pmEnd);
91261
+ if (pos >= pmStart && pos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
91262
+ const textNode = spanEl.firstChild;
91263
+ const charIndex = Math.min(pos - pmStart, textNode.length);
91264
+ const rangeObj = document.createRange();
91265
+ rangeObj.setStart(textNode, charIndex);
91266
+ rangeObj.setEnd(textNode, charIndex);
91267
+ const rangeRect = rangeObj.getBoundingClientRect();
91268
+ if (pageRect2) {
91269
+ domCaretX2 = (rangeRect.left - pageRect2.left) / zoom2;
91270
+ domCaretY2 = (rangeRect.top - pageRect2.top) / zoom2;
91271
+ }
91272
+ break;
91273
+ }
91274
+ }
91275
+ if (includeDomFallback && domCaretX2 != null && domCaretY2 != null) {
91276
+ return {
91277
+ pageIndex: hit.pageIndex,
91278
+ x: domCaretX2,
91279
+ y: domCaretY2,
91280
+ height: line.lineHeight
91281
+ };
91282
+ }
91283
+ return result2;
91085
91284
  }
91086
- const localX = fragment.x + markerWidth + indentAdjust + charX;
91285
+ const indentAdjust = calculateTextStartIndent({
91286
+ isFirstLine,
91287
+ isListItem: isListItemFlag,
91288
+ markerWidth,
91289
+ paraIndentLeft: indent.left,
91290
+ firstLineIndent: indent.firstLine,
91291
+ hangingIndent: indent.hanging,
91292
+ wordLayout
91293
+ });
91294
+ const localX = fragment.x + indentAdjust + charX;
91087
91295
  const lineOffset = __privateMethod$1(this, _PresentationEditor_instances, lineHeightBeforeIndex_fn).call(this, measure.lines, fragment.fromLine, index2);
91088
91296
  const localY = fragment.y + lineOffset;
91089
91297
  const result = {
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-B25GbVbB.js";
3
- import { _ as _export_sfc } from "./chunks/editor-C2fZMnwi.js";
2
+ import { T as TextSelection } from "./chunks/converter-CjKHGzQU.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-CgbApADp.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -42697,7 +42697,7 @@ const _SuperConverter = class _SuperConverter {
42697
42697
  static getStoredSuperdocVersion(docx) {
42698
42698
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42699
42699
  }
42700
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.86") {
42700
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.88") {
42701
42701
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42702
42702
  }
42703
42703
  /**
@@ -1,4 +1,4 @@
1
- import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-B25GbVbB.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-CjKHGzQU.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }