superdoc 1.0.0-beta.97 → 1.0.0-beta.98

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-BHcBfUWj.es.js → PdfViewer-1_KffD-j.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-YvkZg201.cjs → PdfViewer-D1Ot32kX.cjs} +1 -1
  3. package/dist/chunks/{index-DeQfFbTb.es.js → index-CP2_WwLA.es.js} +3 -3
  4. package/dist/chunks/{index-DZ_AI-HW.cjs → index-CUO7gEi8.cjs} +3 -3
  5. package/dist/chunks/{index-Pvlqsxge-vW641SZt.es.js → index-Dg_sTYZK-D20z8mus.es.js} +1 -1
  6. package/dist/chunks/{index-Pvlqsxge-IH3eauKE.cjs → index-Dg_sTYZK-DYDzxoXL.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-BinyZw4F.es.js → super-editor.es-3dJOUw65.es.js} +113 -151
  8. package/dist/chunks/{super-editor.es-BP3PKkwh.cjs → super-editor.es-DN_dgBH0.cjs} +113 -151
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-BEVM5t3i.js → converter-Oj-eTB79.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-vETk3IMG.js → docx-zipper-Dl188zQ3.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-B8k1bwD_.js → editor-DBXoaaWP.js} +114 -152
  13. package/dist/super-editor/chunks/{index-Pvlqsxge.js → index-Dg_sTYZK.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-j1GSUGWU.js → toolbar-PlGGj0Ew.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 +115 -153
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -42421,7 +42421,7 @@ const _SuperConverter = class _SuperConverter2 {
42421
42421
  static getStoredSuperdocVersion(docx) {
42422
42422
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42423
42423
  }
42424
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.97") {
42424
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.98") {
42425
42425
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42426
42426
  }
42427
42427
  /**
@@ -59639,7 +59639,7 @@ const isHeadless = (editor) => {
59639
59639
  const shouldSkipNodeView = (editor) => {
59640
59640
  return isHeadless(editor);
59641
59641
  };
59642
- const summaryVersion = "1.0.0-beta.97";
59642
+ const summaryVersion = "1.0.0-beta.98";
59643
59643
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59644
59644
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59645
59645
  function mapAttributes(attrs) {
@@ -60428,7 +60428,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60428
60428
  { default: remarkStringify },
60429
60429
  { default: remarkGfm }
60430
60430
  ] = await Promise.all([
60431
- Promise.resolve().then(() => require("./index-Pvlqsxge-IH3eauKE.cjs")),
60431
+ Promise.resolve().then(() => require("./index-Dg_sTYZK-DYDzxoXL.cjs")),
60432
60432
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60433
60433
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60434
60434
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60633,7 +60633,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60633
60633
  * Process collaboration migrations
60634
60634
  */
60635
60635
  processCollaborationMigrations() {
60636
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.97");
60636
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.98");
60637
60637
  if (!this.options.ydoc) return;
60638
60638
  const metaMap = this.options.ydoc.getMap("meta");
60639
60639
  let docVersion = metaMap.get("version");
@@ -63011,14 +63011,15 @@ function extractPageSizeAndOrientation(elements) {
63011
63011
  return { pageSizePx, orientation };
63012
63012
  }
63013
63013
  function extractFallbackMargins(elements, currentHeader, currentFooter) {
63014
- if (currentHeader !== void 0 && currentFooter !== void 0) {
63015
- return { headerPx: currentHeader, footerPx: currentFooter };
63016
- }
63017
63014
  const pgMar = elements.find((el) => el?.name === "w:pgMar");
63018
63015
  const a = pgMar?.attributes || {};
63019
63016
  return {
63020
63017
  headerPx: currentHeader ?? (a["w:header"] != null ? twipsToPixels$1(a["w:header"]) : void 0),
63021
- footerPx: currentFooter ?? (a["w:footer"] != null ? twipsToPixels$1(a["w:footer"]) : void 0)
63018
+ footerPx: currentFooter ?? (a["w:footer"] != null ? twipsToPixels$1(a["w:footer"]) : void 0),
63019
+ topPx: a["w:top"] != null ? twipsToPixels$1(a["w:top"]) : void 0,
63020
+ rightPx: a["w:right"] != null ? twipsToPixels$1(a["w:right"]) : void 0,
63021
+ bottomPx: a["w:bottom"] != null ? twipsToPixels$1(a["w:bottom"]) : void 0,
63022
+ leftPx: a["w:left"] != null ? twipsToPixels$1(a["w:left"]) : void 0
63022
63023
  };
63023
63024
  }
63024
63025
  function extractHeaderFooterRefs(elements, refName) {
@@ -63079,7 +63080,10 @@ function extractSectionData(para) {
63079
63080
  const type2 = extractSectionType(sectPrElements);
63080
63081
  const { pageSizePx, orientation } = extractPageSizeAndOrientation(sectPrElements);
63081
63082
  const titlePg = sectPrElements.some((el) => el?.name === "w:titlePg");
63082
- ({ headerPx, footerPx } = extractFallbackMargins(sectPrElements, headerPx, footerPx));
63083
+ const fallbackMargins = extractFallbackMargins(sectPrElements, headerPx, footerPx);
63084
+ headerPx = fallbackMargins.headerPx;
63085
+ footerPx = fallbackMargins.footerPx;
63086
+ const { topPx, rightPx, bottomPx, leftPx } = fallbackMargins;
63083
63087
  const headerRefs = extractHeaderFooterRefs(sectPrElements, "w:headerReference");
63084
63088
  const footerRefs = extractHeaderFooterRefs(sectPrElements, "w:footerReference");
63085
63089
  const numbering = extractPageNumbering(sectPrElements);
@@ -63088,6 +63092,10 @@ function extractSectionData(para) {
63088
63092
  return {
63089
63093
  headerPx,
63090
63094
  footerPx,
63095
+ topPx,
63096
+ rightPx,
63097
+ bottomPx,
63098
+ leftPx,
63091
63099
  type: type2,
63092
63100
  pageSizePx,
63093
63101
  orientation,
@@ -63199,7 +63207,14 @@ function buildSectionRangesFromParagraphs(paragraphs, hasBodySectPr) {
63199
63207
  startParagraphIndex: currentStart,
63200
63208
  endParagraphIndex: item.index,
63201
63209
  sectPr,
63202
- margins: sectionData.headerPx != null || sectionData.footerPx != null ? { header: sectionData.headerPx ?? 0, footer: sectionData.footerPx ?? 0 } : null,
63210
+ margins: sectionData.headerPx != null || sectionData.footerPx != null ? {
63211
+ header: sectionData.headerPx ?? 0,
63212
+ footer: sectionData.footerPx ?? 0,
63213
+ top: sectionData.topPx,
63214
+ right: sectionData.rightPx,
63215
+ bottom: sectionData.bottomPx,
63216
+ left: sectionData.leftPx
63217
+ } : null,
63203
63218
  pageSize: sectionData.pageSizePx ?? null,
63204
63219
  orientation: sectionData.orientation ?? null,
63205
63220
  columns: sectionData.columnsPx ?? null,
@@ -63241,7 +63256,14 @@ function createFinalSectionFromBodySectPr(bodySectPr, currentStart, totalParagra
63241
63256
  startParagraphIndex: currentStart,
63242
63257
  endParagraphIndex: totalParagraphs - 1,
63243
63258
  sectPr: bodySectPr,
63244
- margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? { header: bodySectionData.headerPx ?? 0, footer: bodySectionData.footerPx ?? 0 } : null,
63259
+ margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? {
63260
+ header: bodySectionData.headerPx ?? 0,
63261
+ footer: bodySectionData.footerPx ?? 0,
63262
+ top: bodySectionData.topPx,
63263
+ right: bodySectionData.rightPx,
63264
+ bottom: bodySectionData.bottomPx,
63265
+ left: bodySectionData.leftPx
63266
+ } : null,
63245
63267
  pageSize: bodySectionData.pageSizePx ?? null,
63246
63268
  orientation: bodySectionData.orientation ?? null,
63247
63269
  columns: bodySectionData.columnsPx ?? null,
@@ -69520,41 +69542,6 @@ const parseTableCell = (args) => {
69520
69542
  }
69521
69543
  }
69522
69544
  }
69523
- try {
69524
- const blockSummaries = blocks.map((b2) => {
69525
- if (b2.kind === "paragraph") {
69526
- const runs = b2.runs ?? [];
69527
- const attrs = b2.attrs ?? {};
69528
- return {
69529
- kind: "paragraph",
69530
- runKinds: runs.map((r2) => r2.kind ?? "text"),
69531
- runCount: runs.length,
69532
- runPreview: runs.map((r2) => {
69533
- const kind = r2.kind ?? "text";
69534
- if (kind === "image") {
69535
- const img = r2;
69536
- return { kind, src: img.src, width: img.width, height: img.height };
69537
- }
69538
- return { kind };
69539
- }),
69540
- hasNumbering: Boolean(attrs.numberingProperties),
69541
- markerText: attrs.wordLayout?.marker?.markerText
69542
- };
69543
- }
69544
- return { kind: b2.kind };
69545
- });
69546
- console.log(
69547
- "[tableNodeToBlock.parseTableCell] cell contents",
69548
- JSON.stringify({
69549
- cellIndex,
69550
- rowIndex,
69551
- cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
69552
- childTypes: cellNode.content.map((c2) => c2?.type),
69553
- blocks: blockSummaries
69554
- })
69555
- );
69556
- } catch {
69557
- }
69558
69545
  if (blocks.length === 0) {
69559
69546
  return null;
69560
69547
  }
@@ -73419,20 +73406,6 @@ const renderTableCell = (deps) => {
73419
73406
  }
73420
73407
  const cellBlocks = cell?.blocks ?? (cell?.paragraph ? [cell.paragraph] : []);
73421
73408
  const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
73422
- try {
73423
- console.log(
73424
- "[DomPainter.renderTableCell] cell render input",
73425
- JSON.stringify({
73426
- cellId: cell?.id,
73427
- blockKinds: cellBlocks.map((b2) => b2.kind),
73428
- measureKinds: blockMeasures.map((m2) => m2.kind),
73429
- width: cellMeasure?.width,
73430
- height: cellMeasure?.height,
73431
- rowHeight
73432
- })
73433
- );
73434
- } catch {
73435
- }
73436
73409
  if (cellBlocks.length > 0 && blockMeasures.length > 0) {
73437
73410
  const content = doc2.createElement("div");
73438
73411
  content.style.position = "relative";
@@ -73465,15 +73438,6 @@ const renderTableCell = (deps) => {
73465
73438
  const blockMeasure = blockMeasures[i];
73466
73439
  const block = cellBlocks[i];
73467
73440
  if (blockMeasure.kind === "image" && block?.kind === "image") {
73468
- console.log(
73469
- "[DomPainter.renderTableCell] rendering image block in cell",
73470
- JSON.stringify({
73471
- cellId: cell?.id,
73472
- blockId: block.id,
73473
- width: blockMeasure.width,
73474
- height: blockMeasure.height
73475
- })
73476
- );
73477
73441
  const imageWrapper = doc2.createElement("div");
73478
73442
  imageWrapper.style.position = "relative";
73479
73443
  imageWrapper.style.width = `${blockMeasure.width}px`;
@@ -73496,16 +73460,6 @@ const renderTableCell = (deps) => {
73496
73460
  continue;
73497
73461
  }
73498
73462
  if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
73499
- console.log(
73500
- "[DomPainter.renderTableCell] rendering drawing block in cell",
73501
- JSON.stringify({
73502
- cellId: cell?.id,
73503
- blockId: block.id,
73504
- drawingKind: block.drawingKind,
73505
- width: blockMeasure.width,
73506
- height: blockMeasure.height
73507
- })
73508
- );
73509
73463
  const drawingWrapper = doc2.createElement("div");
73510
73464
  drawingWrapper.style.position = "relative";
73511
73465
  drawingWrapper.style.width = `${blockMeasure.width}px`;
@@ -73548,20 +73502,6 @@ const renderTableCell = (deps) => {
73548
73502
  continue;
73549
73503
  }
73550
73504
  if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
73551
- try {
73552
- const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
73553
- const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
73554
- console.log(
73555
- "[DomPainter.renderTableCell] rendering paragraph block in cell",
73556
- JSON.stringify({
73557
- cellId: cell?.id,
73558
- blockId: block.id,
73559
- runKinds,
73560
- imageRuns
73561
- })
73562
- );
73563
- } catch {
73564
- }
73565
73505
  const paragraphMeasure = blockMeasure;
73566
73506
  const lines = paragraphMeasure.lines;
73567
73507
  const blockLineCount = lines?.length || 0;
@@ -75376,7 +75316,9 @@ const _DomPainter = class _DomPainter2 {
75376
75316
  const isTocEntry = block.attrs?.isTocEntry;
75377
75317
  const hasMarker = !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
75378
75318
  const hasSdtContainer = block.attrs?.sdt?.type === "documentSection" || block.attrs?.sdt?.type === "structuredContent" || block.attrs?.containerSdt?.type === "documentSection" || block.attrs?.containerSdt?.type === "structuredContent";
75379
- const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
75319
+ const paraIndentForOverflow = block.attrs?.indent;
75320
+ const hasNegativeIndent = (paraIndentForOverflow?.left ?? 0) < 0 || (paraIndentForOverflow?.right ?? 0) < 0;
75321
+ const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer || hasNegativeIndent ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
75380
75322
  applyStyles$2(fragmentEl, styles);
75381
75323
  this.applyFragmentFrame(fragmentEl, fragment, context.section);
75382
75324
  if (isTocEntry) {
@@ -75405,6 +75347,8 @@ const _DomPainter = class _DomPainter2 {
75405
75347
  }
75406
75348
  if (fragmentEl.style.paddingLeft) fragmentEl.style.removeProperty("padding-left");
75407
75349
  if (fragmentEl.style.paddingRight) fragmentEl.style.removeProperty("padding-right");
75350
+ if (fragmentEl.style.marginLeft) fragmentEl.style.removeProperty("margin-left");
75351
+ if (fragmentEl.style.marginRight) fragmentEl.style.removeProperty("margin-right");
75408
75352
  if (fragmentEl.style.textIndent) fragmentEl.style.removeProperty("text-indent");
75409
75353
  const paraIndent = block.attrs?.indent;
75410
75354
  const paraIndentLeft = paraIndent?.left ?? 0;
@@ -75433,16 +75377,22 @@ const _DomPainter = class _DomPainter2 {
75433
75377
  if (!isListFirstLine) {
75434
75378
  if (hasExplicitSegmentPositioning) {
75435
75379
  if (isFirstLine && firstLineOffset !== 0) {
75436
- const adjustedPadding = paraIndentLeft + firstLineOffset;
75437
- lineEl.style.paddingLeft = `${adjustedPadding}px`;
75380
+ const effectiveLeftIndent = paraIndentLeft < 0 ? 0 : paraIndentLeft;
75381
+ const adjustedPadding = effectiveLeftIndent + firstLineOffset;
75382
+ if (adjustedPadding > 0) {
75383
+ lineEl.style.paddingLeft = `${adjustedPadding}px`;
75384
+ }
75438
75385
  }
75439
- } else if (paraIndentLeft) {
75386
+ } else if (paraIndentLeft && paraIndentLeft > 0) {
75440
75387
  lineEl.style.paddingLeft = `${paraIndentLeft}px`;
75388
+ } else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0) {
75389
+ lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
75441
75390
  }
75442
75391
  }
75443
- if (paraIndentRight) {
75392
+ if (paraIndentRight && paraIndentRight > 0) {
75444
75393
  lineEl.style.paddingRight = `${paraIndentRight}px`;
75445
75394
  }
75395
+ const hasNegativeLeftIndent = paraIndentLeft != null && paraIndentLeft < 0;
75446
75396
  if (!fragment.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
75447
75397
  if (!hasExplicitSegmentPositioning) {
75448
75398
  lineEl.style.textIndent = `${firstLineOffset}px`;
@@ -77727,15 +77677,18 @@ const applyParagraphBlockStyles = (element, attrs) => {
77727
77677
  }
77728
77678
  const indent = attrs.indent;
77729
77679
  if (indent) {
77730
- if (indent.left) {
77680
+ if (indent.left && indent.left > 0) {
77731
77681
  element.style.paddingLeft = `${indent.left}px`;
77732
77682
  }
77733
- if (indent.right) {
77683
+ if (indent.right && indent.right > 0) {
77734
77684
  element.style.paddingRight = `${indent.right}px`;
77735
77685
  }
77736
- const textIndent = (indent.firstLine ?? 0) - (indent.hanging ?? 0);
77737
- if (textIndent) {
77738
- element.style.textIndent = `${textIndent}px`;
77686
+ const hasNegativeLeftIndent = indent.left != null && indent.left < 0;
77687
+ if (!hasNegativeLeftIndent) {
77688
+ const textIndent = (indent.firstLine ?? 0) - (indent.hanging ?? 0);
77689
+ if (textIndent) {
77690
+ element.style.textIndent = `${textIndent}px`;
77691
+ }
77739
77692
  }
77740
77693
  }
77741
77694
  applyParagraphBorderStyles(element, attrs.borders);
@@ -79097,20 +79050,6 @@ const asSafeNumber = (value) => {
79097
79050
  }
79098
79051
  return value;
79099
79052
  };
79100
- function calculateFirstLineIndent(block, measure) {
79101
- const wordLayout = block.attrs?.wordLayout;
79102
- if (!wordLayout?.firstLineIndentMode) {
79103
- return 0;
79104
- }
79105
- if (!wordLayout.marker || !measure.marker) {
79106
- return 0;
79107
- }
79108
- const markerWidthRaw = measure.marker.markerWidth ?? wordLayout.marker.markerBoxWidthPx ?? 0;
79109
- const markerWidth = Number.isFinite(markerWidthRaw) && markerWidthRaw >= 0 ? markerWidthRaw : 0;
79110
- const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
79111
- const gutterWidth = Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0;
79112
- return markerWidth + gutterWidth;
79113
- }
79114
79053
  function layoutParagraphBlock(ctx2, anchors) {
79115
79054
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
79116
79055
  const remeasureParagraph2 = ctx2.remeasureParagraph;
@@ -79232,10 +79171,25 @@ function layoutParagraphBlock(ctx2, anchors) {
79232
79171
  }
79233
79172
  let lines = normalizeLines(measure);
79234
79173
  const measurementWidth = lines[0]?.maxWidth;
79174
+ const paraIndent = block.attrs?.indent;
79175
+ const indentLeft = typeof paraIndent?.left === "number" && Number.isFinite(paraIndent.left) ? paraIndent.left : 0;
79176
+ const indentRight = typeof paraIndent?.right === "number" && Number.isFinite(paraIndent.right) ? paraIndent.right : 0;
79177
+ const negativeLeftIndent = indentLeft < 0 ? indentLeft : 0;
79178
+ const negativeRightIndent = indentRight < 0 ? indentRight : 0;
79179
+ const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
79235
79180
  let didRemeasureForColumnWidth = false;
79236
- if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > columnWidth) {
79237
- const firstLineIndent = calculateFirstLineIndent(block, measure);
79238
- const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
79181
+ if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
79182
+ let firstLineIndent = 0;
79183
+ const wordLayout = block.attrs?.wordLayout;
79184
+ if (wordLayout?.marker && measure.marker) {
79185
+ const markerJustification = wordLayout.marker.justification ?? "left";
79186
+ if (markerJustification === "left") {
79187
+ const markerWidth = measure.marker.markerWidth ?? 0;
79188
+ const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
79189
+ firstLineIndent = markerWidth + gutterWidth;
79190
+ }
79191
+ }
79192
+ const newMeasure = remeasureParagraph2(block, remeasureWidth, firstLineIndent);
79239
79193
  lines = normalizeLines(newMeasure);
79240
79194
  didRemeasureForColumnWidth = true;
79241
79195
  }
@@ -79314,9 +79268,19 @@ function layoutParagraphBlock(ctx2, anchors) {
79314
79268
  }
79315
79269
  tempY += lineHeight2;
79316
79270
  }
79317
- if (narrowestWidth < columnWidth) {
79318
- const firstLineIndent = calculateFirstLineIndent(block, measure);
79319
- const newMeasure = remeasureParagraph2(block, narrowestWidth, firstLineIndent);
79271
+ const narrowestRemeasureWidth = Math.max(1, narrowestWidth - indentLeft - indentRight);
79272
+ if (narrowestRemeasureWidth < remeasureWidth) {
79273
+ let firstLineIndent = 0;
79274
+ const wordLayout = block.attrs?.wordLayout;
79275
+ if (wordLayout?.marker && measure.marker) {
79276
+ const markerJustification = wordLayout.marker.justification ?? "left";
79277
+ if (markerJustification === "left") {
79278
+ const markerWidth = measure.marker.markerWidth ?? 0;
79279
+ const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
79280
+ firstLineIndent = markerWidth + gutterWidth;
79281
+ }
79282
+ }
79283
+ const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
79320
79284
  lines = normalizeLines(newMeasure);
79321
79285
  didRemeasureForFloats = true;
79322
79286
  }
@@ -79370,14 +79334,16 @@ function layoutParagraphBlock(ctx2, anchors) {
79370
79334
  }
79371
79335
  const slice2 = sliceLines(lines, fromLine, state2.contentBottom - state2.cursorY);
79372
79336
  const fragmentHeight = slice2.height;
79337
+ const adjustedX = columnX(state2.columnIndex) + offsetX + negativeLeftIndent;
79338
+ const adjustedWidth = effectiveColumnWidth - negativeLeftIndent - negativeRightIndent;
79373
79339
  const fragment = {
79374
79340
  kind: "para",
79375
79341
  blockId: block.id,
79376
79342
  fromLine,
79377
79343
  toLine: slice2.toLine,
79378
- x: columnX(state2.columnIndex) + offsetX,
79344
+ x: adjustedX,
79379
79345
  y: state2.cursorY,
79380
- width: effectiveColumnWidth,
79346
+ width: adjustedWidth,
79381
79347
  ...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
79382
79348
  };
79383
79349
  if (didRemeasureForColumnWidth) {
@@ -83085,9 +83051,15 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
83085
83051
  }
83086
83052
  const DEFAULT_PAGE_SIZE$1 = { w: 612, h: 792 };
83087
83053
  const DEFAULT_MARGINS$1 = { top: 72, right: 72, bottom: 72, left: 72 };
83054
+ const normalizeMargin = (value, fallback) => Number.isFinite(value) ? value : fallback;
83088
83055
  function resolveMeasurementConstraints(options) {
83089
83056
  const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
83090
- const margins = options.margins ?? DEFAULT_MARGINS$1;
83057
+ const margins = {
83058
+ top: normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top),
83059
+ right: normalizeMargin(options.margins?.right, DEFAULT_MARGINS$1.right),
83060
+ bottom: normalizeMargin(options.margins?.bottom, DEFAULT_MARGINS$1.bottom),
83061
+ left: normalizeMargin(options.margins?.left, DEFAULT_MARGINS$1.left)
83062
+ };
83091
83063
  const contentWidth = pageSize.w - (margins.left + margins.right);
83092
83064
  const contentHeight = pageSize.h - (margins.top + margins.bottom);
83093
83065
  const columns = options.columns;
@@ -84625,8 +84597,8 @@ async function measureParagraphBlock(block, maxWidth) {
84625
84597
  const lines = [];
84626
84598
  const indent = block.attrs?.indent;
84627
84599
  const spacing = block.attrs?.spacing;
84628
- const indentLeft = sanitizePositive(indent?.left);
84629
- const indentRight = sanitizePositive(indent?.right);
84600
+ const indentLeft = sanitizeIndent(indent?.left);
84601
+ const indentRight = sanitizeIndent(indent?.right);
84630
84602
  const firstLine = indent?.firstLine ?? 0;
84631
84603
  const hanging = indent?.hanging ?? 0;
84632
84604
  const isWordLayoutList = Boolean(wordLayout?.marker);
@@ -84635,10 +84607,10 @@ async function measureParagraphBlock(block, maxWidth) {
84635
84607
  const clampedFirstLineOffset = Math.max(0, rawFirstLineOffset);
84636
84608
  const firstLineOffset = isWordLayoutList ? 0 : clampedFirstLineOffset;
84637
84609
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
84610
+ const bodyContentWidth = contentWidth;
84638
84611
  let initialAvailableWidth;
84639
84612
  const textStartPx = wordLayout?.textStartPx;
84640
- const treatAsHanging = isWordLayoutList && indentLeft === 0 && hanging === 0 && typeof textStartPx === "number";
84641
- if (typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging) {
84613
+ if (typeof textStartPx === "number" && textStartPx > indentLeft) {
84642
84614
  initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
84643
84615
  } else {
84644
84616
  initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
@@ -84685,21 +84657,6 @@ async function measureParagraphBlock(block, maxWidth) {
84685
84657
  totalHeight: metrics.lineHeight
84686
84658
  };
84687
84659
  }
84688
- const isListLike = Boolean(block.attrs?.numId || wordLayout?.marker);
84689
- if (isListLike) {
84690
- console.log(
84691
- "[measureParagraph][list]",
84692
- JSON.stringify({
84693
- blockId: block.id,
84694
- maxWidth,
84695
- indentLeft,
84696
- indentRight,
84697
- textStartPx: textStartPx ?? null,
84698
- firstLineOffset: firstLineOffset ?? null,
84699
- initialAvailableWidth
84700
- })
84701
- );
84702
- }
84703
84660
  let currentLine = null;
84704
84661
  const getEffectiveWidth = (baseWidth) => {
84705
84662
  if (dropCapMeasure && lines.length < dropCapMeasure.lines && dropCapMeasure.mode === "drop") {
@@ -84845,7 +84802,7 @@ async function measureParagraphBlock(block, maxWidth) {
84845
84802
  lines.push(emptyLine);
84846
84803
  }
84847
84804
  const hadPreviousLine = lines.length > 0;
84848
- const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(contentWidth) : getEffectiveWidth(initialAvailableWidth);
84805
+ const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(bodyContentWidth) : getEffectiveWidth(initialAvailableWidth);
84849
84806
  currentLine = {
84850
84807
  fromRun: runIndex,
84851
84808
  fromChar: 0,
@@ -84956,7 +84913,7 @@ async function measureParagraphBlock(block, maxWidth) {
84956
84913
  toChar: 1,
84957
84914
  width: imageWidth,
84958
84915
  maxFontSize: imageHeight,
84959
- maxWidth: getEffectiveWidth(contentWidth),
84916
+ maxWidth: getEffectiveWidth(bodyContentWidth),
84960
84917
  spaceCount: 0,
84961
84918
  segments: [
84962
84919
  {
@@ -85045,7 +85002,7 @@ async function measureParagraphBlock(block, maxWidth) {
85045
85002
  toChar: 1,
85046
85003
  width: annotationWidth,
85047
85004
  maxFontSize: annotationHeight,
85048
- maxWidth: getEffectiveWidth(contentWidth),
85005
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85049
85006
  spaceCount: 0,
85050
85007
  segments: [
85051
85008
  {
@@ -85127,7 +85084,7 @@ async function measureParagraphBlock(block, maxWidth) {
85127
85084
  width: spacesWidth,
85128
85085
  maxFontSize: run2.fontSize,
85129
85086
  maxFontInfo: getFontInfoFromRun(run2),
85130
- maxWidth: getEffectiveWidth(contentWidth),
85087
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85131
85088
  segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
85132
85089
  spaceCount: spacesLength
85133
85090
  };
@@ -85190,7 +85147,7 @@ async function measureParagraphBlock(block, maxWidth) {
85190
85147
  width: singleSpaceWidth,
85191
85148
  maxFontSize: run2.fontSize,
85192
85149
  maxFontInfo: getFontInfoFromRun(run2),
85193
- maxWidth: getEffectiveWidth(contentWidth),
85150
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85194
85151
  segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
85195
85152
  spaceCount: 1
85196
85153
  };
@@ -85383,7 +85340,7 @@ async function measureParagraphBlock(block, maxWidth) {
85383
85340
  width: wordOnlyWidth,
85384
85341
  maxFontSize: run2.fontSize,
85385
85342
  maxFontInfo: getFontInfoFromRun(run2),
85386
- maxWidth: getEffectiveWidth(contentWidth),
85343
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85387
85344
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
85388
85345
  spaceCount: 0
85389
85346
  };
@@ -85948,6 +85905,7 @@ const resolveLineHeight = (spacing, baseLineHeight) => {
85948
85905
  return Math.max(baseLineHeight, raw);
85949
85906
  };
85950
85907
  const sanitizePositive = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0;
85908
+ const sanitizeIndent = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
85951
85909
  const sanitizeDecimalSeparator = (value) => {
85952
85910
  if (value === ",") return ",";
85953
85911
  return DEFAULT_DECIMAL_SEPARATOR;
@@ -90496,6 +90454,10 @@ resolveLayoutOptions_fn = function(blocks, sectionMetadata) {
90496
90454
  const pageSize = firstSection?.pageSize ?? defaults.pageSize;
90497
90455
  const margins = {
90498
90456
  ...defaults.margins,
90457
+ ...firstSection?.margins?.top != null ? { top: firstSection.margins.top } : {},
90458
+ ...firstSection?.margins?.right != null ? { right: firstSection.margins.right } : {},
90459
+ ...firstSection?.margins?.bottom != null ? { bottom: firstSection.margins.bottom } : {},
90460
+ ...firstSection?.margins?.left != null ? { left: firstSection.margins.left } : {},
90499
90461
  ...firstSection?.margins?.header != null ? { header: firstSection.margins.header } : {},
90500
90462
  ...firstSection?.margins?.footer != null ? { footer: firstSection.margins.footer } : {}
90501
90463
  };
@@ -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-BEVM5t3i.js";
3
- import { _ as _export_sfc } from "./chunks/editor-B8k1bwD_.js";
2
+ import { T as TextSelection } from "./chunks/converter-Oj-eTB79.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-DBXoaaWP.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 = {}) {
@@ -42721,7 +42721,7 @@ const _SuperConverter = class _SuperConverter {
42721
42721
  static getStoredSuperdocVersion(docx) {
42722
42722
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42723
42723
  }
42724
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.97") {
42724
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.98") {
42725
42725
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42726
42726
  }
42727
42727
  /**
@@ -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-BEVM5t3i.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-Oj-eTB79.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
  }