superdoc 1.0.0-beta.61 → 1.0.0-beta.63

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 (30) hide show
  1. package/dist/chunks/{PdfViewer-CuTlpPQO.cjs → PdfViewer-Dc7zft9M.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BHLsVrSe.es.js → PdfViewer-Enk2l025.es.js} +1 -1
  3. package/dist/chunks/{index-u8dj63PM-Bfomc8Z6.es.js → index-BO5Ne6G9-BxC5lPet.es.js} +1 -1
  4. package/dist/chunks/{index-u8dj63PM-VgHx1nNP.cjs → index-BO5Ne6G9-njLy4w3i.cjs} +1 -1
  5. package/dist/chunks/{index-E5x6cBKw.cjs → index-DZPXVd1d.cjs} +3 -3
  6. package/dist/chunks/{index-DeFp1DEO.es.js → index-KZsFukCq.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-nY9_xN6Z.cjs → super-editor.es-Crw7wu2n.cjs} +206 -68
  8. package/dist/chunks/{super-editor.es-CI3WoKIG.es.js → super-editor.es-DhGXcD3R.es.js} +206 -68
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/style.css +29 -29
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-DaSkPzA9.js → converter-C4bE8Uad.js} +164 -46
  13. package/dist/super-editor/chunks/{docx-zipper-Cx1zgQ8B.js → docx-zipper-BIkbwyZO.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-45pxcsTR.js → editor-ByMtGRzi.js} +33 -20
  15. package/dist/super-editor/chunks/{index-u8dj63PM.js → index-BO5Ne6G9.js} +1 -1
  16. package/dist/super-editor/chunks/{toolbar-C4OC-AnI.js → toolbar-DFgaXUsx.js} +2 -2
  17. package/dist/super-editor/converter.es.js +1 -1
  18. package/dist/super-editor/docx-zipper.es.js +2 -2
  19. package/dist/super-editor/editor.es.js +3 -3
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/style.css +29 -29
  22. package/dist/super-editor/super-editor.es.js +17 -10
  23. package/dist/super-editor/toolbar.es.js +2 -2
  24. package/dist/super-editor.cjs +1 -1
  25. package/dist/super-editor.es.js +1 -1
  26. package/dist/superdoc.cjs +2 -2
  27. package/dist/superdoc.es.js +2 -2
  28. package/dist/superdoc.umd.js +208 -70
  29. package/dist/superdoc.umd.js.map +1 -1
  30. 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-E5x6cBKw.cjs");
