superdoc 1.0.0-beta.71 → 1.0.0-beta.72

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-ByYZWEAY.cjs → PdfViewer-BxCLl7Q6.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-fC8HER9x.es.js → PdfViewer-Dg-qiC1A.es.js} +1 -1
  3. package/dist/chunks/{index-dVVrZVr-.es.js → index-B1AqHbuy.es.js} +3 -3
  4. package/dist/chunks/{index-C5kk90i2.cjs → index-CAQDtLex.cjs} +3 -3
  5. package/dist/chunks/{index-DNdPLYmc-xVZ8rsAB.cjs → index-qXb-Hmel-BPsIpdLY.cjs} +1 -1
  6. package/dist/chunks/{index-DNdPLYmc-BiqKDIea.es.js → index-qXb-Hmel-DwJhkxdW.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-1WGVfjfp.es.js → super-editor.es-DPl3-zTR.es.js} +148 -13
  8. package/dist/chunks/{super-editor.es-DUGFHvw1.cjs → super-editor.es-DxG6ckVG.cjs} +148 -13
  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-JlOFMM88.js} +1 -1
  12. package/dist/super-editor/chunks/{docx-zipper-Dy4WiCTL.js → docx-zipper-BVmpz1K_.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-DO6-AGUY.js → editor-CNzx36Ms.js} +92 -7
  14. package/dist/super-editor/chunks/{index-DNdPLYmc.js → index-qXb-Hmel.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-Dt8nFoPI.js → toolbar-DAhwzyFV.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 +150 -15
  28. package/dist/superdoc.umd.js.map +1 -1
  29. package/package.json +1 -1
@@ -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-CAQDtLex.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -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-B1AqHbuy.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -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-DPl3-zTR.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-Dg-qiC1A.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.72";
18144
18144
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18145
18145
  this.superdocId = config.superdocId || v4();
18146
18146
  this.colors = this.config.colors;
@@ -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-DxG6ckVG.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-BxCLl7Q6.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.72";
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,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-DxG6ckVG.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-DPl3-zTR.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -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.72") {
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.72";
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-qXb-Hmel-DwJhkxdW.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.72");
60496
60496
  if (!this.options.ydoc) return;
60497
60497
  const metaMap = this.options.ydoc.getMap("meta");
60498
60498
  let docVersion = metaMap.get("version");
@@ -85637,6 +85637,74 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
85637
85637
  getLayoutOptions() {
85638
85638
  return { ...__privateGet$1(this, _layoutOptions) };
85639
85639
  }
85640
+ /**
85641
+ * Get the page styles for the section containing the current caret position.
85642
+ *
85643
+ * In multi-section documents, different sections can have different page sizes,
85644
+ * margins, and orientations. This method returns the styles for the section
85645
+ * where the caret is currently located, enabling section-aware UI components
85646
+ * like rulers to display accurate information.
85647
+ *
85648
+ * @returns Object containing:
85649
+ * - pageSize: { width, height } in inches
85650
+ * - pageMargins: { left, right, top, bottom } in inches
85651
+ * - sectionIndex: The current section index (0-based)
85652
+ * - orientation: 'portrait' or 'landscape'
85653
+ *
85654
+ * Falls back to document-level defaults if section info is unavailable.
85655
+ *
85656
+ * @example
85657
+ * ```typescript
85658
+ * const sectionStyles = presentation.getCurrentSectionPageStyles();
85659
+ * console.log(`Section ${sectionStyles.sectionIndex}: ${sectionStyles.pageSize.width}" x ${sectionStyles.pageSize.height}"`);
85660
+ * ```
85661
+ */
85662
+ getCurrentSectionPageStyles() {
85663
+ const PPI2 = 96;
85664
+ const layout = __privateGet$1(this, _layoutState).layout;
85665
+ const pageIndex = __privateMethod$1(this, _PresentationEditor_instances, getCurrentPageIndex_fn).call(this);
85666
+ const page = layout?.pages?.[pageIndex];
85667
+ const converterStyles = __privateGet$1(this, _editor3).converter?.pageStyles ?? {};
85668
+ const defaultMargins = converterStyles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
85669
+ const safeMargins = {
85670
+ left: typeof defaultMargins.left === "number" ? defaultMargins.left : 1,
85671
+ right: typeof defaultMargins.right === "number" ? defaultMargins.right : 1,
85672
+ top: typeof defaultMargins.top === "number" ? defaultMargins.top : 1,
85673
+ bottom: typeof defaultMargins.bottom === "number" ? defaultMargins.bottom : 1
85674
+ };
85675
+ if (!page) {
85676
+ return {
85677
+ pageSize: { width: 8.5, height: 11 },
85678
+ pageMargins: safeMargins,
85679
+ sectionIndex: 0,
85680
+ orientation: "portrait"
85681
+ };
85682
+ }
85683
+ const pageOrientation = page.orientation === "landscape" || page.orientation === "portrait" ? page.orientation : "portrait";
85684
+ const standardPortrait = { w: 8.5 * PPI2, h: 11 * PPI2 };
85685
+ const standardLandscape = { w: 11 * PPI2, h: 8.5 * PPI2 };
85686
+ const orientationDefault = pageOrientation === "landscape" ? standardLandscape : standardPortrait;
85687
+ const pageWidthPx = page.size?.w ?? orientationDefault.w;
85688
+ const pageHeightPx = page.size?.h ?? orientationDefault.h;
85689
+ const marginLeftPx = page.margins?.left ?? safeMargins.left * PPI2;
85690
+ const marginRightPx = page.margins?.right ?? safeMargins.right * PPI2;
85691
+ const marginTopPx = page.margins?.top ?? safeMargins.top * PPI2;
85692
+ const marginBottomPx = page.margins?.bottom ?? safeMargins.bottom * PPI2;
85693
+ return {
85694
+ pageSize: {
85695
+ width: pageWidthPx / PPI2,
85696
+ height: pageHeightPx / PPI2
85697
+ },
85698
+ pageMargins: {
85699
+ left: marginLeftPx / PPI2,
85700
+ right: marginRightPx / PPI2,
85701
+ top: marginTopPx / PPI2,
85702
+ bottom: marginBottomPx / PPI2
85703
+ },
85704
+ sectionIndex: page.sectionIndex ?? 0,
85705
+ orientation: pageOrientation
85706
+ };
85707
+ }
85640
85708
  /**
85641
85709
  * Get current remote cursor states (normalized to absolute PM positions).
85642
85710
  * Returns an array of cursor states for all remote collaborators, excluding the local user.
@@ -88531,9 +88599,26 @@ getCurrentPageIndex_fn = function() {
88531
88599
  }
88532
88600
  const layout = __privateGet$1(this, _layoutState).layout;
88533
88601
  const selection = __privateGet$1(this, _editor3).state?.selection;
88534
- if (!layout || !selection) return 0;
88602
+ if (!layout || !selection) {
88603
+ return 0;
88604
+ }
88535
88605
  const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, selection.from, selection.to) ?? [];
88536
- return rects[0]?.pageIndex ?? 0;
88606
+ if (rects.length > 0) {
88607
+ return rects[0]?.pageIndex ?? 0;
88608
+ }
88609
+ const pos = selection.from;
88610
+ for (let pageIdx = 0; pageIdx < layout.pages.length; pageIdx++) {
88611
+ const page = layout.pages[pageIdx];
88612
+ for (const fragment of page.fragments) {
88613
+ const frag = fragment;
88614
+ if (frag.pmStart != null && frag.pmEnd != null) {
88615
+ if (pos >= frag.pmStart && pos <= frag.pmEnd) {
88616
+ return pageIdx;
88617
+ }
88618
+ }
88619
+ }
88620
+ }
88621
+ return 0;
88537
88622
  };
88538
88623
  findRegionForPage_fn = function(kind, pageIndex) {
88539
88624
  const map22 = kind === "header" ? __privateGet$1(this, _headerRegions) : __privateGet$1(this, _footerRegions);
@@ -123268,6 +123353,7 @@ const _sfc_main$6 = {
123268
123353
  const rulerHandleActiveColor = ref$1("#2563EB66");
123269
123354
  const pageSize = ref$1(null);
123270
123355
  const pageMargins = ref$1(null);
123356
+ const currentSectionIndex = ref$1(0);
123271
123357
  const isDragging = ref$1(false);
123272
123358
  const currentHandle = ref$1(null);
123273
123359
  const leftHandle = reactive({ side: "left", x: 0 });
@@ -123275,9 +123361,29 @@ const _sfc_main$6 = {
123275
123361
  const showVerticalIndicator = ref$1(false);
123276
123362
  const initialX = ref$1(0);
123277
123363
  let offsetX = 0;
123278
- const initRuler = () => {
123279
- if (props.editor.options.mode !== "docx") return null;
123280
- const { pageMargins: docMargins, pageSize: docSize } = props.editor.getPageStyles();
123364
+ let selectionUpdateHandler = null;
123365
+ const getPresentationEditor = () => {
123366
+ return props.editor?.presentationEditor ?? null;
123367
+ };
123368
+ const updateRulerForCurrentSection = () => {
123369
+ if (!props.editor || props.editor.options?.mode !== "docx") return;
123370
+ const presentationEditor = getPresentationEditor();
123371
+ let docSize, docMargins, sectionIndex;
123372
+ if (presentationEditor && typeof presentationEditor.getCurrentSectionPageStyles === "function") {
123373
+ const sectionStyles = presentationEditor.getCurrentSectionPageStyles();
123374
+ docSize = sectionStyles.pageSize;
123375
+ docMargins = sectionStyles.pageMargins;
123376
+ sectionIndex = sectionStyles.sectionIndex;
123377
+ } else {
123378
+ const styles = props.editor.getPageStyles();
123379
+ docSize = styles.pageSize ?? { width: 8.5, height: 11 };
123380
+ docMargins = styles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
123381
+ sectionIndex = 0;
123382
+ }
123383
+ if (pageSize.value && currentSectionIndex.value === sectionIndex) {
123384
+ return;
123385
+ }
123386
+ currentSectionIndex.value = sectionIndex;
123281
123387
  pageSize.value = docSize;
123282
123388
  pageMargins.value = docMargins;
123283
123389
  const definition = generateRulerDefinition({
@@ -123291,7 +123397,7 @@ const _sfc_main$6 = {
123291
123397
  });
123292
123398
  leftHandle.x = definition.leftMarginPx;
123293
123399
  rightHandle.x = definition.rightMarginPx;
123294
- return definition;
123400
+ rulerDefinition.value = definition;
123295
123401
  };
123296
123402
  const getTickStyle = computed(() => (tick) => {
123297
123403
  return {
@@ -123345,7 +123451,8 @@ const _sfc_main$6 = {
123345
123451
  const marginValue = getNewMarginValue();
123346
123452
  emit("margin-change", {
123347
123453
  side: currentHandle.value.side,
123348
- value: marginValue
123454
+ value: marginValue,
123455
+ sectionIndex: currentSectionIndex.value
123349
123456
  });
123350
123457
  }
123351
123458
  };
@@ -123369,12 +123476,40 @@ const _sfc_main$6 = {
123369
123476
  "--ruler-width": `${width}px`
123370
123477
  };
123371
123478
  });
123479
+ const handleSelectionUpdate = () => {
123480
+ if (isDragging.value) return;
123481
+ updateRulerForCurrentSection();
123482
+ };
123483
+ const setupEditorListeners = () => {
123484
+ if (!props.editor) return;
123485
+ selectionUpdateHandler = handleSelectionUpdate;
123486
+ props.editor.on("selectionUpdate", selectionUpdateHandler);
123487
+ };
123488
+ const cleanupEditorListeners = () => {
123489
+ if (!props.editor || !selectionUpdateHandler) return;
123490
+ props.editor.off("selectionUpdate", selectionUpdateHandler);
123491
+ selectionUpdateHandler = null;
123492
+ };
123493
+ watch(
123494
+ () => props.editor,
123495
+ (newEditor, oldEditor) => {
123496
+ if (oldEditor && selectionUpdateHandler) {
123497
+ oldEditor.off("selectionUpdate", selectionUpdateHandler);
123498
+ }
123499
+ if (newEditor) {
123500
+ setupEditorListeners();
123501
+ updateRulerForCurrentSection();
123502
+ }
123503
+ }
123504
+ );
123372
123505
  onMounted(() => {
123373
- rulerDefinition.value = initRuler();
123506
+ updateRulerForCurrentSection();
123507
+ setupEditorListeners();
123374
123508
  window.addEventListener("mousemove", handleMouseMove2);
123375
123509
  window.addEventListener("mouseup", handleMouseUp);
123376
123510
  });
123377
123511
  onUnmounted(() => {
123512
+ cleanupEditorListeners();
123378
123513
  window.removeEventListener("mousemove", handleMouseMove2);
123379
123514
  window.removeEventListener("mouseup", handleMouseUp);
123380
123515
  });
@@ -123415,7 +123550,7 @@ const _sfc_main$6 = {
123415
123550
  };
123416
123551
  }
123417
123552
  };
123418
- const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-b9f4f30a"]]);
123553
+ const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-0d1b9cd1"]]);
123419
123554
  const _sfc_main$5 = {
123420
123555
  __name: "GenericPopover",
123421
123556
  props: {
@@ -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.72") {
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.72";
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-qXb-Hmel-BPsIpdLY.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.72");
60513
60513
  if (!this.options.ydoc) return;
60514
60514
  const metaMap = this.options.ydoc.getMap("meta");
60515
60515
  let docVersion = metaMap.get("version");
@@ -85654,6 +85654,74 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
85654
85654
  getLayoutOptions() {
85655
85655
  return { ...__privateGet$1(this, _layoutOptions) };
85656
85656
  }
85657
+ /**
85658
+ * Get the page styles for the section containing the current caret position.
85659
+ *
85660
+ * In multi-section documents, different sections can have different page sizes,
85661
+ * margins, and orientations. This method returns the styles for the section
85662
+ * where the caret is currently located, enabling section-aware UI components
85663
+ * like rulers to display accurate information.
85664
+ *
85665
+ * @returns Object containing:
85666
+ * - pageSize: { width, height } in inches
85667
+ * - pageMargins: { left, right, top, bottom } in inches
85668
+ * - sectionIndex: The current section index (0-based)
85669
+ * - orientation: 'portrait' or 'landscape'
85670
+ *
85671
+ * Falls back to document-level defaults if section info is unavailable.
85672
+ *
85673
+ * @example
85674
+ * ```typescript
85675
+ * const sectionStyles = presentation.getCurrentSectionPageStyles();
85676
+ * console.log(`Section ${sectionStyles.sectionIndex}: ${sectionStyles.pageSize.width}" x ${sectionStyles.pageSize.height}"`);
85677
+ * ```
85678
+ */
85679
+ getCurrentSectionPageStyles() {
85680
+ const PPI2 = 96;
85681
+ const layout = __privateGet$1(this, _layoutState).layout;
85682
+ const pageIndex = __privateMethod$1(this, _PresentationEditor_instances, getCurrentPageIndex_fn).call(this);
85683
+ const page = layout?.pages?.[pageIndex];
85684
+ const converterStyles = __privateGet$1(this, _editor3).converter?.pageStyles ?? {};
85685
+ const defaultMargins = converterStyles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
85686
+ const safeMargins = {
85687
+ left: typeof defaultMargins.left === "number" ? defaultMargins.left : 1,
85688
+ right: typeof defaultMargins.right === "number" ? defaultMargins.right : 1,
85689
+ top: typeof defaultMargins.top === "number" ? defaultMargins.top : 1,
85690
+ bottom: typeof defaultMargins.bottom === "number" ? defaultMargins.bottom : 1
85691
+ };
85692
+ if (!page) {
85693
+ return {
85694
+ pageSize: { width: 8.5, height: 11 },
85695
+ pageMargins: safeMargins,
85696
+ sectionIndex: 0,
85697
+ orientation: "portrait"
85698
+ };
85699
+ }
85700
+ const pageOrientation = page.orientation === "landscape" || page.orientation === "portrait" ? page.orientation : "portrait";
85701
+ const standardPortrait = { w: 8.5 * PPI2, h: 11 * PPI2 };
85702
+ const standardLandscape = { w: 11 * PPI2, h: 8.5 * PPI2 };
85703
+ const orientationDefault = pageOrientation === "landscape" ? standardLandscape : standardPortrait;
85704
+ const pageWidthPx = page.size?.w ?? orientationDefault.w;
85705
+ const pageHeightPx = page.size?.h ?? orientationDefault.h;
85706
+ const marginLeftPx = page.margins?.left ?? safeMargins.left * PPI2;
85707
+ const marginRightPx = page.margins?.right ?? safeMargins.right * PPI2;
85708
+ const marginTopPx = page.margins?.top ?? safeMargins.top * PPI2;
85709
+ const marginBottomPx = page.margins?.bottom ?? safeMargins.bottom * PPI2;
85710
+ return {
85711
+ pageSize: {
85712
+ width: pageWidthPx / PPI2,
85713
+ height: pageHeightPx / PPI2
85714
+ },
85715
+ pageMargins: {
85716
+ left: marginLeftPx / PPI2,
85717
+ right: marginRightPx / PPI2,
85718
+ top: marginTopPx / PPI2,
85719
+ bottom: marginBottomPx / PPI2
85720
+ },
85721
+ sectionIndex: page.sectionIndex ?? 0,
85722
+ orientation: pageOrientation
85723
+ };
85724
+ }
85657
85725
  /**
85658
85726
  * Get current remote cursor states (normalized to absolute PM positions).
85659
85727
  * Returns an array of cursor states for all remote collaborators, excluding the local user.
@@ -88548,9 +88616,26 @@ getCurrentPageIndex_fn = function() {
88548
88616
  }
88549
88617
  const layout = __privateGet$1(this, _layoutState).layout;
88550
88618
  const selection = __privateGet$1(this, _editor3).state?.selection;
88551
- if (!layout || !selection) return 0;
88619
+ if (!layout || !selection) {
88620
+ return 0;
88621
+ }
88552
88622
  const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, selection.from, selection.to) ?? [];
88553
- return rects[0]?.pageIndex ?? 0;
88623
+ if (rects.length > 0) {
88624
+ return rects[0]?.pageIndex ?? 0;
88625
+ }
88626
+ const pos = selection.from;
88627
+ for (let pageIdx = 0; pageIdx < layout.pages.length; pageIdx++) {
88628
+ const page = layout.pages[pageIdx];
88629
+ for (const fragment of page.fragments) {
88630
+ const frag = fragment;
88631
+ if (frag.pmStart != null && frag.pmEnd != null) {
88632
+ if (pos >= frag.pmStart && pos <= frag.pmEnd) {
88633
+ return pageIdx;
88634
+ }
88635
+ }
88636
+ }
88637
+ }
88638
+ return 0;
88554
88639
  };
88555
88640
  findRegionForPage_fn = function(kind, pageIndex) {
88556
88641
  const map22 = kind === "header" ? __privateGet$1(this, _headerRegions) : __privateGet$1(this, _footerRegions);
@@ -123285,6 +123370,7 @@ const _sfc_main$6 = {
123285
123370
  const rulerHandleActiveColor = vue.ref("#2563EB66");
123286
123371
  const pageSize = vue.ref(null);
123287
123372
  const pageMargins = vue.ref(null);
123373
+ const currentSectionIndex = vue.ref(0);
123288
123374
  const isDragging = vue.ref(false);
123289
123375
  const currentHandle = vue.ref(null);
123290
123376
  const leftHandle = vue.reactive({ side: "left", x: 0 });
@@ -123292,9 +123378,29 @@ const _sfc_main$6 = {
123292
123378
  const showVerticalIndicator = vue.ref(false);
123293
123379
  const initialX = vue.ref(0);
123294
123380
  let offsetX = 0;
123295
- const initRuler = () => {
123296
- if (props.editor.options.mode !== "docx") return null;
123297
- const { pageMargins: docMargins, pageSize: docSize } = props.editor.getPageStyles();
123381
+ let selectionUpdateHandler = null;
123382
+ const getPresentationEditor = () => {
123383
+ return props.editor?.presentationEditor ?? null;
123384
+ };
123385
+ const updateRulerForCurrentSection = () => {
123386
+ if (!props.editor || props.editor.options?.mode !== "docx") return;
123387
+ const presentationEditor = getPresentationEditor();
123388
+ let docSize, docMargins, sectionIndex;
123389
+ if (presentationEditor && typeof presentationEditor.getCurrentSectionPageStyles === "function") {
123390
+ const sectionStyles = presentationEditor.getCurrentSectionPageStyles();
123391
+ docSize = sectionStyles.pageSize;
123392
+ docMargins = sectionStyles.pageMargins;
123393
+ sectionIndex = sectionStyles.sectionIndex;
123394
+ } else {
123395
+ const styles = props.editor.getPageStyles();
123396
+ docSize = styles.pageSize ?? { width: 8.5, height: 11 };
123397
+ docMargins = styles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
123398
+ sectionIndex = 0;
123399
+ }
123400
+ if (pageSize.value && currentSectionIndex.value === sectionIndex) {
123401
+ return;
123402
+ }
123403
+ currentSectionIndex.value = sectionIndex;
123298
123404
  pageSize.value = docSize;
123299
123405
  pageMargins.value = docMargins;
123300
123406
  const definition = generateRulerDefinition({
@@ -123308,7 +123414,7 @@ const _sfc_main$6 = {
123308
123414
  });
123309
123415
  leftHandle.x = definition.leftMarginPx;
123310
123416
  rightHandle.x = definition.rightMarginPx;
123311
- return definition;
123417
+ rulerDefinition.value = definition;
123312
123418
  };
123313
123419
  const getTickStyle = vue.computed(() => (tick) => {
123314
123420
  return {
@@ -123362,7 +123468,8 @@ const _sfc_main$6 = {
123362
123468
  const marginValue = getNewMarginValue();
123363
123469
  emit("margin-change", {
123364
123470
  side: currentHandle.value.side,
123365
- value: marginValue
123471
+ value: marginValue,
123472
+ sectionIndex: currentSectionIndex.value
123366
123473
  });
123367
123474
  }
123368
123475
  };
@@ -123386,12 +123493,40 @@ const _sfc_main$6 = {
123386
123493
  "--ruler-width": `${width}px`
123387
123494
  };
123388
123495
  });
123496
+ const handleSelectionUpdate = () => {
123497
+ if (isDragging.value) return;
123498
+ updateRulerForCurrentSection();
123499
+ };
123500
+ const setupEditorListeners = () => {
123501
+ if (!props.editor) return;
123502
+ selectionUpdateHandler = handleSelectionUpdate;
123503
+ props.editor.on("selectionUpdate", selectionUpdateHandler);
123504
+ };
123505
+ const cleanupEditorListeners = () => {
123506
+ if (!props.editor || !selectionUpdateHandler) return;
123507
+ props.editor.off("selectionUpdate", selectionUpdateHandler);
123508
+ selectionUpdateHandler = null;
123509
+ };
123510
+ vue.watch(
123511
+ () => props.editor,
123512
+ (newEditor, oldEditor) => {
123513
+ if (oldEditor && selectionUpdateHandler) {
123514
+ oldEditor.off("selectionUpdate", selectionUpdateHandler);
123515
+ }
123516
+ if (newEditor) {
123517
+ setupEditorListeners();
123518
+ updateRulerForCurrentSection();
123519
+ }
123520
+ }
123521
+ );
123389
123522
  vue.onMounted(() => {
123390
- rulerDefinition.value = initRuler();
123523
+ updateRulerForCurrentSection();
123524
+ setupEditorListeners();
123391
123525
  window.addEventListener("mousemove", handleMouseMove2);
123392
123526
  window.addEventListener("mouseup", handleMouseUp);
123393
123527
  });
123394
123528
  vue.onUnmounted(() => {
123529
+ cleanupEditorListeners();
123395
123530
  window.removeEventListener("mousemove", handleMouseMove2);
123396
123531
  window.removeEventListener("mouseup", handleMouseUp);
123397
123532
  });
@@ -123432,7 +123567,7 @@ const _sfc_main$6 = {
123432
123567
  };
123433
123568
  }
123434
123569
  };
123435
- const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-b9f4f30a"]]);
123570
+ const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-0d1b9cd1"]]);
123436
123571
  const _sfc_main$5 = {
123437
123572
  __name: "GenericPopover",
123438
123573
  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-JlOFMM88.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-CNzx36Ms.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.72") {
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-JlOFMM88.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
  }