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
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _MARK_TOGGLE_NAMES, _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn, syncStickyMarksFromState_fn, restoreStickyMarksIfNeeded_fn, ensureStoredMarksForMarkToggle_fn;
12
- import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, ar as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, al as parseSizeUnit, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-DaSkPzA9.js";
13
- import { ac, i, a9, aQ } from "./chunks/converter-DaSkPzA9.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as generateRulerDefinition, n as clampHandlePosition, o as calculateMarginFromHandle, p as measureCache, q as isHeadless, E as Editor, t as getStarterExtensions, P as PresentationEditor, v as Placeholder, w as getRichTextExtensions, D as DecorationSet, x as Decoration, M as Mark, z as Extension, A as Attribute, N as Node } from "./chunks/editor-45pxcsTR.js";
15
- import { F, I, G, T, B, H, C } from "./chunks/editor-45pxcsTR.js";
12
+ import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, ar as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, al as parseSizeUnit, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-C4bE8Uad.js";
13
+ import { ac, i, a9, aQ } from "./chunks/converter-C4bE8Uad.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as generateRulerDefinition, n as clampHandlePosition, o as calculateMarginFromHandle, p as measureCache, q as isHeadless, E as Editor, t as getStarterExtensions, P as PresentationEditor, v as Placeholder, w as getRichTextExtensions, D as DecorationSet, x as Decoration, M as Mark, z as Extension, A as Attribute, N as Node } from "./chunks/editor-ByMtGRzi.js";
15
+ import { F, I, G, T, B, H, C } from "./chunks/editor-ByMtGRzi.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, defineComponent, reactive, onUnmounted, renderSlot, useCssVars, shallowRef, createBlock, Teleport, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-C4OC-AnI.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-DFgaXUsx.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-Cx1zgQ8B.js";
19
+ import { D } from "./chunks/docx-zipper-BIkbwyZO.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -659,13 +659,20 @@ const _sfc_main$e = {
659
659
  const { $from, empty } = selection;
660
660
  if (empty) {
661
661
  const marks = state.storedMarks || $from.marks();
662
- const link = marks.find((mark) => mark.type === linkMark);
663
- if (link) href = link.attrs.href;
662
+ let link = marks.find((mark) => mark.type === linkMark);
663
+ if (!link) {
664
+ const nodeAfter = $from.nodeAfter;
665
+ const nodeBefore = $from.nodeBefore;
666
+ const marksOnNodeAfter = nodeAfter && Array.isArray(nodeAfter.marks) ? nodeAfter.marks : [];
667
+ const marksOnNodeBefore = nodeBefore && Array.isArray(nodeBefore.marks) ? nodeBefore.marks : [];
668
+ link = marksOnNodeAfter.find((mark) => mark.type === linkMark) || marksOnNodeBefore.find((mark) => mark.type === linkMark);
669
+ }
670
+ if (link && link.attrs && link.attrs.href) href = link.attrs.href;
664
671
  } else {
665
672
  state.doc.nodesBetween(selection.from, selection.to, (node) => {
666
673
  if (node.marks) {
667
674
  const link = node.marks.find((mark) => mark.type === linkMark);
668
- if (link) href = link.attrs.href;
675
+ if (link && link.attrs && link.attrs.href) href = link.attrs.href;
669
676
  }
670
677
  });
671
678
  }
@@ -808,7 +815,7 @@ const _sfc_main$e = {
808
815
  };
809
816
  }
810
817
  };
811
- const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-ba50627b"]]);
818
+ const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-de37bd1c"]]);
812
819
  const _hoisted_1$b = ["aria-label", "onClick", "onKeydown"];
813
820
  const _hoisted_2$6 = ["innerHTML"];
814
821
  const _hoisted_3$5 = ["innerHTML"];
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-C4OC-AnI.js";
3
- import "./chunks/editor-45pxcsTR.js";
2
+ import { T } from "./chunks/toolbar-DFgaXUsx.js";
3
+ import "./chunks/editor-ByMtGRzi.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-nY9_xN6Z.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Crw7wu2n.cjs");
4
4
  require("./chunks/vue-jWLMl8Ts.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-CI3WoKIG.es.js";
1
+ import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-DhGXcD3R.es.js";
2
2
  import "./chunks/vue-Dysv_7z5.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-nY9_xN6Z.cjs");
