superdoc 1.0.0-beta.3 → 1.0.0-beta.30

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 (44) hide show
  1. package/dist/chunks/{PdfViewer-CxHbcDGx.cjs → PdfViewer-BADCvUNL.cjs} +2 -2
  2. package/dist/chunks/{PdfViewer-CKzs9Ct5.es.js → PdfViewer-C2nY5qD8.es.js} +2 -2
  3. package/dist/chunks/{eventemitter3-ByBH0NYV.es.js → eventemitter3-CcXAdeql.es.js} +1 -1
  4. package/dist/chunks/{eventemitter3-CFCpOk3d.cjs → eventemitter3-DQmQUge-.cjs} +1 -1
  5. package/dist/chunks/{index-Dp3rVMnX.cjs → index-DTgPk1zO.cjs} +15 -10
  6. package/dist/chunks/{index-CJUy3fVi-D8zt9F3Z.es.js → index-DUzV7kkk-BvBMF_lo.es.js} +1 -1
  7. package/dist/chunks/{index-CJUy3fVi-BGLfCP5B.cjs → index-DUzV7kkk-CM3uwGCb.cjs} +1 -1
  8. package/dist/chunks/{index-DukSDI8_.es.js → index-DmelLGEj.es.js} +15 -10
  9. package/dist/chunks/{jszip-BwsONqK5.es.js → jszip-5vvIqAEE.es.js} +1 -1
  10. package/dist/chunks/{jszip-B99MTu59.cjs → jszip-BdEez1WM.cjs} +1 -1
  11. package/dist/chunks/{super-editor.es-CDiTp9Fe.cjs → super-editor.es-463G9jKM.cjs} +17633 -2983
  12. package/dist/chunks/{super-editor.es-BRKZG90h.es.js → super-editor.es-Be9785LD.es.js} +17633 -2983
  13. package/dist/chunks/{vue-CztqUvm1.es.js → vue-Dysv_7z5.es.js} +101 -12
  14. package/dist/chunks/{vue-ARQSyfaw.cjs → vue-jWLMl8Ts.cjs} +89 -0
  15. package/dist/chunks/xml-js-ClO_jHnq.es.js +2 -0
  16. package/dist/chunks/xml-js-Dz51sEbr.cjs +3 -0
  17. package/dist/packages/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -1
  18. package/dist/packages/superdoc/src/core/SuperDoc.d.ts +2 -2
  19. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  20. package/dist/packages/superdoc/src/core/types/index.d.ts +2 -2
  21. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
  22. package/dist/style.css +66 -27
  23. package/dist/super-editor/ai-writer.es.js +2 -2
  24. package/dist/super-editor/chunks/{converter-B9YfBdcc.js → converter-U59bT3FO.js} +7060 -760
  25. package/dist/super-editor/chunks/{docx-zipper-V16OzZ7a.js → docx-zipper-DSnoGkju.js} +1 -1
  26. package/dist/super-editor/chunks/{editor-DlvlVSbc.js → editor-DRHVtMIR.js} +9986 -2179
  27. package/dist/super-editor/chunks/{index-CJUy3fVi.js → index-DUzV7kkk.js} +1 -1
  28. package/dist/super-editor/chunks/{toolbar-cNDvtryE.js → toolbar-DbBLxo6N.js} +39 -24
  29. package/dist/super-editor/converter.es.js +1 -1
  30. package/dist/super-editor/docx-zipper.es.js +2 -2
  31. package/dist/super-editor/editor.es.js +3 -3
  32. package/dist/super-editor/file-zipper.es.js +2 -2
  33. package/dist/super-editor/style.css +66 -27
  34. package/dist/super-editor/super-editor.es.js +878 -215
  35. package/dist/super-editor/toolbar.es.js +2 -2
  36. package/dist/super-editor.cjs +4 -4
  37. package/dist/super-editor.es.js +2 -2
  38. package/dist/superdoc.cjs +2 -2
  39. package/dist/superdoc.es.js +2 -2
  40. package/dist/superdoc.umd.js +17553 -2822
  41. package/dist/superdoc.umd.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunks/xml-js-BZPSMmVo.es.js +0 -2
  44. package/dist/chunks/xml-js-DQa4Ye5C.cjs +0 -3
@@ -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 { aJ as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aM as vClickOutside, aN as getActiveFormatting, aC as isInTable, U as findParentNode, aq as calculateResolvedParagraphProperties, a7 as twipsToLines, V as isList, al as parseSizeUnit, a8 as pixelsToTwips, aO as getFileObject, aP as translator, aQ as translator$1, aR as translator$2, aS as translator$3, aT as translator$4, aU as translator$5, aV as translator$6, aW as translator$7, aX as translator$8, aY as translator$9, aZ as translator$a, a_ as translator$b, a$ as translator$c, b0 as translator$d, b1 as translator$e, b2 as commentRangeEndTranslator, b3 as commentRangeStartTranslator, b4 as translator$f, b5 as translator$g, b6 as translator$h, b7 as translator$i, b8 as translator$j, b9 as translator$k, ba as translator$l, bb as translator$m, bc as translator$n, bd as translator$o, be as translator$p, bf as translator$q, bg as translator$r, bh as translator$s, bi as translator$t, bj as translator$u, bk as translator$v, bl as translator$w, bm as translator$x, bn as translator$y, bo as translator$z, bp as translator$A, bq as translator$B, br as translator$C, bs as translator$D, bt as translator$E, bu as translator$F, bv as translator$G, bw as translator$H, bx as translator$I, by as translator$J, bz as translator$K, bA as translator$L, bB as translator$M, bC as translator$N, bD as translator$O, bE as translator$P, bF as translator$Q, bG as translator$R, bH as translator$S, bI as translator$T, bJ as translator$U, bK as translator$V, bL as translator$W, bM as translator$X, bN as translator$Y, bO as translator$Z, bP as translator$_, bQ as translator$$, bR as translator$10, bS as translator$11, bT as translator$12, bU as translator$13, bV as translator$14, bW as translator$15, bX as translator$16, bY as translator$17, bZ as translator$18, b_ as translator$19, b$ as translator$1a, c0 as translator$1b, c1 as translator$1c, c2 as translator$1d, c3 as translator$1e, c4 as translator$1f, c5 as translator$1g, c6 as translator$1h, c7 as translator$1i, c8 as translator$1j, P as PluginKey, a as Plugin } from "./chunks/converter-B9YfBdcc.js";
13
- import { ac, i, a9 } from "./chunks/converter-B9YfBdcc.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 measureCache, n as isHeadless, E as Editor, o as getStarterExtensions, P as PresentationEditor, p as Placeholder, q as getRichTextExtensions, D as DecorationSet, t as Decoration, M as Mark, v as Extension, A as Attribute, N as Node } from "./chunks/editor-DlvlVSbc.js";
15
- import { z, F, B, T, w, C, x } from "./chunks/editor-DlvlVSbc.js";
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, shallowRef, createBlock, 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-cNDvtryE.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-U59bT3FO.js";
13
+ import { ac, i, a9, aQ } from "./chunks/converter-U59bT3FO.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 measureCache, n as isHeadless, E as Editor, o as getStarterExtensions, P as PresentationEditor, p as Placeholder, q as getRichTextExtensions, D as DecorationSet, t as Decoration, M as Mark, v as Extension, A as Attribute, N as Node } from "./chunks/editor-DRHVtMIR.js";
15
+ import { z, F, B, T, w, C, x } from "./chunks/editor-DRHVtMIR.js";
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, 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-DbBLxo6N.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-V16OzZ7a.js";
19
+ import { D } from "./chunks/docx-zipper-DSnoGkju.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -311,8 +311,8 @@ const useToolbarItem = (options) => {
311
311
  onDeactivate
312
312
  };
313
313
  };
314
- const _hoisted_1$e = ["onClick", "innerHTML", "aria-label", "onKeydown"];
315
- const _sfc_main$f = {
314
+ const _hoisted_1$f = ["onClick", "innerHTML", "aria-label", "onKeydown"];
315
+ const _sfc_main$h = {
316
316
  __name: "AlignmentButtons",
317
317
  emits: ["select"],
318
318
  setup(__props, { emit: __emit }) {
@@ -397,20 +397,20 @@ const _sfc_main$f = {
397
397
  ref_key: "alignmentButtonsRefs",
398
398
  ref: alignmentButtonsRefs,
399
399
  onKeydown: withModifiers((event) => handleKeyDown(event, index), ["prevent"])
400
- }, null, 40, _hoisted_1$e);
400
+ }, null, 40, _hoisted_1$f);
401
401
  }), 64))
402
402
  ], 2);
403
403
  };
404
404
  }
405
405
  };
406
- const AlignmentButtons = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-d84f57b6"]]);
407
- const _hoisted_1$d = ["onClick", "onKeydown"];
406
+ const AlignmentButtons = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-d84f57b6"]]);
407
+ const _hoisted_1$e = ["onClick", "onKeydown"];
408
408
  const _hoisted_2$9 = { class: "document-mode-column icon-column" };
409
409
  const _hoisted_3$7 = ["innerHTML"];
410
410
  const _hoisted_4$3 = { class: "document-mode-column text-column" };
411
411
  const _hoisted_5$2 = { class: "document-mode-type" };
412
412
  const _hoisted_6$1 = { class: "document-mode-description" };
413
- const _sfc_main$e = {
413
+ const _sfc_main$g = {
414
414
  __name: "DocumentMode",
415
415
  props: {
416
416
  options: {
@@ -484,19 +484,20 @@ const _sfc_main$e = {
484
484
  createElementVNode("div", _hoisted_5$2, toDisplayString(option.label), 1),
485
485
  createElementVNode("div", _hoisted_6$1, toDisplayString(option.description), 1)
486
486
  ])
487
- ], 42, _hoisted_1$d);
487
+ ], 42, _hoisted_1$e);
488
488
  }), 256))
489
489
  ], 2);
490
490
  };
491
491
  }
492
492
  };
