superdoc 1.0.0-beta.71 → 1.0.0-beta.73

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 (29) hide show
  1. package/dist/chunks/{PdfViewer-fC8HER9x.es.js → PdfViewer-A6N1Ilp8.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-ByYZWEAY.cjs → PdfViewer-DBqcgXRQ.cjs} +1 -1
  3. package/dist/chunks/{index-DNdPLYmc-xVZ8rsAB.cjs → index-DZuRXtuO-BP5GzZkJ.cjs} +1 -1
  4. package/dist/chunks/{index-DNdPLYmc-BiqKDIea.es.js → index-DZuRXtuO-BpEV348M.es.js} +1 -1
  5. package/dist/chunks/{index-C5kk90i2.cjs → index-Dc6FhKsA.cjs} +3 -3
  6. package/dist/chunks/{index-dVVrZVr-.es.js → index-YCkhH3qs.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-DUGFHvw1.cjs → super-editor.es-CrRRbz3_.cjs} +184 -39
  8. package/dist/chunks/{super-editor.es-1WGVfjfp.es.js → super-editor.es-rYLAMF97.es.js} +184 -39
  9. package/dist/style.css +7 -8
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-Cd9FToOQ.js → converter-Czwp6T-t.js} +1 -1
  12. package/dist/super-editor/chunks/{docx-zipper-Dy4WiCTL.js → docx-zipper-BT3IILnA.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-DO6-AGUY.js → editor-DaiVtTXo.js} +128 -33
  14. package/dist/super-editor/chunks/{index-DNdPLYmc.js → index-DZuRXtuO.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-Dt8nFoPI.js → toolbar-DuPPWgDF.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/style.css +7 -8
  21. package/dist/super-editor/super-editor.es.js +63 -13
  22. package/dist/super-editor/toolbar.es.js +2 -2
  23. package/dist/super-editor.cjs +1 -1
  24. package/dist/super-editor.es.js +1 -1
  25. package/dist/superdoc.cjs +2 -2
  26. package/dist/superdoc.es.js +2 -2
  27. package/dist/superdoc.umd.js +186 -41
  28. package/dist/superdoc.umd.js.map +1 -1
  29. package/package.json +1 -1
@@ -42327,7 +42327,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42327
42327
  static getStoredSuperdocVersion(docx) {
42328
42328
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42329
42329
  }
42330
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.71") {
42330
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.73") {
42331
42331
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42332
42332
  }
42333
42333
  /**
@@ -67373,7 +67373,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67373
67373
  const shouldSkipNodeView = (editor) => {
67374
67374
  return isHeadless(editor);
67375
67375
  };
67376
- const summaryVersion = "1.0.0-beta.71";
67376
+ const summaryVersion = "1.0.0-beta.73";
67377
67377
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67378
67378
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67379
67379
  function mapAttributes(attrs) {
@@ -68162,7 +68162,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68162
68162
  { default: remarkStringify2 },
68163
68163
  { default: remarkGfm2 }
68164
68164
  ] = await Promise.all([
68165
- Promise.resolve().then(() => indexDNdPLYmc),
68165
+ Promise.resolve().then(() => indexDZuRXtuO),
68166
68166
  Promise.resolve().then(() => indexDRCvimau),
68167
68167
  Promise.resolve().then(() => indexC_x_N6Uh),
68168
68168
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68367,7 +68367,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68367
68367
  * Process collaboration migrations
68368
68368
  */
68369
68369
  processCollaborationMigrations() {
68370
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.71");
68370
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.73");
68371
68371
  if (!this.options.ydoc) return;
68372
68372
  const metaMap = this.options.ydoc.getMap("meta");
68373
68373
  let docVersion = metaMap.get("version");
@@ -75898,11 +75898,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75898
75898
  }
75899
75899
  return spaces;
75900
75900
  };
75901
- const getJustifyAdjustment = (block, line, availableWidthOverride) => {
75901
+ const getJustifyAdjustment = (block, line, availableWidthOverride, alignmentOverride) => {
75902
75902
  if (block.kind !== "paragraph") {
75903
75903
  return { extraPerSpace: 0, totalSpaces: 0 };
75904
75904
  }
75905
- const alignment2 = block.attrs?.alignment;
75905
+ const alignment2 = alignmentOverride ?? block.attrs?.alignment;
75906
75906
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
75907
75907
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
75908
75908
  const slack = Math.max(0, availableWidth - line.width);
@@ -75981,13 +75981,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75981
75981
  }
75982
75982
  return result;
75983
75983
  }
