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
@@ -1,5 +1,5 @@
1
1
  import { y as defineComponent, z as h, O as Transition, a0 as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-Dysv_7z5.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-dVVrZVr-.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-YCkhH3qs.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-jWLMl8Ts.cjs");
4
- const superdoc = require("./index-C5kk90i2.cjs");
4
+ const superdoc = require("./index-Dc6FhKsA.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-DUGFHvw1.cjs");
3
+ const superEditor_es = require("./super-editor.es-CrRRbz3_.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-1WGVfjfp.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-rYLAMF97.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-DUGFHvw1.cjs");
2
+ const superEditor_es = require("./super-editor.es-CrRRbz3_.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-DQmQUge-.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -17268,7 +17268,7 @@ const _sfc_main = {
17268
17268
  __name: "SuperDoc",
17269
17269
  emits: ["selection-update"],
17270
17270
  setup(__props, { emit: __emit }) {
17271
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-ByYZWEAY.cjs")));
17271
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DBqcgXRQ.cjs")));
17272
17272
  const superdocStore = useSuperdocStore();
17273
17273
  const commentsStore = useCommentsStore();
17274
17274
  const {
@@ -18157,7 +18157,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18157
18157
  this.config.colors = shuffleArray(this.config.colors);
18158
18158
  this.userColorMap = /* @__PURE__ */ new Map();
18159
18159
  this.colorIndex = 0;
18160
- this.version = "1.0.0-beta.71";
18160
+ this.version = "1.0.0-beta.73";
18161
18161
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18162
18162
  this.superdocId = config.superdocId || uuid.v4();
18163
18163
  this.colors = this.config.colors;
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-1WGVfjfp.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-rYLAMF97.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-CcXAdeql.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -17251,7 +17251,7 @@ const _sfc_main = {
17251
17251
  __name: "SuperDoc",
17252
17252
  emits: ["selection-update"],
17253
17253
  setup(__props, { emit: __emit }) {
17254
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-fC8HER9x.es.js"));
17254
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-A6N1Ilp8.es.js"));
17255
17255
  const superdocStore = useSuperdocStore();
17256
17256
  const commentsStore = useCommentsStore();
17257
17257
  const {
@@ -18140,7 +18140,7 @@ class SuperDoc extends EventEmitter {
18140
18140
  this.config.colors = shuffleArray(this.config.colors);
18141
18141
  this.userColorMap = /* @__PURE__ */ new Map();
18142
18142
  this.colorIndex = 0;
18143
- this.version = "1.0.0-beta.71";
18143
+ this.version = "1.0.0-beta.73";
18144
18144
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18145
18145
  this.superdocId = config.superdocId || v4();
18146
18146
  this.colors = this.config.colors;
@@ -42326,7 +42326,7 @@ const _SuperConverter = class _SuperConverter2 {
42326
42326
  static getStoredSuperdocVersion(docx) {
42327
42327
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42328
42328
  }
42329
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.71") {
42329
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.73") {
42330
42330
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42331
42331
  }
42332
42332
  /**
@@ -59515,7 +59515,7 @@ const isHeadless = (editor) => {
59515
59515
  const shouldSkipNodeView = (editor) => {
59516
59516
  return isHeadless(editor);
59517
59517
  };
59518
- const summaryVersion = "1.0.0-beta.71";
59518
+ const summaryVersion = "1.0.0-beta.73";
59519
59519
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59520
59520
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59521
59521
  function mapAttributes(attrs) {
@@ -60304,7 +60304,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60304
60304
  { default: remarkStringify },
60305
60305
  { default: remarkGfm }
60306
60306
  ] = await Promise.all([
60307
- Promise.resolve().then(() => require("./index-DNdPLYmc-xVZ8rsAB.cjs")),
60307
+ Promise.resolve().then(() => require("./index-DZuRXtuO-BP5GzZkJ.cjs")),
60308
60308
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60309
60309
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60310
60310
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60509,7 +60509,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60509
60509
  * Process collaboration migrations
60510
60510
  */
60511
60511
  processCollaborationMigrations() {
60512
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.71");
60512
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.73");
60513
60513
  if (!this.options.ydoc) return;
60514
60514
  const metaMap = this.options.ydoc.getMap("meta");
60515
60515
  let docVersion = metaMap.get("version");
@@ -68040,11 +68040,11 @@ const countSpaces = (text) => {
68040
68040
  }
68041
68041
  return spaces;
68042
68042
  };
68043
- const getJustifyAdjustment = (block, line, availableWidthOverride) => {
68043
+ const getJustifyAdjustment = (block, line, availableWidthOverride, alignmentOverride) => {
68044
68044
  if (block.kind !== "paragraph") {
68045
68045
  return { extraPerSpace: 0, totalSpaces: 0 };
68046
68046
  }
68047
- const alignment2 = block.attrs?.alignment;
68047
+ const alignment2 = alignmentOverride ?? block.attrs?.alignment;
68048
68048
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
68049
68049
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
68050
68050
  const slack = Math.max(0, availableWidth - line.width);
@@ -68123,13 +68123,13 @@ function sliceRunsForLine$1(block, line) {
68123
68123
  }
68124
68124
  return result;
68125
68125
  }
68126
- function measureCharacterX(block, line, charOffset, availableWidthOverride) {
68126
+ function measureCharacterX(block, line, charOffset, availableWidthOverride, alignmentOverride) {
68127
68127
  const ctx2 = getMeasurementContext();
68128
68128
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: if no maxWidth, approximate available width as line width (no slack)
68129
68129
  line.width;
68130
- const justify = getJustifyAdjustment(block, line, availableWidth);
68131
- const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
68132
- const alignment2 = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
68130
+ const justify = getJustifyAdjustment(block, line, availableWidth, alignmentOverride);
68131
+ const alignment2 = alignmentOverride ?? (block.kind === "paragraph" ? block.attrs?.alignment : void 0);
68132
+ const renderedLineWidth = alignment2 === "justify" ? line.width + Math.max(0, availableWidth - line.width) : line.width;
68133
68133
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
68134
68134
  const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
68135
68135
  if (hasExplicitPositioning && line.segments && ctx2) {
@@ -68258,13 +68258,13 @@ function charOffsetToPm(block, line, charOffset, fallbackPmStart) {
68258
68258
  }
68259
68259
  return lastPm;
68260
68260
  }
68261
- function findCharacterAtX(block, line, x2, pmStart, availableWidthOverride) {
68261
+ function findCharacterAtX(block, line, x2, pmStart, availableWidthOverride, alignmentOverride) {
68262
68262
  const ctx2 = getMeasurementContext();
68263
68263
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: approximate with line width when no maxWidth is present
68264
68264
  line.width;
68265
- const justify = getJustifyAdjustment(block, line, availableWidth);
68266
- const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
68267
- const alignment2 = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
68265
+ const justify = getJustifyAdjustment(block, line, availableWidth, alignmentOverride);
68266
+ const alignment2 = alignmentOverride ?? (block.kind === "paragraph" ? block.attrs?.alignment : void 0);
68267
+ const renderedLineWidth = alignment2 === "justify" ? line.width + Math.max(0, availableWidth - line.width) : line.width;
68268
68268
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
68269
68269
  const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
68270
68270
  if (!ctx2) {
@@ -80972,7 +80972,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
80972
80972
  `[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.`
80973
80973
  );
80974
80974
  }
80975
- const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth);
80975
+ const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
80976
+ const isListItem = markerWidth > 0;
80977
+ const alignmentOverride = isListItem ? "left" : void 0;
80978
+ const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
80976
80979
  if (pos == null) {
80977
80980
  logClickStage("warn", "no-position", {
80978
80981
  blockId: fragment.blockId
@@ -81014,7 +81017,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
81014
81017
  `[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.`
81015
81018
  );
81016
81019
  }
81017
- const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth);
81020
+ const cellMarkerWidth = cellMeasure.marker?.markerWidth ?? 0;
81021
+ const isListItem = cellMarkerWidth > 0;
81022
+ const alignmentOverride = isListItem ? "left" : void 0;
81023
+ const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, alignmentOverride);
81018
81024
  if (pos != null) {
81019
81025
  logClickStage("log", "success", {
81020
81026
  blockId: tableHit.fragment.blockId,
@@ -81170,18 +81176,19 @@ function selectionToRects(layout, blocks, measures, from2, to) {
81170
81176
  if (sliceFrom >= sliceTo) return;
81171
81177
  const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
81172
81178
  const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
81173
- const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
81174
- const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
81175
81179
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
81180
+ const isListItem = markerWidth > 0;
81181
+ const alignmentOverride = isListItem ? "left" : void 0;
81182
+ const startX = mapPmToX(block, line, charOffsetFrom, fragment.width, alignmentOverride);
81183
+ const endX = mapPmToX(block, line, charOffsetTo, fragment.width, alignmentOverride);
81176
81184
  const paraIndentLeft = block.attrs?.indent?.left ?? 0;
81177
81185
  const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
81178
81186
  const isFirstLine = index2 === fragment.fromLine;
81179
- const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
81180
- let indentAdjust = 0;
81181
- if (!isListFirstLine) {
81182
- indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
81187
+ let indentAdjust = paraIndentLeft;
81188
+ if (isFirstLine && !isListItem) {
81189
+ indentAdjust += firstLineOffset;
81183
81190
  }
81184
- const rectX = fragment.x + markerWidth + indentAdjust + Math.min(startX, endX);
81191
+ const rectX = fragment.x + indentAdjust + Math.min(startX, endX);
81185
81192
  const rectWidth = Math.max(1, Math.abs(endX - startX));
81186
81193
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
81187
81194
  const rectY = fragment.y + lineOffset;
@@ -81283,6 +81290,9 @@ function selectionToRects(layout, blocks, measures, from2, to) {
81283
81290
  let blockTopCursor = padding.top + verticalOffset;
81284
81291
  renderedBlocks.forEach((info) => {
81285
81292
  const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
81293
+ const isListItem = paragraphMarkerWidth > 0;
81294
+ const alignmentOverride = isListItem ? "left" : void 0;
81295
+ const paraIndentLeft = info.block.kind === "paragraph" ? info.block.attrs?.indent?.left ?? 0 : 0;
81286
81296
  const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
81287
81297
  intersectingLines.forEach(({ line, index: index2 }) => {
81288
81298
  if (index2 < info.startLine || index2 >= info.endLine) {
@@ -81296,9 +81306,9 @@ function selectionToRects(layout, blocks, measures, from2, to) {
81296
81306
  const charOffsetFrom = pmPosToCharOffset(info.block, line, sliceFrom);
81297
81307
  const charOffsetTo = pmPosToCharOffset(info.block, line, sliceTo);
81298
81308
  const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
81299
- const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth);
81300
- const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth);
81301
- const rectX = fragment.x + cellX + padding.left + paragraphMarkerWidth + Math.min(startX, endX);
81309
+ const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth, alignmentOverride);
81310
+ const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth, alignmentOverride);
81311
+ const rectX = fragment.x + cellX + padding.left + paraIndentLeft + Math.min(startX, endX);
81302
81312
  const rectWidth = Math.max(1, Math.abs(endX - startX));
81303
81313
  const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
81304
81314
  const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
@@ -81557,11 +81567,11 @@ const lineHeightBeforeIndex = (measure, absoluteLineIndex) => {
81557
81567
  }
81558
81568
  return height;
81559
81569
  };
81560
- const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride) => {
81570
+ const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride, alignmentOverride) => {
81561
81571
  if (block.kind !== "paragraph") return null;
81562
81572
  const range2 = computeLinePmRange(block, line);
81563
81573
  if (range2.pmStart == null || range2.pmEnd == null) return null;
81564
- const result = findCharacterAtX(block, line, x2, range2.pmStart, availableWidthOverride);
81574
+ const result = findCharacterAtX(block, line, x2, range2.pmStart, availableWidthOverride, alignmentOverride);
81565
81575
  if (isRTL) {
81566
81576
  const charOffset = result.charOffset;
81567
81577
  const charsInLine = Math.max(1, line.toChar - line.fromChar);
@@ -81570,7 +81580,7 @@ const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride) => {
81570
81580
  }
81571
81581
  return result.pmPosition;
81572
81582
  };
81573
- const mapPmToX = (block, line, offset2, fragmentWidth) => {
81583
+ const mapPmToX = (block, line, offset2, fragmentWidth, alignmentOverride) => {
81574
81584
  if (fragmentWidth <= 0 || line.width <= 0) return 0;
81575
81585
  let paraIndentLeft = 0;
81576
81586
  let paraIndentRight = 0;
@@ -81587,7 +81597,7 @@ const mapPmToX = (block, line, offset2, fragmentWidth) => {
81587
81597
  `[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.`
81588
81598
  );
81589
81599
  }
81590
- return measureCharacterX(block, line, offset2, availableWidth);
81600
+ return measureCharacterX(block, line, offset2, availableWidth, alignmentOverride);
81591
81601
  };
81592
81602
  const isRtlBlock = (block) => {
81593
81603
  if (block.kind !== "paragraph") return false;
@@ -85654,6 +85664,74 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
85654
85664
  getLayoutOptions() {
85655
85665
  return { ...__privateGet$1(this, _layoutOptions) };
85656
85666
  }
85667
+ /**
85668
+ * Get the page styles for the section containing the current caret position.
85669
+ *
85670
+ * In multi-section documents, different sections can have different page sizes,
85671
+ * margins, and orientations. This method returns the styles for the section
85672
+ * where the caret is currently located, enabling section-aware UI components
85673
+ * like rulers to display accurate information.
85674
+ *
85675
+ * @returns Object containing:
85676
+ * - pageSize: { width, height } in inches
85677
+ * - pageMargins: { left, right, top, bottom } in inches
85678
+ * - sectionIndex: The current section index (0-based)
85679
+ * - orientation: 'portrait' or 'landscape'
85680
+ *
85681
+ * Falls back to document-level defaults if section info is unavailable.
85682
+ *
85683
+ * @example
85684
+ * ```typescript
85685
+ * const sectionStyles = presentation.getCurrentSectionPageStyles();
85686
+ * console.log(`Section ${sectionStyles.sectionIndex}: ${sectionStyles.pageSize.width}" x ${sectionStyles.pageSize.height}"`);
85687
+ * ```
85688
+ */
85689
+ getCurrentSectionPageStyles() {
85690
+ const PPI2 = 96;
85691
+ const layout = __privateGet$1(this, _layoutState).layout;
85692
+ const pageIndex = __privateMethod$1(this, _PresentationEditor_instances, getCurrentPageIndex_fn).call(this);
85693
+ const page = layout?.pages?.[pageIndex];
85694
+ const converterStyles = __privateGet$1(this, _editor3).converter?.pageStyles ?? {};
85695
+ const defaultMargins = converterStyles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
85696
+ const safeMargins = {
85697
+ left: typeof defaultMargins.left === "number" ? defaultMargins.left : 1,
85698
+ right: typeof defaultMargins.right === "number" ? defaultMargins.right : 1,
85699
+ top: typeof defaultMargins.top === "number" ? defaultMargins.top : 1,
85700
+ bottom: typeof defaultMargins.bottom === "number" ? defaultMargins.bottom : 1
85701
+ };
85702
+ if (!page) {
85703
+ return {
85704
+ pageSize: { width: 8.5, height: 11 },
85705
+ pageMargins: safeMargins,
85706
+ sectionIndex: 0,
85707
+ orientation: "portrait"
85708
+ };
85709
+ }
85710
+ const pageOrientation = page.orientation === "landscape" || page.orientation === "portrait" ? page.orientation : "portrait";
85711
+ const standardPortrait = { w: 8.5 * PPI2, h: 11 * PPI2 };
85712
+ const standardLandscape = { w: 11 * PPI2, h: 8.5 * PPI2 };
85713
+ const orientationDefault = pageOrientation === "landscape" ? standardLandscape : standardPortrait;
85714
+ const pageWidthPx = page.size?.w ?? orientationDefault.w;
85715
+ const pageHeightPx = page.size?.h ?? orientationDefault.h;
85716
+ const marginLeftPx = page.margins?.left ?? safeMargins.left * PPI2;
85717
+ const marginRightPx = page.margins?.right ?? safeMargins.right * PPI2;
85718
+ const marginTopPx = page.margins?.top ?? safeMargins.top * PPI2;
85719
+ const marginBottomPx = page.margins?.bottom ?? safeMargins.bottom * PPI2;
85720
+ return {
85721
+ pageSize: {
85722
+ width: pageWidthPx / PPI2,
85723
+ height: pageHeightPx / PPI2
85724
+ },
85725
+ pageMargins: {
85726
+ left: marginLeftPx / PPI2,
85727
+ right: marginRightPx / PPI2,
85728
+ top: marginTopPx / PPI2,
85729
+ bottom: marginBottomPx / PPI2
85730
+ },
85731
+ sectionIndex: page.sectionIndex ?? 0,
85732
+ orientation: pageOrientation
85733
+ };
85734
+ }
85657
85735
  /**
85658
85736
  * Get current remote cursor states (normalized to absolute PM positions).
85659
85737
  * Returns an array of cursor states for all remote collaborators, excluding the local user.
@@ -88548,9 +88626,26 @@ getCurrentPageIndex_fn = function() {
88548
88626
  }
88549
88627
  const layout = __privateGet$1(this, _layoutState).layout;
88550
88628
  const selection = __privateGet$1(this, _editor3).state?.selection;
88551
- if (!layout || !selection) return 0;
88629
+ if (!layout || !selection) {
88630
+ return 0;
88631
+ }
88552
88632
  const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, selection.from, selection.to) ?? [];
88553
- return rects[0]?.pageIndex ?? 0;
88633
+ if (rects.length > 0) {
88634
+ return rects[0]?.pageIndex ?? 0;
88635
+ }
88636
+ const pos = selection.from;
88637
+ for (let pageIdx = 0; pageIdx < layout.pages.length; pageIdx++) {
88638
+ const page = layout.pages[pageIdx];
88639
+ for (const fragment of page.fragments) {
88640
+ const frag = fragment;
88641
+ if (frag.pmStart != null && frag.pmEnd != null) {
88642
+ if (pos >= frag.pmStart && pos <= frag.pmEnd) {
88643
+ return pageIdx;
88644
+ }
88645
+ }
88646
+ }
88647
+ }
88648
+ return 0;
88554
88649
  };
88555
88650
  findRegionForPage_fn = function(kind, pageIndex) {
88556
88651
  const map22 = kind === "header" ? __privateGet$1(this, _headerRegions) : __privateGet$1(this, _footerRegions);
@@ -123285,6 +123380,7 @@ const _sfc_main$6 = {
123285
123380
  const rulerHandleActiveColor = vue.ref("#2563EB66");
123286
123381
  const pageSize = vue.ref(null);
123287
123382
  const pageMargins = vue.ref(null);
123383
+ const currentSectionIndex = vue.ref(0);
123288
123384
  const isDragging = vue.ref(false);
123289
123385
  const currentHandle = vue.ref(null);
123290
123386
  const leftHandle = vue.reactive({ side: "left", x: 0 });
@@ -123292,9 +123388,29 @@ const _sfc_main$6 = {
123292
123388
  const showVerticalIndicator = vue.ref(false);
123293
123389
  const initialX = vue.ref(0);
123294
123390
  let offsetX = 0;
123295
- const initRuler = () => {
123296
- if (props.editor.options.mode !== "docx") return null;
123297
- const { pageMargins: docMargins, pageSize: docSize } = props.editor.getPageStyles();
123391
+ let selectionUpdateHandler = null;
123392
+ const getPresentationEditor = () => {
123393
+ return props.editor?.presentationEditor ?? null;
123394
+ };
123395
+ const updateRulerForCurrentSection = () => {
123396
+ if (!props.editor || props.editor.options?.mode !== "docx") return;
123397
+ const presentationEditor = getPresentationEditor();
123398
+ let docSize, docMargins, sectionIndex;
123399
+ if (presentationEditor && typeof presentationEditor.getCurrentSectionPageStyles === "function") {
123400
+ const sectionStyles = presentationEditor.getCurrentSectionPageStyles();
123401
+ docSize = sectionStyles.pageSize;
123402
+ docMargins = sectionStyles.pageMargins;
123403
+ sectionIndex = sectionStyles.sectionIndex;
123404
+ } else {
123405
+ const styles = props.editor.getPageStyles();
123406
+ docSize = styles.pageSize ?? { width: 8.5, height: 11 };
123407
+ docMargins = styles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
123408
+ sectionIndex = 0;
123409
+ }
123410
+ if (pageSize.value && currentSectionIndex.value === sectionIndex) {
123411
+ return;
123412
+ }
123413
+ currentSectionIndex.value = sectionIndex;
123298
123414
  pageSize.value = docSize;
123299
123415
  pageMargins.value = docMargins;
123300
123416
  const definition = generateRulerDefinition({
@@ -123308,7 +123424,7 @@ const _sfc_main$6 = {
123308
123424
  });
123309
123425
  leftHandle.x = definition.leftMarginPx;
123310
123426
  rightHandle.x = definition.rightMarginPx;
123311
- return definition;
123427
+ rulerDefinition.value = definition;
123312
123428
  };
123313
123429
  const getTickStyle = vue.computed(() => (tick) => {
123314
123430
  return {
@@ -123362,7 +123478,8 @@ const _sfc_main$6 = {
123362
123478
  const marginValue = getNewMarginValue();
123363
123479
  emit("margin-change", {
123364
123480
  side: currentHandle.value.side,
123365
- value: marginValue
123481
+ value: marginValue,
123482
+ sectionIndex: currentSectionIndex.value
123366
123483
  });
123367
123484
  }
123368
123485
  };
@@ -123386,12 +123503,40 @@ const _sfc_main$6 = {
123386
123503
  "--ruler-width": `${width}px`
123387
123504
  };
123388
123505
  });
123506
+ const handleSelectionUpdate = () => {
123507
+ if (isDragging.value) return;
123508
+ updateRulerForCurrentSection();
123509
+ };
123510
+ const setupEditorListeners = () => {
123511
+ if (!props.editor) return;
123512
+ selectionUpdateHandler = handleSelectionUpdate;
123513
+ props.editor.on("selectionUpdate", selectionUpdateHandler);
123514
+ };
123515
+ const cleanupEditorListeners = () => {
123516
+ if (!props.editor || !selectionUpdateHandler) return;
123517
+ props.editor.off("selectionUpdate", selectionUpdateHandler);
123518
+ selectionUpdateHandler = null;
123519
+ };
123520
+ vue.watch(
123521
+ () => props.editor,
123522
+ (newEditor, oldEditor) => {
123523
+ if (oldEditor && selectionUpdateHandler) {
123524
+ oldEditor.off("selectionUpdate", selectionUpdateHandler);
123525
+ }
123526
+ if (newEditor) {
123527
+ setupEditorListeners();
123528
+ updateRulerForCurrentSection();
123529
+ }
123530
+ }
123531
+ );
123389
123532
  vue.onMounted(() => {
123390
- rulerDefinition.value = initRuler();
123533
+ updateRulerForCurrentSection();
123534
+ setupEditorListeners();
123391
123535
  window.addEventListener("mousemove", handleMouseMove2);
123392
123536
  window.addEventListener("mouseup", handleMouseUp);
123393
123537
  });
123394
123538
  vue.onUnmounted(() => {
123539
+ cleanupEditorListeners();
123395
123540
  window.removeEventListener("mousemove", handleMouseMove2);
123396
123541
  window.removeEventListener("mouseup", handleMouseUp);
123397
123542
  });
@@ -123432,7 +123577,7 @@ const _sfc_main$6 = {
123432
123577
  };
123433
123578
  }
123434
123579
  };
123435
- const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-b9f4f30a"]]);
123580
+ const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-0d1b9cd1"]]);
123436
123581
  const _sfc_main$5 = {
123437
123582
  __name: "GenericPopover",
123438
123583
  props: {