superdoc 1.0.0-beta.95 → 1.0.0-beta.96

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--l9mxuw6.cjs → PdfViewer-BGTfnD4T.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DC5ZtOHL.es.js → PdfViewer-Cdp1WJ9e.es.js} +1 -1
  3. package/dist/chunks/{index-D_AIVJix.es.js → index-BV9YtiyI.es.js} +3 -3
  4. package/dist/chunks/{index-DA6_gKCn.cjs → index-C-IS20yQ.cjs} +3 -3
  5. package/dist/chunks/{index-DJD7xO_i-DlZGZmeW.es.js → index-lfdM_gm7-_EQjLyqH.es.js} +1 -1
  6. package/dist/chunks/{index-DJD7xO_i-CVT8OSh8.cjs → index-lfdM_gm7-qtx-V4oF.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-DLfNMkAR.cjs → super-editor.es-D2zn943K.cjs} +58 -23
  8. package/dist/chunks/{super-editor.es-L0F8-awY.es.js → super-editor.es-De2XS3A1.es.js} +58 -23
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CAiO-oW4.js → converter-B29ATZFC.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DRP7HhmI.js → docx-zipper-BPktKUBx.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-D5oQ83xJ.js → editor-BRHMYtPA.js} +59 -24
  13. package/dist/super-editor/chunks/{index-DJD7xO_i.js → index-lfdM_gm7.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-ax2sbcF_.js → toolbar-CB2cJCLh.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 +68 -33
  26. package/dist/superdoc.umd.js.map +1 -1
  27. 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-DA6_gKCn.cjs");
4
+ const superdoc = require("./index-C-IS20yQ.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-D_AIVJix.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-BV9YtiyI.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-L0F8-awY.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-De2XS3A1.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-DC5ZtOHL.es.js"));
17254
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-Cdp1WJ9e.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.95";
18143
+ this.version = "1.0.0-beta.96";
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-DLfNMkAR.cjs");
2
+ const superEditor_es = require("./super-editor.es-D2zn943K.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--l9mxuw6.cjs")));
17271
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BGTfnD4T.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.95";
18160
+ this.version = "1.0.0-beta.96";
18161
18161
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18162
18162
  this.superdocId = config.superdocId || uuid.v4();
18163
18163
  this.colors = this.config.colors;
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-L0F8-awY.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-De2XS3A1.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-DLfNMkAR.cjs");
3
+ const superEditor_es = require("./super-editor.es-D2zn943K.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -42421,7 +42421,7 @@ const _SuperConverter = class _SuperConverter2 {
42421
42421
  static getStoredSuperdocVersion(docx) {
42422
42422
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42423
42423
  }
42424
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.95") {
42424
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.96") {
42425
42425
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42426
42426
  }
42427
42427
  /**
@@ -59639,7 +59639,7 @@ const isHeadless = (editor) => {
59639
59639
  const shouldSkipNodeView = (editor) => {
59640
59640
  return isHeadless(editor);
59641
59641
  };
59642
- const summaryVersion = "1.0.0-beta.95";
59642
+ const summaryVersion = "1.0.0-beta.96";
59643
59643
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59644
59644
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59645
59645
  function mapAttributes(attrs) {
@@ -60428,7 +60428,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60428
60428
  { default: remarkStringify },
60429
60429
  { default: remarkGfm }
60430
60430
  ] = await Promise.all([
60431
- Promise.resolve().then(() => require("./index-DJD7xO_i-CVT8OSh8.cjs")),
60431
+ Promise.resolve().then(() => require("./index-lfdM_gm7-qtx-V4oF.cjs")),
60432
60432
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60433
60433
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60434
60434
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60633,7 +60633,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60633
60633
  * Process collaboration migrations
60634
60634
  */
