@harbour-enterprises/superdoc 1.0.0-beta.94 → 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-CC_fv7lS.cjs → PdfViewer-BGTfnD4T.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BR7hR5hX.es.js → PdfViewer-Cdp1WJ9e.es.js} +1 -1
  3. package/dist/chunks/{index-JAE9iqTX.es.js → index-BV9YtiyI.es.js} +3 -3
  4. package/dist/chunks/{index-DHRt1tCk.cjs → index-C-IS20yQ.cjs} +3 -3
  5. package/dist/chunks/{index-BstIHBcW-BxKvjs-R.es.js → index-lfdM_gm7-_EQjLyqH.es.js} +1 -1
  6. package/dist/chunks/{index-BstIHBcW-6lPNsqaA.cjs → index-lfdM_gm7-qtx-V4oF.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-DXKgM3JR.cjs → super-editor.es-D2zn943K.cjs} +83 -24
  8. package/dist/chunks/{super-editor.es-C1RjP_IO.es.js → super-editor.es-De2XS3A1.es.js} +83 -24
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CIgfC-et.js → converter-B29ATZFC.js} +26 -2
  11. package/dist/super-editor/chunks/{docx-zipper-AQa91HPZ.js → docx-zipper-BPktKUBx.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-6Tyu_6Nf.js → editor-BRHMYtPA.js} +59 -24
  13. package/dist/super-editor/chunks/{index-BstIHBcW.js → index-lfdM_gm7.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-yzD6N9Br.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 +93 -34
  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-DHRt1tCk.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-JAE9iqTX.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-C1RjP_IO.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-BR7hR5hX.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.94";
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-DXKgM3JR.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-CC_fv7lS.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.94";
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-C1RjP_IO.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-DXKgM3JR.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) {
@@ -42235,6 +42235,24 @@ const _SuperConverter = class _SuperConverter2 {
42235
42235
  }
42236
42236
  return false;
42237
42237
  }
42238
+ /**
42239
+ * Extracts the namespace prefix from an element name.
42240
+ *
42241
+ * @private
42242
+ * @static
42243
+ * @param {string} elementName - The element name (may include namespace prefix, e.g., 'op:Properties')
42244
+ * @returns {string} The namespace prefix (e.g., 'op') or empty string if no prefix
42245
+ *
42246
+ * @example
42247
+ * _extractNamespacePrefix('op:Properties') // => 'op'
42248
+ * _extractNamespacePrefix('Properties') // => ''
42249
+ * _extractNamespacePrefix('custom:property') // => 'custom'
42250
+ */
42251
+ static _extractNamespacePrefix(elementName) {
42252
+ if (!elementName || typeof elementName !== "string") return "";
42253
+ const colonIndex = elementName.indexOf(":");
42254
+ return colonIndex > 0 ? elementName.slice(0, colonIndex) : "";
42255
+ }
42238
42256
  /**
42239
42257
  * Generic method to get a stored custom property from docx.
42240
42258
  * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
@@ -42333,6 +42351,8 @@ const _SuperConverter = class _SuperConverter2 {
42333
42351
  const properties = customXml.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42334
42352
  if (!properties) return null;
42335
42353
  if (!properties.elements) properties.elements = [];
42354
+ const namespacePrefix = _SuperConverter2._extractNamespacePrefix(properties.name);
42355
+ const propertyElementName = namespacePrefix ? `${namespacePrefix}:property` : "property";
42336
42356
  let property2 = properties.elements.find(
42337
42357
  (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42338
42358
  );
@@ -42349,7 +42369,7 @@ const _SuperConverter = class _SuperConverter2 {
42349
42369
  const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42350
42370
  property2 = {
42351
42371
  type: "element",
42352
- name: "property",
42372
+ name: propertyElementName,
42353
42373
  attributes: {
42354
42374
  name: propertyName,
42355
42375
  fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
@@ -42370,6 +42390,10 @@ const _SuperConverter = class _SuperConverter2 {
42370
42390
  };
42371
42391
  properties.elements.push(property2);
42372
42392
  } else {
42393
+ const existingPropertyPrefix = _SuperConverter2._extractNamespacePrefix(property2.name);
42394
+ if (existingPropertyPrefix !== namespacePrefix) {
42395
+ property2.name = propertyElementName;
42396
+ }
42373
42397
  if (!property2.elements?.[0]?.elements?.[0]) {
42374
42398
  console.warn(`Malformed property structure for "${propertyName}", recreating structure`);
42375
42399
  property2.elements = [
@@ -42397,7 +42421,7 @@ const _SuperConverter = class _SuperConverter2 {
42397
42421
  static getStoredSuperdocVersion(docx) {
42398
42422
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42399
42423
  }
42400
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.94") {
42424
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.96") {
42401
42425
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42402
42426
  }
42403
42427
  /**
@@ -59615,7 +59639,7 @@ const isHeadless = (editor) => {
59615
59639
  const shouldSkipNodeView = (editor) => {
59616
59640
  return isHeadless(editor);
59617
59641
  };
59618
- const summaryVersion = "1.0.0-beta.94";
59642
+ const summaryVersion = "1.0.0-beta.96";
59619
59643
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59620
59644
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59621
59645
  function mapAttributes(attrs) {
@@ -60404,7 +60428,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60404
60428
  { default: remarkStringify },
60405
60429
  { default: remarkGfm }
60406
60430
  ] = await Promise.all([
60407
- Promise.resolve().then(() => require("./index-BstIHBcW-6lPNsqaA.cjs")),
60431
+ Promise.resolve().then(() => require("./index-lfdM_gm7-qtx-V4oF.cjs")),
60408
60432
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60409
60433
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60410
60434
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60609,7 +60633,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60609
60633
  * Process collaboration migrations
60610
60634
  */
