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
@@ -42327,7 +42327,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42327
42327
  static getStoredSuperdocVersion(docx) {
42328
42328
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42329
42329
  }
42330
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.71") {
42330
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.72") {
42331
42331
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42332
42332
  }
42333
42333
  /**
@@ -67373,7 +67373,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67373
67373
  const shouldSkipNodeView = (editor) => {
67374
67374
  return isHeadless(editor);
67375
67375
  };
67376
- const summaryVersion = "1.0.0-beta.71";
67376
+ const summaryVersion = "1.0.0-beta.72";
67377
67377
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67378
67378
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67379
67379
  function mapAttributes(attrs) {
@@ -68162,7 +68162,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68162
68162
  { default: remarkStringify2 },
68163
68163
  { default: remarkGfm2 }
68164
68164
  ] = await Promise.all([
68165
- Promise.resolve().then(() => indexDNdPLYmc),
68165
+ Promise.resolve().then(() => indexQXbHmel),
68166
68166
  Promise.resolve().then(() => indexDRCvimau),
68167
68167
  Promise.resolve().then(() => indexC_x_N6Uh),
68168
68168
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68367,7 +68367,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68367
68367
  * Process collaboration migrations
68368
68368
  */
68369
68369
  processCollaborationMigrations() {
68370
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.71");
68370
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.72");
68371
68371
  if (!this.options.ydoc) return;
68372
68372
  const metaMap = this.options.ydoc.getMap("meta");
68373
68373
  let docVersion = metaMap.get("version");
@@ -93512,6 +93512,74 @@ ${l}
93512
93512
  getLayoutOptions() {
93513
93513
  return { ...__privateGet$1(this, _layoutOptions) };
93514
93514
  }
93515
+ /**
93516
+ * Get the page styles for the section containing the current caret position.
93517
+ *
93518
+ * In multi-section documents, different sections can have different page sizes,
93519
+ * margins, and orientations. This method returns the styles for the section
93520
+ * where the caret is currently located, enabling section-aware UI components
93521
+ * like rulers to display accurate information.
93522
+ *
93523
+ * @returns Object containing:
93524
+ * - pageSize: { width, height } in inches
93525
+ * - pageMargins: { left, right, top, bottom } in inches
93526
+ * - sectionIndex: The current section index (0-based)
93527
+ * - orientation: 'portrait' or 'landscape'
93528
+ *
93529
+ * Falls back to document-level defaults if section info is unavailable.
93530
+ *
93531
+ * @example
93532
+ * ```typescript
93533
+ * const sectionStyles = presentation.getCurrentSectionPageStyles();
93534
+ * console.log(`Section ${sectionStyles.sectionIndex}: ${sectionStyles.pageSize.width}" x ${sectionStyles.pageSize.height}"`);
93535
+ * ```
93536
+ */
93537
+ getCurrentSectionPageStyles() {
93538
+ const PPI2 = 96;
93539
+ const layout = __privateGet$1(this, _layoutState).layout;
93540
+ const pageIndex = __privateMethod$1(this, _PresentationEditor_instances, getCurrentPageIndex_fn).call(this);
93541
+ const page = layout?.pages?.[pageIndex];
93542
+ const converterStyles = __privateGet$1(this, _editor3).converter?.pageStyles ?? {};
93543
+ const defaultMargins = converterStyles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
93544
+ const safeMargins = {
93545
+ left: typeof defaultMargins.left === "number" ? defaultMargins.left : 1,
93546
+ right: typeof defaultMargins.right === "number" ? defaultMargins.right : 1,
93547
+ top: typeof defaultMargins.top === "number" ? defaultMargins.top : 1,
93548
+ bottom: typeof defaultMargins.bottom === "number" ? defaultMargins.bottom : 1
93549
+ };
93550
+ if (!page) {
93551
+ return {
93552
+ pageSize: { width: 8.5, height: 11 },
93553
+ pageMargins: safeMargins,
93554
+ sectionIndex: 0,
93555
+ orientation: "portrait"
93556
+ };
93557
+ }
93558
+ const pageOrientation = page.orientation === "landscape" || page.orientation === "portrait" ? page.orientation : "portrait";
93559
+ const standardPortrait = { w: 8.5 * PPI2, h: 11 * PPI2 };
93560
+ const standardLandscape = { w: 11 * PPI2, h: 8.5 * PPI2 };
93561
+ const orientationDefault = pageOrientation === "landscape" ? standardLandscape : standardPortrait;
93562
+ const pageWidthPx = page.size?.w ?? orientationDefault.w;
93563
+ const pageHeightPx = page.size?.h ?? orientationDefault.h;
93564
+ const marginLeftPx = page.margins?.left ?? safeMargins.left * PPI2;
93565
+ const marginRightPx = page.margins?.right ?? safeMargins.right * PPI2;
93566
+ const marginTopPx = page.margins?.top ?? safeMargins.top * PPI2;
93567
+ const marginBottomPx = page.margins?.bottom ?? safeMargins.bottom * PPI2;
93568
+ return {
93569
+ pageSize: {
93570
+ width: pageWidthPx / PPI2,
93571
+ height: pageHeightPx / PPI2
93572
+ },
93573
+ pageMargins: {
93574
+ left: marginLeftPx / PPI2,
93575
+ right: marginRightPx / PPI2,
93576
+ top: marginTopPx / PPI2,
93577
+ bottom: marginBottomPx / PPI2
93578
+ },
93579
+ sectionIndex: page.sectionIndex ?? 0,
93580
+ orientation: pageOrientation
93581
+ };
93582
+ }
93515
93583
  /**
93516
93584
  * Get current remote cursor states (normalized to absolute PM positions).
93517
93585
  * Returns an array of cursor states for all remote collaborators, excluding the local user.
@@ -96406,9 +96474,26 @@ ${l}
96406
96474
  }
96407
96475
  const layout = __privateGet$1(this, _layoutState).layout;
96408
96476
  const selection = __privateGet$1(this, _editor3).state?.selection;
96409
- if (!layout || !selection) return 0;
96477
+ if (!layout || !selection) {
96478
+ return 0;
96479
+ }
96410
96480
  const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, selection.from, selection.to) ?? [];
96411
- return rects[0]?.pageIndex ?? 0;
96481
+ if (rects.length > 0) {
96482
+ return rects[0]?.pageIndex ?? 0;
96483
+ }
96484
+ const pos = selection.from;
96485
+ for (let pageIdx = 0; pageIdx < layout.pages.length; pageIdx++) {
96486
+ const page = layout.pages[pageIdx];
96487
+ for (const fragment of page.fragments) {
96488
+ const frag = fragment;
96489
+ if (frag.pmStart != null && frag.pmEnd != null) {
96490
+ if (pos >= frag.pmStart && pos <= frag.pmEnd) {
96491
+ return pageIdx;
96492
+ }
96493
+ }
96494
+ }
96495
+ }
96496
+ return 0;
96412
96497
  };
96413
96498
  findRegionForPage_fn = function(kind, pageIndex) {
96414
96499
  const map2 = kind === "header" ? __privateGet$1(this, _headerRegions) : __privateGet$1(this, _footerRegions);
@@ -131116,6 +131201,7 @@ ${style2}
131116
131201
  const rulerHandleActiveColor = ref("#2563EB66");
131117
131202
  const pageSize = ref(null);
131118
131203
  const pageMargins = ref(null);
131204
+ const currentSectionIndex = ref(0);
131119
131205
  const isDragging = ref(false);
131120
131206
  const currentHandle = ref(null);
131121
131207
  const leftHandle = reactive({ side: "left", x: 0 });
@@ -131123,9 +131209,29 @@ ${style2}
131123
131209
  const showVerticalIndicator = ref(false);
131124
131210
  const initialX = ref(0);
131125
131211
  let offsetX = 0;
131126
- const initRuler = () => {
131127
- if (props.editor.options.mode !== "docx") return null;
131128
- const { pageMargins: docMargins, pageSize: docSize } = props.editor.getPageStyles();
131212
+ let selectionUpdateHandler = null;
131213
+ const getPresentationEditor = () => {
131214
+ return props.editor?.presentationEditor ?? null;
131215
+ };
131216
+ const updateRulerForCurrentSection = () => {
131217
+ if (!props.editor || props.editor.options?.mode !== "docx") return;
131218
+ const presentationEditor = getPresentationEditor();
131219
+ let docSize, docMargins, sectionIndex;
131220
+ if (presentationEditor && typeof presentationEditor.getCurrentSectionPageStyles === "function") {
131221
+ const sectionStyles = presentationEditor.getCurrentSectionPageStyles();
131222
+ docSize = sectionStyles.pageSize;
131223
+ docMargins = sectionStyles.pageMargins;
131224
+ sectionIndex = sectionStyles.sectionIndex;
131225
+ } else {
131226
+ const styles = props.editor.getPageStyles();
131227
+ docSize = styles.pageSize ?? { width: 8.5, height: 11 };
131228
+ docMargins = styles.pageMargins ?? { left: 1, right: 1, top: 1, bottom: 1 };
131229
+ sectionIndex = 0;
131230
+ }
131231
+ if (pageSize.value && currentSectionIndex.value === sectionIndex) {
131232
+ return;
131233
+ }
131234
+ currentSectionIndex.value = sectionIndex;
131129
131235
  pageSize.value = docSize;
131130
131236
  pageMargins.value = docMargins;
131131
131237
  const definition2 = generateRulerDefinition({
@@ -131139,7 +131245,7 @@ ${style2}
131139
131245
  });
131140
131246
  leftHandle.x = definition2.leftMarginPx;
131141
131247
  rightHandle.x = definition2.rightMarginPx;
131142
- return definition2;
131248
+ rulerDefinition.value = definition2;
131143
131249
  };
131144
131250
  const getTickStyle = computed(() => (tick) => {
131145
131251
  return {
@@ -131193,7 +131299,8 @@ ${style2}
131193
131299
  const marginValue = getNewMarginValue();
131194
131300
  emit2("margin-change", {
131195
131301
  side: currentHandle.value.side,
131196
- value: marginValue
131302
+ value: marginValue,
131303
+ sectionIndex: currentSectionIndex.value
131197
131304
  });
131198
131305
  }
131199
131306
  };
@@ -131217,12 +131324,40 @@ ${style2}
131217
131324
  "--ruler-width": `${width}px`
131218
131325
  };
131219
131326
  });
131327
+ const handleSelectionUpdate = () => {
131328
+ if (isDragging.value) return;
131329
+ updateRulerForCurrentSection();
131330
+ };
131331
+ const setupEditorListeners = () => {
131332
+ if (!props.editor) return;
131333
+ selectionUpdateHandler = handleSelectionUpdate;
131334
+ props.editor.on("selectionUpdate", selectionUpdateHandler);
131335
+ };
131336
+ const cleanupEditorListeners = () => {
131337
+ if (!props.editor || !selectionUpdateHandler) return;
131338
+ props.editor.off("selectionUpdate", selectionUpdateHandler);
131339
+ selectionUpdateHandler = null;
131340
+ };
131341
+ watch(
131342
+ () => props.editor,
131343
+ (newEditor, oldEditor) => {
131344
+ if (oldEditor && selectionUpdateHandler) {
131345
+ oldEditor.off("selectionUpdate", selectionUpdateHandler);
131346
+ }
131347
+ if (newEditor) {
131348
+ setupEditorListeners();
131349
+ updateRulerForCurrentSection();
131350
+ }
131351
+ }
131352
+ );
131220
131353
  onMounted(() => {
131221
- rulerDefinition.value = initRuler();
131354
+ updateRulerForCurrentSection();
131355
+ setupEditorListeners();
131222
131356
  window.addEventListener("mousemove", handleMouseMove2);
131223
131357
  window.addEventListener("mouseup", handleMouseUp);
131224
131358
  });
131225
131359
  onUnmounted(() => {
131360
+ cleanupEditorListeners();
131226
131361
  window.removeEventListener("mousemove", handleMouseMove2);
131227
131362
  window.removeEventListener("mouseup", handleMouseUp);
131228
131363
  });
@@ -131263,7 +131398,7 @@ ${style2}
131263
131398
  };
131264
131399
  }
131265
131400
  };
131266
- const Ruler = /* @__PURE__ */ _export_sfc$1(_sfc_main$6$1, [["__scopeId", "data-v-b9f4f30a"]]);
131401
+ const Ruler = /* @__PURE__ */ _export_sfc$1(_sfc_main$6$1, [["__scopeId", "data-v-0d1b9cd1"]]);
131267
131402
  const _sfc_main$5$1 = {
131268
131403
  __name: "GenericPopover",
131269
131404
  props: {
@@ -150253,7 +150388,7 @@ ${style2}
150253
150388
  this.config.colors = shuffleArray(this.config.colors);
150254
150389
  this.userColorMap = /* @__PURE__ */ new Map();
150255
150390
  this.colorIndex = 0;
150256
- this.version = "1.0.0-beta.71";
150391
+ this.version = "1.0.0-beta.72";
150257
150392
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
150258
150393
  this.superdocId = config2.superdocId || v4();
150259
150394
  this.colors = this.config.colors;
@@ -152725,7 +152860,7 @@ ${style2}
152725
152860
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
152726
152861
  );
152727
152862
  }
152728
- const indexDNdPLYmc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
152863
+ const indexQXbHmel = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
152729
152864
  __proto__: null,
152730
152865
  unified
152731
152866
  }, Symbol.toStringTag, { value: "Module" }));