493
- const DocumentMode = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-8730b752"]]);
494
- const _hoisted_1$c = {
493
+ const DocumentMode = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-8730b752"]]);
494
+ const _hoisted_1$d = {
495
495
  key: 0,
496
- class: "linked-style-buttons"
496
+ class: "linked-style-buttons",
497
+ "data-editor-ui-surface": ""
497
498
  };
498
499
  const _hoisted_2$8 = ["onClick", "onKeydown", "aria-label"];
499
- const _sfc_main$d = {
500
+ const _sfc_main$f = {
500
501
  __name: "LinkedStyle",
501
502
  props: {
502
503
  editor: {
@@ -550,7 +551,7 @@ const _sfc_main$d = {
550
551
  styleRefs.value[0].focus();
551
552
  });
552
553
  return (_ctx, _cache) => {
553
- return props.editor ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
554
+ return props.editor ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
554
555
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getQuickFormatList)(__props.editor), (style, index) => {
555
556
  return openBlock(), createElementBlock("div", {
556
557
  class: normalizeClass(["style-item", { selected: __props.selectedOption === style.id }]),
@@ -572,8 +573,8 @@ const _sfc_main$d = {
572
573
  };
573
574
  }
574
575
  };
575
- const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-b53508a8"]]);
576
- const _hoisted_1$b = {
576
+ const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-ecb78965"]]);
577
+ const _hoisted_1$c = {
577
578
  key: 0,
578
579
  class: "link-title"
579
580
  };
@@ -601,7 +602,7 @@ const _hoisted_13 = {
601
602
  key: 4,
602
603
  class: "input-row go-to-anchor clickable"
603
604
  };
604
- const _sfc_main$c = {
605
+ const _sfc_main$e = {
605
606
  __name: "LinkInput",
606
607
  props: {
607
608
  showInput: {
@@ -740,7 +741,7 @@ const _sfc_main$c = {
740
741
  return openBlock(), createElementBlock("div", {
741
742
  class: normalizeClass(["link-input-ctn", { "high-contrast": unref(isHighContrastMode) }])
742
743
  }, [
743
- isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_1$b, "Page anchor")) : isEditing.value ? (openBlock(), createElementBlock("div", _hoisted_2$7, "Edit link")) : (openBlock(), createElementBlock("div", _hoisted_3$6, "Add link")),
744
+ isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_1$c, "Page anchor")) : isEditing.value ? (openBlock(), createElementBlock("div", _hoisted_2$7, "Edit link")) : (openBlock(), createElementBlock("div", _hoisted_3$6, "Add link")),
744
745
  __props.showInput && !isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
745
746
  createElementVNode("div", _hoisted_5$1, [
746
747
  _cache[4] || (_cache[4] = createElementVNode("div", { class: "input-icon text-input-icon" }, "T", -1)),
@@ -807,12 +808,12 @@ const _sfc_main$c = {
807
808
  };
808
809
  }
809
810
  };
810
- const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-ba50627b"]]);
811
- const _hoisted_1$a = ["aria-label", "onClick", "onKeydown"];
811
+ const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-ba50627b"]]);
812
+ const _hoisted_1$b = ["aria-label", "onClick", "onKeydown"];
812
813
  const _hoisted_2$6 = ["innerHTML"];
813
814
  const _hoisted_3$5 = ["innerHTML"];
814
815
  const ROW_SIZE$1 = 7;
815
- const _sfc_main$b = {
816
+ const _sfc_main$d = {
816
817
  __name: "IconGridRow",
817
818
  props: {
818
819
  icons: {
@@ -938,19 +939,19 @@ const _sfc_main$b = {
938
939
  innerHTML: unref(toolbarIcons).colorOptionCheck,
939
940
  style: normalizeStyle(getCheckStyle(option.value, optionIndex))
940
941
  }, null, 12, _hoisted_3$5)) : createCommentVNode("", true)
941
- ], 40, _hoisted_1$a);
942
+ ], 40, _hoisted_1$b);
942
943
  }), 128))
943
944
  ]);
944
945
  }), 128);
945
946
  };
946
947
  }
947
948
  };
948
- const IconGridRow = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-0f479b6c"]]);
949
+ const IconGridRow = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-0f479b6c"]]);
949
950
  const DropIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z"/></svg>\n';
950
- const _hoisted_1$9 = { class: "options-grid-wrap" };
951
+ const _hoisted_1$a = { class: "options-grid-wrap" };
951
952
  const _hoisted_2$5 = ["innerHTML"];
952
953
  const _hoisted_3$4 = { class: "option-grid-ctn" };
953
- const _sfc_main$a = {
954
+ const _sfc_main$c = {
954
955
  __name: "IconGrid",
955
956
  props: {
956
957
  icons: {
@@ -977,7 +978,7 @@ const _sfc_main$a = {
977
978
  emit("select", option);
978
979
  };
979
980
  return (_ctx, _cache) => {
980
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
981
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
981
982
  __props.hasNoneIcon ? (openBlock(), createElementBlock("div", {
982
983
  key: 0,
983
984
  class: "none-option",
@@ -1010,7 +1011,7 @@ const _sfc_main$a = {
1010
1011
  };
1011
1012
  }
1012
1013
  };
1013
- const IconGrid = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-3d19fedf"]]);
1014
+ const IconGrid = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-3d19fedf"]]);
1014
1015
  const closeDropdown$1 = (dropdown) => {
1015
1016
  dropdown.expand.value = false;
1016
1017
  };
@@ -1119,10 +1120,10 @@ const icons = [
1119
1120
  const getAvailableColorOptions = () => {
1120
1121
  return icons.flat().map((item) => item.value);
1121
1122
  };
1122
- const _hoisted_1$8 = ["data-cols", "data-rows", "onKeydown", "onClick"];
1123
+ const _hoisted_1$9 = ["data-cols", "data-rows", "onKeydown", "onClick"];
1123
1124
  const _hoisted_2$4 = ["aria-valuetext"];
1124
1125
  const ROW_SIZE = 5;
1125
- const _sfc_main$9 = {
1126
+ const _sfc_main$b = {
1126
1127
  __name: "TableGrid",
1127
1128
  emits: ["select", "clickoutside"],
1128
1129
  setup(__props, { emit: __emit }) {
@@ -1238,7 +1239,7 @@ const _sfc_main$9 = {
1238
1239
  ref: tableGridItems,
1239
1240
  onKeydown: withModifiers((event) => handleKeyDown(event, n, i2), ["prevent"]),
1240
1241
  onClick: withModifiers(($event) => handleClick({ cols: n, rows: i2 }), ["stop", "prevent"])
1241
- }, null, 40, _hoisted_1$8);
1242
+ }, null, 40, _hoisted_1$9);
1242
1243
  }), 64))
1243
1244
  ], 64);
1244
1245
  }), 64))
@@ -1251,13 +1252,13 @@ const _sfc_main$9 = {
1251
1252
  };
1252
1253
  }
1253
1254
  };
1254
- const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-92e8d5fb"]]);
1255
- const _hoisted_1$7 = { class: "toolbar-table-actions" };
1255
+ const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-92e8d5fb"]]);
1256
+ const _hoisted_1$8 = { class: "toolbar-table-actions" };
1256
1257
  const _hoisted_2$3 = ["onClick", "data-item", "ariaLabel"];
1257
1258
  const _hoisted_3$3 = { class: "toolbar-table-actions__icon" };
1258
1259
  const _hoisted_4$1 = ["innerHTML"];
1259
1260
  const _hoisted_5 = { class: "toolbar-table-actions__label" };