60611
60635
  processCollaborationMigrations() {
60612
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.94");
60636
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.96");
60613
60637
  if (!this.options.ydoc) return;
60614
60638
  const metaMap = this.options.ydoc.getMap("meta");
60615
60639
  let docVersion = metaMap.get("version");
@@ -66669,6 +66693,13 @@ const isTruthy = (value) => {
66669
66693
  }
66670
66694
  return false;
66671
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
+ };
66672
66703
  const isExplicitFalse = (value) => {
66673
66704
  if (value === false || value === 0) return true;
66674
66705
  if (typeof value === "string") {
@@ -67161,8 +67192,9 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67161
67192
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
67162
67193
  }
67163
67194
  }
67164
- if (normalizedSpacing?.contextualSpacing != null) {
67165
- paragraphAttrs.contextualSpacing = normalizedSpacing.contextualSpacing;
67195
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
67196
+ if (contextualSpacingValue != null) {
67197
+ paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
67166
67198
  }
67167
67199
  const hasExplicitIndent = Boolean(normalizedIndent);
67168
67200
  const hasNumberingIndent = Boolean(computed2.numbering?.indent?.left || computed2.numbering?.indent?.hanging);
@@ -67214,7 +67246,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67214
67246
  paragraphAttrs.tabs = normalizedTabs;
67215
67247
  }
67216
67248
  }
