superdoc 1.0.0-beta.16 → 1.0.0-beta.18

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 (31) hide show
  1. package/dist/chunks/{PdfViewer-ODeuH1gb.es.js → PdfViewer-CDEQktlZ.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-93eWvs8z.cjs → PdfViewer-CZgU5VTe.cjs} +1 -1
  3. package/dist/chunks/{index-RquHXtgI.cjs → index-CBFc2Hsa.cjs} +8 -4
  4. package/dist/chunks/{index-DexFffM7-Cbdy0Zy6.es.js → index-DpnfmQSg--uFI4inB.es.js} +1 -1
  5. package/dist/chunks/{index-DexFffM7-XZD_g6eY.cjs → index-DpnfmQSg-D54nF5iO.cjs} +1 -1
  6. package/dist/chunks/{index-DW5_UKLM.es.js → index-yYYhcBhg.es.js} +8 -4
  7. package/dist/chunks/{super-editor.es-Dg5uoFkw.es.js → super-editor.es-BNkRY9J-.es.js} +2518 -1261
  8. package/dist/chunks/{super-editor.es-BLKWkx5G.cjs → super-editor.es-BfPsU6H-.cjs} +2517 -1260
  9. package/dist/packages/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -1
  10. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
  11. package/dist/style.css +13 -13
  12. package/dist/super-editor/ai-writer.es.js +2 -2
  13. package/dist/super-editor/chunks/{converter-C_R_BK8X.js → converter-Cz21HA_9.js} +277 -48
  14. package/dist/super-editor/chunks/{docx-zipper-BvQAYmi1.js → docx-zipper-DiEfO4LE.js} +1 -1
  15. package/dist/super-editor/chunks/{editor-DFFvalb1.js → editor-DoxVe-iR.js} +2082 -1159
  16. package/dist/super-editor/chunks/{index-DexFffM7.js → index-DpnfmQSg.js} +1 -1
  17. package/dist/super-editor/chunks/{toolbar-DLPfegtw.js → toolbar-CKdQr5PG.js} +2 -2
  18. package/dist/super-editor/converter.es.js +1 -1
  19. package/dist/super-editor/docx-zipper.es.js +2 -2
  20. package/dist/super-editor/editor.es.js +3 -3
  21. package/dist/super-editor/file-zipper.es.js +1 -1
  22. package/dist/super-editor/style.css +13 -13
  23. package/dist/super-editor/super-editor.es.js +250 -80
  24. package/dist/super-editor/toolbar.es.js +2 -2
  25. package/dist/super-editor.cjs +3 -3
  26. package/dist/super-editor.es.js +1 -1
  27. package/dist/superdoc.cjs +2 -2
  28. package/dist/superdoc.es.js +2 -2
  29. package/dist/superdoc.umd.js +2516 -1255
  30. package/dist/superdoc.umd.js.map +1 -1
  31. package/package.json +1 -1
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _MARK_TOGGLE_NAMES, _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn, syncStickyMarksFromState_fn, restoreStickyMarksIfNeeded_fn, ensureStoredMarksForMarkToggle_fn;
12
- import { 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, P as PluginKey, a as Plugin } from "./chunks/converter-C_R_BK8X.js";
13
- import { ac, i, a9, aP } from "./chunks/converter-C_R_BK8X.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-DFFvalb1.js";
15
- import { z, F, B, T, w, C, x } from "./chunks/editor-DFFvalb1.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-Cz21HA_9.js";
13
+ import { ac, i, a9, aQ } from "./chunks/converter-Cz21HA_9.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-DoxVe-iR.js";
15
+ import { z, F, B, T, w, C, x } from "./chunks/editor-DoxVe-iR.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, defineComponent, reactive, onUnmounted, renderSlot, useCssVars, shallowRef, createBlock, 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-DLPfegtw.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-CKdQr5PG.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-BvQAYmi1.js";
19
+ import { D } from "./chunks/docx-zipper-DiEfO4LE.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -312,7 +312,7 @@ const useToolbarItem = (options) => {
312
312
  };
313
313
  };
314
314
  const _hoisted_1$f = ["onClick", "innerHTML", "aria-label", "onKeydown"];
