@harbour-enterprises/superdoc 1.0.0-beta.13 → 1.0.0-beta.19

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 (42) hide show
  1. package/dist/chunks/{PdfViewer-D_E86Mtr.cjs → PdfViewer-BLFV17De.cjs} +2 -2
  2. package/dist/chunks/{PdfViewer-D0cPi5hG.es.js → PdfViewer-D_4g-jsZ.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-BMAfbNel-CvPc3jnD.es.js → index-CRpn1mWd-B4eH8Zok.es.js} +1 -1
  6. package/dist/chunks/{index-BMAfbNel-DBZCkkMj.cjs → index-CRpn1mWd-BUbbd3Jq.cjs} +1 -1
  7. package/dist/chunks/{index-BHmLKAul.es.js → index-NPXppXmC.es.js} +11 -7
  8. package/dist/chunks/{index-CL4VptDO.cjs → index-k02voMEs.cjs} +11 -7
  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-5gtBhP8I.es.js → super-editor.es-CHU4dmes.es.js} +9554 -2211
  12. package/dist/chunks/{super-editor.es-riuOlaxm.cjs → super-editor.es-C_Gk8cDd.cjs} +9554 -2211
  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.map +1 -1
  19. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
  20. package/dist/style.css +57 -18
  21. package/dist/super-editor/ai-writer.es.js +2 -2
  22. package/dist/super-editor/chunks/{converter-D9KiDgXx.js → converter-Cu26_LdN.js} +1190 -385
  23. package/dist/super-editor/chunks/{docx-zipper-DQmUj-ef.js → docx-zipper-C8lozSFd.js} +1 -1
  24. package/dist/super-editor/chunks/{editor-ByPqJ2k8.js → editor-BXC2Hzba.js} +7704 -1712
  25. package/dist/super-editor/chunks/{index-BMAfbNel.js → index-CRpn1mWd.js} +1 -1
  26. package/dist/super-editor/chunks/{toolbar-Da2cOhJ-.js → toolbar-BglLOe8y.js} +36 -22
  27. package/dist/super-editor/converter.es.js +1 -1
  28. package/dist/super-editor/docx-zipper.es.js +2 -2
  29. package/dist/super-editor/editor.es.js +3 -3
  30. package/dist/super-editor/file-zipper.es.js +1 -1
  31. package/dist/super-editor/style.css +57 -18
  32. package/dist/super-editor/super-editor.es.js +770 -200
  33. package/dist/super-editor/toolbar.es.js +2 -2
  34. package/dist/super-editor.cjs +4 -4
  35. package/dist/super-editor.es.js +2 -2
  36. package/dist/superdoc.cjs +2 -2
  37. package/dist/superdoc.es.js +2 -2
  38. package/dist/superdoc.umd.js +9623 -2200
  39. package/dist/superdoc.umd.js.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/chunks/xml-js-BZPSMmVo.es.js +0 -2
  42. 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-D9KiDgXx.js";
13
- import { ac, i, a9 } from "./chunks/converter-D9KiDgXx.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-ByPqJ2k8.js";
15
- import { z, F, B, T, w, C, x } from "./chunks/editor-ByPqJ2k8.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-Da2cOhJ-.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, U as findParentNode, ar as calculateResolvedParagraphProperties, a7 as twipsToLines, V as isList, al as parseSizeUnit, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-Cu26_LdN.js";
13
+ import { ac, i, a9, aQ } from "./chunks/converter-Cu26_LdN.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-BXC2Hzba.js";
15
+ import { z, F, B, T, w, C, x } from "./chunks/editor-BXC2Hzba.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-BglLOe8y.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-DQmUj-ef.js";
19
+ import { D } from "./chunks/docx-zipper-C8lozSFd.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,20 +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
496
  class: "linked-style-buttons",
497
497
  "data-editor-ui-surface": ""
498
498
  };
499
499
  const _hoisted_2$8 = ["onClick", "onKeydown", "aria-label"];
500
- const _sfc_main$d = {
500
+ const _sfc_main$f = {
501
501
  __name: "LinkedStyle",
502
502
  props: {
503
503
  editor: {
@@ -551,7 +551,7 @@ const _sfc_main$d = {
551
551
  styleRefs.value[0].focus();
552
552
  });
553
553
  return (_ctx, _cache) => {
554
- return props.editor ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
554
+ return props.editor ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
555
555
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getQuickFormatList)(__props.editor), (style, index) => {
556
556
  return openBlock(), createElementBlock("div", {
557
557
  class: normalizeClass(["style-item", { selected: __props.selectedOption === style.id }]),
@@ -573,8 +573,8 @@ const _sfc_main$d = {
573
573
  };
574
574
  }
575
575
  };
576
- const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-ecb78965"]]);
577
- const _hoisted_1$b = {
576
+ const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-ecb78965"]]);
577
+ const _hoisted_1$c = {
578
578
  key: 0,
579
579
  class: "link-title"
580
580
  };
@@ -602,7 +602,7 @@ const _hoisted_13 = {
602
602
  key: 4,
603
603
  class: "input-row go-to-anchor clickable"
604
604
  };
605
- const _sfc_main$c = {
605
+ const _sfc_main$e = {
606
606
  __name: "LinkInput",
607
607
  props: {
608
608
  showInput: {
@@ -741,7 +741,7 @@ const _sfc_main$c = {
741
741
  return openBlock(), createElementBlock("div", {
742
742
  class: normalizeClass(["link-input-ctn", { "high-contrast": unref(isHighContrastMode) }])
743
743
  }, [
744
- 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")),
745
745
  __props.showInput && !isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
746
746
  createElementVNode("div", _hoisted_5$1, [
747
747
  _cache[4] || (_cache[4] = createElementVNode("div", { class: "input-icon text-input-icon" }, "T", -1)),
@@ -808,12 +808,12 @@ const _sfc_main$c = {
808
808
  };
809
809
  }
810
810
  };
811
- const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-ba50627b"]]);
812
- 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"];
813
813
  const _hoisted_2$6 = ["innerHTML"];
814
814
  const _hoisted_3$5 = ["innerHTML"];
815
815
  const ROW_SIZE$1 = 7;
816
- const _sfc_main$b = {
816
+ const _sfc_main$d = {
817
817
  __name: "IconGridRow",
818
818
  props: {
819
819
  icons: {
@@ -939,19 +939,19 @@ const _sfc_main$b = {
939
939
  innerHTML: unref(toolbarIcons).colorOptionCheck,
940
940
  style: normalizeStyle(getCheckStyle(option.value, optionIndex))
941
941
  }, null, 12, _hoisted_3$5)) : createCommentVNode("", true)
942
- ], 40, _hoisted_1$a);
942
+ ], 40, _hoisted_1$b);
943
943
  }), 128))
944
944
  ]);
945
945
  }), 128);
946
946
  };
947
947
  }
948
948
  };
949
- 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"]]);
950
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';
951
- const _hoisted_1$9 = { class: "options-grid-wrap" };
951
+ const _hoisted_1$a = { class: "options-grid-wrap" };
952
952
  const _hoisted_2$5 = ["innerHTML"];
953
953
  const _hoisted_3$4 = { class: "option-grid-ctn" };
954
- const _sfc_main$a = {
954
+ const _sfc_main$c = {
955
955
  __name: "IconGrid",
956
956
  props: {
957
957
  icons: {
@@ -978,7 +978,7 @@ const _sfc_main$a = {
978
978
  emit("select", option);
979
979
  };
980
980
  return (_ctx, _cache) => {
981
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
981
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
982
982
  __props.hasNoneIcon ? (openBlock(), createElementBlock("div", {
983
983
  key: 0,
984
984
  class: "none-option",
@@ -1011,7 +1011,7 @@ const _sfc_main$a = {
1011
1011
  };
1012
1012
  }
1013
1013
  };
1014
- 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"]]);
1015
1015
  const closeDropdown$1 = (dropdown) => {
1016
1016
  dropdown.expand.value = false;
1017
1017
  };
@@ -1120,10 +1120,10 @@ const icons = [
1120
1120
  const getAvailableColorOptions = () => {
1121
1121
  return icons.flat().map((item) => item.value);
1122
1122
  };
1123
- const _hoisted_1$8 = ["data-cols", "data-rows", "onKeydown", "onClick"];
1123
+ const _hoisted_1$9 = ["data-cols", "data-rows", "onKeydown", "onClick"];
1124
1124
  const _hoisted_2$4 = ["aria-valuetext"];
1125
1125
  const ROW_SIZE = 5;
1126
- const _sfc_main$9 = {
1126
+ const _sfc_main$b = {
1127
1127
  __name: "TableGrid",
1128
1128
  emits: ["select", "clickoutside"],
1129
1129
  setup(__props, { emit: __emit }) {
@@ -1239,7 +1239,7 @@ const _sfc_main$9 = {
1239
1239
  ref: tableGridItems,
1240
1240
  onKeydown: withModifiers((event) => handleKeyDown(event, n, i2), ["prevent"]),
1241
1241
  onClick: withModifiers(($event) => handleClick({ cols: n, rows: i2 }), ["stop", "prevent"])
1242
- }, null, 40, _hoisted_1$8);
1242
+ }, null, 40, _hoisted_1$9);
1243
1243
  }), 64))
1244
1244
  ], 64);
1245
1245
  }), 64))