4
- const superdoc = require("./chunks/index-E5x6cBKw.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Crw7wu2n.cjs");
4
+ const superdoc = require("./chunks/index-DZPXVd1d.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
7
7
  exports.Editor = superEditor_es.Editor;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-CI3WoKIG.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DeFp1DEO.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DhGXcD3R.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-KZsFukCq.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -42132,11 +42132,71 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42132
42132
  return JSON.parse(xmljs.xml2json(newXml, null, 2));
42133
42133
  }
42134
42134
  /**
42135
- * Generic method to get a stored custom property from docx
42135
+ * Checks if an element name matches the expected local name, with or without namespace prefix.
42136
+ * This helper supports custom namespace prefixes in DOCX files (e.g., 'op:Properties', 'custom:property').
42137
+ *
42138
+ * @private
42139
+ * @static
42140
+ * @param {string|undefined|null} elementName - The element name to check (may include namespace prefix)
42141
+ * @param {string} expectedLocalName - The expected local name without prefix
42142
+ * @returns {boolean} True if the element name matches (with or without prefix)
42143
+ *
42144
+ * @example
42145
+ * // Exact match without prefix
42146
+ * _matchesElementName('Properties', 'Properties') // => true
42147
+ *
42148
+ * @example
42149
+ * // Match with namespace prefix
42150
+ * _matchesElementName('op:Properties', 'Properties') // => true
42151
+ * _matchesElementName('custom:property', 'property') // => true
42152
+ *
42153
+ * @example
42154
+ * // No match
42155
+ * _matchesElementName('SomeOtherElement', 'Properties') // => false
42156
+ * _matchesElementName(':Properties', 'Properties') // => false (empty prefix)
42157
+ */
42158
+ static _matchesElementName(elementName, expectedLocalName) {
42159
+ if (!elementName || typeof elementName !== "string") return false;
42160
+ if (!expectedLocalName) return false;
42161
+ if (elementName === expectedLocalName) return true;
42162
+ if (elementName.endsWith(`:${expectedLocalName}`)) {
42163
+ const prefix2 = elementName.slice(0, -(expectedLocalName.length + 1));
42164
+ return prefix2.length > 0;
42165
+ }
42166
+ return false;
42167
+ }
42168
+ /**
42169
+ * Generic method to get a stored custom property from docx.
42170
+ * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
42171
+ *
42136
42172
  * @static
42137
42173
  * @param {Array} docx - Array of docx file objects
42138
42174
  * @param {string} propertyName - Name of the property to retrieve
42139
42175
  * @returns {string|null} The property value or null if not found
42176
+ *
42177
+ * Returns null in the following cases:
42178
+ * - docx array is empty or doesn't contain 'docProps/custom.xml'
42179
+ * - custom.xml cannot be parsed
42180
+ * - Properties element is not found (with or without namespace prefix)
42181
+ * - Property with the specified name is not found
42182
+ * - Property has malformed structure (missing nested elements or text)
42183
+ * - Any error occurs during parsing or retrieval
42184
+ *
42185
+ * @example
42186
+ * // Standard property without namespace prefix
42187
+ * const version = SuperConverter.getStoredCustomProperty(docx, 'SuperdocVersion');
42188
+ * // => '1.2.3'
42189
+ *
42190
+ * @example
42191
+ * // Property with namespace prefix (e.g., from Office 365)
42192
+ * const guid = SuperConverter.getStoredCustomProperty(docx, 'DocumentGuid');
42193
+ * // Works with both 'Properties' and 'op:Properties' elements
42194
+ * // => 'abc-123-def-456'
42195
+ *
42196
+ * @example
42197
+ * // Non-existent property
42198
+ * const missing = SuperConverter.getStoredCustomProperty(docx, 'NonExistent');
42199
+ * // => null
42140
42200
  */