67217
- const asString = (value) => {
67249
+ const asString2 = (value) => {
67218
67250
  return typeof value === "string" ? value : void 0;
67219
67251
  };
67220
67252
  const normalizeFramePr = (value) => {
@@ -67237,7 +67269,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67237
67269
  };
67238
67270
  const framePr = normalizeFramePr(attrs.framePr) ?? normalizeFramePr(attrs.paragraphProperties?.framePr) ?? extractFramePrFromElements(attrs.paragraphProperties);
67239
67271
  if (framePr) {
67240
- const rawXAlign = asString(framePr["w:xAlign"] ?? framePr.xAlign);
67272
+ const rawXAlign = asString2(framePr["w:xAlign"] ?? framePr.xAlign);
67241
67273
  const xAlign = typeof rawXAlign === "string" ? rawXAlign.toLowerCase() : void 0;
67242
67274
  if (xAlign === "left" || xAlign === "right" || xAlign === "center") {
67243
67275
  paragraphAttrs.floatAlignment = xAlign;
@@ -67247,7 +67279,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67247
67279
  paragraphAttrs.dropCap = dropCap;
67248
67280
  const dropCapMode = typeof dropCap === "string" ? dropCap.toLowerCase() : "drop";
67249
67281
  const linesValue = pickNumber(framePr["w:lines"] ?? framePr.lines);
67250
- const wrapValue = asString(framePr["w:wrap"] ?? framePr.wrap);
67282
+ const wrapValue = asString2(framePr["w:wrap"] ?? framePr.wrap);
67251
67283
  const dropCapRunInfo = extractDropCapRunFromParagraph(para);
67252
67284
  if (dropCapRunInfo) {
67253
67285
  const descriptor = {
@@ -67265,18 +67297,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67265
67297
  }
67266
67298
  }
67267
67299
  const frame = {};
67268
- const wrap2 = asString(framePr["w:wrap"] ?? framePr.wrap);
67300
+ const wrap2 = asString2(framePr["w:wrap"] ?? framePr.wrap);
67269
67301
  if (wrap2) frame.wrap = wrap2;
67270
67302
  if (xAlign) {
67271
67303
  frame.xAlign = xAlign;
67272
67304
  }
67273
- const rawYAlign = asString(framePr["w:yAlign"] ?? framePr.yAlign);
67305
+ const rawYAlign = asString2(framePr["w:yAlign"] ?? framePr.yAlign);
67274
67306
  if (rawYAlign) {
67275
67307
  frame.yAlign = rawYAlign;
67276
67308
  }
67277
- const hAnchor = asString(framePr["w:hAnchor"] ?? framePr.hAnchor);
67309
+ const hAnchor = asString2(framePr["w:hAnchor"] ?? framePr.hAnchor);
67278
67310
  if (hAnchor) frame.hAnchor = hAnchor;
67279
- const vAnchor = asString(framePr["w:vAnchor"] ?? framePr.vAnchor);
67311
+ const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
67280
67312
  if (vAnchor) frame.vAnchor = vAnchor;
67281
67313
  const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
67282
67314
  if (xTwips != null) frame.x = twipsToPx$1(xTwips);
@@ -79020,6 +79052,32 @@ const extractBlockPmRange = (block) => {
79020
79052
  pmEnd: end2 ?? (start2 != null ? start2 + 1 : void 0)
79021
79053
  };
79022
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
+ };
79023
79081
  function calculateFirstLineIndent(block, measure) {
79024
79082
  const wordLayout = block.attrs?.wordLayout;
79025
79083
  if (!wordLayout?.firstLineIndentMode) {
@@ -79037,7 +79095,8 @@ function calculateFirstLineIndent(block, measure) {
79037
79095
  function layoutParagraphBlock(ctx2, anchors) {
79038
79096
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
79039
79097
  const remeasureParagraph2 = ctx2.remeasureParagraph;
79040
- const frame = block.attrs?.frame;
79098
+ const blockAttrs = getParagraphAttrs(block);
79099
+ const frame = blockAttrs?.frame;
79041
79100
  if (anchors?.anchoredDrawings?.length) {
79042
79101
  for (const entry of anchors.anchoredDrawings) {
79043
79102
  if (anchors.placedAnchoredIds.has(entry.block.id)) continue;
@@ -79162,9 +79221,10 @@ function layoutParagraphBlock(ctx2, anchors) {
79162
79221
  didRemeasureForColumnWidth = true;
79163
79222
  }
79164
79223
  let fromLine = 0;
79165
- const spacing = block.attrs?.spacing ?? {};
79166
- const styleId = block.attrs?.styleId;
79167
- 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);
79168
79228
  let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
79169
79229
  const spacingAfter = Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
79170
79230
  let appliedSpacingBefore = spacingBefore === 0;
@@ -79245,14 +79305,13 @@ function layoutParagraphBlock(ctx2, anchors) {
79245
79305
  while (fromLine < lines.length) {
79246
79306
  let state2 = ensurePage();
79247
79307
  if (state2.trailingSpacing == null) state2.trailingSpacing = 0;
79248
- if (contextualSpacing) {
79249
- const prevStyle = state2.lastParagraphStyleId;
79250
- if (styleId && prevStyle && prevStyle === styleId) {
79251
- spacingBefore = 0;
79252
- }
79253
- }
79254
79308
  if (contextualSpacing && state2.lastParagraphStyleId && styleId && state2.lastParagraphStyleId === styleId) {
79255
79309
  spacingBefore = 0;
79310
+ const prevTrailing = asSafeNumber(state2.trailingSpacing);
79311
+ if (prevTrailing > 0) {
79312
+ state2.cursorY -= prevTrailing;
79313
+ state2.trailingSpacing = 0;
79314
+ }
79256
79315
  }
79257
79316
  if (!appliedSpacingBefore && spacingBefore > 0) {
79258
79317
  while (!appliedSpacingBefore) {
@@ -42218,6 +42218,24 @@ const _SuperConverter = class _SuperConverter2 {
42218
42218
  }
42219
42219
  return false;
42220
42220
  }
42221
+ /**
42222
+ * Extracts the namespace prefix from an element name.
42223
+ *
42224
+ * @private
42225
+ * @static
42226
+ * @param {string} elementName - The element name (may include namespace prefix, e.g., 'op:Properties')
42227
+ * @returns {string} The namespace prefix (e.g., 'op') or empty string if no prefix
42228
+ *
42229
+ * @example
42230
+ * _extractNamespacePrefix('op:Properties') // => 'op'
42231
+ * _extractNamespacePrefix('Properties') // => ''
42232
+ * _extractNamespacePrefix('custom:property') // => 'custom'
42233
+ */
42234
+ static _extractNamespacePrefix(elementName) {
42235
+ if (!elementName || typeof elementName !== "string") return "";
42236
+ const colonIndex = elementName.indexOf(":");
42237
+ return colonIndex > 0 ? elementName.slice(0, colonIndex) : "";
42238
+ }
42221
42239
  /**
42222
42240
  * Generic method to get a stored custom property from docx.
42223
42241
  * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
@@ -42316,6 +42334,8 @@ const _SuperConverter = class _SuperConverter2 {
42316
42334
  const properties = customXml.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42317
42335
  if (!properties) return null;
42318
42336
  if (!properties.elements) properties.elements = [];
42337
+ const namespacePrefix = _SuperConverter2._extractNamespacePrefix(properties.name);
42338
+ const propertyElementName = namespacePrefix ? `${namespacePrefix}:property` : "property";
42319
42339
  let property2 = properties.elements.find(
42320
42340
  (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42321
42341
  );
@@ -42332,7 +42352,7 @@ const _SuperConverter = class _SuperConverter2 {
42332
42352
  const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42333
42353
  property2 = {
42334
42354
  type: "element",
42335
- name: "property",
42355
+ name: propertyElementName,
42336
42356
  attributes: {
42337
42357
  name: propertyName,
42338
42358
  fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
@@ -42353,6 +42373,10 @@ const _SuperConverter = class _SuperConverter2 {
42353
42373
  };
42354
42374
  properties.elements.push(property2);
42355
42375
  } else {
42376
+ const existingPropertyPrefix = _SuperConverter2._extractNamespacePrefix(property2.name);
42377
+ if (existingPropertyPrefix !== namespacePrefix) {
42378
+ property2.name = propertyElementName;
42379
+ }
42356
42380
  if (!property2.elements?.[0]?.elements?.[0]) {
42357
42381
  console.warn(`Malformed property structure for "${propertyName}", recreating structure`);
42358
42382
  property2.elements = [
@@ -42380,7 +42404,7 @@ const _SuperConverter = class _SuperConverter2 {
42380
42404
  static getStoredSuperdocVersion(docx) {
42381
42405
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42382
42406
  }
42383
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.94") {
42407
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.96") {
42384
42408
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42385
42409
  }
42386
42410
  /**
@@ -59598,7 +59622,7 @@ const isHeadless = (editor) => {
59598
59622
  const shouldSkipNodeView = (editor) => {
59599
59623
  return isHeadless(editor);
59600
59624
  };
59601
- const summaryVersion = "1.0.0-beta.94";
59625
+ const summaryVersion = "1.0.0-beta.96";
59602
59626
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59603
59627
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59604
59628
  function mapAttributes(attrs) {
@@ -60387,7 +60411,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60387
60411
  { default: remarkStringify },
60388
60412
  { default: remarkGfm }
60389
60413
  ] = await Promise.all([
60390
- import("./index-BstIHBcW-BxKvjs-R.es.js"),
60414
+ import("./index-lfdM_gm7-_EQjLyqH.es.js"),
60391
60415
  import("./index-DRCvimau-Cw339678.es.js"),
60392
60416
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60393
60417
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60592,7 +60616,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60592
60616
  * Process collaboration migrations
60593
60617
  */
60594
60618
  processCollaborationMigrations() {
60595
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.94");
60619
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.96");
60596
60620
  if (!this.options.ydoc) return;
60597
60621
  const metaMap = this.options.ydoc.getMap("meta");
60598
60622
  let docVersion = metaMap.get("version");
@@ -66652,6 +66676,13 @@ const isTruthy = (value) => {
66652
66676
  }
66653
66677
  return false;
66654
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
+ };
66655
66686
  const isExplicitFalse = (value) => {
66656
66687
  if (value === false || value === 0) return true;
66657
66688
  if (typeof value === "string") {
@@ -67144,8 +67175,9 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67144
67175
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
67145
67176
  }
67146
67177
  }
67147
- if (normalizedSpacing?.contextualSpacing != null) {
67148
- paragraphAttrs.contextualSpacing = normalizedSpacing.contextualSpacing;
67178
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
67179
+ if (contextualSpacingValue != null) {
67180
+ paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
67149
67181
  }
67150
67182
  const hasExplicitIndent = Boolean(normalizedIndent);
67151
67183
  const hasNumberingIndent = Boolean(computed2.numbering?.indent?.left || computed2.numbering?.indent?.hanging);
@@ -67197,7 +67229,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67197
67229
  paragraphAttrs.tabs = normalizedTabs;
67198
67230
  }
67199
67231
  }
67200
- const asString = (value) => {
67232
+ const asString2 = (value) => {
67201
67233
  return typeof value === "string" ? value : void 0;
67202
67234
  };
67203
67235
  const normalizeFramePr = (value) => {
@@ -67220,7 +67252,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67220
67252
  };
67221
67253
  const framePr = normalizeFramePr(attrs.framePr) ?? normalizeFramePr(attrs.paragraphProperties?.framePr) ?? extractFramePrFromElements(attrs.paragraphProperties);
67222
67254
  if (framePr) {
67223
- const rawXAlign = asString(framePr["w:xAlign"] ?? framePr.xAlign);
67255
+ const rawXAlign = asString2(framePr["w:xAlign"] ?? framePr.xAlign);
67224
67256
  const xAlign = typeof rawXAlign === "string" ? rawXAlign.toLowerCase() : void 0;
67225
67257
  if (xAlign === "left" || xAlign === "right" || xAlign === "center") {
67226
67258
  paragraphAttrs.floatAlignment = xAlign;
@@ -67230,7 +67262,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67230
67262
  paragraphAttrs.dropCap = dropCap;
67231
67263
  const dropCapMode = typeof dropCap === "string" ? dropCap.toLowerCase() : "drop";
67232
67264
  const linesValue = pickNumber(framePr["w:lines"] ?? framePr.lines);
67233
- const wrapValue = asString(framePr["w:wrap"] ?? framePr.wrap);
67265
+ const wrapValue = asString2(framePr["w:wrap"] ?? framePr.wrap);
67234
67266
  const dropCapRunInfo = extractDropCapRunFromParagraph(para);
67235
67267
  if (dropCapRunInfo) {
67236
67268
  const descriptor = {
@@ -67248,18 +67280,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67248
67280
  }
67249
67281
  }
67250
67282
  const frame = {};
67251
- const wrap2 = asString(framePr["w:wrap"] ?? framePr.wrap);
67283
+ const wrap2 = asString2(framePr["w:wrap"] ?? framePr.wrap);
67252
67284
  if (wrap2) frame.wrap = wrap2;
67253
67285
  if (xAlign) {
67254
67286
  frame.xAlign = xAlign;
67255
67287
  }
67256
- const rawYAlign = asString(framePr["w:yAlign"] ?? framePr.yAlign);
67288
+ const rawYAlign = asString2(framePr["w:yAlign"] ?? framePr.yAlign);
67257
67289
  if (rawYAlign) {
67258
67290
  frame.yAlign = rawYAlign;
67259
67291
  }
67260
- const hAnchor = asString(framePr["w:hAnchor"] ?? framePr.hAnchor);
67292
+ const hAnchor = asString2(framePr["w:hAnchor"] ?? framePr.hAnchor);
67261
67293
  if (hAnchor) frame.hAnchor = hAnchor;
67262
- const vAnchor = asString(framePr["w:vAnchor"] ?? framePr.vAnchor);
67294
+ const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
67263
67295
  if (vAnchor) frame.vAnchor = vAnchor;
67264
67296
  const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
67265
67297
  if (xTwips != null) frame.x = twipsToPx$1(xTwips);
@@ -79003,6 +79035,32 @@ const extractBlockPmRange = (block) => {
79003
79035
  pmEnd: end2 ?? (start2 != null ? start2 + 1 : void 0)
79004
79036
  };
79005
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
+ };
79006
79064
  function calculateFirstLineIndent(block, measure) {
79007
79065
  const wordLayout = block.attrs?.wordLayout;
79008
79066
  if (!wordLayout?.firstLineIndentMode) {
@@ -79020,7 +79078,8 @@ function calculateFirstLineIndent(block, measure) {
79020
79078
  function layoutParagraphBlock(ctx2, anchors) {
79021
79079
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
79022
79080
  const remeasureParagraph2 = ctx2.remeasureParagraph;
79023
- const frame = block.attrs?.frame;
79081
+ const blockAttrs = getParagraphAttrs(block);
79082
+ const frame = blockAttrs?.frame;
79024
79083
  if (anchors?.anchoredDrawings?.length) {
79025
79084
  for (const entry of anchors.anchoredDrawings) {
79026
79085
  if (anchors.placedAnchoredIds.has(entry.block.id)) continue;
@@ -79145,9 +79204,10 @@ function layoutParagraphBlock(ctx2, anchors) {
79145
79204
  didRemeasureForColumnWidth = true;
79146
79205
  }
79147
79206
  let fromLine = 0;
79148
- const spacing = block.attrs?.spacing ?? {};
79149
- const styleId = block.attrs?.styleId;
79150
- 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);
79151
79211
  let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
79152
79212
  const spacingAfter = Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
79153
79213
  let appliedSpacingBefore = spacingBefore === 0;
@@ -79228,14 +79288,13 @@ function layoutParagraphBlock(ctx2, anchors) {
79228
79288
  while (fromLine < lines.length) {
79229
79289
  let state2 = ensurePage();
79230
79290
  if (state2.trailingSpacing == null) state2.trailingSpacing = 0;
79231
- if (contextualSpacing) {
79232
- const prevStyle = state2.lastParagraphStyleId;
79233
- if (styleId && prevStyle && prevStyle === styleId) {
79234
- spacingBefore = 0;
79235
- }
79236
- }
79237
79291
  if (contextualSpacing && state2.lastParagraphStyleId && styleId && state2.lastParagraphStyleId === styleId) {
79238
79292
  spacingBefore = 0;
79293
+ const prevTrailing = asSafeNumber(state2.trailingSpacing);
79294
+ if (prevTrailing > 0) {
79295
+ state2.cursorY -= prevTrailing;
79296
+ state2.trailingSpacing = 0;
79297
+ }
79239
79298
  }
79240
79299
  if (!appliedSpacingBefore && spacingBefore > 0) {
79241
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-CIgfC-et.js";
3
- import { _ as _export_sfc } from "./chunks/editor-6Tyu_6Nf.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 = {}) {
@@ -42535,6 +42535,24 @@ const _SuperConverter = class _SuperConverter {
42535
42535
  }
42536
42536
  return false;
42537
42537
  }
42538
+ /**
42539
+ * Extracts the namespace prefix from an element name.
42540
+ *
42541
+ * @private
42542
+ * @static
42543
+ * @param {string} elementName - The element name (may include namespace prefix, e.g., 'op:Properties')
42544
+ * @returns {string} The namespace prefix (e.g., 'op') or empty string if no prefix
42545
+ *
42546
+ * @example
42547
+ * _extractNamespacePrefix('op:Properties') // => 'op'
42548
+ * _extractNamespacePrefix('Properties') // => ''
42549
+ * _extractNamespacePrefix('custom:property') // => 'custom'
42550
+ */
42551
+ static _extractNamespacePrefix(elementName) {
42552
+ if (!elementName || typeof elementName !== "string") return "";
42553
+ const colonIndex = elementName.indexOf(":");
42554
+ return colonIndex > 0 ? elementName.slice(0, colonIndex) : "";
42555
+ }
42538
42556
  /**
42539
42557
  * Generic method to get a stored custom property from docx.
42540
42558
  * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
@@ -42633,6 +42651,8 @@ const _SuperConverter = class _SuperConverter {
42633
42651
  const properties = customXml.elements?.find((el) => _SuperConverter._matchesElementName(el.name, "Properties"));
42634
42652
  if (!properties) return null;
42635
42653
  if (!properties.elements) properties.elements = [];
42654
+ const namespacePrefix = _SuperConverter._extractNamespacePrefix(properties.name);
42655
+ const propertyElementName = namespacePrefix ? `${namespacePrefix}:property` : "property";
42636
42656
  let property = properties.elements.find(
42637
42657
  (el) => _SuperConverter._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42638
42658
  );
@@ -42649,7 +42669,7 @@ const _SuperConverter = class _SuperConverter {
42649
42669
  const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42650
42670
  property = {
42651
42671
  type: "element",
42652
- name: "property",
42672
+ name: propertyElementName,
42653
42673
  attributes: {
42654
42674
  name: propertyName,
42655
42675
  fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
@@ -42670,6 +42690,10 @@ const _SuperConverter = class _SuperConverter {
42670
42690
  };
42671
42691
  properties.elements.push(property);
42672
42692
  } else {
42693
+ const existingPropertyPrefix = _SuperConverter._extractNamespacePrefix(property.name);
42694
+ if (existingPropertyPrefix !== namespacePrefix) {
42695
+ property.name = propertyElementName;
42696
+ }
42673
42697
  if (!property.elements?.[0]?.elements?.[0]) {
42674
42698
  console.warn(`Malformed property structure for "${propertyName}", recreating structure`);
42675
42699
  property.elements = [
@@ -42697,7 +42721,7 @@ const _SuperConverter = class _SuperConverter {
42697
42721
  static getStoredSuperdocVersion(docx) {
42698
42722
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42699
42723
  }
42700
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.94") {
42724
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.96") {
42701
42725
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42702
42726
  }
42703
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-CIgfC-et.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
  }