315
- const _sfc_main$g = {
315
+ const _sfc_main$h = {
316
316
  __name: "AlignmentButtons",
317
317
  emits: ["select"],
318
318
  setup(__props, { emit: __emit }) {
@@ -403,14 +403,14 @@ const _sfc_main$g = {
403
403
  };
404
404
  }
405
405
  };
406
- const AlignmentButtons = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-d84f57b6"]]);
406
+ const AlignmentButtons = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-d84f57b6"]]);
407
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$f = {
413
+ const _sfc_main$g = {
414
414
  __name: "DocumentMode",
415
415
  props: {
416
416
  options: {
@@ -490,14 +490,14 @@ const _sfc_main$f = {
490
490
  };
491
491
  }
492
492
  };
493
- const DocumentMode = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-8730b752"]]);
493
+ const DocumentMode = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-8730b752"]]);
494
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$e = {
500
+ const _sfc_main$f = {
501
501
  __name: "LinkedStyle",
502
502
  props: {
503
503
  editor: {
@@ -573,7 +573,7 @@ const _sfc_main$e = {
573
573
  };
574
574
  }
575
575
  };
576
- const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-ecb78965"]]);
576
+ const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-ecb78965"]]);
577
577
  const _hoisted_1$c = {
578
578
  key: 0,
579
579
  class: "link-title"
@@ -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$d = {
605
+ const _sfc_main$e = {
606
606
  __name: "LinkInput",
607
607
  props: {
608
608
  showInput: {
@@ -808,12 +808,12 @@ const _sfc_main$d = {
808
808
  };
809
809
  }
810
810
  };
811
- const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-ba50627b"]]);
811
+ const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-ba50627b"]]);
812
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$c = {
816
+ const _sfc_main$d = {
817
817
  __name: "IconGridRow",
818
818
  props: {
819
819
  icons: {
@@ -946,12 +946,12 @@ const _sfc_main$c = {
946
946
  };
947
947
  }
948
948
  };
949
- const IconGridRow = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__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
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$b = {
954
+ const _sfc_main$c = {
955
955
  __name: "IconGrid",
956
956
  props: {
957
957
  icons: {
@@ -1011,7 +1011,7 @@ const _sfc_main$b = {
1011
1011
  };
1012
1012
  }
1013
1013
  };
1014
- const IconGrid = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__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
  };
@@ -1123,7 +1123,7 @@ const getAvailableColorOptions = () => {
1123
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$a = {
1126
+ const _sfc_main$b = {
1127
1127
  __name: "TableGrid",
1128
1128
  emits: ["select", "clickoutside"],
1129
1129
  setup(__props, { emit: __emit }) {
@@ -1252,13 +1252,13 @@ const _sfc_main$a = {
1252
1252
  };
1253
1253
  }
1254
1254
  };
1255
- const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-92e8d5fb"]]);
1255
+ const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-92e8d5fb"]]);
1256
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$9 = {
1261
+ const _sfc_main$a = {
1262
1262
  __name: "TableActions",
1263
1263
  props: {
1264
1264
  options: {
@@ -1294,7 +1294,7 @@ const _sfc_main$9 = {
1294
1294
  };
1295
1295
  }
1296
1296
  };
1297
- const TableActions = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__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) {
@@ -1321,7 +1321,7 @@ const checkIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 5
1321
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$8 = {
1324
+ const _sfc_main$9 = {
1325
1325
  __name: "SearchInput",
1326
1326
  props: {
1327
1327
  searchRef: {
@@ -1360,7 +1360,7 @@ const _sfc_main$8 = {
1360
1360
  };
1361
1361
  }
1362
1362
  };
1363
- const SearchInput = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__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",
@@ -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$7 = {
4223
+ const _sfc_main$8 = {
4224
4224
  __name: "SlashMenu",
4225
4225
  props: {
4226
4226
  editor: {
@@ -4572,7 +4572,7 @@ const _sfc_main$7 = {
4572
4572
  }
4573
4573
  };
4574
4574
  const _hoisted_1$5 = ["accept"];
4575
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4575
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4576
4576
  __name: "BasicUpload",
4577
4577
  props: {
4578
4578
  accept: { default: ".docx, .pdf, .html, .md" }
@@ -4601,7 +4601,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4601
4601
  const _hoisted_1$4 = { class: "numbering" };
4602
4602
  const MIN_WIDTH = 200;
4603
4603
  const alignment = "flex-end";
4604
- const _sfc_main$5 = {
4604
+ const _sfc_main$6 = {
4605
4605
  __name: "Ruler",
4606
4606
  props: {
4607
4607
  orientation: {
@@ -4806,8 +4806,8 @@ const _sfc_main$5 = {
4806
4806
  };
4807
4807
  }
4808
4808
  };
4809
- const Ruler = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-79f9a944"]]);
4810
- const _sfc_main$4 = {
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$4 = {
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$4 = {
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$4 = {
4875
4875
  };
4876
4876
  }
4877
4877
  };
4878
- const GenericPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-cbddcc0f"]]);
4878
+ const GenericPopover = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-157855b5"]]);
4879
4879
  const _hoisted_1$3 = ["data-boundary-index", "data-boundary-type", "onMousedown"];
4880
- const _sfc_main$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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$3 = {
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,21 +5379,21 @@ const _sfc_main$3 = {
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)
5396
+ onMousedown: ($event) => onHandleMouseDown($event, resizableBoundaryIndex)
5308
5397
  }, null, 46, _hoisted_1$3);
5309
5398
  }), 128))
5310
5399
  ], 64);
@@ -5318,7 +5407,7 @@ const _sfc_main$3 = {
5318
5407
  };
5319
5408
  }
5320
5409
  };
5321
- const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-3f4a506b"]]);
5410
+ const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2fdf7836"]]);
5322
5411
  const _hoisted_1$2 = ["data-handle-position", "onMousedown"];
5323
5412
  const OVERLAY_EXPANSION_PX = 2e3;
5324
5413
  const RESIZE_HANDLE_SIZE_PX = 12;
@@ -5327,7 +5416,7 @@ const DIMENSION_CHANGE_THRESHOLD_PX = 1;
5327
5416
  const Z_INDEX_OVERLAY = 10;
5328
5417
  const Z_INDEX_HANDLE = 15;
5329
5418
  const Z_INDEX_GUIDELINE = 20;
5330
- const _sfc_main$2 = {
5419
+ const _sfc_main$3 = {
5331
5420
  __name: "ImageResizeOverlay",
5332
5421
  props: {
5333
5422
  /** Editor instance for dispatching transactions */
@@ -5751,7 +5840,81 @@ const _sfc_main$2 = {
5751
5840
  };
5752
5841
  }
5753
5842
  };
5754
- const ImageResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-e66ec7bb"]]);
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
+ };
5755
5918
  function adjustPaginationBreaks(editorElem, editor) {
5756
5919
  if (!editorElem.value || !editor?.value?.options?.scale || isHeadless(editor)) return;
5757
5920
  const zoom = editor.value.options.scale;
@@ -6093,21 +6256,28 @@ const _sfc_main$1 = {
6093
6256
  class: "editor-element super-editor__element",
6094
6257
  role: "presentation"
6095
6258
  }, null, 512),
6096
- !contextMenuDisabled.value && editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$7, {
6259
+ !contextMenuDisabled.value && editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$8, {
6097
6260
  key: 0,
6098
6261
  editor: activeEditor.value,
6099
6262
  popoverControls,
6100
6263
  openPopover,
6101
6264
  closePopover
6102
6265
  }, null, 8, ["editor", "popoverControls"])) : createCommentVNode("", true),
6103
- editorReady.value && activeEditor.value ? (openBlock(), createBlock(TableResizeOverlay, {
6266
+ editorReady.value && activeEditor.value ? (openBlock(), createBlock(_sfc_main$2, {
6104
6267
  key: 1,
6105
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,
6106
6276
  visible: tableResizeState.visible,
6107
6277
  tableElement: tableResizeState.tableElement
6108
6278
  }, null, 8, ["editor", "visible", "tableElement"])) : createCommentVNode("", true),
6109
6279
  editorReady.value && activeEditor.value ? (openBlock(), createBlock(ImageResizeOverlay, {
6110
- key: 2,
6280
+ key: 3,
6111
6281
  editor: activeEditor.value,
6112
6282
  visible: imageResizeState.visible,
6113
6283
  imageElement: imageResizeState.imageElement
@@ -6174,7 +6344,7 @@ const _sfc_main$1 = {
6174
6344
  };
6175
6345
  }
6176
6346
  };
6177
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-a84087aa"]]);
6347
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-08b32c3d"]]);
6178
6348
  const _hoisted_1 = ["innerHTML"];
6179
6349
  const _sfc_main = {
6180
6350
  __name: "SuperInput",
@@ -6280,14 +6450,14 @@ const Extensions = {
6280
6450
  export {
6281
6451
  AIWriter,
6282
6452
  z as AnnotatorHelpers,
6283
- _sfc_main$6 as BasicUpload,
6453
+ _sfc_main$7 as BasicUpload,
6284
6454
  F as CommentsPluginKey,
6285
6455
  D as DocxZipper,
6286
6456
  Editor,
6287
6457
  Extensions,
6288
6458
  PresentationEditor,
6289
6459
  B as SectionHelpers,
6290
- _sfc_main$7 as SlashMenu,
6460
+ _sfc_main$8 as SlashMenu,
6291
6461
  ac as SuperConverter,
6292
6462
  SuperEditor,
6293
6463
  SuperInput,
@@ -6302,6 +6472,6 @@ export {
6302
6472
  getRichTextExtensions,
6303
6473
  getStarterExtensions,
6304
6474
  a9 as helpers,
6305
- aP as registeredHandlers,
6475
+ aQ as registeredHandlers,
6306
6476
  x as trackChangesHelpers
6307
6477
  };