42141
42201
  static getStoredCustomProperty(docx, propertyName) {
42142
42202
  try {
@@ -42145,10 +42205,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42145
42205
  const converter = new _SuperConverter2();
42146
42206
  const content2 = customXml.content;
42147
42207
  const contentJson = converter.parseXmlToJson(content2);
42148
- const properties = contentJson.elements?.find((el) => el.name === "Properties");
42208
+ const properties = contentJson?.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42149
42209
  if (!properties?.elements) return null;
42150
- const property2 = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
42210
+ const property2 = properties.elements.find(
42211
+ (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42212
+ );
42151
42213
  if (!property2) return null;
42214
+ if (!property2.elements?.[0]?.elements?.[0]?.text) {
42215
+ console.warn(`Malformed property structure for "${propertyName}"`);
42216
+ return null;
42217
+ }
42152
42218
  return property2.elements[0].elements[0].text;
42153
42219
  } catch (e) {
42154
42220
  console.warn(`Error getting custom property ${propertyName}:`, e);
@@ -42156,60 +42222,112 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42156
42222
  }
42157
42223
  }
42158
42224
  /**
42159
- * Generic method to set a stored custom property in docx
42225
+ * Generic method to set a stored custom property in docx.
42226
+ * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
42227
+ *
42160
42228
  * @static
42161
- * @param {Object} docx - The docx object to store the property in
42229
+ * @param {Object} docx - The docx object to store the property in (converted XML structure)
42162
42230
  * @param {string} propertyName - Name of the property
42163
42231
  * @param {string|Function} value - Value or function that returns the value
42164
42232
  * @param {boolean} preserveExisting - If true, won't overwrite existing values
42165
- * @returns {string} The stored value
42233
+ * @returns {string|null} The stored value, or null if Properties element is not found
42234
+ *
42235
+ * @throws {Error} If an error occurs during property setting (logged as warning)
42236
+ *
42237
+ * @example
42238
+ * // Set a new property
42239
+ * const value = SuperConverter.setStoredCustomProperty(docx, 'MyProperty', 'MyValue');
42240
+ * // => 'MyValue'
42241
+ *
42242
+ * @example
42243
+ * // Set a property with a function
42244
+ * const guid = SuperConverter.setStoredCustomProperty(docx, 'DocumentGuid', () => uuidv4());
42245
+ * // => 'abc-123-def-456'
42246
+ *
42247
+ * @example
42248
+ * // Preserve existing value
42249
+ * SuperConverter.setStoredCustomProperty(docx, 'MyProperty', 'NewValue', true);
42250
+ * // => 'MyValue' (original value preserved)
42251
+ *
42252
+ * @example
42253
+ * // Works with namespace prefixes
42254
+ * // If docx has 'op:Properties' and 'op:property' elements, this will handle them correctly
42255
+ * const version = SuperConverter.setStoredCustomProperty(docx, 'Version', '2.0.0');
42256
+ * // => '2.0.0'
42166
42257
  */
42167
42258
  static setStoredCustomProperty(docx, propertyName, value, preserveExisting = false) {
42168
- const customLocation = "docProps/custom.xml";
42169
- if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
42170
- const customXml = docx[customLocation];
42171
- const properties = customXml.elements?.find((el) => el.name === "Properties");
42172
- if (!properties) return null;
42173
- if (!properties.elements) properties.elements = [];
42174
- let property2 = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
42175
- if (property2 && preserveExisting) {
42176
- return property2.elements[0].elements[0].text;
42177
- }
42178
- const finalValue = typeof value === "function" ? value() : value;
42179
- if (!property2) {
42180
- const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
42181
- const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42182
- property2 = {
42183
- type: "element",
42184
- name: "property",
42185
- attributes: {
42186
- name: propertyName,
42187
- fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
42188
- pid
42189
- },
42190
- elements: [
42191
- {
42192
- type: "element",
42193
- name: "vt:lpwstr",
42194
- elements: [
42195
- {
42196
- type: "text",
42197
- text: finalValue
42198
- }
42199
- ]
42200
- }
42201
- ]
42202
- };
42203
- properties.elements.push(property2);
42204
- } else {
42205
- property2.elements[0].elements[0].text = finalValue;
42259
+ try {
42260
+ const customLocation = "docProps/custom.xml";
42261
+ if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
42262
+ const customXml = docx[customLocation];
42263
+ const properties = customXml.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42264
+ if (!properties) return null;
42265
+ if (!properties.elements) properties.elements = [];
42266
+ let property2 = properties.elements.find(
42267
+ (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42268
+ );
42269
+ if (property2 && preserveExisting) {
42270
+ if (!property2.elements?.[0]?.elements?.[0]?.text) {
42271
+ console.warn(`Malformed existing property structure for "${propertyName}"`);
42272
+ return null;
42273
+ }
42274
+ return property2.elements[0].elements[0].text;
42275
+ }
42276
+ const finalValue = typeof value === "function" ? value() : value;
42277
+ if (!property2) {
42278
+ const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
42279
+ const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42280
+ property2 = {
42281
+ type: "element",
42282
+ name: "property",
42283
+ attributes: {
42284
+ name: propertyName,
42285
+ fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
42286
+ pid
42287
+ },
42288
+ elements: [
42289
+ {
42290
+ type: "element",
42291
+ name: "vt:lpwstr",
42292
+ elements: [
42293
+ {
42294
+ type: "text",
42295
+ text: finalValue
42296
+ }
42297
+ ]
42298
+ }
42299
+ ]
42300
+ };
42301
+ properties.elements.push(property2);
42302
+ } else {
42303
+ if (!property2.elements?.[0]?.elements?.[0]) {
42304
+ console.warn(`Malformed property structure for "${propertyName}", recreating structure`);
42305
+ property2.elements = [
42306
+ {
42307
+ type: "element",
42308
+ name: "vt:lpwstr",
42309
+ elements: [
42310
+ {
42311
+ type: "text",
42312
+ text: finalValue
42313
+ }
42314
+ ]
42315
+ }
42316
+ ];
42317
+ } else {
42318
+ property2.elements[0].elements[0].text = finalValue;
42319
+ }
42320
+ }
42321
+ return finalValue;
42322
+ } catch (e) {
42323
+ console.warn(`Error setting custom property ${propertyName}:`, e);
42324
+ return null;
42206
42325
  }
42207
- return finalValue;
42208
42326
  }
42209
42327
  static getStoredSuperdocVersion(docx) {
42210
42328
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42211
42329
  }
42212
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.61") {
42330
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.63") {
42213
42331
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42214
42332
  }
42215
42333
  /**
@@ -67255,7 +67373,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67255
67373
  const shouldSkipNodeView = (editor) => {
67256
67374
  return isHeadless(editor);
67257
67375
  };
67258
- const summaryVersion = "1.0.0-beta.61";
67376
+ const summaryVersion = "1.0.0-beta.63";
67259
67377
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67260
67378
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67261
67379
  function mapAttributes(attrs) {
@@ -68044,7 +68162,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68044
68162
  { default: remarkStringify2 },
68045
68163
  { default: remarkGfm2 }
68046
68164
  ] = await Promise.all([
68047
- Promise.resolve().then(() => indexU8dj63PM),
68165
+ Promise.resolve().then(() => indexBO5Ne6G9),
68048
68166
  Promise.resolve().then(() => indexDRCvimau),
68049
68167
  Promise.resolve().then(() => indexC_x_N6Uh),
68050
68168
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68249,7 +68367,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68249
68367
  * Process collaboration migrations
68250
68368
  */
68251
68369
  processCollaborationMigrations() {
68252
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.61");
68370
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.63");
68253
68371
  if (!this.options.ydoc) return;
68254
68372
  const metaMap = this.options.ydoc.getMap("meta");
68255
68373
  let docVersion = metaMap.get("version");
@@ -72222,12 +72340,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72222
72340
  resolveSpacingIndent: resolveSpacingIndent$1,
72223
72341
  scaleWrapPolygon
72224
72342
  }, Symbol.toStringTag, { value: "Module" }));