@@ -1252,13 +1252,13 @@ const _sfc_main$9 = {
1252
1252
  };
1253
1253
  }
1254
1254
  };
1255
- const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-92e8d5fb"]]);
1256
- 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" };
1257
1257
  const _hoisted_2$3 = ["onClick", "data-item", "ariaLabel"];
1258
1258
  const _hoisted_3$3 = { class: "toolbar-table-actions__icon" };
1259
1259
  const _hoisted_4$1 = ["innerHTML"];
1260
1260
  const _hoisted_5 = { class: "toolbar-table-actions__label" };
1261
- const _sfc_main$8 = {
1261
+ const _sfc_main$a = {
1262
1262
  __name: "TableActions",
1263
1263
  props: {
1264
1264
  options: {
@@ -1272,7 +1272,7 @@ const _sfc_main$8 = {
1272
1272
  emit("select", { command: item.command });
1273
1273
  };
1274
1274
  return (_ctx, _cache) => {
1275
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
1275
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
1276
1276
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
1277
1277
  return openBlock(), createElementBlock("div", {
1278
1278
  class: normalizeClass(["toolbar-table-actions__item", { "toolbar-table-actions__item--border": option.bottomBorder }]),
@@ -1294,7 +1294,7 @@ const _sfc_main$8 = {
1294
1294
  };
1295
1295
  }
1296
1296
  };
1297
- 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"]]);
1298
1298
  function getScrollableParent(element) {
1299
1299
  let currentElement = element;
1300
1300
  while (currentElement) {
@@ -1318,10 +1318,10 @@ function scrollToElement(targetElement, options = { behavior: "smooth", block: "
1318
1318
  });
1319
1319
  }
1320
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';
1321
- const _hoisted_1$6 = { class: "search-input-ctn" };
1321
+ const _hoisted_1$7 = { class: "search-input-ctn" };
1322
1322
  const _hoisted_2$2 = { class: "row" };
1323
1323
  const _hoisted_3$2 = ["onKeydown"];
1324
- const _sfc_main$7 = {
1324
+ const _sfc_main$9 = {
1325
1325
  __name: "SearchInput",
1326
1326
  props: {
1327
1327
  searchRef: {
@@ -1336,7 +1336,7 @@ const _sfc_main$7 = {
1336
1336
  emit("submit", { value: searchValue.value });
1337
1337
  };
1338
1338
  return (_ctx, _cache) => {
1339
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
1339
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
1340
1340
  createElementVNode("div", _hoisted_2$2, [
1341
1341
  withDirectives(createElementVNode("input", {
1342
1342
  ref: __props.searchRef,
@@ -1360,7 +1360,7 @@ const _sfc_main$7 = {
1360
1360
  };
1361
1361
  }
1362
1362
  };
1363
- 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"]]);
1364
1364
  const TOOLBAR_FONTS = [
1365
1365
  {
1366
1366
  label: "Georgia",
@@ -4212,7 +4212,7 @@ function getItems(context, customItems = [], includeDefaultItems = true) {
4212
4212
  }).filter((section) => section.items.length > 0);
4213
4213
  return filteredSections;
4214
4214
  }
4215
- const _hoisted_1$5 = { class: "slash-menu-items" };
4215
+ const _hoisted_1$6 = { class: "slash-menu-items" };
4216
4216
  const _hoisted_2$1 = {
4217
4217
  key: 0,
4218
4218
  class: "slash-menu-divider",
@@ -4220,7 +4220,7 @@ const _hoisted_2$1 = {
4220
4220
  };
4221
4221
  const _hoisted_3$1 = ["onClick"];
4222
4222
  const _hoisted_4 = ["innerHTML"];
4223
- const _sfc_main$6 = {
4223
+ const _sfc_main$8 = {
4224
4224
  __name: "SlashMenu",
4225
4225
  props: {
4226
4226
  editor: {
@@ -4348,7 +4348,7 @@ const _sfc_main$6 = {
4348
4348
  customItemRefs.clear();
4349
4349
  };
4350
4350
  const handleGlobalKeyDown = (event) => {
4351
- if (event.key === "Escape") {
4351
+ if (event.key === "Escape" && isOpen.value) {
4352
4352
  event.preventDefault();
4353
4353
  event.stopPropagation();
4354
4354
  closeMenu();
@@ -4536,7 +4536,7 @@ const _sfc_main$6 = {
4536
4536
  }, null, 544), [
4537
4537
  [vModelText, searchQuery.value]
4538
4538
  ]),
4539
- createElementVNode("div", _hoisted_1$5, [
4539
+ createElementVNode("div", _hoisted_1$6, [
4540
4540
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredSections.value, (section, sectionIndex) => {
4541
4541
  return openBlock(), createElementBlock(Fragment, {
4542
4542
  key: section.id
@@ -4571,8 +4571,8 @@ const _sfc_main$6 = {
4571
4571
  };
4572
4572
  }
4573
4573
  };
4574
- const _hoisted_1$4 = ["accept"];
4575
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4574
+ const _hoisted_1$5 = ["accept"];
4575
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4576
4576
  __name: "BasicUpload",
4577
4577
  props: {
4578
4578
  accept: { default: ".docx, .pdf, .html, .md" }
@@ -4593,15 +4593,15 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4593
4593
  id: "fileInput",
4594
4594
  onChange: onFileChange,
4595
4595
  accept: __props.accept
4596
- }, null, 40, _hoisted_1$4)
4596
+ }, null, 40, _hoisted_1$5)
4597
4597
  ]);
4598
4598
  };
4599
4599
  }
4600
4600
  });
4601
- const _hoisted_1$3 = { class: "numbering" };
4601
+ const _hoisted_1$4 = { class: "numbering" };
4602
4602
  const MIN_WIDTH = 200;
4603
4603
  const alignment = "flex-end";
4604
- const _sfc_main$4 = {
4604
+ const _sfc_main$6 = {
4605
4605
  __name: "Ruler",
4606
4606
  props: {
4607
4607
  orientation: {
@@ -4786,7 +4786,7 @@ const _sfc_main$4 = {
4786
4786
  class: normalizeClass(unit.className),
4787
4787
  style: normalizeStyle(getStyle.value(unit))
4788
4788
  }, [
4789
- createElementVNode("div", _hoisted_1$3, toDisplayString(unit.numbering), 1),
4789
+ createElementVNode("div", _hoisted_1$4, toDisplayString(unit.numbering), 1),
4790
4790
  (openBlock(true), createElementBlock(Fragment, null, renderList(unit.elements, (half) => {
4791
4791
  return openBlock(), createElementBlock("div", {
4792
4792
  class: normalizeClass(half.className),
@@ -4806,8 +4806,8 @@ const _sfc_main$4 = {
4806
4806
  };
4807
4807
  }
4808
4808
  };
4809
- const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-79f9a944"]]);
4810
- const _sfc_main$3 = {
4809
+ const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-79f9a944"]]);
4810
+ const _sfc_main$5 = {
4811
4811
  __name: "GenericPopover",
4812
4812
  props: {
4813
4813
  editor: { type: Object, required: true },
@@ -4835,22 +4835,22 @@ const _sfc_main$3 = {
4835
4835
  () => props.visible,
4836
4836
  (val) => {
4837
4837
  if (val) {
4838
- document.addEventListener("mousedown", handleClickOutside);
4838
+ document.addEventListener("pointerdown", handleClickOutside);
4839
4839
  document.addEventListener("keydown", handleEscape);
4840
4840
  } else {
4841
- document.removeEventListener("mousedown", handleClickOutside);
4841
+ document.removeEventListener("pointerdown", handleClickOutside);
4842
4842
  document.removeEventListener("keydown", handleEscape);
4843
4843
  }
4844
4844
  }
4845
4845
  );
4846
4846
  onMounted(() => {
4847
4847
  if (props.visible) {
4848
- document.addEventListener("mousedown", handleClickOutside);
4848
+ document.addEventListener("pointerdown", handleClickOutside);
4849
4849
  document.addEventListener("keydown", handleEscape);
4850
4850
  }
4851
4851
  });
4852
4852
  onBeforeUnmount(() => {
4853
- document.removeEventListener("mousedown", handleClickOutside);
4853
+ document.removeEventListener("pointerdown", handleClickOutside);
4854
4854
  document.removeEventListener("keydown", handleEscape);
4855
4855
  });
4856
4856
  const derivedStyles = computed(() => ({
@@ -4865,7 +4865,7 @@ const _sfc_main$3 = {
4865
4865
  style: normalizeStyle(derivedStyles.value),
4866
4866
  ref_key: "popover",
4867
4867
  ref: popover,
4868
- onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
4868
+ onPointerdown: _cache[0] || (_cache[0] = withModifiers(() => {
4869
4869
  }, ["stop"])),
4870
4870
  onClick: _cache[1] || (_cache[1] = withModifiers(() => {
4871
4871
  }, ["stop"]))
@@ -4875,9 +4875,15 @@ const _sfc_main$3 = {
4875
4875
  };
4876
4876
  }
4877
4877
  };
4878
- const GenericPopover = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-cbddcc0f"]]);
4879
- const _hoisted_1$2 = ["data-boundary-index", "data-boundary-type", "onMousedown"];
4880
- const _sfc_main$2 = {
4878
+ const GenericPopover = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-157855b5"]]);
4879
+ const _hoisted_1$3 = ["data-boundary-index", "data-boundary-type", "onMousedown"];
4880
+ const RESIZE_HANDLE_WIDTH_PX = 9;
4881
+ const RESIZE_HANDLE_OFFSET_PX = 4;
4882
+ const DRAG_OVERLAY_EXTENSION_PX = 1e3;
4883
+ const MIN_DRAG_OVERLAY_WIDTH_PX = 2e3;
4884
+ const THROTTLE_INTERVAL_MS = 16;
4885
+ const MIN_RESIZE_DELTA_PX = 1;
4886
+ const _sfc_main$4 = {
4881
4887
  __name: "TableResizeOverlay",
4882
4888
  props: {
4883
4889
  /** Editor instance for dispatching transactions */
@@ -4900,26 +4906,73 @@ const _sfc_main$2 = {
4900
4906
  setup(__props, { emit: __emit }) {
4901
4907
  const props = __props;
4902
4908
  const emit = __emit;
4909
+ const overlayRect = ref(null);
4903
4910
  const tableMetadata = ref(null);
4904
4911
  const dragState = ref(null);
4905
4912
  const forcedCleanup = ref(false);
4913
+ let rafId = null;
4914
+ let isUnmounted = false;
4915
+ function startOverlayTracking() {
4916
+ if (rafId !== null) return;
4917
+ const step = () => {
4918
+ updateOverlayRect();
4919
+ rafId = requestAnimationFrame(step);
4920
+ };
4921
+ rafId = requestAnimationFrame(step);
4922
+ }
4923
+ function stopOverlayTracking() {
4924
+ if (rafId !== null) {
4925
+ cancelAnimationFrame(rafId);
4926
+ rafId = null;
4927
+ }
4928
+ }
4906
4929
  const overlayStyle = computed(() => {
4907
- if (!props.tableElement) return {};
4908
- const rect = props.tableElement.getBoundingClientRect();
4930
+ if (!overlayRect.value || !props.tableElement) return {};
4931
+ const rect = overlayRect.value;
4909
4932
  let overlayWidth = rect.width;
4910
4933
  if (dragState.value) {
4911
- overlayWidth = Math.max(rect.width + 1e3, 2e3);
4934
+ overlayWidth = Math.max(rect.width + DRAG_OVERLAY_EXTENSION_PX, MIN_DRAG_OVERLAY_WIDTH_PX);
4912
4935
  }
4913
4936
  return {
4914
4937
  position: "absolute",
4915
- left: `${props.tableElement.offsetLeft}px`,
4916
- top: `${props.tableElement.offsetTop}px`,
4938
+ left: `${rect.left}px`,
4939
+ top: `${rect.top}px`,
4917
4940
  width: `${overlayWidth}px`,
4918
4941
  height: `${rect.height}px`,
4919
4942
  pointerEvents: dragState.value ? "auto" : "none",
4920
4943
  zIndex: 10
4921
4944
  };
4922
4945
  });
4946
+ function updateOverlayRect() {
4947
+ if (!props.tableElement) {
4948
+ overlayRect.value = null;
4949
+ return;
4950
+ }
4951
+ const parent = props.tableElement.offsetParent;
4952
+ const tableRect = props.tableElement.getBoundingClientRect();
4953
+ if (tableRect.width === 0 || tableRect.height === 0) {
4954
+ overlayRect.value = null;
4955
+ return;
4956
+ }
4957
+ if (parent) {
4958
+ const parentRect = parent.getBoundingClientRect();
4959
+ const left = tableRect.left - parentRect.left + (parent.scrollLeft || 0);
4960
+ const top = tableRect.top - parentRect.top + (parent.scrollTop || 0);
4961
+ overlayRect.value = {
4962
+ left,
4963
+ top,
4964
+ width: tableRect.width,
4965
+ height: tableRect.height
4966
+ };
4967
+ } else {
4968
+ overlayRect.value = {
4969
+ left: props.tableElement.offsetLeft,
4970
+ top: props.tableElement.offsetTop,
4971
+ width: tableRect.width,
4972
+ height: tableRect.height
4973
+ };
4974
+ }
4975
+ }
4923
4976
  const resizableBoundaries = computed(() => {
4924
4977
  if (!tableMetadata.value?.columns) {
4925
4978
  return [];
@@ -4958,9 +5011,9 @@ const _sfc_main$2 = {
4958
5011
  if (!colSegments || colSegments.length === 0) {
4959
5012
  return [];
4960
5013
  }
4961
- return colSegments.map((seg) => ({
4962
- y: seg.y,
4963
- h: seg.h
5014
+ return colSegments.filter((seg) => seg && typeof seg === "object").map((seg) => ({
5015
+ y: typeof seg.y === "number" ? seg.y : 0,
5016
+ h: seg.h !== null && typeof seg.h === "number" ? seg.h : null
4964
5017
  }));
4965
5018
  }
4966
5019
  function getSegmentHandleStyle(boundary, segment) {
@@ -4968,16 +5021,16 @@ const _sfc_main$2 = {
4968
5021
  position: "absolute",
4969
5022
  left: `${boundary.x}px`,
4970
5023
  top: segment.y != null ? `${segment.y}px` : "0",
4971
- width: "9px",
5024
+ width: `${RESIZE_HANDLE_WIDTH_PX}px`,
4972
5025
  height: segment.h != null ? `${segment.h}px` : "100%",
4973
- transform: "translateX(-4px)",
5026
+ transform: `translateX(-${RESIZE_HANDLE_OFFSET_PX}px)`,
4974
5027
  cursor: "col-resize",
4975
5028
  pointerEvents: "auto"
4976
5029
  };
4977
5030
  }
4978
5031
  const guidelineStyle = computed(() => {
4979
5032
  if (!dragState.value || !tableMetadata.value) return { display: "none" };
4980
- const initialBoundary = resizableBoundaries.value[dragState.value.boundaryIndex];
5033
+ const initialBoundary = resizableBoundaries.value[dragState.value.resizableBoundaryIndex];
4981
5034
  if (!initialBoundary) return { display: "none" };
4982
5035
  const newX = initialBoundary.x + dragState.value.constrainedDelta;
4983
5036
  return {
@@ -5034,11 +5087,11 @@ const _sfc_main$2 = {
5034
5087
  });
5035
5088
  }
5036
5089
  }
5037
- function onHandleMouseDown(event, boundaryIndex) {
5090
+ function onHandleMouseDown(event, resizableBoundaryIndex) {
5038
5091
  event.preventDefault();
5039
5092
  event.stopPropagation();
5040
5093
  if (!tableMetadata.value?.columns) return;
5041
- const boundary = resizableBoundaries.value[boundaryIndex];
5094
+ const boundary = resizableBoundaries.value[resizableBoundaryIndex];
5042
5095
  if (!boundary) return;
5043
5096
  const columns = tableMetadata.value.columns;
5044
5097
  const isRightEdge = boundary.type === "right-edge";
@@ -5046,7 +5099,7 @@ const _sfc_main$2 = {
5046
5099
  const rightColumn = isRightEdge ? null : columns[boundary.index + 1];
5047
5100
  dragState.value = {
5048
5101
  columnIndex: boundary.index,
5049
- boundaryIndex,
5102
+ resizableBoundaryIndex,
5050
5103
  isRightEdge,
5051
5104
  initialX: event.clientX,
5052
5105
  initialWidths: columns.map((col) => col.w),
@@ -5060,15 +5113,28 @@ const _sfc_main$2 = {
5060
5113
  } : null,
5061
5114
  constrainedDelta: 0
5062
5115
  };
5116
+ if (!props.editor?.view?.dom) {
5117
+ emit("resize-error", { error: "Editor view not available" });
5118
+ dragState.value = null;
5119
+ return;
5120
+ }
5063
5121
  const pmView = props.editor.view.dom;
5064
5122
  pmView.style.pointerEvents = "none";
5065
- document.addEventListener("mousemove", onDocumentMouseMove);
5066
- document.addEventListener("mouseup", onDocumentMouseUp);
5067
- emit("resize-start", {
5068
- columnIndex: boundary.index,
5069
- isRightEdge,
5070
- initialWidths: dragState.value.initialWidths
5071
- });
5123
+ try {
5124
+ document.addEventListener("mousemove", onDocumentMouseMove);
5125
+ document.addEventListener("mouseup", onDocumentMouseUp);
5126
+ emit("resize-start", {
5127
+ columnIndex: boundary.index,
5128
+ isRightEdge,
5129
+ initialWidths: dragState.value.initialWidths
5130
+ });
5131
+ } catch (error) {
5132
+ document.removeEventListener("mousemove", onDocumentMouseMove);
5133
+ document.removeEventListener("mouseup", onDocumentMouseUp);
5134
+ pmView.style.pointerEvents = "auto";
5135
+ dragState.value = null;
5136
+ emit("resize-error", { error: error instanceof Error ? error.message : String(error) });
5137
+ }
5072
5138
  }
5073
5139
  function throttle(func, limit) {
5074
5140
  let inThrottle;
@@ -5093,7 +5159,7 @@ const _sfc_main$2 = {
5093
5159
  return { throttled, cancel };
5094
5160
  }
5095
5161
  const mouseMoveThrottle = throttle((event) => {
5096
- if (!dragState.value) return;
5162
+ if (isUnmounted || !dragState.value) return;
5097
5163
  const delta = event.clientX - dragState.value.initialX;
5098
5164
  const minDelta = -(dragState.value.leftColumn.width - dragState.value.leftColumn.minWidth);
5099
5165
  let maxDelta;
@@ -5119,7 +5185,7 @@ const _sfc_main$2 = {
5119
5185
  columnIndex: dragState.value.columnIndex,
5120
5186
  delta: constrainedDelta
5121
5187
  });
5122
- }, 16);
5188
+ }, THROTTLE_INTERVAL_MS);
5123
5189
  const onDocumentMouseMove = mouseMoveThrottle.throttled;
5124
5190
  function onDocumentMouseUp(event) {
5125
5191
  if (!dragState.value) return;
@@ -5134,13 +5200,11 @@ const _sfc_main$2 = {
5134
5200
  }
5135
5201
  document.removeEventListener("mousemove", onDocumentMouseMove);
5136
5202
  document.removeEventListener("mouseup", onDocumentMouseUp);
5137
- if (props.editor?.view) {
5203
+ if (props.editor?.view?.dom) {
5138
5204
  const pmView = props.editor.view.dom;
5139
- if (pmView && pmView.style) {
5140
- pmView.style.pointerEvents = "auto";
5141
- }
5205
+ pmView.style.pointerEvents = "auto";
5142
5206
  }
5143
- if (!forcedCleanup.value && Math.abs(finalDelta) > 1) {
5207
+ if (!forcedCleanup.value && Math.abs(finalDelta) > MIN_RESIZE_DELTA_PX) {
5144
5208
  dispatchResizeTransaction(columnIndex, newWidths);
5145
5209
  emit("resize-end", {
5146
5210
  columnIndex,
@@ -5203,7 +5267,14 @@ const _sfc_main$2 = {
5203
5267
  if (!pmElement) {
5204
5268
  return null;
5205
5269
  }
5206
- const pmStart = parseInt(pmElement.getAttribute("data-pm-start"), 10);
5270
+ const pmStartAttr = pmElement.getAttribute("data-pm-start");
5271
+ if (!pmStartAttr) {
5272
+ return null;
5273
+ }
5274
+ const pmStart = parseInt(pmStartAttr, 10);
5275
+ if (!Number.isFinite(pmStart)) {
5276
+ return null;
5277
+ }
5207
5278
  let tablePos = null;
5208
5279
  state.doc.descendants((node, pos) => {
5209
5280
  if (node.type.name === "table") {
@@ -5255,6 +5326,12 @@ const _sfc_main$2 = {
5255
5326
  () => props.tableElement,
5256
5327
  () => {
5257
5328
  parseTableMetadata();
5329
+ updateOverlayRect();
5330
+ if (props.visible && props.tableElement) {
5331
+ startOverlayTracking();
5332
+ } else if (!props.tableElement) {
5333
+ stopOverlayTracking();
5334
+ }
5258
5335
  },
5259
5336
  { immediate: true }
5260
5337
  );
@@ -5263,7 +5340,10 @@ const _sfc_main$2 = {
5263
5340
  (visible) => {
5264
5341
  if (visible) {
5265
5342
  parseTableMetadata();
5343
+ updateOverlayRect();
5344
+ startOverlayTracking();
5266
5345
  } else {
5346
+ stopOverlayTracking();
5267
5347
  if (dragState.value) {
5268
5348
  forcedCleanup.value = true;
5269
5349
  onDocumentMouseUp(new MouseEvent("mouseup"));
@@ -5272,8 +5352,15 @@ const _sfc_main$2 = {
5272
5352
  }
5273
5353
  }
5274
5354
  );
5355
+ onMounted(() => {
5356
+ window.addEventListener("scroll", updateOverlayRect, true);
5357
+ window.addEventListener("resize", updateOverlayRect);
5358
+ updateOverlayRect();
5359
+ });
5275
5360
  onBeforeUnmount(() => {
5361
+ isUnmounted = true;
5276
5362
  mouseMoveThrottle.cancel();
5363
+ stopOverlayTracking();
5277
5364
  if (dragState.value) {
5278
5365
  document.removeEventListener("mousemove", onDocumentMouseMove);
5279
5366
  document.removeEventListener("mouseup", onDocumentMouseUp);
@@ -5281,6 +5368,8 @@ const _sfc_main$2 = {
5281
5368
  props.editor.view.dom.style.pointerEvents = "auto";
5282
5369
  }
5283
5370
  }
5371
+ window.removeEventListener("scroll", updateOverlayRect, true);
5372
+ window.removeEventListener("resize", updateOverlayRect);
5284
5373
  });
5285
5374
  return (_ctx, _cache) => {
5286
5375
  return __props.visible && tableMetadata.value ? (openBlock(), createElementBlock("div", {
@@ -5290,22 +5379,22 @@ const _sfc_main$2 = {
5290
5379
  onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
5291
5380
  }, ["stop"]))
5292
5381
  }, [
5293
- (openBlock(true), createElementBlock(Fragment, null, renderList(resizableBoundaries.value, (boundary, boundaryIndex) => {
5382
+ (openBlock(true), createElementBlock(Fragment, null, renderList(resizableBoundaries.value, (boundary, resizableBoundaryIndex) => {
5294
5383
  return openBlock(), createElementBlock(Fragment, {
5295
- key: `boundary-${boundaryIndex}`
5384
+ key: `boundary-${resizableBoundaryIndex}`
5296
5385
  }, [
5297
5386
  (openBlock(true), createElementBlock(Fragment, null, renderList(getBoundarySegments(boundary), (segment, segmentIndex) => {
5298
5387
  return openBlock(), createElementBlock("div", {
5299
5388
  key: `handle-${boundary.type}-${boundary.index}-${segmentIndex}`,
5300
5389
  class: normalizeClass(["resize-handle", {
5301
- "resize-handle--active": dragState.value && dragState.value.boundaryIndex === boundaryIndex,
5390
+ "resize-handle--active": dragState.value && dragState.value.resizableBoundaryIndex === resizableBoundaryIndex,
5302
5391
  "resize-handle--edge": boundary.type === "right-edge"
5303
5392
  }]),
5304
- "data-boundary-index": boundaryIndex,
5393
+ "data-boundary-index": resizableBoundaryIndex,
5305
5394
  "data-boundary-type": boundary.type,
5306
5395
  style: normalizeStyle(getSegmentHandleStyle(boundary, segment)),
5307
- onMousedown: ($event) => onHandleMouseDown($event, boundaryIndex)
5308
- }, null, 46, _hoisted_1$2);
5396
+ onMousedown: ($event) => onHandleMouseDown($event, resizableBoundaryIndex)
5397
+ }, null, 46, _hoisted_1$3);
5309
5398
  }), 128))
5310
5399
  ], 64);
5311
5400
  }), 128)),
@@ -5318,7 +5407,514 @@ const _sfc_main$2 = {
5318
5407
  };
5319
5408
  }
5320
5409
  };
5321
- const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d4258885"]]);
5410
+ const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2fdf7836"]]);
5411
+ const _hoisted_1$2 = ["data-handle-position", "onMousedown"];
5412
+ const OVERLAY_EXPANSION_PX = 2e3;
5413
+ const RESIZE_HANDLE_SIZE_PX = 12;
5414
+ const MOUSE_MOVE_THROTTLE_MS = 16;
5415
+ const DIMENSION_CHANGE_THRESHOLD_PX = 1;
5416
+ const Z_INDEX_OVERLAY = 10;
5417
+ const Z_INDEX_HANDLE = 15;
5418
+ const Z_INDEX_GUIDELINE = 20;
5419
+ const _sfc_main$3 = {
5420
+ __name: "ImageResizeOverlay",
5421
+ props: {
5422
+ /** Editor instance for dispatching transactions */
5423
+ editor: {
5424
+ type: Object,
5425
+ required: true
5426
+ },
5427
+ /** Show or hide the overlay */
5428
+ visible: {
5429
+ type: Boolean,
5430
+ default: false
5431
+ },
5432
+ /** Image fragment element containing data-image-metadata */
5433
+ imageElement: {
5434
+ type: Object,
5435
+ default: null
5436
+ }
5437
+ },
5438
+ emits: ["resize-start", "resize-move", "resize-end", "resize-success", "resize-error"],
5439
+ setup(__props, { emit: __emit }) {
5440
+ useCssVars((_ctx) => ({
5441
+ "v1e81f81d": RESIZE_HANDLE_SIZE_PX + "px",
5442
+ "v12763124": Z_INDEX_HANDLE
5443
+ }));
5444
+ function isValidEditor(editor) {
5445
+ return editor && typeof editor === "object" && editor.view && typeof editor.view === "object" && editor.view.dom instanceof HTMLElement && editor.view.state && typeof editor.view.dispatch === "function";
5446
+ }
5447
+ const props = __props;
5448
+ const emit = __emit;
5449
+ const imageMetadata = ref(null);
5450
+ const dragState = ref(null);
5451
+ const forcedCleanup = ref(false);
5452
+ const overlayStyle = computed(() => {
5453
+ if (!props.imageElement || !props.imageElement.isConnected) return {};
5454
+ const imageRect = props.imageElement.getBoundingClientRect();
5455
+ const wrapper = props.imageElement.closest(".super-editor");
5456
+ if (!wrapper) {
5457
+ return {
5458
+ position: "absolute",
5459
+ left: `${props.imageElement.offsetLeft}px`,
5460
+ top: `${props.imageElement.offsetTop}px`,
5461
+ width: `${imageRect.width}px`,
5462
+ height: `${imageRect.height}px`,
5463
+ pointerEvents: dragState.value ? "auto" : "none",
5464
+ zIndex: Z_INDEX_OVERLAY
5465
+ };
5466
+ }
5467
+ const wrapperRect = wrapper.getBoundingClientRect();
5468
+ const scrollLeft = wrapper.scrollLeft || 0;
5469
+ const scrollTop = wrapper.scrollTop || 0;
5470
+ const relativeLeft = imageRect.left - wrapperRect.left + scrollLeft;
5471
+ const relativeTop = imageRect.top - wrapperRect.top + scrollTop;
5472
+ let overlayWidth = imageRect.width;
5473
+ let overlayHeight = imageRect.height;
5474
+ let offsetX = 0;
5475
+ let offsetY = 0;
5476
+ if (dragState.value) {
5477
+ const expansion = OVERLAY_EXPANSION_PX;
5478
+ overlayWidth = imageRect.width + expansion * 2;
5479
+ overlayHeight = imageRect.height + expansion * 2;
5480
+ offsetX = -expansion;
5481
+ offsetY = -expansion;
5482
+ }
5483
+ return {
5484
+ position: "absolute",
5485
+ left: `${relativeLeft + offsetX}px`,
5486
+ top: `${relativeTop + offsetY}px`,
5487
+ width: `${overlayWidth}px`,
5488
+ height: `${overlayHeight}px`,
5489
+ pointerEvents: dragState.value ? "auto" : "none",
5490
+ zIndex: Z_INDEX_OVERLAY
5491
+ };
5492
+ });
5493
+ const resizeHandles = computed(() => {
5494
+ if (!imageMetadata.value || !props.imageElement) {
5495
+ return [];
5496
+ }
5497
+ const rect = props.imageElement.getBoundingClientRect();
5498
+ const width = rect.width;
5499
+ const height = rect.height;
5500
+ const handleSize = RESIZE_HANDLE_SIZE_PX;
5501
+ const offset = handleSize / 2;
5502
+ const expansion = dragState.value ? OVERLAY_EXPANSION_PX : 0;
5503
+ return [
5504
+ {
5505
+ position: "nw",
5506
+ style: {
5507
+ left: `${expansion - offset}px`,
5508
+ top: `${expansion - offset}px`,
5509
+ cursor: "nwse-resize"
5510
+ }
5511
+ },
5512
+ {
5513
+ position: "ne",
5514
+ style: {
5515
+ left: `${expansion + width - offset}px`,
5516
+ top: `${expansion - offset}px`,
5517
+ cursor: "nesw-resize"
5518
+ }
5519
+ },
5520
+ {
5521
+ position: "sw",
5522
+ style: {
5523
+ left: `${expansion - offset}px`,
5524
+ top: `${expansion + height - offset}px`,
5525
+ cursor: "nesw-resize"
5526
+ }
5527
+ },
5528
+ {
5529
+ position: "se",
5530
+ style: {
5531
+ left: `${expansion + width - offset}px`,
5532
+ top: `${expansion + height - offset}px`,
5533
+ cursor: "nwse-resize"
5534
+ }
5535
+ }
5536
+ ];
5537
+ });
5538
+ const guidelineStyle = computed(() => {
5539
+ if (!dragState.value || !props.imageElement) {
5540
+ return { display: "none" };
5541
+ }
5542
+ const expansion = OVERLAY_EXPANSION_PX;
5543
+ return {
5544
+ position: "absolute",
5545
+ left: `${expansion}px`,
5546
+ top: `${expansion}px`,
5547
+ width: `${dragState.value.constrainedWidth}px`,
5548
+ height: `${dragState.value.constrainedHeight}px`,
5549
+ border: "2px solid #4A90E2",
5550
+ pointerEvents: "none",
5551
+ zIndex: Z_INDEX_GUIDELINE,
5552
+ boxSizing: "border-box"
5553
+ };
5554
+ });
5555
+ function parseImageMetadata() {
5556
+ if (!props.imageElement || !props.imageElement.isConnected) {
5557
+ imageMetadata.value = null;
5558
+ return;
5559
+ }
5560
+ try {
5561
+ const metadataAttr = props.imageElement.getAttribute("data-image-metadata");
5562
+ if (!metadataAttr) {
5563
+ imageMetadata.value = null;
5564
+ return;
5565
+ }
5566
+ const parsed = JSON.parse(metadataAttr);
5567
+ if (!parsed || typeof parsed !== "object") {
5568
+ imageMetadata.value = null;
5569
+ return;
5570
+ }
5571
+ const required = [
5572
+ "originalWidth",
5573
+ "originalHeight",
5574
+ "maxWidth",
5575
+ "maxHeight",
5576
+ "aspectRatio",
5577
+ "minWidth",
5578
+ "minHeight"
5579
+ ];
5580
+ for (const field of required) {
5581
+ if (!Number.isFinite(parsed[field]) || parsed[field] <= 0) {
5582
+ console.warn(`[ImageResizeOverlay] Invalid or missing metadata field: ${field}`);
5583
+ imageMetadata.value = null;
5584
+ return;
5585
+ }
5586
+ }
5587
+ imageMetadata.value = parsed;
5588
+ } catch (error) {
5589
+ imageMetadata.value = null;
5590
+ emit("resize-error", {
5591
+ error: error instanceof Error ? error.message : "Failed to parse image metadata",
5592
+ rawMetadata: props.imageElement?.getAttribute("data-image-metadata")
5593
+ });
5594
+ }
5595
+ }
5596
+ function onHandleMouseDown(event, handlePosition) {
5597
+ event.preventDefault();
5598
+ event.stopPropagation();
5599
+ if (!isValidEditor(props.editor) || !imageMetadata.value || !props.imageElement) return;
5600
+ const rect = props.imageElement.getBoundingClientRect();
5601
+ dragState.value = {
5602
+ handle: handlePosition,
5603
+ initialX: event.clientX,
5604
+ initialY: event.clientY,
5605
+ initialWidth: rect.width,
5606
+ initialHeight: rect.height,
5607
+ aspectRatio: imageMetadata.value.aspectRatio,
5608
+ constrainedWidth: rect.width,
5609
+ constrainedHeight: rect.height
5610
+ };
5611
+ const pmView = props.editor.view.dom;
5612
+ pmView.style.pointerEvents = "none";
5613
+ document.addEventListener("mousemove", onDocumentMouseMove);
5614
+ document.addEventListener("mouseup", onDocumentMouseUp);
5615
+ document.addEventListener("keydown", onEscapeKey);
5616
+ emit("resize-start", {
5617
+ blockId: props.imageElement.getAttribute("data-sd-block-id"),
5618
+ initialWidth: rect.width,
5619
+ initialHeight: rect.height
5620
+ });
5621
+ }
5622
+ function throttle(func, limit) {
5623
+ let inThrottle;
5624
+ let timeoutId = null;
5625
+ const throttled = function(...args) {
5626
+ if (!inThrottle) {
5627
+ func.apply(this, args);
5628
+ inThrottle = true;
5629
+ timeoutId = setTimeout(() => {
5630
+ inThrottle = false;
5631
+ timeoutId = null;
5632
+ }, limit);
5633
+ }
5634
+ };
5635
+ const cancel = () => {
5636
+ if (timeoutId !== null) {
5637
+ clearTimeout(timeoutId);
5638
+ timeoutId = null;
5639
+ inThrottle = false;
5640
+ }
5641
+ };
5642
+ return { throttled, cancel };
5643
+ }
5644
+ const mouseMoveThrottle = throttle((event) => {
5645
+ if (!dragState.value || !imageMetadata.value) return;
5646
+ let deltaX = event.clientX - dragState.value.initialX;
5647
+ let deltaY = event.clientY - dragState.value.initialY;
5648
+ const handle = dragState.value.handle;
5649
+ if (handle === "nw") {
5650
+ deltaX = -deltaX;
5651
+ deltaY = -deltaY;
5652
+ } else if (handle === "ne") {
5653
+ deltaY = -deltaY;
5654
+ } else if (handle === "sw") {
5655
+ deltaX = -deltaX;
5656
+ }
5657
+ const scaleX = (dragState.value.initialWidth + deltaX) / dragState.value.initialWidth;
5658
+ const scaleY = (dragState.value.initialHeight + deltaY) / dragState.value.initialHeight;
5659
+ const scale = Math.max(scaleX, scaleY);
5660
+ let newWidth = dragState.value.initialWidth * scale;
5661
+ let newHeight = dragState.value.initialHeight * scale;
5662
+ const minWidth = imageMetadata.value.minWidth;
5663
+ const minHeight = imageMetadata.value.minHeight;
5664
+ const maxWidth = imageMetadata.value.maxWidth;
5665
+ const maxHeight = imageMetadata.value.maxHeight;
5666
+ if (newWidth < minWidth) {
5667
+ newWidth = minWidth;
5668
+ newHeight = newWidth / dragState.value.aspectRatio;
5669
+ }
5670
+ if (newHeight < minHeight) {
5671
+ newHeight = minHeight;
5672
+ newWidth = newHeight * dragState.value.aspectRatio;
5673
+ }
5674
+ if (newWidth > maxWidth) {
5675
+ newWidth = maxWidth;
5676
+ newHeight = newWidth / dragState.value.aspectRatio;
5677
+ }
5678
+ if (newHeight > maxHeight) {
5679
+ newHeight = maxHeight;
5680
+ newWidth = newHeight * dragState.value.aspectRatio;
5681
+ }
5682
+ dragState.value.constrainedWidth = newWidth;
5683
+ dragState.value.constrainedHeight = newHeight;
5684
+ emit("resize-move", {
5685
+ blockId: props.imageElement.getAttribute("data-sd-block-id"),
5686
+ width: newWidth,
5687
+ height: newHeight
5688
+ });
5689
+ }, MOUSE_MOVE_THROTTLE_MS);
5690
+ const onDocumentMouseMove = mouseMoveThrottle.throttled;
5691
+ function onEscapeKey(event) {
5692
+ if (event.key === "Escape" && dragState.value) {
5693
+ forcedCleanup.value = true;
5694
+ onDocumentMouseUp(new MouseEvent("mouseup"));
5695
+ forcedCleanup.value = false;
5696
+ }
5697
+ }
5698
+ function onDocumentMouseUp(event) {
5699
+ if (!dragState.value) return;
5700
+ const finalWidth = dragState.value.constrainedWidth;
5701
+ const finalHeight = dragState.value.constrainedHeight;
5702
+ const blockId = props.imageElement?.getAttribute("data-sd-block-id");
5703
+ document.removeEventListener("mousemove", onDocumentMouseMove);
5704
+ document.removeEventListener("mouseup", onDocumentMouseUp);
5705
+ document.removeEventListener("keydown", onEscapeKey);
5706
+ if (props.editor?.view) {
5707
+ const pmView = props.editor.view.dom;
5708
+ if (pmView && pmView.style) {
5709
+ pmView.style.pointerEvents = "auto";
5710
+ }
5711
+ }
5712
+ const widthDelta = Math.abs(finalWidth - dragState.value.initialWidth);
5713
+ const heightDelta = Math.abs(finalHeight - dragState.value.initialHeight);
5714
+ if (!forcedCleanup.value && (widthDelta > DIMENSION_CHANGE_THRESHOLD_PX || heightDelta > DIMENSION_CHANGE_THRESHOLD_PX)) {
5715
+ dispatchResizeTransaction(blockId, finalWidth, finalHeight);
5716
+ emit("resize-end", {
5717
+ blockId,
5718
+ finalWidth,
5719
+ finalHeight
5720
+ });
5721
+ }
5722
+ dragState.value = null;
5723
+ }
5724
+ function dispatchResizeTransaction(blockId, newWidth, newHeight) {
5725
+ if (!isValidEditor(props.editor) || !props.imageElement) {
5726
+ return;
5727
+ }
5728
+ if (!Number.isFinite(newWidth) || !Number.isFinite(newHeight) || newWidth <= 0 || newHeight <= 0) {
5729
+ emit("resize-error", {
5730
+ blockId,
5731
+ error: "Invalid dimensions: width and height must be positive finite numbers"
5732
+ });
5733
+ return;
5734
+ }
5735
+ try {
5736
+ const { state, dispatch } = props.editor.view;
5737
+ const tr = state.tr;
5738
+ const pmStartAttr = props.imageElement.getAttribute("data-pm-start");
5739
+ if (!pmStartAttr) {
5740
+ emit("resize-error", {
5741
+ blockId,
5742
+ error: "Image position marker (data-pm-start) not found"
5743
+ });
5744
+ return;
5745
+ }
5746
+ const imagePos = parseInt(pmStartAttr, 10);
5747
+ if (!Number.isFinite(imagePos) || imagePos < 0) {
5748
+ emit("resize-error", {
5749
+ blockId,
5750
+ error: "Invalid image position marker"
5751
+ });
5752
+ return;
5753
+ }
5754
+ const imageNode = state.doc.nodeAt(imagePos);
5755
+ if (!imageNode || imageNode.type.name !== "image") {
5756
+ emit("resize-error", {
5757
+ blockId,
5758
+ error: "Invalid image node at position"
5759
+ });
5760
+ return;
5761
+ }
5762
+ const newAttrs = {
5763
+ ...imageNode.attrs,
5764
+ size: {
5765
+ width: Math.round(newWidth),
5766
+ height: Math.round(newHeight)
5767
+ }
5768
+ };
5769
+ tr.setNodeMarkup(imagePos, null, newAttrs);
5770
+ dispatch(tr);
5771
+ if (blockId && blockId.trim()) {
5772
+ measureCache.invalidate([blockId]);
5773
+ }
5774
+ emit("resize-success", { blockId, newWidth, newHeight });
5775
+ } catch (error) {
5776
+ emit("resize-error", {
5777
+ blockId,
5778
+ error: error instanceof Error ? error.message : String(error)
5779
+ });
5780
+ }
5781
+ }
5782
+ watch(
5783
+ () => props.imageElement,
5784
+ () => {
5785
+ parseImageMetadata();
5786
+ },
5787
+ { immediate: true }
5788
+ );
5789
+ watch(
5790
+ () => props.visible,
5791
+ (visible) => {
5792
+ if (visible) {
5793
+ parseImageMetadata();
5794
+ } else {
5795
+ if (dragState.value) {
5796
+ forcedCleanup.value = true;
5797
+ onDocumentMouseUp(new MouseEvent("mouseup"));
5798
+ forcedCleanup.value = false;
5799
+ }
5800
+ }
5801
+ }
5802
+ );
5803
+ onBeforeUnmount(() => {
5804
+ mouseMoveThrottle.cancel();
5805
+ if (dragState.value) {
5806
+ document.removeEventListener("mousemove", onDocumentMouseMove);
5807
+ document.removeEventListener("mouseup", onDocumentMouseUp);
5808
+ document.removeEventListener("keydown", onEscapeKey);
5809
+ if (props.editor?.view?.dom) {
5810
+ props.editor.view.dom.style.pointerEvents = "auto";
5811
+ }
5812
+ }
5813
+ });
5814
+ return (_ctx, _cache) => {
5815
+ return __props.visible && imageMetadata.value ? (openBlock(), createElementBlock("div", {
5816
+ key: 0,
5817
+ class: "superdoc-image-resize-overlay",
5818
+ style: normalizeStyle(overlayStyle.value),
5819
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
5820
+ }, ["stop"]))
5821
+ }, [
5822
+ (openBlock(true), createElementBlock(Fragment, null, renderList(resizeHandles.value, (handle) => {
5823
+ return openBlock(), createElementBlock("div", {
5824
+ key: handle.position,
5825
+ class: normalizeClass(["resize-handle", {
5826
+ "resize-handle--active": dragState.value && dragState.value.handle === handle.position,
5827
+ [`resize-handle--${handle.position}`]: true
5828
+ }]),
5829
+ style: normalizeStyle(handle.style),
5830
+ "data-handle-position": handle.position,
5831
+ onMousedown: ($event) => onHandleMouseDown($event, handle.position)
5832
+ }, null, 46, _hoisted_1$2);
5833
+ }), 128)),
5834
+ dragState.value ? (openBlock(), createElementBlock("div", {
5835
+ key: 0,
5836
+ class: "resize-guideline",
5837
+ style: normalizeStyle(guidelineStyle.value)
5838
+ }, null, 4)) : createCommentVNode("", true)
5839
+ ], 36)) : createCommentVNode("", true);
5840
+ };
5841
+ }
5842
+ };
5843
+ const ImageResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e66ec7bb"]]);
5844
+ const _sfc_main$2 = {
5845
+ __name: "LinkClickHandler",
5846
+ props: {
5847
+ editor: {
5848
+ type: Object,
5849
+ required: true
5850
+ },
5851
+ openPopover: {
5852
+ type: Function,
5853
+ required: true
5854
+ },
5855
+ closePopover: {
5856
+ type: Function,
5857
+ required: true
5858
+ },
5859
+ popoverVisible: {
5860
+ type: Boolean,
5861
+ default: false
5862
+ }
5863
+ },
5864
+ setup(__props) {
5865
+ const props = __props;
5866
+ const handleLinkClick = (event) => {
5867
+ if (props.popoverVisible) {
5868
+ props.closePopover();
5869
+ return;
5870
+ }
5871
+ if (!props.editor || !props.editor.state) {
5872
+ return;
5873
+ }
5874
+ const surface = getEditorSurfaceElement(props.editor);
5875
+ if (!surface) {
5876
+ return;
5877
+ }
5878
+ moveCursorToMouseEvent(event.detail, props.editor);
5879
+ setTimeout(() => {
5880
+ const currentState = props.editor.state;
5881
+ const hasLink = selectionHasNodeOrMark(currentState, "link", { requireEnds: true });
5882
+ if (hasLink) {
5883
+ const surfaceRect = surface.getBoundingClientRect();
5884
+ if (!surfaceRect) return;
5885
+ props.openPopover(
5886
+ markRaw(LinkInput),
5887
+ {
5888
+ showInput: true,
5889
+ editor: props.editor,
5890
+ closePopover: props.closePopover
5891
+ },
5892
+ {
5893
+ left: `${event.detail.clientX - surfaceRect.left}px`,
5894
+ top: `${event.detail.clientY - surfaceRect.top + 15}px`
5895
+ }
5896
+ );
5897
+ }
5898
+ }, 10);
5899
+ };
5900
+ let surfaceElement = null;
5901
+ onMounted(() => {
5902
+ if (!props.editor) return;
5903
+ surfaceElement = getEditorSurfaceElement(props.editor);
5904
+ if (surfaceElement) {
5905
+ surfaceElement.addEventListener("superdoc-link-click", handleLinkClick);
5906
+ }
5907
+ });
5908
+ onBeforeUnmount(() => {
5909
+ if (surfaceElement) {
5910
+ surfaceElement.removeEventListener("superdoc-link-click", handleLinkClick);
5911
+ }
5912
+ });
5913
+ return (_ctx, _cache) => {
5914
+ return null;
5915
+ };
5916
+ }
5917
+ };
5322
5918
  function adjustPaginationBreaks(editorElem, editor) {
5323
5919
  if (!editorElem.value || !editor?.value?.options?.scale || isHeadless(editor)) return;
5324
5920
  const zoom = editor.value.options.scale;
@@ -5407,6 +6003,11 @@ const _sfc_main$1 = {
5407
6003
  visible: false,
5408
6004
  tableElement: null
5409
6005
  });
6006
+ const imageResizeState = reactive({
6007
+ visible: false,
6008
+ imageElement: null,
6009
+ blockId: null
6010
+ });
5410
6011
  const updateTableResizeOverlay = (event) => {
5411
6012
  if (!editorElem.value) return;
5412
6013
  let target = event.target;
@@ -5428,6 +6029,38 @@ const _sfc_main$1 = {
5428
6029
  tableResizeState.visible = false;
5429
6030
  tableResizeState.tableElement = null;
5430
6031
  };
6032
+ const updateImageResizeOverlay = (event) => {
6033
+ if (!editorElem.value) return;
6034
+ let target = event.target;
6035
+ while (target && target !== document.body) {
6036
+ if (target.classList?.contains("superdoc-image-resize-overlay") || target.closest?.(".superdoc-image-resize-overlay")) {
6037
+ return;
6038
+ }
6039
+ if (target.classList?.contains("superdoc-image-fragment") && target.hasAttribute("data-image-metadata")) {
6040
+ imageResizeState.visible = true;
6041
+ imageResizeState.imageElement = target;
6042
+ imageResizeState.blockId = target.getAttribute("data-sd-block-id");
6043
+ return;
6044
+ }
6045
+ target = target.parentElement;
6046
+ }
6047
+ imageResizeState.visible = false;
6048
+ imageResizeState.imageElement = null;
6049
+ imageResizeState.blockId = null;
6050
+ };
6051
+ const hideImageResizeOverlay = () => {
6052
+ imageResizeState.visible = false;
6053
+ imageResizeState.imageElement = null;
6054
+ imageResizeState.blockId = null;
6055
+ };
6056
+ const handleOverlayUpdates = (event) => {
6057
+ updateTableResizeOverlay(event);
6058
+ updateImageResizeOverlay(event);
6059
+ };
6060
+ const handleOverlayHide = () => {
6061
+ hideTableResizeOverlay();
6062
+ hideImageResizeOverlay();
6063
+ };
5431
6064
  let dataPollTimeout;
5432
6065
  const stopPolling = () => {
5433
6066
  clearTimeout(dataPollTimeout);
@@ -5514,6 +6147,22 @@ const _sfc_main$1 = {
5514
6147
  const paginationTarget = editor.value?.editor ? { value: base } : editor;
5515
6148
  adjustPaginationBreaks(editorElem, paginationTarget);
5516
6149
  });
6150
+ if (editor.value instanceof PresentationEditor) {
6151
+ editor.value.on("layoutUpdated", () => {
6152
+ if (imageResizeState.visible && imageResizeState.blockId) {
6153
+ const newElement = editorElem.value?.querySelector(
6154
+ `.superdoc-image-fragment[data-sd-block-id="${imageResizeState.blockId}"]`
6155
+ );
6156
+ if (newElement) {
6157
+ imageResizeState.imageElement = newElement;
6158
+ } else {
6159
+ imageResizeState.visible = false;
6160
+ imageResizeState.imageElement = null;
6161
+ imageResizeState.blockId = null;
6162
+ }
6163
+ }
6164
+ });
6165
+ }
5517
6166
  editor.value.on("collaborationReady", () => {
5518
6167
  setTimeout(() => {
5519
6168
  editorReady.value = true;
@@ -5598,8 +6247,8 @@ const _sfc_main$1 = {
5598
6247
  onKeydown: handleSuperEditorKeydown,
5599
6248
  onClick: handleSuperEditorClick,
5600
6249
  onMousedown: handleMarginClick,
5601
- onMousemove: updateTableResizeOverlay,
5602
- onMouseleave: hideTableResizeOverlay
6250
+ onMousemove: handleOverlayUpdates,
6251
+ onMouseleave: handleOverlayHide
5603
6252
  }, [
5604
6253
  createElementVNode("div", {
5605
6254
  ref_key: "editorElem",
@@ -5607,19 +6256,32 @@ const _sfc_main$1 = {
5607
6256
  class: "editor-element super-editor__element",
5608
6257
  role: "presentation"
5609
6258
  }, null, 512),
5610
- !contextMenuDisabled.value && editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$6, {
6259
+ !contextMenuDisabled.value && editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$8, {
5611
6260
  key: 0,
5612
6261
  editor: activeEditor.value,
5613
6262
  popoverControls,
5614
6263
  openPopover,
5615
6264
  closePopover
5616
6265
  }, null, 8, ["editor", "popoverControls"])) : createCommentVNode("", true),
5617
- editorReady.value && activeEditor.value ? (openBlock(), createBlock(TableResizeOverlay, {
6266
+ editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$2, {
5618
6267
  key: 1,
5619
6268
  editor: activeEditor.value,
6269
+ openPopover,
6270
+ closePopover,
6271
+ popoverVisible: popoverControls.visible
6272
+ }, null, 8, ["editor", "popoverVisible"])) : createCommentVNode("", true),
6273
+ editorReady.value && activeEditor.value ? (openBlock(), createBlock(TableResizeOverlay, {
6274
+ key: 2,
6275
+ editor: activeEditor.value,
5620
6276
  visible: tableResizeState.visible,
5621
6277
  tableElement: tableResizeState.tableElement
5622
- }, null, 8, ["editor", "visible", "tableElement"])) : createCommentVNode("", true)
6278
+ }, null, 8, ["editor", "visible", "tableElement"])) : createCommentVNode("", true),
6279
+ editorReady.value && activeEditor.value ? (openBlock(), createBlock(ImageResizeOverlay, {
6280
+ key: 3,
6281
+ editor: activeEditor.value,
6282
+ visible: imageResizeState.visible,
6283
+ imageElement: imageResizeState.imageElement
6284
+ }, null, 8, ["editor", "visible", "imageElement"])) : createCommentVNode("", true)
5623
6285
  ], 544),
5624
6286
  !editorReady.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
5625
6287
  createElementVNode("div", _hoisted_3, [
@@ -5682,7 +6344,7 @@ const _sfc_main$1 = {
5682
6344
  };
5683
6345
  }
5684
6346
  };
5685
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-f1e98438"]]);
6347
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-08b32c3d"]]);
5686
6348
  const _hoisted_1 = ["innerHTML"];
5687
6349
  const _sfc_main = {
5688
6350
  __name: "SuperInput",
@@ -5774,98 +6436,6 @@ const _sfc_main = {
5774
6436
  }
5775
6437
  };
5776
6438
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
5777
- const additionalHandlers = Object.freeze({
5778
- "mc:AlternateContent": translator$1j,
5779
- "sd:pageReference": translator$1i,
5780
- "sd:tableOfContents": translator$1h,
5781
- "w:b": translator$1g,
5782
- "w:bCs": translator$1f,
5783
- "w:bidiVisual": translator$1e,
5784
- "w:bookmarkEnd": translator$1d,
5785
- "w:bookmarkStart": translator$1c,
5786
- "w:bottom": translator$1b,
5787
- "w:br": translator$1a,
5788
- "w:cantSplit": translator$19,
5789
- "w:caps": translator$18,
5790
- "w:cnfStyle": translator$17,
5791
- "w:color": translator$16,
5792
- "w:divId": translator$15,
5793
- "w:drawing": translator$14,
5794
- "w:end": translator$13,
5795
- "w:gridAfter": translator$12,
5796
- "w:gridBefore": translator$11,
5797
- "w:gridCol": translator$10,
5798
- "w:hidden": translator$$,
5799
- "w:highlight": translator$_,
5800
- "w:hyperlink": translator$Z,
5801
- "w:i": translator$Y,
5802
- "w:insideH": translator$X,
5803
- "w:insideV": translator$W,
5804
- "w:jc": translator$V,
5805
- "w:left": translator$U,
5806
- "w:p": translator$T,
5807
- "w:r": translator$S,
5808
- "w:rFonts": translator$R,
5809
- "w:rPr": translator$Q,
5810
- "w:rStyle": translator$P,
5811
- "w:right": translator$O,
5812
- "w:sdt": translator$N,
5813
- "w:shd": translator$M,
5814
- "w:start": translator$L,
5815
- "w:strike": translator$K,
5816
- "w:sz": translator$J,
5817
- "w:szCs": translator$I,
5818
- "w:tab": translator$H,
5819
- "w:tbl": translator$G,
5820
- "w:tblBorders": translator$F,
5821
- "w:tblCaption": translator$E,
5822
- "w:tblCellMar": translator$D,
5823
- "w:tblCellSpacing": translator$C,
5824
- "w:tblDescription": translator$B,
5825
- "w:tblGrid": translator$A,
5826
- "w:tblHeader": translator$z,
5827
- "w:tblInd": translator$y,
5828
- "w:tblLayout": translator$x,
5829
- "w:tblLook": translator$w,
5830
- "w:tblOverlap": translator$v,
5831
- "w:tblPr": translator$u,
5832
- "w:tblStyle": translator$t,
5833
- "w:tblStyleColBandSize": translator$s,
5834
- "w:tblStyleRowBandSize": translator$r,
5835
- "w:tblW": translator$q,
5836
- "w:tblpPr": translator$p,
5837
- "w:tc": translator$o,
5838
- "w:top": translator$n,
5839
- "w:tr": translator$m,
5840
- "w:trHeight": translator$l,
5841
- "w:trPr": translator$k,
5842
- "w:u": translator$j,
5843
- "w:wAfter": translator$i,
5844
- "w:wBefore": translator$h,
5845
- "wp:anchor": translator$g,
5846
- "wp:inline": translator$f,
5847
- "w:commentRangeStart": commentRangeStartTranslator,
5848
- "w:commentRangeEnd": commentRangeEndTranslator,
5849
- "w:vMerge": translator$e,
5850
- "w:gridSpan": translator$d,
5851
- "w:vAlign": translator$c,
5852
- "w:noWrap": translator$b,
5853
- "w:tcFitText": translator$a,
5854
- "w:tcW": translator$9,
5855
- "w:hideMark": translator$8,
5856
- "w:textDirection": translator$7,
5857
- "w:tl2br": translator$6,
5858
- "w:tr2bl": translator$5,
5859
- "w:header": translator$4,
5860
- "w:headers": translator$3,
5861
- "w:tcBorders": translator$2,
5862
- "w:tcMar": translator$1,
5863
- "w:tcPr": translator
5864
- });
5865
- const baseHandlers = {
5866
- ...additionalHandlers
5867
- };
5868
- const registeredHandlers = Object.freeze(baseHandlers);
5869
6439
  const Extensions = {
5870
6440
  Node,
5871
6441
  Attribute,
@@ -5880,14 +6450,14 @@ const Extensions = {
5880
6450
  export {
5881
6451
  AIWriter,
5882
6452
  z as AnnotatorHelpers,
5883
- _sfc_main$5 as BasicUpload,
6453
+ _sfc_main$7 as BasicUpload,
5884
6454
  F as CommentsPluginKey,
5885
6455
  D as DocxZipper,
5886
6456
  Editor,
5887
6457
  Extensions,
5888
6458
  PresentationEditor,
5889
6459
  B as SectionHelpers,
5890
- _sfc_main$6 as SlashMenu,
6460
+ _sfc_main$8 as SlashMenu,
5891
6461
  ac as SuperConverter,
5892
6462
  SuperEditor,
5893
6463
  SuperInput,
@@ -5902,6 +6472,6 @@ export {
5902
6472
  getRichTextExtensions,
5903
6473
  getStarterExtensions,
5904
6474
  a9 as helpers,
5905
- registeredHandlers,
6475
+ aQ as registeredHandlers,
5906
6476
  x as trackChangesHelpers
5907
6477
  };