60635
60635
  processCollaborationMigrations() {
60636
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.95");
60636
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.96");
60637
60637
  if (!this.options.ydoc) return;
60638
60638
  const metaMap = this.options.ydoc.getMap("meta");
60639
60639
  let docVersion = metaMap.get("version");
@@ -66693,6 +66693,13 @@ const isTruthy = (value) => {
66693
66693
  }
66694
66694
  return false;
66695
66695
  };
66696
+ const safeGetProperty = (obj, key2) => {
66697
+ if (!obj || typeof obj !== "object") {
66698
+ return void 0;
66699
+ }
66700
+ const record = obj;
66701
+ return record[key2];
66702
+ };
66696
66703
  const isExplicitFalse = (value) => {
66697
66704
  if (value === false || value === 0) return true;
66698
66705
  if (typeof value === "string") {
@@ -67185,8 +67192,9 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67185
67192
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
67186
67193
  }
67187
67194
  }
67188
- if (normalizedSpacing?.contextualSpacing != null) {
67189
- paragraphAttrs.contextualSpacing = normalizedSpacing.contextualSpacing;
67195
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
67196
+ if (contextualSpacingValue != null) {
67197
+ paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
67190
67198
  }
67191
67199
  const hasExplicitIndent = Boolean(normalizedIndent);
67192
67200
  const hasNumberingIndent = Boolean(computed2.numbering?.indent?.left || computed2.numbering?.indent?.hanging);
@@ -67238,7 +67246,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67238
67246
  paragraphAttrs.tabs = normalizedTabs;
67239
67247
  }
67240
67248
  }