72225
- const extractHeaderFooterSpace = (margins) => {
72226
- return {
72227
- headerSpace: margins?.header ?? 0,
72228
- footerSpace: margins?.footer ?? 0
72229
- };
72230
- };
72231
72343
  const hasParagraphStyleContext = (context) => {
72232
72344
  return Boolean(context?.docx);
72233
72345
  };
@@ -75142,8 +75254,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75142
75254
  if (rawValue == null) return void 0;
75143
75255
  const rawRule = heightObj.rule ?? heightObj.hRule;
75144
75256
  const rule = rawRule === "exact" || rawRule === "atLeast" || rawRule === "auto" ? rawRule : "atLeast";
75145
- const isLikelyTwips = rawValue >= 300 || Math.abs(rawValue % 15) < 1e-6;
75146
- const valuePx = isLikelyTwips ? twipsToPx$1(rawValue) : rawValue;
75257
+ const valuePx = twipsToPx$1(rawValue);
75147
75258
  return {
75148
75259
  value: valuePx,
75149
75260
  rule
@@ -80479,6 +80590,7 @@ ${l}
80479
80590
  container.style.height = `${data.height}px`;
80480
80591
  container.style.top = `${Math.max(0, offset2)}px`;
80481
80592
  container.style.zIndex = "1";
80593
+ container.style.overflow = "visible";
80482
80594
  let footerYOffset = 0;
80483
80595
  if (kind === "footer" && data.fragments.length > 0) {
80484
80596
  const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max2, f2) => {
@@ -89491,7 +89603,14 @@ ${l}
89491
89603
  leftJustifiedMarkerSpace = markerBoxWidth + gutterWidth;
89492
89604
  }
89493
89605
  }