75984
- function measureCharacterX(block, line, charOffset, availableWidthOverride) {
75984
+ function measureCharacterX(block, line, charOffset, availableWidthOverride, alignmentOverride) {
75985
75985
  const ctx2 = getMeasurementContext();
75986
75986
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: if no maxWidth, approximate available width as line width (no slack)
75987
75987
  line.width;
75988
- const justify = getJustifyAdjustment(block, line, availableWidth);
75989
- const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
75990
- const alignment2 = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
75988
+ const justify = getJustifyAdjustment(block, line, availableWidth, alignmentOverride);
75989
+ const alignment2 = alignmentOverride ?? (block.kind === "paragraph" ? block.attrs?.alignment : void 0);
75990
+ const renderedLineWidth = alignment2 === "justify" ? line.width + Math.max(0, availableWidth - line.width) : line.width;
75991
75991
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
75992
75992
  const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
75993
75993
  if (hasExplicitPositioning && line.segments && ctx2) {
@@ -76116,13 +76116,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76116
76116
  }
76117
76117
  return lastPm;
76118
76118
  }
76119
- function findCharacterAtX(block, line, x2, pmStart, availableWidthOverride) {
76119
+ function findCharacterAtX(block, line, x2, pmStart, availableWidthOverride, alignmentOverride) {
76120
76120
  const ctx2 = getMeasurementContext();
76121
76121
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: approximate with line width when no maxWidth is present
76122
76122
  line.width;
76123
- const justify = getJustifyAdjustment(block, line, availableWidth);
76124
- const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
76125
- const alignment2 = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
76123
+ const justify = getJustifyAdjustment(block, line, availableWidth, alignmentOverride);
76124
+ const alignment2 = alignmentOverride ?? (block.kind === "paragraph" ? block.attrs?.alignment : void 0);
76125
+ const renderedLineWidth = alignment2 === "justify" ? line.width + Math.max(0, availableWidth - line.width) : line.width;
76126
76126
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
76127
76127
  const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
76128
76128
  if (!ctx2) {
@@ -88830,7 +88830,10 @@ ${l}
88830
88830
  `[clickToPosition] Paragraph indents (${totalIndent}px) exceed fragment width (${fragment.width}px) for block ${fragment.blockId}. This may indicate a layout miscalculation. Available width clamped to 0.`
88831
88831
  );
88832
88832
  }
88833
- const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth);
88833
+ const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
88834
+ const isListItem = markerWidth > 0;
88835
+ const alignmentOverride = isListItem ? "left" : void 0;
88836
+ const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
88834
88837
  if (pos == null) {
88835
88838
  logClickStage("warn", "no-position", {
88836
88839
  blockId: fragment.blockId
@@ -88872,7 +88875,10 @@ ${l}
88872
88875
  `[clickToPosition:table] Paragraph indents (${totalIndent}px) exceed fragment width (${tableHit.fragment.width}px) for block ${tableHit.fragment.blockId}. This may indicate a layout miscalculation. Available width clamped to 0.`
88873
88876
  );
88874
88877
  }
88875
- const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth);
88878
+ const cellMarkerWidth = cellMeasure.marker?.markerWidth ?? 0;
88879
+ const isListItem = cellMarkerWidth > 0;
88880
+ const alignmentOverride = isListItem ? "left" : void 0;
88881
+ const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, alignmentOverride);
88876
88882
  if (pos != null) {
88877
88883
  logClickStage("log", "success", {
88878
88884
  blockId: tableHit.fragment.blockId,
@@ -89028,18 +89034,19 @@ ${l}
89028
89034
  if (sliceFrom >= sliceTo) return;
89029
89035
  const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
89030
89036
  const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
89031
- const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
89032
- const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
89033
89037
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
89038
+ const isListItem = markerWidth > 0;
89039
+ const alignmentOverride = isListItem ? "left" : void 0;
89040
+ const startX = mapPmToX(block, line, charOffsetFrom, fragment.width, alignmentOverride);
89041
+ const endX = mapPmToX(block, line, charOffsetTo, fragment.width, alignmentOverride);
89034
89042
  const paraIndentLeft = block.attrs?.indent?.left ?? 0;
89035
89043
  const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
89036
89044
  const isFirstLine = index2 === fragment.fromLine;
89037
- const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
89038
- let indentAdjust = 0;
89039
- if (!isListFirstLine) {
89040
- indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
89045
+ let indentAdjust = paraIndentLeft;
89046
+ if (isFirstLine && !isListItem) {
89047
+ indentAdjust += firstLineOffset;
89041
89048
  }
89042
- const rectX = fragment.x + markerWidth + indentAdjust + Math.min(startX, endX);
89049
+ const rectX = fragment.x + indentAdjust + Math.min(startX, endX);
89043
89050
  const rectWidth = Math.max(1, Math.abs(endX - startX));
89044
89051
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
89045
89052
  const rectY = fragment.y + lineOffset;
@@ -89141,6 +89148,9 @@ ${l}
89141
89148
  let blockTopCursor = padding.top + verticalOffset;
89142
89149
  renderedBlocks.forEach((info) => {
89143
89150
  const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
89151
+ const isListItem = paragraphMarkerWidth > 0;
89152
+ const alignmentOverride = isListItem ? "left" : void 0;
89153
+ const paraIndentLeft = info.block.kind === "paragraph" ? info.block.attrs?.indent?.left ?? 0 : 0;
89144
89154
  const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
89145
89155
  intersectingLines.forEach(({ line, index: index2 }) => {
89146
89156
  if (index2 < info.startLine || index2 >= info.endLine) {
@@ -89154,9 +89164,9 @@ ${l}
89154
89164
  const charOffsetFrom = pmPosToCharOffset(info.block, line, sliceFrom);
89155
89165
  const charOffsetTo = pmPosToCharOffset(info.block, line, sliceTo);
89156
89166
  const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
89157
- const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth);
89158
- const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth);
89159
- const rectX = fragment.x + cellX + padding.left + paragraphMarkerWidth + Math.min(startX, endX);
89167
+ const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth, alignmentOverride);
89168
+ const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth, alignmentOverride);
89169
+ const rectX = fragment.x + cellX + padding.left + paraIndentLeft + Math.min(startX, endX);
89160
89170
  const rectWidth = Math.max(1, Math.abs(endX - startX));
89161
89171
  const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
89162
89172
  const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
@@ -89415,11 +89425,11 @@ ${l}
89415
89425
  }
89416
89426
  return height;
89417
89427
  };
89418
- const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride) => {
89428
+ const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride, alignmentOverride) => {
89419
89429
  if (block.kind !== "paragraph") return null;
89420
89430
  const range2 = computeLinePmRange(block, line);
89421
89431
  if (range2.pmStart == null || range2.pmEnd == null) return null;
89422
- const result = findCharacterAtX(block, line, x2, range2.pmStart, availableWidthOverride);
89432
+ const result = findCharacterAtX(block, line, x2, range2.pmStart, availableWidthOverride, alignmentOverride);
89423
89433
  if (isRTL) {
89424
89434
  const charOffset = result.charOffset;
89425
89435
  const charsInLine = Math.max(1, line.toChar - line.fromChar);
@@ -89428,7 +89438,7 @@ ${l}
89428
89438
  }
89429
89439
  return result.pmPosition;
89430
89440
  };
89431
- const mapPmToX = (block, line, offset2, fragmentWidth) => {
89441
+ const mapPmToX = (block, line, offset2, fragmentWidth, alignmentOverride) => {
89432
89442
  if (fragmentWidth <= 0 || line.width <= 0) return 0;
89433
89443
  let paraIndentLeft = 0;
89434
89444
  let paraIndentRight = 0;
@@ -89445,7 +89455,7 @@ ${l}
89445
89455
  `[mapPmToX] Paragraph indents (${totalIndent}px) exceed fragment width (${fragmentWidth}px) for block ${block.id}. This may indicate a layout miscalculation. Available width clamped to 0.`
89446
89456
  );
89447
89457
  }
89448
- return measureCharacterX(block, line, offset2, availableWidth);
89458
+ return measureCharacterX(block, line, offset2, availableWidth, alignmentOverride);
89449
89459
  };
89450
89460
  const isRtlBlock = (block) => {
89451
89461
  if (block.kind !== "paragraph") return false;
@@ -93512,6 +93522,74 @@ ${l}
93512
93522
  getLayoutOptions() {
93513
93523
  return { ...__privateGet$1(this, _layoutOptions) };
93514
93524
  }
93525
+ /**
93526
+ * Get the page styles for the section containing the current caret position.
93527
+ *
93528
+ * In multi-section documents, different sections can have different page sizes,
93529
+ * margins, and orientations. This method returns the styles for the section
93530
+ * where the caret is currently located, enabling section-aware UI components
93531
+ * like rulers to display accurate information.
93532
+ *
93533
+ * @returns Object containing:
93534
+ * - pageSize: { width, height } in inches
93535
+ * - pageMargins: { left, right, top, bottom } in inches
93536
+ * - sectionIndex: The current section index (0-based)
93537
+ * - orientation: 'portrait' or 'landscape'
93538
+ *
93539
+ * Falls back to document-level defaults if section info is unavailable.
93540
+ *
93541
+ * @example
93542
+ * ```typescript
93543
+ * const sectionStyles = presentation.getCurrentSectionPageStyles();
93544
+ * console.log(`Section ${sectionStyles.sectionIndex}: ${sectionStyles.pageSize.width}" x ${sectionStyles.pageSize.height}"`);
93545
+ * ```
93546
+ */
93547
+ getCurrentSectionPageStyles() {
93548
+ const PPI2 = 96;
93549
+ const layout = __privateGet$1(this, _layoutState).layout;
93550
+ const pageIndex = __privateMethod$1(this, _PresentationEditor_instances, getCurrentPageIndex_fn).call(this);
93551
+ const page = layout?.pages?.[pageIndex];
93552
+ const converterStyles = __privateGet$1(this, _editor3).converter?.pageStyles ?? {};
93553
+ const defaultMargins = converterStyles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
93554
+ const safeMargins = {
93555
+ left: typeof defaultMargins.left === "number" ? defaultMargins.left : 1,
93556
+ right: typeof defaultMargins.right === "number" ? defaultMargins.right : 1,
93557
+ top: typeof defaultMargins.top === "number" ? defaultMargins.top : 1,
93558
+ bottom: typeof defaultMargins.bottom === "number" ? defaultMargins.bottom : 1
93559
+ };
93560
+ if (!page) {
93561
+ return {
93562
+ pageSize: { width: 8.5, height: 11 },
93563
+ pageMargins: safeMargins,
93564
+ sectionIndex: 0,
93565
+ orientation: "portrait"
93566
+ };
93567
+ }
93568
+ const pageOrientation = page.orientation === "landscape" || page.orientation === "portrait" ? page.orientation : "portrait";
93569
+ const standardPortrait = { w: 8.5 * PPI2, h: 11 * PPI2 };
93570
+ const standardLandscape = { w: 11 * PPI2, h: 8.5 * PPI2 };
93571
+ const orientationDefault = pageOrientation === "landscape" ? standardLandscape : standardPortrait;
93572
+ const pageWidthPx = page.size?.w ?? orientationDefault.w;
93573
+ const pageHeightPx = page.size?.h ?? orientationDefault.h;
93574
+ const marginLeftPx = page.margins?.left ?? safeMargins.left * PPI2;
93575
+ const marginRightPx = page.margins?.right ?? safeMargins.right * PPI2;
93576
+ const marginTopPx = page.margins?.top ?? safeMargins.top * PPI2;
93577
+ const marginBottomPx = page.margins?.bottom ?? safeMargins.bottom * PPI2;
93578
+ return {
93579
+ pageSize: {
93580
+ width: pageWidthPx / PPI2,
93581
+ height: pageHeightPx / PPI2
93582
+ },
93583
+ pageMargins: {
93584
+ left: marginLeftPx / PPI2,
93585
+ right: marginRightPx / PPI2,
93586
+ top: marginTopPx / PPI2,
93587
+ bottom: marginBottomPx / PPI2
93588
+ },
93589
+ sectionIndex: page.sectionIndex ?? 0,
93590
+ orientation: pageOrientation
93591
+ };
93592
+ }
93515
93593
  /**
93516
93594
  * Get current remote cursor states (normalized to absolute PM positions).
93517
93595
  * Returns an array of cursor states for all remote collaborators, excluding the local user.
@@ -96406,9 +96484,26 @@ ${l}
96406
96484
  }
96407
96485
  const layout = __privateGet$1(this, _layoutState).layout;
96408
96486
  const selection = __privateGet$1(this, _editor3).state?.selection;
96409
- if (!layout || !selection) return 0;
96487
+ if (!layout || !selection) {
96488
+ return 0;
96489
+ }
96410
96490
  const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, selection.from, selection.to) ?? [];
96411
- return rects[0]?.pageIndex ?? 0;
96491
+ if (rects.length > 0) {
96492
+ return rects[0]?.pageIndex ?? 0;
96493
+ }
96494
+ const pos = selection.from;
96495
+ for (let pageIdx = 0; pageIdx < layout.pages.length; pageIdx++) {
96496
+ const page = layout.pages[pageIdx];
96497
+ for (const fragment of page.fragments) {
96498
+ const frag = fragment;
96499
+ if (frag.pmStart != null && frag.pmEnd != null) {
96500
+ if (pos >= frag.pmStart && pos <= frag.pmEnd) {
96501
+ return pageIdx;
96502
+ }
96503
+ }
96504
+ }
96505
+ }
96506
+ return 0;
96412
96507
  };
96413
96508
  findRegionForPage_fn = function(kind, pageIndex) {
96414
96509
  const map2 = kind === "header" ? __privateGet$1(this, _headerRegions) : __privateGet$1(this, _footerRegions);
@@ -131116,6 +131211,7 @@ ${style2}
131116
131211
  const rulerHandleActiveColor = ref("#2563EB66");
131117
131212
  const pageSize = ref(null);
131118
131213
  const pageMargins = ref(null);
131214
+ const currentSectionIndex = ref(0);
131119
131215
  const isDragging = ref(false);
131120
131216
  const currentHandle = ref(null);
131121
131217
  const leftHandle = reactive({ side: "left", x: 0 });
@@ -131123,9 +131219,29 @@ ${style2}
131123
131219
  const showVerticalIndicator = ref(false);
131124
131220
  const initialX = ref(0);
131125
131221
  let offsetX = 0;
131126
- const initRuler = () => {
131127
- if (props.editor.options.mode !== "docx") return null;
131128
- const { pageMargins: docMargins, pageSize: docSize } = props.editor.getPageStyles();
131222
+ let selectionUpdateHandler = null;
131223
+ const getPresentationEditor = () => {
131224
+ return props.editor?.presentationEditor ?? null;
131225
+ };
131226
+ const updateRulerForCurrentSection = () => {
131227
+ if (!props.editor || props.editor.options?.mode !== "docx") return;
131228
+ const presentationEditor = getPresentationEditor();
131229
+ let docSize, docMargins, sectionIndex;
131230
+ if (presentationEditor && typeof presentationEditor.getCurrentSectionPageStyles === "function") {
131231
+ const sectionStyles = presentationEditor.getCurrentSectionPageStyles();
131232
+ docSize = sectionStyles.pageSize;
131233
+ docMargins = sectionStyles.pageMargins;
131234
+ sectionIndex = sectionStyles.sectionIndex;
131235
+ } else {
131236
+ const styles = props.editor.getPageStyles();
131237
+ docSize = styles.pageSize ?? { width: 8.5, height: 11 };
131238
+ docMargins = styles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
131239
+ sectionIndex = 0;
131240
+ }
131241
+ if (pageSize.value && currentSectionIndex.value === sectionIndex) {
131242
+ return;
131243
+ }
131244
+ currentSectionIndex.value = sectionIndex;
131129
131245
  pageSize.value = docSize;
131130
131246
  pageMargins.value = docMargins;
131131
131247
  const definition2 = generateRulerDefinition({
@@ -131139,7 +131255,7 @@ ${style2}
131139
131255
  });
131140
131256
  leftHandle.x = definition2.leftMarginPx;
131141
131257
  rightHandle.x = definition2.rightMarginPx;
131142
- return definition2;
131258
+ rulerDefinition.value = definition2;
131143
131259
  };
131144
131260
  const getTickStyle = computed(() => (tick) => {
131145
131261
  return {
@@ -131193,7 +131309,8 @@ ${style2}
131193
131309
  const marginValue = getNewMarginValue();
131194
131310
  emit2("margin-change", {
131195
131311
  side: currentHandle.value.side,
131196
- value: marginValue
131312
+ value: marginValue,
131313
+ sectionIndex: currentSectionIndex.value
131197
131314
  });
131198
131315
  }
131199
131316
  };
@@ -131217,12 +131334,40 @@ ${style2}
131217
131334
  "--ruler-width": `${width}px`
131218
131335
  };
131219
131336
  });
131337
+ const handleSelectionUpdate = () => {
131338
+ if (isDragging.value) return;
131339
+ updateRulerForCurrentSection();
131340
+ };
131341
+ const setupEditorListeners = () => {
131342
+ if (!props.editor) return;
131343
+ selectionUpdateHandler = handleSelectionUpdate;
131344
+ props.editor.on("selectionUpdate", selectionUpdateHandler);
131345
+ };
131346
+ const cleanupEditorListeners = () => {
131347
+ if (!props.editor || !selectionUpdateHandler) return;
131348
+ props.editor.off("selectionUpdate", selectionUpdateHandler);
131349
+ selectionUpdateHandler = null;
131350
+ };
131351
+ watch(
131352
+ () => props.editor,
131353
+ (newEditor, oldEditor) => {
131354
+ if (oldEditor && selectionUpdateHandler) {
131355
+ oldEditor.off("selectionUpdate", selectionUpdateHandler);
131356
+ }
131357
+ if (newEditor) {
131358
+ setupEditorListeners();
131359
+ updateRulerForCurrentSection();
131360
+ }
131361
+ }
131362
+ );
131220
131363
  onMounted(() => {
131221
- rulerDefinition.value = initRuler();
131364
+ updateRulerForCurrentSection();
131365
+ setupEditorListeners();
131222
131366
  window.addEventListener("mousemove", handleMouseMove2);
131223
131367
  window.addEventListener("mouseup", handleMouseUp);
131224
131368
  });
131225
131369
  onUnmounted(() => {
131370
+ cleanupEditorListeners();
131226
131371
  window.removeEventListener("mousemove", handleMouseMove2);
131227
131372
  window.removeEventListener("mouseup", handleMouseUp);
131228
131373
  });
@@ -131263,7 +131408,7 @@ ${style2}
131263
131408
  };
131264
131409
  }
131265
131410
  };
131266
- const Ruler = /* @__PURE__ */ _export_sfc$1(_sfc_main$6$1, [["__scopeId", "data-v-b9f4f30a"]]);
131411
+ const Ruler = /* @__PURE__ */ _export_sfc$1(_sfc_main$6$1, [["__scopeId", "data-v-0d1b9cd1"]]);
131267
131412
  const _sfc_main$5$1 = {
131268
131413
  __name: "GenericPopover",
131269
131414
  props: {
@@ -150253,7 +150398,7 @@ ${style2}
150253
150398
  this.config.colors = shuffleArray(this.config.colors);
150254
150399
  this.userColorMap = /* @__PURE__ */ new Map();
150255
150400
  this.colorIndex = 0;
150256
- this.version = "1.0.0-beta.71";
150401
+ this.version = "1.0.0-beta.73";
150257
150402
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
150258
150403
  this.superdocId = config2.superdocId || v4();
150259
150404
  this.colors = this.config.colors;
@@ -152725,7 +152870,7 @@ ${style2}
152725
152870
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
152726
152871
  );
152727
152872
  }
152728
- const indexDNdPLYmc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
152873
+ const indexDZuRXtuO = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
152729
152874
  __proto__: null,
152730
152875
  unified
152731
152876
  }, Symbol.toStringTag, { value: "Module" }));