@harbour-enterprises/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
@@ -42309,7 +42309,7 @@ const _SuperConverter = class _SuperConverter2 {
42309
42309
  static getStoredSuperdocVersion(docx) {
42310
42310
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42311
42311
  }
42312
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.71") {
42312
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.73") {
42313
42313
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42314
42314
  }
42315
42315
  /**
@@ -59498,7 +59498,7 @@ const isHeadless = (editor) => {
59498
59498
  const shouldSkipNodeView = (editor) => {
59499
59499
  return isHeadless(editor);
59500
59500
  };
59501
- const summaryVersion = "1.0.0-beta.71";
59501
+ const summaryVersion = "1.0.0-beta.73";
59502
59502
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59503
59503
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59504
59504
  function mapAttributes(attrs) {
@@ -60287,7 +60287,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60287
60287
  { default: remarkStringify },
60288
60288
  { default: remarkGfm }
60289
60289
  ] = await Promise.all([
60290
- import("./index-DNdPLYmc-BiqKDIea.es.js"),
60290
+ import("./index-DZuRXtuO-BpEV348M.es.js"),
60291
60291
  import("./index-DRCvimau-Cw339678.es.js"),
60292
60292
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60293
60293
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60492,7 +60492,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60492
60492
  * Process collaboration migrations
60493
60493
  */
60494
60494
  processCollaborationMigrations() {
60495
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.71");
60495
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.73");
60496
60496
  if (!this.options.ydoc) return;
60497
60497
  const metaMap = this.options.ydoc.getMap("meta");
60498
60498
  let docVersion = metaMap.get("version");
@@ -68023,11 +68023,11 @@ const countSpaces = (text) => {
68023
68023
  }
68024
68024
  return spaces;
68025
68025
  };
