superdoc 1.1.0 → 1.1.1

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-BgOzYGGE.es.js → PdfViewer-C1zFzMbc.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-ClRuoPWm.cjs → PdfViewer-CM7Xv_EB.cjs} +1 -1
  3. package/dist/chunks/{index-LKlY0uOW-D_ZqJ-GU.es.js → index-BTh-y1Z8-DbitXhC4.es.js} +1 -1
  4. package/dist/chunks/{index-LKlY0uOW-B70pXIte.cjs → index-BTh-y1Z8-cfF8oFrC.cjs} +1 -1
  5. package/dist/chunks/{index-BKEi2CRJ.es.js → index-BoBf0NbC.es.js} +3 -3
  6. package/dist/chunks/{index-35PXpdi_.cjs → index-DcTiDrZR.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-Dt3pSUMk.es.js → super-editor.es-CcRgDiI0.es.js} +105 -48
  8. package/dist/chunks/{super-editor.es-COhOfA81.cjs → super-editor.es-DVbzpPdX.cjs} +105 -48
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CB_4LqhI.js → converter-r8fFrCoG.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-0-ibLeHA.js → docx-zipper-Cdo7N4G3.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-BKIkgBE0.js → editor-BYC5b9i-.js} +106 -49
  13. package/dist/super-editor/chunks/{index-LKlY0uOW.js → index-BTh-y1Z8.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CfarRdhy.js → toolbar-Bn9n_w-F.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +107 -50
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { y as defineComponent, A as h, P as Transition, a0 as process$1, K as watchEffect, a as computed, r as ref, j as onMounted, X as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, s as createVNode, x as unref } from "./vue-CLFbn_1r.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-BKEi2CRJ.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-BoBf0NbC.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-gvuFr0vx.cjs");
4
- const superdoc = require("./index-35PXpdi_.cjs");
4
+ const superdoc = require("./index-DcTiDrZR.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-Dt3pSUMk.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-CcRgDiI0.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -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-COhOfA81.cjs");
3
+ const superEditor_es = require("./super-editor.es-DVbzpPdX.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 { 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-Dt3pSUMk.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-CcRgDiI0.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-D_2kqkfV.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -17470,7 +17470,7 @@ const _sfc_main = {
17470
17470
  __name: "SuperDoc",
17471
17471
  emits: ["selection-update"],
17472
17472
  setup(__props, { emit: __emit }) {
17473
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BgOzYGGE.es.js"));
17473
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-C1zFzMbc.es.js"));
17474
17474
  const superdocStore = useSuperdocStore();
17475
17475
  const commentsStore = useCommentsStore();
17476
17476
  const {
@@ -18374,7 +18374,7 @@ class SuperDoc extends EventEmitter {
18374
18374
  this.config.colors = shuffleArray(this.config.colors);
18375
18375
  this.userColorMap = /* @__PURE__ */ new Map();
18376
18376
  this.colorIndex = 0;
18377
- this.version = "1.1.0";
18377
+ this.version = "1.1.1";
18378
18378
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18379
18379
  this.superdocId = config.superdocId || v4();
18380
18380
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-COhOfA81.cjs");
2
+ const superEditor_es = require("./super-editor.es-DVbzpPdX.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-DIclNhoR.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -17487,7 +17487,7 @@ const _sfc_main = {
17487
17487
  __name: "SuperDoc",
17488
17488
  emits: ["selection-update"],
17489
17489
  setup(__props, { emit: __emit }) {
17490
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-ClRuoPWm.cjs")));
17490
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CM7Xv_EB.cjs")));
17491
17491
  const superdocStore = useSuperdocStore();
17492
17492
  const commentsStore = useCommentsStore();
17493
17493
  const {
@@ -18391,7 +18391,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18391
18391
  this.config.colors = shuffleArray(this.config.colors);
18392
18392
  this.userColorMap = /* @__PURE__ */ new Map();
18393
18393
  this.colorIndex = 0;
18394
- this.version = "1.1.0";
18394
+ this.version = "1.1.1";
18395
18395
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18396
18396
  this.superdocId = config.superdocId || uuid.v4();
18397
18397
  this.colors = this.config.colors;
@@ -42410,7 +42410,7 @@ const _SuperConverter = class _SuperConverter2 {
42410
42410
  static getStoredSuperdocVersion(docx) {
42411
42411
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42412
42412
  }
42413
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.1.0") {
42413
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.1.1") {
42414
42414
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42415
42415
  }
42416
42416
  /**
@@ -60491,7 +60491,7 @@ const isHeadless = (editor) => {
60491
60491
  const shouldSkipNodeView = (editor) => {
60492
60492
  return isHeadless(editor);
60493
60493
  };
60494
- const summaryVersion = "1.1.0";
60494
+ const summaryVersion = "1.1.1";
60495
60495
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
60496
60496
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
60497
60497
  function mapAttributes(attrs) {
@@ -61280,7 +61280,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61280
61280
  { default: remarkStringify },
61281
61281
  { default: remarkGfm }
61282
61282
  ] = await Promise.all([
61283
- import("./index-LKlY0uOW-D_ZqJ-GU.es.js"),
61283
+ import("./index-BTh-y1Z8-DbitXhC4.es.js"),
61284
61284
  import("./index-DRCvimau-Cw339678.es.js"),
61285
61285
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
61286
61286
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -61485,7 +61485,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61485
61485
  * Process collaboration migrations
61486
61486
  */
61487
61487
  processCollaborationMigrations() {
61488
- console.debug("[checkVersionMigrations] Current editor version", "1.1.0");
61488
+ console.debug("[checkVersionMigrations] Current editor version", "1.1.1");
61489
61489
  if (!this.options.ydoc) return;
61490
61490
  const metaMap = this.options.ydoc.getMap("meta");
61491
61491
  let docVersion = metaMap.get("version");
@@ -75041,13 +75041,13 @@ function scheduleSectionBreak(block, state2, baseMargins, maxHeaderContentHeight
75041
75041
  if (maxHeaderContentHeight > 0) {
75042
75042
  return Math.max(baseTop, headerDistance + maxHeaderContentHeight);
75043
75043
  }
75044
- return Math.max(baseTop, headerDistance);
75044
+ return baseTop;
75045
75045
  };
75046
75046
  const calcRequiredBottomMargin = (footerDistance, baseBottom) => {
75047
75047
  if (maxFooterContentHeight > 0) {
75048
75048
  return Math.max(baseBottom, footerDistance + maxFooterContentHeight);
75049
75049
  }
75050
- return Math.max(baseBottom, footerDistance);
75050
+ return baseBottom;
75051
75051
  };
75052
75052
  if (block.attrs?.isFirstSection && !next.hasAnyPages) {
75053
75053
  if (block.pageSize) {
@@ -75548,6 +75548,11 @@ function layoutParagraphBlock(ctx2, anchors) {
75548
75548
  const prevTrailing = state2.trailingSpacing ?? 0;
75549
75549
  const neededSpacingBefore = Math.max(spacingBefore - prevTrailing, 0);
75550
75550
  if (state2.cursorY + neededSpacingBefore > state2.contentBottom) {
75551
+ if (state2.cursorY <= state2.topMargin) {
75552
+ state2.trailingSpacing = 0;
75553
+ appliedSpacingBefore = true;
75554
+ break;
75555
+ }
75551
75556
  state2 = advanceColumn(state2);
75552
75557
  if (state2.trailingSpacing == null) state2.trailingSpacing = 0;
75553
75558
  continue;
@@ -76863,12 +76868,12 @@ function layoutDocument(blocks, measures, options = {}) {
76863
76868
  next.pendingFooterDistance = footerDistance2;
76864
76869
  }
76865
76870
  if (block.margins?.top !== void 0 || block.margins?.header !== void 0) {
76866
- const requiredTop = maxHeaderContentHeight > 0 ? headerDistance2 + maxHeaderContentHeight : headerDistance2;
76871
+ const requiredTop = maxHeaderContentHeight > 0 ? headerDistance2 + maxHeaderContentHeight : 0;
76867
76872
  next.activeTopMargin = Math.max(sectionTop, requiredTop);
76868
76873
  next.pendingTopMargin = next.activeTopMargin;
76869
76874
  }
76870
76875
  if (block.margins?.bottom !== void 0 || block.margins?.footer !== void 0) {
76871
- const requiredBottom = maxFooterContentHeight > 0 ? footerDistance2 + maxFooterContentHeight : footerDistance2;
76876
+ const requiredBottom = maxFooterContentHeight > 0 ? footerDistance2 + maxFooterContentHeight : 0;
76872
76877
  next.activeBottomMargin = Math.max(sectionBottom, requiredBottom);
76873
76878
  next.pendingBottomMargin = next.activeBottomMargin;
76874
76879
  }
@@ -77618,7 +77623,7 @@ function layoutHeaderFooter(blocks, measures, constraints) {
77618
77623
  throw new Error("layoutHeaderFooter: width must be positive");
77619
77624
  }
77620
77625
  if (!Number.isFinite(height) || height <= 0) {
77621
- throw new Error("layoutHeaderFooter: height must be positive");
77626
+ return { pages: [], height: 0 };
77622
77627
  }
77623
77628
  const maxBehindDocOverflow = Math.max(192, height * 4);
77624
77629
  const minBehindDocY = -maxBehindDocOverflow;
@@ -79463,7 +79468,9 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
79463
79468
  `[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
79464
79469
  );
79465
79470
  let headerContentHeights;
79466
- if (headerFooter?.constraints && headerFooter.headerBlocks) {
79471
+ const hasHeaderBlocks = headerFooter?.headerBlocks && Object.keys(headerFooter.headerBlocks).length > 0;
79472
+ const hasHeaderBlocksByRId = headerFooter?.headerBlocksByRId && headerFooter.headerBlocksByRId.size > 0;
79473
+ if (headerFooter?.constraints && (hasHeaderBlocks || hasHeaderBlocksByRId)) {
79467
79474
  const hfPreStart = performance.now();
79468
79475
  const measureFn = headerFooter.measure ?? measureBlock2;
79469
79476
  invalidateHeaderFooterCache(
@@ -79475,25 +79482,45 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
79475
79482
  options.sectionMetadata
79476
79483
  );
79477
79484
  const HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT = 1;
79478
- const preHeaderLayouts = await layoutHeaderFooterWithCache(
79479
- headerFooter.headerBlocks,
79480
- headerFooter.constraints,
79481
- measureFn,
79482
- headerMeasureCache,
79483
- HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
79484
- void 0
79485
- // No page resolver needed for height calculation
79486
- );
79487
79485
  const isValidHeaderType = (key2) => {
79488
79486
  return ["default", "first", "even", "odd"].includes(key2);
79489
79487
  };
79490
79488
  headerContentHeights = {};
79491
- for (const [type2, value] of Object.entries(preHeaderLayouts)) {
79492
- if (!isValidHeaderType(type2)) continue;
79493
- if (value?.layout && typeof value.layout.height === "number") {
79494
- const height = value.layout.height;
79495
- if (Number.isFinite(height) && height >= 0) {
79496
- headerContentHeights[type2] = height;
79489
+ if (hasHeaderBlocks && headerFooter.headerBlocks) {
79490
+ const preHeaderLayouts = await layoutHeaderFooterWithCache(
79491
+ headerFooter.headerBlocks,
79492
+ headerFooter.constraints,
79493
+ measureFn,
79494
+ headerMeasureCache,
79495
+ HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
79496
+ void 0
79497
+ // No page resolver needed for height calculation
79498
+ );
79499
+ for (const [type2, value] of Object.entries(preHeaderLayouts)) {
79500
+ if (!isValidHeaderType(type2)) continue;
79501
+ if (value?.layout && typeof value.layout.height === "number") {
79502
+ const height = value.layout.height;
79503
+ if (Number.isFinite(height) && height >= 0) {
79504
+ headerContentHeights[type2] = height;
79505
+ }
79506
+ }
79507
+ }
79508
+ }
79509
+ if (hasHeaderBlocksByRId && headerFooter.headerBlocksByRId) {
79510
+ for (const [_rId, blocks] of headerFooter.headerBlocksByRId) {
79511
+ if (!blocks || blocks.length === 0) continue;
79512
+ const measureConstraints = {
79513
+ maxWidth: headerFooter.constraints.width,
79514
+ maxHeight: headerFooter.constraints.height
79515
+ };
79516
+ const measures2 = await Promise.all(blocks.map((block) => measureFn(block, measureConstraints)));
79517
+ const layout2 = layoutHeaderFooter(blocks, measures2, {
79518
+ width: headerFooter.constraints.width,
79519
+ height: headerFooter.constraints.height
79520
+ });
79521
+ if (layout2.height > 0) {
79522
+ const currentDefault = headerContentHeights.default ?? 0;
79523
+ headerContentHeights.default = Math.max(currentDefault, layout2.height);
79497
79524
  }
79498
79525
  }
79499
79526
  }
@@ -79501,10 +79528,12 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
79501
79528
  perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
79502
79529
  }
79503
79530
  let footerContentHeights;
79504
- if (headerFooter?.constraints && headerFooter.footerBlocks) {
79531
+ const hasFooterBlocks = headerFooter?.footerBlocks && Object.keys(headerFooter.footerBlocks).length > 0;
79532
+ const hasFooterBlocksByRId = headerFooter?.footerBlocksByRId && headerFooter.footerBlocksByRId.size > 0;
79533
+ if (headerFooter?.constraints && (hasFooterBlocks || hasFooterBlocksByRId)) {
79505
79534
  const footerPreStart = performance.now();
79506
79535
  const measureFn = headerFooter.measure ?? measureBlock2;
79507
- if (!headerFooter.headerBlocks) {
79536
+ if (!hasHeaderBlocks && !hasHeaderBlocksByRId) {
79508
79537
  invalidateHeaderFooterCache(
79509
79538
  headerMeasureCache,
79510
79539
  headerFooterCacheState,
@@ -79515,26 +79544,46 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
79515
79544
  );
79516
79545
  }
79517
79546
  const FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT = 1;
79547
+ const isValidFooterType = (key2) => {
79548
+ return ["default", "first", "even", "odd"].includes(key2);
79549
+ };
79550
+ footerContentHeights = {};
79518
79551
  try {
79519
- const preFooterLayouts = await layoutHeaderFooterWithCache(
79520
- headerFooter.footerBlocks,
79521
- headerFooter.constraints,
79522
- measureFn,
79523
- headerMeasureCache,
79524
- FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
79525
- void 0
79526
- // No page resolver needed for height calculation
79527
- );
79528
- const isValidFooterType = (key2) => {
79529
- return ["default", "first", "even", "odd"].includes(key2);
79530
- };
79531
- footerContentHeights = {};
79532
- for (const [type2, value] of Object.entries(preFooterLayouts)) {
79533
- if (!isValidFooterType(type2)) continue;
79534
- if (value?.layout && typeof value.layout.height === "number") {
79535
- const height = value.layout.height;
79536
- if (Number.isFinite(height) && height >= 0) {
79537
- footerContentHeights[type2] = height;
79552
+ if (hasFooterBlocks && headerFooter.footerBlocks) {
79553
+ const preFooterLayouts = await layoutHeaderFooterWithCache(
79554
+ headerFooter.footerBlocks,
79555
+ headerFooter.constraints,
79556
+ measureFn,
79557
+ headerMeasureCache,
79558
+ FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
79559
+ void 0
79560
+ // No page resolver needed for height calculation
79561
+ );
79562
+ for (const [type2, value] of Object.entries(preFooterLayouts)) {
79563
+ if (!isValidFooterType(type2)) continue;
79564
+ if (value?.layout && typeof value.layout.height === "number") {
79565
+ const height = value.layout.height;
79566
+ if (Number.isFinite(height) && height >= 0) {
79567
+ footerContentHeights[type2] = height;
79568
+ }
79569
+ }
79570
+ }
79571
+ }
79572
+ if (hasFooterBlocksByRId && headerFooter.footerBlocksByRId) {
79573
+ for (const [_rId, blocks] of headerFooter.footerBlocksByRId) {
79574
+ if (!blocks || blocks.length === 0) continue;
79575
+ const measureConstraints = {
79576
+ maxWidth: headerFooter.constraints.width,
79577
+ maxHeight: headerFooter.constraints.height
79578
+ };
79579
+ const measures2 = await Promise.all(blocks.map((block) => measureFn(block, measureConstraints)));
79580
+ const layout2 = layoutHeaderFooter(blocks, measures2, {
79581
+ width: headerFooter.constraints.width,
79582
+ height: headerFooter.constraints.height
79583
+ });
79584
+ if (layout2.height > 0) {
79585
+ const currentDefault = footerContentHeights.default ?? 0;
79586
+ footerContentHeights.default = Math.max(currentDefault, layout2.height);
79538
79587
  }
79539
79588
  }
79540
79589
  }
@@ -96479,7 +96528,14 @@ computeHeaderFooterConstraints_fn = function() {
96479
96528
  const footerMargin = margins.footer ?? 0;
96480
96529
  const headerContentSpace = Math.max(marginTop - headerMargin, 0);
96481
96530
  const footerContentSpace = Math.max(marginBottom - footerMargin, 0);
96482
- const height = Math.max(headerContentSpace, footerContentSpace, 1);
96531
+ const height = Math.max(
96532
+ headerContentSpace,
96533
+ footerContentSpace,
96534
+ headerMargin,
96535
+ footerMargin,
96536
+ marginTop,
96537
+ marginBottom
96538
+ );
96483
96539
  return {
96484
96540
  width: measurementWidth,
96485
96541
  height,
@@ -96629,7 +96685,8 @@ computeDecorationBox_fn = function(kind, pageMargins, pageHeight) {
96629
96685
  const headerMargin = margins.header ?? 0;
96630
96686
  const topMargin = margins.top ?? DEFAULT_MARGINS.top ?? 0;
96631
96687
  const height = Math.max(topMargin - headerMargin, 1);
96632
- return { x: left2, width, height, offset: headerMargin };
96688
+ const offset2 = headerMargin;
96689
+ return { x: left2, width, height, offset: offset2 };
96633
96690
  } else {
96634
96691
  const footerMargin = margins.footer ?? 0;
96635
96692
  const bottomMargin = margins.bottom ?? DEFAULT_MARGINS.bottom ?? 0;
@@ -42427,7 +42427,7 @@ const _SuperConverter = class _SuperConverter2 {
42427
42427
  static getStoredSuperdocVersion(docx) {
42428
42428
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42429
42429
  }
42430
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.1.0") {
42430
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.1.1") {
42431
42431
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42432
42432
  }
42433
42433
  /**
@@ -60508,7 +60508,7 @@ const isHeadless = (editor) => {
60508
60508
  const shouldSkipNodeView = (editor) => {
60509
60509
  return isHeadless(editor);
60510
60510
  };
60511
- const summaryVersion = "1.1.0";
60511
+ const summaryVersion = "1.1.1";
60512
60512
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
60513
60513
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
60514
60514
  function mapAttributes(attrs) {
@@ -61297,7 +61297,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61297
61297
  { default: remarkStringify },
61298
61298
  { default: remarkGfm }
61299
61299
  ] = await Promise.all([
61300
- Promise.resolve().then(() => require("./index-LKlY0uOW-B70pXIte.cjs")),
61300
+ Promise.resolve().then(() => require("./index-BTh-y1Z8-cfF8oFrC.cjs")),
61301
61301
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
61302
61302
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
61303
61303
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -61502,7 +61502,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61502
61502
  * Process collaboration migrations
61503
61503
  */
61504
61504
  processCollaborationMigrations() {
61505
- console.debug("[checkVersionMigrations] Current editor version", "1.1.0");
61505
+ console.debug("[checkVersionMigrations] Current editor version", "1.1.1");
61506
61506
  if (!this.options.ydoc) return;
61507
61507
  const metaMap = this.options.ydoc.getMap("meta");
61508
61508
  let docVersion = metaMap.get("version");
@@ -75058,13 +75058,13 @@ function scheduleSectionBreak(block, state2, baseMargins, maxHeaderContentHeight
75058
75058
  if (maxHeaderContentHeight > 0) {
75059
75059
  return Math.max(baseTop, headerDistance + maxHeaderContentHeight);
75060
75060
  }
75061
- return Math.max(baseTop, headerDistance);
75061
+ return baseTop;
75062
75062
  };
75063
75063
  const calcRequiredBottomMargin = (footerDistance, baseBottom) => {
75064
75064
  if (maxFooterContentHeight > 0) {
75065
75065
  return Math.max(baseBottom, footerDistance + maxFooterContentHeight);
75066
75066
  }
75067
- return Math.max(baseBottom, footerDistance);
75067
+ return baseBottom;
75068
75068
  };
75069
75069
  if (block.attrs?.isFirstSection && !next.hasAnyPages) {
75070
75070
  if (block.pageSize) {
@@ -75565,6 +75565,11 @@ function layoutParagraphBlock(ctx2, anchors) {
75565
75565
  const prevTrailing = state2.trailingSpacing ?? 0;
75566
75566
  const neededSpacingBefore = Math.max(spacingBefore - prevTrailing, 0);
75567
75567
  if (state2.cursorY + neededSpacingBefore > state2.contentBottom) {
75568
+ if (state2.cursorY <= state2.topMargin) {
75569
+ state2.trailingSpacing = 0;
75570
+ appliedSpacingBefore = true;
75571
+ break;
75572
+ }
75568
75573
  state2 = advanceColumn(state2);
75569
75574
  if (state2.trailingSpacing == null) state2.trailingSpacing = 0;
75570
75575
  continue;
@@ -76880,12 +76885,12 @@ function layoutDocument(blocks, measures, options = {}) {
76880
76885
  next.pendingFooterDistance = footerDistance2;
76881
76886
  }
76882
76887
  if (block.margins?.top !== void 0 || block.margins?.header !== void 0) {
76883
- const requiredTop = maxHeaderContentHeight > 0 ? headerDistance2 + maxHeaderContentHeight : headerDistance2;
76888
+ const requiredTop = maxHeaderContentHeight > 0 ? headerDistance2 + maxHeaderContentHeight : 0;
76884
76889
  next.activeTopMargin = Math.max(sectionTop, requiredTop);
76885
76890
  next.pendingTopMargin = next.activeTopMargin;
76886
76891
  }
76887
76892
  if (block.margins?.bottom !== void 0 || block.margins?.footer !== void 0) {
76888
- const requiredBottom = maxFooterContentHeight > 0 ? footerDistance2 + maxFooterContentHeight : footerDistance2;
76893
+ const requiredBottom = maxFooterContentHeight > 0 ? footerDistance2 + maxFooterContentHeight : 0;
76889
76894
  next.activeBottomMargin = Math.max(sectionBottom, requiredBottom);
76890
76895
  next.pendingBottomMargin = next.activeBottomMargin;
76891
76896
  }
@@ -77635,7 +77640,7 @@ function layoutHeaderFooter(blocks, measures, constraints) {
77635
77640
  throw new Error("layoutHeaderFooter: width must be positive");
77636
77641
  }
77637
77642
  if (!Number.isFinite(height) || height <= 0) {
77638
- throw new Error("layoutHeaderFooter: height must be positive");
77643
+ return { pages: [], height: 0 };
77639
77644
  }
77640
77645
  const maxBehindDocOverflow = Math.max(192, height * 4);
77641
77646
  const minBehindDocY = -maxBehindDocOverflow;
@@ -79480,7 +79485,9 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
79480
79485
  `[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
79481
79486
  );
79482
79487
  let headerContentHeights;
79483
- if (headerFooter?.constraints && headerFooter.headerBlocks) {
79488
+ const hasHeaderBlocks = headerFooter?.headerBlocks && Object.keys(headerFooter.headerBlocks).length > 0;
79489
+ const hasHeaderBlocksByRId = headerFooter?.headerBlocksByRId && headerFooter.headerBlocksByRId.size > 0;
79490
+ if (headerFooter?.constraints && (hasHeaderBlocks || hasHeaderBlocksByRId)) {
79484
79491
  const hfPreStart = performance.now();
79485
79492
  const measureFn = headerFooter.measure ?? measureBlock2;
79486
79493
  invalidateHeaderFooterCache(
@@ -79492,25 +79499,45 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
79492
79499
  options.sectionMetadata
79493
79500
  );
79494
79501
  const HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT = 1;
79495
- const preHeaderLayouts = await layoutHeaderFooterWithCache(
79496
- headerFooter.headerBlocks,
79497
- headerFooter.constraints,
79498
- measureFn,
79499
- headerMeasureCache,
79500
- HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
79501
- void 0
79502
- // No page resolver needed for height calculation
79503
- );
79504
79502
  const isValidHeaderType = (key2) => {
79505
79503
  return ["default", "first", "even", "odd"].includes(key2);
79506
79504
  };
79507
79505
  headerContentHeights = {};
79508
- for (const [type2, value] of Object.entries(preHeaderLayouts)) {
79509
- if (!isValidHeaderType(type2)) continue;
79510
- if (value?.layout && typeof value.layout.height === "number") {
79511
- const height = value.layout.height;
79512
- if (Number.isFinite(height) && height >= 0) {
79513
- headerContentHeights[type2] = height;
79506
+ if (hasHeaderBlocks && headerFooter.headerBlocks) {
79507
+ const preHeaderLayouts = await layoutHeaderFooterWithCache(
79508
+ headerFooter.headerBlocks,
79509
+ headerFooter.constraints,
79510
+ measureFn,
79511
+ headerMeasureCache,
79512
+ HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
79513
+ void 0
79514
+ // No page resolver needed for height calculation
79515
+ );
79516
+ for (const [type2, value] of Object.entries(preHeaderLayouts)) {
79517
+ if (!isValidHeaderType(type2)) continue;
79518
+ if (value?.layout && typeof value.layout.height === "number") {
79519
+ const height = value.layout.height;
79520
+ if (Number.isFinite(height) && height >= 0) {
79521
+ headerContentHeights[type2] = height;
79522
+ }
79523
+ }
79524
+ }
79525
+ }
79526
+ if (hasHeaderBlocksByRId && headerFooter.headerBlocksByRId) {
79527
+ for (const [_rId, blocks] of headerFooter.headerBlocksByRId) {
79528
+ if (!blocks || blocks.length === 0) continue;
79529
+ const measureConstraints = {
79530
+ maxWidth: headerFooter.constraints.width,
79531
+ maxHeight: headerFooter.constraints.height
79532
+ };
79533
+ const measures2 = await Promise.all(blocks.map((block) => measureFn(block, measureConstraints)));
79534
+ const layout2 = layoutHeaderFooter(blocks, measures2, {
79535
+ width: headerFooter.constraints.width,
79536
+ height: headerFooter.constraints.height
79537
+ });
79538
+ if (layout2.height > 0) {
79539
+ const currentDefault = headerContentHeights.default ?? 0;
79540
+ headerContentHeights.default = Math.max(currentDefault, layout2.height);
79514
79541
  }
79515
79542
  }
79516
79543
  }
@@ -79518,10 +79545,12 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
79518
79545
  perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
79519
79546
  }
79520
79547
  let footerContentHeights;
79521
- if (headerFooter?.constraints && headerFooter.footerBlocks) {
79548
+ const hasFooterBlocks = headerFooter?.footerBlocks && Object.keys(headerFooter.footerBlocks).length > 0;
79549
+ const hasFooterBlocksByRId = headerFooter?.footerBlocksByRId && headerFooter.footerBlocksByRId.size > 0;
79550
+ if (headerFooter?.constraints && (hasFooterBlocks || hasFooterBlocksByRId)) {
79522
79551
  const footerPreStart = performance.now();
79523
79552
  const measureFn = headerFooter.measure ?? measureBlock2;
79524
- if (!headerFooter.headerBlocks) {
79553
+ if (!hasHeaderBlocks && !hasHeaderBlocksByRId) {
79525
79554
  invalidateHeaderFooterCache(
79526
79555
  headerMeasureCache,
79527
79556
  headerFooterCacheState,
@@ -79532,26 +79561,46 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
79532
79561
  );
79533
79562
  }
79534
79563
  const FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT = 1;
79564
+ const isValidFooterType = (key2) => {
79565
+ return ["default", "first", "even", "odd"].includes(key2);
79566
+ };
79567
+ footerContentHeights = {};
79535
79568
  try {
79536
- const preFooterLayouts = await layoutHeaderFooterWithCache(
79537
- headerFooter.footerBlocks,
79538
- headerFooter.constraints,
79539
- measureFn,
79540
- headerMeasureCache,
79541
- FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
79542
- void 0
79543
- // No page resolver needed for height calculation
79544
- );
79545
- const isValidFooterType = (key2) => {
79546
- return ["default", "first", "even", "odd"].includes(key2);
79547
- };
79548
- footerContentHeights = {};
79549
- for (const [type2, value] of Object.entries(preFooterLayouts)) {
79550
- if (!isValidFooterType(type2)) continue;
79551
- if (value?.layout && typeof value.layout.height === "number") {
79552
- const height = value.layout.height;
79553
- if (Number.isFinite(height) && height >= 0) {
79554
- footerContentHeights[type2] = height;
79569
+ if (hasFooterBlocks && headerFooter.footerBlocks) {
79570
+ const preFooterLayouts = await layoutHeaderFooterWithCache(
79571
+ headerFooter.footerBlocks,
79572
+ headerFooter.constraints,
79573
+ measureFn,
79574
+ headerMeasureCache,
79575
+ FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
79576
+ void 0
79577
+ // No page resolver needed for height calculation
79578
+ );
79579
+ for (const [type2, value] of Object.entries(preFooterLayouts)) {
79580
+ if (!isValidFooterType(type2)) continue;
79581
+ if (value?.layout && typeof value.layout.height === "number") {
79582
+ const height = value.layout.height;
79583
+ if (Number.isFinite(height) && height >= 0) {
79584
+ footerContentHeights[type2] = height;
79585
+ }
79586
+ }
79587
+ }
79588
+ }
79589
+ if (hasFooterBlocksByRId && headerFooter.footerBlocksByRId) {
79590
+ for (const [_rId, blocks] of headerFooter.footerBlocksByRId) {
79591
+ if (!blocks || blocks.length === 0) continue;
79592
+ const measureConstraints = {
79593
+ maxWidth: headerFooter.constraints.width,
79594
+ maxHeight: headerFooter.constraints.height
79595
+ };
79596
+ const measures2 = await Promise.all(blocks.map((block) => measureFn(block, measureConstraints)));
79597
+ const layout2 = layoutHeaderFooter(blocks, measures2, {
79598
+ width: headerFooter.constraints.width,
79599
+ height: headerFooter.constraints.height
79600
+ });
79601
+ if (layout2.height > 0) {
79602
+ const currentDefault = footerContentHeights.default ?? 0;
79603
+ footerContentHeights.default = Math.max(currentDefault, layout2.height);
79555
79604
  }
79556
79605
  }
79557
79606
  }
@@ -96496,7 +96545,14 @@ computeHeaderFooterConstraints_fn = function() {
96496
96545
  const footerMargin = margins.footer ?? 0;
96497
96546
  const headerContentSpace = Math.max(marginTop - headerMargin, 0);
96498
96547
  const footerContentSpace = Math.max(marginBottom - footerMargin, 0);
96499
- const height = Math.max(headerContentSpace, footerContentSpace, 1);
96548
+ const height = Math.max(
96549
+ headerContentSpace,
96550
+ footerContentSpace,
96551
+ headerMargin,
96552
+ footerMargin,
96553
+ marginTop,
96554
+ marginBottom
96555
+ );
96500
96556
  return {
96501
96557
  width: measurementWidth,
96502
96558
  height,
@@ -96646,7 +96702,8 @@ computeDecorationBox_fn = function(kind, pageMargins, pageHeight) {
96646
96702
  const headerMargin = margins.header ?? 0;
96647
96703
  const topMargin = margins.top ?? DEFAULT_MARGINS.top ?? 0;
96648
96704
  const height = Math.max(topMargin - headerMargin, 1);
96649
- return { x: left2, width, height, offset: headerMargin };
96705
+ const offset2 = headerMargin;
96706
+ return { x: left2, width, height, offset: offset2 };
96650
96707
  } else {
96651
96708
  const footerMargin = margins.footer ?? 0;
96652
96709
  const bottomMargin = margins.bottom ?? DEFAULT_MARGINS.bottom ?? 0;
@@ -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-CB_4LqhI.js";
3
- import { _ as _export_sfc } from "./chunks/editor-BKIkgBE0.js";
2
+ import { T as TextSelection } from "./chunks/converter-r8fFrCoG.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-BYC5b9i-.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 = {}) {
@@ -42727,7 +42727,7 @@ const _SuperConverter = class _SuperConverter {
42727
42727
  static getStoredSuperdocVersion(docx) {
42728
42728
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42729
42729
  }
42730
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.1.0") {
42730
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.1.1") {
42731
42731
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42732
42732
  }
42733
42733
  /**
@@ -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-CB_4LqhI.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-r8fFrCoG.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
  }