@markweave/vue2 0.1.7 → 0.1.8

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.
package/dist/index.js CHANGED
@@ -1,55 +1,58 @@
1
1
  import { createMarkweaveEditorExtensions as e } from "markweave/internal/editor-core/create-editor-extensions";
2
- import { createMarkweaveAdapterMediaExtensions as t } from "markweave/internal/plugins/media/media-extension-factory";
3
- import { Editor as n, EditorContent as r, NodeViewWrapper as i, VueNodeViewRenderer as a } from "@tiptap/vue-2";
4
- import * as o from "vue";
5
- import { getMarkweaveEditorModeState as s, isMarkweaveEditorLiveEditable as c, normalizeMarkweaveEditorMode as l, setMarkweaveEditorModeState as u, subscribeToMarkweaveEditorMode as d } from "markweave/internal/core/editor-mode-state";
6
- import { getLocalizedSlashCommandSpecs as f, getMarkweaveMessages as p, normalizeMarkweaveLang as m } from "markweave/internal/i18n";
7
- import { openMarkweaveImagePreview as h } from "markweave/internal/plugins/media/image-preview";
8
- import { MarkweaveCoreImage as g, MarkweaveCoreVideo as _, attrsFromMarkweaveImageUploadResult as v, attrsFromMarkweaveVideoUploadResult as y, attrsFromMarkweaveVideoUrl as b, clampMarkweaveImageWidth as x, createMarkweaveImageUploadRequest as S, createMarkweaveVideoUploadRequest as C, downloadMarkweaveImage as w, markweaveVideoIframeAllow as T, normalizeMarkweaveCoreImageAlign as E, normalizeMarkweaveVideoEmbedUrl as ee, numberAttribute as D, stringAttribute as O } from "markweave/internal/plugins/media/core-media-nodes";
9
- import { detectUploadSource as k, getDirectUploadResult as A, resolveMarkweaveUploadResult as j } from "markweave/internal/plugins/slash-command/upload";
10
- import { BubbleMenu as M } from "@tiptap/vue-2/menus";
11
- import { isEditorComposing as te } from "markweave/internal/editor-core/composition-guard";
12
- import { createMarkweaveFrameScheduler as N } from "markweave/internal/editor-core/frame-scheduler";
13
- import { createMarkweaveEditorUpdatePayload as ne, getMarkweaveContentType as P, isEditorContentCurrent as re, isMarkweaveControlledContentEchoCurrent as F, normalizeMarkweaveContentFormat as I } from "markweave/internal/editor-core/editor-content";
14
- import { getCurrentFloatingToolbarBlockType as L, getFloatingToolbarHighlightColorOptions as R, getFloatingToolbarMoreActions as ie, getFloatingToolbarTextColorOptions as ae, getFloatingToolbarTurnIntoOptions as oe, runFloatingToolbarMoreAction as se, setFloatingToolbarTurnInto as ce } from "markweave/internal/editor-core/floating-toolbar-model";
15
- import { openMarkweaveReadonlyLinkFromEvent as le } from "markweave/internal/editor-core/readonly-link";
16
- import { createMarkweaveEditorRuntimeSnapshot as ue } from "markweave/internal/editor-core/runtime-snapshot";
17
- import { areEditorSelectionSnapshotsEquivalent as de, calculateFloatingToolbarPopoverPlacement as fe, createSelectionSnapshot as pe, markweaveRuntimeProjectionDelayMs as me, shouldShowFloatingToolbar as z } from "markweave/internal/editor-core/selection-state";
18
- import { normalizeMarkweaveTheme as he } from "markweave/internal/core/theme";
19
- import { createMarkweaveTocState as ge, emptyMarkweaveTocState as _e, getActiveMarkweaveTocId as ve, getMarkweaveTocItems as ye, getValidMarkweaveTocActiveId as be, normalizeMarkweaveInnerTocPlacement as xe, observeMarkweaveInnerTocContainerPosition as Se, scrollToMarkweaveTocItem as Ce } from "markweave/internal/core/toc-state";
20
- import { codeBlockCollapsePluginKey as we, copyActiveCodeBlock as Te, getActiveCodeBlockState as Ee, getCodeBlockCopyFeedbackSnapshot as De, markweaveCodeBlockBehavior as Oe, setCodeBlockCollapsedAtPosition as ke, setCodeBlockLanguageAtPosition as Ae, setCodeBlockMermaidPreviewModeAtPosition as je } from "markweave/internal/plugins/codeblock/codeblock-behavior";
21
- import { calculateCodeBlockLanguageMenuPosition as Me, clampFullscreenScale as Ne, codeBlockCopyFeedbackTimeoutMs as Pe, copyCodeBlockText as Fe, createCodeBlockOverlayPosition as Ie, createMermaidFullscreenViewerState as Le, createMermaidTabPosition as Re, focusCodeBlockTarget as ze, formatCodeBlockLanguageLabel as Be, formatFullscreenZoom as Ve, getActiveCodeBlockElement as He, getAnchoredRect as Ue, getCodeBlockLanguageItems as We, getCodeBlockPositionFromEventTarget as Ge, getCodeBlockStateAtPosition as Ke, getFrameElement as qe, getMermaidCodeBlockTargets as Je, getMermaidSvgMarkup as Ye, isCodeBlockTargetCollapsed as Xe, mergeStableMermaidTabPositions as Ze, mermaidFullscreenZoomStep as Qe, moveMermaidFullscreenViewer as $e } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
22
- import { normalizeMarkdownLinkHref as et } from "markweave/internal/plugins/markdown/markdown-input";
23
- import { applyMarkweaveMathLatex as tt, calculateMarkweaveMathPopoverPosition as nt, getMarkweaveMathAnchorRect as rt, getMarkweaveMathBlockIndex as it, getMarkweaveMathRenderedHtml as at, getMarkweaveMathTargetAtPos as ot, getMarkweaveMathTargetFromDomEvent as st, getMarkweaveMathTargetFromSelection as ct, renderMarkweaveMathPreview as lt, setMarkweaveMathEditingDomState as ut, setMarkweaveMathEditingDomStateInView as dt, setMarkweaveMathSelectionInView as ft } from "markweave/internal/plugins/math/math-ui-model";
24
- import { isMermaidInlinePreviewTransaction as pt, setMarkweaveMermaidTheme as mt, setMermaidInlinePreviewEditorMode as ht, setReadonlyMermaidPreviewMode as gt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
25
- import { getMermaidPreviewState as _t } from "markweave/internal/plugins/mermaid/mermaid-renderer";
26
- import { filterSlashCommands as vt, isExecutableSlashCommand as yt } from "markweave/internal/plugins/slash-command/command-spec";
27
- import { getSlashCommandKeyboardAction as bt } from "markweave/internal/plugins/slash-command/slash-keyboard";
28
- import { executeSlashCommand as xt, getNextSlashCommandState as St, getSlashCommandAnchoredMenuPosition as Ct, getSlashCommandContext as wt } from "markweave/internal/plugins/slash-command/slash-runtime";
29
- import { initialSlashCommandState as Tt, reduceSlashCommandState as Et } from "markweave/internal/plugins/slash-command/slash-state";
30
- import { setMarkweaveTableMenuAxisTarget as Dt } from "markweave/internal/plugins/table/table-clipboard";
31
- import { getFirstTableDebugSnapshot as Ot } from "markweave/internal/plugins/table/table-debug-snapshot";
32
- import { focusFirstTableBodyCell as kt } from "markweave/internal/plugins/table/table-focus-position";
33
- import { getTableFocusState as At } from "markweave/internal/plugins/table/table-focus-state";
34
- import { getTableSelectionOverlayState as jt, initialTableInteractionState as Mt, tableInteractionPluginKey as Nt } from "markweave/internal/plugins/table/table-interaction-layer";
35
- import { calculateAnchoredTableMenuPosition as Pt, calculateTableEdgeHandlePosition as Ft, canRunTableCommand as It, executeTableMenuCommand as Lt, formatTableCopyFeedback as Rt, getActiveTableElement as zt, getAvailableCellMenuCommandSpecs as Bt, getTableAxisTargetRect as Vt, getTableControlAxisSelectionModel as Ht, getTableEditWithAiRequest as Ut, getTableMenuItemGroup as Wt, getTableMenuItemLabel as Gt, getTableMenuItems as Kt, getTableSelectionTargetRect as qt, measureTableSelectionOverlay as Jt, selectTableAxisFromCell as Yt, tableCopyFeedbackTimeoutMs as Xt, tableMenuLabel as Zt } from "markweave/internal/plugins/table/table-ui-model";
2
+ import { getLocalizedSlashCommandSpecs as t, getMarkweaveMessages as n, normalizeMarkweaveLang as r } from "markweave/internal/i18n";
3
+ import { createMarkweaveAdapterMediaExtensions as i } from "markweave/internal/plugins/media/media-extension-factory";
4
+ import { Editor as a, EditorContent as o, NodeViewWrapper as s, VueNodeViewRenderer as c } from "@tiptap/vue-2";
5
+ import * as l from "vue";
6
+ import { getMarkweaveEditorModeState as u, isMarkweaveEditorLiveEditable as d, normalizeMarkweaveEditorMode as f, setMarkweaveEditorModeState as p, subscribeToMarkweaveEditorMode as m } from "markweave/internal/core/editor-mode-state";
7
+ import { MarkweaveLinkCard as h } from "markweave/internal/plugins/link-card/link-card-node";
8
+ import { openMarkweaveLinkCardComposer as g } from "markweave/internal/plugins/link-card/link-card-composer";
9
+ import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as v, replaceMarkweaveLinkCardWithLink as y } from "markweave/internal/plugins/link-card/link-card";
10
+ import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
11
+ import { MarkweaveCoreImage as x, MarkweaveCoreVideo as S, attrsFromMarkweaveImageUploadResult as C, attrsFromMarkweaveVideoUploadResult as w, attrsFromMarkweaveVideoUrl as T, clampMarkweaveImageWidth as E, createMarkweaveImageUploadRequest as ee, createMarkweaveVideoUploadRequest as D, downloadMarkweaveImage as O, markweaveVideoIframeAllow as k, normalizeMarkweaveCoreImageAlign as A, normalizeMarkweaveVideoEmbedUrl as j, numberAttribute as M, stringAttribute as N } from "markweave/internal/plugins/media/core-media-nodes";
12
+ import { detectUploadSource as P, getDirectUploadResult as te, resolveMarkweaveUploadResult as F } from "markweave/internal/plugins/slash-command/upload";
13
+ import { BubbleMenu as I } from "@tiptap/vue-2/menus";
14
+ import { isEditorComposing as L } from "markweave/internal/editor-core/composition-guard";
15
+ import { createMarkweaveFrameScheduler as R } from "markweave/internal/editor-core/frame-scheduler";
16
+ import { createMarkweaveEditorUpdatePayload as ne, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
17
+ import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as z, getFloatingToolbarTurnIntoOptions as ue, runFloatingToolbarMoreAction as de, setFloatingToolbarTurnInto as fe } from "markweave/internal/editor-core/floating-toolbar-model";
18
+ import { openMarkweaveReadonlyLinkFromEvent as pe } from "markweave/internal/editor-core/readonly-link";
19
+ import { createMarkweaveEditorRuntimeSnapshot as me } from "markweave/internal/editor-core/runtime-snapshot";
20
+ import { areEditorSelectionSnapshotsEquivalent as he, calculateFloatingToolbarPopoverPlacement as ge, createSelectionSnapshot as _e, markweaveRuntimeProjectionDelayMs as ve, shouldShowFloatingToolbar as ye } from "markweave/internal/editor-core/selection-state";
21
+ import { normalizeMarkweaveTheme as be } from "markweave/internal/core/theme";
22
+ import { createMarkweaveTocState as xe, emptyMarkweaveTocState as Se, getActiveMarkweaveTocId as Ce, getMarkweaveTocItems as we, getValidMarkweaveTocActiveId as Te, normalizeMarkweaveInnerTocPlacement as Ee, observeMarkweaveInnerTocContainerPosition as De, scrollToMarkweaveTocItem as Oe } from "markweave/internal/core/toc-state";
23
+ import { codeBlockCollapsePluginKey as ke, copyActiveCodeBlock as Ae, getActiveCodeBlockState as je, getCodeBlockCopyFeedbackSnapshot as Me, markweaveCodeBlockBehavior as Ne, setCodeBlockCollapsedAtPosition as Pe, setCodeBlockLanguageAtPosition as Fe, setCodeBlockMermaidPreviewModeAtPosition as Ie } from "markweave/internal/plugins/codeblock/codeblock-behavior";
24
+ import { calculateCodeBlockLanguageMenuPosition as Le, clampFullscreenScale as Re, codeBlockCopyFeedbackTimeoutMs as ze, copyCodeBlockText as Be, createCodeBlockOverlayPosition as Ve, createMermaidFullscreenViewerState as He, createMermaidTabPosition as Ue, focusCodeBlockTarget as We, formatCodeBlockLanguageLabel as Ge, formatFullscreenZoom as Ke, getActiveCodeBlockElement as qe, getAnchoredRect as Je, getCodeBlockLanguageItems as Ye, getCodeBlockPositionFromEventTarget as Xe, getCodeBlockStateAtPosition as Ze, getFrameElement as Qe, getMermaidCodeBlockTargets as $e, getMermaidSvgMarkup as et, isCodeBlockTargetCollapsed as tt, mergeStableMermaidTabPositions as nt, mermaidFullscreenZoomStep as rt, moveMermaidFullscreenViewer as it } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
25
+ import { normalizeMarkdownLinkHref as at } from "markweave/internal/plugins/markdown/markdown-input";
26
+ import { applyMarkweaveMathLatex as ot, calculateMarkweaveMathPopoverPosition as st, getMarkweaveMathAnchorRect as ct, getMarkweaveMathBlockIndex as lt, getMarkweaveMathRenderedHtml as ut, getMarkweaveMathTargetAtPos as dt, getMarkweaveMathTargetFromDomEvent as ft, getMarkweaveMathTargetFromSelection as pt, renderMarkweaveMathPreview as mt, setMarkweaveMathEditingDomState as ht, setMarkweaveMathEditingDomStateInView as gt, setMarkweaveMathSelectionInView as _t } from "markweave/internal/plugins/math/math-ui-model";
27
+ import { isMermaidInlinePreviewTransaction as vt, setMarkweaveMermaidTheme as yt, setMermaidInlinePreviewEditorMode as bt, setReadonlyMermaidPreviewMode as xt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
28
+ import { getMermaidPreviewState as St } from "markweave/internal/plugins/mermaid/mermaid-renderer";
29
+ import { filterSlashCommands as Ct, isExecutableSlashCommand as wt } from "markweave/internal/plugins/slash-command/command-spec";
30
+ import { getSlashCommandKeyboardAction as Tt } from "markweave/internal/plugins/slash-command/slash-keyboard";
31
+ import { executeSlashCommand as Et, getNextSlashCommandState as Dt, getSlashCommandAnchoredMenuPosition as Ot, getSlashCommandContext as kt } from "markweave/internal/plugins/slash-command/slash-runtime";
32
+ import { initialSlashCommandState as At, reduceSlashCommandState as jt } from "markweave/internal/plugins/slash-command/slash-state";
33
+ import { setMarkweaveTableMenuAxisTarget as Mt } from "markweave/internal/plugins/table/table-clipboard";
34
+ import { getFirstTableDebugSnapshot as Nt } from "markweave/internal/plugins/table/table-debug-snapshot";
35
+ import { focusFirstTableBodyCell as Pt } from "markweave/internal/plugins/table/table-focus-position";
36
+ import { getTableFocusState as Ft } from "markweave/internal/plugins/table/table-focus-state";
37
+ import { getTableSelectionOverlayState as It, initialTableInteractionState as Lt, tableInteractionPluginKey as Rt } from "markweave/internal/plugins/table/table-interaction-layer";
38
+ import { calculateAnchoredTableMenuPosition as zt, calculateTableEdgeHandlePosition as Bt, canRunTableCommand as Vt, executeTableMenuCommand as Ht, formatTableCopyFeedback as Ut, getActiveTableElement as Wt, getAvailableCellMenuCommandSpecs as Gt, getTableAxisTargetRect as Kt, getTableControlAxisSelectionModel as qt, getTableEditWithAiRequest as Jt, getTableMenuItemGroup as Yt, getTableMenuItemLabel as Xt, getTableMenuItems as Zt, getTableSelectionTargetRect as Qt, measureTableSelectionOverlay as $t, selectTableAxisFromCell as en, tableCopyFeedbackTimeoutMs as tn, tableMenuLabel as nn } from "markweave/internal/plugins/table/table-ui-model";
36
39
  //#region src/vue2-compat.ts
37
- var Qt = o.default ?? o, $t = null, en = null, tn = null;
38
- function nn(e) {
40
+ var rn = l.default ?? l, an = null, on = null, sn = null;
41
+ function cn(e) {
39
42
  return !!(e && typeof e == "object" && "value" in e);
40
43
  }
41
- function rn(e) {
44
+ function ln(e) {
42
45
  let t = e.slice(2);
43
46
  return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
44
47
  }
45
- function an(e) {
48
+ function un(e) {
46
49
  let t = {}, n = {}, r = {}, i = {}, a = {};
47
50
  for (let [o, s] of Object.entries(e)) if (s !== void 0) {
48
51
  if (o === "class" || o === "style" || o === "key") {
49
52
  t[o] = s;
50
53
  continue;
51
54
  }
52
- if (o === "ref" && nn(s)) {
55
+ if (o === "ref" && cn(s)) {
53
56
  a.insert = (e) => {
54
57
  s.value = e.elm;
55
58
  }, a.destroy = () => {
@@ -58,7 +61,7 @@ function an(e) {
58
61
  continue;
59
62
  }
60
63
  if (/^on[A-Z]/.test(o)) {
61
- i[rn(o)] = s;
64
+ i[ln(o)] = s;
62
65
  continue;
63
66
  }
64
67
  if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
@@ -69,14 +72,14 @@ function an(e) {
69
72
  }
70
73
  return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
71
74
  }
72
- function on(e) {
75
+ function dn(e) {
73
76
  let t = {}, n = {}, r = {}, i = {};
74
77
  for (let [a, o] of Object.entries(e)) if (o !== void 0) {
75
78
  if (a === "class" || a === "style" || a === "key") {
76
79
  t[a] = o;
77
80
  continue;
78
81
  }
79
- if (a === "ref" && nn(o)) {
82
+ if (a === "ref" && cn(o)) {
80
83
  i.insert = (e) => {
81
84
  o.value = e.componentInstance ?? e.elm;
82
85
  }, i.destroy = () => {
@@ -92,25 +95,25 @@ function on(e) {
92
95
  }
93
96
  return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
94
97
  }
95
- function sn(e) {
98
+ function fn(e) {
96
99
  return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
97
100
  }
98
- function cn(e) {
101
+ function pn(e) {
99
102
  return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
100
103
  }
101
- function ln(e) {
104
+ function mn(e) {
102
105
  return e == null || Array.isArray(e) ? e : [e];
103
106
  }
104
- function un(e) {
105
- return typeof e == "function" ? ln(e()) : sn(e) ? ln(e.default()) : cn(e) ? [e] : e;
107
+ function hn(e) {
108
+ return typeof e == "function" ? mn(e()) : fn(e) ? mn(e.default()) : pn(e) ? [e] : e;
106
109
  }
107
110
  function B(e, t, n) {
108
- if (!tn) throw Error("Vue 2 render context is not available.");
109
- let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? an(r) : on(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : un(n);
110
- return tn(e, i, a);
111
+ if (!sn) throw Error("Vue 2 render context is not available.");
112
+ let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? un(r) : dn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : hn(n);
113
+ return sn(e, i, a);
111
114
  }
112
115
  function V(e) {
113
- return Qt.observable({ value: e });
116
+ return rn.observable({ value: e });
114
117
  }
115
118
  var H = V;
116
119
  function U(e) {
@@ -120,19 +123,19 @@ function U(e) {
120
123
  }
121
124
  function W(e, t, n) {
122
125
  let r = typeof e == "function" ? e : () => e.value;
123
- return $t?.$watch ? $t.$watch(r, t, n) : () => void 0;
126
+ return an?.$watch ? an.$watch(r, t, n) : () => void 0;
124
127
  }
125
128
  function G(e) {
126
- en?.mounted.push(e);
129
+ on?.mounted.push(e);
127
130
  }
128
131
  function K(e) {
129
- en?.beforeUnmount.push(e);
132
+ on?.beforeUnmount.push(e);
130
133
  }
131
134
  function q(e) {
132
- return Qt.nextTick(e);
135
+ return rn.nextTick(e);
133
136
  }
134
137
  function J(e) {
135
- return Qt.extend({
138
+ return rn.extend({
136
139
  name: e.name,
137
140
  props: e.props,
138
141
  created() {
@@ -140,12 +143,12 @@ function J(e) {
140
143
  mounted: [],
141
144
  beforeUnmount: []
142
145
  };
143
- $t = this, en = t;
146
+ an = this, on = t;
144
147
  try {
145
148
  let n = e.setup?.(this.$props ?? this) ?? null;
146
149
  this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
147
150
  } finally {
148
- $t = null, en = null;
151
+ an = null, on = null;
149
152
  }
150
153
  },
151
154
  mounted() {
@@ -155,19 +158,19 @@ function J(e) {
155
158
  this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
156
159
  },
157
160
  render(t) {
158
- tn = t;
161
+ sn = t;
159
162
  try {
160
163
  let n = this.__markweaveVue2Render;
161
164
  return n ? n() : e.render?.(t) ?? null;
162
165
  } finally {
163
- tn = null;
166
+ sn = null;
164
167
  }
165
168
  }
166
169
  });
167
170
  }
168
171
  //#endregion
169
172
  //#region src/vue2-icons.ts
170
- var dn = {
173
+ var gn = {
171
174
  AlignCenter: {
172
175
  iconName: "text-align-center",
173
176
  node: [
@@ -1032,7 +1035,7 @@ var dn = {
1032
1035
  }]]
1033
1036
  }
1034
1037
  };
1035
- function fn(e) {
1038
+ function _n(e) {
1036
1039
  return e.map(([e, t]) => B(e, t));
1037
1040
  }
1038
1041
  function Y(e) {
@@ -1053,7 +1056,7 @@ function Y(e) {
1053
1056
  }
1054
1057
  },
1055
1058
  setup(t) {
1056
- let n = dn[e];
1059
+ let n = gn[e];
1057
1060
  return () => B("svg", {
1058
1061
  class: `lucide lucide-${n.iconName}`,
1059
1062
  viewBox: "0 0 24 24",
@@ -1066,14 +1069,12 @@ function Y(e) {
1066
1069
  "stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
1067
1070
  "aria-hidden": "true",
1068
1071
  focusable: "false"
1069
- }, fn(n.node));
1072
+ }, _n(n.node));
1070
1073
  }
1071
1074
  });
1072
1075
  }
1073
- var pn = Y("AlignCenter"), mn = Y("AlignJustify"), hn = Y("AlignLeft"), gn = Y("AlignRight"), _n = Y("AlertTriangle"), vn = Y("Bold"), yn = Y("Braces"), bn = Y("Captions"), xn = Y("CheckCircle2"), Sn = Y("ChevronDown"), Cn = Y("ChevronUp"), wn = Y("CircleX"), Tn = Y("Code2"), En = Y("CornerDownLeft"), Dn = Y("Download"), On = Y("Eye"), kn = Y("ExternalLink"), An = Y("Heading1"), jn = Y("Heading2"), Mn = Y("Heading3"), Nn = Y("Image"), Pn = Y("ImageUp"), Fn = Y("IndentDecrease"), In = Y("IndentIncrease"), Ln = Y("Info"), Rn = Y("Italic"), zn = Y("Lightbulb"), Bn = Y("Link2"), Vn = Y("List"), Hn = Y("ListChecks"), Un = Y("ListOrdered"), Wn = Y("Minus"), Gn = Y("MoreVertical"), Kn = Y("Paperclip");
1074
- Y("PencilLine");
1075
- var qn = Y("Quote"), Jn = Y("Replace"), Yn = Y("Sigma"), Xn = Y("SmilePlus"), Zn = Y("Strikethrough"), Qn = Y("Subscript"), $n = Y("Superscript"), er = Y("Table2"), tr = Y("Text"), nr = Y("Trash2"), rr = Y("Type"), ir = Y("Underline"), ar = Y("Upload"), or = Y("Video"), sr = E;
1076
- function cr(e) {
1076
+ var vn = Y("AlignCenter"), yn = Y("AlignJustify"), bn = Y("AlignLeft"), xn = Y("AlignRight"), Sn = Y("AlertTriangle"), Cn = Y("Bold"), wn = Y("Braces"), Tn = Y("Captions"), En = Y("CheckCircle2"), Dn = Y("ChevronDown"), On = Y("ChevronUp"), kn = Y("CircleX"), An = Y("Code2"), jn = Y("CornerDownLeft"), Mn = Y("Download"), Nn = Y("Eye"), Pn = Y("ExternalLink"), Fn = Y("Heading1"), In = Y("Heading2"), Ln = Y("Heading3"), Rn = Y("Image"), zn = Y("ImageUp"), Bn = Y("IndentDecrease"), Vn = Y("IndentIncrease"), Hn = Y("Info"), Un = Y("Italic"), Wn = Y("Lightbulb"), Gn = Y("Link2"), Kn = Y("List"), qn = Y("ListChecks"), Jn = Y("ListOrdered"), Yn = Y("Minus"), Xn = Y("MoreVertical"), Zn = Y("Paperclip"), Qn = Y("PencilLine"), $n = Y("Quote"), er = Y("Replace"), tr = Y("Sigma"), nr = Y("SmilePlus"), rr = Y("Strikethrough"), ir = Y("Subscript"), ar = Y("Superscript"), or = Y("Table2"), sr = Y("Text"), cr = Y("Trash2"), lr = Y("Type"), ur = Y("Underline"), dr = Y("Upload"), fr = Y("Video"), pr = A;
1077
+ function mr(e) {
1077
1078
  let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
1078
1079
  let n = t?.getAttribute("data-markweave-mode");
1079
1080
  return n === "view" ? {
@@ -1082,8 +1083,8 @@ function cr(e) {
1082
1083
  } : n === "live" ? {
1083
1084
  mode: "live",
1084
1085
  editable: e.isEditable
1085
- } : s(e);
1086
- }, r = V(n()), i = d(e, () => {
1086
+ } : u(e);
1087
+ }, r = V(n()), i = m(e, () => {
1087
1088
  r.value = n();
1088
1089
  }), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
1089
1090
  r.value = n();
@@ -1095,13 +1096,16 @@ function cr(e) {
1095
1096
  i(), a?.disconnect();
1096
1097
  }), r;
1097
1098
  }
1098
- function lr(e) {
1099
+ function hr(e) {
1099
1100
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
1100
1101
  }
1101
- function ur(e) {
1102
+ function gr(e) {
1102
1103
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
1103
1104
  }
1104
- function dr(e, t) {
1105
+ function _r(e) {
1106
+ return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
1107
+ }
1108
+ function vr(e, t) {
1105
1109
  return B(e, {
1106
1110
  size: 18,
1107
1111
  strokeWidth: 1.8,
@@ -1117,12 +1121,12 @@ function X(e) {
1117
1121
  "data-active": e.active ? "true" : "false",
1118
1122
  onMousedown: (e) => e.preventDefault(),
1119
1123
  onClick: e.onClick
1120
- }, [dr(e.icon, e.label), B("span", {
1124
+ }, [vr(e.icon, e.label), B("span", {
1121
1125
  class: "markweave-image-tooltip",
1122
1126
  role: "tooltip"
1123
1127
  }, e.label)]);
1124
1128
  }
1125
- function fr(e) {
1129
+ function yr(e) {
1126
1130
  let t = V(null), n = e.messages.image;
1127
1131
  return B("section", {
1128
1132
  class: "markweave-image-upload-placeholder",
@@ -1156,7 +1160,7 @@ function fr(e) {
1156
1160
  B("div", {
1157
1161
  class: "markweave-image-upload-icon",
1158
1162
  "aria-hidden": "true"
1159
- }, [B(Pn, {
1163
+ }, [B(zn, {
1160
1164
  size: 46,
1161
1165
  strokeWidth: 1.6
1162
1166
  })]),
@@ -1181,7 +1185,7 @@ function fr(e) {
1181
1185
  "data-testid": "markweave-image-upload-submit",
1182
1186
  disabled: e.isSubmitting || !e.inputValue.trim(),
1183
1187
  onClick: e.onSubmit
1184
- }, [B(Pn, {
1188
+ }, [B(zn, {
1185
1189
  size: 16,
1186
1190
  strokeWidth: 1.8
1187
1191
  }), e.messages.common.insert]),
@@ -1197,7 +1201,7 @@ function fr(e) {
1197
1201
  }, e.error) : null
1198
1202
  ]);
1199
1203
  }
1200
- function pr(e) {
1204
+ function br(e) {
1201
1205
  let t = V(null), n = e.messages.video;
1202
1206
  return B("section", {
1203
1207
  class: "markweave-video-upload-placeholder",
@@ -1231,7 +1235,7 @@ function pr(e) {
1231
1235
  B("div", {
1232
1236
  class: "markweave-video-upload-icon",
1233
1237
  "aria-hidden": "true"
1234
- }, [B(or, {
1238
+ }, [B(fr, {
1235
1239
  size: 46,
1236
1240
  strokeWidth: 1.6
1237
1241
  })]),
@@ -1256,7 +1260,7 @@ function pr(e) {
1256
1260
  "data-testid": "markweave-video-upload-submit",
1257
1261
  disabled: e.isSubmitting || !e.inputValue.trim(),
1258
1262
  onClick: e.onSubmit
1259
- }, [B(ar, {
1263
+ }, [B(dr, {
1260
1264
  size: 16,
1261
1265
  strokeWidth: 1.8
1262
1266
  }), e.messages.common.insert]),
@@ -1272,7 +1276,7 @@ function pr(e) {
1272
1276
  }, e.error) : null
1273
1277
  ]);
1274
1278
  }
1275
- var mr = J({
1279
+ var xr = J({
1276
1280
  name: "MarkweaveVueImageNodeView",
1277
1281
  props: {
1278
1282
  editor: {
@@ -1305,137 +1309,137 @@ var mr = J({
1305
1309
  }
1306
1310
  },
1307
1311
  setup(e) {
1308
- let t = V(null), n = V(!1), r = V(!1), a = V(!1), o = V(""), s = V(null), l = V(!1), u = U(() => e.node.attrs), d = V(!!O(u.value.caption)), f = V(O(u.value.caption) ?? ""), m = cr(e.editor), g = U(() => c(m.value)), _ = U(() => e.extension.options?.messages ?? p("zh")), y = U(() => _.value.image), b = U(() => O(u.value.src)), C = U(() => sr(u.value.align)), T = U(() => D(u.value.width)), E = U(() => O(u.value.caption)), ee = U(() => g.value && (!b.value || r.value)), A = () => {
1309
- b.value && h({
1310
- src: b.value,
1311
- alt: O(u.value.alt) ?? "",
1312
+ let t = V(null), r = V(!1), i = V(!1), a = V(!1), o = V(""), c = V(null), l = V(!1), u = U(() => e.node.attrs), f = V(!!N(u.value.caption)), p = V(N(u.value.caption) ?? ""), m = mr(e.editor), h = U(() => d(m.value)), g = U(() => e.extension.options?.messages ?? n("zh")), _ = U(() => g.value.image), v = U(() => N(u.value.src)), y = U(() => pr(u.value.align)), x = U(() => M(u.value.width)), S = U(() => N(u.value.caption)), w = U(() => h.value && (!v.value || i.value)), T = () => {
1313
+ v.value && b({
1314
+ src: v.value,
1315
+ alt: N(u.value.alt) ?? "",
1312
1316
  messages: {
1313
- dialogAriaLabel: y.value.previewDialogAriaLabel,
1314
- zoomOut: y.value.previewZoomOut,
1315
- zoomIn: y.value.previewZoomIn,
1316
- reset: y.value.previewReset,
1317
- close: y.value.previewClose
1317
+ dialogAriaLabel: _.value.previewDialogAriaLabel,
1318
+ zoomOut: _.value.previewZoomOut,
1319
+ zoomIn: _.value.previewZoomIn,
1320
+ reset: _.value.previewReset,
1321
+ close: _.value.previewClose
1318
1322
  }
1319
1323
  });
1320
1324
  };
1321
- W(E, (e) => {
1322
- d.value || (f.value = e ?? "");
1325
+ W(S, (e) => {
1326
+ f.value || (p.value = e ?? "");
1323
1327
  });
1324
- let M = () => {
1325
- if (!g.value) return;
1328
+ let D = () => {
1329
+ if (!h.value) return;
1326
1330
  let t = e.getPos();
1327
1331
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1328
- }, te = () => {
1329
- if (o.value = "", s.value = null, a.value = !1, b.value) {
1330
- r.value = !1;
1332
+ }, k = () => {
1333
+ if (o.value = "", c.value = null, a.value = !1, v.value) {
1334
+ i.value = !1;
1331
1335
  return;
1332
1336
  }
1333
1337
  e.deleteNode();
1334
- }, N = async (t) => {
1335
- if (!g.value) return;
1338
+ }, A = async (t) => {
1339
+ if (!h.value) return;
1336
1340
  let n = e.extension.options;
1337
- l.value = !0, s.value = null;
1341
+ l.value = !0, c.value = null;
1338
1342
  try {
1339
- let i = await j(S(t, b.value && r.value ? "image-replace" : "image-insert"), n?.onUpload);
1340
- e.updateAttributes(v(u.value, i)), o.value = "", r.value = !1;
1343
+ let r = await F(ee(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1344
+ e.updateAttributes(C(u.value, r)), o.value = "", i.value = !1;
1341
1345
  } catch (e) {
1342
- s.value = e instanceof Error ? e.message : y.value.uploadFailedError;
1346
+ c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
1343
1347
  } finally {
1344
1348
  l.value = !1, a.value = !1;
1345
1349
  }
1346
- }, ne = () => {
1350
+ }, j = () => {
1347
1351
  if (!o.value.trim()) {
1348
- s.value = y.value.uploadRequiredError;
1352
+ c.value = _.value.uploadRequiredError;
1349
1353
  return;
1350
1354
  }
1351
- N(k(o.value));
1352
- }, P = (e) => {
1353
- N({
1355
+ A(P(o.value));
1356
+ }, te = (e) => {
1357
+ A({
1354
1358
  type: "file",
1355
1359
  file: e,
1356
1360
  mimeType: e.type || "image/*"
1357
1361
  });
1358
- }, re = () => {
1359
- d.value = !d.value, d.value && (f.value = E.value ?? "");
1360
- }, F = (n, r) => {
1361
- if (!g.value || !b.value) return;
1362
- r.preventDefault(), r.stopPropagation(), M();
1362
+ }, I = () => {
1363
+ f.value = !f.value, f.value && (p.value = S.value ?? "");
1364
+ }, L = (n, r) => {
1365
+ if (!h.value || !v.value) return;
1366
+ r.preventDefault(), r.stopPropagation(), D();
1363
1367
  let i = t.value;
1364
1368
  if (!i) return;
1365
- let a = r.clientX, o = i.getBoundingClientRect().width || T.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
1369
+ let a = r.clientX, o = i.getBoundingClientRect().width || x.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
1366
1370
  let r = n === "right" ? t.clientX - a : a - t.clientX;
1367
- e.updateAttributes({ width: x(o + r, s) });
1371
+ e.updateAttributes({ width: E(o + r, s) });
1368
1372
  }, l = () => {
1369
1373
  window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
1370
1374
  };
1371
1375
  window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
1372
1376
  };
1373
- return () => ee.value ? B(i, {
1377
+ return () => w.value ? B(s, {
1374
1378
  as: "figure",
1375
1379
  class: "markweave-image-node",
1376
1380
  "data-testid": "markweave-image-node",
1377
- "data-align": C.value,
1381
+ "data-align": y.value,
1378
1382
  "data-selected": "false",
1379
1383
  "data-hovered": "false",
1380
1384
  "data-empty": "true"
1381
- }, () => fr({
1382
- messages: _.value,
1385
+ }, () => yr({
1386
+ messages: g.value,
1383
1387
  inputValue: o.value,
1384
- error: s.value,
1388
+ error: c.value,
1385
1389
  dragActive: a.value,
1386
1390
  isSubmitting: l.value,
1387
1391
  onInputValue: (e) => {
1388
1392
  o.value = e;
1389
1393
  },
1390
- onFile: P,
1391
- onSubmit: ne,
1392
- onCancel: te,
1394
+ onFile: te,
1395
+ onSubmit: j,
1396
+ onCancel: k,
1393
1397
  onDragActive: (e) => {
1394
1398
  a.value = e;
1395
1399
  }
1396
- })) : B(i, {
1400
+ })) : B(s, {
1397
1401
  as: "figure",
1398
1402
  class: "markweave-image-node",
1399
1403
  "data-testid": "markweave-image-node",
1400
- "data-align": C.value,
1401
- "data-selected": g.value && e.selected ? "true" : "false",
1402
- "data-hovered": n.value ? "true" : "false",
1404
+ "data-align": y.value,
1405
+ "data-selected": h.value && e.selected ? "true" : "false",
1406
+ "data-hovered": r.value ? "true" : "false",
1403
1407
  "data-empty": "false",
1404
1408
  onMouseenter: () => {
1405
- n.value = !0;
1409
+ r.value = !0;
1406
1410
  },
1407
1411
  onMouseleave: () => {
1408
- n.value = !1;
1412
+ r.value = !1;
1409
1413
  },
1410
1414
  onMousedown: (e) => {
1411
- g.value && !lr(e.target) && M();
1415
+ h.value && !hr(e.target) && D();
1412
1416
  }
1413
1417
  }, () => [
1414
- g.value ? B("div", {
1418
+ h.value ? B("div", {
1415
1419
  class: "markweave-image-toolbar",
1416
1420
  "data-testid": "markweave-image-toolbar",
1417
1421
  "data-markweave-image-ui": "true",
1418
- "aria-label": y.value.toolsAriaLabel
1422
+ "aria-label": _.value.toolsAriaLabel
1419
1423
  }, [
1420
1424
  X({
1421
1425
  testId: "markweave-image-align-left",
1422
- label: y.value.alignLeft,
1423
- icon: hn,
1424
- active: C.value === "left",
1426
+ label: _.value.alignLeft,
1427
+ icon: bn,
1428
+ active: y.value === "left",
1425
1429
  onClick: () => e.updateAttributes({ align: "left" })
1426
1430
  }),
1427
1431
  X({
1428
1432
  testId: "markweave-image-align-center",
1429
- label: y.value.alignCenter,
1430
- icon: pn,
1431
- active: C.value === "center",
1433
+ label: _.value.alignCenter,
1434
+ icon: vn,
1435
+ active: y.value === "center",
1432
1436
  onClick: () => e.updateAttributes({ align: "center" })
1433
1437
  }),
1434
1438
  X({
1435
1439
  testId: "markweave-image-align-right",
1436
- label: y.value.alignRight,
1437
- icon: gn,
1438
- active: C.value === "right",
1440
+ label: _.value.alignRight,
1441
+ icon: xn,
1442
+ active: y.value === "right",
1439
1443
  onClick: () => e.updateAttributes({ align: "right" })
1440
1444
  }),
1441
1445
  B("span", {
@@ -1444,31 +1448,31 @@ var mr = J({
1444
1448
  }),
1445
1449
  X({
1446
1450
  testId: "markweave-image-caption",
1447
- label: y.value.caption,
1448
- icon: bn,
1449
- active: d.value || !!E.value,
1450
- onClick: re
1451
+ label: _.value.caption,
1452
+ icon: Tn,
1453
+ active: f.value || !!S.value,
1454
+ onClick: I
1451
1455
  }),
1452
1456
  X({
1453
1457
  testId: "markweave-image-preview",
1454
- label: y.value.preview,
1455
- icon: On,
1456
- onClick: A
1458
+ label: _.value.preview,
1459
+ icon: Nn,
1460
+ onClick: T
1457
1461
  }),
1458
1462
  X({
1459
1463
  testId: "markweave-image-download",
1460
- label: y.value.download,
1461
- icon: Dn,
1464
+ label: _.value.download,
1465
+ icon: Mn,
1462
1466
  onClick: () => {
1463
- b.value && w(b.value);
1467
+ v.value && O(v.value);
1464
1468
  }
1465
1469
  }),
1466
1470
  X({
1467
1471
  testId: "markweave-image-replace",
1468
- label: y.value.replace,
1469
- icon: Jn,
1472
+ label: _.value.replace,
1473
+ icon: er,
1470
1474
  onClick: () => {
1471
- o.value = "", s.value = null, r.value = !0;
1475
+ o.value = "", c.value = null, i.value = !0;
1472
1476
  }
1473
1477
  }),
1474
1478
  B("span", {
@@ -1477,82 +1481,82 @@ var mr = J({
1477
1481
  }),
1478
1482
  X({
1479
1483
  testId: "markweave-image-delete",
1480
- label: y.value.delete,
1481
- icon: nr,
1484
+ label: _.value.delete,
1485
+ icon: cr,
1482
1486
  onClick: () => e.deleteNode()
1483
1487
  })
1484
1488
  ]) : null,
1485
1489
  B("div", {
1486
1490
  ref: t,
1487
1491
  class: "markweave-image-box",
1488
- style: T.value ? { width: `${Math.round(T.value)}px` } : void 0
1492
+ style: x.value ? { width: `${Math.round(x.value)}px` } : void 0
1489
1493
  }, [
1490
- b.value ? B("img", {
1494
+ v.value ? B("img", {
1491
1495
  class: "markweave-image",
1492
- src: b.value,
1493
- alt: O(u.value.alt) ?? "",
1494
- title: O(u.value.title) ?? void 0,
1496
+ src: v.value,
1497
+ alt: N(u.value.alt) ?? "",
1498
+ title: N(u.value.title) ?? void 0,
1495
1499
  draggable: !1
1496
1500
  }) : B("div", {
1497
1501
  class: "markweave-image-readonly-empty",
1498
1502
  "data-testid": "markweave-image-readonly-empty",
1499
1503
  "aria-hidden": "true"
1500
1504
  }),
1501
- !g.value && b.value ? B("button", {
1505
+ !h.value && v.value ? B("button", {
1502
1506
  type: "button",
1503
1507
  class: "markweave-image-preview-trigger",
1504
1508
  "data-testid": "markweave-image-preview",
1505
1509
  "data-markweave-image-ui": "true",
1506
- "aria-label": y.value.preview,
1507
- title: y.value.preview,
1510
+ "aria-label": _.value.preview,
1511
+ title: _.value.preview,
1508
1512
  onMousedown: (e) => e.preventDefault(),
1509
- onClick: A
1510
- }, [B(On, {
1513
+ onClick: T
1514
+ }, [B(Nn, {
1511
1515
  size: 16,
1512
1516
  strokeWidth: 1.8
1513
1517
  }), B("span", {
1514
1518
  class: "markweave-image-tooltip",
1515
1519
  role: "tooltip"
1516
- }, y.value.preview)]) : null,
1517
- g.value ? B("button", {
1520
+ }, _.value.preview)]) : null,
1521
+ h.value ? B("button", {
1518
1522
  type: "button",
1519
1523
  class: "markweave-image-resize-handle",
1520
1524
  "data-testid": "markweave-image-resize-left",
1521
1525
  "data-side": "left",
1522
- "aria-label": y.value.resizeLeft,
1526
+ "aria-label": _.value.resizeLeft,
1523
1527
  "data-markweave-image-ui": "true",
1524
- onPointerdown: (e) => F("left", e)
1528
+ onPointerdown: (e) => L("left", e)
1525
1529
  }) : null,
1526
- g.value ? B("button", {
1530
+ h.value ? B("button", {
1527
1531
  type: "button",
1528
1532
  class: "markweave-image-resize-handle",
1529
1533
  "data-testid": "markweave-image-resize-right",
1530
1534
  "data-side": "right",
1531
- "aria-label": y.value.resizeRight,
1535
+ "aria-label": _.value.resizeRight,
1532
1536
  "data-markweave-image-ui": "true",
1533
- onPointerdown: (e) => F("right", e)
1537
+ onPointerdown: (e) => L("right", e)
1534
1538
  }) : null
1535
1539
  ]),
1536
- g.value && (d.value || E.value) ? B("input", {
1540
+ h.value && (f.value || S.value) ? B("input", {
1537
1541
  class: "markweave-image-caption-input",
1538
1542
  "data-testid": "markweave-image-caption-input",
1539
1543
  "data-markweave-image-ui": "true",
1540
- value: f.value,
1541
- placeholder: y.value.captionPlaceholder,
1542
- "aria-label": y.value.captionAriaLabel,
1544
+ value: p.value,
1545
+ placeholder: _.value.captionPlaceholder,
1546
+ "aria-label": _.value.captionAriaLabel,
1543
1547
  onInput: (t) => {
1544
- f.value = t.target.value, e.updateAttributes({ caption: f.value.trim() ? f.value : null });
1548
+ p.value = t.target.value, e.updateAttributes({ caption: p.value.trim() ? p.value : null });
1545
1549
  },
1546
1550
  onKeydown: (e) => {
1547
- e.key === "Escape" && (e.preventDefault(), d.value = !1);
1551
+ e.key === "Escape" && (e.preventDefault(), f.value = !1);
1548
1552
  }
1549
- }) : E.value ? B("figcaption", {
1553
+ }) : S.value ? B("figcaption", {
1550
1554
  class: "markweave-image-caption",
1551
1555
  "data-testid": "markweave-image-caption"
1552
- }, E.value) : null
1556
+ }, S.value) : null
1553
1557
  ]);
1554
1558
  }
1555
- }), hr = J({
1559
+ }), Sr = J({
1556
1560
  name: "MarkweaveVueVideoNodeView",
1557
1561
  props: {
1558
1562
  editor: {
@@ -1585,75 +1589,75 @@ var mr = J({
1585
1589
  }
1586
1590
  },
1587
1591
  setup(e) {
1588
- let t = V(!1), n = V(""), r = V(null), a = V(!1), o = cr(e.editor), s = U(() => c(o.value)), l = U(() => e.extension.options?.messages ?? p("zh")), u = U(() => l.value.video), d = U(() => e.node.attrs), f = U(() => O(d.value.src)), m = U(() => O(d.value.embedUrl)), h = U(() => O(d.value.provider)), g = U(() => m.value ? ee(m.value, h.value) : null), _ = U(() => O(d.value.mimeType)), v = U(() => O(d.value.title)), x = () => {
1589
- f.value || e.deleteNode(), n.value = "", r.value = null, t.value = !1;
1590
- }, S = async (i) => {
1591
- if (!s.value) return;
1592
+ let t = V(!1), r = V(""), i = V(null), a = V(!1), o = mr(e.editor), c = U(() => d(o.value)), l = U(() => e.extension.options?.messages ?? n("zh")), u = U(() => l.value.video), f = U(() => e.node.attrs), p = U(() => N(f.value.src)), m = U(() => N(f.value.embedUrl)), h = U(() => N(f.value.provider)), g = U(() => m.value ? j(m.value, h.value) : null), _ = U(() => N(f.value.mimeType)), v = U(() => N(f.value.title)), y = () => {
1593
+ p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
1594
+ }, b = async (n) => {
1595
+ if (!c.value) return;
1592
1596
  let o = e.extension.options;
1593
- a.value = !0, r.value = null;
1597
+ a.value = !0, i.value = null;
1594
1598
  try {
1595
- let t = await j(C(i), o?.onUpload);
1596
- e.updateAttributes(y(t)), n.value = "";
1599
+ let t = await F(D(n), o?.onUpload);
1600
+ e.updateAttributes(w(t)), r.value = "";
1597
1601
  } catch (e) {
1598
- r.value = e instanceof Error ? e.message : u.value.uploadFailedError;
1602
+ i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
1599
1603
  } finally {
1600
1604
  a.value = !1, t.value = !1;
1601
1605
  }
1602
- }, w = () => {
1603
- if (!s.value) return;
1604
- let t = b(n.value);
1606
+ }, x = () => {
1607
+ if (!c.value) return;
1608
+ let t = T(r.value);
1605
1609
  if (!t) {
1606
- r.value = u.value.unsupportedUrlError;
1610
+ i.value = u.value.unsupportedUrlError;
1607
1611
  return;
1608
1612
  }
1609
- r.value = null, e.updateAttributes(t), n.value = "";
1610
- }, E = (e) => {
1611
- S({
1613
+ i.value = null, e.updateAttributes(t), r.value = "";
1614
+ }, S = (e) => {
1615
+ b({
1612
1616
  type: "file",
1613
1617
  file: e,
1614
1618
  mimeType: e.type || "video/*"
1615
1619
  });
1616
- }, D = () => {
1617
- if (!s.value) return;
1620
+ }, C = () => {
1621
+ if (!c.value) return;
1618
1622
  let t = e.getPos();
1619
1623
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1620
- }, k = (t) => {
1621
- s.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
1624
+ }, E = (t) => {
1625
+ c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
1622
1626
  };
1623
- return () => s.value && !f.value ? B(i, {
1627
+ return () => c.value && !p.value ? B(s, {
1624
1628
  as: "figure",
1625
1629
  class: "markweave-video-node",
1626
1630
  "data-testid": "markweave-video-node",
1627
1631
  "data-empty": "true",
1628
1632
  "data-selected": "false"
1629
- }, () => pr({
1633
+ }, () => br({
1630
1634
  messages: l.value,
1631
- inputValue: n.value,
1632
- error: r.value,
1635
+ inputValue: r.value,
1636
+ error: i.value,
1633
1637
  dragActive: t.value,
1634
1638
  isSubmitting: a.value,
1635
1639
  onInputValue: (e) => {
1636
- n.value = e;
1640
+ r.value = e;
1637
1641
  },
1638
- onFile: E,
1639
- onSubmit: w,
1640
- onCancel: x,
1642
+ onFile: S,
1643
+ onSubmit: x,
1644
+ onCancel: y,
1641
1645
  onDragActive: (e) => {
1642
1646
  t.value = e;
1643
1647
  }
1644
- })) : B(i, {
1648
+ })) : B(s, {
1645
1649
  as: "figure",
1646
1650
  class: "markweave-video-node",
1647
1651
  "data-testid": "markweave-video-node",
1648
1652
  "data-provider": h.value ?? "file",
1649
- "data-empty": f.value ? "false" : "true",
1650
- "data-selected": s.value && e.selected ? "true" : "false",
1653
+ "data-empty": p.value ? "false" : "true",
1654
+ "data-selected": c.value && e.selected ? "true" : "false",
1651
1655
  "aria-label": u.value.nodeAriaLabel,
1652
- tabindex: s.value ? 0 : void 0,
1653
- onFocus: D,
1654
- onKeydown: k,
1656
+ tabindex: c.value ? 0 : void 0,
1657
+ onFocus: C,
1658
+ onKeydown: E,
1655
1659
  onMousedown: (e) => {
1656
- s.value && !ur(e.target) && (e.preventDefault(), D());
1660
+ c.value && !gr(e.target) && (e.preventDefault(), C());
1657
1661
  }
1658
1662
  }, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
1659
1663
  class: "markweave-video-iframe",
@@ -1661,25 +1665,25 @@ var mr = J({
1661
1665
  title: v.value ?? `${h.value ?? "Video"} embed`,
1662
1666
  "data-markweave-video-embed": "true",
1663
1667
  "data-markweave-video-provider": h.value ?? void 0,
1664
- "data-markweave-video-src": f.value ?? void 0,
1665
- allow: T,
1668
+ "data-markweave-video-src": p.value ?? void 0,
1669
+ allow: k,
1666
1670
  loading: "lazy",
1667
1671
  allowfullscreen: "true"
1668
- }), s.value ? B("button", {
1672
+ }), c.value ? B("button", {
1669
1673
  type: "button",
1670
1674
  class: "markweave-video-selection-layer",
1671
1675
  "data-testid": "markweave-video-selection-layer",
1672
1676
  tabindex: -1,
1673
1677
  "aria-label": u.value.selectAriaLabel
1674
- }) : null]) : f.value ? B("div", { class: "markweave-video-box" }, [B("video", {
1678
+ }) : null]) : p.value ? B("div", { class: "markweave-video-box" }, [B("video", {
1675
1679
  class: "markweave-video",
1676
- src: f.value,
1680
+ src: p.value,
1677
1681
  title: v.value ?? void 0,
1678
1682
  preload: "metadata",
1679
1683
  controls: !0,
1680
1684
  "data-markweave-video": "true",
1681
1685
  "data-markweave-mime-type": _.value ?? void 0
1682
- }), s.value ? B("button", {
1686
+ }), c.value ? B("button", {
1683
1687
  type: "button",
1684
1688
  class: "markweave-video-selection-layer",
1685
1689
  "data-testid": "markweave-video-selection-layer",
@@ -1691,46 +1695,234 @@ var mr = J({
1691
1695
  "aria-hidden": "true"
1692
1696
  })]);
1693
1697
  }
1694
- }), gr = g.extend({
1698
+ }), Cr = x.extend({
1695
1699
  addOptions() {
1696
1700
  return {
1697
1701
  ...this.parent?.(),
1698
- messages: p("zh"),
1702
+ messages: n("zh"),
1699
1703
  onUpload: void 0
1700
1704
  };
1701
1705
  },
1702
1706
  addNodeView() {
1703
- return typeof document > "u" ? null : a(mr, { stopEvent: ({ event: e }) => lr(e.target) });
1707
+ return typeof document > "u" ? null : c(xr, { stopEvent: ({ event: e }) => hr(e.target) });
1704
1708
  }
1705
- }), _r = _.extend({
1709
+ }), wr = S.extend({
1706
1710
  addOptions() {
1707
1711
  return {
1708
1712
  ...this.parent?.(),
1709
- messages: p("zh"),
1713
+ messages: n("zh"),
1710
1714
  onUpload: void 0
1711
1715
  };
1712
1716
  },
1713
1717
  addNodeView() {
1714
- return typeof document > "u" ? null : a(hr, { stopEvent: ({ event: e }) => ur(e.target) });
1718
+ return typeof document > "u" ? null : c(Sr, { stopEvent: ({ event: e }) => gr(e.target) });
1719
+ }
1720
+ }), Tr = J({
1721
+ name: "MarkweaveVueLinkCardNodeView",
1722
+ props: {
1723
+ editor: {
1724
+ type: Object,
1725
+ required: !0
1726
+ },
1727
+ extension: {
1728
+ type: Object,
1729
+ required: !0
1730
+ },
1731
+ node: {
1732
+ type: Object,
1733
+ required: !0
1734
+ },
1735
+ getPos: {
1736
+ type: Function,
1737
+ required: !0
1738
+ },
1739
+ deleteNode: {
1740
+ type: Function,
1741
+ required: !0
1742
+ },
1743
+ updateAttributes: {
1744
+ type: Function,
1745
+ required: !0
1746
+ },
1747
+ selected: {
1748
+ type: Boolean,
1749
+ required: !0
1750
+ }
1751
+ },
1752
+ setup(e) {
1753
+ let t = e.extension.options, r = t.messages ?? n("zh"), i = mr(e.editor), a = V(!1), o = V(!1), c = V(!1), l = U(() => _(e.node.attrs ?? {})), u = V(l.value?.title ?? ""), f = V(l.value?.href ?? "");
1754
+ W(l, (e) => {
1755
+ u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
1756
+ });
1757
+ let p = U(() => d(i.value)), m = U(() => {
1758
+ try {
1759
+ return new URL(l.value?.href ?? "").host;
1760
+ } catch {
1761
+ return l.value?.href ?? "";
1762
+ }
1763
+ }), h = (e) => e.preventDefault(), b = (e) => void navigator.clipboard?.writeText?.(e), x = () => y(e.editor, e.getPos()), S = async (n) => {
1764
+ n.preventDefault();
1765
+ let r = _({
1766
+ ...l.value,
1767
+ title: u.value,
1768
+ href: f.value
1769
+ });
1770
+ if (!r) return;
1771
+ e.updateAttributes(r), o.value = !1;
1772
+ let i = await t.resolver?.({
1773
+ href: r.href,
1774
+ title: r.title,
1775
+ signal: new AbortController().signal
1776
+ }).catch(() => null);
1777
+ i && e.updateAttributes(_({
1778
+ ...r,
1779
+ ...i
1780
+ }) ?? r);
1781
+ }, C = (e, t, n, r) => B("button", {
1782
+ type: "button",
1783
+ title: e,
1784
+ "aria-label": e,
1785
+ "data-testid": n,
1786
+ onMousedown: h,
1787
+ onClick: r
1788
+ }, [vr(t, e), B("span", { role: "tooltip" }, e)]);
1789
+ return () => {
1790
+ let n = l.value;
1791
+ if (!n) return null;
1792
+ let i = !c.value && n.imageUrl ? B("img", {
1793
+ src: n.imageUrl,
1794
+ alt: "",
1795
+ loading: "lazy",
1796
+ referrerpolicy: "no-referrer",
1797
+ onError: () => {
1798
+ c.value = !0;
1799
+ }
1800
+ }) : !c.value && n.faviconUrl ? B("img", {
1801
+ class: "markweave-link-card-favicon",
1802
+ src: n.faviconUrl,
1803
+ alt: "",
1804
+ loading: "lazy",
1805
+ referrerpolicy: "no-referrer",
1806
+ onError: () => {
1807
+ c.value = !0;
1808
+ }
1809
+ }) : B("b", null, m.value.slice(0, 1).toUpperCase());
1810
+ return B(s, {
1811
+ as: "article",
1812
+ class: "markweave-link-card",
1813
+ "data-testid": "markweave-link-card",
1814
+ "data-markweave-link-card": "true",
1815
+ "data-hovered": a.value ? "true" : "false",
1816
+ "data-selected": e.selected ? "true" : "false",
1817
+ onMouseenter: () => {
1818
+ a.value = !0;
1819
+ },
1820
+ onMouseleave: () => {
1821
+ a.value = !1;
1822
+ },
1823
+ onMousedown: (e) => {
1824
+ _r(e.target) || e.preventDefault();
1825
+ },
1826
+ onClick: (e) => {
1827
+ _r(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
1828
+ }
1829
+ }, () => [
1830
+ B("a", {
1831
+ class: "markweave-link-card-main",
1832
+ href: n.href,
1833
+ "aria-label": r.linkCard.open
1834
+ }, [B("span", { class: "markweave-link-card-copy" }, [
1835
+ B("strong", null, n.title),
1836
+ n.description ? B("span", null, n.description) : null,
1837
+ B("small", null, n.siteName ?? m.value)
1838
+ ]), B("span", {
1839
+ class: "markweave-link-card-media",
1840
+ "aria-hidden": "true"
1841
+ }, [i])]),
1842
+ p.value && a.value ? B("div", {
1843
+ class: "markweave-link-card-tools",
1844
+ "data-markweave-link-card-ui": "true",
1845
+ "aria-label": r.linkCard.toolsAriaLabel
1846
+ }, [
1847
+ C(r.linkCard.convertToLink, Gn, "markweave-link-card-convert", x),
1848
+ C(r.linkCard.copyAddress, Mn, "markweave-link-card-copy", () => b(n.href)),
1849
+ C(r.linkCard.edit, Qn, "markweave-link-card-edit", (i) => g({
1850
+ anchor: i.currentTarget,
1851
+ editor: e.editor,
1852
+ messages: r,
1853
+ resolver: t.resolver,
1854
+ card: {
1855
+ pos: e.getPos(),
1856
+ attrs: n
1857
+ }
1858
+ })),
1859
+ C(r.linkCard.delete, cr, "markweave-link-card-delete", () => e.deleteNode())
1860
+ ]) : null,
1861
+ p.value && o.value ? B("form", {
1862
+ class: "markweave-link-card-editor",
1863
+ "data-markweave-link-card-ui": "true",
1864
+ "data-testid": "markweave-link-card-editor",
1865
+ onSubmit: S
1866
+ }, [
1867
+ B("label", null, [B("span", null, r.linkCard.titleLabel), B("input", {
1868
+ value: u.value,
1869
+ placeholder: r.linkCard.titlePlaceholder,
1870
+ "aria-label": r.linkCard.titleLabel,
1871
+ onInput: (e) => {
1872
+ u.value = e.target.value;
1873
+ }
1874
+ })]),
1875
+ B("label", null, [B("span", null, r.linkCard.addressLabel), B("input", {
1876
+ value: f.value,
1877
+ placeholder: r.linkCard.addressPlaceholder,
1878
+ "aria-label": r.linkCard.addressLabel,
1879
+ onInput: (e) => {
1880
+ f.value = e.target.value;
1881
+ }
1882
+ })]),
1883
+ B("button", {
1884
+ type: "submit",
1885
+ disabled: !v(f.value),
1886
+ "aria-label": r.linkCard.edit
1887
+ }, [vr(Gn, r.linkCard.edit)])
1888
+ ]) : null
1889
+ ]);
1890
+ };
1891
+ }
1892
+ }), Er = h.extend({
1893
+ addOptions() {
1894
+ return {
1895
+ ...this.parent?.(),
1896
+ messages: n("zh"),
1897
+ resolver: void 0
1898
+ };
1899
+ },
1900
+ addNodeView() {
1901
+ return typeof document > "u" ? null : c(Tr, { stopEvent: ({ event: e }) => _r(e.target) });
1715
1902
  }
1716
1903
  });
1717
1904
  //#endregion
1718
1905
  //#region src/create-editor-extensions.ts
1719
- function vr(n = {}) {
1906
+ function Dr(t = {}) {
1720
1907
  return e({
1721
- lang: n.lang,
1722
- mediaExtensions: t({
1723
- image: gr,
1724
- video: _r,
1725
- lang: n.lang,
1726
- onImageUpload: n.onImageUpload,
1727
- onVideoUpload: n.onVideoUpload
1908
+ lang: t.lang,
1909
+ linkCardExtension: Er.configure({
1910
+ lang: t.lang,
1911
+ messages: n(t.lang),
1912
+ resolver: t.linkCardResolver
1913
+ }),
1914
+ mediaExtensions: i({
1915
+ image: Cr,
1916
+ video: wr,
1917
+ lang: t.lang,
1918
+ onImageUpload: t.onImageUpload,
1919
+ onVideoUpload: t.onVideoUpload
1728
1920
  })
1729
1921
  });
1730
1922
  }
1731
1923
  //#endregion
1732
1924
  //#region src/MarkweaveEditor.ts
1733
- var yr = {
1925
+ var Or = {
1734
1926
  active: !1,
1735
1927
  mode: "outside",
1736
1928
  activeCellPos: null,
@@ -1738,17 +1930,17 @@ var yr = {
1738
1930
  selectedCellCount: 0,
1739
1931
  selectionFrom: 0,
1740
1932
  selectionTo: 0
1741
- }, br = {
1933
+ }, kr = {
1742
1934
  active: !1,
1743
- language: Oe.defaultLanguage,
1935
+ language: Ne.defaultLanguage,
1744
1936
  mermaidPreviewMode: "code",
1745
1937
  pos: null,
1746
1938
  text: ""
1747
1939
  };
1748
- function xr(e) {
1749
- return Nt.getState(e.state) ?? Mt;
1940
+ function Ar(e) {
1941
+ return Rt.getState(e.state) ?? Lt;
1750
1942
  }
1751
- function Sr(e) {
1943
+ function jr(e) {
1752
1944
  if (!e || typeof window > "u") return null;
1753
1945
  let t = e.parentElement;
1754
1946
  for (; t;) {
@@ -1765,7 +1957,7 @@ function Z(e, t, n = 18, r = 1.8) {
1765
1957
  "aria-hidden": "true"
1766
1958
  }, { default: () => t });
1767
1959
  }
1768
- function Cr(e) {
1960
+ function Mr(e) {
1769
1961
  return e === "clipboard" ? [B("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), B("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [B("circle", {
1770
1962
  cx: "10",
1771
1963
  cy: "10",
@@ -1813,57 +2005,57 @@ function Q(e) {
1813
2005
  "stroke-linecap": "round",
1814
2006
  "stroke-linejoin": "round",
1815
2007
  "stroke-width": "1.8"
1816
- }, Cr(e)));
2008
+ }, Mr(e)));
1817
2009
  }
1818
2010
  function $(e) {
1819
2011
  e.preventDefault();
1820
2012
  }
1821
- function wr(e) {
1822
- let t = et(e);
2013
+ function Nr(e) {
2014
+ let t = at(e);
1823
2015
  return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
1824
2016
  }
1825
- var Tr = {
1826
- bold: vn,
1827
- italic: Rn,
1828
- underline: ir,
1829
- strike: Zn,
1830
- "inline-code": Tn,
1831
- link: Bn,
1832
- more: Gn,
1833
- superscript: $n,
1834
- subscript: Qn,
1835
- "inline-math": Yn,
1836
- "align-left": hn,
1837
- "align-center": pn,
1838
- "align-right": gn,
1839
- "align-justify": mn,
1840
- "decrease-indent": Fn,
1841
- "increase-indent": In
1842
- }, Er = {
1843
- type: tr,
1844
- "heading-1": An,
1845
- "heading-2": jn,
1846
- "heading-3": Mn,
1847
- "bullet-list": Vn,
1848
- "ordered-list": Un,
1849
- "task-list": Hn,
1850
- blockquote: qn,
1851
- "code-block": yn,
1852
- info: Ln,
1853
- tip: zn,
1854
- warning: _n,
1855
- error: wn,
1856
- success: xn,
1857
- emoji: Xn,
1858
- math: Yn,
1859
- table: er,
1860
- separator: Wn,
1861
- image: Nn,
1862
- video: or,
1863
- attachment: Kn
2017
+ var Pr = {
2018
+ bold: Cn,
2019
+ italic: Un,
2020
+ underline: ur,
2021
+ strike: rr,
2022
+ "inline-code": An,
2023
+ link: Gn,
2024
+ more: Xn,
2025
+ superscript: ar,
2026
+ subscript: ir,
2027
+ "inline-math": tr,
2028
+ "align-left": bn,
2029
+ "align-center": vn,
2030
+ "align-right": xn,
2031
+ "align-justify": yn,
2032
+ "decrease-indent": Bn,
2033
+ "increase-indent": Vn
2034
+ }, Fr = {
2035
+ type: sr,
2036
+ "heading-1": Fn,
2037
+ "heading-2": In,
2038
+ "heading-3": Ln,
2039
+ "bullet-list": Kn,
2040
+ "ordered-list": Jn,
2041
+ "task-list": qn,
2042
+ blockquote: $n,
2043
+ "code-block": wn,
2044
+ info: Hn,
2045
+ tip: Wn,
2046
+ warning: Sn,
2047
+ error: kn,
2048
+ success: En,
2049
+ emoji: nr,
2050
+ math: tr,
2051
+ table: or,
2052
+ separator: Yn,
2053
+ image: Rn,
2054
+ video: fr,
2055
+ attachment: Zn
1864
2056
  };
1865
- function Dr(e) {
1866
- let t = Er[e];
2057
+ function Ir(e) {
2058
+ let t = Fr[e];
1867
2059
  return B(t, {
1868
2060
  size: 18,
1869
2061
  strokeWidth: 1.6,
@@ -1871,21 +2063,21 @@ function Dr(e) {
1871
2063
  "aria-hidden": "true"
1872
2064
  });
1873
2065
  }
1874
- var Or = {
1875
- paragraph: rr,
1876
- "heading-1": An,
1877
- "heading-2": jn,
1878
- "heading-3": Mn,
1879
- "bullet-list": Vn,
1880
- "numbered-list": Un,
1881
- "todo-list": Hn,
1882
- quote: qn,
1883
- "code-block": yn
2066
+ var Lr = {
2067
+ paragraph: lr,
2068
+ "heading-1": Fn,
2069
+ "heading-2": In,
2070
+ "heading-3": Ln,
2071
+ "bullet-list": Kn,
2072
+ "numbered-list": Jn,
2073
+ "todo-list": qn,
2074
+ quote: $n,
2075
+ "code-block": wn
1884
2076
  };
1885
- function kr(e, t) {
1886
- return L(e, t).label;
2077
+ function Rr(e, t) {
2078
+ return se(e, t).label;
1887
2079
  }
1888
- var Ar = J({
2080
+ var zr = J({
1889
2081
  name: "MarkweaveVueFloatingToolbar",
1890
2082
  props: {
1891
2083
  editor: {
@@ -1902,28 +2094,28 @@ var Ar = J({
1902
2094
  }
1903
2095
  },
1904
2096
  setup(e) {
1905
- let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() => et(n.value.trim())), u = U(() => e.messages.floatingToolbar), d = U(() => oe(e.messages).map((e) => [
2097
+ let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() => at(n.value.trim())), u = U(() => e.messages.floatingToolbar), d = U(() => ue(e.messages).map((e) => [
1906
2098
  e.id,
1907
2099
  e.label,
1908
- Or[e.id]
1909
- ])), f = U(() => ae(e.messages).map((e) => [
2100
+ Lr[e.id]
2101
+ ])), f = U(() => z(e.messages).map((e) => [
1910
2102
  e.id,
1911
2103
  e.value,
1912
2104
  e.label
1913
- ])), p = U(() => R(e.messages).map((e) => [
2105
+ ])), p = U(() => ce(e.messages).map((e) => [
1914
2106
  e.id,
1915
2107
  e.value,
1916
2108
  e.label
1917
- ])), m = U(() => ie(e.messages).map((e) => e.id)), h = () => {
2109
+ ])), m = U(() => le(e.messages).map((e) => e.id)), h = () => {
1918
2110
  l.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: l.value }).run(), t.value = null);
1919
2111
  }, g = () => {
1920
2112
  e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
1921
2113
  }, _ = (r) => {
1922
2114
  t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
1923
- }, v = N(() => {
2115
+ }, v = R(() => {
1924
2116
  let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
1925
2117
  if (!t.value || !n || !r) return;
1926
- let s = fe({
2118
+ let s = ge({
1927
2119
  toolbarRect: n.getBoundingClientRect(),
1928
2120
  popoverSize: r.getBoundingClientRect(),
1929
2121
  viewport: {
@@ -1980,7 +2172,7 @@ var Ar = J({
1980
2172
  onMouseenter: (e) => b(n, e.currentTarget),
1981
2173
  onMouseleave: () => b(null),
1982
2174
  onClick: o
1983
- }, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, kr(e.editor, e.messages)), Z(t.value === "block-type" ? Cn : Sn, i)])] : n === "color" ? [B("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [B("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? Cn : Sn, i)])] : [Z(a, i)]), C = () => B("span", {
2175
+ }, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, Rr(e.editor, e.messages)), Z(t.value === "block-type" ? On : Dn, i)])] : n === "color" ? [B("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [B("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? On : Dn, i)])] : [Z(a, i)]), C = () => B("span", {
1984
2176
  class: "markweave-floating-toolbar-divider",
1985
2177
  "aria-hidden": "true"
1986
2178
  }), w = (n, r, i) => B("section", {
@@ -2012,7 +2204,7 @@ var Ar = J({
2012
2204
  "data-testid": `markweave-floating-toolbar-turn-${n}`,
2013
2205
  onMousedown: $,
2014
2206
  onClick: () => {
2015
- ce(e.editor, n), t.value = null;
2207
+ fe(e.editor, n), t.value = null;
2016
2208
  }
2017
2209
  }, [B("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), B("span", null, r)]))]) : t.value === "link" ? B("form", {
2018
2210
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
@@ -2036,7 +2228,7 @@ var Ar = J({
2036
2228
  "aria-label": u.value.applyLink,
2037
2229
  "data-testid": "markweave-floating-toolbar-link-apply",
2038
2230
  onMousedown: $
2039
- }, [Z(En, u.value.applyLink)]),
2231
+ }, [Z(jn, u.value.applyLink)]),
2040
2232
  B("span", {
2041
2233
  class: "markweave-floating-toolbar-link-divider",
2042
2234
  "aria-hidden": "true"
@@ -2047,15 +2239,15 @@ var Ar = J({
2047
2239
  "aria-label": u.value.openLink,
2048
2240
  "data-testid": "markweave-floating-toolbar-link-open",
2049
2241
  onMousedown: $,
2050
- onClick: () => wr(n.value)
2051
- }, [Z(kn, u.value.openLink)]),
2242
+ onClick: () => Nr(n.value)
2243
+ }, [Z(Pn, u.value.openLink)]),
2052
2244
  B("button", {
2053
2245
  type: "button",
2054
2246
  "aria-label": u.value.removeLink,
2055
2247
  "data-testid": "markweave-floating-toolbar-link-remove",
2056
2248
  onMousedown: $,
2057
2249
  onClick: g
2058
- }, [Z(nr, u.value.removeLink)])
2250
+ }, [Z(cr, u.value.removeLink)])
2059
2251
  ])]) : t.value === "color" ? B("div", {
2060
2252
  ref: c,
2061
2253
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
@@ -2080,15 +2272,15 @@ var Ar = J({
2080
2272
  r.value = null;
2081
2273
  },
2082
2274
  onClick: () => {
2083
- se(e.editor, n), t.value = null;
2275
+ de(e.editor, n), t.value = null;
2084
2276
  }
2085
- }, [Z(Tr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
2277
+ }, [Z(Pr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
2086
2278
  class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
2087
2279
  role: "tooltip"
2088
2280
  }, u.value.moreActions[n]) : null]))) : null;
2089
- return () => B(M, {
2281
+ return () => B(I, {
2090
2282
  editor: e.editor,
2091
- shouldShow: ({ editor: e }) => e.isEditable && z(pe(e)),
2283
+ shouldShow: ({ editor: e }) => e.isEditable && ye(_e(e)),
2092
2284
  options: { placement: "top" }
2093
2285
  }, { default: () => B("div", {
2094
2286
  ref: o,
@@ -2100,23 +2292,23 @@ var Ar = J({
2100
2292
  class: "markweave-floating-toolbar-content",
2101
2293
  "data-menu": t.value ?? "none"
2102
2294
  }, [
2103
- S("block-type", u.value.buttons["block-type"], rr, () => _("block-type"), t.value === "block-type"),
2295
+ S("block-type", u.value.buttons["block-type"], lr, () => _("block-type"), t.value === "block-type"),
2104
2296
  C(),
2105
- S("bold", u.value.buttons.bold, vn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2106
- S("italic", u.value.buttons.italic, Rn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2107
- S("underline", u.value.buttons.underline, ir, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2108
- S("strike", u.value.buttons.strike, Zn, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2109
- S("inline-code", u.value.buttons["inline-code"], Tn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2297
+ S("bold", u.value.buttons.bold, Cn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2298
+ S("italic", u.value.buttons.italic, Un, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2299
+ S("underline", u.value.buttons.underline, ur, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2300
+ S("strike", u.value.buttons.strike, rr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2301
+ S("inline-code", u.value.buttons["inline-code"], An, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2110
2302
  C(),
2111
- S("link", u.value.buttons.link, Bn, () => _("link"), e.editor.isActive("link")),
2112
- S("color", u.value.buttons.color, rr, () => _("color"), t.value === "color"),
2303
+ S("link", u.value.buttons.link, Gn, () => _("link"), e.editor.isActive("link")),
2304
+ S("color", u.value.buttons.color, lr, () => _("color"), t.value === "color"),
2113
2305
  C(),
2114
- S("more", u.value.buttons.more, Gn, () => _("more"), t.value === "more"),
2306
+ S("more", u.value.buttons.more, Xn, () => _("more"), t.value === "more"),
2115
2307
  T(),
2116
2308
  x()
2117
2309
  ])]) });
2118
2310
  }
2119
- }), jr = J({
2311
+ }), Br = J({
2120
2312
  name: "MarkweaveVueMathEditorPopover",
2121
2313
  props: {
2122
2314
  editor: {
@@ -2137,17 +2329,17 @@ var Ar = J({
2137
2329
  }
2138
2330
  },
2139
2331
  setup(e) {
2140
- let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(at(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
2332
+ let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(ut(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
2141
2333
  html: a.value,
2142
2334
  error: !1
2143
- } : lt(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => it(e.editor, e.target) ?? 1), u = () => {
2335
+ } : mt(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => lt(e.editor, e.target) ?? 1), u = () => {
2144
2336
  if (typeof window > "u") return;
2145
- let r = rt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2337
+ let r = ct(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2146
2338
  if (!r || !i) {
2147
2339
  e.onClose();
2148
2340
  return;
2149
2341
  }
2150
- n.value = nt({
2342
+ n.value = st({
2151
2343
  anchorRect: r,
2152
2344
  frameRect: i,
2153
2345
  kind: e.target.kind,
@@ -2156,7 +2348,7 @@ var Ar = J({
2156
2348
  viewportWidth: window.innerWidth
2157
2349
  });
2158
2350
  }, d = () => {
2159
- s.value && tt(e.editor, e.target, t.value) && e.onClose();
2351
+ s.value && ot(e.editor, e.target, t.value) && e.onClose();
2160
2352
  }, f = (t) => {
2161
2353
  if (t.key === "Escape") {
2162
2354
  t.preventDefault(), e.onClose(), e.editor.commands.focus();
@@ -2168,13 +2360,13 @@ var Ar = J({
2168
2360
  n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
2169
2361
  };
2170
2362
  return W(() => [e.target.pos, e.target.latex], () => {
2171
- t.value = e.target.latex, a.value = at(e.editor, e.target), q(u);
2363
+ t.value = e.target.latex, a.value = ut(e.editor, e.target), q(u);
2172
2364
  }), G(() => {
2173
- ut(e.editor, e.target, !0), u(), q(() => {
2365
+ ht(e.editor, e.target, !0), u(), q(() => {
2174
2366
  i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
2175
2367
  }), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
2176
2368
  }), K(() => {
2177
- ut(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
2369
+ ht(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
2178
2370
  }), () => {
2179
2371
  let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
2180
2372
  ref: i,
@@ -2235,14 +2427,14 @@ var Ar = J({
2235
2427
  }, [
2236
2428
  B("div", { class: "markweave-math-block-toolbar" }, [
2237
2429
  B("span", null, c.value.label),
2238
- Z(Tn, c.value.label, 15, 1.75),
2430
+ Z(An, c.value.label, 15, 1.75),
2239
2431
  B("button", {
2240
2432
  type: "submit",
2241
2433
  title: c.value.apply,
2242
2434
  "aria-label": c.value.apply,
2243
2435
  disabled: !s.value,
2244
2436
  "data-testid": "markweave-math-editor-apply"
2245
- }, [Z(xn, c.value.apply, 16, 2)])
2437
+ }, [Z(En, c.value.apply, 16, 2)])
2246
2438
  ]),
2247
2439
  B("label", {
2248
2440
  class: "markweave-math-block-source",
@@ -2265,7 +2457,7 @@ var Ar = J({
2265
2457
  ]);
2266
2458
  };
2267
2459
  }
2268
- }), Mr = J({
2460
+ }), Vr = J({
2269
2461
  name: "MarkweaveVueSlashCommandMenu",
2270
2462
  props: {
2271
2463
  commands: {
@@ -2324,13 +2516,13 @@ var Ar = J({
2324
2516
  } : {
2325
2517
  kind: e.inputCommand.uploadKind ?? "attachment",
2326
2518
  trigger: "slash-command",
2327
- source: k(t.value)
2519
+ source: P(t.value)
2328
2520
  };
2329
2521
  if (!n.value && !t.value.trim()) {
2330
2522
  r.value = e.messages.slash.uploadRequiredError;
2331
2523
  return;
2332
2524
  }
2333
- let a = await j(i, e.onUpload);
2525
+ let a = await F(i, e.onUpload);
2334
2526
  e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
2335
2527
  } catch (t) {
2336
2528
  r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
@@ -2451,7 +2643,7 @@ var Ar = J({
2451
2643
  class: "markweave-slash-group",
2452
2644
  "aria-label": t.group
2453
2645
  }, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
2454
- let n = e.commands.indexOf(t) === e.state.activeIndex, r = yt(t);
2646
+ let n = e.commands.indexOf(t) === e.state.activeIndex, r = wt(t);
2455
2647
  return B("button", {
2456
2648
  key: t.id,
2457
2649
  type: "button",
@@ -2474,7 +2666,7 @@ var Ar = J({
2474
2666
  }
2475
2667
  }
2476
2668
  }, [
2477
- Dr(t.icon),
2669
+ Ir(t.icon),
2478
2670
  B("span", null, t.label),
2479
2671
  t.disabledReason ? B("small", null, t.disabledReason) : null
2480
2672
  ]);
@@ -2485,7 +2677,7 @@ var Ar = J({
2485
2677
  }, e.messages.slash.noResults)])]);
2486
2678
  };
2487
2679
  }
2488
- }), Nr = J({
2680
+ }), Hr = J({
2489
2681
  name: "MarkweaveVueTableControls",
2490
2682
  props: {
2491
2683
  editor: {
@@ -2518,12 +2710,12 @@ var Ar = J({
2518
2710
  }
2519
2711
  },
2520
2712
  setup(e) {
2521
- let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? At(e.editor.state) : yr), h = U(() => Ht(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => Ht(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Bt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? Kt(e.editor, t.value) : []), b = () => {
2713
+ let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? Ft(e.editor.state) : Or), h = U(() => qt(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => qt(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Gt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? Zt(e.editor, t.value) : []), b = () => {
2522
2714
  p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
2523
2715
  }, x = (e) => {
2524
2716
  b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
2525
2717
  s.value = null, p = null;
2526
- }, Xt));
2718
+ }, tn));
2527
2719
  }, S = () => {
2528
2720
  if (!e.active) {
2529
2721
  r.value = null, i.value = null, a.value = null, x(null);
@@ -2534,16 +2726,16 @@ var Ar = J({
2534
2726
  r.value = null, i.value = null, a.value = null;
2535
2727
  return;
2536
2728
  }
2537
- let s = o.getBoundingClientRect(), c = h.value ? Vt(e.editor, h.value) : null, l = g.value ? Vt(e.editor, g.value) : null, u = v.value ? qt(e.editor) : null;
2538
- c ? r.value = Ft({
2729
+ let s = o.getBoundingClientRect(), c = h.value ? Kt(e.editor, h.value) : null, l = g.value ? Kt(e.editor, g.value) : null, u = v.value ? Qt(e.editor) : null;
2730
+ c ? r.value = Bt({
2539
2731
  targetRect: c,
2540
2732
  frameRect: s,
2541
2733
  kind: "row"
2542
- }) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Ft({
2734
+ }) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Bt({
2543
2735
  targetRect: l,
2544
2736
  frameRect: s,
2545
2737
  kind: "column"
2546
- }) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Ft({
2738
+ }) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Bt({
2547
2739
  targetRect: u,
2548
2740
  frameRect: s,
2549
2741
  kind: "selection"
@@ -2558,13 +2750,13 @@ var Ar = J({
2558
2750
  o.value = null;
2559
2751
  return;
2560
2752
  }
2561
- let a = i.getBoundingClientRect(), s = t.value === "row" ? zt(e.editor)?.getBoundingClientRect() : null, c = s ? {
2753
+ let a = i.getBoundingClientRect(), s = t.value === "row" ? Wt(e.editor)?.getBoundingClientRect() : null, c = s ? {
2562
2754
  left: a.left,
2563
2755
  top: s.top,
2564
2756
  width: a.width,
2565
2757
  height: a.height
2566
2758
  } : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
2567
- o.value = Pt({
2759
+ o.value = zt({
2568
2760
  anchorRect: c,
2569
2761
  frameRect: p,
2570
2762
  menuSize: {
@@ -2581,16 +2773,16 @@ var Ar = J({
2581
2773
  let i = t.value === e && n.value === r;
2582
2774
  n.value = r, t.value = i ? null : e, T();
2583
2775
  }, ee = () => {
2584
- e.editor.view.dispatch(Dt(e.editor.state.tr, null));
2776
+ e.editor.view.dispatch(Mt(e.editor.state.tr, null));
2585
2777
  }, D = (t, n) => {
2586
2778
  let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
2587
- r !== null && Yt(e.editor, r, t, { visualIndex: i }), E(t, n);
2779
+ r !== null && en(e.editor, r, t, { visualIndex: i }), E(t, n);
2588
2780
  }, O = () => {
2589
2781
  ee(), E("selection", "selection-edge");
2590
2782
  }, k = (n = !1) => {
2591
2783
  t.value = null, o.value = null, n && e.editor.view.focus();
2592
2784
  }, A = async (n, r) => {
2593
- let i = await Lt({
2785
+ let i = await Ht({
2594
2786
  editor: e.editor,
2595
2787
  commandId: n,
2596
2788
  menu: r ?? t.value ?? "selection",
@@ -2598,17 +2790,17 @@ var Ar = J({
2598
2790
  });
2599
2791
  return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
2600
2792
  }, j = (t) => {
2601
- let n = Ut(e.editor, t);
2793
+ let n = Jt(e.editor, t);
2602
2794
  n && e.onEditWithAi?.(n), k(!0);
2603
2795
  }, M = (e) => {
2604
2796
  !t.value || e.key !== "Escape" || k(!0);
2605
- }, te = (e) => {
2797
+ }, N = (e) => {
2606
2798
  t.value && (e.target instanceof Node && c.value?.contains(e.target) || k());
2607
2799
  };
2608
2800
  G(() => {
2609
- w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", M), document.addEventListener("mousedown", te);
2801
+ w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", M), document.addEventListener("mousedown", N);
2610
2802
  }), K(() => {
2611
- b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", M), document.removeEventListener("mousedown", te);
2803
+ b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", M), document.removeEventListener("mousedown", N);
2612
2804
  }), W(() => [
2613
2805
  e.active,
2614
2806
  m.value.activeCellPos,
@@ -2620,11 +2812,11 @@ var Ar = J({
2620
2812
  t.value,
2621
2813
  n.value
2622
2814
  ], T, { flush: "post" });
2623
- let N = () => t.value ? B("div", {
2815
+ let P = () => t.value ? B("div", {
2624
2816
  ref: f,
2625
2817
  class: "markweave-table-menu",
2626
2818
  role: "menu",
2627
- "aria-label": Zt(t.value, e.messages),
2819
+ "aria-label": nn(t.value, e.messages),
2628
2820
  "data-testid": "markweave-table-menu",
2629
2821
  "data-positioned": o.value ? "true" : "false",
2630
2822
  style: o.value ? {
@@ -2632,7 +2824,7 @@ var Ar = J({
2632
2824
  top: `${o.value.top}px`
2633
2825
  } : void 0
2634
2826
  }, y.value.map((n, r) => {
2635
- let i = Wt(n), a = r === 0 ? i : Wt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : It(e.editor, n.commandId), c = Gt(n, e.messages);
2827
+ let i = Yt(n), a = r === 0 ? i : Yt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Vt(e.editor, n.commandId), c = Xt(n, e.messages);
2636
2828
  return B("button", {
2637
2829
  key: `${n.id}-${r}`,
2638
2830
  type: "button",
@@ -2672,7 +2864,7 @@ var Ar = J({
2672
2864
  "data-copy-kind": s.value.kind,
2673
2865
  "data-text-length": s.value.textLength,
2674
2866
  "data-html-length": s.value.htmlLength
2675
- }, Rt(s.value)) : null,
2867
+ }, Ut(s.value)) : null,
2676
2868
  r.value ? B("button", {
2677
2869
  ref: l,
2678
2870
  type: "button",
@@ -2729,10 +2921,10 @@ var Ar = J({
2729
2921
  onMousedown: $,
2730
2922
  onClick: O
2731
2923
  }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2732
- N()
2924
+ P()
2733
2925
  ]) : null;
2734
2926
  }
2735
- }), Pr = J({
2927
+ }), Ur = J({
2736
2928
  name: "MarkweaveVueTableSelectionOverlay",
2737
2929
  props: {
2738
2930
  editor: {
@@ -2750,7 +2942,7 @@ var Ar = J({
2750
2942
  t.value = null;
2751
2943
  return;
2752
2944
  }
2753
- t.value = Jt(e.editor, jt(e.editor.state));
2945
+ t.value = $t(e.editor, It(e.editor.state));
2754
2946
  };
2755
2947
  return G(() => {
2756
2948
  n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
@@ -2788,7 +2980,7 @@ var Ar = J({
2788
2980
  }) : null;
2789
2981
  };
2790
2982
  }
2791
- }), Fr = J({
2983
+ }), Wr = J({
2792
2984
  name: "MarkweaveVueCodeBlockControls",
2793
2985
  props: {
2794
2986
  editor: {
@@ -2821,88 +3013,88 @@ var Ar = J({
2821
3013
  active: !1,
2822
3014
  lastX: 0,
2823
3015
  lastY: 0
2824
- }), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Ke(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
3016
+ }), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Ze(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
2825
3017
  ...e.state,
2826
3018
  pos: e.state.pos,
2827
3019
  active: !0
2828
- } : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => Xe(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), ee = U(() => !e.readOnly), D = U(() => S.value ? Be(S.value.language) : Be("text")), O = U(() => u.value?.status ?? "idle"), k = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), A = U(() => w.value && k.value === "preview"), j = U(() => (v.value, g.value, _.value, Je(e.editor))), M = U(() => `${_.value}|${j.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), te = U(() => We(l.value)), N = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), ne = () => {
3020
+ } : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => tt(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), ee = U(() => !e.readOnly), D = U(() => S.value ? Ge(S.value.language) : Ge("text")), O = U(() => u.value?.status ?? "idle"), k = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), A = U(() => w.value && k.value === "preview"), j = U(() => (v.value, g.value, _.value, $e(e.editor))), M = U(() => `${_.value}|${j.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), N = U(() => Ye(l.value)), P = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), te = () => {
2829
3021
  y !== null && (window.clearTimeout(y), y = null);
2830
- }, P = (e) => {
2831
- ne(), u.value = e, e && (y = window.setTimeout(() => {
3022
+ }, F = (e) => {
3023
+ te(), u.value = e, e && (y = window.setTimeout(() => {
2832
3024
  u.value = null, y = null;
2833
- }, Pe));
2834
- }, re = () => {
3025
+ }, ze));
3026
+ }, I = () => {
2835
3027
  f.value = null, p.value = null, m.value = !1, h.value = {
2836
3028
  active: !1,
2837
3029
  lastX: 0,
2838
3030
  lastY: 0
2839
3031
  }, e.editor.view.focus();
2840
- }, F = () => {
3032
+ }, L = () => {
2841
3033
  let n = t.value;
2842
3034
  if (!n) return;
2843
- if (!qe(n) || j.value.length === 0) {
3035
+ if (!Qe(n) || j.value.length === 0) {
2844
3036
  o.value = [];
2845
3037
  return;
2846
3038
  }
2847
3039
  let r = n.getBoundingClientRect(), i = j.value.flatMap((t) => {
2848
- let n = Ue(He(e.editor, t.pos, t.mermaidPreviewMode), r);
2849
- return n ? [Re(t, n, r)] : [];
3040
+ let n = Je(qe(e.editor, t.pos, t.mermaidPreviewMode), r);
3041
+ return n ? [Ue(t, n, r)] : [];
2850
3042
  });
2851
- o.value = Ze(o.value, i, j.value.map((e) => e.pos));
2852
- }, I = () => {
3043
+ o.value = nt(o.value, i, j.value.map((e) => e.pos));
3044
+ }, R = () => {
2853
3045
  if (!E.value || !S.value) {
2854
3046
  a.value = null, s.value = null;
2855
3047
  return;
2856
3048
  }
2857
3049
  let r = t.value;
2858
3050
  if (!r) return;
2859
- let i = He(e.editor, S.value.pos, k.value), o = r.getBoundingClientRect(), l = Ue(i, o);
3051
+ let i = qe(e.editor, S.value.pos, k.value), o = r.getBoundingClientRect(), l = Je(i, o);
2860
3052
  if (!l) {
2861
3053
  a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
2862
3054
  return;
2863
3055
  }
2864
- if (a.value = Ie(S.value.pos, l, o), c.value && n.value) {
3056
+ if (a.value = Ve(S.value.pos, l, o), c.value && n.value) {
2865
3057
  let e = n.value.getBoundingClientRect();
2866
- s.value = Me({
3058
+ s.value = Le({
2867
3059
  overlayRect: o,
2868
3060
  buttonRect: e,
2869
3061
  windowWidth: window.innerWidth,
2870
3062
  windowHeight: window.innerHeight
2871
3063
  });
2872
3064
  }
2873
- }, L = async () => {
3065
+ }, ne = async () => {
2874
3066
  if (e.readOnly) {
2875
3067
  if (!S.value) return;
2876
- let e = await Fe(S.value.text);
2877
- P(De(S.value, e ? "copied" : "failed"));
3068
+ let e = await Be(S.value.text);
3069
+ F(Me(S.value, e ? "copied" : "failed"));
2878
3070
  return;
2879
3071
  }
2880
- if (!ze(e.editor, S.value)) return;
2881
- let t = await Te(e.editor);
2882
- P(De(Ee(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
2883
- }, R = (t, n) => {
3072
+ if (!We(e.editor, S.value)) return;
3073
+ let t = await Ae(e.editor);
3074
+ F(Me(je(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
3075
+ }, re = (t, n) => {
2884
3076
  if (e.readOnly) {
2885
- gt(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
3077
+ xt(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
2886
3078
  return;
2887
3079
  }
2888
3080
  let r = e.state.active && e.state.pos === t.pos;
2889
- je(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
3081
+ Ie(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
2890
3082
  }, ie = (t) => {
2891
3083
  if (e.readOnly || !S.value) return;
2892
3084
  let n = e.state.active && e.state.pos === S.value.pos;
2893
- Ae(e.editor, S.value.pos, t) && (t === "mermaid" && je(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
3085
+ Fe(e.editor, S.value.pos, t) && (t === "mermaid" && Ie(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
2894
3086
  }, ae = () => {
2895
- e.readOnly || !S.value || ke(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
3087
+ e.readOnly || !S.value || Pe(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
2896
3088
  }, oe = () => {
2897
3089
  if (!S.value) return;
2898
- let t = Ye(e.editor, S.value.pos);
3090
+ let t = et(e.editor, S.value.pos);
2899
3091
  if (!t) return;
2900
3092
  let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
2901
3093
  i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
2902
3094
  }, se = () => {
2903
3095
  if (!S.value) return;
2904
- let t = Ye(e.editor, S.value.pos);
2905
- t && (f.value = Le(t), p.value = null, m.value = !1, h.value = {
3096
+ let t = et(e.editor, S.value.pos);
3097
+ t && (f.value = He(t), p.value = null, m.value = !1, h.value = {
2906
3098
  active: !1,
2907
3099
  lastX: 0,
2908
3100
  lastY: 0
@@ -2910,23 +3102,23 @@ var Ar = J({
2910
3102
  }, ce = (e) => {
2911
3103
  f.value = f.value ? {
2912
3104
  ...f.value,
2913
- scale: Ne(f.value.scale + e)
3105
+ scale: Re(f.value.scale + e)
2914
3106
  } : null;
2915
3107
  }, le = () => {
2916
- f.value = f.value ? Le(f.value.svg) : null, h.value = {
3108
+ f.value = f.value ? He(f.value.svg) : null, h.value = {
2917
3109
  active: !1,
2918
3110
  lastX: 0,
2919
3111
  lastY: 0
2920
3112
  }, m.value = !1;
3113
+ }, z = (e) => {
3114
+ e.preventDefault(), ce(e.deltaY < 0 ? rt : -rt);
2921
3115
  }, ue = (e) => {
2922
- e.preventDefault(), ce(e.deltaY < 0 ? Qe : -Qe);
2923
- }, de = (e) => {
2924
3116
  e.button === 0 && (e.preventDefault(), h.value = {
2925
3117
  active: !0,
2926
3118
  lastX: e.clientX,
2927
3119
  lastY: e.clientY
2928
3120
  }, m.value = !0);
2929
- }, fe = (e) => {
3121
+ }, de = (e) => {
2930
3122
  let t = h.value;
2931
3123
  if (!t.active) return;
2932
3124
  let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
@@ -2934,8 +3126,8 @@ var Ar = J({
2934
3126
  active: !0,
2935
3127
  lastX: e.clientX,
2936
3128
  lastY: e.clientY
2937
- }, f.value = $e(f.value, n, r);
2938
- }, pe = () => {
3129
+ }, f.value = it(f.value, n, r);
3130
+ }, fe = () => {
2939
3131
  h.value = {
2940
3132
  active: !1,
2941
3133
  lastX: 0,
@@ -2944,10 +3136,10 @@ var Ar = J({
2944
3136
  };
2945
3137
  W(() => e.readOnly, (e) => {
2946
3138
  e && (c.value = !1, l.value = "");
2947
- }), W(N, () => {
2948
- P(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
3139
+ }), W(P, () => {
3140
+ F(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
2949
3141
  }), W(c, async (e) => {
2950
- e && (await q(), I(), r.value?.focus({ preventScroll: !0 }));
3142
+ e && (await q(), R(), r.value?.focus({ preventScroll: !0 }));
2951
3143
  }), W(() => [
2952
3144
  E.value,
2953
3145
  g.value,
@@ -2955,29 +3147,29 @@ var Ar = J({
2955
3147
  c.value,
2956
3148
  k.value
2957
3149
  ], async () => {
2958
- await q(), I();
3150
+ await q(), R();
2959
3151
  }, {
2960
3152
  flush: "post",
2961
3153
  immediate: !0
2962
3154
  }), W(M, async () => {
2963
- await q(), F(), window.requestAnimationFrame(F);
3155
+ await q(), L(), window.requestAnimationFrame(L);
2964
3156
  }, {
2965
3157
  flush: "post",
2966
3158
  immediate: !0
2967
3159
  });
2968
- let me = null;
3160
+ let pe = null;
2969
3161
  return G(() => {
2970
3162
  q(() => {
2971
3163
  let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
2972
3164
  if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
2973
- let r = Ge(e.editor, n.target), a = Ke(e.editor, r), o = a && !Xe(e.editor, a) ? a.pos : null;
3165
+ let r = Xe(e.editor, n.target), a = Ze(e.editor, r), o = a && !tt(e.editor, a) ? a.pos : null;
2974
3166
  i.value = i.value === o ? i.value : o;
2975
3167
  }, a = () => {
2976
3168
  c.value || (i.value = null);
2977
3169
  }, o = (t) => {
2978
3170
  if (t.key === "Escape") {
2979
3171
  if (f.value) {
2980
- re();
3172
+ I();
2981
3173
  return;
2982
3174
  }
2983
3175
  c.value && (c.value = !1, e.editor.view.focus());
@@ -2985,14 +3177,14 @@ var Ar = J({
2985
3177
  }, s = (e) => {
2986
3178
  c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
2987
3179
  }, l = ({ transaction: e }) => {
2988
- e.getMeta(we) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(we) || pt(e)) && (v.value += 1);
3180
+ e.getMeta(ke) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(ke) || vt(e)) && (v.value += 1);
2989
3181
  };
2990
- n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), window.addEventListener("resize", F), window.addEventListener("scroll", F, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), me = () => {
2991
- n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", F), window.removeEventListener("scroll", F, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), ne();
3182
+ n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", R), window.addEventListener("scroll", R, !0), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), pe = () => {
3183
+ n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", R), window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), te();
2992
3184
  };
2993
3185
  });
2994
3186
  }), K(() => {
2995
- me?.(), me = null, ne();
3187
+ pe?.(), pe = null, te();
2996
3188
  }), () => {
2997
3189
  if (!E.value && j.value.length === 0 && !f.value) return null;
2998
3190
  let i = a.value ? {
@@ -3026,7 +3218,7 @@ var Ar = J({
3026
3218
  "data-testid": `markweave-mermaid-mode-${t}`,
3027
3219
  "data-active": e.mermaidPreviewMode === t ? "true" : "false",
3028
3220
  onMousedown: $,
3029
- onClick: () => R(e, t)
3221
+ onClick: () => re(e, t)
3030
3222
  }, t === "code" ? "Code" : "Preview")));
3031
3223
  }),
3032
3224
  E.value && S.value ? B("div", {
@@ -3085,7 +3277,7 @@ var Ar = J({
3085
3277
  d.value = !1;
3086
3278
  },
3087
3279
  onClick: () => {
3088
- L();
3280
+ ne();
3089
3281
  }
3090
3282
  }, [Q(O.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
3091
3283
  class: "markweave-codeblock-tooltip",
@@ -3131,7 +3323,7 @@ var Ar = J({
3131
3323
  onKeydown: (t) => {
3132
3324
  t.key === "Escape" && (t.preventDefault(), c.value = !1, e.editor.view.focus());
3133
3325
  }
3134
- }), Q("search")]), B("div", { class: "markweave-codeblock-language-list" }, te.value.map((e) => {
3326
+ }), Q("search")]), B("div", { class: "markweave-codeblock-language-list" }, N.value.map((e) => {
3135
3327
  let t = S.value?.language === e.language;
3136
3328
  return B("button", {
3137
3329
  key: e.language,
@@ -3172,12 +3364,12 @@ var Ar = J({
3172
3364
  onBlur: () => {
3173
3365
  p.value = null;
3174
3366
  },
3175
- onClick: () => ce(-Qe)
3367
+ onClick: () => ce(-rt)
3176
3368
  }, [Q("zoomOut")]),
3177
3369
  B("span", {
3178
3370
  class: "markweave-mermaid-fullscreen-zoom-label",
3179
3371
  "data-testid": "markweave-mermaid-fullscreen-zoom-label"
3180
- }, Ve(f.value.scale)),
3372
+ }, Ke(f.value.scale)),
3181
3373
  B("button", {
3182
3374
  type: "button",
3183
3375
  class: "markweave-mermaid-fullscreen-control",
@@ -3195,7 +3387,7 @@ var Ar = J({
3195
3387
  onBlur: () => {
3196
3388
  p.value = null;
3197
3389
  },
3198
- onClick: () => ce(Qe)
3390
+ onClick: () => ce(rt)
3199
3391
  }, [Q("zoomIn")]),
3200
3392
  B("button", {
3201
3393
  type: "button",
@@ -3227,17 +3419,17 @@ var Ar = J({
3227
3419
  class: "markweave-mermaid-fullscreen-close",
3228
3420
  "aria-label": "Close fullscreen Mermaid preview",
3229
3421
  "data-testid": "markweave-mermaid-fullscreen-close",
3230
- onClick: re
3422
+ onClick: I
3231
3423
  }, [Q("close")]),
3232
3424
  B("div", {
3233
3425
  class: "markweave-mermaid-fullscreen-viewport",
3234
3426
  "data-testid": "markweave-mermaid-fullscreen-viewport",
3235
3427
  "data-dragging": m.value ? "true" : "false",
3236
- onWheel: ue,
3237
- onMousedown: de,
3238
- onMousemove: fe,
3239
- onMouseup: pe,
3240
- onMouseleave: pe
3428
+ onWheel: z,
3429
+ onMousedown: ue,
3430
+ onMousemove: de,
3431
+ onMouseup: fe,
3432
+ onMouseleave: fe
3241
3433
  }, [B("div", {
3242
3434
  class: "markweave-mermaid-fullscreen-content",
3243
3435
  "data-testid": "markweave-mermaid-fullscreen-content",
@@ -3254,7 +3446,7 @@ var Ar = J({
3254
3446
  ]);
3255
3447
  };
3256
3448
  }
3257
- }), Ir = J({
3449
+ }), Gr = J({
3258
3450
  name: "MarkweaveVueInnerToc",
3259
3451
  props: {
3260
3452
  editor: {
@@ -3280,7 +3472,7 @@ var Ar = J({
3280
3472
  },
3281
3473
  setup(e) {
3282
3474
  let t = V(null), n, r = () => {
3283
- n?.(), n = e.placement === "container" && t.value ? Se(t.value) : void 0;
3475
+ n?.(), n = e.placement === "container" && t.value ? De(t.value) : void 0;
3284
3476
  };
3285
3477
  return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
3286
3478
  ref: t,
@@ -3303,33 +3495,34 @@ var Ar = J({
3303
3495
  "aria-current": t.active ? "location" : void 0,
3304
3496
  "aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
3305
3497
  title: t.text,
3306
- onClick: () => Ce(e.editor, t, {
3498
+ onClick: () => Oe(e.editor, t, {
3307
3499
  behavior: "smooth",
3308
3500
  focus: e.editable
3309
3501
  })
3310
3502
  }, t.text)))])]) : null;
3311
3503
  }
3312
3504
  });
3313
- function Lr(e = {}) {
3314
- let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => he(e.theme)), s = U(() => a.value === "live" && e.editable !== !1), c = V(0), d = H(null), h = V(Tt), g = H(null), _ = H(null), v = V("code"), y = H(null), b = H(Mt), x = V(null), S = V(!1), C = H(null), w = I(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = null;
3505
+ function Kr(e = {}) {
3506
+ let i = r(e.lang), o = n(i), s = t(i), c = V(f(e.mode)), l = U(() => be(e.theme)), u = U(() => c.value === "live" && e.editable !== !1), d = V(0), m = H(null), h = V(At), g = H(null), _ = H(null), v = V("code"), y = H(null), b = H(Lt), x = V(null), S = V(!1), C = H(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = null;
3315
3507
  function E() {
3316
- T !== null && (window.clearTimeout(T), T = null), c.value += 1;
3508
+ T !== null && (window.clearTimeout(T), T = null), d.value += 1;
3317
3509
  }
3318
3510
  function ee() {
3319
3511
  T !== null && window.clearTimeout(T), T = window.setTimeout(() => {
3320
- T = null, c.value += 1;
3321
- }, me);
3512
+ T = null, d.value += 1;
3513
+ }, ve);
3322
3514
  }
3323
3515
  let D = e.onSlashCommandUpload, O = H(null);
3324
- O.value = new n({
3325
- extensions: vr({
3326
- lang: t,
3327
- onImageUpload: (e) => D?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
3328
- onVideoUpload: (e) => D?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
3516
+ O.value = new a({
3517
+ extensions: Dr({
3518
+ lang: i,
3519
+ linkCardResolver: e.linkCardResolver,
3520
+ onImageUpload: (e) => D?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
3521
+ onVideoUpload: (e) => D?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
3329
3522
  }),
3330
3523
  content: e.content ?? e.defaultContent ?? "",
3331
- contentType: P(w),
3332
- editable: s.value,
3524
+ contentType: re(w),
3525
+ editable: u.value,
3333
3526
  autofocus: e.autofocus,
3334
3527
  editorProps: {
3335
3528
  attributes: {
@@ -3341,36 +3534,36 @@ function Lr(e = {}) {
3341
3534
  translate: "no"
3342
3535
  },
3343
3536
  handleClick: (e, t, n) => {
3344
- if (!s.value) return le(n);
3345
- let r = st(e, n);
3346
- return r ? (n.preventDefault(), n.stopPropagation(), j(), dt(e, r, !0), ft(e, r), y.value = r, !0) : (y.value = null, !1);
3537
+ if (!u.value) return pe(n);
3538
+ let r = ft(e, n);
3539
+ return r ? (n.preventDefault(), n.stopPropagation(), A(), gt(e, r, !0), _t(e, r), y.value = r, !0) : (y.value = null, !1);
3347
3540
  },
3348
3541
  handleDOMEvents: {
3349
- compositionstart: () => s.value ? (h.value = Et(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
3350
- compositionend: (e) => (s.value && window.setTimeout(() => M(e), 0), !1),
3542
+ compositionstart: () => u.value ? (h.value = jt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
3543
+ compositionend: (e) => (u.value && window.setTimeout(() => j(e), 0), !1),
3351
3544
  click: (e, t) => {
3352
- if (!s.value) return le(t);
3353
- let n = st(e, t);
3354
- return n ? (t.preventDefault(), t.stopPropagation(), j(), dt(e, n, !0), ft(e, n), y.value = n, !0) : (y.value = null, !1);
3545
+ if (!u.value) return pe(t);
3546
+ let n = ft(e, t);
3547
+ return n ? (t.preventDefault(), t.stopPropagation(), A(), gt(e, n, !0), _t(e, n), y.value = n, !0) : (y.value = null, !1);
3355
3548
  }
3356
3549
  }
3357
3550
  },
3358
- onSelectionUpdate: ({ editor: e }) => L(e),
3551
+ onSelectionUpdate: ({ editor: e }) => N(e),
3359
3552
  onCreate: ({ editor: t }) => {
3360
- u(t, {
3361
- mode: a.value,
3362
- editable: s.value
3363
- }), mt(t, o.value), ht(t, s.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && s.value && kt(t), R(t), L(t), E();
3553
+ p(t, {
3554
+ mode: c.value,
3555
+ editable: u.value
3556
+ }), yt(t, l.value), bt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Pt(t), P(t), N(t), E();
3364
3557
  },
3365
3558
  onTransaction: ({ editor: e, transaction: t }) => {
3366
- if (R(e), (t.docChanged || pt(t)) && ee(), t.docChanged && y.value) {
3367
- let t = ot(e, y.value.pos);
3559
+ if (P(e), (t.docChanged || vt(t)) && ee(), t.docChanged && y.value) {
3560
+ let t = dt(e, y.value.pos);
3368
3561
  y.value = t?.kind === y.value.kind ? t : null;
3369
3562
  }
3370
3563
  },
3371
3564
  onUpdate: ({ editor: t }) => {
3372
- L(t), s.value && N(t), S.value || e.onUpdate?.(ne(t, { onContentRead: (n, r) => {
3373
- let i = I(e.contentFormat);
3565
+ N(t), u.value && M(t), S.value || e.onUpdate?.(ne(t, { onContentRead: (n, r) => {
3566
+ let i = oe(e.contentFormat);
3374
3567
  e.content !== void 0 && n === i && (C.value = {
3375
3568
  content: r,
3376
3569
  format: n,
@@ -3380,119 +3573,119 @@ function Lr(e = {}) {
3380
3573
  }
3381
3574
  });
3382
3575
  let k = U(() => O.value ?? null);
3383
- function j() {
3384
- g.value = null, _.value = null, h.value = Tt;
3576
+ function A() {
3577
+ g.value = null, _.value = null, h.value = At;
3385
3578
  }
3386
- function M(e) {
3387
- let t = wt(e.state);
3579
+ function j(e) {
3580
+ let t = kt(e.state);
3388
3581
  if (!t) {
3389
- h.value = h.value.name === "idle" ? h.value : Tt, g.value = null, _.value = null;
3582
+ h.value = h.value.name === "idle" ? h.value : At, g.value = null, _.value = null;
3390
3583
  return;
3391
3584
  }
3392
3585
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3393
- g.value = Ct(n, {
3586
+ g.value = Ot(n, {
3394
3587
  frameRect: i,
3395
3588
  triggerRect: r
3396
- }), h.value = St(h.value, t);
3589
+ }), h.value = Dt(h.value, t);
3397
3590
  }
3398
- function N(e) {
3399
- M(e.view);
3591
+ function M(e) {
3592
+ j(e.view);
3400
3593
  }
3401
- function L(e) {
3402
- let t = pe(e);
3403
- de(d.value, t) || (d.value = t);
3404
- let n = ct(e);
3405
- n && (ut(e, n, !0), y.value = n);
3406
- let r = Ee(e);
3594
+ function N(e) {
3595
+ let t = _e(e);
3596
+ he(m.value, t) || (m.value = t);
3597
+ let n = pt(e);
3598
+ n && (ht(e, n, !0), y.value = n);
3599
+ let r = je(e);
3407
3600
  r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
3408
3601
  }
3409
- function R(e) {
3410
- b.value = xr(e);
3602
+ function P(e) {
3603
+ b.value = Ar(e);
3411
3604
  }
3412
- let ie = U(() => k.value ? Ee(k.value) : br), ae = U(() => k.value ? At(k.value.state) : yr), oe = U(() => d.value?.currentNode === "codeBlock"), se = U(() => oe.value && ie.value.language === "mermaid"), ce = U(() => k.value ? _t({
3605
+ let F = U(() => k.value ? je(k.value) : kr), I = U(() => k.value ? Ft(k.value.state) : Or), R = U(() => m.value?.currentNode === "codeBlock"), se = U(() => R.value && F.value.language === "mermaid"), ce = U(() => k.value ? St({
3413
3606
  active: se.value,
3414
3607
  mode: v.value,
3415
- source: ie.value.text
3416
- }) : _t({
3608
+ source: F.value.text
3609
+ }) : St({
3417
3610
  active: !1,
3418
3611
  mode: "code",
3419
3612
  source: ""
3420
- })), fe = U(() => k.value ? Ot(k.value.state) : null), z = U(() => k.value ? ye(k.value.state.doc) : _e.items), xe = U(() => be(z.value, x.value)), Se = U(() => ge(z.value, xe.value)), Ce = U(() => vt(h.value.query, i)), we = U(() => ue({
3421
- revision: c.value,
3422
- mode: a.value,
3423
- editable: s.value,
3424
- toc: Se.value,
3425
- selection: d.value,
3613
+ })), le = U(() => k.value ? Nt(k.value.state) : null), z = U(() => k.value ? we(k.value.state.doc) : Se.items), ue = U(() => Te(z.value, x.value)), de = U(() => xe(z.value, ue.value)), fe = U(() => Ct(h.value.query, s)), ge = U(() => me({
3614
+ revision: d.value,
3615
+ mode: c.value,
3616
+ editable: u.value,
3617
+ toc: de.value,
3618
+ selection: m.value,
3426
3619
  slash: h.value,
3427
- table: ae.value,
3620
+ table: I.value,
3428
3621
  tableInteraction: b.value,
3429
- codeBlock: ie.value,
3622
+ codeBlock: F.value,
3430
3623
  mermaid: ce.value,
3431
- tableDebugSnapshot: fe.value
3432
- })), Te = {
3433
- closeSlashMenu: j,
3434
- focusFirstTableBodyCell: () => k.value ? kt(k.value) : !1,
3624
+ tableDebugSnapshot: le.value
3625
+ })), ye = {
3626
+ closeSlashMenu: A,
3627
+ focusFirstTableBodyCell: () => k.value ? Pt(k.value) : !1,
3435
3628
  setContent: (e, t = {}) => {
3436
3629
  if (!k.value) return !1;
3437
- let n = I(t.format);
3630
+ let n = oe(t.format);
3438
3631
  return k.value.commands.setContent(e, {
3439
- contentType: P(n),
3632
+ contentType: re(n),
3440
3633
  emitUpdate: t.emitUpdate ?? !1
3441
- }), t.focusFirstTableBodyCell && kt(k.value), L(k.value), s.value && N(k.value), R(k.value), E(), !0;
3634
+ }), t.focusFirstTableBodyCell && Pt(k.value), N(k.value), u.value && M(k.value), P(k.value), E(), !0;
3442
3635
  }
3443
3636
  };
3444
- function De(e, t) {
3445
- if (!(!k.value || !s.value || !yt(e))) {
3637
+ function Ee(e, t) {
3638
+ if (!(!k.value || !u.value || !wt(e))) {
3446
3639
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
3447
3640
  _.value = e;
3448
3641
  return;
3449
3642
  }
3450
- xt(k.value, h.value, e, t), h.value = Et(h.value, { type: "execute" }), j();
3643
+ Et(k.value, h.value, e, t), h.value = jt(h.value, { type: "execute" }), A();
3451
3644
  }
3452
3645
  }
3453
- function Oe(e) {
3454
- if (!k.value || _.value || !s.value) return;
3455
- let t = bt(h.value, Ce.value, e.key, { isComposing: e.isComposing || te(k.value.state) });
3646
+ function De(e) {
3647
+ if (!k.value || _.value || !u.value) return;
3648
+ let t = Tt(h.value, fe.value, e.key, { isComposing: e.isComposing || L(k.value.state) });
3456
3649
  if (t.type !== "ignore") {
3457
3650
  if (e.preventDefault(), t.type === "close") {
3458
- h.value = Et(h.value, { type: "escape" }), j();
3651
+ h.value = jt(h.value, { type: "escape" }), A();
3459
3652
  return;
3460
3653
  }
3461
3654
  if (t.type === "move-active") {
3462
- h.value = Et(h.value, {
3655
+ h.value = jt(h.value, {
3463
3656
  type: "move-active",
3464
3657
  delta: t.delta,
3465
3658
  optionCount: t.optionCount
3466
3659
  });
3467
3660
  return;
3468
3661
  }
3469
- De(t.command);
3662
+ Ee(t.command);
3470
3663
  }
3471
3664
  }
3472
3665
  W(() => [e.mode, e.editable], () => {
3473
- a.value = l(e.mode), k.value && (k.value.setEditable(s.value), u(k.value, {
3474
- mode: a.value,
3475
- editable: s.value
3476
- }), ht(k.value, s.value ? "live" : "view"), E(), s.value || j());
3666
+ c.value = f(e.mode), k.value && (k.value.setEditable(u.value), p(k.value, {
3667
+ mode: c.value,
3668
+ editable: u.value
3669
+ }), bt(k.value, u.value ? "live" : "view"), E(), u.value || A());
3477
3670
  }, { immediate: !0 }), W(() => e.theme, () => {
3478
- k.value && mt(k.value, o.value);
3671
+ k.value && yt(k.value, l.value);
3479
3672
  }, { immediate: !0 }), W(() => e.content, (t) => {
3480
- let n = I(e.contentFormat);
3673
+ let n = oe(e.contentFormat);
3481
3674
  if (!(!k.value || t === void 0)) {
3482
- if (F(k.value, C.value, t, n)) {
3675
+ if (ae(k.value, C.value, t, n)) {
3483
3676
  C.value = null;
3484
3677
  return;
3485
3678
  }
3486
- C.value = null, !re(k.value, t, n) && (S.value = !0, k.value.commands.setContent(t, {
3487
- contentType: P(n),
3679
+ C.value = null, !ie(k.value, t, n) && (S.value = !0, k.value.commands.setContent(t, {
3680
+ contentType: re(n),
3488
3681
  emitUpdate: !1
3489
- }), S.value = !1, L(k.value), s.value && N(k.value), R(k.value), E());
3682
+ }), S.value = !1, N(k.value), u.value && M(k.value), P(k.value), E());
3490
3683
  }
3491
- }), W(we, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(Se, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
3492
- let t = be(e, x.value);
3684
+ }), W(ge, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(de, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
3685
+ let t = Te(e, x.value);
3493
3686
  x.value !== t && (x.value = t);
3494
3687
  });
3495
- let ke = null;
3688
+ let Oe = null;
3496
3689
  return K(() => {
3497
3690
  T !== null && window.clearTimeout(T);
3498
3691
  }), G(() => {
@@ -3503,49 +3696,49 @@ function Lr(e = {}) {
3503
3696
  }
3504
3697
  let e = null;
3505
3698
  try {
3506
- e = ve(k.value, z.value);
3699
+ e = Ce(k.value, z.value);
3507
3700
  } catch {
3508
3701
  return;
3509
3702
  }
3510
3703
  x.value !== e && (x.value = e);
3511
- }, t = () => window.requestAnimationFrame(e), n = Sr(k.value?.view.dom ?? null);
3512
- window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), ke = () => {
3704
+ }, t = () => window.requestAnimationFrame(e), n = jr(k.value?.view.dom ?? null);
3705
+ window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
3513
3706
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
3514
3707
  };
3515
3708
  }), K(() => {
3516
- ke?.();
3709
+ Oe?.();
3517
3710
  let e = O.value;
3518
3711
  O.value = null, q(() => e?.destroy());
3519
3712
  }), {
3520
3713
  editor: k,
3521
- runtimeSnapshot: we,
3522
- actions: Te,
3714
+ runtimeSnapshot: ge,
3715
+ actions: ye,
3523
3716
  __render: {
3524
- messages: r,
3525
- effectiveEditable: s,
3526
- tableFocusState: ae,
3717
+ messages: o,
3718
+ effectiveEditable: u,
3719
+ tableFocusState: I,
3527
3720
  tableInteractionState: b,
3528
- codeBlockState: ie,
3529
- isCodeBlockActive: oe,
3721
+ codeBlockState: F,
3722
+ isCodeBlockActive: R,
3530
3723
  mermaidMode: v,
3531
3724
  mathTarget: y,
3532
3725
  setMermaidMode: (e) => {
3533
3726
  v.value = e;
3534
3727
  },
3535
- tocState: Se,
3536
- filteredSlashCommands: Ce,
3728
+ tocState: de,
3729
+ filteredSlashCommands: fe,
3537
3730
  slashState: h,
3538
3731
  slashMenuPosition: g,
3539
3732
  slashInputCommand: _,
3540
- runSlashCommand: De,
3541
- handleEditorKeyDown: Oe,
3733
+ runSlashCommand: Ee,
3734
+ handleEditorKeyDown: De,
3542
3735
  setSlashInputCommand: (e) => {
3543
3736
  _.value = e;
3544
3737
  }
3545
3738
  }
3546
3739
  };
3547
3740
  }
3548
- var Rr = J({
3741
+ var qr = J({
3549
3742
  name: "MarkweaveEditor",
3550
3743
  props: {
3551
3744
  defaultContent: {
@@ -3600,6 +3793,10 @@ var Rr = J({
3600
3793
  type: Boolean,
3601
3794
  default: !1
3602
3795
  },
3796
+ linkCardResolver: {
3797
+ type: Function,
3798
+ default: void 0
3799
+ },
3603
3800
  className: {
3604
3801
  type: String,
3605
3802
  default: void 0
@@ -3642,75 +3839,75 @@ var Rr = J({
3642
3839
  }
3643
3840
  },
3644
3841
  setup(e) {
3645
- let t = Lr(e);
3842
+ let t = Kr(e);
3646
3843
  return () => {
3647
3844
  let n = t.editor.value;
3648
3845
  if (!n) return null;
3649
- let i = t.__render;
3846
+ let r = t.__render;
3650
3847
  return B("section", {
3651
3848
  class: ["markweave-editor-frame", e.className].filter(Boolean).join(" "),
3652
- "aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
3849
+ "aria-label": e.ariaLabel ?? r.messages.common.editorAriaLabel,
3653
3850
  "data-testid": "markweave-editor-frame",
3654
3851
  "data-markweave-mode": t.runtimeSnapshot.value.mode,
3655
- "data-markweave-theme": he(e.theme),
3852
+ "data-markweave-theme": be(e.theme),
3656
3853
  "data-markweave-inner-toc": e.innerToc ? "true" : "false",
3657
- "data-markweave-inner-toc-placement": xe(e.innerTocPlacement),
3854
+ "data-markweave-inner-toc-placement": Ee(e.innerTocPlacement),
3658
3855
  "data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
3659
- "data-table-focus-mode": i.tableFocusState.value.mode,
3660
- onKeydownCapture: i.handleEditorKeyDown
3856
+ "data-table-focus-mode": r.tableFocusState.value.mode,
3857
+ onKeydownCapture: r.handleEditorKeyDown
3661
3858
  }, [
3662
- i.effectiveEditable.value ? B(Ar, {
3859
+ r.effectiveEditable.value ? B(zr, {
3663
3860
  editor: n,
3664
- messages: i.messages
3861
+ messages: r.messages
3665
3862
  }) : null,
3666
- i.effectiveEditable.value ? B(Mr, {
3667
- commands: i.filteredSlashCommands.value,
3668
- state: i.slashState.value,
3669
- position: i.slashMenuPosition.value,
3670
- inputCommand: i.slashInputCommand.value,
3671
- messages: i.messages,
3672
- onSelect: i.runSlashCommand,
3673
- onInputCommandChange: i.setSlashInputCommand,
3863
+ r.effectiveEditable.value ? B(Vr, {
3864
+ commands: r.filteredSlashCommands.value,
3865
+ state: r.slashState.value,
3866
+ position: r.slashMenuPosition.value,
3867
+ inputCommand: r.slashInputCommand.value,
3868
+ messages: r.messages,
3869
+ onSelect: r.runSlashCommand,
3870
+ onInputCommandChange: r.setSlashInputCommand,
3674
3871
  onUpload: e.onSlashCommandUpload
3675
3872
  }) : null,
3676
- i.effectiveEditable.value ? B(Nr, {
3873
+ r.effectiveEditable.value ? B(Hr, {
3677
3874
  editor: n,
3678
- active: i.tableFocusState.value.active,
3679
- interactionState: i.tableInteractionState.value,
3680
- messages: i.messages,
3875
+ active: r.tableFocusState.value.active,
3876
+ interactionState: r.tableInteractionState.value,
3877
+ messages: r.messages,
3681
3878
  onCopyPayload: e.onTableCopyPayload,
3682
3879
  onCommandResult: e.onTableCommandResult,
3683
3880
  onEditWithAi: e.onEditWithAi
3684
3881
  }) : null,
3685
- i.effectiveEditable.value ? B(Pr, {
3882
+ r.effectiveEditable.value ? B(Ur, {
3686
3883
  editor: n,
3687
- focusState: i.tableFocusState.value
3884
+ focusState: r.tableFocusState.value
3688
3885
  }) : null,
3689
- B(Fr, {
3886
+ B(Wr, {
3690
3887
  editor: n,
3691
- state: i.codeBlockState.value,
3692
- active: i.effectiveEditable.value && i.isCodeBlockActive.value,
3693
- mermaidMode: i.mermaidMode.value,
3694
- onMermaidModeChange: i.setMermaidMode,
3695
- readOnly: !i.effectiveEditable.value
3888
+ state: r.codeBlockState.value,
3889
+ active: r.effectiveEditable.value && r.isCodeBlockActive.value,
3890
+ mermaidMode: r.mermaidMode.value,
3891
+ onMermaidModeChange: r.setMermaidMode,
3892
+ readOnly: !r.effectiveEditable.value
3696
3893
  }),
3697
- e.innerToc && i.tocState.value.items.length ? B(Ir, {
3894
+ e.innerToc && r.tocState.value.items.length ? B(Gr, {
3698
3895
  editor: n,
3699
- state: i.tocState.value,
3700
- messages: i.messages,
3701
- editable: i.effectiveEditable.value,
3702
- placement: xe(e.innerTocPlacement)
3896
+ state: r.tocState.value,
3897
+ messages: r.messages,
3898
+ editable: r.effectiveEditable.value,
3899
+ placement: Ee(e.innerTocPlacement)
3703
3900
  }) : null,
3704
- i.effectiveEditable.value && i.mathTarget.value ? B(jr, {
3901
+ r.effectiveEditable.value && r.mathTarget.value ? B(Br, {
3705
3902
  editor: n,
3706
- messages: i.messages,
3707
- target: i.mathTarget.value,
3708
- onClose: () => i.mathTarget.value = null
3903
+ messages: r.messages,
3904
+ target: r.mathTarget.value,
3905
+ onClose: () => r.mathTarget.value = null
3709
3906
  }) : null,
3710
- B(r, { editor: n })
3907
+ B(o, { editor: n })
3711
3908
  ]);
3712
3909
  };
3713
3910
  }
3714
3911
  });
3715
3912
  //#endregion
3716
- export { Rr as MarkweaveEditor, vr as createMarkweaveEditorExtensions, vr as createMarkweaveVue2EditorExtensions, Lr as useMarkweaveEditorController };
3913
+ export { qr as MarkweaveEditor, Dr as createMarkweaveEditorExtensions, Dr as createMarkweaveVue2EditorExtensions, Kr as useMarkweaveEditorController };