67241
- const asString = (value) => {
67249
+ const asString2 = (value) => {
67242
67250
  return typeof value === "string" ? value : void 0;
67243
67251
  };
67244
67252
  const normalizeFramePr = (value) => {
@@ -67261,7 +67269,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67261
67269
  };
67262
67270
  const framePr = normalizeFramePr(attrs.framePr) ?? normalizeFramePr(attrs.paragraphProperties?.framePr) ?? extractFramePrFromElements(attrs.paragraphProperties);
67263
67271
  if (framePr) {
67264
- const rawXAlign = asString(framePr["w:xAlign"] ?? framePr.xAlign);
67272
+ const rawXAlign = asString2(framePr["w:xAlign"] ?? framePr.xAlign);
67265
67273
  const xAlign = typeof rawXAlign === "string" ? rawXAlign.toLowerCase() : void 0;
67266
67274
  if (xAlign === "left" || xAlign === "right" || xAlign === "center") {
67267
67275
  paragraphAttrs.floatAlignment = xAlign;
@@ -67271,7 +67279,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67271
67279
  paragraphAttrs.dropCap = dropCap;
67272
67280
  const dropCapMode = typeof dropCap === "string" ? dropCap.toLowerCase() : "drop";
67273
67281
  const linesValue = pickNumber(framePr["w:lines"] ?? framePr.lines);
67274
- const wrapValue = asString(framePr["w:wrap"] ?? framePr.wrap);
67282
+ const wrapValue = asString2(framePr["w:wrap"] ?? framePr.wrap);
67275
67283
  const dropCapRunInfo = extractDropCapRunFromParagraph(para);
67276
67284
  if (dropCapRunInfo) {
67277
67285
  const descriptor = {
@@ -67289,18 +67297,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67289
67297
  }
67290
67298
  }
67291
67299
  const frame = {};
67292
- const wrap2 = asString(framePr["w:wrap"] ?? framePr.wrap);
67300
+ const wrap2 = asString2(framePr["w:wrap"] ?? framePr.wrap);
67293
67301
  if (wrap2) frame.wrap = wrap2;
67294
67302
  if (xAlign) {
67295
67303
  frame.xAlign = xAlign;
67296
67304
  }
67297
- const rawYAlign = asString(framePr["w:yAlign"] ?? framePr.yAlign);
67305
+ const rawYAlign = asString2(framePr["w:yAlign"] ?? framePr.yAlign);
67298
67306
  if (rawYAlign) {
67299
67307
  frame.yAlign = rawYAlign;
67300
67308
  }
67301
- const hAnchor = asString(framePr["w:hAnchor"] ?? framePr.hAnchor);
67309
+ const hAnchor = asString2(framePr["w:hAnchor"] ?? framePr.hAnchor);
67302
67310
  if (hAnchor) frame.hAnchor = hAnchor;
67303
- const vAnchor = asString(framePr["w:vAnchor"] ?? framePr.vAnchor);
67311
+ const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
67304
67312
  if (vAnchor) frame.vAnchor = vAnchor;
67305
67313
  const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
67306
67314
  if (xTwips != null) frame.x = twipsToPx$1(xTwips);
@@ -79044,6 +79052,32 @@ const extractBlockPmRange = (block) => {
79044
79052
  pmEnd: end2 ?? (start2 != null ? start2 + 1 : void 0)
79045
79053
  };
79046
79054
  };
79055
+ const getParagraphAttrs = (block) => {
79056
+ if (!block.attrs || typeof block.attrs !== "object") {
79057
+ return void 0;
79058
+ }
79059
+ return block.attrs;
79060
+ };
79061
+ const asString = (value) => {
79062
+ return typeof value === "string" ? value : void 0;
79063
+ };
79064
+ const asBoolean = (value) => {
79065
+ if (value === true || value === 1) return true;
79066
+ if (typeof value === "string") {
79067
+ const normalized = value.toLowerCase();
79068
+ return normalized === "true" || normalized === "1" || normalized === "on";
79069
+ }
79070
+ return false;
79071
+ };
79072
+ const asSafeNumber = (value) => {
79073
+ if (typeof value !== "number") {
79074
+ return 0;
79075
+ }
79076
+ if (!Number.isFinite(value) || value < 0) {
79077
+ return 0;
79078
+ }
79079
+ return value;
79080
+ };
79047
79081
  function calculateFirstLineIndent(block, measure) {
79048
79082
  const wordLayout = block.attrs?.wordLayout;
79049
79083
  if (!wordLayout?.firstLineIndentMode) {
@@ -79061,7 +79095,8 @@ function calculateFirstLineIndent(block, measure) {
79061
79095
  function layoutParagraphBlock(ctx2, anchors) {
79062
79096
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
79063
79097
  const remeasureParagraph2 = ctx2.remeasureParagraph;
79064
- const frame = block.attrs?.frame;
79098
+ const blockAttrs = getParagraphAttrs(block);
79099
+ const frame = blockAttrs?.frame;
79065
79100
  if (anchors?.anchoredDrawings?.length) {
79066
79101
  for (const entry of anchors.anchoredDrawings) {
79067
79102
  if (anchors.placedAnchoredIds.has(entry.block.id)) continue;
@@ -79186,9 +79221,10 @@ function layoutParagraphBlock(ctx2, anchors) {
79186
79221
  didRemeasureForColumnWidth = true;
79187
79222
  }
79188
79223
  let fromLine = 0;
79189
- const spacing = block.attrs?.spacing ?? {};
79190
- const styleId = block.attrs?.styleId;
79191
- const contextualSpacing = Boolean(block.attrs?.contextualSpacing);
79224
+ const attrs = getParagraphAttrs(block);
79225
+ const spacing = attrs?.spacing ?? {};
79226
+ const styleId = asString(attrs?.styleId);
79227
+ const contextualSpacing = asBoolean(attrs?.contextualSpacing);
79192
79228
  let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
79193
79229
  const spacingAfter = Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
79194
79230
  let appliedSpacingBefore = spacingBefore === 0;
@@ -79269,14 +79305,13 @@ function layoutParagraphBlock(ctx2, anchors) {
79269
79305
  while (fromLine < lines.length) {
79270
79306
  let state2 = ensurePage();
79271
79307
  if (state2.trailingSpacing == null) state2.trailingSpacing = 0;
79272
- if (contextualSpacing) {
79273
- const prevStyle = state2.lastParagraphStyleId;
79274
- if (styleId && prevStyle && prevStyle === styleId) {
79275
- spacingBefore = 0;
79276
- }
79277
- }
79278
79308
  if (contextualSpacing && state2.lastParagraphStyleId && styleId && state2.lastParagraphStyleId === styleId) {
79279
79309
  spacingBefore = 0;
79310
+ const prevTrailing = asSafeNumber(state2.trailingSpacing);
79311
+ if (prevTrailing > 0) {
79312
+ state2.cursorY -= prevTrailing;
79313
+ state2.trailingSpacing = 0;
79314
+ }
79280
79315
  }
79281
79316
  if (!appliedSpacingBefore && spacingBefore > 0) {
79282
79317
  while (!appliedSpacingBefore) {
@@ -42404,7 +42404,7 @@ const _SuperConverter = class _SuperConverter2 {
42404
42404
  static getStoredSuperdocVersion(docx) {
42405
42405
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42406
42406
  }
42407
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.95") {
42407
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.96") {
42408
42408
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42409
42409
  }
42410
42410
  /**
@@ -59622,7 +59622,7 @@ const isHeadless = (editor) => {
59622
59622
  const shouldSkipNodeView = (editor) => {
59623
59623
  return isHeadless(editor);
59624
59624
  };
59625
- const summaryVersion = "1.0.0-beta.95";
59625
+ const summaryVersion = "1.0.0-beta.96";
59626
59626
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59627
59627
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59628
59628
  function mapAttributes(attrs) {
@@ -60411,7 +60411,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60411
60411
  { default: remarkStringify },
60412
60412
  { default: remarkGfm }
60413
60413
  ] = await Promise.all([
60414
- import("./index-DJD7xO_i-DlZGZmeW.es.js"),
60414
+ import("./index-lfdM_gm7-_EQjLyqH.es.js"),
60415
60415
  import("./index-DRCvimau-Cw339678.es.js"),
60416
60416
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60417
60417
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60616,7 +60616,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60616
60616
  * Process collaboration migrations
60617
60617
  */
60618
60618
  processCollaborationMigrations() {
60619
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.95");
60619
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.96");
60620
60620
  if (!this.options.ydoc) return;
60621
60621
  const metaMap = this.options.ydoc.getMap("meta");
60622
60622
  let docVersion = metaMap.get("version");
@@ -66676,6 +66676,13 @@ const isTruthy = (value) => {
66676
66676
  }
66677
66677
  return false;
66678
66678
  };
66679
+ const safeGetProperty = (obj, key2) => {
66680
+ if (!obj || typeof obj !== "object") {
66681
+ return void 0;
66682
+ }
66683
+ const record = obj;
66684
+ return record[key2];
66685
+ };
66679
66686
  const isExplicitFalse = (value) => {
66680
66687
  if (value === false || value === 0) return true;
66681
66688
  if (typeof value === "string") {
@@ -67168,8 +67175,9 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67168
67175
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
67169
67176
  }
67170
67177
  }
67171
- if (normalizedSpacing?.contextualSpacing != null) {
67172
- paragraphAttrs.contextualSpacing = normalizedSpacing.contextualSpacing;
67178
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
67179
+ if (contextualSpacingValue != null) {
67180
+ paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
67173
67181
  }
67174
67182
  const hasExplicitIndent = Boolean(normalizedIndent);
67175
67183
  const hasNumberingIndent = Boolean(computed2.numbering?.indent?.left || computed2.numbering?.indent?.hanging);
@@ -67221,7 +67229,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67221
67229
  paragraphAttrs.tabs = normalizedTabs;
67222
67230
  }
67223
67231
  }
67224
- const asString = (value) => {
67232
+ const asString2 = (value) => {
67225
67233
  return typeof value === "string" ? value : void 0;
67226
67234
  };
67227
67235
  const normalizeFramePr = (value) => {
@@ -67244,7 +67252,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67244
67252
  };
67245
67253
  const framePr = normalizeFramePr(attrs.framePr) ?? normalizeFramePr(attrs.paragraphProperties?.framePr) ?? extractFramePrFromElements(attrs.paragraphProperties);
67246
67254
  if (framePr) {
67247
- const rawXAlign = asString(framePr["w:xAlign"] ?? framePr.xAlign);
67255
+ const rawXAlign = asString2(framePr["w:xAlign"] ?? framePr.xAlign);
67248
67256
  const xAlign = typeof rawXAlign === "string" ? rawXAlign.toLowerCase() : void 0;
67249
67257
  if (xAlign === "left" || xAlign === "right" || xAlign === "center") {
67250
67258
  paragraphAttrs.floatAlignment = xAlign;
@@ -67254,7 +67262,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67254
67262
  paragraphAttrs.dropCap = dropCap;
67255
67263
  const dropCapMode = typeof dropCap === "string" ? dropCap.toLowerCase() : "drop";
67256
67264
  const linesValue = pickNumber(framePr["w:lines"] ?? framePr.lines);
67257
- const wrapValue = asString(framePr["w:wrap"] ?? framePr.wrap);
67265
+ const wrapValue = asString2(framePr["w:wrap"] ?? framePr.wrap);
67258
67266
  const dropCapRunInfo = extractDropCapRunFromParagraph(para);
67259
67267
  if (dropCapRunInfo) {
67260
67268
  const descriptor = {
@@ -67272,18 +67280,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67272
67280
  }
67273
67281
  }
67274
67282
  const frame = {};
67275
- const wrap2 = asString(framePr["w:wrap"] ?? framePr.wrap);
67283
+ const wrap2 = asString2(framePr["w:wrap"] ?? framePr.wrap);
67276
67284
  if (wrap2) frame.wrap = wrap2;
67277
67285
  if (xAlign) {
67278
67286
  frame.xAlign = xAlign;
67279
67287
  }
67280
- const rawYAlign = asString(framePr["w:yAlign"] ?? framePr.yAlign);
67288
+ const rawYAlign = asString2(framePr["w:yAlign"] ?? framePr.yAlign);
67281
67289
  if (rawYAlign) {
67282
67290
  frame.yAlign = rawYAlign;
67283
67291
  }
67284
- const hAnchor = asString(framePr["w:hAnchor"] ?? framePr.hAnchor);
67292
+ const hAnchor = asString2(framePr["w:hAnchor"] ?? framePr.hAnchor);
67285
67293
  if (hAnchor) frame.hAnchor = hAnchor;
67286
- const vAnchor = asString(framePr["w:vAnchor"] ?? framePr.vAnchor);
67294
+ const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
67287
67295
  if (vAnchor) frame.vAnchor = vAnchor;
67288
67296
  const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
67289
67297
  if (xTwips != null) frame.x = twipsToPx$1(xTwips);
@@ -79027,6 +79035,32 @@ const extractBlockPmRange = (block) => {
79027
79035
  pmEnd: end2 ?? (start2 != null ? start2 + 1 : void 0)
79028
79036
  };
79029
79037
  };
79038
+ const getParagraphAttrs = (block) => {
79039
+ if (!block.attrs || typeof block.attrs !== "object") {
79040
+ return void 0;
79041
+ }
79042
+ return block.attrs;
79043
+ };
79044
+ const asString = (value) => {
79045
+ return typeof value === "string" ? value : void 0;
79046
+ };
79047
+ const asBoolean = (value) => {
79048
+ if (value === true || value === 1) return true;
79049
+ if (typeof value === "string") {
79050
+ const normalized = value.toLowerCase();
79051
+ return normalized === "true" || normalized === "1" || normalized === "on";
79052
+ }
79053
+ return false;
79054
+ };
79055
+ const asSafeNumber = (value) => {
79056
+ if (typeof value !== "number") {
79057
+ return 0;
79058
+ }
79059
+ if (!Number.isFinite(value) || value < 0) {
79060
+ return 0;
79061
+ }
79062
+ return value;
79063
+ };
79030
79064
  function calculateFirstLineIndent(block, measure) {
79031
79065
  const wordLayout = block.attrs?.wordLayout;
79032
79066
  if (!wordLayout?.firstLineIndentMode) {
@@ -79044,7 +79078,8 @@ function calculateFirstLineIndent(block, measure) {
79044
79078
  function layoutParagraphBlock(ctx2, anchors) {
79045
79079
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
79046
79080
  const remeasureParagraph2 = ctx2.remeasureParagraph;
79047
- const frame = block.attrs?.frame;
79081
+ const blockAttrs = getParagraphAttrs(block);
79082
+ const frame = blockAttrs?.frame;
79048
79083
  if (anchors?.anchoredDrawings?.length) {
79049
79084
  for (const entry of anchors.anchoredDrawings) {
79050
79085
  if (anchors.placedAnchoredIds.has(entry.block.id)) continue;
@@ -79169,9 +79204,10 @@ function layoutParagraphBlock(ctx2, anchors) {
79169
79204
  didRemeasureForColumnWidth = true;
79170
79205
  }
79171
79206
  let fromLine = 0;
79172
- const spacing = block.attrs?.spacing ?? {};
79173
- const styleId = block.attrs?.styleId;
79174
- const contextualSpacing = Boolean(block.attrs?.contextualSpacing);
79207
+ const attrs = getParagraphAttrs(block);
79208
+ const spacing = attrs?.spacing ?? {};
79209
+ const styleId = asString(attrs?.styleId);
79210
+ const contextualSpacing = asBoolean(attrs?.contextualSpacing);
79175
79211
  let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
79176
79212
  const spacingAfter = Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
79177
79213
  let appliedSpacingBefore = spacingBefore === 0;
@@ -79252,14 +79288,13 @@ function layoutParagraphBlock(ctx2, anchors) {
79252
79288
  while (fromLine < lines.length) {
79253
79289
  let state2 = ensurePage();
79254
79290
  if (state2.trailingSpacing == null) state2.trailingSpacing = 0;
79255
- if (contextualSpacing) {
79256
- const prevStyle = state2.lastParagraphStyleId;
79257
- if (styleId && prevStyle && prevStyle === styleId) {
79258
- spacingBefore = 0;
79259
- }
79260
- }
79261
79291
  if (contextualSpacing && state2.lastParagraphStyleId && styleId && state2.lastParagraphStyleId === styleId) {
79262
79292
  spacingBefore = 0;
79293
+ const prevTrailing = asSafeNumber(state2.trailingSpacing);
79294
+ if (prevTrailing > 0) {
79295
+ state2.cursorY -= prevTrailing;
79296
+ state2.trailingSpacing = 0;
79297
+ }
79263
79298
  }
79264
79299
  if (!appliedSpacingBefore && spacingBefore > 0) {
79265
79300
  while (!appliedSpacingBefore) {
@@ -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-CAiO-oW4.js";
3
- import { _ as _export_sfc } from "./chunks/editor-D5oQ83xJ.js";
2
+ import { T as TextSelection } from "./chunks/converter-B29ATZFC.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-BRHMYtPA.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 = {}) {
@@ -42721,7 +42721,7 @@ const _SuperConverter = class _SuperConverter {
42721
42721
  static getStoredSuperdocVersion(docx) {
42722
42722
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42723
42723
  }
42724
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.95") {
42724
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.96") {
42725
42725
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42726
42726
  }
42727
42727
  /**
@@ -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-CAiO-oW4.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-B29ATZFC.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
  }