68026
- const getJustifyAdjustment = (block, line, availableWidthOverride) => {
68026
+ const getJustifyAdjustment = (block, line, availableWidthOverride, alignmentOverride) => {
68027
68027
  if (block.kind !== "paragraph") {
68028
68028
  return { extraPerSpace: 0, totalSpaces: 0 };
68029
68029
  }
68030
- const alignment2 = block.attrs?.alignment;
68030
+ const alignment2 = alignmentOverride ?? block.attrs?.alignment;
68031
68031
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
68032
68032
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
68033
68033
  const slack = Math.max(0, availableWidth - line.width);
@@ -68106,13 +68106,13 @@ function sliceRunsForLine$1(block, line) {
68106
68106
  }
68107
68107
  return result;
68108
68108
  }
68109
- function measureCharacterX(block, line, charOffset, availableWidthOverride) {
68109
+ function measureCharacterX(block, line, charOffset, availableWidthOverride, alignmentOverride) {
68110
68110
  const ctx2 = getMeasurementContext();
68111
68111
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: if no maxWidth, approximate available width as line width (no slack)
68112
68112
  line.width;
68113
- const justify = getJustifyAdjustment(block, line, availableWidth);
68114
- const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
68115
- const alignment2 = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
68113
+ const justify = getJustifyAdjustment(block, line, availableWidth, alignmentOverride);
68114
+ const alignment2 = alignmentOverride ?? (block.kind === "paragraph" ? block.attrs?.alignment : void 0);
68115
+ const renderedLineWidth = alignment2 === "justify" ? line.width + Math.max(0, availableWidth - line.width) : line.width;
68116
68116
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
68117
68117
  const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
68118
68118
  if (hasExplicitPositioning && line.segments && ctx2) {
@@ -68241,13 +68241,13 @@ function charOffsetToPm(block, line, charOffset, fallbackPmStart) {
68241
68241
  }
68242
68242
  return lastPm;
68243
68243
  }
68244
- function findCharacterAtX(block, line, x2, pmStart, availableWidthOverride) {
68244
+ function findCharacterAtX(block, line, x2, pmStart, availableWidthOverride, alignmentOverride) {
68245
68245
  const ctx2 = getMeasurementContext();
68246
68246
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: approximate with line width when no maxWidth is present
68247
68247
  line.width;
68248
- const justify = getJustifyAdjustment(block, line, availableWidth);
68249
- const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
68250
- const alignment2 = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
68248
+ const justify = getJustifyAdjustment(block, line, availableWidth, alignmentOverride);
68249
+ const alignment2 = alignmentOverride ?? (block.kind === "paragraph" ? block.attrs?.alignment : void 0);
68250
+ const renderedLineWidth = alignment2 === "justify" ? line.width + Math.max(0, availableWidth - line.width) : line.width;
68251
68251
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
68252
68252
  const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
68253
68253
  if (!ctx2) {
@@ -80955,7 +80955,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
80955
80955
  `[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.`
80956
80956
  );
80957
80957
  }
80958
- const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth);
80958
+ const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
80959
+ const isListItem = markerWidth > 0;
80960
+ const alignmentOverride = isListItem ? "left" : void 0;
80961
+ const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
80959
80962
  if (pos == null) {
80960
80963
  logClickStage("warn", "no-position", {
80961
80964
  blockId: fragment.blockId
@@ -80997,7 +81000,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
80997
81000
  `[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.`
80998
81001
  );
80999
81002
  }
81000
- const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth);
81003
+ const cellMarkerWidth = cellMeasure.marker?.markerWidth ?? 0;
81004
+ const isListItem = cellMarkerWidth > 0;
81005
+ const alignmentOverride = isListItem ? "left" : void 0;
81006
+ const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, alignmentOverride);
81001
81007
  if (pos != null) {
81002
81008
  logClickStage("log", "success", {
81003
81009
  blockId: tableHit.fragment.blockId,
@@ -81153,18 +81159,19 @@ function selectionToRects(layout, blocks, measures, from2, to) {
81153
81159
  if (sliceFrom >= sliceTo) return;
81154
81160
  const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
81155
81161
  const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
81156
- const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
81157
- const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
81158
81162
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
81163
+ const isListItem = markerWidth > 0;
81164
+ const alignmentOverride = isListItem ? "left" : void 0;
81165
+ const startX = mapPmToX(block, line, charOffsetFrom, fragment.width, alignmentOverride);
81166
+ const endX = mapPmToX(block, line, charOffsetTo, fragment.width, alignmentOverride);
81159
81167
  const paraIndentLeft = block.attrs?.indent?.left ?? 0;
81160
81168
  const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
81161
81169
  const isFirstLine = index2 === fragment.fromLine;
81162
- const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
81163
- let indentAdjust = 0;
81164
- if (!isListFirstLine) {
81165
- indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
81170
+ let indentAdjust = paraIndentLeft;
81171
+ if (isFirstLine && !isListItem) {
81172
+ indentAdjust += firstLineOffset;
81166
81173
  }
81167
- const rectX = fragment.x + markerWidth + indentAdjust + Math.min(startX, endX);
81174
+ const rectX = fragment.x + indentAdjust + Math.min(startX, endX);
81168
81175
  const rectWidth = Math.max(1, Math.abs(endX - startX));
81169
81176
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
81170
81177
  const rectY = fragment.y + lineOffset;
@@ -81266,6 +81273,9 @@ function selectionToRects(layout, blocks, measures, from2, to) {
81266
81273
  let blockTopCursor = padding.top + verticalOffset;
81267
81274
  renderedBlocks.forEach((info) => {
81268
81275
  const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
81276
+ const isListItem = paragraphMarkerWidth > 0;
81277
+ const alignmentOverride = isListItem ? "left" : void 0;
81278
+ const paraIndentLeft = info.block.kind === "paragraph" ? info.block.attrs?.indent?.left ?? 0 : 0;
81269
81279
  const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
81270
81280
  intersectingLines.forEach(({ line, index: index2 }) => {
81271
81281
  if (index2 < info.startLine || index2 >= info.endLine) {
@@ -81279,9 +81289,9 @@ function selectionToRects(layout, blocks, measures, from2, to) {
81279
81289
  const charOffsetFrom = pmPosToCharOffset(info.block, line, sliceFrom);
81280
81290
  const charOffsetTo = pmPosToCharOffset(info.block, line, sliceTo);
81281
81291
  const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
81282
- const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth);
81283
- const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth);
81284
- const rectX = fragment.x + cellX + padding.left + paragraphMarkerWidth + Math.min(startX, endX);
81292
+ const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth, alignmentOverride);
81293
+ const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth, alignmentOverride);
81294
+ const rectX = fragment.x + cellX + padding.left + paraIndentLeft + Math.min(startX, endX);
81285
81295
  const rectWidth = Math.max(1, Math.abs(endX - startX));
81286
81296
  const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
81287
81297
  const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
@@ -81540,11 +81550,11 @@ const lineHeightBeforeIndex = (measure, absoluteLineIndex) => {
81540
81550
  }
81541
81551
  return height;
81542
81552
  };
81543
- const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride) => {
81553
+ const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride, alignmentOverride) => {
81544
81554
  if (block.kind !== "paragraph") return null;
81545
81555
  const range2 = computeLinePmRange(block, line);
81546
81556
  if (range2.pmStart == null || range2.pmEnd == null) return null;
81547
- const result = findCharacterAtX(block, line, x2, range2.pmStart, availableWidthOverride);
81557
+ const result = findCharacterAtX(block, line, x2, range2.pmStart, availableWidthOverride, alignmentOverride);
81548
81558
  if (isRTL) {
81549
81559
  const charOffset = result.charOffset;
81550
81560
  const charsInLine = Math.max(1, line.toChar - line.fromChar);
@@ -81553,7 +81563,7 @@ const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride) => {
81553
81563
  }
81554
81564
  return result.pmPosition;
81555
81565
  };
81556
- const mapPmToX = (block, line, offset2, fragmentWidth) => {
81566
+ const mapPmToX = (block, line, offset2, fragmentWidth, alignmentOverride) => {
81557
81567
  if (fragmentWidth <= 0 || line.width <= 0) return 0;
81558
81568
  let paraIndentLeft = 0;
81559
81569
  let paraIndentRight = 0;
@@ -81570,7 +81580,7 @@ const mapPmToX = (block, line, offset2, fragmentWidth) => {
81570
81580
  `[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.`
81571
81581
  );
81572
81582
  }
81573
- return measureCharacterX(block, line, offset2, availableWidth);
81583
+ return measureCharacterX(block, line, offset2, availableWidth, alignmentOverride);
81574
81584
  };
81575
81585
  const isRtlBlock = (block) => {
81576
81586
  if (block.kind !== "paragraph") return false;
@@ -85637,6 +85647,74 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
85637
85647
  getLayoutOptions() {
85638
85648
  return { ...__privateGet$1(this, _layoutOptions) };
85639
85649
  }
85650
+ /**
85651
+ * Get the page styles for the section containing the current caret position.
85652
+ *
85653
+ * In multi-section documents, different sections can have different page sizes,
85654
+ * margins, and orientations. This method returns the styles for the section
85655
+ * where the caret is currently located, enabling section-aware UI components
85656
+ * like rulers to display accurate information.
85657
+ *
85658
+ * @returns Object containing:
85659
+ * - pageSize: { width, height } in inches
85660
+ * - pageMargins: { left, right, top, bottom } in inches
85661
+ * - sectionIndex: The current section index (0-based)
85662
+ * - orientation: 'portrait' or 'landscape'
85663
+ *
85664
+ * Falls back to document-level defaults if section info is unavailable.
85665
+ *
85666
+ * @example
85667
+ * ```typescript
85668
+ * const sectionStyles = presentation.getCurrentSectionPageStyles();
85669
+ * console.log(`Section ${sectionStyles.sectionIndex}: ${sectionStyles.pageSize.width}" x ${sectionStyles.pageSize.height}"`);
85670
+ * ```
85671
+ */
85672
+ getCurrentSectionPageStyles() {
85673
+ const PPI2 = 96;
85674
+ const layout = __privateGet$1(this, _layoutState).layout;
85675
+ const pageIndex = __privateMethod$1(this, _PresentationEditor_instances, getCurrentPageIndex_fn).call(this);
85676
+ const page = layout?.pages?.[pageIndex];
85677
+ const converterStyles = __privateGet$1(this, _editor3).converter?.pageStyles ?? {};
85678
+ const defaultMargins = converterStyles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
85679
+ const safeMargins = {
85680
+ left: typeof defaultMargins.left === "number" ? defaultMargins.left : 1,
85681
+ right: typeof defaultMargins.right === "number" ? defaultMargins.right : 1,
85682
+ top: typeof defaultMargins.top === "number" ? defaultMargins.top : 1,
85683
+ bottom: typeof defaultMargins.bottom === "number" ? defaultMargins.bottom : 1
85684
+ };
85685
+ if (!page) {
85686
+ return {
85687
+ pageSize: { width: 8.5, height: 11 },
85688
+ pageMargins: safeMargins,
85689
+ sectionIndex: 0,
85690
+ orientation: "portrait"
85691
+ };
85692
+ }
85693
+ const pageOrientation = page.orientation === "landscape" || page.orientation === "portrait" ? page.orientation : "portrait";
85694
+ const standardPortrait = { w: 8.5 * PPI2, h: 11 * PPI2 };
85695
+ const standardLandscape = { w: 11 * PPI2, h: 8.5 * PPI2 };
85696
+ const orientationDefault = pageOrientation === "landscape" ? standardLandscape : standardPortrait;
85697
+ const pageWidthPx = page.size?.w ?? orientationDefault.w;
85698
+ const pageHeightPx = page.size?.h ?? orientationDefault.h;
85699
+ const marginLeftPx = page.margins?.left ?? safeMargins.left * PPI2;
85700
+ const marginRightPx = page.margins?.right ?? safeMargins.right * PPI2;
85701
+ const marginTopPx = page.margins?.top ?? safeMargins.top * PPI2;
85702
+ const marginBottomPx = page.margins?.bottom ?? safeMargins.bottom * PPI2;
85703
+ return {
85704
+ pageSize: {
85705
+ width: pageWidthPx / PPI2,
85706
+ height: pageHeightPx / PPI2
85707
+ },
85708
+ pageMargins: {
85709
+ left: marginLeftPx / PPI2,
85710
+ right: marginRightPx / PPI2,
85711
+ top: marginTopPx / PPI2,
85712
+ bottom: marginBottomPx / PPI2
85713
+ },
85714
+ sectionIndex: page.sectionIndex ?? 0,
85715
+ orientation: pageOrientation
85716
+ };
85717
+ }
85640
85718
  /**
85641
85719
  * Get current remote cursor states (normalized to absolute PM positions).
85642
85720
  * Returns an array of cursor states for all remote collaborators, excluding the local user.
@@ -88531,9 +88609,26 @@ getCurrentPageIndex_fn = function() {
88531
88609
  }
88532
88610
  const layout = __privateGet$1(this, _layoutState).layout;
88533
88611
  const selection = __privateGet$1(this, _editor3).state?.selection;
88534
- if (!layout || !selection) return 0;
88612
+ if (!layout || !selection) {
88613
+ return 0;
88614
+ }
88535
88615
  const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, selection.from, selection.to) ?? [];
88536
- return rects[0]?.pageIndex ?? 0;
88616
+ if (rects.length > 0) {
88617
+ return rects[0]?.pageIndex ?? 0;
88618
+ }
88619
+ const pos = selection.from;
88620
+ for (let pageIdx = 0; pageIdx < layout.pages.length; pageIdx++) {
88621
+ const page = layout.pages[pageIdx];
88622
+ for (const fragment of page.fragments) {
88623
+ const frag = fragment;
88624
+ if (frag.pmStart != null && frag.pmEnd != null) {
88625
+ if (pos >= frag.pmStart && pos <= frag.pmEnd) {
88626
+ return pageIdx;
88627
+ }
88628
+ }
88629
+ }
88630
+ }
88631
+ return 0;
88537
88632
  };
88538
88633
  findRegionForPage_fn = function(kind, pageIndex) {
88539
88634
  const map22 = kind === "header" ? __privateGet$1(this, _headerRegions) : __privateGet$1(this, _footerRegions);
@@ -123268,6 +123363,7 @@ const _sfc_main$6 = {
123268
123363
  const rulerHandleActiveColor = ref$1("#2563EB66");
123269
123364
  const pageSize = ref$1(null);
123270
123365
  const pageMargins = ref$1(null);
123366
+ const currentSectionIndex = ref$1(0);
123271
123367
  const isDragging = ref$1(false);
123272
123368
  const currentHandle = ref$1(null);
123273
123369
  const leftHandle = reactive({ side: "left", x: 0 });
@@ -123275,9 +123371,29 @@ const _sfc_main$6 = {
123275
123371
  const showVerticalIndicator = ref$1(false);
123276
123372
  const initialX = ref$1(0);
123277
123373
  let offsetX = 0;
123278
- const initRuler = () => {
123279
- if (props.editor.options.mode !== "docx") return null;
123280
- const { pageMargins: docMargins, pageSize: docSize } = props.editor.getPageStyles();
123374
+ let selectionUpdateHandler = null;
123375
+ const getPresentationEditor = () => {
123376
+ return props.editor?.presentationEditor ?? null;
123377
+ };
123378
+ const updateRulerForCurrentSection = () => {
123379
+ if (!props.editor || props.editor.options?.mode !== "docx") return;
123380
+ const presentationEditor = getPresentationEditor();
123381
+ let docSize, docMargins, sectionIndex;
123382
+ if (presentationEditor && typeof presentationEditor.getCurrentSectionPageStyles === "function") {
123383
+ const sectionStyles = presentationEditor.getCurrentSectionPageStyles();
123384
+ docSize = sectionStyles.pageSize;
123385
+ docMargins = sectionStyles.pageMargins;
123386
+ sectionIndex = sectionStyles.sectionIndex;
123387
+ } else {
123388
+ const styles = props.editor.getPageStyles();
123389
+ docSize = styles.pageSize ?? { width: 8.5, height: 11 };
123390
+ docMargins = styles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
123391
+ sectionIndex = 0;
123392
+ }
123393
+ if (pageSize.value && currentSectionIndex.value === sectionIndex) {
123394
+ return;
123395
+ }
123396
+ currentSectionIndex.value = sectionIndex;
123281
123397
  pageSize.value = docSize;
123282
123398
  pageMargins.value = docMargins;
123283
123399
  const definition = generateRulerDefinition({
@@ -123291,7 +123407,7 @@ const _sfc_main$6 = {
123291
123407
  });
123292
123408
  leftHandle.x = definition.leftMarginPx;
123293
123409
  rightHandle.x = definition.rightMarginPx;
123294
- return definition;
123410
+ rulerDefinition.value = definition;
123295
123411
  };
123296
123412
  const getTickStyle = computed(() => (tick) => {
123297
123413
  return {
@@ -123345,7 +123461,8 @@ const _sfc_main$6 = {
123345
123461
  const marginValue = getNewMarginValue();
123346
123462
  emit("margin-change", {
123347
123463
  side: currentHandle.value.side,
123348
- value: marginValue
123464
+ value: marginValue,
123465
+ sectionIndex: currentSectionIndex.value
123349
123466
  });
123350
123467
  }
123351
123468
  };
@@ -123369,12 +123486,40 @@ const _sfc_main$6 = {
123369
123486
  "--ruler-width": `${width}px`
123370
123487
  };
123371
123488
  });
123489
+ const handleSelectionUpdate = () => {
123490
+ if (isDragging.value) return;
123491
+ updateRulerForCurrentSection();
123492
+ };
123493
+ const setupEditorListeners = () => {
123494
+ if (!props.editor) return;
123495
+ selectionUpdateHandler = handleSelectionUpdate;
123496
+ props.editor.on("selectionUpdate", selectionUpdateHandler);
123497
+ };
123498
+ const cleanupEditorListeners = () => {
123499
+ if (!props.editor || !selectionUpdateHandler) return;
123500
+ props.editor.off("selectionUpdate", selectionUpdateHandler);
123501
+ selectionUpdateHandler = null;
123502
+ };
123503
+ watch(
123504
+ () => props.editor,
123505
+ (newEditor, oldEditor) => {
123506
+ if (oldEditor && selectionUpdateHandler) {
123507
+ oldEditor.off("selectionUpdate", selectionUpdateHandler);
123508
+ }
123509
+ if (newEditor) {
123510
+ setupEditorListeners();
123511
+ updateRulerForCurrentSection();
123512
+ }
123513
+ }
123514
+ );
123372
123515
  onMounted(() => {
123373
- rulerDefinition.value = initRuler();
123516
+ updateRulerForCurrentSection();
123517
+ setupEditorListeners();
123374
123518
  window.addEventListener("mousemove", handleMouseMove2);
123375
123519
  window.addEventListener("mouseup", handleMouseUp);
123376
123520
  });
123377
123521
  onUnmounted(() => {
123522
+ cleanupEditorListeners();
123378
123523
  window.removeEventListener("mousemove", handleMouseMove2);
123379
123524
  window.removeEventListener("mouseup", handleMouseUp);
123380
123525
  });
@@ -123415,7 +123560,7 @@ const _sfc_main$6 = {
123415
123560
  };
123416
123561
  }
123417
123562
  };
123418
- const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-b9f4f30a"]]);
123563
+ const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-0d1b9cd1"]]);
123419
123564
  const _sfc_main$5 = {
123420
123565
  __name: "GenericPopover",
123421
123566
  props: {
package/dist/style.css CHANGED
@@ -2189,7 +2189,7 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
2189
2189
  margin: 4px 0;
2190
2190
  }
2191
2191
  .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}
2192
- .vertical-indicator[data-v-b9f4f30a] {
2192
+ .vertical-indicator[data-v-0d1b9cd1] {
2193
2193
  position: absolute;
2194
2194
  height: 0px;
2195
2195
  min-width: 1px;
@@ -2197,7 +2197,7 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
2197
2197
  top: 20px;
2198
2198
  z-index: 100;
2199
2199
  }
2200
- .margin-handle[data-v-b9f4f30a] {
2200
+ .margin-handle[data-v-0d1b9cd1] {
2201
2201
  width: 56px;
2202
2202
  min-width: 5px;
2203
2203
  max-width: 5px;
@@ -2210,10 +2210,10 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
2210
2210
  transition: background-color 250ms ease;
2211
2211
  z-index: 10;
2212
2212
  }
2213
- .margin-handle[data-v-b9f4f30a]:hover {
2213
+ .margin-handle[data-v-0d1b9cd1]:hover {
2214
2214
  background-color: var(--ruler-handle-active-color);
2215
2215
  }
2216
- .ruler[data-v-b9f4f30a] {
2216
+ .ruler[data-v-0d1b9cd1] {
2217
2217
  height: 25px;
2218
2218
  width: var(--ruler-width, 8.5in);
2219
2219
  margin: 0;
@@ -2221,14 +2221,13 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
2221
2221
  box-sizing: border-box;
2222
2222
  position: relative;
2223
2223
  color: #666;
2224
+ transition: width 150ms ease-out;
2224
2225
  }
2225
-
2226
- /* Tick marks - using absolute positioning from ruler-core */
2227
- .ruler-tick[data-v-b9f4f30a] {
2226
+ .ruler-tick[data-v-0d1b9cd1] {
2228
2227
  pointer-events: none;
2229
2228
  user-select: none;
2230
2229
  }
2231
- .numbering[data-v-b9f4f30a] {
2230
+ .numbering[data-v-0d1b9cd1] {
2232
2231
  position: absolute;
2233
2232
  top: -16px;
2234
2233
  left: -2px;
@@ -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-Cd9FToOQ.js";
3
- import { _ as _export_sfc } from "./chunks/editor-DO6-AGUY.js";
2
+ import { T as TextSelection } from "./chunks/converter-Czwp6T-t.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-DaiVtTXo.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 = {}) {
@@ -42626,7 +42626,7 @@ const _SuperConverter = class _SuperConverter {
42626
42626
  static getStoredSuperdocVersion(docx) {
42627
42627
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42628
42628
  }
42629
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.71") {
42629
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.73") {
42630
42630
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42631
42631
  }
42632
42632
  /**
@@ -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-Cd9FToOQ.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-Czwp6T-t.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
  }