4
+ const superdoc = require("./index-DZPXVd1d.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-DeFp1DEO.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-KZsFukCq.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-CI3WoKIG.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-DhGXcD3R.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-nY9_xN6Z.cjs");
3
+ const superEditor_es = require("./super-editor.es-Crw7wu2n.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-nY9_xN6Z.cjs");
2
+ const superEditor_es = require("./super-editor.es-Crw7wu2n.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-CuTlpPQO.cjs")));
17271
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Dc7zft9M.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.61";
18160
+ this.version = "1.0.0-beta.63";
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 { 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-CI3WoKIG.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-DhGXcD3R.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-BHLsVrSe.es.js"));
17254
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-Enk2l025.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.61";
18143
+ this.version = "1.0.0-beta.63";
18144
18144
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18145
18145
  this.superdocId = config.superdocId || v4();
18146
18146
  this.colors = this.config.colors;
@@ -42131,11 +42131,71 @@ const _SuperConverter = class _SuperConverter2 {
42131
42131
  return JSON.parse(xmljs.xml2json(newXml, null, 2));
42132
42132
  }
42133
42133
  /**
42134
- * Generic method to get a stored custom property from docx
42134
+ * Checks if an element name matches the expected local name, with or without namespace prefix.
42135
+ * This helper supports custom namespace prefixes in DOCX files (e.g., 'op:Properties', 'custom:property').
42136
+ *
42137
+ * @private
42138
+ * @static
42139
+ * @param {string|undefined|null} elementName - The element name to check (may include namespace prefix)
42140
+ * @param {string} expectedLocalName - The expected local name without prefix
42141
+ * @returns {boolean} True if the element name matches (with or without prefix)
42142
+ *
42143
+ * @example
42144
+ * // Exact match without prefix
42145
+ * _matchesElementName('Properties', 'Properties') // => true
42146
+ *
42147
+ * @example
42148
+ * // Match with namespace prefix
42149
+ * _matchesElementName('op:Properties', 'Properties') // => true
42150
+ * _matchesElementName('custom:property', 'property') // => true
42151
+ *
42152
+ * @example
42153
+ * // No match
42154
+ * _matchesElementName('SomeOtherElement', 'Properties') // => false
42155
+ * _matchesElementName(':Properties', 'Properties') // => false (empty prefix)
42156
+ */
42157
+ static _matchesElementName(elementName, expectedLocalName) {
42158
+ if (!elementName || typeof elementName !== "string") return false;
42159
+ if (!expectedLocalName) return false;
42160
+ if (elementName === expectedLocalName) return true;
42161
+ if (elementName.endsWith(`:${expectedLocalName}`)) {
42162
+ const prefix2 = elementName.slice(0, -(expectedLocalName.length + 1));
42163
+ return prefix2.length > 0;
42164
+ }
42165
+ return false;
42166
+ }
42167
+ /**
42168
+ * Generic method to get a stored custom property from docx.
42169
+ * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
42170
+ *
42135
42171
  * @static
42136
42172
  * @param {Array} docx - Array of docx file objects
42137
42173
  * @param {string} propertyName - Name of the property to retrieve
42138
42174
  * @returns {string|null} The property value or null if not found
42175
+ *
42176
+ * Returns null in the following cases:
42177
+ * - docx array is empty or doesn't contain 'docProps/custom.xml'
42178
+ * - custom.xml cannot be parsed
42179
+ * - Properties element is not found (with or without namespace prefix)
42180
+ * - Property with the specified name is not found
42181
+ * - Property has malformed structure (missing nested elements or text)
42182
+ * - Any error occurs during parsing or retrieval
42183
+ *
42184
+ * @example
42185
+ * // Standard property without namespace prefix
42186
+ * const version = SuperConverter.getStoredCustomProperty(docx, 'SuperdocVersion');
42187
+ * // => '1.2.3'
42188
+ *
42189
+ * @example
42190
+ * // Property with namespace prefix (e.g., from Office 365)
42191
+ * const guid = SuperConverter.getStoredCustomProperty(docx, 'DocumentGuid');
42192
+ * // Works with both 'Properties' and 'op:Properties' elements
42193
+ * // => 'abc-123-def-456'
42194
+ *
42195
+ * @example
42196
+ * // Non-existent property
42197
+ * const missing = SuperConverter.getStoredCustomProperty(docx, 'NonExistent');
42198
+ * // => null
42139
42199
  */
42140
42200
  static getStoredCustomProperty(docx, propertyName) {
42141
42201
  try {
@@ -42144,10 +42204,16 @@ const _SuperConverter = class _SuperConverter2 {
42144
42204
  const converter = new _SuperConverter2();
42145
42205
  const content = customXml.content;
42146
42206
  const contentJson = converter.parseXmlToJson(content);
42147
- const properties = contentJson.elements?.find((el) => el.name === "Properties");
42207
+ const properties = contentJson?.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42148
42208
  if (!properties?.elements) return null;
42149
- const property2 = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
42209
+ const property2 = properties.elements.find(
42210
+ (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42211
+ );
42150
42212
  if (!property2) return null;
42213
+ if (!property2.elements?.[0]?.elements?.[0]?.text) {
42214
+ console.warn(`Malformed property structure for "${propertyName}"`);
42215
+ return null;
42216
+ }
42151
42217
  return property2.elements[0].elements[0].text;
42152
42218
  } catch (e) {
42153
42219
  console.warn(`Error getting custom property ${propertyName}:`, e);
@@ -42155,60 +42221,112 @@ const _SuperConverter = class _SuperConverter2 {
42155
42221
  }
42156
42222
  }
42157
42223
  /**
42158
- * Generic method to set a stored custom property in docx
42224
+ * Generic method to set a stored custom property in docx.
42225
+ * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
42226
+ *
42159
42227
  * @static
42160
- * @param {Object} docx - The docx object to store the property in
42228
+ * @param {Object} docx - The docx object to store the property in (converted XML structure)
42161
42229
  * @param {string} propertyName - Name of the property
42162
42230
  * @param {string|Function} value - Value or function that returns the value
42163
42231
  * @param {boolean} preserveExisting - If true, won't overwrite existing values
42164
- * @returns {string} The stored value
42232
+ * @returns {string|null} The stored value, or null if Properties element is not found
42233
+ *
42234
+ * @throws {Error} If an error occurs during property setting (logged as warning)
42235
+ *
42236
+ * @example
42237
+ * // Set a new property
42238
+ * const value = SuperConverter.setStoredCustomProperty(docx, 'MyProperty', 'MyValue');
42239
+ * // => 'MyValue'
42240
+ *
42241
+ * @example
42242
+ * // Set a property with a function
42243
+ * const guid = SuperConverter.setStoredCustomProperty(docx, 'DocumentGuid', () => uuidv4());
42244
+ * // => 'abc-123-def-456'
42245
+ *
42246
+ * @example
42247
+ * // Preserve existing value
42248
+ * SuperConverter.setStoredCustomProperty(docx, 'MyProperty', 'NewValue', true);
42249
+ * // => 'MyValue' (original value preserved)
42250
+ *
42251
+ * @example
42252
+ * // Works with namespace prefixes
42253
+ * // If docx has 'op:Properties' and 'op:property' elements, this will handle them correctly
42254
+ * const version = SuperConverter.setStoredCustomProperty(docx, 'Version', '2.0.0');
42255
+ * // => '2.0.0'
42165
42256
  */
42166
42257
  static setStoredCustomProperty(docx, propertyName, value, preserveExisting = false) {
42167
- const customLocation = "docProps/custom.xml";
42168
- if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
42169
- const customXml = docx[customLocation];
42170
- const properties = customXml.elements?.find((el) => el.name === "Properties");
42171
- if (!properties) return null;
42172
- if (!properties.elements) properties.elements = [];
42173
- let property2 = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
42174
- if (property2 && preserveExisting) {
42175
- return property2.elements[0].elements[0].text;
42176
- }
42177
- const finalValue = typeof value === "function" ? value() : value;
42178
- if (!property2) {
42179
- const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
42180
- const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42181
- property2 = {
42182
- type: "element",
42183
- name: "property",
42184
- attributes: {
42185
- name: propertyName,
42186
- fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
42187
- pid
42188
- },
42189
- elements: [
42190
- {
42191
- type: "element",
42192
- name: "vt:lpwstr",
42193
- elements: [
42194
- {
42195
- type: "text",
42196
- text: finalValue
42197
- }
42198
- ]
42199
- }
42200
- ]
42201
- };
42202
- properties.elements.push(property2);
42203
- } else {
42204
- property2.elements[0].elements[0].text = finalValue;
42258
+ try {
42259
+ const customLocation = "docProps/custom.xml";
42260
+ if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
42261
+ const customXml = docx[customLocation];
42262
+ const properties = customXml.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42263
+ if (!properties) return null;
42264
+ if (!properties.elements) properties.elements = [];
42265
+ let property2 = properties.elements.find(
42266
+ (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42267
+ );
42268
+ if (property2 && preserveExisting) {
42269
+ if (!property2.elements?.[0]?.elements?.[0]?.text) {
42270
+ console.warn(`Malformed existing property structure for "${propertyName}"`);
42271
+ return null;
42272
+ }
42273
+ return property2.elements[0].elements[0].text;
42274
+ }
42275
+ const finalValue = typeof value === "function" ? value() : value;
42276
+ if (!property2) {
42277
+ const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
42278
+ const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42279
+ property2 = {
42280
+ type: "element",
42281
+ name: "property",
42282
+ attributes: {
42283
+ name: propertyName,
42284
+ fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
42285
+ pid
42286
+ },
42287
+ elements: [
42288
+ {
42289
+ type: "element",
42290
+ name: "vt:lpwstr",
42291
+ elements: [
42292
+ {
42293
+ type: "text",
42294
+ text: finalValue
42295
+ }
42296
+ ]
42297
+ }
42298
+ ]
42299
+ };
42300
+ properties.elements.push(property2);
42301
+ } else {
42302
+ if (!property2.elements?.[0]?.elements?.[0]) {
42303
+ console.warn(`Malformed property structure for "${propertyName}", recreating structure`);
42304
+ property2.elements = [
42305
+ {
42306
+ type: "element",
42307
+ name: "vt:lpwstr",
42308
+ elements: [
42309
+ {
42310
+ type: "text",
42311
+ text: finalValue
42312
+ }
42313
+ ]
42314
+ }
42315
+ ];
42316
+ } else {
42317
+ property2.elements[0].elements[0].text = finalValue;
42318
+ }
42319
+ }
42320
+ return finalValue;
42321
+ } catch (e) {
42322
+ console.warn(`Error setting custom property ${propertyName}:`, e);
42323
+ return null;
42205
42324
  }
42206
- return finalValue;
42207
42325
  }
42208
42326
  static getStoredSuperdocVersion(docx) {
42209
42327
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42210
42328
  }
42211
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.61") {
42329
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.63") {
42212
42330
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42213
42331
  }
42214
42332
  /**
@@ -59397,7 +59515,7 @@ const isHeadless = (editor) => {
59397
59515
  const shouldSkipNodeView = (editor) => {
59398
59516
  return isHeadless(editor);
59399
59517
  };
59400
- const summaryVersion = "1.0.0-beta.61";
59518
+ const summaryVersion = "1.0.0-beta.63";
59401
59519
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59402
59520
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59403
59521
  function mapAttributes(attrs) {
@@ -60186,7 +60304,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60186
60304
  { default: remarkStringify },
60187
60305
  { default: remarkGfm }
60188
60306
  ] = await Promise.all([
60189
- Promise.resolve().then(() => require("./index-u8dj63PM-VgHx1nNP.cjs")),
60307
+ Promise.resolve().then(() => require("./index-BO5Ne6G9-njLy4w3i.cjs")),
60190
60308
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60191
60309
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60192
60310
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60391,7 +60509,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60391
60509
  * Process collaboration migrations
60392
60510
  */
60393
60511
  processCollaborationMigrations() {
60394
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.61");
60512
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.63");
60395
60513
  if (!this.options.ydoc) return;
60396
60514
  const metaMap = this.options.ydoc.getMap("meta");
60397
60515
  let docVersion = metaMap.get("version");
@@ -64364,12 +64482,6 @@ const Engines = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
64364
64482
  resolveSpacingIndent: resolveSpacingIndent$1,
64365
64483
  scaleWrapPolygon
64366
64484
  }, Symbol.toStringTag, { value: "Module" }));
64367
- const extractHeaderFooterSpace = (margins) => {
64368
- return {
64369
- headerSpace: margins?.header ?? 0,
64370
- footerSpace: margins?.footer ?? 0
64371
- };
64372
- };
64373
64485
  const hasParagraphStyleContext = (context) => {
64374
64486
  return Boolean(context?.docx);
64375
64487
  };
@@ -67284,8 +67396,7 @@ const normalizeRowHeight = (rowProps) => {
67284
67396
  if (rawValue == null) return void 0;
67285
67397
  const rawRule = heightObj.rule ?? heightObj.hRule;
67286
67398
  const rule = rawRule === "exact" || rawRule === "atLeast" || rawRule === "auto" ? rawRule : "atLeast";
67287
- const isLikelyTwips = rawValue >= 300 || Math.abs(rawValue % 15) < 1e-6;
67288
- const valuePx = isLikelyTwips ? twipsToPx$1(rawValue) : rawValue;
67399
+ const valuePx = twipsToPx$1(rawValue);
67289
67400
  return {
67290
67401
  value: valuePx,
67291
67402
  rule
@@ -72621,6 +72732,7 @@ const _DomPainter = class _DomPainter2 {
72621
72732
  container.style.height = `${data.height}px`;
72622
72733
  container.style.top = `${Math.max(0, offset2)}px`;
72623
72734
  container.style.zIndex = "1";
72735
+ container.style.overflow = "visible";
72624
72736
  let footerYOffset = 0;
72625
72737
  if (kind === "footer" && data.fragments.length > 0) {
72626
72738
  const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max2, f2) => {
@@ -81633,7 +81745,14 @@ async function measureParagraphBlock(block, maxWidth) {
81633
81745
  leftJustifiedMarkerSpace = markerBoxWidth + gutterWidth;
81634
81746
  }
81635
81747
  }
81636
- const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
81748
+ let initialAvailableWidth;
81749
+ const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
81750
+ const textStartPx = wordLayout?.textStartPx;
81751
+ if (isFirstLineIndentMode && typeof textStartPx === "number" && textStartPx > 0) {
81752
+ initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
81753
+ } else {
81754
+ initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
81755
+ }
81637
81756
  const tabStops = buildTabStopsPx(
81638
81757
  indent,
81639
81758
  block.attrs?.tabs,
@@ -83609,7 +83728,9 @@ class HeaderFooterLayoutAdapter {
83609
83728
  const batch = {};
83610
83729
  let hasBlocks = false;
83611
83730
  descriptors.forEach((descriptor) => {
83612
- if (!descriptor.variant) return;
83731
+ if (!descriptor.variant) {
83732
+ return;
83733
+ }
83613
83734
  const blocks = __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
83614
83735
  if (blocks && blocks.length > 0) {
83615
83736
  batch[descriptor.variant] = blocks;
@@ -86876,14 +86997,20 @@ computeHeaderFooterConstraints_fn = function() {
86876
86997
  const margins = __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
86877
86998
  const marginLeft = margins.left ?? DEFAULT_MARGINS.left;
86878
86999
  const marginRight = margins.right ?? DEFAULT_MARGINS.right;
86879
- const width = pageSize.w - (marginLeft + marginRight);
86880
- if (!Number.isFinite(width) || width <= 0) {
87000
+ const bodyContentWidth = pageSize.w - (marginLeft + marginRight);
87001
+ if (!Number.isFinite(bodyContentWidth) || bodyContentWidth <= 0) {
86881
87002
  return null;
86882
87003
  }
86883
- const { headerSpace, footerSpace } = extractHeaderFooterSpace(margins);
86884
- const height = Math.max(headerSpace, footerSpace, 1);
87004
+ const measurementWidth = bodyContentWidth;
87005
+ const marginTop = margins.top ?? DEFAULT_MARGINS.top;
87006
+ const marginBottom = margins.bottom ?? DEFAULT_MARGINS.bottom;
87007
+ const headerMargin = margins.header ?? 0;
87008
+ const footerMargin = margins.footer ?? 0;
87009
+ const headerContentSpace = Math.max(marginTop - headerMargin, 0);
87010
+ const footerContentSpace = Math.max(marginBottom - footerMargin, 0);
87011
+ const height = Math.max(headerContentSpace, footerContentSpace, 1);
86885
87012
  return {
86886
- width,
87013
+ width: measurementWidth,
86887
87014
  height,
86888
87015
  // Pass actual page dimensions for page-relative anchor positioning in headers/footers
86889
87016
  pageWidth: pageSize.w,
@@ -91286,7 +91413,11 @@ const splitRunsAfterMarkPlugin = new Plugin({
91286
91413
  const runType = newState.schema.nodes["run"];
91287
91414
  if (!runType) return null;
91288
91415
  const runPositions = /* @__PURE__ */ new Set();
91416
+ const docSize = newState.doc.content.size;
91289
91417
  markRanges.forEach(({ from: from2, to }) => {
91418
+ if (from2 < 0 || to < 0 || from2 > docSize || to > docSize || from2 > to) {
91419
+ return;
91420
+ }
91290
91421
  newState.doc.nodesBetween(from2, to, (node, pos) => {
91291
91422
  if (node.type === runType) runPositions.add(pos);
91292
91423
  });
@@ -118860,13 +118991,20 @@ const _sfc_main$e = {
118860
118991
  const { $from, empty: empty2 } = selection;
118861
118992
  if (empty2) {
118862
118993
  const marks = state2.storedMarks || $from.marks();
118863
- const link = marks.find((mark) => mark.type === linkMark);
118864
- if (link) href = link.attrs.href;
118994
+ let link = marks.find((mark) => mark.type === linkMark);
118995
+ if (!link) {
118996
+ const nodeAfter = $from.nodeAfter;
118997
+ const nodeBefore = $from.nodeBefore;
118998
+ const marksOnNodeAfter = nodeAfter && Array.isArray(nodeAfter.marks) ? nodeAfter.marks : [];
118999
+ const marksOnNodeBefore = nodeBefore && Array.isArray(nodeBefore.marks) ? nodeBefore.marks : [];
119000
+ link = marksOnNodeAfter.find((mark) => mark.type === linkMark) || marksOnNodeBefore.find((mark) => mark.type === linkMark);
119001
+ }
119002
+ if (link && link.attrs && link.attrs.href) href = link.attrs.href;
118865
119003
  } else {
118866
119004
  state2.doc.nodesBetween(selection.from, selection.to, (node) => {
118867
119005
  if (node.marks) {
118868
119006
  const link = node.marks.find((mark) => mark.type === linkMark);
118869
- if (link) href = link.attrs.href;
119007
+ if (link && link.attrs && link.attrs.href) href = link.attrs.href;
118870
119008
  }
118871
119009
  });
118872
119010
  }
@@ -119009,7 +119147,7 @@ const _sfc_main$e = {
119009
119147
  };
119010
119148
  }
119011
119149
  };
119012
- const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-ba50627b"]]);
119150
+ const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-de37bd1c"]]);
119013
119151
  const _hoisted_1$b = ["aria-label", "onClick", "onKeydown"];
119014
119152
  const _hoisted_2$6 = ["innerHTML"];
119015
119153
  const _hoisted_3$5 = ["innerHTML"];