89494
- const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
89606
+ let initialAvailableWidth;
89607
+ const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
89608
+ const textStartPx = wordLayout?.textStartPx;
89609
+ if (isFirstLineIndentMode && typeof textStartPx === "number" && textStartPx > 0) {
89610
+ initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
89611
+ } else {
89612
+ initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
89613
+ }
89495
89614
  const tabStops = buildTabStopsPx(
89496
89615
  indent2,
89497
89616
  block.attrs?.tabs,
@@ -91467,7 +91586,9 @@ ${l}
91467
91586
  const batch2 = {};
91468
91587
  let hasBlocks = false;
91469
91588
  descriptors.forEach((descriptor) => {
91470
- if (!descriptor.variant) return;
91589
+ if (!descriptor.variant) {
91590
+ return;
91591
+ }
91471
91592
  const blocks2 = __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
91472
91593
  if (blocks2 && blocks2.length > 0) {
91473
91594
  batch2[descriptor.variant] = blocks2;
@@ -94734,14 +94855,20 @@ ${l}
94734
94855
  const margins = __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
94735
94856
  const marginLeft = margins.left ?? DEFAULT_MARGINS.left;
94736
94857
  const marginRight = margins.right ?? DEFAULT_MARGINS.right;
94737
- const width = pageSize.w - (marginLeft + marginRight);
94738
- if (!Number.isFinite(width) || width <= 0) {
94858
+ const bodyContentWidth = pageSize.w - (marginLeft + marginRight);
94859
+ if (!Number.isFinite(bodyContentWidth) || bodyContentWidth <= 0) {
94739
94860
  return null;
94740
94861
  }
94741
- const { headerSpace, footerSpace } = extractHeaderFooterSpace(margins);
94742
- const height = Math.max(headerSpace, footerSpace, 1);
94862
+ const measurementWidth = bodyContentWidth;
94863
+ const marginTop = margins.top ?? DEFAULT_MARGINS.top;
94864
+ const marginBottom = margins.bottom ?? DEFAULT_MARGINS.bottom;
94865
+ const headerMargin = margins.header ?? 0;
94866
+ const footerMargin = margins.footer ?? 0;
94867
+ const headerContentSpace = Math.max(marginTop - headerMargin, 0);
94868
+ const footerContentSpace = Math.max(marginBottom - footerMargin, 0);
94869
+ const height = Math.max(headerContentSpace, footerContentSpace, 1);
94743
94870
  return {
94744
- width,
94871
+ width: measurementWidth,
94745
94872
  height,
94746
94873
  // Pass actual page dimensions for page-relative anchor positioning in headers/footers
94747
94874
  pageWidth: pageSize.w,
@@ -99144,7 +99271,11 @@ ${l}
99144
99271
  const runType = newState.schema.nodes["run"];
99145
99272
  if (!runType) return null;
99146
99273
  const runPositions = /* @__PURE__ */ new Set();
99274
+ const docSize = newState.doc.content.size;
99147
99275
  markRanges.forEach(({ from: from2, to }) => {
99276
+ if (from2 < 0 || to < 0 || from2 > docSize || to > docSize || from2 > to) {
99277
+ return;
99278
+ }
99148
99279
  newState.doc.nodesBetween(from2, to, (node2, pos) => {
99149
99280
  if (node2.type === runType) runPositions.add(pos);
99150
99281
  });
@@ -126718,13 +126849,20 @@ ${style2}
126718
126849
  const { $from, empty: empty2 } = selection;
126719
126850
  if (empty2) {
126720
126851
  const marks = state2.storedMarks || $from.marks();
126721
- const link2 = marks.find((mark2) => mark2.type === linkMark);
126722
- if (link2) href = link2.attrs.href;
126852
+ let link2 = marks.find((mark2) => mark2.type === linkMark);
126853
+ if (!link2) {
126854
+ const nodeAfter = $from.nodeAfter;
126855
+ const nodeBefore = $from.nodeBefore;
126856
+ const marksOnNodeAfter = nodeAfter && Array.isArray(nodeAfter.marks) ? nodeAfter.marks : [];
126857
+ const marksOnNodeBefore = nodeBefore && Array.isArray(nodeBefore.marks) ? nodeBefore.marks : [];
126858
+ link2 = marksOnNodeAfter.find((mark2) => mark2.type === linkMark) || marksOnNodeBefore.find((mark2) => mark2.type === linkMark);
126859
+ }
126860
+ if (link2 && link2.attrs && link2.attrs.href) href = link2.attrs.href;
126723
126861
  } else {
126724
126862
  state2.doc.nodesBetween(selection.from, selection.to, (node2) => {
126725
126863
  if (node2.marks) {
126726
126864
  const link2 = node2.marks.find((mark2) => mark2.type === linkMark);
126727
- if (link2) href = link2.attrs.href;
126865
+ if (link2 && link2.attrs && link2.attrs.href) href = link2.attrs.href;
126728
126866
  }
126729
126867
  });
126730
126868
  }
@@ -126867,7 +127005,7 @@ ${style2}
126867
127005
  };
126868
127006
  }
126869
127007
  };
126870
- const LinkInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$e$1, [["__scopeId", "data-v-ba50627b"]]);
127008
+ const LinkInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$e$1, [["__scopeId", "data-v-de37bd1c"]]);
126871
127009
  const _hoisted_1$b$1 = ["aria-label", "onClick", "onKeydown"];
126872
127010
  const _hoisted_2$6$1 = ["innerHTML"];
126873
127011
  const _hoisted_3$5$1 = ["innerHTML"];
@@ -149717,7 +149855,7 @@ ${style2}
149717
149855
  this.config.colors = shuffleArray(this.config.colors);
149718
149856
  this.userColorMap = /* @__PURE__ */ new Map();
149719
149857
  this.colorIndex = 0;
149720
- this.version = "1.0.0-beta.61";
149858
+ this.version = "1.0.0-beta.63";
149721
149859
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
149722
149860
  this.superdocId = config2.superdocId || v4();
149723
149861
  this.colors = this.config.colors;
@@ -152189,7 +152327,7 @@ ${style2}
152189
152327
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
152190
152328
  );
152191
152329
  }
152192
- const indexU8dj63PM = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
152330
+ const indexBO5Ne6G9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
152193
152331
  __proto__: null,
152194
152332
  unified
152195
152333
  }, Symbol.toStringTag, { value: "Module" }));