1260
- const _sfc_main$8 = {
1261
+ const _sfc_main$a = {
1261
1262
  __name: "TableActions",
1262
1263
  props: {
1263
1264
  options: {
@@ -1271,7 +1272,7 @@ const _sfc_main$8 = {
1271
1272
  emit("select", { command: item.command });
1272
1273
  };
1273
1274
  return (_ctx, _cache) => {
1274
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
1275
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
1275
1276
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
1276
1277
  return openBlock(), createElementBlock("div", {
1277
1278
  class: normalizeClass(["toolbar-table-actions__item", { "toolbar-table-actions__item--border": option.bottomBorder }]),
@@ -1293,7 +1294,7 @@ const _sfc_main$8 = {
1293
1294
  };
1294
1295
  }
1295
1296
  };
1296
- const TableActions = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-990b9a25"]]);
1297
+ const TableActions = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-990b9a25"]]);
1297
1298
  function getScrollableParent(element) {
1298
1299
  let currentElement = element;
1299
1300
  while (currentElement) {
@@ -1317,10 +1318,10 @@ function scrollToElement(targetElement, options = { behavior: "smooth", block: "
1317
1318
  });
1318
1319
  }
1319
1320
  const checkIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>\n';
1320
- const _hoisted_1$6 = { class: "search-input-ctn" };
1321
+ const _hoisted_1$7 = { class: "search-input-ctn" };
1321
1322
  const _hoisted_2$2 = { class: "row" };
1322
1323
  const _hoisted_3$2 = ["onKeydown"];
1323
- const _sfc_main$7 = {
1324
+ const _sfc_main$9 = {
1324
1325
  __name: "SearchInput",
1325
1326
  props: {
1326
1327
  searchRef: {
@@ -1335,7 +1336,7 @@ const _sfc_main$7 = {
1335
1336
  emit("submit", { value: searchValue.value });
1336
1337
  };
1337
1338
  return (_ctx, _cache) => {
1338
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
1339
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
1339
1340
  createElementVNode("div", _hoisted_2$2, [
1340
1341
  withDirectives(createElementVNode("input", {
1341
1342
  ref: __props.searchRef,
@@ -1359,7 +1360,7 @@ const _sfc_main$7 = {
1359
1360
  };
1360
1361
  }
1361
1362
  };
1362
- const SearchInput = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-957cbcf2"]]);
1363
+ const SearchInput = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-957cbcf2"]]);
1363
1364
  const TOOLBAR_FONTS = [
1364
1365
  {
1365
1366
  label: "Georgia",
@@ -2969,6 +2970,10 @@ const _SuperToolbar = class _SuperToolbar extends EventEmitter {
2969
2970
  return;
2970
2971
  }
2971
2972
  const { state } = this.activeEditor;
2973
+ if (!state) {
2974
+ __privateMethod(this, _SuperToolbar_instances, deactivateAll_fn).call(this);
2975
+ return;
2976
+ }
2972
2977
  const selection = state.selection;
2973
2978
  const selectionTrackedChanges = __privateMethod(this, _SuperToolbar_instances, enrichTrackedChanges_fn).call(this, collectTrackedChanges({ state, from: selection.from, to: selection.to }));
2974
2979
  const hasTrackedChanges = selectionTrackedChanges.length > 0;
@@ -3286,14 +3291,19 @@ deactivateAll_fn = function() {
3286
3291
  * @returns {void}
3287
3292
  */
3288
3293
  updateToolbarHistory_fn = function() {
3289
- if (!this.activeEditor) return;
3290
- if (this.activeEditor.options.ydoc) {
3291
- const undoManager = yUndoPluginKey.getState(this.activeEditor.state)?.undoManager;
3292
- this.undoDepth = undoManager?.undoStack.length || 0;
3293
- this.redoDepth = undoManager?.redoStack.length || 0;
3294
- } else {
3295
- this.undoDepth = undoDepth(this.activeEditor.state);
3296
- this.redoDepth = redoDepth(this.activeEditor.state);
3294
+ if (!this.activeEditor?.state) return;
3295
+ try {
3296
+ if (this.activeEditor.options.ydoc) {
3297
+ const undoManager = yUndoPluginKey.getState(this.activeEditor.state)?.undoManager;
3298
+ this.undoDepth = undoManager?.undoStack.length || 0;
3299
+ this.redoDepth = undoManager?.redoStack.length || 0;
3300
+ } else {
3301
+ this.undoDepth = undoDepth(this.activeEditor.state);
3302
+ this.redoDepth = redoDepth(this.activeEditor.state);
3303
+ }
3304
+ } catch {
3305
+ this.undoDepth = 0;
3306
+ this.redoDepth = 0;
3297
3307
  }
3298
3308
  };
3299
3309
  enrichTrackedChanges_fn = function(trackedChanges = []) {
@@ -4206,7 +4216,7 @@ function getItems(context, customItems = [], includeDefaultItems = true) {
4206
4216
  }).filter((section) => section.items.length > 0);
4207
4217
  return filteredSections;
4208
4218
  }
4209
- const _hoisted_1$5 = { class: "slash-menu-items" };
4219
+ const _hoisted_1$6 = { class: "slash-menu-items" };
4210
4220
  const _hoisted_2$1 = {
4211
4221
  key: 0,
4212
4222
  class: "slash-menu-divider",
@@ -4214,7 +4224,7 @@ const _hoisted_2$1 = {
4214
4224
  };
4215
4225
  const _hoisted_3$1 = ["onClick"];
4216
4226
  const _hoisted_4 = ["innerHTML"];
4217
- const _sfc_main$6 = {
4227
+ const _sfc_main$8 = {
4218
4228
  __name: "SlashMenu",
4219
4229
  props: {
4220
4230
  editor: {
@@ -4342,7 +4352,7 @@ const _sfc_main$6 = {
4342
4352
  customItemRefs.clear();
4343
4353
  };
4344
4354
  const handleGlobalKeyDown = (event) => {
4345
- if (event.key === "Escape") {
4355
+ if (event.key === "Escape" && isOpen.value) {
4346
4356
  event.preventDefault();
4347
4357
  event.stopPropagation();
4348
4358
  closeMenu();
@@ -4530,7 +4540,7 @@ const _sfc_main$6 = {
4530
4540
  }, null, 544), [
4531
4541
  [vModelText, searchQuery.value]
4532
4542
  ]),
4533
- createElementVNode("div", _hoisted_1$5, [
4543
+ createElementVNode("div", _hoisted_1$6, [
4534
4544
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredSections.value, (section, sectionIndex) => {
4535
4545
  return openBlock(), createElementBlock(Fragment, {
4536
4546
  key: section.id
@@ -4565,8 +4575,8 @@ const _sfc_main$6 = {
4565
4575
  };
4566
4576
  }
4567
4577
  };
4568
- const _hoisted_1$4 = ["accept"];
4569
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4578
+ const _hoisted_1$5 = ["accept"];
4579
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4570
4580
  __name: "BasicUpload",
4571
4581
  props: {
4572
4582
  accept: { default: ".docx, .pdf, .html, .md" }
@@ -4587,15 +4597,15 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4587
4597
  id: "fileInput",
4588
4598
  onChange: onFileChange,
4589
4599
  accept: __props.accept
4590
- }, null, 40, _hoisted_1$4)
4600
+ }, null, 40, _hoisted_1$5)
4591
4601
  ]);
4592
4602
  };
4593
4603
  }
4594
4604
  });
4595
- const _hoisted_1$3 = { class: "numbering" };
4605
+ const _hoisted_1$4 = { class: "numbering" };
4596
4606
  const MIN_WIDTH = 200;
4597
4607
  const alignment = "flex-end";
4598
- const _sfc_main$4 = {
4608
+ const _sfc_main$6 = {
4599
4609
  __name: "Ruler",
4600
4610
  props: {
4601
4611
  orientation: {
@@ -4780,7 +4790,7 @@ const _sfc_main$4 = {
4780
4790
  class: normalizeClass(unit.className),
4781
4791
  style: normalizeStyle(getStyle.value(unit))
4782
4792
  }, [
4783
- createElementVNode("div", _hoisted_1$3, toDisplayString(unit.numbering), 1),
4793
+ createElementVNode("div", _hoisted_1$4, toDisplayString(unit.numbering), 1),
4784
4794
  (openBlock(true), createElementBlock(Fragment, null, renderList(unit.elements, (half) => {
4785
4795
  return openBlock(), createElementBlock("div", {
4786
4796
  class: normalizeClass(half.className),
@@ -4800,8 +4810,8 @@ const _sfc_main$4 = {
4800
4810
  };
4801
4811
  }
4802
4812
  };
4803
- const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-79f9a944"]]);
4804
- const _sfc_main$3 = {
4813
+ const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-79f9a944"]]);
4814
+ const _sfc_main$5 = {
4805
4815
  __name: "GenericPopover",
4806
4816
  props: {
4807
4817
  editor: { type: Object, required: true },
@@ -4829,22 +4839,22 @@ const _sfc_main$3 = {
4829
4839
  () => props.visible,
4830
4840
  (val) => {
4831
4841
  if (val) {
4832
- document.addEventListener("mousedown", handleClickOutside);
4842
+ document.addEventListener("pointerdown", handleClickOutside);
4833
4843
  document.addEventListener("keydown", handleEscape);
4834
4844
  } else {
4835
- document.removeEventListener("mousedown", handleClickOutside);
4845
+ document.removeEventListener("pointerdown", handleClickOutside);
4836
4846
  document.removeEventListener("keydown", handleEscape);
4837
4847
  }
4838
4848
  }
4839
4849
  );
4840
4850
  onMounted(() => {
4841
4851
  if (props.visible) {
4842
- document.addEventListener("mousedown", handleClickOutside);
4852
+ document.addEventListener("pointerdown", handleClickOutside);
4843
4853
  document.addEventListener("keydown", handleEscape);
4844
4854
  }
4845
4855
  });
4846
4856
  onBeforeUnmount(() => {
4847
- document.removeEventListener("mousedown", handleClickOutside);
4857
+ document.removeEventListener("pointerdown", handleClickOutside);
4848
4858
  document.removeEventListener("keydown", handleEscape);
4849
4859
  });
4850
4860
  const derivedStyles = computed(() => ({
@@ -4859,7 +4869,7 @@ const _sfc_main$3 = {
4859
4869
  style: normalizeStyle(derivedStyles.value),
4860
4870
  ref_key: "popover",
4861
4871
  ref: popover,
4862
- onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
4872
+ onPointerdown: _cache[0] || (_cache[0] = withModifiers(() => {
4863
4873
  }, ["stop"])),
4864
4874
  onClick: _cache[1] || (_cache[1] = withModifiers(() => {
4865
4875
  }, ["stop"]))
@@ -4869,9 +4879,15 @@ const _sfc_main$3 = {
4869
4879
  };
4870
4880
  }
4871
4881
  };
4872
- const GenericPopover = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-cbddcc0f"]]);
4873
- const _hoisted_1$2 = ["data-boundary-index", "data-boundary-type", "onMousedown"];
4874
- const _sfc_main$2 = {
4882
+ const GenericPopover = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-157855b5"]]);
4883
+ const _hoisted_1$3 = ["data-boundary-index", "data-boundary-type", "onMousedown"];
4884
+ const RESIZE_HANDLE_WIDTH_PX = 9;
4885
+ const RESIZE_HANDLE_OFFSET_PX = 4;
4886
+ const DRAG_OVERLAY_EXTENSION_PX = 1e3;
4887
+ const MIN_DRAG_OVERLAY_WIDTH_PX = 2e3;
4888
+ const THROTTLE_INTERVAL_MS = 16;
4889
+ const MIN_RESIZE_DELTA_PX = 1;
4890
+ const _sfc_main$4 = {
4875
4891
  __name: "TableResizeOverlay",
4876
4892
  props: {
4877
4893
  /** Editor instance for dispatching transactions */
@@ -4894,26 +4910,73 @@ const _sfc_main$2 = {
4894
4910
  setup(__props, { emit: __emit }) {
4895
4911
  const props = __props;
4896
4912
  const emit = __emit;
4913
+ const overlayRect = ref(null);
4897
4914
  const tableMetadata = ref(null);
4898
4915
  const dragState = ref(null);
4899
4916
  const forcedCleanup = ref(false);
4917
+ let rafId = null;
4918
+ let isUnmounted = false;
4919
+ function startOverlayTracking() {
4920
+ if (rafId !== null) return;
4921
+ const step = () => {
4922
+ updateOverlayRect();
4923
+ rafId = requestAnimationFrame(step);
4924
+ };
4925
+ rafId = requestAnimationFrame(step);
4926
+ }
4927
+ function stopOverlayTracking() {
4928
+ if (rafId !== null) {
4929
+ cancelAnimationFrame(rafId);
4930
+ rafId = null;
4931
+ }
4932
+ }
4900
4933
  const overlayStyle = computed(() => {
4901
- if (!props.tableElement) return {};
4902
- const rect = props.tableElement.getBoundingClientRect();
4934
+ if (!overlayRect.value || !props.tableElement) return {};
4935
+ const rect = overlayRect.value;
4903
4936
  let overlayWidth = rect.width;
4904
4937
  if (dragState.value) {
4905
- overlayWidth = Math.max(rect.width + 1e3, 2e3);
4938
+ overlayWidth = Math.max(rect.width + DRAG_OVERLAY_EXTENSION_PX, MIN_DRAG_OVERLAY_WIDTH_PX);
4906
4939
  }
4907
4940
  return {
4908
4941
  position: "absolute",
4909
- left: `${props.tableElement.offsetLeft}px`,
4910
- top: `${props.tableElement.offsetTop}px`,
4942
+ left: `${rect.left}px`,
4943
+ top: `${rect.top}px`,
4911
4944
  width: `${overlayWidth}px`,
4912
4945
  height: `${rect.height}px`,
4913
4946
  pointerEvents: dragState.value ? "auto" : "none",
4914
4947
  zIndex: 10
4915
4948
  };
4916
4949
  });
4950
+ function updateOverlayRect() {
4951
+ if (!props.tableElement) {
4952
+ overlayRect.value = null;
4953
+ return;
4954
+ }
4955
+ const parent = props.tableElement.offsetParent;
4956
+ const tableRect = props.tableElement.getBoundingClientRect();
4957
+ if (tableRect.width === 0 || tableRect.height === 0) {
4958
+ overlayRect.value = null;
4959
+ return;
4960
+ }
4961
+ if (parent) {
4962
+ const parentRect = parent.getBoundingClientRect();
4963
+ const left = tableRect.left - parentRect.left + (parent.scrollLeft || 0);
4964
+ const top = tableRect.top - parentRect.top + (parent.scrollTop || 0);
4965
+ overlayRect.value = {
4966
+ left,
4967
+ top,
4968
+ width: tableRect.width,
4969
+ height: tableRect.height
4970
+ };
4971
+ } else {
4972
+ overlayRect.value = {
4973
+ left: props.tableElement.offsetLeft,
4974
+ top: props.tableElement.offsetTop,
4975
+ width: tableRect.width,
4976
+ height: tableRect.height
4977
+ };
4978
+ }
4979
+ }
4917
4980
  const resizableBoundaries = computed(() => {
4918
4981
  if (!tableMetadata.value?.columns) {
4919
4982
  return [];
@@ -4939,21 +5002,39 @@ const _sfc_main$2 = {
4939
5002
  });
4940
5003
  return boundaries;
4941
5004
  });
4942
- function getHandleStyle(boundary) {
5005
+ function getBoundarySegments(boundary) {
5006
+ if (boundary.type === "right-edge") {
5007
+ return [{ y: 0, h: null }];
5008
+ }
5009
+ const segmentsData = tableMetadata.value?.segments;
5010
+ if (!segmentsData || !Array.isArray(segmentsData)) {
5011
+ return [{ y: 0, h: null }];
5012
+ }
5013
+ const boundaryColIndex = boundary.index + 1;
5014
+ const colSegments = segmentsData[boundaryColIndex];
5015
+ if (!colSegments || colSegments.length === 0) {
5016
+ return [];
5017
+ }
5018
+ return colSegments.filter((seg) => seg && typeof seg === "object").map((seg) => ({
5019
+ y: typeof seg.y === "number" ? seg.y : 0,
5020
+ h: seg.h !== null && typeof seg.h === "number" ? seg.h : null
5021
+ }));
5022
+ }
5023
+ function getSegmentHandleStyle(boundary, segment) {
4943
5024
  return {
4944
5025
  position: "absolute",
4945
5026
  left: `${boundary.x}px`,
4946
- top: "0",
4947
- width: "9px",
4948
- height: "100%",
4949
- transform: "translateX(-4px)",
5027
+ top: segment.y != null ? `${segment.y}px` : "0",
5028
+ width: `${RESIZE_HANDLE_WIDTH_PX}px`,
5029
+ height: segment.h != null ? `${segment.h}px` : "100%",
5030
+ transform: `translateX(-${RESIZE_HANDLE_OFFSET_PX}px)`,
4950
5031
  cursor: "col-resize",
4951
5032
  pointerEvents: "auto"
4952
5033
  };
4953
5034
  }
4954
5035
  const guidelineStyle = computed(() => {
4955
5036
  if (!dragState.value || !tableMetadata.value) return { display: "none" };
4956
- const initialBoundary = resizableBoundaries.value[dragState.value.boundaryIndex];
5037
+ const initialBoundary = resizableBoundaries.value[dragState.value.resizableBoundaryIndex];
4957
5038
  if (!initialBoundary) return { display: "none" };
4958
5039
  const newX = initialBoundary.x + dragState.value.constrainedDelta;
4959
5040
  return {
@@ -5000,7 +5081,8 @@ const _sfc_main$2 = {
5000
5081
  });
5001
5082
  return;
5002
5083
  }
5003
- tableMetadata.value = { columns: validatedColumns };
5084
+ const segments = Array.isArray(parsed.segments) ? parsed.segments : void 0;
5085
+ tableMetadata.value = { columns: validatedColumns, segments };
5004
5086
  } catch (error) {
5005
5087
  tableMetadata.value = null;
5006
5088
  emit("resize-error", {
@@ -5009,11 +5091,11 @@ const _sfc_main$2 = {
5009
5091
  });
5010
5092
  }
5011
5093
  }
5012
- function onHandleMouseDown(event, boundaryIndex) {
5094
+ function onHandleMouseDown(event, resizableBoundaryIndex) {
5013
5095
  event.preventDefault();
5014
5096
  event.stopPropagation();
5015
5097
  if (!tableMetadata.value?.columns) return;
5016
- const boundary = resizableBoundaries.value[boundaryIndex];
5098
+ const boundary = resizableBoundaries.value[resizableBoundaryIndex];
5017
5099
  if (!boundary) return;
5018
5100
  const columns = tableMetadata.value.columns;
5019
5101
  const isRightEdge = boundary.type === "right-edge";
@@ -5021,7 +5103,7 @@ const _sfc_main$2 = {
5021
5103
  const rightColumn = isRightEdge ? null : columns[boundary.index + 1];
5022
5104
  dragState.value = {
5023
5105
  columnIndex: boundary.index,
5024
- boundaryIndex,
5106
+ resizableBoundaryIndex,
5025
5107
  isRightEdge,
5026
5108
  initialX: event.clientX,
5027
5109
  initialWidths: columns.map((col) => col.w),
@@ -5035,15 +5117,28 @@ const _sfc_main$2 = {
5035
5117
  } : null,
5036
5118
  constrainedDelta: 0
5037
5119
  };
5120
+ if (!props.editor?.view?.dom) {
5121
+ emit("resize-error", { error: "Editor view not available" });
5122
+ dragState.value = null;
5123
+ return;
5124
+ }
5038
5125
  const pmView = props.editor.view.dom;
5039
5126
  pmView.style.pointerEvents = "none";
5040
- document.addEventListener("mousemove", onDocumentMouseMove);
5041
- document.addEventListener("mouseup", onDocumentMouseUp);
5042
- emit("resize-start", {
5043
- columnIndex: boundary.index,
5044
- isRightEdge,
5045
- initialWidths: dragState.value.initialWidths
5046
- });
5127
+ try {
5128
+ document.addEventListener("mousemove", onDocumentMouseMove);
5129
+ document.addEventListener("mouseup", onDocumentMouseUp);
5130
+ emit("resize-start", {
5131
+ columnIndex: boundary.index,
5132
+ isRightEdge,
5133
+ initialWidths: dragState.value.initialWidths
5134
+ });
5135
+ } catch (error) {
5136
+ document.removeEventListener("mousemove", onDocumentMouseMove);
5137
+ document.removeEventListener("mouseup", onDocumentMouseUp);
5138
+ pmView.style.pointerEvents = "auto";
5139
+ dragState.value = null;
5140
+ emit("resize-error", { error: error instanceof Error ? error.message : String(error) });
5141
+ }
5047
5142
  }
5048
5143
  function throttle(func, limit) {
5049
5144
  let inThrottle;
@@ -5068,7 +5163,7 @@ const _sfc_main$2 = {
5068
5163
  return { throttled, cancel };
5069
5164
  }
5070
5165
  const mouseMoveThrottle = throttle((event) => {
5071
- if (!dragState.value) return;
5166
+ if (isUnmounted || !dragState.value) return;
5072
5167
  const delta = event.clientX - dragState.value.initialX;
5073
5168
  const minDelta = -(dragState.value.leftColumn.width - dragState.value.leftColumn.minWidth);
5074
5169
  let maxDelta;
@@ -5094,7 +5189,7 @@ const _sfc_main$2 = {
5094
5189
  columnIndex: dragState.value.columnIndex,
5095
5190
  delta: constrainedDelta
5096
5191
  });
5097
- }, 16);
5192
+ }, THROTTLE_INTERVAL_MS);
5098
5193
  const onDocumentMouseMove = mouseMoveThrottle.throttled;
5099
5194
  function onDocumentMouseUp(event) {
5100
5195
  if (!dragState.value) return;
@@ -5109,13 +5204,11 @@ const _sfc_main$2 = {
5109
5204
  }
5110
5205
  document.removeEventListener("mousemove", onDocumentMouseMove);
5111
5206
  document.removeEventListener("mouseup", onDocumentMouseUp);
5112
- if (props.editor?.view) {
5207
+ if (props.editor?.view?.dom) {
5113
5208
  const pmView = props.editor.view.dom;
5114
- if (pmView && pmView.style) {
5115
- pmView.style.pointerEvents = "auto";
5116
- }
5209
+ pmView.style.pointerEvents = "auto";
5117
5210
  }
5118
- if (!forcedCleanup.value && Math.abs(finalDelta) > 1) {
5211
+ if (!forcedCleanup.value && Math.abs(finalDelta) > MIN_RESIZE_DELTA_PX) {
5119
5212
  dispatchResizeTransaction(columnIndex, newWidths);
5120
5213
  emit("resize-end", {
5121
5214
  columnIndex,
@@ -5162,7 +5255,7 @@ const _sfc_main$2 = {
5162
5255
  updateCellColwidths(tr, tableNode, tablePos, affectedColumns, newWidths);
5163
5256
  dispatch(tr);
5164
5257
  const blockId = props.tableElement?.getAttribute("data-sd-block-id");
5165
- if (blockId) {
5258
+ if (blockId && blockId.trim()) {
5166
5259
  measureCache.invalidate([blockId]);
5167
5260
  }
5168
5261
  emit("resize-success", { columnIndex, newWidths });
@@ -5178,7 +5271,14 @@ const _sfc_main$2 = {
5178
5271
  if (!pmElement) {
5179
5272
  return null;
5180
5273
  }
5181
- const pmStart = parseInt(pmElement.getAttribute("data-pm-start"), 10);
5274
+ const pmStartAttr = pmElement.getAttribute("data-pm-start");
5275
+ if (!pmStartAttr) {
5276
+ return null;
5277
+ }
5278
+ const pmStart = parseInt(pmStartAttr, 10);
5279
+ if (!Number.isFinite(pmStart)) {
5280
+ return null;
5281
+ }
5182
5282
  let tablePos = null;
5183
5283
  state.doc.descendants((node, pos) => {
5184
5284
  if (node.type.name === "table") {
@@ -5230,6 +5330,12 @@ const _sfc_main$2 = {
5230
5330
  () => props.tableElement,
5231
5331
  () => {
5232
5332
  parseTableMetadata();
5333
+ updateOverlayRect();
5334
+ if (props.visible && props.tableElement) {
5335
+ startOverlayTracking();
5336
+ } else if (!props.tableElement) {
5337
+ stopOverlayTracking();
5338
+ }
5233
5339
  },
5234
5340
  { immediate: true }
5235
5341
  );
@@ -5238,7 +5344,10 @@ const _sfc_main$2 = {
5238
5344
  (visible) => {
5239
5345
  if (visible) {
5240
5346
  parseTableMetadata();
5347
+ updateOverlayRect();
5348
+ startOverlayTracking();
5241
5349
  } else {
5350
+ stopOverlayTracking();
5242
5351
  if (dragState.value) {
5243
5352
  forcedCleanup.value = true;
5244
5353
  onDocumentMouseUp(new MouseEvent("mouseup"));
@@ -5247,8 +5356,15 @@ const _sfc_main$2 = {
5247
5356
  }
5248
5357
  }
5249
5358
  );
5359
+ onMounted(() => {
5360
+ window.addEventListener("scroll", updateOverlayRect, true);
5361
+ window.addEventListener("resize", updateOverlayRect);
5362
+ updateOverlayRect();
5363
+ });
5250
5364
  onBeforeUnmount(() => {
5365
+ isUnmounted = true;
5251
5366
  mouseMoveThrottle.cancel();
5367
+ stopOverlayTracking();
5252
5368
  if (dragState.value) {
5253
5369
  document.removeEventListener("mousemove", onDocumentMouseMove);
5254
5370
  document.removeEventListener("mouseup", onDocumentMouseUp);
@@ -5256,6 +5372,8 @@ const _sfc_main$2 = {
5256
5372
  props.editor.view.dom.style.pointerEvents = "auto";
5257
5373
  }
5258
5374
  }
5375
+ window.removeEventListener("scroll", updateOverlayRect, true);
5376
+ window.removeEventListener("resize", updateOverlayRect);
5259
5377
  });
5260
5378
  return (_ctx, _cache) => {
5261
5379
  return __props.visible && tableMetadata.value ? (openBlock(), createElementBlock("div", {
@@ -5265,17 +5383,456 @@ const _sfc_main$2 = {
5265
5383
  onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
5266
5384
  }, ["stop"]))
5267
5385
  }, [
5268
- (openBlock(true), createElementBlock(Fragment, null, renderList(resizableBoundaries.value, (boundary, index) => {
5386
+ (openBlock(true), createElementBlock(Fragment, null, renderList(resizableBoundaries.value, (boundary, resizableBoundaryIndex) => {
5387
+ return openBlock(), createElementBlock(Fragment, {
5388
+ key: `boundary-${resizableBoundaryIndex}`
5389
+ }, [
5390
+ (openBlock(true), createElementBlock(Fragment, null, renderList(getBoundarySegments(boundary), (segment, segmentIndex) => {
5391
+ return openBlock(), createElementBlock("div", {
5392
+ key: `handle-${boundary.type}-${boundary.index}-${segmentIndex}`,
5393
+ class: normalizeClass(["resize-handle", {
5394
+ "resize-handle--active": dragState.value && dragState.value.resizableBoundaryIndex === resizableBoundaryIndex,
5395
+ "resize-handle--edge": boundary.type === "right-edge"
5396
+ }]),
5397
+ "data-boundary-index": resizableBoundaryIndex,
5398
+ "data-boundary-type": boundary.type,
5399
+ style: normalizeStyle(getSegmentHandleStyle(boundary, segment)),
5400
+ onMousedown: ($event) => onHandleMouseDown($event, resizableBoundaryIndex)
5401
+ }, null, 46, _hoisted_1$3);
5402
+ }), 128))
5403
+ ], 64);
5404
+ }), 128)),
5405
+ dragState.value ? (openBlock(), createElementBlock("div", {
5406
+ key: 0,
5407
+ class: "resize-guideline",
5408
+ style: normalizeStyle(guidelineStyle.value)
5409
+ }, null, 4)) : createCommentVNode("", true)
5410
+ ], 36)) : createCommentVNode("", true);
5411
+ };
5412
+ }
5413
+ };
5414
+ const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2fdf7836"]]);
5415
+ const _hoisted_1$2 = ["data-handle-position", "onMousedown"];
5416
+ const OVERLAY_EXPANSION_PX = 2e3;
5417
+ const RESIZE_HANDLE_SIZE_PX = 12;
5418
+ const MOUSE_MOVE_THROTTLE_MS = 16;
5419
+ const DIMENSION_CHANGE_THRESHOLD_PX = 1;
5420
+ const Z_INDEX_OVERLAY = 10;
5421
+ const Z_INDEX_HANDLE = 15;
5422
+ const Z_INDEX_GUIDELINE = 20;
5423
+ const _sfc_main$3 = {
5424
+ __name: "ImageResizeOverlay",
5425
+ props: {
5426
+ /** Editor instance for dispatching transactions */
5427
+ editor: {
5428
+ type: Object,
5429
+ required: true
5430
+ },
5431
+ /** Show or hide the overlay */
5432
+ visible: {
5433
+ type: Boolean,
5434
+ default: false
5435
+ },
5436
+ /** Image fragment element containing data-image-metadata */
5437
+ imageElement: {
5438
+ type: Object,
5439
+ default: null
5440
+ }
5441
+ },
5442
+ emits: ["resize-start", "resize-move", "resize-end", "resize-success", "resize-error"],
5443
+ setup(__props, { emit: __emit }) {
5444
+ useCssVars((_ctx) => ({
5445
+ "v1e81f81d": RESIZE_HANDLE_SIZE_PX + "px",
5446
+ "v12763124": Z_INDEX_HANDLE
5447
+ }));
5448
+ function isValidEditor(editor) {
5449
+ return editor && typeof editor === "object" && editor.view && typeof editor.view === "object" && editor.view.dom instanceof HTMLElement && editor.view.state && typeof editor.view.dispatch === "function";
5450
+ }
5451
+ const props = __props;
5452
+ const emit = __emit;
5453
+ const imageMetadata = ref(null);
5454
+ const dragState = ref(null);
5455
+ const forcedCleanup = ref(false);
5456
+ const overlayStyle = computed(() => {
5457
+ if (!props.imageElement || !props.imageElement.isConnected) return {};
5458
+ const imageRect = props.imageElement.getBoundingClientRect();
5459
+ const wrapper = props.imageElement.closest(".super-editor");
5460
+ if (!wrapper) {
5461
+ return {
5462
+ position: "absolute",
5463
+ left: `${props.imageElement.offsetLeft}px`,
5464
+ top: `${props.imageElement.offsetTop}px`,
5465
+ width: `${imageRect.width}px`,
5466
+ height: `${imageRect.height}px`,
5467
+ pointerEvents: dragState.value ? "auto" : "none",
5468
+ zIndex: Z_INDEX_OVERLAY
5469
+ };
5470
+ }
5471
+ const wrapperRect = wrapper.getBoundingClientRect();
5472
+ const scrollLeft = wrapper.scrollLeft || 0;
5473
+ const scrollTop = wrapper.scrollTop || 0;
5474
+ const relativeLeft = imageRect.left - wrapperRect.left + scrollLeft;
5475
+ const relativeTop = imageRect.top - wrapperRect.top + scrollTop;
5476
+ let overlayWidth = imageRect.width;
5477
+ let overlayHeight = imageRect.height;
5478
+ let offsetX = 0;
5479
+ let offsetY = 0;
5480
+ if (dragState.value) {
5481
+ const expansion = OVERLAY_EXPANSION_PX;
5482
+ overlayWidth = imageRect.width + expansion * 2;
5483
+ overlayHeight = imageRect.height + expansion * 2;
5484
+ offsetX = -expansion;
5485
+ offsetY = -expansion;
5486
+ }
5487
+ return {
5488
+ position: "absolute",
5489
+ left: `${relativeLeft + offsetX}px`,
5490
+ top: `${relativeTop + offsetY}px`,
5491
+ width: `${overlayWidth}px`,
5492
+ height: `${overlayHeight}px`,
5493
+ pointerEvents: dragState.value ? "auto" : "none",
5494
+ zIndex: Z_INDEX_OVERLAY
5495
+ };
5496
+ });
5497
+ const resizeHandles = computed(() => {
5498
+ if (!imageMetadata.value || !props.imageElement) {
5499
+ return [];
5500
+ }
5501
+ const rect = props.imageElement.getBoundingClientRect();
5502
+ const width = rect.width;
5503
+ const height = rect.height;
5504
+ const handleSize = RESIZE_HANDLE_SIZE_PX;
5505
+ const offset = handleSize / 2;
5506
+ const expansion = dragState.value ? OVERLAY_EXPANSION_PX : 0;
5507
+ return [
5508
+ {
5509
+ position: "nw",
5510
+ style: {
5511
+ left: `${expansion - offset}px`,
5512
+ top: `${expansion - offset}px`,
5513
+ cursor: "nwse-resize"
5514
+ }
5515
+ },
5516
+ {
5517
+ position: "ne",
5518
+ style: {
5519
+ left: `${expansion + width - offset}px`,
5520
+ top: `${expansion - offset}px`,
5521
+ cursor: "nesw-resize"
5522
+ }
5523
+ },
5524
+ {
5525
+ position: "sw",
5526
+ style: {
5527
+ left: `${expansion - offset}px`,
5528
+ top: `${expansion + height - offset}px`,
5529
+ cursor: "nesw-resize"
5530
+ }
5531
+ },
5532
+ {
5533
+ position: "se",
5534
+ style: {
5535
+ left: `${expansion + width - offset}px`,
5536
+ top: `${expansion + height - offset}px`,
5537
+ cursor: "nwse-resize"
5538
+ }
5539
+ }
5540
+ ];
5541
+ });
5542
+ const guidelineStyle = computed(() => {
5543
+ if (!dragState.value || !props.imageElement) {
5544
+ return { display: "none" };
5545
+ }
5546
+ const expansion = OVERLAY_EXPANSION_PX;
5547
+ return {
5548
+ position: "absolute",
5549
+ left: `${expansion}px`,
5550
+ top: `${expansion}px`,
5551
+ width: `${dragState.value.constrainedWidth}px`,
5552
+ height: `${dragState.value.constrainedHeight}px`,
5553
+ border: "2px solid #4A90E2",
5554
+ pointerEvents: "none",
5555
+ zIndex: Z_INDEX_GUIDELINE,
5556
+ boxSizing: "border-box"
5557
+ };
5558
+ });
5559
+ function parseImageMetadata() {
5560
+ if (!props.imageElement || !props.imageElement.isConnected) {
5561
+ imageMetadata.value = null;
5562
+ return;
5563
+ }
5564
+ try {
5565
+ const metadataAttr = props.imageElement.getAttribute("data-image-metadata");
5566
+ if (!metadataAttr) {
5567
+ imageMetadata.value = null;
5568
+ return;
5569
+ }
5570
+ const parsed = JSON.parse(metadataAttr);
5571
+ if (!parsed || typeof parsed !== "object") {
5572
+ imageMetadata.value = null;
5573
+ return;
5574
+ }
5575
+ const required = [
5576
+ "originalWidth",
5577
+ "originalHeight",
5578
+ "maxWidth",
5579
+ "maxHeight",
5580
+ "aspectRatio",
5581
+ "minWidth",
5582
+ "minHeight"
5583
+ ];
5584
+ for (const field of required) {
5585
+ if (!Number.isFinite(parsed[field]) || parsed[field] <= 0) {
5586
+ console.warn(`[ImageResizeOverlay] Invalid or missing metadata field: ${field}`);
5587
+ imageMetadata.value = null;
5588
+ return;
5589
+ }
5590
+ }
5591
+ imageMetadata.value = parsed;
5592
+ } catch (error) {
5593
+ imageMetadata.value = null;
5594
+ emit("resize-error", {
5595
+ error: error instanceof Error ? error.message : "Failed to parse image metadata",
5596
+ rawMetadata: props.imageElement?.getAttribute("data-image-metadata")
5597
+ });
5598
+ }
5599
+ }
5600
+ function onHandleMouseDown(event, handlePosition) {
5601
+ event.preventDefault();
5602
+ event.stopPropagation();
5603
+ if (!isValidEditor(props.editor) || !imageMetadata.value || !props.imageElement) return;
5604
+ const rect = props.imageElement.getBoundingClientRect();
5605
+ dragState.value = {
5606
+ handle: handlePosition,
5607
+ initialX: event.clientX,
5608
+ initialY: event.clientY,
5609
+ initialWidth: rect.width,
5610
+ initialHeight: rect.height,
5611
+ aspectRatio: imageMetadata.value.aspectRatio,
5612
+ constrainedWidth: rect.width,
5613
+ constrainedHeight: rect.height
5614
+ };
5615
+ const pmView = props.editor.view.dom;
5616
+ pmView.style.pointerEvents = "none";
5617
+ document.addEventListener("mousemove", onDocumentMouseMove);
5618
+ document.addEventListener("mouseup", onDocumentMouseUp);
5619
+ document.addEventListener("keydown", onEscapeKey);
5620
+ emit("resize-start", {
5621
+ blockId: props.imageElement.getAttribute("data-sd-block-id"),
5622
+ initialWidth: rect.width,
5623
+ initialHeight: rect.height
5624
+ });
5625
+ }
5626
+ function throttle(func, limit) {
5627
+ let inThrottle;
5628
+ let timeoutId = null;
5629
+ const throttled = function(...args) {
5630
+ if (!inThrottle) {
5631
+ func.apply(this, args);
5632
+ inThrottle = true;
5633
+ timeoutId = setTimeout(() => {
5634
+ inThrottle = false;
5635
+ timeoutId = null;
5636
+ }, limit);
5637
+ }
5638
+ };
5639
+ const cancel = () => {
5640
+ if (timeoutId !== null) {
5641
+ clearTimeout(timeoutId);
5642
+ timeoutId = null;
5643
+ inThrottle = false;
5644
+ }
5645
+ };
5646
+ return { throttled, cancel };
5647
+ }
5648
+ const mouseMoveThrottle = throttle((event) => {
5649
+ if (!dragState.value || !imageMetadata.value) return;
5650
+ let deltaX = event.clientX - dragState.value.initialX;
5651
+ let deltaY = event.clientY - dragState.value.initialY;
5652
+ const handle = dragState.value.handle;
5653
+ if (handle === "nw") {
5654
+ deltaX = -deltaX;
5655
+ deltaY = -deltaY;
5656
+ } else if (handle === "ne") {
5657
+ deltaY = -deltaY;
5658
+ } else if (handle === "sw") {
5659
+ deltaX = -deltaX;
5660
+ }
5661
+ const scaleX = (dragState.value.initialWidth + deltaX) / dragState.value.initialWidth;
5662
+ const scaleY = (dragState.value.initialHeight + deltaY) / dragState.value.initialHeight;
5663
+ const scale = Math.max(scaleX, scaleY);
5664
+ let newWidth = dragState.value.initialWidth * scale;
5665
+ let newHeight = dragState.value.initialHeight * scale;
5666
+ const minWidth = imageMetadata.value.minWidth;
5667
+ const minHeight = imageMetadata.value.minHeight;
5668
+ const maxWidth = imageMetadata.value.maxWidth;
5669
+ const maxHeight = imageMetadata.value.maxHeight;
5670
+ if (newWidth < minWidth) {
5671
+ newWidth = minWidth;
5672
+ newHeight = newWidth / dragState.value.aspectRatio;
5673
+ }
5674
+ if (newHeight < minHeight) {
5675
+ newHeight = minHeight;
5676
+ newWidth = newHeight * dragState.value.aspectRatio;
5677
+ }
5678
+ if (newWidth > maxWidth) {
5679
+ newWidth = maxWidth;
5680
+ newHeight = newWidth / dragState.value.aspectRatio;
5681
+ }
5682
+ if (newHeight > maxHeight) {
5683
+ newHeight = maxHeight;
5684
+ newWidth = newHeight * dragState.value.aspectRatio;
5685
+ }
5686
+ dragState.value.constrainedWidth = newWidth;
5687
+ dragState.value.constrainedHeight = newHeight;
5688
+ emit("resize-move", {
5689
+ blockId: props.imageElement.getAttribute("data-sd-block-id"),
5690
+ width: newWidth,
5691
+ height: newHeight
5692
+ });
5693
+ }, MOUSE_MOVE_THROTTLE_MS);
5694
+ const onDocumentMouseMove = mouseMoveThrottle.throttled;
5695
+ function onEscapeKey(event) {
5696
+ if (event.key === "Escape" && dragState.value) {
5697
+ forcedCleanup.value = true;
5698
+ onDocumentMouseUp(new MouseEvent("mouseup"));
5699
+ forcedCleanup.value = false;
5700
+ }
5701
+ }
5702
+ function onDocumentMouseUp(event) {
5703
+ if (!dragState.value) return;
5704
+ const finalWidth = dragState.value.constrainedWidth;
5705
+ const finalHeight = dragState.value.constrainedHeight;
5706
+ const blockId = props.imageElement?.getAttribute("data-sd-block-id");
5707
+ document.removeEventListener("mousemove", onDocumentMouseMove);
5708
+ document.removeEventListener("mouseup", onDocumentMouseUp);
5709
+ document.removeEventListener("keydown", onEscapeKey);
5710
+ if (props.editor?.view) {
5711
+ const pmView = props.editor.view.dom;
5712
+ if (pmView && pmView.style) {
5713
+ pmView.style.pointerEvents = "auto";
5714
+ }
5715
+ }
5716
+ const widthDelta = Math.abs(finalWidth - dragState.value.initialWidth);
5717
+ const heightDelta = Math.abs(finalHeight - dragState.value.initialHeight);
5718
+ if (!forcedCleanup.value && (widthDelta > DIMENSION_CHANGE_THRESHOLD_PX || heightDelta > DIMENSION_CHANGE_THRESHOLD_PX)) {
5719
+ dispatchResizeTransaction(blockId, finalWidth, finalHeight);
5720
+ emit("resize-end", {
5721
+ blockId,
5722
+ finalWidth,
5723
+ finalHeight
5724
+ });
5725
+ }
5726
+ dragState.value = null;
5727
+ }
5728
+ function dispatchResizeTransaction(blockId, newWidth, newHeight) {
5729
+ if (!isValidEditor(props.editor) || !props.imageElement) {
5730
+ return;
5731
+ }
5732
+ if (!Number.isFinite(newWidth) || !Number.isFinite(newHeight) || newWidth <= 0 || newHeight <= 0) {
5733
+ emit("resize-error", {
5734
+ blockId,
5735
+ error: "Invalid dimensions: width and height must be positive finite numbers"
5736
+ });
5737
+ return;
5738
+ }
5739
+ try {
5740
+ const { state, dispatch } = props.editor.view;
5741
+ const tr = state.tr;
5742
+ const pmStartAttr = props.imageElement.getAttribute("data-pm-start");
5743
+ if (!pmStartAttr) {
5744
+ emit("resize-error", {
5745
+ blockId,
5746
+ error: "Image position marker (data-pm-start) not found"
5747
+ });
5748
+ return;
5749
+ }
5750
+ const imagePos = parseInt(pmStartAttr, 10);
5751
+ if (!Number.isFinite(imagePos) || imagePos < 0) {
5752
+ emit("resize-error", {
5753
+ blockId,
5754
+ error: "Invalid image position marker"
5755
+ });
5756
+ return;
5757
+ }
5758
+ const imageNode = state.doc.nodeAt(imagePos);
5759
+ if (!imageNode || imageNode.type.name !== "image") {
5760
+ emit("resize-error", {
5761
+ blockId,
5762
+ error: "Invalid image node at position"
5763
+ });
5764
+ return;
5765
+ }
5766
+ const newAttrs = {
5767
+ ...imageNode.attrs,
5768
+ size: {
5769
+ width: Math.round(newWidth),
5770
+ height: Math.round(newHeight)
5771
+ }
5772
+ };
5773
+ tr.setNodeMarkup(imagePos, null, newAttrs);
5774
+ dispatch(tr);
5775
+ if (blockId && blockId.trim()) {
5776
+ measureCache.invalidate([blockId]);
5777
+ }
5778
+ emit("resize-success", { blockId, newWidth, newHeight });
5779
+ } catch (error) {
5780
+ emit("resize-error", {
5781
+ blockId,
5782
+ error: error instanceof Error ? error.message : String(error)
5783
+ });
5784
+ }
5785
+ }
5786
+ watch(
5787
+ () => props.imageElement,
5788
+ () => {
5789
+ parseImageMetadata();
5790
+ },
5791
+ { immediate: true }
5792
+ );
5793
+ watch(
5794
+ () => props.visible,
5795
+ (visible) => {
5796
+ if (visible) {
5797
+ parseImageMetadata();
5798
+ } else {
5799
+ if (dragState.value) {
5800
+ forcedCleanup.value = true;
5801
+ onDocumentMouseUp(new MouseEvent("mouseup"));
5802
+ forcedCleanup.value = false;
5803
+ }
5804
+ }
5805
+ }
5806
+ );
5807
+ onBeforeUnmount(() => {
5808
+ mouseMoveThrottle.cancel();
5809
+ if (dragState.value) {
5810
+ document.removeEventListener("mousemove", onDocumentMouseMove);
5811
+ document.removeEventListener("mouseup", onDocumentMouseUp);
5812
+ document.removeEventListener("keydown", onEscapeKey);
5813
+ if (props.editor?.view?.dom) {
5814
+ props.editor.view.dom.style.pointerEvents = "auto";
5815
+ }
5816
+ }
5817
+ });
5818
+ return (_ctx, _cache) => {
5819
+ return __props.visible && imageMetadata.value ? (openBlock(), createElementBlock("div", {
5820
+ key: 0,
5821
+ class: "superdoc-image-resize-overlay",
5822
+ style: normalizeStyle(overlayStyle.value),
5823
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
5824
+ }, ["stop"]))
5825
+ }, [
5826
+ (openBlock(true), createElementBlock(Fragment, null, renderList(resizeHandles.value, (handle) => {
5269
5827
  return openBlock(), createElementBlock("div", {
5270
- key: `handle-${boundary.type}-${boundary.index}`,
5828
+ key: handle.position,
5271
5829
  class: normalizeClass(["resize-handle", {
5272
- "resize-handle--active": dragState.value && dragState.value.boundaryIndex === index,
5273
- "resize-handle--edge": boundary.type === "right-edge"
5830
+ "resize-handle--active": dragState.value && dragState.value.handle === handle.position,
5831
+ [`resize-handle--${handle.position}`]: true
5274
5832
  }]),
5275
- "data-boundary-index": index,
5276
- "data-boundary-type": boundary.type,
5277
- style: normalizeStyle(getHandleStyle(boundary)),
5278
- onMousedown: ($event) => onHandleMouseDown($event, index)
5833
+ style: normalizeStyle(handle.style),
5834
+ "data-handle-position": handle.position,
5835
+ onMousedown: ($event) => onHandleMouseDown($event, handle.position)
5279
5836
  }, null, 46, _hoisted_1$2);
5280
5837
  }), 128)),
5281
5838
  dragState.value ? (openBlock(), createElementBlock("div", {
@@ -5287,7 +5844,81 @@ const _sfc_main$2 = {
5287
5844
  };
5288
5845
  }
5289
5846
  };
5290
- const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-acc51d8d"]]);
5847
+ const ImageResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e66ec7bb"]]);
5848
+ const _sfc_main$2 = {
5849
+ __name: "LinkClickHandler",
5850
+ props: {
5851
+ editor: {
5852
+ type: Object,
5853
+ required: true
5854
+ },
5855
+ openPopover: {
5856
+ type: Function,
5857
+ required: true
5858
+ },
5859
+ closePopover: {
5860
+ type: Function,
5861
+ required: true
5862
+ },
5863
+ popoverVisible: {
5864
+ type: Boolean,
5865
+ default: false
5866
+ }
5867
+ },
5868
+ setup(__props) {
5869
+ const props = __props;
5870
+ const handleLinkClick = (event) => {
5871
+ if (props.popoverVisible) {
5872
+ props.closePopover();
5873
+ return;
5874
+ }
5875
+ if (!props.editor || !props.editor.state) {
5876
+ return;
5877
+ }
5878
+ const surface = getEditorSurfaceElement(props.editor);
5879
+ if (!surface) {
5880
+ return;
5881
+ }
5882
+ moveCursorToMouseEvent(event.detail, props.editor);
5883
+ setTimeout(() => {
5884
+ const currentState = props.editor.state;
5885
+ const hasLink = selectionHasNodeOrMark(currentState, "link", { requireEnds: true });
5886
+ if (hasLink) {
5887
+ const surfaceRect = surface.getBoundingClientRect();
5888
+ if (!surfaceRect) return;
5889
+ props.openPopover(
5890
+ markRaw(LinkInput),
5891
+ {
5892
+ showInput: true,
5893
+ editor: props.editor,
5894
+ closePopover: props.closePopover
5895
+ },
5896
+ {
5897
+ left: `${event.detail.clientX - surfaceRect.left}px`,
5898
+ top: `${event.detail.clientY - surfaceRect.top + 15}px`
5899
+ }
5900
+ );
5901
+ }
5902
+ }, 10);
5903
+ };
5904
+ let surfaceElement = null;
5905
+ onMounted(() => {
5906
+ if (!props.editor) return;
5907
+ surfaceElement = getEditorSurfaceElement(props.editor);
5908
+ if (surfaceElement) {
5909
+ surfaceElement.addEventListener("superdoc-link-click", handleLinkClick);
5910
+ }
5911
+ });
5912
+ onBeforeUnmount(() => {
5913
+ if (surfaceElement) {
5914
+ surfaceElement.removeEventListener("superdoc-link-click", handleLinkClick);
5915
+ }
5916
+ });
5917
+ return (_ctx, _cache) => {
5918
+ return null;
5919
+ };
5920
+ }
5921
+ };
5291
5922
  function adjustPaginationBreaks(editorElem, editor) {
5292
5923
  if (!editorElem.value || !editor?.value?.options?.scale || isHeadless(editor)) return;
5293
5924
  const zoom = editor.value.options.scale;
@@ -5312,6 +5943,8 @@ const _hoisted_2 = {
5312
5943
  };
5313
5944
  const _hoisted_3 = { class: "placeholder-title" };
5314
5945
  const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
5946
+ const TABLE_RESIZE_HOVER_THRESHOLD = 8;
5947
+ const TABLE_RESIZE_THROTTLE_MS = 16;
5315
5948
  const _sfc_main$1 = {
5316
5949
  __name: "SuperEditor",
5317
5950
  props: {
@@ -5376,7 +6009,63 @@ const _sfc_main$1 = {
5376
6009
  visible: false,
5377
6010
  tableElement: null
5378
6011
  });
6012
+ const imageResizeState = reactive({
6013
+ visible: false,
6014
+ imageElement: null,
6015
+ blockId: null
6016
+ });
6017
+ let lastUpdateTableResizeTimestamp = 0;
6018
+ const isNearColumnBoundary = (event, tableElement) => {
6019
+ if (!event || typeof event.clientX !== "number" || typeof event.clientY !== "number") {
6020
+ console.warn("[isNearColumnBoundary] Invalid event: missing clientX or clientY", event);
6021
+ return false;
6022
+ }
6023
+ if (!tableElement || !(tableElement instanceof HTMLElement)) {
6024
+ console.warn("[isNearColumnBoundary] Invalid tableElement: not an HTMLElement", tableElement);
6025
+ return false;
6026
+ }
6027
+ const boundariesAttr = tableElement.getAttribute("data-table-boundaries");
6028
+ if (!boundariesAttr) return false;
6029
+ try {
6030
+ const metadata = JSON.parse(boundariesAttr);
6031
+ if (!metadata.columns || !Array.isArray(metadata.columns)) return false;
6032
+ const tableRect = tableElement.getBoundingClientRect();
6033
+ const mouseX = event.clientX - tableRect.left;
6034
+ const mouseY = event.clientY - tableRect.top;
6035
+ for (let i2 = 0; i2 < metadata.columns.length; i2++) {
6036
+ const col = metadata.columns[i2];
6037
+ const boundaryX = col.x + col.w;
6038
+ if (Math.abs(mouseX - boundaryX) <= TABLE_RESIZE_HOVER_THRESHOLD) {
6039
+ const segmentColIndex = i2 + 1;
6040
+ const segments = metadata.segments?.[segmentColIndex];
6041
+ if (!segments || segments.length === 0) {
6042
+ if (i2 === metadata.columns.length - 1) return true;
6043
+ continue;
6044
+ }
6045
+ for (const seg of segments) {
6046
+ const segTop = seg.y || 0;
6047
+ const segBottom = seg.h != null ? segTop + seg.h : tableRect.height;
6048
+ if (mouseY >= segTop && mouseY <= segBottom) {
6049
+ return true;
6050
+ }
6051
+ }
6052
+ }
6053
+ }
6054
+ if (Math.abs(mouseX) <= TABLE_RESIZE_HOVER_THRESHOLD) {
6055
+ return true;
6056
+ }
6057
+ return false;
6058
+ } catch (e) {
6059
+ console.warn("[isNearColumnBoundary] Failed to parse table boundary metadata:", e);
6060
+ return false;
6061
+ }
6062
+ };
5379
6063
  const updateTableResizeOverlay = (event) => {
6064
+ const now = Date.now();
6065
+ if (now - lastUpdateTableResizeTimestamp < TABLE_RESIZE_THROTTLE_MS) {
6066
+ return;
6067
+ }
6068
+ lastUpdateTableResizeTimestamp = now;
5380
6069
  if (!editorElem.value) return;
5381
6070
  let target = event.target;
5382
6071
  while (target && target !== editorElem.value) {
@@ -5384,8 +6073,13 @@ const _sfc_main$1 = {
5384
6073
  return;
5385
6074
  }
5386
6075
  if (target.classList?.contains("superdoc-table-fragment") && target.hasAttribute("data-table-boundaries")) {
5387
- tableResizeState.visible = true;
5388
- tableResizeState.tableElement = target;
6076
+ if (isNearColumnBoundary(event, target)) {
6077
+ tableResizeState.visible = true;
6078
+ tableResizeState.tableElement = target;
6079
+ } else {
6080
+ tableResizeState.visible = false;
6081
+ tableResizeState.tableElement = null;
6082
+ }
5389
6083
  return;
5390
6084
  }
5391
6085
  target = target.parentElement;
@@ -5397,6 +6091,38 @@ const _sfc_main$1 = {
5397
6091
  tableResizeState.visible = false;
5398
6092
  tableResizeState.tableElement = null;
5399
6093
  };
6094
+ const updateImageResizeOverlay = (event) => {
6095
+ if (!editorElem.value) return;
6096
+ let target = event.target;
6097
+ while (target && target !== document.body) {
6098
+ if (target.classList?.contains("superdoc-image-resize-overlay") || target.closest?.(".superdoc-image-resize-overlay")) {
6099
+ return;
6100
+ }
6101
+ if (target.classList?.contains("superdoc-image-fragment") && target.hasAttribute("data-image-metadata")) {
6102
+ imageResizeState.visible = true;
6103
+ imageResizeState.imageElement = target;
6104
+ imageResizeState.blockId = target.getAttribute("data-sd-block-id");
6105
+ return;
6106
+ }
6107
+ target = target.parentElement;
6108
+ }
6109
+ imageResizeState.visible = false;
6110
+ imageResizeState.imageElement = null;
6111
+ imageResizeState.blockId = null;
6112
+ };
6113
+ const hideImageResizeOverlay = () => {
6114
+ imageResizeState.visible = false;
6115
+ imageResizeState.imageElement = null;
6116
+ imageResizeState.blockId = null;
6117
+ };
6118
+ const handleOverlayUpdates = (event) => {
6119
+ updateTableResizeOverlay(event);
6120
+ updateImageResizeOverlay(event);
6121
+ };
6122
+ const handleOverlayHide = () => {
6123
+ hideTableResizeOverlay();
6124
+ hideImageResizeOverlay();
6125
+ };
5400
6126
  let dataPollTimeout;
5401
6127
  const stopPolling = () => {
5402
6128
  clearTimeout(dataPollTimeout);
@@ -5483,6 +6209,22 @@ const _sfc_main$1 = {
5483
6209
  const paginationTarget = editor.value?.editor ? { value: base } : editor;
5484
6210
  adjustPaginationBreaks(editorElem, paginationTarget);
5485
6211
  });
6212
+ if (editor.value instanceof PresentationEditor) {
6213
+ editor.value.on("layoutUpdated", () => {
6214
+ if (imageResizeState.visible && imageResizeState.blockId) {
6215
+ const newElement = editorElem.value?.querySelector(
6216
+ `.superdoc-image-fragment[data-sd-block-id="${imageResizeState.blockId}"]`
6217
+ );
6218
+ if (newElement) {
6219
+ imageResizeState.imageElement = newElement;
6220
+ } else {
6221
+ imageResizeState.visible = false;
6222
+ imageResizeState.imageElement = null;
6223
+ imageResizeState.blockId = null;
6224
+ }
6225
+ }
6226
+ });
6227
+ }
5486
6228
  editor.value.on("collaborationReady", () => {
5487
6229
  setTimeout(() => {
5488
6230
  editorReady.value = true;
@@ -5567,8 +6309,8 @@ const _sfc_main$1 = {
5567
6309
  onKeydown: handleSuperEditorKeydown,
5568
6310
  onClick: handleSuperEditorClick,
5569
6311
  onMousedown: handleMarginClick,
5570
- onMousemove: updateTableResizeOverlay,
5571
- onMouseleave: hideTableResizeOverlay
6312
+ onMousemove: handleOverlayUpdates,
6313
+ onMouseleave: handleOverlayHide
5572
6314
  }, [
5573
6315
  createElementVNode("div", {
5574
6316
  ref_key: "editorElem",
@@ -5576,19 +6318,32 @@ const _sfc_main$1 = {
5576
6318
  class: "editor-element super-editor__element",
5577
6319
  role: "presentation"
5578
6320
  }, null, 512),
5579
- !contextMenuDisabled.value && editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$6, {
6321
+ !contextMenuDisabled.value && editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$8, {
5580
6322
  key: 0,
5581
6323
  editor: activeEditor.value,
5582
6324
  popoverControls,
5583
6325
  openPopover,
5584
6326
  closePopover
5585
6327
  }, null, 8, ["editor", "popoverControls"])) : createCommentVNode("", true),
5586
- editorReady.value && activeEditor.value ? (openBlock(), createBlock(TableResizeOverlay, {
6328
+ editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$2, {
5587
6329
  key: 1,
5588
6330
  editor: activeEditor.value,
6331
+ openPopover,
6332
+ closePopover,
6333
+ popoverVisible: popoverControls.visible
6334
+ }, null, 8, ["editor", "popoverVisible"])) : createCommentVNode("", true),
6335
+ editorReady.value && activeEditor.value ? (openBlock(), createBlock(TableResizeOverlay, {
6336
+ key: 2,
6337
+ editor: activeEditor.value,
5589
6338
  visible: tableResizeState.visible,
5590
6339
  tableElement: tableResizeState.tableElement
5591
- }, null, 8, ["editor", "visible", "tableElement"])) : createCommentVNode("", true)
6340
+ }, null, 8, ["editor", "visible", "tableElement"])) : createCommentVNode("", true),
6341
+ editorReady.value && activeEditor.value ? (openBlock(), createBlock(ImageResizeOverlay, {
6342
+ key: 3,
6343
+ editor: activeEditor.value,
6344
+ visible: imageResizeState.visible,
6345
+ imageElement: imageResizeState.imageElement
6346
+ }, null, 8, ["editor", "visible", "imageElement"])) : createCommentVNode("", true)
5592
6347
  ], 544),
5593
6348
  !editorReady.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
5594
6349
  createElementVNode("div", _hoisted_3, [
@@ -5651,7 +6406,7 @@ const _sfc_main$1 = {
5651
6406
  };
5652
6407
  }
5653
6408
  };
5654
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-f1e98438"]]);
6409
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ed5a08ee"]]);
5655
6410
  const _hoisted_1 = ["innerHTML"];
5656
6411
  const _sfc_main = {
5657
6412
  __name: "SuperInput",
@@ -5743,98 +6498,6 @@ const _sfc_main = {
5743
6498
  }
5744
6499
  };
5745
6500
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
5746
- const additionalHandlers = Object.freeze({
5747
- "mc:AlternateContent": translator$1j,
5748
- "sd:pageReference": translator$1i,
5749
- "sd:tableOfContents": translator$1h,
5750
- "w:b": translator$1g,
5751
- "w:bCs": translator$1f,
5752
- "w:bidiVisual": translator$1e,
5753
- "w:bookmarkEnd": translator$1d,
5754
- "w:bookmarkStart": translator$1c,
5755
- "w:bottom": translator$1b,
5756
- "w:br": translator$1a,
5757
- "w:cantSplit": translator$19,
5758
- "w:caps": translator$18,
5759
- "w:cnfStyle": translator$17,
5760
- "w:color": translator$16,
5761
- "w:divId": translator$15,
5762
- "w:drawing": translator$14,
5763
- "w:end": translator$13,
5764
- "w:gridAfter": translator$12,
5765
- "w:gridBefore": translator$11,
5766
- "w:gridCol": translator$10,
5767
- "w:hidden": translator$$,
5768
- "w:highlight": translator$_,
5769
- "w:hyperlink": translator$Z,
5770
- "w:i": translator$Y,
5771
- "w:insideH": translator$X,
5772
- "w:insideV": translator$W,
5773
- "w:jc": translator$V,
5774
- "w:left": translator$U,
5775
- "w:p": translator$T,
5776
- "w:r": translator$S,
5777
- "w:rFonts": translator$R,
5778
- "w:rPr": translator$Q,
5779
- "w:rStyle": translator$P,
5780
- "w:right": translator$O,
5781
- "w:sdt": translator$N,
5782
- "w:shd": translator$M,
5783
- "w:start": translator$L,
5784
- "w:strike": translator$K,
5785
- "w:sz": translator$J,
5786
- "w:szCs": translator$I,
5787
- "w:tab": translator$H,
5788
- "w:tbl": translator$G,
5789
- "w:tblBorders": translator$F,
5790
- "w:tblCaption": translator$E,
5791
- "w:tblCellMar": translator$D,
5792
- "w:tblCellSpacing": translator$C,
5793
- "w:tblDescription": translator$B,
5794
- "w:tblGrid": translator$A,
5795
- "w:tblHeader": translator$z,
5796
- "w:tblInd": translator$y,
5797
- "w:tblLayout": translator$x,
5798
- "w:tblLook": translator$w,
5799
- "w:tblOverlap": translator$v,
5800
- "w:tblPr": translator$u,
5801
- "w:tblStyle": translator$t,
5802
- "w:tblStyleColBandSize": translator$s,
5803
- "w:tblStyleRowBandSize": translator$r,
5804
- "w:tblW": translator$q,
5805
- "w:tblpPr": translator$p,
5806
- "w:tc": translator$o,
5807
- "w:top": translator$n,
5808
- "w:tr": translator$m,
5809
- "w:trHeight": translator$l,
5810
- "w:trPr": translator$k,
5811
- "w:u": translator$j,
5812
- "w:wAfter": translator$i,
5813
- "w:wBefore": translator$h,
5814
- "wp:anchor": translator$g,
5815
- "wp:inline": translator$f,
5816
- "w:commentRangeStart": commentRangeStartTranslator,
5817
- "w:commentRangeEnd": commentRangeEndTranslator,
5818
- "w:vMerge": translator$e,
5819
- "w:gridSpan": translator$d,
5820
- "w:vAlign": translator$c,
5821
- "w:noWrap": translator$b,
5822
- "w:tcFitText": translator$a,
5823
- "w:tcW": translator$9,
5824
- "w:hideMark": translator$8,
5825
- "w:textDirection": translator$7,
5826
- "w:tl2br": translator$6,
5827
- "w:tr2bl": translator$5,
5828
- "w:header": translator$4,
5829
- "w:headers": translator$3,
5830
- "w:tcBorders": translator$2,
5831
- "w:tcMar": translator$1,
5832
- "w:tcPr": translator
5833
- });
5834
- const baseHandlers = {
5835
- ...additionalHandlers
5836
- };
5837
- const registeredHandlers = Object.freeze(baseHandlers);
5838
6501
  const Extensions = {
5839
6502
  Node,
5840
6503
  Attribute,
@@ -5849,14 +6512,14 @@ const Extensions = {
5849
6512
  export {
5850
6513
  AIWriter,
5851
6514
  z as AnnotatorHelpers,
5852
- _sfc_main$5 as BasicUpload,
6515
+ _sfc_main$7 as BasicUpload,
5853
6516
  F as CommentsPluginKey,
5854
6517
  D as DocxZipper,
5855
6518
  Editor,
5856
6519
  Extensions,
5857
6520
  PresentationEditor,
5858
6521
  B as SectionHelpers,
5859
- _sfc_main$6 as SlashMenu,
6522
+ _sfc_main$8 as SlashMenu,
5860
6523
  ac as SuperConverter,
5861
6524
  SuperEditor,
5862
6525
  SuperInput,
@@ -5871,6 +6534,6 @@ export {
5871
6534
  getRichTextExtensions,
5872
6535
  getStarterExtensions,
5873
6536
  a9 as helpers,
5874
- registeredHandlers,
6537
+ aQ as registeredHandlers,
5875
6538
  x as trackChangesHelpers
5876
6539
  };