@markweave/vue2 0.7.10 → 0.8.0
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/LICENSE +21 -21
- package/README.md +37 -37
- package/dist/index.js +744 -738
- package/dist/types/MarkweaveEditor.d.ts +2 -0
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/create-editor-extensions.d.ts +1 -0
- package/dist/types/create-editor-extensions.d.ts.map +1 -1
- package/dist/types/media-nodeviews.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -23,50 +23,49 @@ import { saveMarkweaveBrowserFile as ue } from "markweave/internal/core/browser-
|
|
|
23
23
|
import { createMarkweaveFrameScheduler as de } from "markweave/internal/editor-core/frame-scheduler";
|
|
24
24
|
import { createMarkweaveEditorUpdatePayload as fe, getMarkweaveContentType as pe, isEditorContentCurrent as me, isMarkweaveControlledContentEchoCurrent as he, normalizeMarkweaveContentFormat as ge } from "markweave/internal/editor-core/editor-content";
|
|
25
25
|
import { getCurrentFloatingToolbarBlockType as _e, getFloatingToolbarHighlightColorOptions as ve, getFloatingToolbarMoreActions as ye, getFloatingToolbarTextColorOptions as be, getFloatingToolbarTurnIntoOptions as xe, runFloatingToolbarMoreAction as Se, setFloatingToolbarTurnInto as Ce } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import { applyTableAxisAlignment as Pn, applyTableAxisBackgroundColor as Fn, applyTableAxisTextColor as In, calculateAnchoredTableMenuPosition as Ln, calculateAnchoredTableSubmenuPosition as Rn, calculateTableAxisHandleLayout as zn, calculateTableExtendButtonLayout as Bn, canRunTableCommand as Vn, executeTableMenuCommand as Hn, formatTableCopyFeedback as Un, getActiveTableElement as Wn, getAvailableCellMenuCommandSpecs as Gn, getTableAxisDropIndexAtPoint as Kn, getTableAxisFormattingState as qn, getTableAxisTargetRect as Jn, getTableControlAxisSelectionModel as Yn, getTableMenuBoundaryRect as Xn, getTableMenuItemGroup as Zn, getTableMenuItemLabel as Qn, getTableMenuItems as $n, getTableSelectionTargetRect as er, measureTableSelectionOverlay as tr, moveTargetedTableAxis as nr, selectTableAxisFromCell as rr, tableColorOptions as ir, tableCopyFeedbackTimeoutMs as ar, tableHorizontalAlignmentOptions as or, tableMenuLabel as sr, tableVerticalAlignmentOptions as cr, targetTableAxisFromCell as lr } from "markweave/internal/plugins/table/table-ui-model";
|
|
26
|
+
import { createMarkweaveEditorRuntimeSnapshot as we } from "markweave/internal/editor-core/runtime-snapshot";
|
|
27
|
+
import { areEditorSelectionSnapshotsEquivalent as Te, calculateFloatingToolbarPopoverPlacement as Ee, createSelectionSnapshot as De, markweaveRuntimeProjectionDelayMs as Oe, shouldShowFloatingToolbarForAiState as ke } from "markweave/internal/editor-core/selection-state";
|
|
28
|
+
import { normalizeMarkweaveCanvasColor as Ae, normalizeMarkweaveTheme as je } from "markweave/internal/core/theme";
|
|
29
|
+
import { createMarkweaveAiEditController as Me } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
|
|
30
|
+
import { MarkweaveAskAiError as Ne, acceptMarkweaveAskAiResult as Pe, calculateMarkweaveAskAiPanelPosition as Fe, canStartMarkweaveAskAiTableTarget as Ie, clearMarkweaveAskAiPreview as Le, clearMarkweaveAskAiTarget as Re, createMarkweaveAskAiRequest as ze, getMappedMarkweaveAskAiSelection as Be, getMarkweaveAskAiSurfaceRect as Ve, getMarkweaveAskAiTarget as He, getMarkweaveAskAiTargetRect as Ue, hasMarkweaveAskAiPreview as We, isMarkweaveAskAiSelectionEligible as Ge, restoreMarkweaveAskAiTargetSelection as Ke, runMarkweaveAskAiHandler as qe, setMarkweaveAskAiPreview as Je, startMarkweaveAskAiTableTarget as Ye, startMarkweaveAskAiTarget as Xe } from "markweave/internal/plugins/ask-ai/ask-ai-session";
|
|
31
|
+
import { createMarkweaveTocState as Ze, emptyMarkweaveTocState as Qe, getActiveMarkweaveTocId as $e, getMarkweaveInnerTocRailHeight as et, getMarkweaveTocItemsFromState as tt, getValidMarkweaveTocActiveId as nt, normalizeMarkweaveInnerTocPlacement as rt, observeMarkweaveInnerTocContainerPosition as it, observeMarkweaveInnerTocRailOverflow as at, scrollToMarkweaveTocItem as ot } from "markweave/internal/core/toc-state";
|
|
32
|
+
import { codeBlockCollapsePluginKey as st, copyActiveCodeBlock as ct, getActiveCodeBlockState as lt, getCodeBlockCopyFeedbackSnapshot as ut, markweaveCodeBlockBehavior as dt, setCodeBlockCollapsedAtPosition as ft, setCodeBlockLanguageAtPosition as pt, setCodeBlockMermaidPreviewModeAtPosition as mt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
33
|
+
import { calculateCodeBlockLanguageMenuPosition as ht, clampFullscreenScale as gt, codeBlockCopyFeedbackTimeoutMs as _t, copyCodeBlockText as vt, createCodeBlockLanguageMenuDomId as yt, createCodeBlockOverlayPosition as bt, createMermaidFullscreenViewerState as xt, createMermaidTabPosition as St, focusCodeBlockTarget as Ct, formatCodeBlockLanguageLabel as wt, formatFullscreenZoom as Tt, getActiveCodeBlockElement as Et, getAnchoredRect as Dt, getCodeBlockLanguageItems as Ot, getCodeBlockLanguageOptionDomId as kt, getCodeBlockPositionFromEventTarget as At, getCodeBlockStateAtPosition as jt, getFrameElement as Mt, getInitialCodeBlockLanguageItemIndex as Nt, getMermaidCodeBlockTargets as Pt, getMermaidSvgMarkup as Ft, isCodeBlockTargetCollapsed as It, mergeStableMermaidTabPositions as Lt, mermaidFullscreenZoomStep as Rt, moveCodeBlockLanguageItemIndex as zt, moveMermaidFullscreenViewer as Bt, scrollCodeBlockLanguageItemIntoView as Vt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
34
|
+
import { normalizeMarkdownLinkHref as Ht } from "markweave/internal/plugins/markdown/markdown-input";
|
|
35
|
+
import { applyMarkweaveMathLatex as Ut, calculateMarkweaveMathPopoverPosition as Wt, getMarkweaveMathAnchorRect as Gt, getMarkweaveMathBlockIndex as Kt, getMarkweaveMathRenderedHtml as qt, getMarkweaveMathTargetAtPos as Jt, getMarkweaveMathTargetFromDomEvent as Yt, getMarkweaveMathTargetFromSelection as Xt, renderMarkweaveMathPreview as Zt, setMarkweaveMathEditingDomState as Qt, setMarkweaveMathEditingDomStateInView as $t, setMarkweaveMathSelectionInView as en } from "markweave/internal/plugins/math/math-ui-model";
|
|
36
|
+
import { isMermaidInlinePreviewTransaction as tn, setMarkweaveMermaidTheme as nn, setMermaidInlinePreviewEditorMode as rn, setReadonlyMermaidPreviewMode as an } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
37
|
+
import { getMermaidPreviewState as on } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
38
|
+
import { createResolvedSlashCommandSpecs as sn, getSlashCommandTextIconLength as cn, isExecutableSlashCommand as ln } from "markweave/internal/plugins/slash-command/command-spec";
|
|
39
|
+
import { getSlashCommandKeyboardAction as un } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
40
|
+
import { scrollSlashCommandItemIntoView as dn } from "markweave/internal/plugins/slash-command/slash-menu-scroll";
|
|
41
|
+
import { areSlashCommandMenuPositionsEquivalent as fn, getNextSlashCommandState as pn, getSlashCommandAnchoredMenuPosition as mn, getSlashCommandContext as hn, isMarkweaveSlashMenuScrollTarget as gn, isSlashCommandAnchorVisible as _n } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
42
|
+
import { createMarkweaveCommandController as vn, executeMarkweaveSlashCommand as yn, setMarkweaveCommandContentFormat as bn, setMarkweaveCommandRegistry as xn } from "markweave/internal/commands/command-runtime";
|
|
43
|
+
import { createMarkweaveCommandRegistry as Sn } from "markweave/internal/commands/command-registry";
|
|
44
|
+
import { initialSlashCommandState as Cn, reduceSlashCommandState as wn } from "markweave/internal/plugins/slash-command/slash-state";
|
|
45
|
+
import { setMarkweaveTableMenuAxisTarget as Tn } from "markweave/internal/plugins/table/table-clipboard";
|
|
46
|
+
import { isMarkweaveTableCapabilityAllowed as En } from "markweave/internal/plugins/table/table-capabilities";
|
|
47
|
+
import { getFirstTableDebugSnapshot as Dn } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
48
|
+
import { focusFirstTableBodyCell as On } from "markweave/internal/plugins/table/table-focus-position";
|
|
49
|
+
import { getTableFocusState as kn } from "markweave/internal/plugins/table/table-focus-state";
|
|
50
|
+
import { getTableSelectionOverlayState as An, initialTableInteractionState as jn, tableInteractionPluginKey as Mn } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
51
|
+
import { applyTableAxisAlignment as Nn, applyTableAxisBackgroundColor as Pn, applyTableAxisTextColor as Fn, calculateAnchoredTableMenuPosition as In, calculateAnchoredTableSubmenuPosition as Ln, calculateTableAxisHandleLayout as Rn, calculateTableExtendButtonLayout as zn, canRunTableCommand as Bn, executeTableMenuCommand as Vn, formatTableCopyFeedback as Hn, getActiveTableElement as Un, getAvailableCellMenuCommandSpecs as Wn, getTableAxisDropIndexAtPoint as Gn, getTableAxisFormattingState as Kn, getTableAxisTargetRect as qn, getTableControlAxisSelectionModel as Jn, getTableMenuBoundaryRect as Yn, getTableMenuItemGroup as Xn, getTableMenuItemLabel as Zn, getTableMenuItems as Qn, getTableSelectionTargetRect as $n, measureTableSelectionOverlay as er, moveTargetedTableAxis as tr, selectTableAxisFromCell as nr, tableColorOptions as rr, tableCopyFeedbackTimeoutMs as ir, tableHorizontalAlignmentOptions as ar, tableMenuLabel as or, tableVerticalAlignmentOptions as sr, targetTableAxisFromCell as cr } from "markweave/internal/plugins/table/table-ui-model";
|
|
53
52
|
//#region src/vue2-compat.ts
|
|
54
|
-
var
|
|
55
|
-
function
|
|
53
|
+
var lr = c.default ?? c, ur = null, dr = null, fr = null;
|
|
54
|
+
function pr(e) {
|
|
56
55
|
return !!(e && typeof e == "object" && "value" in e);
|
|
57
56
|
}
|
|
58
|
-
function
|
|
57
|
+
function mr(e) {
|
|
59
58
|
let t = e.slice(2);
|
|
60
59
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
61
60
|
}
|
|
62
|
-
function
|
|
61
|
+
function hr(e) {
|
|
63
62
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
64
63
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
65
64
|
if (o === "class" || o === "style" || o === "key") {
|
|
66
65
|
t[o] = s;
|
|
67
66
|
continue;
|
|
68
67
|
}
|
|
69
|
-
if (o === "ref" &&
|
|
68
|
+
if (o === "ref" && pr(s)) {
|
|
70
69
|
a.insert = (e) => {
|
|
71
70
|
s.value = e.elm;
|
|
72
71
|
}, a.destroy = () => {
|
|
@@ -75,7 +74,7 @@ function gr(e) {
|
|
|
75
74
|
continue;
|
|
76
75
|
}
|
|
77
76
|
if (/^on[A-Z]/.test(o)) {
|
|
78
|
-
i[
|
|
77
|
+
i[mr(o)] = s;
|
|
79
78
|
continue;
|
|
80
79
|
}
|
|
81
80
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -86,14 +85,14 @@ function gr(e) {
|
|
|
86
85
|
}
|
|
87
86
|
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;
|
|
88
87
|
}
|
|
89
|
-
function
|
|
88
|
+
function gr(e) {
|
|
90
89
|
let t = {}, n = {}, r = {}, i = {};
|
|
91
90
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
92
91
|
if (a === "class" || a === "style" || a === "key") {
|
|
93
92
|
t[a] = o;
|
|
94
93
|
continue;
|
|
95
94
|
}
|
|
96
|
-
if (a === "ref" &&
|
|
95
|
+
if (a === "ref" && pr(o)) {
|
|
97
96
|
i.insert = (e) => {
|
|
98
97
|
o.value = e.componentInstance ?? e.elm;
|
|
99
98
|
}, i.destroy = () => {
|
|
@@ -109,27 +108,27 @@ function _r(e) {
|
|
|
109
108
|
}
|
|
110
109
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
111
110
|
}
|
|
112
|
-
function
|
|
111
|
+
function _r(e) {
|
|
113
112
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
114
113
|
}
|
|
115
|
-
function
|
|
114
|
+
function vr(e) {
|
|
116
115
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
117
116
|
}
|
|
118
|
-
function
|
|
117
|
+
function yr(e) {
|
|
119
118
|
return e == null || Array.isArray(e) ? e : [e];
|
|
120
119
|
}
|
|
121
|
-
function
|
|
122
|
-
return typeof e == "function" ?
|
|
120
|
+
function br(e) {
|
|
121
|
+
return typeof e == "function" ? yr(e()) : _r(e) ? yr(e.default()) : vr(e) ? [e] : e;
|
|
123
122
|
}
|
|
124
123
|
function U(e, t, n) {
|
|
125
|
-
if (!
|
|
126
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
127
|
-
return
|
|
124
|
+
if (!fr) throw Error("Vue 2 render context is not available.");
|
|
125
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? hr(r) : gr(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : br(n);
|
|
126
|
+
return fr(e, i, a);
|
|
128
127
|
}
|
|
129
128
|
function W(e) {
|
|
130
|
-
return
|
|
129
|
+
return lr.observable({ value: e });
|
|
131
130
|
}
|
|
132
|
-
var
|
|
131
|
+
var xr = W;
|
|
133
132
|
function G(e) {
|
|
134
133
|
return { get value() {
|
|
135
134
|
return e();
|
|
@@ -137,19 +136,19 @@ function G(e) {
|
|
|
137
136
|
}
|
|
138
137
|
function K(e, t, n) {
|
|
139
138
|
let r = typeof e == "function" ? e : () => e.value;
|
|
140
|
-
return
|
|
139
|
+
return ur?.$watch ? ur.$watch(r, t, n) : () => void 0;
|
|
141
140
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
141
|
+
function Sr(e) {
|
|
142
|
+
dr?.mounted.push(e);
|
|
144
143
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
144
|
+
function Cr(e) {
|
|
145
|
+
dr?.beforeUnmount.push(e);
|
|
147
146
|
}
|
|
148
147
|
function q(e) {
|
|
149
|
-
return
|
|
148
|
+
return lr.nextTick(e);
|
|
150
149
|
}
|
|
151
150
|
function J(e) {
|
|
152
|
-
return
|
|
151
|
+
return lr.extend({
|
|
153
152
|
name: e.name,
|
|
154
153
|
props: e.props,
|
|
155
154
|
created() {
|
|
@@ -157,12 +156,12 @@ function J(e) {
|
|
|
157
156
|
mounted: [],
|
|
158
157
|
beforeUnmount: []
|
|
159
158
|
};
|
|
160
|
-
|
|
159
|
+
ur = this, dr = t;
|
|
161
160
|
try {
|
|
162
161
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
163
162
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
164
163
|
} finally {
|
|
165
|
-
|
|
164
|
+
ur = null, dr = null;
|
|
166
165
|
}
|
|
167
166
|
},
|
|
168
167
|
mounted() {
|
|
@@ -172,19 +171,19 @@ function J(e) {
|
|
|
172
171
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
173
172
|
},
|
|
174
173
|
render(t) {
|
|
175
|
-
|
|
174
|
+
fr = t;
|
|
176
175
|
try {
|
|
177
176
|
let n = this.__markweaveVue2Render;
|
|
178
177
|
return n ? n() : e.render?.(t) ?? null;
|
|
179
178
|
} finally {
|
|
180
|
-
|
|
179
|
+
fr = null;
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
});
|
|
184
183
|
}
|
|
185
184
|
//#endregion
|
|
186
185
|
//#region src/vue2-icons.ts
|
|
187
|
-
var
|
|
186
|
+
var wr = {
|
|
188
187
|
AlignVerticalJustifyCenter: {
|
|
189
188
|
iconName: "align-vertical-justify-center",
|
|
190
189
|
node: [
|
|
@@ -1506,7 +1505,7 @@ var Tr = {
|
|
|
1506
1505
|
}]]
|
|
1507
1506
|
}
|
|
1508
1507
|
};
|
|
1509
|
-
function
|
|
1508
|
+
function Tr(e) {
|
|
1510
1509
|
return e.map(([e, t]) => U(e, t));
|
|
1511
1510
|
}
|
|
1512
1511
|
function Y(e) {
|
|
@@ -1527,7 +1526,7 @@ function Y(e) {
|
|
|
1527
1526
|
}
|
|
1528
1527
|
},
|
|
1529
1528
|
setup(t) {
|
|
1530
|
-
let n =
|
|
1529
|
+
let n = wr[e];
|
|
1531
1530
|
return () => U("svg", {
|
|
1532
1531
|
class: `lucide lucide-${n.iconName}`,
|
|
1533
1532
|
viewBox: "0 0 24 24",
|
|
@@ -1540,12 +1539,12 @@ function Y(e) {
|
|
|
1540
1539
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1541
1540
|
"aria-hidden": "true",
|
|
1542
1541
|
focusable: "false"
|
|
1543
|
-
},
|
|
1542
|
+
}, Tr(n.node));
|
|
1544
1543
|
}
|
|
1545
1544
|
});
|
|
1546
1545
|
}
|
|
1547
|
-
var
|
|
1548
|
-
function
|
|
1546
|
+
var Er = Y("AlignCenter"), Dr = Y("AlignJustify"), Or = Y("AlignLeft"), kr = Y("AlignRight"), Ar = Y("AlignVerticalJustifyCenter"), jr = Y("AlignVerticalJustifyEnd"), Mr = Y("AlignVerticalJustifyStart"), Nr = Y("AlertTriangle"), Pr = Y("ArrowDown"), Fr = Y("ArrowDownAZ"), Ir = Y("ArrowLeft"), Lr = Y("ArrowRight"), Rr = Y("ArrowUp"), zr = Y("ArrowUpZA"), Br = Y("BetweenHorizontalEnd"), Vr = Y("BetweenHorizontalStart"), Hr = Y("BetweenVerticalEnd"), Ur = Y("BetweenVerticalStart"), Wr = Y("Bold"), Gr = Y("Braces"), Kr = Y("Captions"), qr = Y("Check"), Jr = Y("CheckCircle2"), Yr = Y("ChevronDown"), Xr = Y("ChevronRight"), Zr = Y("ChevronUp"), Qr = Y("CircleX"), $r = Y("Code2"), ei = Y("CornerDownLeft"), ti = Y("Copy"), ni = Y("Download"), ri = Y("Eye"), ii = Y("ExternalLink"), ai = Y("Heading1"), oi = Y("Heading2"), si = Y("Heading3"), ci = Y("Image"), li = Y("ImageUp"), ui = Y("IndentDecrease"), di = Y("IndentIncrease"), fi = Y("Info"), pi = Y("Italic"), mi = Y("Lightbulb"), hi = Y("Link2"), gi = Y("List"), _i = Y("ListChecks"), vi = Y("ListOrdered"), yi = Y("Minus"), bi = Y("MoreVertical"), xi = Y("PaintBucket"), Si = Y("Paperclip"), Ci = Y("PencilLine"), wi = Y("Plus"), Ti = Y("Quote"), Ei = Y("Replace"), Di = Y("RotateCcw"), Oi = Y("Sigma"), ki = Y("SmilePlus"), Ai = Y("Sparkles"), ji = Y("Square"), Mi = Y("SquareX"), Ni = Y("Strikethrough"), Pi = Y("Subscript"), Fi = Y("Superscript"), Ii = Y("Table2"), Li = Y("TableCellsMerge"), Ri = Y("TableCellsSplit"), zi = Y("Text"), Bi = Y("Trash2"), Vi = Y("Type"), Hi = Y("Underline"), Ui = Y("Upload"), Wi = Y("Video"), Gi = Y("X"), Ki = M;
|
|
1547
|
+
function qi(e) {
|
|
1549
1548
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1550
1549
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1551
1550
|
return n === "view" ? {
|
|
@@ -1563,27 +1562,27 @@ function Ji(e) {
|
|
|
1563
1562
|
return a && t && a.observe(t, {
|
|
1564
1563
|
attributes: !0,
|
|
1565
1564
|
attributeFilter: ["data-markweave-mode"]
|
|
1566
|
-
}),
|
|
1565
|
+
}), Cr(() => {
|
|
1567
1566
|
i(), a?.disconnect();
|
|
1568
1567
|
}), r;
|
|
1569
1568
|
}
|
|
1570
|
-
function
|
|
1569
|
+
function Ji(e) {
|
|
1571
1570
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1572
1571
|
}
|
|
1573
|
-
function
|
|
1572
|
+
function Yi(e) {
|
|
1574
1573
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1575
1574
|
}
|
|
1576
|
-
function
|
|
1575
|
+
function Xi(e) {
|
|
1577
1576
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1578
1577
|
}
|
|
1579
|
-
function
|
|
1578
|
+
function Zi(e, t) {
|
|
1580
1579
|
return U(e, {
|
|
1581
1580
|
size: 18,
|
|
1582
1581
|
strokeWidth: 1.8,
|
|
1583
1582
|
"aria-hidden": "true"
|
|
1584
1583
|
}, { default: () => t });
|
|
1585
1584
|
}
|
|
1586
|
-
function
|
|
1585
|
+
function Qi(e) {
|
|
1587
1586
|
return U("button", {
|
|
1588
1587
|
type: "button",
|
|
1589
1588
|
"aria-label": e.label,
|
|
@@ -1592,12 +1591,12 @@ function $i(e) {
|
|
|
1592
1591
|
"data-active": e.active ? "true" : "false",
|
|
1593
1592
|
onMousedown: (e) => e.preventDefault(),
|
|
1594
1593
|
onClick: e.onClick
|
|
1595
|
-
}, [
|
|
1594
|
+
}, [Zi(e.icon, e.label), U("span", {
|
|
1596
1595
|
class: "markweave-image-tooltip",
|
|
1597
1596
|
role: "tooltip"
|
|
1598
1597
|
}, e.label)]);
|
|
1599
1598
|
}
|
|
1600
|
-
function
|
|
1599
|
+
function $i(e) {
|
|
1601
1600
|
let t = W(null), n = e.messages.image;
|
|
1602
1601
|
return U("section", {
|
|
1603
1602
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1639,7 +1638,7 @@ function ea(e) {
|
|
|
1639
1638
|
U("span", {
|
|
1640
1639
|
class: "markweave-image-upload-icon",
|
|
1641
1640
|
"aria-hidden": "true"
|
|
1642
|
-
}, [U(
|
|
1641
|
+
}, [U(li, {
|
|
1643
1642
|
size: 16,
|
|
1644
1643
|
strokeWidth: 1.8
|
|
1645
1644
|
})]),
|
|
@@ -1665,7 +1664,7 @@ function ea(e) {
|
|
|
1665
1664
|
"data-testid": "markweave-image-upload-submit",
|
|
1666
1665
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1667
1666
|
onClick: e.onSubmit
|
|
1668
|
-
}, [U(
|
|
1667
|
+
}, [U(li, {
|
|
1669
1668
|
size: 16,
|
|
1670
1669
|
strokeWidth: 1.8
|
|
1671
1670
|
}), e.messages.common.insert]),
|
|
@@ -1681,7 +1680,7 @@ function ea(e) {
|
|
|
1681
1680
|
}, e.error) : null
|
|
1682
1681
|
]);
|
|
1683
1682
|
}
|
|
1684
|
-
function
|
|
1683
|
+
function ea(e) {
|
|
1685
1684
|
let t = W(null), n = e.messages.video;
|
|
1686
1685
|
return U("section", {
|
|
1687
1686
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1723,7 +1722,7 @@ function ta(e) {
|
|
|
1723
1722
|
U("span", {
|
|
1724
1723
|
class: "markweave-video-upload-icon",
|
|
1725
1724
|
"aria-hidden": "true"
|
|
1726
|
-
}, [U(
|
|
1725
|
+
}, [U(Wi, {
|
|
1727
1726
|
size: 16,
|
|
1728
1727
|
strokeWidth: 1.8
|
|
1729
1728
|
})]),
|
|
@@ -1749,7 +1748,7 @@ function ta(e) {
|
|
|
1749
1748
|
"data-testid": "markweave-video-upload-submit",
|
|
1750
1749
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1751
1750
|
onClick: e.onSubmit
|
|
1752
|
-
}, [U(
|
|
1751
|
+
}, [U(Ui, {
|
|
1753
1752
|
size: 16,
|
|
1754
1753
|
strokeWidth: 1.8
|
|
1755
1754
|
}), e.messages.common.insert]),
|
|
@@ -1765,7 +1764,7 @@ function ta(e) {
|
|
|
1765
1764
|
}, e.error) : null
|
|
1766
1765
|
]);
|
|
1767
1766
|
}
|
|
1768
|
-
var
|
|
1767
|
+
var ta = J({
|
|
1769
1768
|
name: "MarkweaveVueImageNodeView",
|
|
1770
1769
|
props: {
|
|
1771
1770
|
editor: {
|
|
@@ -1798,7 +1797,7 @@ var na = J({
|
|
|
1798
1797
|
}
|
|
1799
1798
|
},
|
|
1800
1799
|
setup(e) {
|
|
1801
|
-
let n = W(null), r = W(!1), i = W(!1), a = W(!1), s = W(""), c = W(null), l = W(!1), d = G(() => e.node.attrs), f = W(!!F(d.value.caption)), p = W(F(d.value.caption) ?? ""), m =
|
|
1800
|
+
let n = W(null), r = W(!1), i = W(!1), a = W(!1), s = W(""), c = W(null), l = W(!1), d = G(() => e.node.attrs), f = W(!!F(d.value.caption)), p = W(F(d.value.caption) ?? ""), m = qi(e.editor), h = G(() => u(m.value)), g = G(() => e.extension.options?.messages ?? t("zh")), _ = G(() => g.value.image), v = G(() => F(d.value.src)), b = G(() => e.extension.options?.resolveMediaSource), S = W(null), C = null;
|
|
1802
1801
|
K(v, (t) => {
|
|
1803
1802
|
if (C?.abort(), C = null, !t) {
|
|
1804
1803
|
S.value = null;
|
|
@@ -1818,8 +1817,8 @@ var na = J({
|
|
|
1818
1817
|
}).then((e) => {
|
|
1819
1818
|
r.signal.aborted || (S.value = e);
|
|
1820
1819
|
});
|
|
1821
|
-
}, { immediate: !0 }),
|
|
1822
|
-
let T = G(() => S.value?.src ?? (b.value ? null : v.value)), E = G(() =>
|
|
1820
|
+
}, { immediate: !0 }), Cr(() => C?.abort());
|
|
1821
|
+
let T = G(() => S.value?.src ?? (b.value ? null : v.value)), E = G(() => Ki(d.value.align)), k = G(() => P(d.value.width)), j = G(() => F(d.value.caption)), M = G(() => h.value && (!v.value || i.value)), N = () => {
|
|
1823
1822
|
T.value && y({
|
|
1824
1823
|
src: T.value,
|
|
1825
1824
|
alt: F(d.value.alt) ?? "",
|
|
@@ -1892,7 +1891,7 @@ var na = J({
|
|
|
1892
1891
|
"data-selected": "false",
|
|
1893
1892
|
"data-hovered": "false",
|
|
1894
1893
|
"data-empty": "true"
|
|
1895
|
-
}, () =>
|
|
1894
|
+
}, () => $i({
|
|
1896
1895
|
messages: g.value,
|
|
1897
1896
|
inputValue: s.value,
|
|
1898
1897
|
error: c.value,
|
|
@@ -1922,7 +1921,7 @@ var na = J({
|
|
|
1922
1921
|
r.value = !1;
|
|
1923
1922
|
},
|
|
1924
1923
|
onMousedown: (e) => {
|
|
1925
|
-
h.value && !
|
|
1924
|
+
h.value && !Ji(e.target) && I();
|
|
1926
1925
|
}
|
|
1927
1926
|
}, () => [
|
|
1928
1927
|
h.value ? U("div", {
|
|
@@ -1931,24 +1930,24 @@ var na = J({
|
|
|
1931
1930
|
"data-markweave-image-ui": "true",
|
|
1932
1931
|
"aria-label": _.value.toolsAriaLabel
|
|
1933
1932
|
}, [
|
|
1934
|
-
|
|
1933
|
+
Qi({
|
|
1935
1934
|
testId: "markweave-image-align-left",
|
|
1936
1935
|
label: _.value.alignLeft,
|
|
1937
|
-
icon:
|
|
1936
|
+
icon: Or,
|
|
1938
1937
|
active: E.value === "left",
|
|
1939
1938
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1940
1939
|
}),
|
|
1941
|
-
|
|
1940
|
+
Qi({
|
|
1942
1941
|
testId: "markweave-image-align-center",
|
|
1943
1942
|
label: _.value.alignCenter,
|
|
1944
|
-
icon:
|
|
1943
|
+
icon: Er,
|
|
1945
1944
|
active: E.value === "center",
|
|
1946
1945
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1947
1946
|
}),
|
|
1948
|
-
|
|
1947
|
+
Qi({
|
|
1949
1948
|
testId: "markweave-image-align-right",
|
|
1950
1949
|
label: _.value.alignRight,
|
|
1951
|
-
icon:
|
|
1950
|
+
icon: kr,
|
|
1952
1951
|
active: E.value === "right",
|
|
1953
1952
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1954
1953
|
}),
|
|
@@ -1956,31 +1955,31 @@ var na = J({
|
|
|
1956
1955
|
class: "markweave-image-toolbar-divider",
|
|
1957
1956
|
"aria-hidden": "true"
|
|
1958
1957
|
}),
|
|
1959
|
-
|
|
1958
|
+
Qi({
|
|
1960
1959
|
testId: "markweave-image-caption",
|
|
1961
1960
|
label: _.value.caption,
|
|
1962
|
-
icon:
|
|
1961
|
+
icon: Kr,
|
|
1963
1962
|
active: f.value || !!j.value,
|
|
1964
1963
|
onClick: z
|
|
1965
1964
|
}),
|
|
1966
|
-
|
|
1965
|
+
Qi({
|
|
1967
1966
|
testId: "markweave-image-preview",
|
|
1968
1967
|
label: _.value.preview,
|
|
1969
|
-
icon:
|
|
1968
|
+
icon: ri,
|
|
1970
1969
|
onClick: N
|
|
1971
1970
|
}),
|
|
1972
|
-
|
|
1971
|
+
Qi({
|
|
1973
1972
|
testId: "markweave-image-download",
|
|
1974
1973
|
label: _.value.download,
|
|
1975
|
-
icon:
|
|
1974
|
+
icon: ni,
|
|
1976
1975
|
onClick: () => {
|
|
1977
1976
|
T.value && A(T.value);
|
|
1978
1977
|
}
|
|
1979
1978
|
}),
|
|
1980
|
-
|
|
1979
|
+
Qi({
|
|
1981
1980
|
testId: "markweave-image-replace",
|
|
1982
1981
|
label: _.value.replace,
|
|
1983
|
-
icon:
|
|
1982
|
+
icon: Ei,
|
|
1984
1983
|
onClick: () => {
|
|
1985
1984
|
s.value = "", c.value = null, i.value = !0;
|
|
1986
1985
|
}
|
|
@@ -1989,10 +1988,10 @@ var na = J({
|
|
|
1989
1988
|
class: "markweave-image-toolbar-divider",
|
|
1990
1989
|
"aria-hidden": "true"
|
|
1991
1990
|
}),
|
|
1992
|
-
|
|
1991
|
+
Qi({
|
|
1993
1992
|
testId: "markweave-image-delete",
|
|
1994
1993
|
label: _.value.delete,
|
|
1995
|
-
icon:
|
|
1994
|
+
icon: Bi,
|
|
1996
1995
|
onClick: () => e.deleteNode()
|
|
1997
1996
|
})
|
|
1998
1997
|
]) : null,
|
|
@@ -2028,7 +2027,7 @@ var na = J({
|
|
|
2028
2027
|
title: _.value.preview,
|
|
2029
2028
|
onMousedown: (e) => e.preventDefault(),
|
|
2030
2029
|
onClick: N
|
|
2031
|
-
}, [U(
|
|
2030
|
+
}, [U(ri, {
|
|
2032
2031
|
size: 16,
|
|
2033
2032
|
strokeWidth: 1.8
|
|
2034
2033
|
}), U("span", {
|
|
@@ -2073,7 +2072,7 @@ var na = J({
|
|
|
2073
2072
|
}, j.value) : null
|
|
2074
2073
|
]);
|
|
2075
2074
|
}
|
|
2076
|
-
}),
|
|
2075
|
+
}), na = J({
|
|
2077
2076
|
name: "MarkweaveVueVideoNodeView",
|
|
2078
2077
|
props: {
|
|
2079
2078
|
editor: {
|
|
@@ -2106,7 +2105,7 @@ var na = J({
|
|
|
2106
2105
|
}
|
|
2107
2106
|
},
|
|
2108
2107
|
setup(e) {
|
|
2109
|
-
let n = W(!1), r = W(""), i = W(null), a = W(!1), s =
|
|
2108
|
+
let n = W(!1), r = W(""), i = W(null), a = W(!1), s = qi(e.editor), c = G(() => u(s.value)), l = G(() => e.extension.options?.messages ?? t("zh")), d = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => F(f.value.src)), m = G(() => F(f.value.embedUrl)), h = G(() => F(f.value.provider)), g = G(() => m.value ? N(m.value, h.value) : null), _ = G(() => F(f.value.mimeType)), v = G(() => F(f.value.title)), y = () => {
|
|
2110
2109
|
p.value || e.deleteNode(), r.value = "", i.value = null, n.value = !1;
|
|
2111
2110
|
}, b = async (t) => {
|
|
2112
2111
|
if (!c.value) return;
|
|
@@ -2147,7 +2146,7 @@ var na = J({
|
|
|
2147
2146
|
"data-testid": "markweave-video-node",
|
|
2148
2147
|
"data-empty": "true",
|
|
2149
2148
|
"data-selected": "false"
|
|
2150
|
-
}, () =>
|
|
2149
|
+
}, () => ea({
|
|
2151
2150
|
messages: l.value,
|
|
2152
2151
|
inputValue: r.value,
|
|
2153
2152
|
error: i.value,
|
|
@@ -2174,7 +2173,7 @@ var na = J({
|
|
|
2174
2173
|
onFocus: C,
|
|
2175
2174
|
onKeydown: w,
|
|
2176
2175
|
onMousedown: (e) => {
|
|
2177
|
-
c.value && !
|
|
2176
|
+
c.value && !Yi(e.target) && (e.preventDefault(), C());
|
|
2178
2177
|
}
|
|
2179
2178
|
}, () => [g.value ? U("div", { class: "markweave-video-embed" }, [U("iframe", {
|
|
2180
2179
|
class: "markweave-video-iframe",
|
|
@@ -2197,6 +2196,7 @@ var na = J({
|
|
|
2197
2196
|
src: p.value,
|
|
2198
2197
|
title: v.value ?? void 0,
|
|
2199
2198
|
preload: "metadata",
|
|
2199
|
+
autoplay: !1,
|
|
2200
2200
|
controls: !0,
|
|
2201
2201
|
"data-markweave-video": "true",
|
|
2202
2202
|
"data-markweave-mime-type": _.value ?? void 0
|
|
@@ -2212,7 +2212,7 @@ var na = J({
|
|
|
2212
2212
|
"aria-hidden": "true"
|
|
2213
2213
|
})]);
|
|
2214
2214
|
}
|
|
2215
|
-
}),
|
|
2215
|
+
}), ra = S.extend({
|
|
2216
2216
|
addOptions() {
|
|
2217
2217
|
return {
|
|
2218
2218
|
...this.parent?.(),
|
|
@@ -2223,7 +2223,7 @@ var na = J({
|
|
|
2223
2223
|
},
|
|
2224
2224
|
addNodeView() {
|
|
2225
2225
|
if (typeof document > "u") return null;
|
|
2226
|
-
let e = s(
|
|
2226
|
+
let e = s(ta, { stopEvent: ({ event: e }) => Ji(e.target) }), n = this.options.resolveMediaSource;
|
|
2227
2227
|
if (!n) return e;
|
|
2228
2228
|
let r = b({
|
|
2229
2229
|
messages: this.options.messages ?? t("zh"),
|
|
@@ -2232,7 +2232,7 @@ var na = J({
|
|
|
2232
2232
|
});
|
|
2233
2233
|
return (t) => F(t.node.attrs.src) ? r(t) : e(t);
|
|
2234
2234
|
}
|
|
2235
|
-
}),
|
|
2235
|
+
}), ia = C.extend({
|
|
2236
2236
|
addOptions() {
|
|
2237
2237
|
return {
|
|
2238
2238
|
...this.parent?.(),
|
|
@@ -2242,16 +2242,16 @@ var na = J({
|
|
|
2242
2242
|
};
|
|
2243
2243
|
},
|
|
2244
2244
|
addNodeView() {
|
|
2245
|
-
return typeof document > "u" ? null : s(
|
|
2245
|
+
return typeof document > "u" ? null : s(na, { stopEvent: ({ event: e }) => Yi(e.target) });
|
|
2246
2246
|
}
|
|
2247
2247
|
});
|
|
2248
|
-
function
|
|
2248
|
+
function aa(e) {
|
|
2249
2249
|
return e instanceof Element && !!e.closest("[data-markweave-attachment-ui=\"true\"], .markweave-attachment-upload-placeholder, .markweave-attachment-uploading");
|
|
2250
2250
|
}
|
|
2251
|
-
function
|
|
2251
|
+
function oa(e, t) {
|
|
2252
2252
|
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? null : Math.max(0, Math.min(100, Math.round(e / t * 100)));
|
|
2253
2253
|
}
|
|
2254
|
-
var
|
|
2254
|
+
var sa = J({
|
|
2255
2255
|
name: "MarkweaveVueAttachmentNodeView",
|
|
2256
2256
|
props: {
|
|
2257
2257
|
editor: {
|
|
@@ -2284,7 +2284,7 @@ var ca = J({
|
|
|
2284
2284
|
}
|
|
2285
2285
|
},
|
|
2286
2286
|
setup(e) {
|
|
2287
|
-
let n = G(() => e.extension.options), r = G(() => n.value?.messages ?? t("zh")), i =
|
|
2287
|
+
let n = G(() => e.extension.options), r = G(() => n.value?.messages ?? t("zh")), i = qi(e.editor), a = G(() => u(i.value)), s = G(() => L(e.node.attrs ?? {})), c = G(() => s.value?.name ?? F(e.node.attrs?.src) ?? r.value.attachment.missingSrc), d = G(() => [F(e.node.attrs?.mimeType), te(typeof e.node.attrs?.size == "number" ? e.node.attrs.size : null)].filter(Boolean).join(" · ")), f = W(null), p = W(!1), m = W(!1), h = W(null), g = W(null), _ = W(null), v = W(null), y = () => {
|
|
2288
2288
|
if (!a.value) return;
|
|
2289
2289
|
let t = e.getPos();
|
|
2290
2290
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
@@ -2301,7 +2301,7 @@ var ca = J({
|
|
|
2301
2301
|
mimeType: t.type || void 0
|
|
2302
2302
|
}),
|
|
2303
2303
|
onProgress: (e) => {
|
|
2304
|
-
v.value =
|
|
2304
|
+
v.value = oa(e.loaded, e.total);
|
|
2305
2305
|
}
|
|
2306
2306
|
}, n.value?.onUpload);
|
|
2307
2307
|
e.updateAttributes(ee(r));
|
|
@@ -2317,7 +2317,7 @@ var ca = J({
|
|
|
2317
2317
|
event: t
|
|
2318
2318
|
}, n.value?.onDownload);
|
|
2319
2319
|
}, C = (e) => {
|
|
2320
|
-
|
|
2320
|
+
aa(e.target) || (e.preventDefault(), e.stopPropagation(), s.value && S(e));
|
|
2321
2321
|
};
|
|
2322
2322
|
return () => {
|
|
2323
2323
|
let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [te(_.value), v.value === null ? null : `${v.value}%`].filter(Boolean).join(" · ");
|
|
@@ -2353,7 +2353,7 @@ var ca = J({
|
|
|
2353
2353
|
U("span", {
|
|
2354
2354
|
class: "markweave-attachment-icon",
|
|
2355
2355
|
"aria-hidden": "true"
|
|
2356
|
-
}, [
|
|
2356
|
+
}, [Zi(Ui, t.uploadLabel)]),
|
|
2357
2357
|
U("span", { class: "markweave-attachment-upload-label" }, t.uploadLabel),
|
|
2358
2358
|
h.value ? U("span", { class: "markweave-attachment-upload-error" }, h.value) : null
|
|
2359
2359
|
])]) : i ? U(o, {
|
|
@@ -2375,7 +2375,7 @@ var ca = J({
|
|
|
2375
2375
|
}, [U("span", {
|
|
2376
2376
|
class: "markweave-attachment-icon",
|
|
2377
2377
|
"aria-hidden": "true"
|
|
2378
|
-
}, [
|
|
2378
|
+
}, [Zi(Ui, t.uploading)]), U("span", { class: "markweave-attachment-body" }, [U("span", { class: "markweave-attachment-name" }, g.value ?? t.uploading), U("span", { class: "markweave-attachment-meta" }, [U("span", {
|
|
2379
2379
|
class: "markweave-attachment-spinner",
|
|
2380
2380
|
"aria-hidden": "true"
|
|
2381
2381
|
}), u || t.uploading])])]) : U(o, {
|
|
@@ -2394,7 +2394,7 @@ var ca = J({
|
|
|
2394
2394
|
p.value = !1;
|
|
2395
2395
|
},
|
|
2396
2396
|
onMousedown: (e) => {
|
|
2397
|
-
!a.value ||
|
|
2397
|
+
!a.value || aa(e.target) || (e.preventDefault(), y());
|
|
2398
2398
|
},
|
|
2399
2399
|
onKeydown: (t) => {
|
|
2400
2400
|
a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
|
|
@@ -2404,7 +2404,7 @@ var ca = J({
|
|
|
2404
2404
|
U("span", {
|
|
2405
2405
|
class: "markweave-attachment-icon",
|
|
2406
2406
|
"aria-hidden": "true"
|
|
2407
|
-
}, [
|
|
2407
|
+
}, [Zi(Si, t.nodeAriaLabel)]),
|
|
2408
2408
|
U("span", { class: "markweave-attachment-body" }, [U("span", { class: "markweave-attachment-name" }, c.value), d.value ? U("span", { class: "markweave-attachment-meta" }, d.value) : null]),
|
|
2409
2409
|
l ? U("span", {
|
|
2410
2410
|
class: "markweave-attachment-actions",
|
|
@@ -2417,7 +2417,7 @@ var ca = J({
|
|
|
2417
2417
|
"aria-label": t.downloadAriaLabel,
|
|
2418
2418
|
onMousedown: (e) => e.preventDefault(),
|
|
2419
2419
|
onClick: S
|
|
2420
|
-
}, [
|
|
2420
|
+
}, [Zi(ni, t.download), U("span", {
|
|
2421
2421
|
class: "markweave-attachment-tooltip",
|
|
2422
2422
|
role: "tooltip"
|
|
2423
2423
|
}, t.download)]), a.value ? U("button", {
|
|
@@ -2430,14 +2430,14 @@ var ca = J({
|
|
|
2430
2430
|
onClick: (t) => {
|
|
2431
2431
|
t.preventDefault(), t.stopPropagation(), e.deleteNode();
|
|
2432
2432
|
}
|
|
2433
|
-
}, [
|
|
2433
|
+
}, [Zi(Bi, t.delete), U("span", {
|
|
2434
2434
|
class: "markweave-attachment-tooltip",
|
|
2435
2435
|
role: "tooltip"
|
|
2436
2436
|
}, t.delete)]) : null]) : null
|
|
2437
2437
|
]);
|
|
2438
2438
|
};
|
|
2439
2439
|
}
|
|
2440
|
-
}),
|
|
2440
|
+
}), ca = z.extend({
|
|
2441
2441
|
addOptions() {
|
|
2442
2442
|
return {
|
|
2443
2443
|
...this.parent?.(),
|
|
@@ -2448,9 +2448,9 @@ var ca = J({
|
|
|
2448
2448
|
};
|
|
2449
2449
|
},
|
|
2450
2450
|
addNodeView() {
|
|
2451
|
-
return typeof document > "u" ? null : s(
|
|
2451
|
+
return typeof document > "u" ? null : s(sa, { stopEvent: ({ event: e }) => aa(e.target) });
|
|
2452
2452
|
}
|
|
2453
|
-
}),
|
|
2453
|
+
}), la = J({
|
|
2454
2454
|
name: "MarkweaveVueLinkCardNodeView",
|
|
2455
2455
|
props: {
|
|
2456
2456
|
editor: {
|
|
@@ -2483,7 +2483,7 @@ var ca = J({
|
|
|
2483
2483
|
}
|
|
2484
2484
|
},
|
|
2485
2485
|
setup(e) {
|
|
2486
|
-
let n = e.extension.options, r = n.messages ?? t("zh"), i =
|
|
2486
|
+
let n = e.extension.options, r = n.messages ?? t("zh"), i = qi(e.editor), a = W(!1), s = W(!1), c = W(!1), l = G(() => g(e.node.attrs ?? {})), d = W(l.value?.title ?? ""), f = W(l.value?.href ?? "");
|
|
2487
2487
|
K(l, (e) => {
|
|
2488
2488
|
d.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
2489
2489
|
});
|
|
@@ -2518,7 +2518,7 @@ var ca = J({
|
|
|
2518
2518
|
"data-testid": n,
|
|
2519
2519
|
onMousedown: y,
|
|
2520
2520
|
onClick: r
|
|
2521
|
-
}, [
|
|
2521
|
+
}, [Zi(t, e), U("span", { role: "tooltip" }, e)]);
|
|
2522
2522
|
return () => {
|
|
2523
2523
|
let t = l.value;
|
|
2524
2524
|
if (!t) return null;
|
|
@@ -2554,10 +2554,10 @@ var ca = J({
|
|
|
2554
2554
|
a.value = !1;
|
|
2555
2555
|
},
|
|
2556
2556
|
onMousedown: (e) => {
|
|
2557
|
-
|
|
2557
|
+
Xi(e.target) || e.preventDefault();
|
|
2558
2558
|
},
|
|
2559
2559
|
onClick: (e) => {
|
|
2560
|
-
|
|
2560
|
+
Xi(e.target) || (e.preventDefault(), t.href && window.open(t.href, "_blank", "noopener,noreferrer"));
|
|
2561
2561
|
}
|
|
2562
2562
|
}, () => [
|
|
2563
2563
|
U("a", {
|
|
@@ -2577,9 +2577,9 @@ var ca = J({
|
|
|
2577
2577
|
"data-markweave-link-card-ui": "true",
|
|
2578
2578
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
2579
2579
|
}, [
|
|
2580
|
-
C(r.linkCard.convertToLink,
|
|
2581
|
-
C(r.linkCard.copyAddress,
|
|
2582
|
-
C(r.linkCard.edit,
|
|
2580
|
+
C(r.linkCard.convertToLink, hi, "markweave-link-card-convert", x),
|
|
2581
|
+
C(r.linkCard.copyAddress, ni, "markweave-link-card-copy", () => b(t.href)),
|
|
2582
|
+
C(r.linkCard.edit, Ci, "markweave-link-card-edit", (i) => h({
|
|
2583
2583
|
anchor: i.currentTarget,
|
|
2584
2584
|
editor: e.editor,
|
|
2585
2585
|
messages: r,
|
|
@@ -2589,7 +2589,7 @@ var ca = J({
|
|
|
2589
2589
|
attrs: t
|
|
2590
2590
|
}
|
|
2591
2591
|
})),
|
|
2592
|
-
C(r.linkCard.delete,
|
|
2592
|
+
C(r.linkCard.delete, Bi, "markweave-link-card-delete", () => e.deleteNode())
|
|
2593
2593
|
]) : null,
|
|
2594
2594
|
p.value && s.value ? U("form", {
|
|
2595
2595
|
class: "markweave-link-card-editor",
|
|
@@ -2617,12 +2617,12 @@ var ca = J({
|
|
|
2617
2617
|
type: "submit",
|
|
2618
2618
|
disabled: !_(f.value),
|
|
2619
2619
|
"aria-label": r.linkCard.edit
|
|
2620
|
-
}, [
|
|
2620
|
+
}, [Zi(hi, r.linkCard.edit)])
|
|
2621
2621
|
]) : null
|
|
2622
2622
|
]);
|
|
2623
2623
|
};
|
|
2624
2624
|
}
|
|
2625
|
-
}),
|
|
2625
|
+
}), ua = m.extend({
|
|
2626
2626
|
addOptions() {
|
|
2627
2627
|
return {
|
|
2628
2628
|
...this.parent?.(),
|
|
@@ -2631,27 +2631,28 @@ var ca = J({
|
|
|
2631
2631
|
};
|
|
2632
2632
|
},
|
|
2633
2633
|
addNodeView() {
|
|
2634
|
-
return typeof document > "u" ? null : s(
|
|
2634
|
+
return typeof document > "u" ? null : s(la, { stopEvent: ({ event: e }) => Xi(e.target) });
|
|
2635
2635
|
}
|
|
2636
2636
|
});
|
|
2637
2637
|
//#endregion
|
|
2638
2638
|
//#region src/create-editor-extensions.ts
|
|
2639
|
-
function
|
|
2639
|
+
function da(n = {}) {
|
|
2640
2640
|
return e({
|
|
2641
2641
|
lang: n.lang,
|
|
2642
|
+
revealLinkMarkdown: n.revealLinkMarkdown,
|
|
2642
2643
|
onImageUpload: n.onImageUpload,
|
|
2643
2644
|
tableCapabilities: n.tableCapabilities,
|
|
2644
2645
|
referenceSuggestion: n.referenceSuggestion,
|
|
2645
2646
|
internalLinkCard: n.internalLinkCard,
|
|
2646
|
-
linkCardExtension:
|
|
2647
|
+
linkCardExtension: ua.configure({
|
|
2647
2648
|
lang: n.lang,
|
|
2648
2649
|
messages: t(n.lang),
|
|
2649
2650
|
resolver: n.linkCardResolver
|
|
2650
2651
|
}),
|
|
2651
2652
|
mediaExtensions: r({
|
|
2652
|
-
image:
|
|
2653
|
-
video:
|
|
2654
|
-
attachment:
|
|
2653
|
+
image: ra,
|
|
2654
|
+
video: ia,
|
|
2655
|
+
attachment: ca,
|
|
2655
2656
|
lang: n.lang,
|
|
2656
2657
|
onImageUpload: n.onImageUpload,
|
|
2657
2658
|
onVideoUpload: n.onVideoUpload,
|
|
@@ -2663,65 +2664,65 @@ function fa(n = {}) {
|
|
|
2663
2664
|
});
|
|
2664
2665
|
}
|
|
2665
2666
|
//#endregion
|
|
2666
|
-
//#region ../../node_modules/.pnpm/@tiptap+vue-2@3.29.2_@
|
|
2667
|
-
var
|
|
2667
|
+
//#region ../../node_modules/.pnpm/@tiptap+vue-2@3.29.2_@floating-ui+dom@1.7.6_@tiptap+core@3.29.2_@tiptap+pm@3.29.2__@tiptap+pm@3.29.2_vue@2.6.12/node_modules/@tiptap/vue-2/dist/menus/index.js
|
|
2668
|
+
var fa = [
|
|
2668
2669
|
"top",
|
|
2669
2670
|
"right",
|
|
2670
2671
|
"bottom",
|
|
2671
2672
|
"left"
|
|
2672
|
-
],
|
|
2673
|
+
], pa = ["start", "end"], ma = /* @__PURE__ */ fa.reduce((e, t) => e.concat(t, t + "-" + pa[0], t + "-" + pa[1]), []), ha = Math.min, X = Math.max, ga = Math.round, _a = (e) => ({
|
|
2673
2674
|
x: e,
|
|
2674
2675
|
y: e
|
|
2675
|
-
}),
|
|
2676
|
+
}), va = {
|
|
2676
2677
|
left: "right",
|
|
2677
2678
|
right: "left",
|
|
2678
2679
|
bottom: "top",
|
|
2679
2680
|
top: "bottom"
|
|
2680
|
-
},
|
|
2681
|
+
}, ya = {
|
|
2681
2682
|
start: "end",
|
|
2682
2683
|
end: "start"
|
|
2683
2684
|
};
|
|
2684
|
-
function
|
|
2685
|
-
return X(e,
|
|
2685
|
+
function ba(e, t, n) {
|
|
2686
|
+
return X(e, ha(t, n));
|
|
2686
2687
|
}
|
|
2687
|
-
function
|
|
2688
|
+
function xa(e, t) {
|
|
2688
2689
|
return typeof e == "function" ? e(t) : e;
|
|
2689
2690
|
}
|
|
2690
|
-
function
|
|
2691
|
+
function Sa(e) {
|
|
2691
2692
|
return e.split("-")[0];
|
|
2692
2693
|
}
|
|
2693
|
-
function
|
|
2694
|
+
function Ca(e) {
|
|
2694
2695
|
return e.split("-")[1];
|
|
2695
2696
|
}
|
|
2696
|
-
function
|
|
2697
|
+
function wa(e) {
|
|
2697
2698
|
return e === "x" ? "y" : "x";
|
|
2698
2699
|
}
|
|
2699
|
-
function
|
|
2700
|
+
function Ta(e) {
|
|
2700
2701
|
return e === "y" ? "height" : "width";
|
|
2701
2702
|
}
|
|
2702
|
-
function
|
|
2703
|
-
return ["top", "bottom"].includes(
|
|
2703
|
+
function Ea(e) {
|
|
2704
|
+
return ["top", "bottom"].includes(Sa(e)) ? "y" : "x";
|
|
2704
2705
|
}
|
|
2705
|
-
function
|
|
2706
|
-
return
|
|
2706
|
+
function Da(e) {
|
|
2707
|
+
return wa(Ea(e));
|
|
2707
2708
|
}
|
|
2708
|
-
function
|
|
2709
|
+
function Oa(e, t, n) {
|
|
2709
2710
|
n === void 0 && (n = !1);
|
|
2710
|
-
let r =
|
|
2711
|
-
return t.reference[a] > t.floating[a] && (o =
|
|
2711
|
+
let r = Ca(e), i = Da(e), a = Ta(i), o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
2712
|
+
return t.reference[a] > t.floating[a] && (o = Na(o)), [o, Na(o)];
|
|
2712
2713
|
}
|
|
2713
|
-
function
|
|
2714
|
-
let t =
|
|
2714
|
+
function ka(e) {
|
|
2715
|
+
let t = Na(e);
|
|
2715
2716
|
return [
|
|
2716
|
-
|
|
2717
|
+
Aa(e),
|
|
2717
2718
|
t,
|
|
2718
|
-
|
|
2719
|
+
Aa(t)
|
|
2719
2720
|
];
|
|
2720
2721
|
}
|
|
2721
|
-
function
|
|
2722
|
-
return e.replace(/start|end/g, (e) =>
|
|
2722
|
+
function Aa(e) {
|
|
2723
|
+
return e.replace(/start|end/g, (e) => ya[e]);
|
|
2723
2724
|
}
|
|
2724
|
-
function
|
|
2725
|
+
function ja(e, t, n) {
|
|
2725
2726
|
let r = ["left", "right"], i = ["right", "left"], a = ["top", "bottom"], o = ["bottom", "top"];
|
|
2726
2727
|
switch (e) {
|
|
2727
2728
|
case "top":
|
|
@@ -2731,14 +2732,14 @@ function Ma(e, t, n) {
|
|
|
2731
2732
|
default: return [];
|
|
2732
2733
|
}
|
|
2733
2734
|
}
|
|
2734
|
-
function
|
|
2735
|
-
let i =
|
|
2736
|
-
return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(
|
|
2735
|
+
function Ma(e, t, n, r) {
|
|
2736
|
+
let i = Ca(e), a = ja(Sa(e), n === "start", r);
|
|
2737
|
+
return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(Aa)))), a;
|
|
2737
2738
|
}
|
|
2738
|
-
function
|
|
2739
|
-
return e.replace(/left|right|bottom|top/g, (e) =>
|
|
2739
|
+
function Na(e) {
|
|
2740
|
+
return e.replace(/left|right|bottom|top/g, (e) => va[e]);
|
|
2740
2741
|
}
|
|
2741
|
-
function
|
|
2742
|
+
function Pa(e) {
|
|
2742
2743
|
return {
|
|
2743
2744
|
top: 0,
|
|
2744
2745
|
right: 0,
|
|
@@ -2747,15 +2748,15 @@ function Fa(e) {
|
|
|
2747
2748
|
...e
|
|
2748
2749
|
};
|
|
2749
2750
|
}
|
|
2750
|
-
function
|
|
2751
|
+
function Fa(e) {
|
|
2751
2752
|
return typeof e == "number" ? {
|
|
2752
2753
|
top: e,
|
|
2753
2754
|
right: e,
|
|
2754
2755
|
bottom: e,
|
|
2755
2756
|
left: e
|
|
2756
|
-
} :
|
|
2757
|
+
} : Pa(e);
|
|
2757
2758
|
}
|
|
2758
|
-
function
|
|
2759
|
+
function Ia(e) {
|
|
2759
2760
|
let { x: t, y: n, width: r, height: i } = e;
|
|
2760
2761
|
return {
|
|
2761
2762
|
width: r,
|
|
@@ -2768,8 +2769,8 @@ function La(e) {
|
|
|
2768
2769
|
y: n
|
|
2769
2770
|
};
|
|
2770
2771
|
}
|
|
2771
|
-
function
|
|
2772
|
-
let { reference: r, floating: i } = e, a =
|
|
2772
|
+
function La(e, t, n) {
|
|
2773
|
+
let { reference: r, floating: i } = e, a = Ea(t), o = Da(t), s = Ta(o), c = Sa(t), l = a === "y", u = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, f = r[s] / 2 - i[s] / 2, p;
|
|
2773
2774
|
switch (c) {
|
|
2774
2775
|
case "top":
|
|
2775
2776
|
p = {
|
|
@@ -2800,7 +2801,7 @@ function Ra(e, t, n) {
|
|
|
2800
2801
|
y: r.y
|
|
2801
2802
|
};
|
|
2802
2803
|
}
|
|
2803
|
-
switch (
|
|
2804
|
+
switch (Ca(t)) {
|
|
2804
2805
|
case "start":
|
|
2805
2806
|
p[o] -= f * (n && l ? -1 : 1);
|
|
2806
2807
|
break;
|
|
@@ -2810,12 +2811,12 @@ function Ra(e, t, n) {
|
|
|
2810
2811
|
}
|
|
2811
2812
|
return p;
|
|
2812
2813
|
}
|
|
2813
|
-
var
|
|
2814
|
+
var Ra = async (e, t, n) => {
|
|
2814
2815
|
let { placement: r = "bottom", strategy: i = "absolute", middleware: a = [], platform: o } = n, s = a.filter(Boolean), c = await (o.isRTL == null ? void 0 : o.isRTL(t)), l = await o.getElementRects({
|
|
2815
2816
|
reference: e,
|
|
2816
2817
|
floating: t,
|
|
2817
2818
|
strategy: i
|
|
2818
|
-
}), { x: u, y: d } =
|
|
2819
|
+
}), { x: u, y: d } = La(l, r, c), f = r, p = {}, m = 0;
|
|
2819
2820
|
for (let n = 0; n < s.length; n++) {
|
|
2820
2821
|
let { name: a, fn: h } = s[n], { x: g, y: _, data: v, reset: y } = await h({
|
|
2821
2822
|
x: u,
|
|
@@ -2841,7 +2842,7 @@ var za = async (e, t, n) => {
|
|
|
2841
2842
|
reference: e,
|
|
2842
2843
|
floating: t,
|
|
2843
2844
|
strategy: i
|
|
2844
|
-
}) : y.rects), {x: u, y: d} =
|
|
2845
|
+
}) : y.rects), {x: u, y: d} = La(l, f, c)), n = -1);
|
|
2845
2846
|
}
|
|
2846
2847
|
return {
|
|
2847
2848
|
x: u,
|
|
@@ -2851,9 +2852,9 @@ var za = async (e, t, n) => {
|
|
|
2851
2852
|
middlewareData: p
|
|
2852
2853
|
};
|
|
2853
2854
|
};
|
|
2854
|
-
async function
|
|
2855
|
+
async function za(e, t) {
|
|
2855
2856
|
t === void 0 && (t = {});
|
|
2856
|
-
let { x: n, y: r, platform: i, rects: a, elements: o, strategy: s } = e, { boundary: c = "clippingAncestors", rootBoundary: l = "viewport", elementContext: u = "floating", altBoundary: d = !1, padding: f = 0 } =
|
|
2857
|
+
let { x: n, y: r, platform: i, rects: a, elements: o, strategy: s } = e, { boundary: c = "clippingAncestors", rootBoundary: l = "viewport", elementContext: u = "floating", altBoundary: d = !1, padding: f = 0 } = xa(t, e), p = Fa(f), m = o[d ? u === "floating" ? "reference" : "floating" : u], h = Ia(await i.getClippingRect({
|
|
2857
2858
|
element: await (i.isElement == null ? void 0 : i.isElement(m)) ?? !0 ? m : m.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(o.floating)),
|
|
2858
2859
|
boundary: c,
|
|
2859
2860
|
rootBoundary: l,
|
|
@@ -2866,7 +2867,7 @@ async function Ba(e, t) {
|
|
|
2866
2867
|
} : a.reference, _ = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(o.floating)), v = await (i.isElement == null ? void 0 : i.isElement(_)) && await (i.getScale == null ? void 0 : i.getScale(_)) || {
|
|
2867
2868
|
x: 1,
|
|
2868
2869
|
y: 1
|
|
2869
|
-
}, y =
|
|
2870
|
+
}, y = Ia(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2870
2871
|
elements: o,
|
|
2871
2872
|
rect: g,
|
|
2872
2873
|
offsetParent: _,
|
|
@@ -2879,18 +2880,18 @@ async function Ba(e, t) {
|
|
|
2879
2880
|
right: (y.right - h.right + p.right) / v.x
|
|
2880
2881
|
};
|
|
2881
2882
|
}
|
|
2882
|
-
var
|
|
2883
|
+
var Ba = (e) => ({
|
|
2883
2884
|
name: "arrow",
|
|
2884
2885
|
options: e,
|
|
2885
2886
|
async fn(t) {
|
|
2886
|
-
let { x: n, y: r, placement: i, rects: a, platform: o, elements: s, middlewareData: c } = t, { element: l, padding: u = 0 } =
|
|
2887
|
+
let { x: n, y: r, placement: i, rects: a, platform: o, elements: s, middlewareData: c } = t, { element: l, padding: u = 0 } = xa(e, t) || {};
|
|
2887
2888
|
if (l == null) return {};
|
|
2888
|
-
let d =
|
|
2889
|
+
let d = Fa(u), f = {
|
|
2889
2890
|
x: n,
|
|
2890
2891
|
y: r
|
|
2891
|
-
}, p =
|
|
2892
|
+
}, p = Da(i), m = Ta(p), h = await o.getDimensions(l), g = p === "y", _ = g ? "top" : "left", v = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", b = a.reference[m] + a.reference[p] - f[p] - a.floating[m], x = f[p] - a.reference[p], S = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l)), C = S ? S[y] : 0;
|
|
2892
2893
|
(!C || !await (o.isElement == null ? void 0 : o.isElement(S))) && (C = s.floating[y] || a.floating[m]);
|
|
2893
|
-
let w = b / 2 - x / 2, T = C / 2 - h[m] / 2 - 1, E =
|
|
2894
|
+
let w = b / 2 - x / 2, T = C / 2 - h[m] / 2 - 1, E = ha(d[_], T), D = ha(d[v], T), O = E, k = C - h[m] - D, A = C / 2 - h[m] / 2 + w, j = ba(O, A, k), M = !c.arrow && Ca(i) != null && A !== j && a.reference[m] / 2 - (A < O ? E : D) - h[m] / 2 < 0, N = M ? A < O ? A - O : A - k : 0;
|
|
2894
2895
|
return {
|
|
2895
2896
|
[p]: f[p] + N,
|
|
2896
2897
|
data: {
|
|
@@ -2902,20 +2903,20 @@ var Va = (e) => ({
|
|
|
2902
2903
|
};
|
|
2903
2904
|
}
|
|
2904
2905
|
});
|
|
2905
|
-
function
|
|
2906
|
-
return (e ? [...n.filter((t) =>
|
|
2906
|
+
function Va(e, t, n) {
|
|
2907
|
+
return (e ? [...n.filter((t) => Ca(t) === e), ...n.filter((t) => Ca(t) !== e)] : n.filter((e) => Sa(e) === e)).filter((n) => e ? Ca(n) === e || (t ? Aa(n) !== n : !1) : !0);
|
|
2907
2908
|
}
|
|
2908
|
-
var
|
|
2909
|
+
var Ha = function(e) {
|
|
2909
2910
|
return e === void 0 && (e = {}), {
|
|
2910
2911
|
name: "autoPlacement",
|
|
2911
2912
|
options: e,
|
|
2912
2913
|
async fn(t) {
|
|
2913
|
-
let { rects: n, middlewareData: r, placement: i, platform: a, elements: o } = t, { crossAxis: s = !1, alignment: c, allowedPlacements: l =
|
|
2914
|
+
let { rects: n, middlewareData: r, placement: i, platform: a, elements: o } = t, { crossAxis: s = !1, alignment: c, allowedPlacements: l = ma, autoAlignment: u = !0, ...d } = xa(e, t), f = c !== void 0 || l === ma ? Va(c || null, u, l) : l, p = await za(t, d), m = r.autoPlacement?.index || 0, h = f[m];
|
|
2914
2915
|
if (h == null) return {};
|
|
2915
|
-
let g =
|
|
2916
|
+
let g = Oa(h, n, await (a.isRTL == null ? void 0 : a.isRTL(o.floating)));
|
|
2916
2917
|
if (i !== h) return { reset: { placement: f[0] } };
|
|
2917
2918
|
let _ = [
|
|
2918
|
-
p[
|
|
2919
|
+
p[Sa(h)],
|
|
2919
2920
|
p[g[0]],
|
|
2920
2921
|
p[g[1]]
|
|
2921
2922
|
], v = [...r.autoPlacement?.overflows || [], {
|
|
@@ -2930,13 +2931,13 @@ var Ua = function(e) {
|
|
|
2930
2931
|
reset: { placement: y }
|
|
2931
2932
|
};
|
|
2932
2933
|
let b = v.map((e) => {
|
|
2933
|
-
let t =
|
|
2934
|
+
let t = Ca(e.placement);
|
|
2934
2935
|
return [
|
|
2935
2936
|
e.placement,
|
|
2936
2937
|
t && s ? e.overflows.slice(0, 2).reduce((e, t) => e + t, 0) : e.overflows[0],
|
|
2937
2938
|
e.overflows
|
|
2938
2939
|
];
|
|
2939
|
-
}).sort((e, t) => e[1] - t[1]), x = b.filter((e) => e[2].slice(0,
|
|
2940
|
+
}).sort((e, t) => e[1] - t[1]), x = b.filter((e) => e[2].slice(0, Ca(e[0]) ? 2 : 3).every((e) => e <= 0))[0]?.[0] || b[0][0];
|
|
2940
2941
|
return x === i ? {} : {
|
|
2941
2942
|
data: {
|
|
2942
2943
|
index: m + 1,
|
|
@@ -2946,19 +2947,19 @@ var Ua = function(e) {
|
|
|
2946
2947
|
};
|
|
2947
2948
|
}
|
|
2948
2949
|
};
|
|
2949
|
-
},
|
|
2950
|
+
}, Ua = function(e) {
|
|
2950
2951
|
return e === void 0 && (e = {}), {
|
|
2951
2952
|
name: "flip",
|
|
2952
2953
|
options: e,
|
|
2953
2954
|
async fn(t) {
|
|
2954
2955
|
var n;
|
|
2955
|
-
let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: s, elements: c } = t, { mainAxis: l = !0, crossAxis: u = !0, fallbackPlacements: d, fallbackStrategy: f = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: m = !0, ...h } =
|
|
2956
|
+
let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: s, elements: c } = t, { mainAxis: l = !0, crossAxis: u = !0, fallbackPlacements: d, fallbackStrategy: f = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: m = !0, ...h } = xa(e, t);
|
|
2956
2957
|
if ((n = i.arrow) != null && n.alignmentOffset) return {};
|
|
2957
|
-
let g =
|
|
2958
|
-
!d && x && b.push(...
|
|
2959
|
-
let S = [o, ...b], C = await
|
|
2958
|
+
let g = Sa(r), _ = Ea(o), v = Sa(o) === o, y = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), b = d || (v || !m ? [Na(o)] : ka(o)), x = p !== "none";
|
|
2959
|
+
!d && x && b.push(...Ma(o, m, p, y));
|
|
2960
|
+
let S = [o, ...b], C = await za(t, h), w = [], T = i.flip?.overflows || [];
|
|
2960
2961
|
if (l && w.push(C[g]), u) {
|
|
2961
|
-
let e =
|
|
2962
|
+
let e = Oa(r, a, y);
|
|
2962
2963
|
w.push(C[e[0]], C[e[1]]);
|
|
2963
2964
|
}
|
|
2964
2965
|
if (T = [...T, {
|
|
@@ -2978,7 +2979,7 @@ var Ua = function(e) {
|
|
|
2978
2979
|
case "bestFit": {
|
|
2979
2980
|
let e = T.filter((e) => {
|
|
2980
2981
|
if (x) {
|
|
2981
|
-
let t =
|
|
2982
|
+
let t = Ea(e.placement);
|
|
2982
2983
|
return t === _ || t === "y";
|
|
2983
2984
|
}
|
|
2984
2985
|
return !0;
|
|
@@ -2996,7 +2997,7 @@ var Ua = function(e) {
|
|
|
2996
2997
|
}
|
|
2997
2998
|
};
|
|
2998
2999
|
};
|
|
2999
|
-
function
|
|
3000
|
+
function Wa(e, t) {
|
|
3000
3001
|
return {
|
|
3001
3002
|
top: e.top - t.height,
|
|
3002
3003
|
right: e.right - t.width,
|
|
@@ -3004,34 +3005,34 @@ function Ga(e, t) {
|
|
|
3004
3005
|
left: e.left - t.width
|
|
3005
3006
|
};
|
|
3006
3007
|
}
|
|
3007
|
-
function
|
|
3008
|
-
return
|
|
3008
|
+
function Ga(e) {
|
|
3009
|
+
return fa.some((t) => e[t] >= 0);
|
|
3009
3010
|
}
|
|
3010
|
-
var
|
|
3011
|
+
var Ka = function(e) {
|
|
3011
3012
|
return e === void 0 && (e = {}), {
|
|
3012
3013
|
name: "hide",
|
|
3013
3014
|
options: e,
|
|
3014
3015
|
async fn(t) {
|
|
3015
|
-
let { rects: n } = t, { strategy: r = "referenceHidden", ...i } =
|
|
3016
|
+
let { rects: n } = t, { strategy: r = "referenceHidden", ...i } = xa(e, t);
|
|
3016
3017
|
switch (r) {
|
|
3017
3018
|
case "referenceHidden": {
|
|
3018
|
-
let e =
|
|
3019
|
+
let e = Wa(await za(t, {
|
|
3019
3020
|
...i,
|
|
3020
3021
|
elementContext: "reference"
|
|
3021
3022
|
}), n.reference);
|
|
3022
3023
|
return { data: {
|
|
3023
3024
|
referenceHiddenOffsets: e,
|
|
3024
|
-
referenceHidden:
|
|
3025
|
+
referenceHidden: Ga(e)
|
|
3025
3026
|
} };
|
|
3026
3027
|
}
|
|
3027
3028
|
case "escaped": {
|
|
3028
|
-
let e =
|
|
3029
|
+
let e = Wa(await za(t, {
|
|
3029
3030
|
...i,
|
|
3030
3031
|
altBoundary: !0
|
|
3031
3032
|
}), n.floating);
|
|
3032
3033
|
return { data: {
|
|
3033
3034
|
escapedOffsets: e,
|
|
3034
|
-
escaped:
|
|
3035
|
+
escaped: Ga(e)
|
|
3035
3036
|
} };
|
|
3036
3037
|
}
|
|
3037
3038
|
default: return {};
|
|
@@ -3039,8 +3040,8 @@ var qa = function(e) {
|
|
|
3039
3040
|
}
|
|
3040
3041
|
};
|
|
3041
3042
|
};
|
|
3042
|
-
function
|
|
3043
|
-
let t =
|
|
3043
|
+
function qa(e) {
|
|
3044
|
+
let t = ha(...e.map((e) => e.left)), n = ha(...e.map((e) => e.top)), r = X(...e.map((e) => e.right)), i = X(...e.map((e) => e.bottom));
|
|
3044
3045
|
return {
|
|
3045
3046
|
x: t,
|
|
3046
3047
|
y: n,
|
|
@@ -3048,25 +3049,25 @@ function Ja(e) {
|
|
|
3048
3049
|
height: i - n
|
|
3049
3050
|
};
|
|
3050
3051
|
}
|
|
3051
|
-
function
|
|
3052
|
+
function Ja(e) {
|
|
3052
3053
|
let t = e.slice().sort((e, t) => e.y - t.y), n = [], r = null;
|
|
3053
3054
|
for (let e = 0; e < t.length; e++) {
|
|
3054
3055
|
let i = t[e];
|
|
3055
3056
|
!r || i.y - r.y > r.height / 2 ? n.push([i]) : n[n.length - 1].push(i), r = i;
|
|
3056
3057
|
}
|
|
3057
|
-
return n.map((e) =>
|
|
3058
|
+
return n.map((e) => Ia(qa(e)));
|
|
3058
3059
|
}
|
|
3059
|
-
var
|
|
3060
|
+
var Ya = function(e) {
|
|
3060
3061
|
return e === void 0 && (e = {}), {
|
|
3061
3062
|
name: "inline",
|
|
3062
3063
|
options: e,
|
|
3063
3064
|
async fn(t) {
|
|
3064
|
-
let { placement: n, elements: r, rects: i, platform: a, strategy: o } = t, { padding: s = 2, x: c, y: l } =
|
|
3065
|
+
let { placement: n, elements: r, rects: i, platform: a, strategy: o } = t, { padding: s = 2, x: c, y: l } = xa(e, t), u = Array.from(await (a.getClientRects == null ? void 0 : a.getClientRects(r.reference)) || []), d = Ja(u), f = Ia(qa(u)), p = Fa(s);
|
|
3065
3066
|
function m() {
|
|
3066
3067
|
if (d.length === 2 && d[0].left > d[1].right && c != null && l != null) return d.find((e) => c > e.left - p.left && c < e.right + p.right && l > e.top - p.top && l < e.bottom + p.bottom) || f;
|
|
3067
3068
|
if (d.length >= 2) {
|
|
3068
|
-
if (
|
|
3069
|
-
let e = d[0], t = d[d.length - 1], r =
|
|
3069
|
+
if (Ea(n) === "y") {
|
|
3070
|
+
let e = d[0], t = d[d.length - 1], r = Sa(n) === "top", i = e.top, a = t.bottom, o = r ? e.left : t.left, s = r ? e.right : t.right;
|
|
3070
3071
|
return {
|
|
3071
3072
|
top: i,
|
|
3072
3073
|
bottom: a,
|
|
@@ -3078,7 +3079,7 @@ var Xa = function(e) {
|
|
|
3078
3079
|
y: i
|
|
3079
3080
|
};
|
|
3080
3081
|
}
|
|
3081
|
-
let e =
|
|
3082
|
+
let e = Sa(n) === "left", t = X(...d.map((e) => e.right)), r = ha(...d.map((e) => e.left)), i = d.filter((n) => e ? n.left === r : n.right === t), a = i[0].top, o = i[i.length - 1].bottom, s = r, c = t;
|
|
3082
3083
|
return {
|
|
3083
3084
|
top: a,
|
|
3084
3085
|
bottom: o,
|
|
@@ -3101,8 +3102,8 @@ var Xa = function(e) {
|
|
|
3101
3102
|
}
|
|
3102
3103
|
};
|
|
3103
3104
|
};
|
|
3104
|
-
async function
|
|
3105
|
-
let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o =
|
|
3105
|
+
async function Xa(e, t) {
|
|
3106
|
+
let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = Sa(n), s = Ca(n), c = Ea(n) === "y", l = ["left", "top"].includes(o) ? -1 : 1, u = a && c ? -1 : 1, d = xa(t, e), { mainAxis: f, crossAxis: p, alignmentAxis: m } = typeof d == "number" ? {
|
|
3106
3107
|
mainAxis: d,
|
|
3107
3108
|
crossAxis: 0,
|
|
3108
3109
|
alignmentAxis: null
|
|
@@ -3119,13 +3120,13 @@ async function Za(e, t) {
|
|
|
3119
3120
|
y: p * u
|
|
3120
3121
|
};
|
|
3121
3122
|
}
|
|
3122
|
-
var
|
|
3123
|
+
var Za = function(e) {
|
|
3123
3124
|
return e === void 0 && (e = 0), {
|
|
3124
3125
|
name: "offset",
|
|
3125
3126
|
options: e,
|
|
3126
3127
|
async fn(t) {
|
|
3127
3128
|
var n;
|
|
3128
|
-
let { x: r, y: i, placement: a, middlewareData: o } = t, s = await
|
|
3129
|
+
let { x: r, y: i, placement: a, middlewareData: o } = t, s = await Xa(t, e);
|
|
3129
3130
|
return a === o.offset?.placement && (n = o.arrow) != null && n.alignmentOffset ? {} : {
|
|
3130
3131
|
x: r + s.x,
|
|
3131
3132
|
y: i + s.y,
|
|
@@ -3136,7 +3137,7 @@ var Qa = function(e) {
|
|
|
3136
3137
|
};
|
|
3137
3138
|
}
|
|
3138
3139
|
};
|
|
3139
|
-
},
|
|
3140
|
+
}, Qa = function(e) {
|
|
3140
3141
|
return e === void 0 && (e = {}), {
|
|
3141
3142
|
name: "shift",
|
|
3142
3143
|
options: e,
|
|
@@ -3147,17 +3148,17 @@ var Qa = function(e) {
|
|
|
3147
3148
|
x: t,
|
|
3148
3149
|
y: n
|
|
3149
3150
|
};
|
|
3150
|
-
} }, ...c } =
|
|
3151
|
+
} }, ...c } = xa(e, t), l = {
|
|
3151
3152
|
x: n,
|
|
3152
3153
|
y: r
|
|
3153
|
-
}, u = await
|
|
3154
|
+
}, u = await za(t, c), d = Ea(Sa(i)), f = wa(d), p = l[f], m = l[d];
|
|
3154
3155
|
if (a) {
|
|
3155
3156
|
let e = f === "y" ? "top" : "left", t = f === "y" ? "bottom" : "right", n = p + u[e], r = p - u[t];
|
|
3156
|
-
p =
|
|
3157
|
+
p = ba(n, p, r);
|
|
3157
3158
|
}
|
|
3158
3159
|
if (o) {
|
|
3159
3160
|
let e = d === "y" ? "top" : "left", t = d === "y" ? "bottom" : "right", n = m + u[e], r = m - u[t];
|
|
3160
|
-
m =
|
|
3161
|
+
m = ba(n, m, r);
|
|
3161
3162
|
}
|
|
3162
3163
|
let h = s.fn({
|
|
3163
3164
|
...t,
|
|
@@ -3177,15 +3178,15 @@ var Qa = function(e) {
|
|
|
3177
3178
|
};
|
|
3178
3179
|
}
|
|
3179
3180
|
};
|
|
3180
|
-
},
|
|
3181
|
+
}, $a = function(e) {
|
|
3181
3182
|
return e === void 0 && (e = {}), {
|
|
3182
3183
|
name: "size",
|
|
3183
3184
|
options: e,
|
|
3184
3185
|
async fn(t) {
|
|
3185
3186
|
var n, r;
|
|
3186
|
-
let { placement: i, rects: a, platform: o, elements: s } = t, { apply: c = () => {}, ...l } =
|
|
3187
|
+
let { placement: i, rects: a, platform: o, elements: s } = t, { apply: c = () => {}, ...l } = xa(e, t), u = await za(t, l), d = Sa(i), f = Ca(i), p = Ea(i) === "y", { width: m, height: h } = a.floating, g, _;
|
|
3187
3188
|
d === "top" || d === "bottom" ? (g = d, _ = f === (await (o.isRTL == null ? void 0 : o.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (_ = d, g = f === "end" ? "top" : "bottom");
|
|
3188
|
-
let v = h - u.top - u.bottom, y = m - u.left - u.right, b =
|
|
3189
|
+
let v = h - u.top - u.bottom, y = m - u.left - u.right, b = ha(h - u[g], v), x = ha(m - u[_], y), S = !t.middlewareData.shift, C = b, w = x;
|
|
3189
3190
|
if ((n = t.middlewareData.shift) != null && n.enabled.x && (w = y), (r = t.middlewareData.shift) != null && r.enabled.y && (C = v), S && !f) {
|
|
3190
3191
|
let e = X(u.left, 0), t = X(u.right, 0), n = X(u.top, 0), r = X(u.bottom, 0);
|
|
3191
3192
|
p ? w = m - 2 * (e !== 0 || t !== 0 ? e + t : X(u.left, u.right)) : C = h - 2 * (n !== 0 || r !== 0 ? n + r : X(u.top, u.bottom));
|
|
@@ -3200,43 +3201,43 @@ var Qa = function(e) {
|
|
|
3200
3201
|
}
|
|
3201
3202
|
};
|
|
3202
3203
|
};
|
|
3203
|
-
function
|
|
3204
|
+
function eo() {
|
|
3204
3205
|
return typeof window < "u";
|
|
3205
3206
|
}
|
|
3206
|
-
function
|
|
3207
|
-
return
|
|
3207
|
+
function to(e) {
|
|
3208
|
+
return ro(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
3208
3209
|
}
|
|
3209
3210
|
function Z(e) {
|
|
3210
3211
|
var t;
|
|
3211
3212
|
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
3212
3213
|
}
|
|
3214
|
+
function no(e) {
|
|
3215
|
+
return ((ro(e) ? e.ownerDocument : e.document) || window.document)?.documentElement;
|
|
3216
|
+
}
|
|
3213
3217
|
function ro(e) {
|
|
3214
|
-
return (
|
|
3218
|
+
return eo() ? e instanceof Node || e instanceof Z(e).Node : !1;
|
|
3215
3219
|
}
|
|
3216
3220
|
function io(e) {
|
|
3217
|
-
return
|
|
3221
|
+
return eo() ? e instanceof Element || e instanceof Z(e).Element : !1;
|
|
3218
3222
|
}
|
|
3219
3223
|
function ao(e) {
|
|
3220
|
-
return
|
|
3224
|
+
return eo() ? e instanceof HTMLElement || e instanceof Z(e).HTMLElement : !1;
|
|
3221
3225
|
}
|
|
3222
3226
|
function oo(e) {
|
|
3223
|
-
return
|
|
3227
|
+
return !eo() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof Z(e).ShadowRoot;
|
|
3224
3228
|
}
|
|
3225
3229
|
function so(e) {
|
|
3226
|
-
|
|
3227
|
-
}
|
|
3228
|
-
function co(e) {
|
|
3229
|
-
let { overflow: t, overflowX: n, overflowY: r, display: i } = go(e);
|
|
3230
|
+
let { overflow: t, overflowX: n, overflowY: r, display: i } = ho(e);
|
|
3230
3231
|
return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(i);
|
|
3231
3232
|
}
|
|
3232
|
-
function
|
|
3233
|
+
function co(e) {
|
|
3233
3234
|
return [
|
|
3234
3235
|
"table",
|
|
3235
3236
|
"td",
|
|
3236
3237
|
"th"
|
|
3237
|
-
].includes(
|
|
3238
|
+
].includes(to(e));
|
|
3238
3239
|
}
|
|
3239
|
-
function
|
|
3240
|
+
function lo(e) {
|
|
3240
3241
|
return [":popover-open", ":modal"].some((t) => {
|
|
3241
3242
|
try {
|
|
3242
3243
|
return e.matches(t);
|
|
@@ -3245,8 +3246,8 @@ function uo(e) {
|
|
|
3245
3246
|
}
|
|
3246
3247
|
});
|
|
3247
3248
|
}
|
|
3248
|
-
function
|
|
3249
|
-
let t =
|
|
3249
|
+
function uo(e) {
|
|
3250
|
+
let t = po(), n = io(e) ? ho(e) : e;
|
|
3250
3251
|
return [
|
|
3251
3252
|
"transform",
|
|
3252
3253
|
"translate",
|
|
@@ -3267,30 +3268,30 @@ function fo(e) {
|
|
|
3267
3268
|
"content"
|
|
3268
3269
|
].some((e) => (n.contain || "").includes(e));
|
|
3269
3270
|
}
|
|
3270
|
-
function
|
|
3271
|
-
let t =
|
|
3272
|
-
for (;
|
|
3273
|
-
if (
|
|
3274
|
-
if (
|
|
3275
|
-
t =
|
|
3271
|
+
function fo(e) {
|
|
3272
|
+
let t = _o(e);
|
|
3273
|
+
for (; ao(t) && !mo(t);) {
|
|
3274
|
+
if (uo(t)) return t;
|
|
3275
|
+
if (lo(t)) return null;
|
|
3276
|
+
t = _o(t);
|
|
3276
3277
|
}
|
|
3277
3278
|
return null;
|
|
3278
3279
|
}
|
|
3279
|
-
function
|
|
3280
|
+
function po() {
|
|
3280
3281
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
3281
3282
|
}
|
|
3282
|
-
function
|
|
3283
|
+
function mo(e) {
|
|
3283
3284
|
return [
|
|
3284
3285
|
"html",
|
|
3285
3286
|
"body",
|
|
3286
3287
|
"#document"
|
|
3287
|
-
].includes(
|
|
3288
|
+
].includes(to(e));
|
|
3288
3289
|
}
|
|
3289
|
-
function
|
|
3290
|
+
function ho(e) {
|
|
3290
3291
|
return Z(e).getComputedStyle(e);
|
|
3291
3292
|
}
|
|
3292
|
-
function
|
|
3293
|
-
return
|
|
3293
|
+
function go(e) {
|
|
3294
|
+
return io(e) ? {
|
|
3294
3295
|
scrollLeft: e.scrollLeft,
|
|
3295
3296
|
scrollTop: e.scrollTop
|
|
3296
3297
|
} : {
|
|
@@ -3298,101 +3299,101 @@ function _o(e) {
|
|
|
3298
3299
|
scrollTop: e.scrollY
|
|
3299
3300
|
};
|
|
3300
3301
|
}
|
|
3301
|
-
function
|
|
3302
|
-
if (
|
|
3303
|
-
let t = e.assignedSlot || e.parentNode ||
|
|
3304
|
-
return
|
|
3302
|
+
function _o(e) {
|
|
3303
|
+
if (to(e) === "html") return e;
|
|
3304
|
+
let t = e.assignedSlot || e.parentNode || oo(e) && e.host || no(e);
|
|
3305
|
+
return oo(t) ? t.host : t;
|
|
3305
3306
|
}
|
|
3306
|
-
function
|
|
3307
|
-
let t =
|
|
3308
|
-
return
|
|
3307
|
+
function vo(e) {
|
|
3308
|
+
let t = _o(e);
|
|
3309
|
+
return mo(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : ao(t) && so(t) ? t : vo(t);
|
|
3309
3310
|
}
|
|
3310
|
-
function
|
|
3311
|
+
function yo(e, t, n) {
|
|
3311
3312
|
t === void 0 && (t = []), n === void 0 && (n = !0);
|
|
3312
|
-
let r =
|
|
3313
|
+
let r = vo(e), i = r === e.ownerDocument?.body, a = Z(r);
|
|
3313
3314
|
if (i) {
|
|
3314
|
-
let e =
|
|
3315
|
-
return t.concat(a, a.visualViewport || [],
|
|
3315
|
+
let e = bo(a);
|
|
3316
|
+
return t.concat(a, a.visualViewport || [], so(r) ? r : [], e && n ? yo(e) : []);
|
|
3316
3317
|
}
|
|
3317
|
-
return t.concat(r,
|
|
3318
|
+
return t.concat(r, yo(r, [], n));
|
|
3318
3319
|
}
|
|
3319
|
-
function
|
|
3320
|
+
function bo(e) {
|
|
3320
3321
|
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
3321
3322
|
}
|
|
3322
|
-
function
|
|
3323
|
-
let t =
|
|
3323
|
+
function xo(e) {
|
|
3324
|
+
let t = ho(e), n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0, i = ao(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = ga(n) !== a || ga(r) !== o;
|
|
3324
3325
|
return s && (n = a, r = o), {
|
|
3325
3326
|
width: n,
|
|
3326
3327
|
height: r,
|
|
3327
3328
|
$: s
|
|
3328
3329
|
};
|
|
3329
3330
|
}
|
|
3330
|
-
function
|
|
3331
|
-
return
|
|
3331
|
+
function So(e) {
|
|
3332
|
+
return io(e) ? e : e.contextElement;
|
|
3332
3333
|
}
|
|
3333
|
-
function
|
|
3334
|
-
let t =
|
|
3335
|
-
if (!
|
|
3336
|
-
let n = t.getBoundingClientRect(), { width: r, height: i, $: a } =
|
|
3334
|
+
function Co(e) {
|
|
3335
|
+
let t = So(e);
|
|
3336
|
+
if (!ao(t)) return _a(1);
|
|
3337
|
+
let n = t.getBoundingClientRect(), { width: r, height: i, $: a } = xo(t), o = (a ? ga(n.width) : n.width) / r, s = (a ? ga(n.height) : n.height) / i;
|
|
3337
3338
|
return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
|
|
3338
3339
|
x: o,
|
|
3339
3340
|
y: s
|
|
3340
3341
|
};
|
|
3341
3342
|
}
|
|
3342
|
-
var
|
|
3343
|
-
function
|
|
3343
|
+
var wo = /* @__PURE__ */ _a(0);
|
|
3344
|
+
function To(e) {
|
|
3344
3345
|
let t = Z(e);
|
|
3345
|
-
return !
|
|
3346
|
+
return !po() || !t.visualViewport ? wo : {
|
|
3346
3347
|
x: t.visualViewport.offsetLeft,
|
|
3347
3348
|
y: t.visualViewport.offsetTop
|
|
3348
3349
|
};
|
|
3349
3350
|
}
|
|
3350
|
-
function
|
|
3351
|
+
function Eo(e, t, n) {
|
|
3351
3352
|
return t === void 0 && (t = !1), !n || t && n !== Z(e) ? !1 : t;
|
|
3352
3353
|
}
|
|
3353
|
-
function
|
|
3354
|
+
function Do(e, t, n, r) {
|
|
3354
3355
|
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
3355
|
-
let i = e.getBoundingClientRect(), a =
|
|
3356
|
-
t && (r ?
|
|
3357
|
-
let s =
|
|
3356
|
+
let i = e.getBoundingClientRect(), a = So(e), o = _a(1);
|
|
3357
|
+
t && (r ? io(r) && (o = Co(r)) : o = Co(e));
|
|
3358
|
+
let s = Eo(a, n, r) ? To(a) : _a(0), c = (i.left + s.x) / o.x, l = (i.top + s.y) / o.y, u = i.width / o.x, d = i.height / o.y;
|
|
3358
3359
|
if (a) {
|
|
3359
|
-
let e = Z(a), t = r &&
|
|
3360
|
+
let e = Z(a), t = r && io(r) ? Z(r) : r, n = e, i = bo(n);
|
|
3360
3361
|
for (; i && r && t !== n;) {
|
|
3361
|
-
let e =
|
|
3362
|
-
c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n = Z(i), i =
|
|
3362
|
+
let e = Co(i), t = i.getBoundingClientRect(), r = ho(i), a = t.left + (i.clientLeft + parseFloat(r.paddingLeft)) * e.x, o = t.top + (i.clientTop + parseFloat(r.paddingTop)) * e.y;
|
|
3363
|
+
c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n = Z(i), i = bo(n);
|
|
3363
3364
|
}
|
|
3364
3365
|
}
|
|
3365
|
-
return
|
|
3366
|
+
return Ia({
|
|
3366
3367
|
width: u,
|
|
3367
3368
|
height: d,
|
|
3368
3369
|
x: c,
|
|
3369
3370
|
y: l
|
|
3370
3371
|
});
|
|
3371
3372
|
}
|
|
3372
|
-
function
|
|
3373
|
-
let n =
|
|
3374
|
-
return t ? t.left + n :
|
|
3373
|
+
function Oo(e, t) {
|
|
3374
|
+
let n = go(e).scrollLeft;
|
|
3375
|
+
return t ? t.left + n : Do(no(e)).left + n;
|
|
3375
3376
|
}
|
|
3376
|
-
function
|
|
3377
|
+
function ko(e, t, n) {
|
|
3377
3378
|
n === void 0 && (n = !1);
|
|
3378
3379
|
let r = e.getBoundingClientRect();
|
|
3379
3380
|
return {
|
|
3380
|
-
x: r.left + t.scrollLeft - (n ? 0 :
|
|
3381
|
+
x: r.left + t.scrollLeft - (n ? 0 : Oo(e, r)),
|
|
3381
3382
|
y: r.top + t.scrollTop
|
|
3382
3383
|
};
|
|
3383
3384
|
}
|
|
3384
|
-
function
|
|
3385
|
-
let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o =
|
|
3385
|
+
function Ao(e) {
|
|
3386
|
+
let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o = no(r), s = t ? lo(t.floating) : !1;
|
|
3386
3387
|
if (r === o || s && a) return n;
|
|
3387
3388
|
let c = {
|
|
3388
3389
|
scrollLeft: 0,
|
|
3389
3390
|
scrollTop: 0
|
|
3390
|
-
}, l =
|
|
3391
|
-
if ((d || !d && !a) && ((
|
|
3392
|
-
let e =
|
|
3393
|
-
l =
|
|
3391
|
+
}, l = _a(1), u = _a(0), d = ao(r);
|
|
3392
|
+
if ((d || !d && !a) && ((to(r) !== "body" || so(o)) && (c = go(r)), ao(r))) {
|
|
3393
|
+
let e = Do(r);
|
|
3394
|
+
l = Co(r), u.x = e.x + r.clientLeft, u.y = e.y + r.clientTop;
|
|
3394
3395
|
}
|
|
3395
|
-
let f = o && !d && !a ?
|
|
3396
|
+
let f = o && !d && !a ? ko(o, c, !0) : _a(0);
|
|
3396
3397
|
return {
|
|
3397
3398
|
width: n.width * l.x,
|
|
3398
3399
|
height: n.height * l.y,
|
|
@@ -3400,23 +3401,23 @@ function jo(e) {
|
|
|
3400
3401
|
y: n.y * l.y - c.scrollTop * l.y + u.y + f.y
|
|
3401
3402
|
};
|
|
3402
3403
|
}
|
|
3403
|
-
function
|
|
3404
|
+
function jo(e) {
|
|
3404
3405
|
return Array.from(e.getClientRects());
|
|
3405
3406
|
}
|
|
3406
|
-
function
|
|
3407
|
-
let t =
|
|
3408
|
-
return
|
|
3407
|
+
function Mo(e) {
|
|
3408
|
+
let t = no(e), n = go(e), r = e.ownerDocument.body, i = X(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = X(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight), o = -n.scrollLeft + Oo(e), s = -n.scrollTop;
|
|
3409
|
+
return ho(r).direction === "rtl" && (o += X(t.clientWidth, r.clientWidth) - i), {
|
|
3409
3410
|
width: i,
|
|
3410
3411
|
height: a,
|
|
3411
3412
|
x: o,
|
|
3412
3413
|
y: s
|
|
3413
3414
|
};
|
|
3414
3415
|
}
|
|
3415
|
-
function
|
|
3416
|
-
let n = Z(e), r =
|
|
3416
|
+
function No(e, t) {
|
|
3417
|
+
let n = Z(e), r = no(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
|
|
3417
3418
|
if (i) {
|
|
3418
3419
|
a = i.width, o = i.height;
|
|
3419
|
-
let e =
|
|
3420
|
+
let e = po();
|
|
3420
3421
|
(!e || e && t === "fixed") && (s = i.offsetLeft, c = i.offsetTop);
|
|
3421
3422
|
}
|
|
3422
3423
|
return {
|
|
@@ -3426,8 +3427,8 @@ function Po(e, t) {
|
|
|
3426
3427
|
y: c
|
|
3427
3428
|
};
|
|
3428
3429
|
}
|
|
3429
|
-
function
|
|
3430
|
-
let n =
|
|
3430
|
+
function Po(e, t) {
|
|
3431
|
+
let n = Do(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = ao(e) ? Co(e) : _a(1);
|
|
3431
3432
|
return {
|
|
3432
3433
|
width: e.clientWidth * a.x,
|
|
3433
3434
|
height: e.clientHeight * a.y,
|
|
@@ -3435,13 +3436,13 @@ function Fo(e, t) {
|
|
|
3435
3436
|
y: r * a.y
|
|
3436
3437
|
};
|
|
3437
3438
|
}
|
|
3438
|
-
function
|
|
3439
|
+
function Fo(e, t, n) {
|
|
3439
3440
|
let r;
|
|
3440
|
-
if (t === "viewport") r =
|
|
3441
|
-
else if (t === "document") r =
|
|
3442
|
-
else if (
|
|
3441
|
+
if (t === "viewport") r = No(e, n);
|
|
3442
|
+
else if (t === "document") r = Mo(no(e));
|
|
3443
|
+
else if (io(t)) r = Po(t, n);
|
|
3443
3444
|
else {
|
|
3444
|
-
let n =
|
|
3445
|
+
let n = To(e);
|
|
3445
3446
|
r = {
|
|
3446
3447
|
x: t.x - n.x,
|
|
3447
3448
|
y: t.y - n.y,
|
|
@@ -3449,27 +3450,27 @@ function Io(e, t, n) {
|
|
|
3449
3450
|
height: t.height
|
|
3450
3451
|
};
|
|
3451
3452
|
}
|
|
3452
|
-
return
|
|
3453
|
+
return Ia(r);
|
|
3453
3454
|
}
|
|
3454
|
-
function
|
|
3455
|
-
let n =
|
|
3456
|
-
return n === t || !
|
|
3455
|
+
function Io(e, t) {
|
|
3456
|
+
let n = _o(e);
|
|
3457
|
+
return n === t || !io(n) || mo(n) ? !1 : ho(n).position === "fixed" || Io(n, t);
|
|
3457
3458
|
}
|
|
3458
|
-
function
|
|
3459
|
+
function Lo(e, t) {
|
|
3459
3460
|
let n = t.get(e);
|
|
3460
3461
|
if (n) return n;
|
|
3461
|
-
let r =
|
|
3462
|
-
for (;
|
|
3463
|
-
let t =
|
|
3464
|
-
!n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && ["absolute", "fixed"].includes(i.position) ||
|
|
3462
|
+
let r = yo(e, [], !1).filter((e) => io(e) && to(e) !== "body"), i = null, a = ho(e).position === "fixed", o = a ? _o(e) : e;
|
|
3463
|
+
for (; io(o) && !mo(o);) {
|
|
3464
|
+
let t = ho(o), n = uo(o);
|
|
3465
|
+
!n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && ["absolute", "fixed"].includes(i.position) || so(o) && !n && Io(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = _o(o);
|
|
3465
3466
|
}
|
|
3466
3467
|
return t.set(e, r), r;
|
|
3467
3468
|
}
|
|
3468
|
-
function
|
|
3469
|
-
let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ?
|
|
3470
|
-
let r =
|
|
3471
|
-
return e.top = X(r.top, e.top), e.right =
|
|
3472
|
-
},
|
|
3469
|
+
function Ro(e) {
|
|
3470
|
+
let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ? lo(t) ? [] : Lo(t, this._c) : [].concat(n), r], o = a[0], s = a.reduce((e, n) => {
|
|
3471
|
+
let r = Fo(t, n, i);
|
|
3472
|
+
return e.top = X(r.top, e.top), e.right = ha(r.right, e.right), e.bottom = ha(r.bottom, e.bottom), e.left = X(r.left, e.left), e;
|
|
3473
|
+
}, Fo(t, o, i));
|
|
3473
3474
|
return {
|
|
3474
3475
|
width: s.right - s.left,
|
|
3475
3476
|
height: s.bottom - s.top,
|
|
@@ -3477,23 +3478,23 @@ function zo(e) {
|
|
|
3477
3478
|
y: s.top
|
|
3478
3479
|
};
|
|
3479
3480
|
}
|
|
3480
|
-
function
|
|
3481
|
-
let { width: t, height: n } =
|
|
3481
|
+
function zo(e) {
|
|
3482
|
+
let { width: t, height: n } = xo(e);
|
|
3482
3483
|
return {
|
|
3483
3484
|
width: t,
|
|
3484
3485
|
height: n
|
|
3485
3486
|
};
|
|
3486
3487
|
}
|
|
3487
|
-
function
|
|
3488
|
-
let r =
|
|
3488
|
+
function Bo(e, t, n) {
|
|
3489
|
+
let r = ao(t), i = no(t), a = n === "fixed", o = Do(e, !0, a, t), s = {
|
|
3489
3490
|
scrollLeft: 0,
|
|
3490
3491
|
scrollTop: 0
|
|
3491
|
-
}, c =
|
|
3492
|
-
if (r || !r && !a) if ((
|
|
3493
|
-
let e =
|
|
3492
|
+
}, c = _a(0);
|
|
3493
|
+
if (r || !r && !a) if ((to(t) !== "body" || so(i)) && (s = go(t)), r) {
|
|
3494
|
+
let e = Do(t, !0, a, t);
|
|
3494
3495
|
c.x = e.x + t.clientLeft, c.y = e.y + t.clientTop;
|
|
3495
|
-
} else i && (c.x =
|
|
3496
|
-
let l = i && !r && !a ?
|
|
3496
|
+
} else i && (c.x = Oo(i));
|
|
3497
|
+
let l = i && !r && !a ? ko(i, s) : _a(0);
|
|
3497
3498
|
return {
|
|
3498
3499
|
x: o.left + s.scrollLeft - c.x - l.x,
|
|
3499
3500
|
y: o.top + s.scrollTop - c.y - l.y,
|
|
@@ -3501,34 +3502,34 @@ function Vo(e, t, n) {
|
|
|
3501
3502
|
height: o.height
|
|
3502
3503
|
};
|
|
3503
3504
|
}
|
|
3504
|
-
function
|
|
3505
|
-
return
|
|
3505
|
+
function Vo(e) {
|
|
3506
|
+
return ho(e).position === "static";
|
|
3506
3507
|
}
|
|
3507
|
-
function
|
|
3508
|
-
if (!
|
|
3508
|
+
function Ho(e, t) {
|
|
3509
|
+
if (!ao(e) || ho(e).position === "fixed") return null;
|
|
3509
3510
|
if (t) return t(e);
|
|
3510
3511
|
let n = e.offsetParent;
|
|
3511
|
-
return
|
|
3512
|
+
return no(e) === n && (n = n.ownerDocument.body), n;
|
|
3512
3513
|
}
|
|
3513
|
-
function
|
|
3514
|
+
function Uo(e, t) {
|
|
3514
3515
|
let n = Z(e);
|
|
3515
|
-
if (
|
|
3516
|
-
if (!
|
|
3517
|
-
let t =
|
|
3518
|
-
for (; t && !
|
|
3519
|
-
if (
|
|
3520
|
-
t =
|
|
3516
|
+
if (lo(e)) return n;
|
|
3517
|
+
if (!ao(e)) {
|
|
3518
|
+
let t = _o(e);
|
|
3519
|
+
for (; t && !mo(t);) {
|
|
3520
|
+
if (io(t) && !Vo(t)) return t;
|
|
3521
|
+
t = _o(t);
|
|
3521
3522
|
}
|
|
3522
3523
|
return n;
|
|
3523
3524
|
}
|
|
3524
|
-
let r =
|
|
3525
|
-
for (; r &&
|
|
3526
|
-
return r &&
|
|
3525
|
+
let r = Ho(e, t);
|
|
3526
|
+
for (; r && co(r) && Vo(r);) r = Ho(r, t);
|
|
3527
|
+
return r && mo(r) && Vo(r) && !uo(r) ? n : r || fo(e) || n;
|
|
3527
3528
|
}
|
|
3528
|
-
var
|
|
3529
|
-
let t = this.getOffsetParent ||
|
|
3529
|
+
var Wo = async function(e) {
|
|
3530
|
+
let t = this.getOffsetParent || Uo, n = this.getDimensions, r = await n(e.floating);
|
|
3530
3531
|
return {
|
|
3531
|
-
reference:
|
|
3532
|
+
reference: Bo(e.reference, await t(e.floating), e.strategy),
|
|
3532
3533
|
floating: {
|
|
3533
3534
|
x: 0,
|
|
3534
3535
|
y: 0,
|
|
@@ -3537,38 +3538,38 @@ var Go = async function(e) {
|
|
|
3537
3538
|
}
|
|
3538
3539
|
};
|
|
3539
3540
|
};
|
|
3540
|
-
function
|
|
3541
|
-
return
|
|
3541
|
+
function Go(e) {
|
|
3542
|
+
return ho(e).direction === "rtl";
|
|
3542
3543
|
}
|
|
3543
|
-
var
|
|
3544
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
3545
|
-
getDocumentElement:
|
|
3546
|
-
getClippingRect:
|
|
3547
|
-
getOffsetParent:
|
|
3548
|
-
getElementRects:
|
|
3549
|
-
getClientRects:
|
|
3550
|
-
getDimensions:
|
|
3551
|
-
getScale:
|
|
3552
|
-
isElement:
|
|
3553
|
-
isRTL:
|
|
3554
|
-
}, Jo =
|
|
3544
|
+
var Ko = {
|
|
3545
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Ao,
|
|
3546
|
+
getDocumentElement: no,
|
|
3547
|
+
getClippingRect: Ro,
|
|
3548
|
+
getOffsetParent: Uo,
|
|
3549
|
+
getElementRects: Wo,
|
|
3550
|
+
getClientRects: jo,
|
|
3551
|
+
getDimensions: zo,
|
|
3552
|
+
getScale: Co,
|
|
3553
|
+
isElement: io,
|
|
3554
|
+
isRTL: Go
|
|
3555
|
+
}, qo = Za, Jo = Ha, Yo = Qa, Xo = Ua, Zo = $a, Qo = Ka, $o = Ba, es = Ya, ts = (e, t, n) => {
|
|
3555
3556
|
let r = /* @__PURE__ */ new Map(), i = {
|
|
3556
|
-
platform:
|
|
3557
|
+
platform: Ko,
|
|
3557
3558
|
...n
|
|
3558
3559
|
}, a = {
|
|
3559
3560
|
...i.platform,
|
|
3560
3561
|
_c: r
|
|
3561
3562
|
};
|
|
3562
|
-
return
|
|
3563
|
+
return Ra(e, t, {
|
|
3563
3564
|
...i,
|
|
3564
3565
|
platform: a
|
|
3565
3566
|
});
|
|
3566
3567
|
};
|
|
3567
|
-
function
|
|
3568
|
+
function ns(e, t) {
|
|
3568
3569
|
let n = Math.min(e.top, t.top), r = Math.max(e.bottom, t.bottom), i = Math.min(e.left, t.left), a = Math.max(e.right, t.right) - i, o = r - n;
|
|
3569
3570
|
return new DOMRect(i, n, a, o);
|
|
3570
3571
|
}
|
|
3571
|
-
var
|
|
3572
|
+
var rs = class {
|
|
3572
3573
|
constructor({ editor: e, element: t, view: n, pluginKey: r = "bubbleMenu", updateDelay: i = 250, resizeDelay: a = 60, shouldShow: o, appendTo: s, getReferencedVirtualElement: c, options: l }) {
|
|
3573
3574
|
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
|
|
3574
3575
|
strategy: "absolute",
|
|
@@ -3632,7 +3633,7 @@ var is = class {
|
|
|
3632
3633
|
}
|
|
3633
3634
|
get middlewares() {
|
|
3634
3635
|
let e = [];
|
|
3635
|
-
return this.floatingUIOptions.flip && e.push(
|
|
3636
|
+
return this.floatingUIOptions.flip && e.push(Xo(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(Yo(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(qo(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push($o(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(Zo(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(Jo(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(Qo(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(es(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
|
|
3636
3637
|
}
|
|
3637
3638
|
get virtualElement() {
|
|
3638
3639
|
let { selection: e } = this.editor.state, t = this.getReferencedVirtualElement?.call(this);
|
|
@@ -3652,7 +3653,7 @@ var is = class {
|
|
|
3652
3653
|
if (e instanceof ce) {
|
|
3653
3654
|
let { $anchorCell: t, $headCell: n } = e, i = t ? t.pos : n.pos, a = n ? n.pos : t.pos, o = this.view.nodeDOM(i), s = this.view.nodeDOM(a);
|
|
3654
3655
|
if (!o || !s) return;
|
|
3655
|
-
let c = o === s ? o.getBoundingClientRect() :
|
|
3656
|
+
let c = o === s ? o.getBoundingClientRect() : ns(o.getBoundingClientRect(), s.getBoundingClientRect());
|
|
3656
3657
|
r = {
|
|
3657
3658
|
getBoundingClientRect: () => c,
|
|
3658
3659
|
getClientRects: () => [c]
|
|
@@ -3663,7 +3664,7 @@ var is = class {
|
|
|
3663
3664
|
updatePosition() {
|
|
3664
3665
|
if (!this.isVisible) return;
|
|
3665
3666
|
let e = this.virtualElement;
|
|
3666
|
-
e &&
|
|
3667
|
+
e && ts(e, this.element, {
|
|
3667
3668
|
placement: this.floatingUIOptions.placement,
|
|
3668
3669
|
strategy: this.floatingUIOptions.strategy,
|
|
3669
3670
|
middleware: this.middlewares
|
|
@@ -3717,13 +3718,13 @@ var is = class {
|
|
|
3717
3718
|
destroy() {
|
|
3718
3719
|
this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
|
|
3719
3720
|
}
|
|
3720
|
-
},
|
|
3721
|
+
}, is = (e) => new oe({
|
|
3721
3722
|
key: typeof e.pluginKey == "string" ? new se(e.pluginKey) : e.pluginKey,
|
|
3722
|
-
view: (t) => new
|
|
3723
|
+
view: (t) => new rs({
|
|
3723
3724
|
view: t,
|
|
3724
3725
|
...e
|
|
3725
3726
|
})
|
|
3726
|
-
}),
|
|
3727
|
+
}), as = {
|
|
3727
3728
|
name: "BubbleMenu",
|
|
3728
3729
|
inheritAttrs: !1,
|
|
3729
3730
|
props: {
|
|
@@ -3753,7 +3754,7 @@ var is = class {
|
|
|
3753
3754
|
mounted() {
|
|
3754
3755
|
let e = this.editor, t = this.$el;
|
|
3755
3756
|
!e || !t || (t.style.visibility = "hidden", t.style.position = "absolute", t.remove(), this.$nextTick(() => {
|
|
3756
|
-
e.registerPlugin(
|
|
3757
|
+
e.registerPlugin(is({
|
|
3757
3758
|
updateDelay: this.updateDelay,
|
|
3758
3759
|
resizeDelay: this.resizeDelay,
|
|
3759
3760
|
options: this.options,
|
|
@@ -3781,7 +3782,7 @@ var is = class {
|
|
|
3781
3782
|
methods: { getPluginKey() {
|
|
3782
3783
|
return this.generatedPluginKey ||= this.pluginKey ?? new se("bubbleMenu"), this.generatedPluginKey;
|
|
3783
3784
|
} }
|
|
3784
|
-
},
|
|
3785
|
+
}, os = {
|
|
3785
3786
|
active: !1,
|
|
3786
3787
|
mode: "outside",
|
|
3787
3788
|
activeCellPos: null,
|
|
@@ -3789,17 +3790,17 @@ var is = class {
|
|
|
3789
3790
|
selectedCellCount: 0,
|
|
3790
3791
|
selectionFrom: 0,
|
|
3791
3792
|
selectionTo: 0
|
|
3792
|
-
},
|
|
3793
|
+
}, ss = {
|
|
3793
3794
|
active: !1,
|
|
3794
|
-
language:
|
|
3795
|
+
language: dt.defaultLanguage,
|
|
3795
3796
|
mermaidPreviewMode: "code",
|
|
3796
3797
|
pos: null,
|
|
3797
3798
|
text: ""
|
|
3798
3799
|
};
|
|
3799
|
-
function
|
|
3800
|
-
return
|
|
3800
|
+
function cs(e) {
|
|
3801
|
+
return Mn.getState(e.state) ?? jn;
|
|
3801
3802
|
}
|
|
3802
|
-
function
|
|
3803
|
+
function ls(e) {
|
|
3803
3804
|
if (!e || typeof window > "u") return null;
|
|
3804
3805
|
let t = e.parentElement;
|
|
3805
3806
|
for (; t;) {
|
|
@@ -3816,7 +3817,7 @@ function Q(e, t, n = 18, r = 1.8) {
|
|
|
3816
3817
|
"aria-hidden": "true"
|
|
3817
3818
|
}, { default: () => t });
|
|
3818
3819
|
}
|
|
3819
|
-
function
|
|
3820
|
+
function us(e) {
|
|
3820
3821
|
return e === "clipboard" ? [U("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" }), U("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" ? [U("circle", {
|
|
3821
3822
|
cx: "10",
|
|
3822
3823
|
cy: "10",
|
|
@@ -3853,7 +3854,7 @@ function ds(e) {
|
|
|
3853
3854
|
U("path", { d: "m14 14 4 4" })
|
|
3854
3855
|
] : e === "reset" ? [U("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), U("path", { d: "M6.5 8.5H3.5v-3" })] : [U("path", { d: "m6 9 6 6 6-6" })];
|
|
3855
3856
|
}
|
|
3856
|
-
function
|
|
3857
|
+
function ds(e) {
|
|
3857
3858
|
return U("svg", {
|
|
3858
3859
|
viewBox: "0 0 24 24",
|
|
3859
3860
|
"aria-hidden": "true",
|
|
@@ -3864,65 +3865,65 @@ function fs(e) {
|
|
|
3864
3865
|
"stroke-linecap": "round",
|
|
3865
3866
|
"stroke-linejoin": "round",
|
|
3866
3867
|
"stroke-width": "1.8"
|
|
3867
|
-
},
|
|
3868
|
+
}, us(e)));
|
|
3868
3869
|
}
|
|
3869
3870
|
function $(e) {
|
|
3870
3871
|
e.preventDefault();
|
|
3871
3872
|
}
|
|
3872
|
-
function
|
|
3873
|
-
let t =
|
|
3873
|
+
function fs(e) {
|
|
3874
|
+
let t = Ht(e);
|
|
3874
3875
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
3875
3876
|
}
|
|
3876
|
-
var
|
|
3877
|
-
bold:
|
|
3878
|
-
italic:
|
|
3879
|
-
underline:
|
|
3880
|
-
strike:
|
|
3881
|
-
"inline-code":
|
|
3882
|
-
link:
|
|
3883
|
-
more:
|
|
3884
|
-
superscript:
|
|
3885
|
-
subscript:
|
|
3886
|
-
"inline-math":
|
|
3887
|
-
"align-left":
|
|
3888
|
-
"align-center":
|
|
3889
|
-
"align-right":
|
|
3890
|
-
"align-justify":
|
|
3891
|
-
"decrease-indent":
|
|
3892
|
-
"increase-indent":
|
|
3893
|
-
},
|
|
3894
|
-
type:
|
|
3895
|
-
"heading-1":
|
|
3896
|
-
"heading-2":
|
|
3897
|
-
"heading-3":
|
|
3898
|
-
"bullet-list":
|
|
3899
|
-
"ordered-list":
|
|
3900
|
-
"task-list":
|
|
3901
|
-
blockquote:
|
|
3902
|
-
"code-block":
|
|
3903
|
-
info:
|
|
3904
|
-
tip:
|
|
3905
|
-
warning:
|
|
3906
|
-
error:
|
|
3907
|
-
success:
|
|
3908
|
-
emoji:
|
|
3909
|
-
math:
|
|
3910
|
-
table:
|
|
3911
|
-
separator:
|
|
3912
|
-
image:
|
|
3913
|
-
video:
|
|
3914
|
-
attachment:
|
|
3877
|
+
var ps = {
|
|
3878
|
+
bold: Wr,
|
|
3879
|
+
italic: pi,
|
|
3880
|
+
underline: Hi,
|
|
3881
|
+
strike: Ni,
|
|
3882
|
+
"inline-code": $r,
|
|
3883
|
+
link: hi,
|
|
3884
|
+
more: bi,
|
|
3885
|
+
superscript: Fi,
|
|
3886
|
+
subscript: Pi,
|
|
3887
|
+
"inline-math": Oi,
|
|
3888
|
+
"align-left": Or,
|
|
3889
|
+
"align-center": Er,
|
|
3890
|
+
"align-right": kr,
|
|
3891
|
+
"align-justify": Dr,
|
|
3892
|
+
"decrease-indent": ui,
|
|
3893
|
+
"increase-indent": di
|
|
3894
|
+
}, ms = {
|
|
3895
|
+
type: zi,
|
|
3896
|
+
"heading-1": ai,
|
|
3897
|
+
"heading-2": oi,
|
|
3898
|
+
"heading-3": si,
|
|
3899
|
+
"bullet-list": gi,
|
|
3900
|
+
"ordered-list": vi,
|
|
3901
|
+
"task-list": _i,
|
|
3902
|
+
blockquote: Ti,
|
|
3903
|
+
"code-block": Gr,
|
|
3904
|
+
info: fi,
|
|
3905
|
+
tip: mi,
|
|
3906
|
+
warning: Nr,
|
|
3907
|
+
error: Qr,
|
|
3908
|
+
success: Jr,
|
|
3909
|
+
emoji: ki,
|
|
3910
|
+
math: Oi,
|
|
3911
|
+
table: Ii,
|
|
3912
|
+
separator: yi,
|
|
3913
|
+
image: ci,
|
|
3914
|
+
video: Wi,
|
|
3915
|
+
attachment: Si
|
|
3915
3916
|
};
|
|
3916
|
-
function
|
|
3917
|
+
function hs(e) {
|
|
3917
3918
|
if (typeof e != "string") {
|
|
3918
3919
|
if (e.kind === "text") return U("span", {
|
|
3919
3920
|
class: "markweave-slash-command-text-icon",
|
|
3920
|
-
"data-icon-length":
|
|
3921
|
+
"data-icon-length": cn(e),
|
|
3921
3922
|
"aria-hidden": "true"
|
|
3922
3923
|
}, e.text);
|
|
3923
3924
|
e = e.name;
|
|
3924
3925
|
}
|
|
3925
|
-
let t =
|
|
3926
|
+
let t = ms[e];
|
|
3926
3927
|
return U(t, {
|
|
3927
3928
|
size: 18,
|
|
3928
3929
|
strokeWidth: 1.6,
|
|
@@ -3930,21 +3931,21 @@ function gs(e) {
|
|
|
3930
3931
|
"aria-hidden": "true"
|
|
3931
3932
|
});
|
|
3932
3933
|
}
|
|
3933
|
-
var
|
|
3934
|
-
paragraph:
|
|
3935
|
-
"heading-1":
|
|
3936
|
-
"heading-2":
|
|
3937
|
-
"heading-3":
|
|
3938
|
-
"bullet-list":
|
|
3939
|
-
"numbered-list":
|
|
3940
|
-
"todo-list":
|
|
3941
|
-
quote:
|
|
3942
|
-
"code-block":
|
|
3934
|
+
var gs = {
|
|
3935
|
+
paragraph: Vi,
|
|
3936
|
+
"heading-1": ai,
|
|
3937
|
+
"heading-2": oi,
|
|
3938
|
+
"heading-3": si,
|
|
3939
|
+
"bullet-list": gi,
|
|
3940
|
+
"numbered-list": vi,
|
|
3941
|
+
"todo-list": _i,
|
|
3942
|
+
quote: Ti,
|
|
3943
|
+
"code-block": Gr
|
|
3943
3944
|
};
|
|
3944
|
-
function
|
|
3945
|
+
function _s(e, t) {
|
|
3945
3946
|
return _e(e, t).label;
|
|
3946
3947
|
}
|
|
3947
|
-
var
|
|
3948
|
+
var vs = J({
|
|
3948
3949
|
name: "MarkweaveVueFloatingToolbar",
|
|
3949
3950
|
props: {
|
|
3950
3951
|
editor: {
|
|
@@ -3969,10 +3970,10 @@ var ys = J({
|
|
|
3969
3970
|
}
|
|
3970
3971
|
},
|
|
3971
3972
|
setup(e) {
|
|
3972
|
-
let t = W(null), n = W("input"), r = W(""), i = W(""), a = W(""), o = W(""), s =
|
|
3973
|
+
let t = W(null), n = W("input"), r = W(""), i = W(""), a = W(""), o = W(""), s = xr(null), c = xr(null), l = W(null), u = W(null), d = "", f = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = W(""), m = W(null), h = W(null), g = W("bottom"), _ = W(null), v = W(null), y = W(null), b = G(() => Ht(p.value.trim())), x = G(() => e.messages.floatingToolbar), S = G(() => xe(e.messages).map((e) => [
|
|
3973
3974
|
e.id,
|
|
3974
3975
|
e.label,
|
|
3975
|
-
|
|
3976
|
+
gs[e.id]
|
|
3976
3977
|
])), C = G(() => be(e.messages).map((e) => [
|
|
3977
3978
|
e.id,
|
|
3978
3979
|
e.value,
|
|
@@ -3988,12 +3989,12 @@ var ys = J({
|
|
|
3988
3989
|
}, O = (n) => {
|
|
3989
3990
|
t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
|
|
3990
3991
|
}, k = de(() => {
|
|
3991
|
-
|
|
3992
|
+
Je(e.editor, d), a.value = d;
|
|
3992
3993
|
}), A = (n = !0) => {
|
|
3993
|
-
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n &&
|
|
3994
|
+
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && Ke(e.editor), Re(e.editor), t.value = null, n && e.editor.commands.focus();
|
|
3994
3995
|
}, j = () => {
|
|
3995
3996
|
if (!f.value) return;
|
|
3996
|
-
let r =
|
|
3997
|
+
let r = Xe(e.editor);
|
|
3997
3998
|
r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", q(() => u.value?.focus()));
|
|
3998
3999
|
}, M = async (t) => {
|
|
3999
4000
|
if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
|
|
@@ -4002,40 +4003,40 @@ var ys = J({
|
|
|
4002
4003
|
o.value = e.messages.askAi.emptyPrompt, n.value = "error";
|
|
4003
4004
|
return;
|
|
4004
4005
|
}
|
|
4005
|
-
let p =
|
|
4006
|
+
let p = Be(e.editor, s.value);
|
|
4006
4007
|
if (!p) {
|
|
4007
4008
|
n.value = "conflict";
|
|
4008
4009
|
return;
|
|
4009
4010
|
}
|
|
4010
|
-
s.value = p, c.value?.abort(),
|
|
4011
|
-
let m = new AbortController(), h =
|
|
4011
|
+
s.value = p, c.value?.abort(), Le(e.editor);
|
|
4012
|
+
let m = new AbortController(), h = ze(p, u, e.lang, m.signal, void 0, He(e.editor)?.target);
|
|
4012
4013
|
c.value = m, l.value = h.id, i.value = u, k.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
|
|
4013
4014
|
try {
|
|
4014
|
-
let t = await
|
|
4015
|
+
let t = await qe(e.askAi.handler, h, (e) => {
|
|
4015
4016
|
l.value === h.id && !m.signal.aborted && (d = e, k.schedule());
|
|
4016
4017
|
});
|
|
4017
4018
|
if (l.value !== h.id || m.signal.aborted) return;
|
|
4018
|
-
if (k.cancel(), d = t, !
|
|
4019
|
-
a.value = t, r.value = "", n.value =
|
|
4019
|
+
if (k.cancel(), d = t, !Je(e.editor, t)) throw new Ne("invalid-output", "Ask AI output is incompatible with the selected content.");
|
|
4020
|
+
a.value = t, r.value = "", n.value = He(e.editor)?.status === "target" ? "result" : "conflict";
|
|
4020
4021
|
} catch (t) {
|
|
4021
4022
|
if (l.value !== h.id) return;
|
|
4022
4023
|
if (k.cancel(), m.signal.aborted) {
|
|
4023
|
-
|
|
4024
|
+
Le(e.editor), n.value = He(e.editor)?.status === "conflict" ? "conflict" : "input";
|
|
4024
4025
|
return;
|
|
4025
4026
|
}
|
|
4026
|
-
|
|
4027
|
+
Le(e.editor), o.value = t instanceof Ne ? t.code === "empty-result" ? e.messages.askAi.emptyResult : e.messages.askAi.errorFallback : t instanceof Error && t.message ? t.message : e.messages.askAi.errorFallback, n.value = "error";
|
|
4027
4028
|
}
|
|
4028
4029
|
}, N = () => {
|
|
4029
|
-
if (!
|
|
4030
|
-
n.value =
|
|
4030
|
+
if (!Pe(e.editor, a.value)) {
|
|
4031
|
+
n.value = He(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
|
|
4031
4032
|
return;
|
|
4032
4033
|
}
|
|
4033
|
-
t.value = null, window.setTimeout(() =>
|
|
4034
|
+
t.value = null, window.setTimeout(() => Re(e.editor), 560), e.editor.commands.focus();
|
|
4034
4035
|
}, P = de(() => {
|
|
4035
4036
|
let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
4036
4037
|
if (!t.value || !n || !r) return;
|
|
4037
4038
|
if (t.value === "ask-ai") {
|
|
4038
|
-
let t =
|
|
4039
|
+
let t = Ue(e.editor), n = v.value?.getBoundingClientRect();
|
|
4039
4040
|
if (!t || !n) return;
|
|
4040
4041
|
let a = {
|
|
4041
4042
|
anchorRect: n,
|
|
@@ -4045,18 +4046,18 @@ var ys = J({
|
|
|
4045
4046
|
height: window.innerHeight
|
|
4046
4047
|
},
|
|
4047
4048
|
frameRect: i?.getBoundingClientRect() ?? null,
|
|
4048
|
-
surfaceRect:
|
|
4049
|
-
}, o =
|
|
4049
|
+
surfaceRect: Ve(e.editor.view.dom)
|
|
4050
|
+
}, o = Fe({
|
|
4050
4051
|
...a,
|
|
4051
4052
|
panelSize: r.getBoundingClientRect()
|
|
4052
4053
|
}), s = `${o.width}px`;
|
|
4053
|
-
r.style.width !== s && (r.style.width = s, o =
|
|
4054
|
+
r.style.width !== s && (r.style.width = s, o = Fe({
|
|
4054
4055
|
...a,
|
|
4055
4056
|
panelSize: r.getBoundingClientRect()
|
|
4056
4057
|
})), r.style.left = `${o.left}px`, r.style.top = `${o.top}px`, r.style.bottom = "auto", r.style.maxWidth = `${o.maxWidth}px`, r.style.maxHeight = `${Math.max(0, o.maxHeight)}px`, r.dataset.positioned = "true", g.value = o.placement;
|
|
4057
4058
|
return;
|
|
4058
4059
|
}
|
|
4059
|
-
let a =
|
|
4060
|
+
let a = Ee({
|
|
4060
4061
|
toolbarRect: n.getBoundingClientRect(),
|
|
4061
4062
|
popoverSize: r.getBoundingClientRect(),
|
|
4062
4063
|
viewport: {
|
|
@@ -4068,7 +4069,7 @@ var ys = J({
|
|
|
4068
4069
|
});
|
|
4069
4070
|
g.value = a.placement;
|
|
4070
4071
|
}), F = () => {
|
|
4071
|
-
let l =
|
|
4072
|
+
let l = He(e.editor);
|
|
4072
4073
|
if (l?.target.kind === "table" && l.status === "target" && t.value !== "ask-ai") {
|
|
4073
4074
|
s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", q(() => u.value?.focus());
|
|
4074
4075
|
return;
|
|
@@ -4092,10 +4093,10 @@ var ys = J({
|
|
|
4092
4093
|
o.value
|
|
4093
4094
|
], ([e]) => {
|
|
4094
4095
|
e && q(P.schedule);
|
|
4095
|
-
}),
|
|
4096
|
+
}), Sr(() => {
|
|
4096
4097
|
window.addEventListener("resize", P.schedule), window.addEventListener("scroll", P.schedule, !0), e.editor.on("transaction", F), document.addEventListener("pointerdown", ee, !0), document.addEventListener("keydown", I, !0);
|
|
4097
|
-
}),
|
|
4098
|
-
P.cancel(), k.cancel(), window.removeEventListener("resize", P.schedule), window.removeEventListener("scroll", P.schedule, !0), e.editor.off("transaction", F), document.removeEventListener("pointerdown", ee, !0), document.removeEventListener("keydown", I, !0), c.value?.abort(),
|
|
4098
|
+
}), Cr(() => {
|
|
4099
|
+
P.cancel(), k.cancel(), window.removeEventListener("resize", P.schedule), window.removeEventListener("scroll", P.schedule, !0), e.editor.off("transaction", F), document.removeEventListener("pointerdown", ee, !0), document.removeEventListener("keydown", I, !0), c.value?.abort(), Re(e.editor);
|
|
4099
4100
|
});
|
|
4100
4101
|
let L = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, R = (e, t) => {
|
|
4101
4102
|
if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
|
|
@@ -4136,7 +4137,7 @@ var ys = J({
|
|
|
4136
4137
|
onMouseenter: (e) => R(n, e.currentTarget),
|
|
4137
4138
|
onMouseleave: () => R(null),
|
|
4138
4139
|
onClick: a
|
|
4139
|
-
}, n === "ask-ai" ? [U("span", { class: "markweave-floating-toolbar-button-inner" }, [Q(i, r), U("span", null, s ?? r)])] : n === "block-type" ? [U("span", { class: "markweave-floating-toolbar-button-inner" }, [U("span", { class: "markweave-floating-toolbar-block-label" },
|
|
4140
|
+
}, n === "ask-ai" ? [U("span", { class: "markweave-floating-toolbar-button-inner" }, [Q(i, r), U("span", null, s ?? r)])] : n === "block-type" ? [U("span", { class: "markweave-floating-toolbar-button-inner" }, [U("span", { class: "markweave-floating-toolbar-block-label" }, _s(e.editor, e.messages)), Q(t.value === "block-type" ? Zr : Yr, r)])] : n === "color" ? [U("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [U("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Q(t.value === "color" ? Zr : Yr, r)])] : [Q(i, r)]), B = () => U("span", {
|
|
4140
4141
|
class: "markweave-floating-toolbar-divider",
|
|
4141
4142
|
"aria-hidden": "true"
|
|
4142
4143
|
}), V = (n, r, i) => U("section", {
|
|
@@ -4190,7 +4191,7 @@ var ys = J({
|
|
|
4190
4191
|
onClick: () => {
|
|
4191
4192
|
M();
|
|
4192
4193
|
}
|
|
4193
|
-
}, [Q(
|
|
4194
|
+
}, [Q(Rr, e.messages.askAi.send)])]) : null;
|
|
4194
4195
|
return U("section", {
|
|
4195
4196
|
ref: y,
|
|
4196
4197
|
class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
|
|
@@ -4206,7 +4207,7 @@ var ys = J({
|
|
|
4206
4207
|
U("span", {
|
|
4207
4208
|
class: "markweave-ask-ai-sparkles",
|
|
4208
4209
|
"aria-hidden": "true"
|
|
4209
|
-
}, [Q(
|
|
4210
|
+
}, [Q(Ai, "")]),
|
|
4210
4211
|
U("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
|
|
4211
4212
|
U("button", {
|
|
4212
4213
|
type: "button",
|
|
@@ -4214,17 +4215,17 @@ var ys = J({
|
|
|
4214
4215
|
"aria-label": e.messages.askAi.stop,
|
|
4215
4216
|
onMousedown: $,
|
|
4216
4217
|
onClick: () => {
|
|
4217
|
-
c.value?.abort(), k.cancel(),
|
|
4218
|
+
c.value?.abort(), k.cancel(), Le(e.editor), n.value = "input";
|
|
4218
4219
|
}
|
|
4219
|
-
}, [Q(
|
|
4220
|
+
}, [Q(ji, e.messages.askAi.stop)])
|
|
4220
4221
|
]) : null,
|
|
4221
4222
|
n.value === "result" ? U("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
4222
4223
|
t(e.messages.askAi.retry, () => {
|
|
4223
4224
|
M(i.value);
|
|
4224
|
-
}, "markweave-ask-ai-retry",
|
|
4225
|
+
}, "markweave-ask-ai-retry", Di),
|
|
4225
4226
|
U("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
4226
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
4227
|
-
t(e.messages.askAi.accept, N, "markweave-ask-ai-accept",
|
|
4227
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Gi),
|
|
4228
|
+
t(e.messages.askAi.accept, N, "markweave-ask-ai-accept", qr)
|
|
4228
4229
|
]) : null,
|
|
4229
4230
|
n.value === "error" || n.value === "conflict" ? U("div", {
|
|
4230
4231
|
class: "markweave-ask-ai-error",
|
|
@@ -4232,9 +4233,9 @@ var ys = J({
|
|
|
4232
4233
|
}, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, U("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
4233
4234
|
n.value === "error" ? t(e.messages.askAi.retry, () => {
|
|
4234
4235
|
M(i.value);
|
|
4235
|
-
}, "markweave-ask-ai-retry",
|
|
4236
|
+
}, "markweave-ask-ai-retry", Di) : null,
|
|
4236
4237
|
U("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
4237
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
4238
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Gi)
|
|
4238
4239
|
])]) : null
|
|
4239
4240
|
]);
|
|
4240
4241
|
}
|
|
@@ -4272,7 +4273,7 @@ var ys = J({
|
|
|
4272
4273
|
"aria-label": x.value.applyLink,
|
|
4273
4274
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
4274
4275
|
onMousedown: $
|
|
4275
|
-
}, [Q(
|
|
4276
|
+
}, [Q(ei, x.value.applyLink)]),
|
|
4276
4277
|
U("span", {
|
|
4277
4278
|
class: "markweave-floating-toolbar-link-divider",
|
|
4278
4279
|
"aria-hidden": "true"
|
|
@@ -4283,15 +4284,15 @@ var ys = J({
|
|
|
4283
4284
|
"aria-label": x.value.openLink,
|
|
4284
4285
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
4285
4286
|
onMousedown: $,
|
|
4286
|
-
onClick: () =>
|
|
4287
|
-
}, [Q(
|
|
4287
|
+
onClick: () => fs(p.value)
|
|
4288
|
+
}, [Q(ii, x.value.openLink)]),
|
|
4288
4289
|
U("button", {
|
|
4289
4290
|
type: "button",
|
|
4290
4291
|
"aria-label": x.value.removeLink,
|
|
4291
4292
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
4292
4293
|
onMousedown: $,
|
|
4293
4294
|
onClick: D
|
|
4294
|
-
}, [Q(
|
|
4295
|
+
}, [Q(Bi, x.value.removeLink)])
|
|
4295
4296
|
])]) : t.value === "color" ? U("div", {
|
|
4296
4297
|
ref: y,
|
|
4297
4298
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
@@ -4318,23 +4319,23 @@ var ys = J({
|
|
|
4318
4319
|
onClick: () => {
|
|
4319
4320
|
Se(e.editor, n), t.value = null;
|
|
4320
4321
|
}
|
|
4321
|
-
}, [Q(
|
|
4322
|
+
}, [Q(ps[n], x.value.moreActions[n])]), m.value === n ? U("div", {
|
|
4322
4323
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
4323
4324
|
role: "tooltip"
|
|
4324
4325
|
}, x.value.moreActions[n]) : null]))) : null;
|
|
4325
4326
|
};
|
|
4326
|
-
return () => U(
|
|
4327
|
+
return () => U(as, {
|
|
4327
4328
|
editor: e.editor,
|
|
4328
4329
|
shouldShow: ({ editor: e }) => {
|
|
4329
|
-
let t =
|
|
4330
|
-
return
|
|
4330
|
+
let t = He(e);
|
|
4331
|
+
return ke(De(e), {
|
|
4331
4332
|
editable: e.isEditable,
|
|
4332
|
-
hasAskAiPreview:
|
|
4333
|
+
hasAskAiPreview: We(e.state),
|
|
4333
4334
|
hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
|
|
4334
4335
|
});
|
|
4335
4336
|
},
|
|
4336
4337
|
getReferencedVirtualElement: () => {
|
|
4337
|
-
let t =
|
|
4338
|
+
let t = He(e.editor)?.target.kind === "table" ? Ue(e.editor) : null;
|
|
4338
4339
|
return t ? {
|
|
4339
4340
|
getBoundingClientRect: () => new DOMRect(t.left, t.top, t.width, t.height),
|
|
4340
4341
|
getClientRects: () => [new DOMRect(t.left, t.top, t.width, t.height)]
|
|
@@ -4352,25 +4353,25 @@ var ys = J({
|
|
|
4352
4353
|
class: "markweave-floating-toolbar-content",
|
|
4353
4354
|
"data-menu": t.value ?? "none"
|
|
4354
4355
|
}, [
|
|
4355
|
-
f.value &&
|
|
4356
|
-
f.value &&
|
|
4357
|
-
z("block-type", x.value.buttons["block-type"],
|
|
4356
|
+
f.value && Ge(e.editor) ? z("ask-ai", x.value.buttons["ask-ai"], Ai, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
|
|
4357
|
+
f.value && Ge(e.editor) ? B() : null,
|
|
4358
|
+
z("block-type", x.value.buttons["block-type"], Vi, () => O("block-type"), t.value === "block-type"),
|
|
4358
4359
|
B(),
|
|
4359
|
-
z("bold", x.value.buttons.bold,
|
|
4360
|
-
z("italic", x.value.buttons.italic,
|
|
4361
|
-
z("underline", x.value.buttons.underline,
|
|
4362
|
-
z("strike", x.value.buttons.strike,
|
|
4363
|
-
z("inline-code", x.value.buttons["inline-code"],
|
|
4360
|
+
z("bold", x.value.buttons.bold, Wr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
4361
|
+
z("italic", x.value.buttons.italic, pi, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
4362
|
+
z("underline", x.value.buttons.underline, Hi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
4363
|
+
z("strike", x.value.buttons.strike, Ni, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
4364
|
+
z("inline-code", x.value.buttons["inline-code"], $r, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
4364
4365
|
B(),
|
|
4365
|
-
z("link", x.value.buttons.link,
|
|
4366
|
-
z("color", x.value.buttons.color,
|
|
4366
|
+
z("link", x.value.buttons.link, hi, () => O("link"), e.editor.isActive("link")),
|
|
4367
|
+
z("color", x.value.buttons.color, Vi, () => O("color"), t.value === "color"),
|
|
4367
4368
|
B(),
|
|
4368
|
-
z("more", x.value.buttons.more,
|
|
4369
|
+
z("more", x.value.buttons.more, bi, () => O("more"), t.value === "more"),
|
|
4369
4370
|
H(),
|
|
4370
4371
|
te()
|
|
4371
4372
|
])]) });
|
|
4372
4373
|
}
|
|
4373
|
-
}),
|
|
4374
|
+
}), ys = J({
|
|
4374
4375
|
name: "MarkweaveVueMathEditorPopover",
|
|
4375
4376
|
props: {
|
|
4376
4377
|
editor: {
|
|
@@ -4391,17 +4392,17 @@ var ys = J({
|
|
|
4391
4392
|
}
|
|
4392
4393
|
},
|
|
4393
4394
|
setup(e) {
|
|
4394
|
-
let t = W(e.target.latex), n =
|
|
4395
|
+
let t = W(e.target.latex), n = xr(null), r = W(null), i = W(null), a = xr(qt(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
|
|
4395
4396
|
html: a.value,
|
|
4396
4397
|
error: !1
|
|
4397
|
-
} :
|
|
4398
|
+
} : Zt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => Kt(e.editor, e.target) ?? 1), u = () => {
|
|
4398
4399
|
if (typeof window > "u") return;
|
|
4399
|
-
let r =
|
|
4400
|
+
let r = Gt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4400
4401
|
if (!r || !i) {
|
|
4401
4402
|
e.onClose();
|
|
4402
4403
|
return;
|
|
4403
4404
|
}
|
|
4404
|
-
n.value =
|
|
4405
|
+
n.value = Wt({
|
|
4405
4406
|
anchorRect: r,
|
|
4406
4407
|
frameRect: i,
|
|
4407
4408
|
kind: e.target.kind,
|
|
@@ -4410,7 +4411,7 @@ var ys = J({
|
|
|
4410
4411
|
viewportWidth: window.innerWidth
|
|
4411
4412
|
});
|
|
4412
4413
|
}, d = () => {
|
|
4413
|
-
s.value &&
|
|
4414
|
+
s.value && Ut(e.editor, e.target, t.value) && e.onClose();
|
|
4414
4415
|
}, f = (t) => {
|
|
4415
4416
|
if (t.key === "Escape") {
|
|
4416
4417
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -4422,13 +4423,13 @@ var ys = J({
|
|
|
4422
4423
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
4423
4424
|
};
|
|
4424
4425
|
return K(() => [e.target.pos, e.target.latex], () => {
|
|
4425
|
-
t.value = e.target.latex, a.value =
|
|
4426
|
-
}),
|
|
4427
|
-
|
|
4426
|
+
t.value = e.target.latex, a.value = qt(e.editor, e.target), q(u);
|
|
4427
|
+
}), Sr(() => {
|
|
4428
|
+
Qt(e.editor, e.target, !0), u(), q(() => {
|
|
4428
4429
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
4429
4430
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
4430
|
-
}),
|
|
4431
|
-
|
|
4431
|
+
}), Cr(() => {
|
|
4432
|
+
Qt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
4432
4433
|
}), () => {
|
|
4433
4434
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
4434
4435
|
ref: i,
|
|
@@ -4489,14 +4490,14 @@ var ys = J({
|
|
|
4489
4490
|
}, [
|
|
4490
4491
|
U("div", { class: "markweave-math-block-toolbar" }, [
|
|
4491
4492
|
U("span", null, c.value.label),
|
|
4492
|
-
Q(
|
|
4493
|
+
Q($r, c.value.label, 15, 1.75),
|
|
4493
4494
|
U("button", {
|
|
4494
4495
|
type: "submit",
|
|
4495
4496
|
title: c.value.apply,
|
|
4496
4497
|
"aria-label": c.value.apply,
|
|
4497
4498
|
disabled: !s.value,
|
|
4498
4499
|
"data-testid": "markweave-math-editor-apply"
|
|
4499
|
-
}, [Q(
|
|
4500
|
+
}, [Q(Jr, c.value.apply, 16, 2)])
|
|
4500
4501
|
]),
|
|
4501
4502
|
U("label", {
|
|
4502
4503
|
class: "markweave-math-block-source",
|
|
@@ -4519,7 +4520,7 @@ var ys = J({
|
|
|
4519
4520
|
]);
|
|
4520
4521
|
};
|
|
4521
4522
|
}
|
|
4522
|
-
}),
|
|
4523
|
+
}), bs = J({
|
|
4523
4524
|
name: "MarkweaveVueSlashCommandMenu",
|
|
4524
4525
|
props: {
|
|
4525
4526
|
commands: {
|
|
@@ -4577,7 +4578,7 @@ var ys = J({
|
|
|
4577
4578
|
if (e.state.name !== "keyboard-selecting" || e.inputCommand || !e.commands.length) return;
|
|
4578
4579
|
await q();
|
|
4579
4580
|
let t = s.value, n = t?.querySelector("[data-active=\"true\"]");
|
|
4580
|
-
t && n &&
|
|
4581
|
+
t && n && dn(t, n);
|
|
4581
4582
|
}, { flush: "post" });
|
|
4582
4583
|
let l = async () => {
|
|
4583
4584
|
if (e.inputCommand) {
|
|
@@ -4721,7 +4722,7 @@ var ys = J({
|
|
|
4721
4722
|
class: "markweave-slash-group",
|
|
4722
4723
|
"aria-label": t.group
|
|
4723
4724
|
}, [U("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
4724
|
-
let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i =
|
|
4725
|
+
let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i = ln(t);
|
|
4725
4726
|
return U("button", {
|
|
4726
4727
|
key: t.id,
|
|
4727
4728
|
id: `markweave-slash-command-option-${n}`,
|
|
@@ -4732,7 +4733,7 @@ var ys = J({
|
|
|
4732
4733
|
"data-active": r,
|
|
4733
4734
|
"data-disabled": t.disabled ? "true" : "false",
|
|
4734
4735
|
"data-execution-kind": t.executionKind,
|
|
4735
|
-
"data-text-icon-length":
|
|
4736
|
+
"data-text-icon-length": cn(t.icon) ?? void 0,
|
|
4736
4737
|
"data-testid": `markweave-slash-command-${t.id}`,
|
|
4737
4738
|
title: t.disabledReason,
|
|
4738
4739
|
onMousedown: $,
|
|
@@ -4746,7 +4747,7 @@ var ys = J({
|
|
|
4746
4747
|
}
|
|
4747
4748
|
}
|
|
4748
4749
|
}, [
|
|
4749
|
-
|
|
4750
|
+
hs(t.icon),
|
|
4750
4751
|
U("span", null, t.label),
|
|
4751
4752
|
t.disabledReason ? U("small", null, t.disabledReason) : null
|
|
4752
4753
|
]);
|
|
@@ -4762,34 +4763,34 @@ var ys = J({
|
|
|
4762
4763
|
}, e.errorMessage ?? "")]);
|
|
4763
4764
|
};
|
|
4764
4765
|
}
|
|
4765
|
-
}),
|
|
4766
|
-
"ask-ai":
|
|
4767
|
-
"move-left":
|
|
4768
|
-
"move-right":
|
|
4769
|
-
"move-up":
|
|
4770
|
-
"move-down":
|
|
4771
|
-
"insert-left":
|
|
4772
|
-
"insert-right":
|
|
4773
|
-
"insert-above":
|
|
4774
|
-
"insert-below":
|
|
4775
|
-
"sort-asc":
|
|
4776
|
-
"sort-desc":
|
|
4777
|
-
color:
|
|
4778
|
-
alignment:
|
|
4779
|
-
clear:
|
|
4780
|
-
duplicate:
|
|
4781
|
-
copy:
|
|
4782
|
-
merge:
|
|
4783
|
-
split:
|
|
4784
|
-
delete:
|
|
4785
|
-
},
|
|
4786
|
-
left:
|
|
4787
|
-
center:
|
|
4788
|
-
right:
|
|
4789
|
-
top:
|
|
4790
|
-
middle:
|
|
4791
|
-
bottom:
|
|
4792
|
-
},
|
|
4766
|
+
}), xs = {
|
|
4767
|
+
"ask-ai": Ai,
|
|
4768
|
+
"move-left": Ir,
|
|
4769
|
+
"move-right": Lr,
|
|
4770
|
+
"move-up": Rr,
|
|
4771
|
+
"move-down": Pr,
|
|
4772
|
+
"insert-left": Ur,
|
|
4773
|
+
"insert-right": Hr,
|
|
4774
|
+
"insert-above": Vr,
|
|
4775
|
+
"insert-below": Br,
|
|
4776
|
+
"sort-asc": Fr,
|
|
4777
|
+
"sort-desc": zr,
|
|
4778
|
+
color: xi,
|
|
4779
|
+
alignment: Or,
|
|
4780
|
+
clear: Mi,
|
|
4781
|
+
duplicate: ti,
|
|
4782
|
+
copy: ti,
|
|
4783
|
+
merge: Li,
|
|
4784
|
+
split: Ri,
|
|
4785
|
+
delete: Bi
|
|
4786
|
+
}, Ss = {
|
|
4787
|
+
left: Or,
|
|
4788
|
+
center: Er,
|
|
4789
|
+
right: kr,
|
|
4790
|
+
top: Mr,
|
|
4791
|
+
middle: Ar,
|
|
4792
|
+
bottom: jr
|
|
4793
|
+
}, Cs = J({
|
|
4793
4794
|
name: "MarkweaveVueTableControls",
|
|
4794
4795
|
props: {
|
|
4795
4796
|
editor: {
|
|
@@ -4826,12 +4827,12 @@ var ys = J({
|
|
|
4826
4827
|
}
|
|
4827
4828
|
},
|
|
4828
4829
|
setup(e) {
|
|
4829
|
-
let t = W(null), n = W(null), r = W("row-edge"), i = W(null), a = W(null), o = W(null), s = W(null), c = W(null), l = W(null), u = W(null), d = W(null), f = W(0), p = W(null), m = W(null), h = W(null), g = W(null), _ = W(null), v = W(null), y = W(null), b = null, x = null, S = null, C = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = () =>
|
|
4830
|
+
let t = W(null), n = W(null), r = W("row-edge"), i = W(null), a = W(null), o = W(null), s = W(null), c = W(null), l = W(null), u = W(null), d = W(null), f = W(0), p = W(null), m = W(null), h = W(null), g = W(null), _ = W(null), v = W(null), y = W(null), b = null, x = null, S = null, C = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = () => En(e.editor.state, "structure"), T = G(() => e.active ? kn(e.editor.state) : os), E = G(() => Jn(e.editor, e.interactionState, "row", T.value.activeCellPos)), D = G(() => Jn(e.editor, e.interactionState, "column", T.value.activeCellPos)), O = G(() => Wn(e.editor)), k = G(() => (O.value, T.value.active && Qn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), A = G(() => t.value ? Qn(e.editor, t.value, { askAiEnabled: C.value }) : []), j = () => {
|
|
4830
4831
|
b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
|
|
4831
4832
|
}, M = (e) => {
|
|
4832
4833
|
j(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
|
|
4833
4834
|
d.value = null, b = null;
|
|
4834
|
-
},
|
|
4835
|
+
}, ir));
|
|
4835
4836
|
}, N = () => {
|
|
4836
4837
|
if (!e.active) {
|
|
4837
4838
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, M(null);
|
|
@@ -4842,26 +4843,26 @@ var ys = J({
|
|
|
4842
4843
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
|
|
4843
4844
|
return;
|
|
4844
4845
|
}
|
|
4845
|
-
let l = n.getBoundingClientRect(), u = E.value ?
|
|
4846
|
-
u ? i.value =
|
|
4846
|
+
let l = n.getBoundingClientRect(), u = E.value ? qn(e.editor, E.value) : null, d = D.value ? qn(e.editor, D.value) : null, f = k.value ? $n(e.editor) : null, p = Un(e.editor)?.getBoundingClientRect() ?? null;
|
|
4847
|
+
u ? i.value = Rn({
|
|
4847
4848
|
targetRect: u,
|
|
4848
4849
|
frameRect: l,
|
|
4849
4850
|
kind: "row"
|
|
4850
|
-
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value =
|
|
4851
|
+
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Rn({
|
|
4851
4852
|
targetRect: d,
|
|
4852
4853
|
frameRect: l,
|
|
4853
4854
|
kind: "column"
|
|
4854
|
-
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value =
|
|
4855
|
+
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Rn({
|
|
4855
4856
|
targetRect: f,
|
|
4856
4857
|
frameRect: l,
|
|
4857
4858
|
kind: "selection"
|
|
4858
4859
|
}) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
|
|
4859
4860
|
let m = e.interactionState.hoverCellPos !== null && !!(E.value && E.value.index === E.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(D.value && D.value.index === D.value.visualWidth - 1);
|
|
4860
|
-
s.value = p && m ?
|
|
4861
|
+
s.value = p && m ? zn({
|
|
4861
4862
|
tableRect: p,
|
|
4862
4863
|
frameRect: l,
|
|
4863
4864
|
kind: "row"
|
|
4864
|
-
}) : null, c.value = p && h ?
|
|
4865
|
+
}) : null, c.value = p && h ? zn({
|
|
4865
4866
|
tableRect: p,
|
|
4866
4867
|
frameRect: l,
|
|
4867
4868
|
kind: "column"
|
|
@@ -4876,16 +4877,16 @@ var ys = J({
|
|
|
4876
4877
|
l.value = null;
|
|
4877
4878
|
return;
|
|
4878
4879
|
}
|
|
4879
|
-
let a = i.getBoundingClientRect(), o = t.value === "row" ?
|
|
4880
|
+
let a = i.getBoundingClientRect(), o = t.value === "row" ? Un(e.editor)?.getBoundingClientRect() : null, s = o ? {
|
|
4880
4881
|
left: a.left,
|
|
4881
4882
|
top: o.top,
|
|
4882
4883
|
width: a.width,
|
|
4883
4884
|
height: a.height
|
|
4884
4885
|
} : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
|
|
4885
|
-
l.value =
|
|
4886
|
+
l.value = In({
|
|
4886
4887
|
anchorRect: s,
|
|
4887
4888
|
frameRect: c,
|
|
4888
|
-
boundaryRect:
|
|
4889
|
+
boundaryRect: Yn(n),
|
|
4889
4890
|
menuSize: {
|
|
4890
4891
|
width: u.width || 254,
|
|
4891
4892
|
height: f || u.height || 410
|
|
@@ -4903,10 +4904,10 @@ var ys = J({
|
|
|
4903
4904
|
return;
|
|
4904
4905
|
}
|
|
4905
4906
|
let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
|
|
4906
|
-
u.value =
|
|
4907
|
+
u.value = Ln({
|
|
4907
4908
|
triggerRect: i.getBoundingClientRect(),
|
|
4908
4909
|
parentMenuRect: _.value.getBoundingClientRect(),
|
|
4909
|
-
boundaryRect:
|
|
4910
|
+
boundaryRect: Yn(r),
|
|
4910
4911
|
submenuSize: {
|
|
4911
4912
|
width: a.width || 238,
|
|
4912
4913
|
height: o || 410
|
|
@@ -4920,16 +4921,16 @@ var ys = J({
|
|
|
4920
4921
|
let a = t.value === e && r.value === i;
|
|
4921
4922
|
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, ee();
|
|
4922
4923
|
}, R = () => {
|
|
4923
|
-
e.editor.view.dispatch(
|
|
4924
|
+
e.editor.view.dispatch(Tn(e.editor.state.tr, null));
|
|
4924
4925
|
}, te = (t, n) => {
|
|
4925
4926
|
let r = e.interactionState.hoverCellPos ?? T.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
4926
|
-
r !== null &&
|
|
4927
|
+
r !== null && nr(e.editor, r, t, { visualIndex: i }), L(t, n);
|
|
4927
4928
|
}, z = () => {
|
|
4928
4929
|
R(), L("selection", "selection-edge");
|
|
4929
4930
|
}, B = (r = !1) => {
|
|
4930
4931
|
t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
|
|
4931
4932
|
}, V = async (n, r) => {
|
|
4932
|
-
let i = await
|
|
4933
|
+
let i = await Vn({
|
|
4933
4934
|
editor: e.editor,
|
|
4934
4935
|
commandId: n,
|
|
4935
4936
|
menu: r ?? t.value ?? "selection",
|
|
@@ -4937,12 +4938,12 @@ var ys = J({
|
|
|
4937
4938
|
});
|
|
4938
4939
|
return i.copyFeedback ? (M(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : M(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
4939
4940
|
}, H = (t) => {
|
|
4940
|
-
C.value && (
|
|
4941
|
+
C.value && (Ye(e.editor, t), B(!1));
|
|
4941
4942
|
}, ne = (e) => {
|
|
4942
4943
|
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, ee());
|
|
4943
4944
|
}, re = (t) => {
|
|
4944
4945
|
let n = t === "row" ? E.value : D.value, r = e.interactionState.hoverCellPos ?? T.value.activeCellPos;
|
|
4945
|
-
!n || r === null ||
|
|
4946
|
+
!n || r === null || cr(e.editor, r, t, { visualIndex: n.index }) && V(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
4946
4947
|
}, ie = (e, t, n) => {
|
|
4947
4948
|
if (!w()) {
|
|
4948
4949
|
n.preventDefault();
|
|
@@ -4954,14 +4955,14 @@ var ys = J({
|
|
|
4954
4955
|
}, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
4955
4956
|
}, ae = (t) => {
|
|
4956
4957
|
if (!x) return;
|
|
4957
|
-
let n =
|
|
4958
|
+
let n = Gn(e.editor, x.axis, t.clientX, t.clientY);
|
|
4958
4959
|
n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
4959
4960
|
}, oe = (t) => {
|
|
4960
4961
|
let n = x;
|
|
4961
4962
|
if (!n) return;
|
|
4962
|
-
let r =
|
|
4963
|
-
t.preventDefault(), x = null, S = null, r !== null &&
|
|
4964
|
-
}, se = G(() => (f.value, t.value === "row" || t.value === "column" ?
|
|
4963
|
+
let r = Gn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
4964
|
+
t.preventDefault(), x = null, S = null, r !== null && tr(e.editor, n.axis, n.index, r);
|
|
4965
|
+
}, se = G(() => (f.value, t.value === "row" || t.value === "column" ? Kn(e.editor, t.value) : null)), ce = (e) => {
|
|
4965
4966
|
if (!(!t.value || e.key !== "Escape")) {
|
|
4966
4967
|
if (n.value) {
|
|
4967
4968
|
n.value = null;
|
|
@@ -4978,9 +4979,9 @@ var ys = J({
|
|
|
4978
4979
|
}, ue = (e) => {
|
|
4979
4980
|
t.value && (e.target instanceof Node && p.value?.contains(e.target) || B());
|
|
4980
4981
|
};
|
|
4981
|
-
|
|
4982
|
+
Sr(() => {
|
|
4982
4983
|
I(), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), document.addEventListener("keydown", ce), document.addEventListener("mousedown", ue), document.addEventListener("dragover", ae), document.addEventListener("drop", oe);
|
|
4983
|
-
}),
|
|
4984
|
+
}), Cr(() => {
|
|
4984
4985
|
j(), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), document.removeEventListener("keydown", ce), document.removeEventListener("mousedown", ue), document.removeEventListener("dragover", ae), document.removeEventListener("drop", oe);
|
|
4985
4986
|
}), K(() => [
|
|
4986
4987
|
e.active,
|
|
@@ -4997,7 +4998,7 @@ var ys = J({
|
|
|
4997
4998
|
let de = () => {
|
|
4998
4999
|
if (!t.value) return null;
|
|
4999
5000
|
let r = A.value.map((r, i) => {
|
|
5000
|
-
let a =
|
|
5001
|
+
let a = Xn(r), o = i === 0 ? a : Xn(A.value[i - 1]), s = i > 0 && o !== a, c = t.value === "row" || t.value === "column" ? t.value : "selection", l = r.submenuId ? !0 : r.commandId === null ? C.value && Ie(e.editor, c) : Bn(e.editor, r.commandId), u = Zn(r, e.messages), d = xs[r.icon];
|
|
5001
5002
|
return U("button", {
|
|
5002
5003
|
key: `${r.id}-${i}`,
|
|
5003
5004
|
type: "button",
|
|
@@ -5041,7 +5042,7 @@ var ys = J({
|
|
|
5041
5042
|
strokeWidth: 1.8
|
|
5042
5043
|
})]),
|
|
5043
5044
|
U("span", { class: "markweave-table-menu-item-label" }, u),
|
|
5044
|
-
r.submenuId ? U(
|
|
5045
|
+
r.submenuId ? U(Xr, {
|
|
5045
5046
|
class: "markweave-table-menu-chevron",
|
|
5046
5047
|
size: 16,
|
|
5047
5048
|
"aria-hidden": "true"
|
|
@@ -5068,7 +5069,7 @@ var ys = J({
|
|
|
5068
5069
|
onKeydown: le
|
|
5069
5070
|
}, [
|
|
5070
5071
|
U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
5071
|
-
...
|
|
5072
|
+
...rr.map((t) => U("button", {
|
|
5072
5073
|
key: `text-${t.id}`,
|
|
5073
5074
|
type: "button",
|
|
5074
5075
|
role: "menuitemradio",
|
|
@@ -5076,7 +5077,7 @@ var ys = J({
|
|
|
5076
5077
|
"data-active": se.value?.textColorId === t.id ? "true" : "false",
|
|
5077
5078
|
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
5078
5079
|
onMousedown: $,
|
|
5079
|
-
onClick: () => ne((n) =>
|
|
5080
|
+
onClick: () => ne((n) => Fn(e.editor, n, t.id))
|
|
5080
5081
|
}, [U("span", {
|
|
5081
5082
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
5082
5083
|
"aria-hidden": "true",
|
|
@@ -5084,7 +5085,7 @@ var ys = J({
|
|
|
5084
5085
|
}), U("span", null, e.messages.table.colors[t.id].text)])),
|
|
5085
5086
|
U("div", { class: "markweave-table-submenu-separator" }),
|
|
5086
5087
|
U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
5087
|
-
...
|
|
5088
|
+
...rr.map((t) => U("button", {
|
|
5088
5089
|
key: `background-${t.id}`,
|
|
5089
5090
|
type: "button",
|
|
5090
5091
|
role: "menuitemradio",
|
|
@@ -5092,7 +5093,7 @@ var ys = J({
|
|
|
5092
5093
|
"data-active": se.value?.backgroundColorId === t.id ? "true" : "false",
|
|
5093
5094
|
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
5094
5095
|
onMousedown: $,
|
|
5095
|
-
onClick: () => ne((n) =>
|
|
5096
|
+
onClick: () => ne((n) => Pn(e.editor, n, t.id))
|
|
5096
5097
|
}, [U("span", {
|
|
5097
5098
|
class: "markweave-table-color-swatch",
|
|
5098
5099
|
"aria-hidden": "true",
|
|
@@ -5100,7 +5101,7 @@ var ys = J({
|
|
|
5100
5101
|
}), U("span", null, e.messages.table.colors[t.id].background)]))
|
|
5101
5102
|
])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
|
|
5102
5103
|
let t = (t, n) => {
|
|
5103
|
-
let r =
|
|
5104
|
+
let r = Ss[t];
|
|
5104
5105
|
return U("button", {
|
|
5105
5106
|
key: t,
|
|
5106
5107
|
type: "button",
|
|
@@ -5109,7 +5110,7 @@ var ys = J({
|
|
|
5109
5110
|
"data-active": n ? "true" : "false",
|
|
5110
5111
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
5111
5112
|
onMousedown: $,
|
|
5112
|
-
onClick: () => ne((n) =>
|
|
5113
|
+
onClick: () => ne((n) => Nn(e.editor, n, t))
|
|
5113
5114
|
}, [U(r, {
|
|
5114
5115
|
size: 18,
|
|
5115
5116
|
strokeWidth: 1.8,
|
|
@@ -5131,16 +5132,16 @@ var ys = J({
|
|
|
5131
5132
|
} : void 0,
|
|
5132
5133
|
onKeydown: le
|
|
5133
5134
|
}, [
|
|
5134
|
-
...
|
|
5135
|
+
...ar.map((e) => t(e, se.value?.textAlign === e)),
|
|
5135
5136
|
U("div", { class: "markweave-table-submenu-separator" }),
|
|
5136
|
-
...
|
|
5137
|
+
...sr.map((e) => t(e, se.value?.verticalAlign === e))
|
|
5137
5138
|
]));
|
|
5138
5139
|
}
|
|
5139
5140
|
return U("div", {
|
|
5140
5141
|
ref: _,
|
|
5141
5142
|
class: "markweave-table-menu",
|
|
5142
5143
|
role: "menu",
|
|
5143
|
-
"aria-label":
|
|
5144
|
+
"aria-label": or(t.value, e.messages),
|
|
5144
5145
|
"data-testid": "markweave-table-menu",
|
|
5145
5146
|
"data-positioned": l.value ? "true" : "false",
|
|
5146
5147
|
"data-placement": l.value?.placement,
|
|
@@ -5159,7 +5160,7 @@ var ys = J({
|
|
|
5159
5160
|
"aria-label": e.messages.table.controlsAriaLabel,
|
|
5160
5161
|
"data-open-menu": t.value ?? "none",
|
|
5161
5162
|
"data-positioned": i.value || a.value || o.value ? "true" : "false",
|
|
5162
|
-
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(
|
|
5163
|
+
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(Mn, { type: "clear-hover" }))
|
|
5163
5164
|
}, [
|
|
5164
5165
|
d.value ? U("div", {
|
|
5165
5166
|
class: "markweave-table-copy-feedback",
|
|
@@ -5169,7 +5170,7 @@ var ys = J({
|
|
|
5169
5170
|
"data-copy-kind": d.value.kind,
|
|
5170
5171
|
"data-text-length": d.value.textLength,
|
|
5171
5172
|
"data-html-length": d.value.htmlLength
|
|
5172
|
-
},
|
|
5173
|
+
}, Hn(d.value)) : null,
|
|
5173
5174
|
i.value ? U("button", {
|
|
5174
5175
|
ref: m,
|
|
5175
5176
|
type: "button",
|
|
@@ -5196,7 +5197,7 @@ var ys = J({
|
|
|
5196
5197
|
onDragend: () => {
|
|
5197
5198
|
x = null, S = null;
|
|
5198
5199
|
}
|
|
5199
|
-
}, [U(
|
|
5200
|
+
}, [U(bi, {
|
|
5200
5201
|
size: 14,
|
|
5201
5202
|
"aria-hidden": "true"
|
|
5202
5203
|
})]) : null,
|
|
@@ -5226,7 +5227,7 @@ var ys = J({
|
|
|
5226
5227
|
onDragend: () => {
|
|
5227
5228
|
x = null, S = null;
|
|
5228
5229
|
}
|
|
5229
|
-
}, [U(
|
|
5230
|
+
}, [U(bi, {
|
|
5230
5231
|
size: 14,
|
|
5231
5232
|
"aria-hidden": "true"
|
|
5232
5233
|
})]) : null,
|
|
@@ -5247,7 +5248,7 @@ var ys = J({
|
|
|
5247
5248
|
},
|
|
5248
5249
|
onMousedown: $,
|
|
5249
5250
|
onClick: z
|
|
5250
|
-
}, [U(
|
|
5251
|
+
}, [U(bi, {
|
|
5251
5252
|
size: 14,
|
|
5252
5253
|
"aria-hidden": "true"
|
|
5253
5254
|
})]) : null,
|
|
@@ -5265,7 +5266,7 @@ var ys = J({
|
|
|
5265
5266
|
},
|
|
5266
5267
|
onMousedown: $,
|
|
5267
5268
|
onClick: () => re("row")
|
|
5268
|
-
}, [U(
|
|
5269
|
+
}, [U(wi, {
|
|
5269
5270
|
size: 14,
|
|
5270
5271
|
"aria-hidden": "true"
|
|
5271
5272
|
})]) : null,
|
|
@@ -5283,14 +5284,14 @@ var ys = J({
|
|
|
5283
5284
|
},
|
|
5284
5285
|
onMousedown: $,
|
|
5285
5286
|
onClick: () => re("column")
|
|
5286
|
-
}, [U(
|
|
5287
|
+
}, [U(wi, {
|
|
5287
5288
|
size: 14,
|
|
5288
5289
|
"aria-hidden": "true"
|
|
5289
5290
|
})]) : null,
|
|
5290
5291
|
de()
|
|
5291
5292
|
]) : null;
|
|
5292
5293
|
}
|
|
5293
|
-
}),
|
|
5294
|
+
}), ws = J({
|
|
5294
5295
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
5295
5296
|
props: {
|
|
5296
5297
|
editor: {
|
|
@@ -5308,11 +5309,11 @@ var ys = J({
|
|
|
5308
5309
|
t.value = null;
|
|
5309
5310
|
return;
|
|
5310
5311
|
}
|
|
5311
|
-
t.value =
|
|
5312
|
+
t.value = er(e.editor, An(e.editor.state));
|
|
5312
5313
|
};
|
|
5313
|
-
return
|
|
5314
|
+
return Sr(() => {
|
|
5314
5315
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
5315
|
-
}),
|
|
5316
|
+
}), Cr(() => {
|
|
5316
5317
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
5317
5318
|
}), K(() => [
|
|
5318
5319
|
e.focusState.activeCellPos,
|
|
@@ -5347,7 +5348,7 @@ var ys = J({
|
|
|
5347
5348
|
}) : null;
|
|
5348
5349
|
};
|
|
5349
5350
|
}
|
|
5350
|
-
}),
|
|
5351
|
+
}), Ts = J({
|
|
5351
5352
|
name: "MarkweaveVueCodeBlockControls",
|
|
5352
5353
|
props: {
|
|
5353
5354
|
editor: {
|
|
@@ -5380,16 +5381,16 @@ var ys = J({
|
|
|
5380
5381
|
active: !1,
|
|
5381
5382
|
lastX: 0,
|
|
5382
5383
|
lastY: 0
|
|
5383
|
-
}), b = W(0), x = W(0), S = W(0), C = null, w = G(() => (S.value,
|
|
5384
|
+
}), b = W(0), x = W(0), S = W(0), C = null, w = G(() => (S.value, jt(e.editor, s.value))), T = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
5384
5385
|
...e.state,
|
|
5385
5386
|
pos: e.state.pos,
|
|
5386
5387
|
active: !0
|
|
5387
|
-
} : null), E = G(() => w.value ?? T.value), D = G(() => E.value !== null), O = G(() => E.value?.language === "mermaid"), k = G(() =>
|
|
5388
|
+
} : null), E = G(() => w.value ?? T.value), D = G(() => E.value !== null), O = G(() => E.value?.language === "mermaid"), k = G(() => It(e.editor, E.value)), A = G(() => D.value && E.value !== null && !k.value), j = G(() => !e.readOnly), M = G(() => E.value ? wt(E.value.language) : wt("text")), N = G(() => m.value?.status ?? "idle"), P = G(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), F = G(() => O.value && P.value === "preview"), I = G(() => (S.value, b.value, x.value, Pt(e.editor))), ee = G(() => `${x.value}|${I.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => Ot(f.value)), R = G(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), te = () => {
|
|
5388
5389
|
C !== null && (window.clearTimeout(C), C = null);
|
|
5389
5390
|
}, z = (e) => {
|
|
5390
5391
|
te(), m.value = e, e && (C = window.setTimeout(() => {
|
|
5391
5392
|
m.value = null, C = null;
|
|
5392
|
-
},
|
|
5393
|
+
}, _t));
|
|
5393
5394
|
}, B = () => {
|
|
5394
5395
|
g.value = null, _.value = null, v.value = !1, y.value = {
|
|
5395
5396
|
active: !1,
|
|
@@ -5399,15 +5400,15 @@ var ys = J({
|
|
|
5399
5400
|
}, V = () => {
|
|
5400
5401
|
let n = t.value;
|
|
5401
5402
|
if (!n) return;
|
|
5402
|
-
if (!
|
|
5403
|
+
if (!Mt(n) || I.value.length === 0) {
|
|
5403
5404
|
l.value = [];
|
|
5404
5405
|
return;
|
|
5405
5406
|
}
|
|
5406
5407
|
let r = n.getBoundingClientRect(), i = I.value.flatMap((t) => {
|
|
5407
|
-
let n =
|
|
5408
|
-
return n ? [
|
|
5408
|
+
let n = Dt(Et(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
5409
|
+
return n ? [St(t, n, r)] : [];
|
|
5409
5410
|
});
|
|
5410
|
-
l.value =
|
|
5411
|
+
l.value = Lt(l.value, i, I.value.map((e) => e.pos));
|
|
5411
5412
|
}, H = () => {
|
|
5412
5413
|
if (!A.value || !E.value) {
|
|
5413
5414
|
c.value = null, u.value = null;
|
|
@@ -5415,14 +5416,14 @@ var ys = J({
|
|
|
5415
5416
|
}
|
|
5416
5417
|
let i = t.value;
|
|
5417
5418
|
if (!i) return;
|
|
5418
|
-
let a =
|
|
5419
|
+
let a = Et(e.editor, E.value.pos, P.value), o = i.getBoundingClientRect(), s = Dt(a, o);
|
|
5419
5420
|
if (!s) {
|
|
5420
5421
|
c.value = c.value?.pos === E.value.pos ? c.value : null, u.value = d.value ? u.value : null;
|
|
5421
5422
|
return;
|
|
5422
5423
|
}
|
|
5423
|
-
if (c.value =
|
|
5424
|
+
if (c.value = bt(E.value.pos, s, o), d.value && n.value) {
|
|
5424
5425
|
let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
|
|
5425
|
-
u.value =
|
|
5426
|
+
u.value = ht({
|
|
5426
5427
|
overlayRect: o,
|
|
5427
5428
|
buttonRect: e,
|
|
5428
5429
|
menuHeight: t,
|
|
@@ -5433,33 +5434,33 @@ var ys = J({
|
|
|
5433
5434
|
}, ne = async () => {
|
|
5434
5435
|
if (e.readOnly) {
|
|
5435
5436
|
if (!E.value) return;
|
|
5436
|
-
let e = await
|
|
5437
|
-
z(
|
|
5437
|
+
let e = await vt(E.value.text);
|
|
5438
|
+
z(ut(E.value, e ? "copied" : "failed"));
|
|
5438
5439
|
return;
|
|
5439
5440
|
}
|
|
5440
|
-
if (!
|
|
5441
|
-
let t = await
|
|
5442
|
-
z(
|
|
5441
|
+
if (!Ct(e.editor, E.value)) return;
|
|
5442
|
+
let t = await ct(e.editor);
|
|
5443
|
+
z(ut(lt(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
5443
5444
|
}, re = (t, n) => {
|
|
5444
5445
|
if (e.readOnly) {
|
|
5445
|
-
|
|
5446
|
+
an(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
|
|
5446
5447
|
return;
|
|
5447
5448
|
}
|
|
5448
5449
|
let r = e.state.active && e.state.pos === t.pos;
|
|
5449
|
-
|
|
5450
|
+
mt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
|
|
5450
5451
|
}, ie = (t) => {
|
|
5451
5452
|
if (e.readOnly || !E.value) return;
|
|
5452
5453
|
let n = e.state.active && e.state.pos === E.value.pos;
|
|
5453
|
-
|
|
5454
|
+
pt(e.editor, E.value.pos, t) && (t === "mermaid" && mt(e.editor, E.value.pos, "preview") && e.onMermaidModeChange("preview"), d.value = !1, f.value = "", p.value = -1, S.value += 1, n && e.editor.view.focus());
|
|
5454
5455
|
}, ae = () => {
|
|
5455
|
-
d.value = !d.value, d.value && o.value === null && (o.value =
|
|
5456
|
+
d.value = !d.value, d.value && o.value === null && (o.value = yt()), p.value = d.value ? Nt(L.value, E.value?.language ?? null) : -1;
|
|
5456
5457
|
}, oe = (e) => {
|
|
5457
|
-
let t =
|
|
5458
|
-
f.value = e, p.value =
|
|
5458
|
+
let t = Ot(e);
|
|
5459
|
+
f.value = e, p.value = Nt(t, e.trim() ? null : E.value?.language ?? null);
|
|
5459
5460
|
}, se = (t) => {
|
|
5460
5461
|
if (!t.isComposing) {
|
|
5461
5462
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
5462
|
-
t.preventDefault(), p.value =
|
|
5463
|
+
t.preventDefault(), p.value = zt(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
5463
5464
|
return;
|
|
5464
5465
|
}
|
|
5465
5466
|
if (t.key === "Enter") {
|
|
@@ -5470,10 +5471,10 @@ var ys = J({
|
|
|
5470
5471
|
t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
|
|
5471
5472
|
}
|
|
5472
5473
|
}, ce = () => {
|
|
5473
|
-
e.readOnly || !E.value ||
|
|
5474
|
+
e.readOnly || !E.value || ft(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
5474
5475
|
}, le = () => {
|
|
5475
5476
|
if (!E.value) return;
|
|
5476
|
-
let t =
|
|
5477
|
+
let t = Ft(e.editor, E.value.pos);
|
|
5477
5478
|
t && ue({
|
|
5478
5479
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
5479
5480
|
fileName: "markweave-mermaid.svg",
|
|
@@ -5482,8 +5483,8 @@ var ys = J({
|
|
|
5482
5483
|
});
|
|
5483
5484
|
}, de = () => {
|
|
5484
5485
|
if (!E.value) return;
|
|
5485
|
-
let t =
|
|
5486
|
-
t && (g.value =
|
|
5486
|
+
let t = Ft(e.editor, E.value.pos);
|
|
5487
|
+
t && (g.value = xt(t), _.value = null, v.value = !1, y.value = {
|
|
5487
5488
|
active: !1,
|
|
5488
5489
|
lastX: 0,
|
|
5489
5490
|
lastY: 0
|
|
@@ -5491,16 +5492,16 @@ var ys = J({
|
|
|
5491
5492
|
}, fe = (e) => {
|
|
5492
5493
|
g.value = g.value ? {
|
|
5493
5494
|
...g.value,
|
|
5494
|
-
scale:
|
|
5495
|
+
scale: gt(g.value.scale + e)
|
|
5495
5496
|
} : null;
|
|
5496
5497
|
}, pe = () => {
|
|
5497
|
-
g.value = g.value ?
|
|
5498
|
+
g.value = g.value ? xt(g.value.svg) : null, y.value = {
|
|
5498
5499
|
active: !1,
|
|
5499
5500
|
lastX: 0,
|
|
5500
5501
|
lastY: 0
|
|
5501
5502
|
}, v.value = !1;
|
|
5502
5503
|
}, me = (e) => {
|
|
5503
|
-
e.preventDefault(), fe(e.deltaY < 0 ?
|
|
5504
|
+
e.preventDefault(), fe(e.deltaY < 0 ? Rt : -Rt);
|
|
5504
5505
|
}, he = (e) => {
|
|
5505
5506
|
e.button === 0 && (e.preventDefault(), y.value = {
|
|
5506
5507
|
active: !0,
|
|
@@ -5515,7 +5516,7 @@ var ys = J({
|
|
|
5515
5516
|
active: !0,
|
|
5516
5517
|
lastX: e.clientX,
|
|
5517
5518
|
lastY: e.clientY
|
|
5518
|
-
}, g.value =
|
|
5519
|
+
}, g.value = Bt(g.value, n, r);
|
|
5519
5520
|
}, _e = () => {
|
|
5520
5521
|
y.value = {
|
|
5521
5522
|
active: !1,
|
|
@@ -5541,7 +5542,7 @@ var ys = J({
|
|
|
5541
5542
|
if (!d.value || p.value < 0) return;
|
|
5542
5543
|
await q();
|
|
5543
5544
|
let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
|
|
5544
|
-
e && t &&
|
|
5545
|
+
e && t && Vt(e, t);
|
|
5545
5546
|
}, { flush: "post" }), K(() => [
|
|
5546
5547
|
A.value,
|
|
5547
5548
|
b.value,
|
|
@@ -5561,11 +5562,11 @@ var ys = J({
|
|
|
5561
5562
|
immediate: !0
|
|
5562
5563
|
});
|
|
5563
5564
|
let ve = null;
|
|
5564
|
-
return
|
|
5565
|
+
return Sr(() => {
|
|
5565
5566
|
q(() => {
|
|
5566
5567
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
5567
5568
|
if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
|
|
5568
|
-
let r =
|
|
5569
|
+
let r = At(e.editor, n.target), i = jt(e.editor, r), a = i && !It(e.editor, i) ? i.pos : null;
|
|
5569
5570
|
s.value = s.value === a ? s.value : a;
|
|
5570
5571
|
}, i = () => {
|
|
5571
5572
|
d.value || (s.value = null);
|
|
@@ -5580,13 +5581,13 @@ var ys = J({
|
|
|
5580
5581
|
}, o = (e) => {
|
|
5581
5582
|
d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
|
|
5582
5583
|
}, c = ({ transaction: e }) => {
|
|
5583
|
-
e.getMeta(
|
|
5584
|
+
e.getMeta(st) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(st) || tn(e)) && (S.value += 1);
|
|
5584
5585
|
};
|
|
5585
5586
|
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", H), window.addEventListener("scroll", H, !0), window.addEventListener("resize", V), window.addEventListener("scroll", V, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ve = () => {
|
|
5586
5587
|
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", H), window.removeEventListener("scroll", H, !0), window.removeEventListener("resize", V), window.removeEventListener("scroll", V, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), te();
|
|
5587
5588
|
};
|
|
5588
5589
|
});
|
|
5589
|
-
}),
|
|
5590
|
+
}), Cr(() => {
|
|
5590
5591
|
ve?.(), ve = null, te();
|
|
5591
5592
|
}), () => {
|
|
5592
5593
|
if (!A.value && I.value.length === 0 && !g.value) return null;
|
|
@@ -5647,7 +5648,7 @@ var ys = J({
|
|
|
5647
5648
|
"data-testid": "markweave-codeblock-language",
|
|
5648
5649
|
onMousedown: $,
|
|
5649
5650
|
onClick: ae
|
|
5650
|
-
}, [U("span", null, M.value),
|
|
5651
|
+
}, [U("span", null, M.value), ds("chevron")]),
|
|
5651
5652
|
j.value ? U("button", {
|
|
5652
5653
|
type: "button",
|
|
5653
5654
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
@@ -5657,7 +5658,7 @@ var ys = J({
|
|
|
5657
5658
|
"data-collapsed": k.value ? "true" : "false",
|
|
5658
5659
|
onMousedown: $,
|
|
5659
5660
|
onClick: ce
|
|
5660
|
-
}, [
|
|
5661
|
+
}, [ds("chevron")]) : null,
|
|
5661
5662
|
U("span", { class: "markweave-codeblock-copy-wrap" }, [U("button", {
|
|
5662
5663
|
type: "button",
|
|
5663
5664
|
class: "markweave-codeblock-icon-button",
|
|
@@ -5680,7 +5681,7 @@ var ys = J({
|
|
|
5680
5681
|
onClick: () => {
|
|
5681
5682
|
ne();
|
|
5682
5683
|
}
|
|
5683
|
-
}, [
|
|
5684
|
+
}, [ds(N.value === "copied" ? "check" : "clipboard")]), h.value ? U("span", {
|
|
5684
5685
|
class: "markweave-codeblock-tooltip",
|
|
5685
5686
|
role: "tooltip",
|
|
5686
5687
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
@@ -5696,7 +5697,7 @@ var ys = J({
|
|
|
5696
5697
|
disabled: !F.value,
|
|
5697
5698
|
onMousedown: $,
|
|
5698
5699
|
onClick: de
|
|
5699
|
-
}, [
|
|
5700
|
+
}, [ds("expand")]), U("button", {
|
|
5700
5701
|
type: "button",
|
|
5701
5702
|
class: "markweave-codeblock-icon-button",
|
|
5702
5703
|
"aria-label": "Download Mermaid SVG",
|
|
@@ -5704,7 +5705,7 @@ var ys = J({
|
|
|
5704
5705
|
disabled: !F.value,
|
|
5705
5706
|
onMousedown: $,
|
|
5706
5707
|
onClick: le
|
|
5707
|
-
}, [
|
|
5708
|
+
}, [ds("download")])]) : null
|
|
5708
5709
|
]) : null,
|
|
5709
5710
|
j.value && A.value && d.value && E.value ? U("div", {
|
|
5710
5711
|
ref: r,
|
|
@@ -5718,7 +5719,7 @@ var ys = J({
|
|
|
5718
5719
|
"aria-autocomplete": "list",
|
|
5719
5720
|
"aria-controls": o.value ?? void 0,
|
|
5720
5721
|
"aria-expanded": "true",
|
|
5721
|
-
"aria-activedescendant": o.value && L.value[p.value] ?
|
|
5722
|
+
"aria-activedescendant": o.value && L.value[p.value] ? kt(o.value, L.value[p.value].language) : void 0,
|
|
5722
5723
|
"aria-label": "Search code block languages",
|
|
5723
5724
|
value: f.value,
|
|
5724
5725
|
placeholder: "Search...",
|
|
@@ -5727,7 +5728,7 @@ var ys = J({
|
|
|
5727
5728
|
oe(e.target.value);
|
|
5728
5729
|
},
|
|
5729
5730
|
onKeydown: se
|
|
5730
|
-
}),
|
|
5731
|
+
}), ds("search")]), U("div", {
|
|
5731
5732
|
ref: a,
|
|
5732
5733
|
id: o.value ?? void 0,
|
|
5733
5734
|
class: "markweave-codeblock-language-list",
|
|
@@ -5737,7 +5738,7 @@ var ys = J({
|
|
|
5737
5738
|
let n = E.value?.language === e.language, r = t === p.value;
|
|
5738
5739
|
return U("button", {
|
|
5739
5740
|
key: e.language,
|
|
5740
|
-
id: o.value ?
|
|
5741
|
+
id: o.value ? kt(o.value, e.language) : void 0,
|
|
5741
5742
|
type: "button",
|
|
5742
5743
|
role: "option",
|
|
5743
5744
|
"aria-selected": n ? "true" : "false",
|
|
@@ -5750,7 +5751,7 @@ var ys = J({
|
|
|
5750
5751
|
p.value = t;
|
|
5751
5752
|
},
|
|
5752
5753
|
onClick: () => ie(e.language)
|
|
5753
|
-
}, [U("span", null, e.label), n ?
|
|
5754
|
+
}, [U("span", null, e.label), n ? ds("check") : null]);
|
|
5754
5755
|
}))]) : null,
|
|
5755
5756
|
g.value ? U("div", {
|
|
5756
5757
|
class: "markweave-mermaid-fullscreen-layer",
|
|
@@ -5780,12 +5781,12 @@ var ys = J({
|
|
|
5780
5781
|
onBlur: () => {
|
|
5781
5782
|
_.value = null;
|
|
5782
5783
|
},
|
|
5783
|
-
onClick: () => fe(-
|
|
5784
|
-
}, [
|
|
5784
|
+
onClick: () => fe(-Rt)
|
|
5785
|
+
}, [ds("zoomOut")]),
|
|
5785
5786
|
U("span", {
|
|
5786
5787
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
5787
5788
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
5788
|
-
},
|
|
5789
|
+
}, Tt(g.value.scale)),
|
|
5789
5790
|
U("button", {
|
|
5790
5791
|
type: "button",
|
|
5791
5792
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -5803,8 +5804,8 @@ var ys = J({
|
|
|
5803
5804
|
onBlur: () => {
|
|
5804
5805
|
_.value = null;
|
|
5805
5806
|
},
|
|
5806
|
-
onClick: () => fe(
|
|
5807
|
-
}, [
|
|
5807
|
+
onClick: () => fe(Rt)
|
|
5808
|
+
}, [ds("zoomIn")]),
|
|
5808
5809
|
U("button", {
|
|
5809
5810
|
type: "button",
|
|
5810
5811
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -5823,7 +5824,7 @@ var ys = J({
|
|
|
5823
5824
|
_.value = null;
|
|
5824
5825
|
},
|
|
5825
5826
|
onClick: pe
|
|
5826
|
-
}, [
|
|
5827
|
+
}, [ds("reset")]),
|
|
5827
5828
|
_.value ? U("span", {
|
|
5828
5829
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
5829
5830
|
role: "tooltip",
|
|
@@ -5836,7 +5837,7 @@ var ys = J({
|
|
|
5836
5837
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
5837
5838
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
5838
5839
|
onClick: B
|
|
5839
|
-
}, [
|
|
5840
|
+
}, [ds("close")]),
|
|
5840
5841
|
U("div", {
|
|
5841
5842
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
5842
5843
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
@@ -5862,7 +5863,7 @@ var ys = J({
|
|
|
5862
5863
|
]);
|
|
5863
5864
|
};
|
|
5864
5865
|
}
|
|
5865
|
-
}),
|
|
5866
|
+
}), Es = J({
|
|
5866
5867
|
name: "MarkweaveVueInnerToc",
|
|
5867
5868
|
props: {
|
|
5868
5869
|
editor: {
|
|
@@ -5888,20 +5889,20 @@ var ys = J({
|
|
|
5888
5889
|
},
|
|
5889
5890
|
setup(e) {
|
|
5890
5891
|
let t = W(null), n, r, i = () => {
|
|
5891
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
5892
|
+
n?.(), n = e.placement === "container" && t.value ? it(t.value) : void 0;
|
|
5892
5893
|
}, a = () => {
|
|
5893
|
-
r?.(), r = t.value && e.state.items.length ?
|
|
5894
|
+
r?.(), r = t.value && e.state.items.length ? at(t.value, e.state.items.length) : void 0;
|
|
5894
5895
|
};
|
|
5895
|
-
return
|
|
5896
|
+
return Sr(() => {
|
|
5896
5897
|
i(), a();
|
|
5897
|
-
}),
|
|
5898
|
+
}), Cr(() => {
|
|
5898
5899
|
n?.(), r?.();
|
|
5899
5900
|
}), K(() => e.placement, i), K(() => e.state.items.length, a, { flush: "post" }), () => e.state.items.length ? U("nav", {
|
|
5900
5901
|
ref: t,
|
|
5901
5902
|
class: "markweave-inner-toc",
|
|
5902
5903
|
"data-testid": "markweave-inner-toc",
|
|
5903
5904
|
"aria-label": e.messages.toc.ariaLabel,
|
|
5904
|
-
style: { "--markweave-inner-toc-rail-height":
|
|
5905
|
+
style: { "--markweave-inner-toc-rail-height": et(e.state.items.length) }
|
|
5905
5906
|
}, [U("div", {
|
|
5906
5907
|
class: "markweave-inner-toc-rail",
|
|
5907
5908
|
"aria-hidden": "true"
|
|
@@ -5918,32 +5919,33 @@ var ys = J({
|
|
|
5918
5919
|
"aria-current": t.active ? "location" : void 0,
|
|
5919
5920
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
5920
5921
|
title: t.text,
|
|
5921
|
-
onClick: () =>
|
|
5922
|
+
onClick: () => ot(e.editor, t, {
|
|
5922
5923
|
behavior: "smooth",
|
|
5923
5924
|
focus: e.editable
|
|
5924
5925
|
})
|
|
5925
5926
|
}, t.text)))])]) : null;
|
|
5926
5927
|
}
|
|
5927
5928
|
});
|
|
5928
|
-
function
|
|
5929
|
-
let r = n(e.lang), a = t(r), o = G(() =>
|
|
5929
|
+
function Ds(e = {}) {
|
|
5930
|
+
let r = n(e.lang), a = t(r), o = G(() => Sn({
|
|
5930
5931
|
lang: r,
|
|
5931
5932
|
commandGroups: e.commandGroups,
|
|
5932
5933
|
commands: e.commands,
|
|
5933
5934
|
builtinCommands: e.builtinCommands
|
|
5934
|
-
})), s = W(d(e.mode)), c = G(() =>
|
|
5935
|
+
})), s = W(d(e.mode)), c = G(() => je(e.theme)), l = G(() => s.value === "live" && e.editable !== !1), u = W(0), p = xr(null), m = W(Cn), h = xr(null), g = xr(null), _ = W(null), v = W("code"), y = xr(null), b = xr(jn), x = W(null), S = W(!1), C = xr(null), w = ge(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
|
|
5935
5936
|
function O() {
|
|
5936
5937
|
D !== null && (window.clearTimeout(D), D = null), u.value += 1;
|
|
5937
5938
|
}
|
|
5938
5939
|
function k() {
|
|
5939
5940
|
D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
|
|
5940
5941
|
D = null, u.value += 1;
|
|
5941
|
-
},
|
|
5942
|
+
}, Oe);
|
|
5942
5943
|
}
|
|
5943
|
-
let A = e.onSlashCommandUpload, j =
|
|
5944
|
+
let A = e.onSlashCommandUpload, j = xr(null), M = !1;
|
|
5944
5945
|
j.value = new i({
|
|
5945
|
-
extensions:
|
|
5946
|
+
extensions: da({
|
|
5946
5947
|
lang: r,
|
|
5948
|
+
revealLinkMarkdown: e.revealLinkMarkdown !== !1,
|
|
5947
5949
|
linkCardResolver: e.linkCardResolver,
|
|
5948
5950
|
onImageUpload: (e) => A?.(e) ?? V(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
5949
5951
|
onVideoUpload: (e) => A?.(e) ?? V(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
@@ -5968,32 +5970,32 @@ function Os(e = {}) {
|
|
|
5968
5970
|
translate: "no"
|
|
5969
5971
|
},
|
|
5970
5972
|
handleClick: (e, t, n) => {
|
|
5971
|
-
if (!l.value) return
|
|
5972
|
-
let r =
|
|
5973
|
-
return r ? (n.preventDefault(), n.stopPropagation(), R(),
|
|
5973
|
+
if (!l.value) return !1;
|
|
5974
|
+
let r = Yt(e, n);
|
|
5975
|
+
return r ? (n.preventDefault(), n.stopPropagation(), R(), $t(e, r, !0), en(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
5974
5976
|
},
|
|
5975
5977
|
handleDOMEvents: {
|
|
5976
|
-
compositionstart: () => l.value ? (m.value =
|
|
5978
|
+
compositionstart: () => l.value ? (m.value = wn(m.value, { type: "composition-start" }), h.value = null, !1) : !1,
|
|
5977
5979
|
compositionend: (e) => (l.value && window.setTimeout(() => te(e), 0), !1),
|
|
5978
5980
|
click: (e, t) => {
|
|
5979
|
-
if (!l.value) return
|
|
5980
|
-
let n =
|
|
5981
|
-
return n ? (t.preventDefault(), t.stopPropagation(), R(),
|
|
5981
|
+
if (!l.value) return !1;
|
|
5982
|
+
let n = Yt(e, t);
|
|
5983
|
+
return n ? (t.preventDefault(), t.stopPropagation(), R(), $t(e, n, !0), en(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
5982
5984
|
}
|
|
5983
5985
|
}
|
|
5984
5986
|
},
|
|
5985
5987
|
onSelectionUpdate: ({ editor: e }) => B(e),
|
|
5986
5988
|
onCreate: ({ editor: t }) => {
|
|
5987
|
-
|
|
5989
|
+
xn(t, o.value, (t) => {
|
|
5988
5990
|
_.value = t.message, e.onCommandError?.(t);
|
|
5989
|
-
}),
|
|
5991
|
+
}), bn(t, w), M = !0, e.onCommandControllerChange?.(vn(t)), f(t, {
|
|
5990
5992
|
mode: s.value,
|
|
5991
5993
|
editable: l.value
|
|
5992
|
-
}),
|
|
5994
|
+
}), nn(t, c.value), rn(t, l.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && l.value && On(t), H(t), B(t), O();
|
|
5993
5995
|
},
|
|
5994
5996
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
5995
|
-
if (H(e), (t.docChanged ||
|
|
5996
|
-
let t =
|
|
5997
|
+
if (H(e), (t.docChanged || tn(t)) && k(), t.docChanged && y.value) {
|
|
5998
|
+
let t = Jt(e, y.value.pos);
|
|
5997
5999
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
5998
6000
|
}
|
|
5999
6001
|
},
|
|
@@ -6009,70 +6011,70 @@ function Os(e = {}) {
|
|
|
6009
6011
|
}
|
|
6010
6012
|
});
|
|
6011
6013
|
let N = j.value;
|
|
6012
|
-
|
|
6014
|
+
xn(N, o.value, (t) => {
|
|
6013
6015
|
_.value = t.message, e.onCommandError?.(t);
|
|
6014
|
-
}),
|
|
6015
|
-
j.value &&
|
|
6016
|
+
}), bn(N, w), K(o, (t) => {
|
|
6017
|
+
j.value && xn(j.value, t, (t) => {
|
|
6016
6018
|
_.value = t.message, e.onCommandError?.(t);
|
|
6017
6019
|
});
|
|
6018
6020
|
}), K(() => [e.content === void 0 ? e.defaultContentFormat : e.contentFormat, e.content], () => {
|
|
6019
|
-
j.value &&
|
|
6021
|
+
j.value && bn(j.value, ge(e.content === void 0 ? e.defaultContentFormat : e.contentFormat));
|
|
6020
6022
|
});
|
|
6021
|
-
let P = j.value, F =
|
|
6023
|
+
let P = j.value, F = Me(P), I = !1, ee = !1;
|
|
6022
6024
|
q(() => {
|
|
6023
6025
|
I || j.value !== P || (ee = !0, e.onAiEditControllerChange?.(F));
|
|
6024
6026
|
});
|
|
6025
6027
|
let L = G(() => j.value ?? null);
|
|
6026
6028
|
function R() {
|
|
6027
|
-
h.value = null, g.value = null, m.value =
|
|
6029
|
+
h.value = null, g.value = null, m.value = Cn;
|
|
6028
6030
|
}
|
|
6029
6031
|
function te(e) {
|
|
6030
|
-
let t =
|
|
6032
|
+
let t = hn(e.state);
|
|
6031
6033
|
if (!t) {
|
|
6032
|
-
m.value = m.value.name === "idle" ? m.value :
|
|
6034
|
+
m.value = m.value.name === "idle" ? m.value : Cn, h.value = null, g.value = null;
|
|
6033
6035
|
return;
|
|
6034
6036
|
}
|
|
6035
6037
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
6036
|
-
if (!
|
|
6038
|
+
if (!_n(r, { frameRect: i })) {
|
|
6037
6039
|
R();
|
|
6038
6040
|
return;
|
|
6039
6041
|
}
|
|
6040
|
-
let a =
|
|
6042
|
+
let a = mn(n, {
|
|
6041
6043
|
frameRect: i,
|
|
6042
6044
|
triggerRect: r
|
|
6043
6045
|
});
|
|
6044
|
-
|
|
6046
|
+
fn(h.value, a) || (h.value = a), m.value = pn(m.value, t);
|
|
6045
6047
|
}
|
|
6046
6048
|
function z(e) {
|
|
6047
6049
|
te(e.view);
|
|
6048
6050
|
}
|
|
6049
6051
|
function B(e) {
|
|
6050
|
-
let t =
|
|
6051
|
-
|
|
6052
|
-
let n =
|
|
6053
|
-
n && (
|
|
6054
|
-
let r =
|
|
6052
|
+
let t = De(e);
|
|
6053
|
+
Te(p.value, t) || (p.value = t);
|
|
6054
|
+
let n = Xt(e);
|
|
6055
|
+
n && (Qt(e, n, !0), y.value = n);
|
|
6056
|
+
let r = lt(e);
|
|
6055
6057
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
6056
6058
|
}
|
|
6057
6059
|
function H(e) {
|
|
6058
|
-
b.value =
|
|
6060
|
+
b.value = cs(e);
|
|
6059
6061
|
}
|
|
6060
|
-
let ne = G(() => L.value ?
|
|
6062
|
+
let ne = G(() => L.value ? lt(L.value) : ss), re = G(() => L.value ? kn(L.value.state) : os), ie = G(() => p.value?.currentNode === "codeBlock"), ae = G(() => ie.value && ne.value.language === "mermaid"), oe = G(() => L.value ? on({
|
|
6061
6063
|
active: ae.value,
|
|
6062
6064
|
mode: v.value,
|
|
6063
6065
|
source: ne.value.text
|
|
6064
|
-
}) :
|
|
6066
|
+
}) : on({
|
|
6065
6067
|
active: !1,
|
|
6066
6068
|
mode: "code",
|
|
6067
6069
|
source: ""
|
|
6068
|
-
})), se = G(() => L.value && e.onRuntimeStateChange ?
|
|
6070
|
+
})), se = G(() => L.value && e.onRuntimeStateChange ? Dn(L.value.state) : null), ce = G(() => L.value ? tt(L.value.state) : Qe.items), ue = G(() => nt(ce.value, x.value)), _e = G(() => Ze(ce.value, ue.value)), ve = G(() => {
|
|
6069
6071
|
u.value, p.value, l.value;
|
|
6070
6072
|
let e = L.value;
|
|
6071
|
-
return
|
|
6073
|
+
return sn(e ? vn(e).getCommands({
|
|
6072
6074
|
surface: "slash",
|
|
6073
6075
|
query: m.value.query
|
|
6074
6076
|
}) : o.value.commands, r);
|
|
6075
|
-
}), ye = G(() =>
|
|
6077
|
+
}), ye = G(() => we({
|
|
6076
6078
|
revision: u.value,
|
|
6077
6079
|
mode: s.value,
|
|
6078
6080
|
editable: l.value,
|
|
@@ -6086,27 +6088,27 @@ function Os(e = {}) {
|
|
|
6086
6088
|
tableDebugSnapshot: se.value
|
|
6087
6089
|
})), be = {
|
|
6088
6090
|
closeSlashMenu: R,
|
|
6089
|
-
focusFirstTableBodyCell: () => L.value ?
|
|
6091
|
+
focusFirstTableBodyCell: () => L.value ? On(L.value) : !1,
|
|
6090
6092
|
setContent: (e, t = {}) => {
|
|
6091
6093
|
if (!L.value) return !1;
|
|
6092
6094
|
let n = ge(t.format);
|
|
6093
6095
|
return L.value.commands.setContent(e, {
|
|
6094
6096
|
contentType: pe(n),
|
|
6095
6097
|
emitUpdate: t.emitUpdate ?? !1
|
|
6096
|
-
}), t.focusFirstTableBodyCell &&
|
|
6098
|
+
}), t.focusFirstTableBodyCell && On(L.value), B(L.value), l.value && z(L.value), H(L.value), O(), !0;
|
|
6097
6099
|
}
|
|
6098
6100
|
};
|
|
6099
6101
|
function xe(e, t) {
|
|
6100
|
-
if (!L.value || !l.value || !
|
|
6102
|
+
if (!L.value || !l.value || !ln(e)) return;
|
|
6101
6103
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
6102
6104
|
g.value = e;
|
|
6103
6105
|
return;
|
|
6104
6106
|
}
|
|
6105
|
-
let n =
|
|
6107
|
+
let n = hn(L.value.state);
|
|
6106
6108
|
if (!n) return;
|
|
6107
|
-
_.value = null, m.value =
|
|
6109
|
+
_.value = null, m.value = wn(m.value, { type: "execute" }), g.value = null;
|
|
6108
6110
|
let r = L.value;
|
|
6109
|
-
|
|
6111
|
+
yn(r, e.id, n, t).then((e) => {
|
|
6110
6112
|
if (e.ok && e.outcome === "applied") {
|
|
6111
6113
|
R();
|
|
6112
6114
|
return;
|
|
@@ -6117,17 +6119,17 @@ function Os(e = {}) {
|
|
|
6117
6119
|
function Se(e) {
|
|
6118
6120
|
if (!L.value || g.value || !l.value) return;
|
|
6119
6121
|
if (m.value.name === "executing" && e.key === "Escape") {
|
|
6120
|
-
e.preventDefault(),
|
|
6122
|
+
e.preventDefault(), vn(L.value).cancel(), R();
|
|
6121
6123
|
return;
|
|
6122
6124
|
}
|
|
6123
|
-
let t =
|
|
6125
|
+
let t = un(m.value, ve.value, e.key, { isComposing: e.isComposing || le(L.value.state) });
|
|
6124
6126
|
if (t.type !== "ignore") {
|
|
6125
6127
|
if (e.preventDefault(), t.type === "close") {
|
|
6126
|
-
|
|
6128
|
+
vn(L.value).cancel(), m.value = wn(m.value, { type: "escape" }), R();
|
|
6127
6129
|
return;
|
|
6128
6130
|
}
|
|
6129
6131
|
if (t.type === "move-active") {
|
|
6130
|
-
m.value =
|
|
6132
|
+
m.value = wn(m.value, {
|
|
6131
6133
|
type: "move-active",
|
|
6132
6134
|
delta: t.delta,
|
|
6133
6135
|
optionCount: t.optionCount
|
|
@@ -6135,7 +6137,7 @@ function Os(e = {}) {
|
|
|
6135
6137
|
return;
|
|
6136
6138
|
}
|
|
6137
6139
|
if (t.type === "set-active") {
|
|
6138
|
-
m.value =
|
|
6140
|
+
m.value = wn(m.value, t);
|
|
6139
6141
|
return;
|
|
6140
6142
|
}
|
|
6141
6143
|
xe(t.command);
|
|
@@ -6145,9 +6147,9 @@ function Os(e = {}) {
|
|
|
6145
6147
|
s.value = d(e.mode), L.value && (L.value.setEditable(l.value), f(L.value, {
|
|
6146
6148
|
mode: s.value,
|
|
6147
6149
|
editable: l.value
|
|
6148
|
-
}),
|
|
6150
|
+
}), rn(L.value, l.value ? "live" : "view"), O(), l.value || R());
|
|
6149
6151
|
}, { immediate: !0 }), K(() => e.theme, () => {
|
|
6150
|
-
L.value &&
|
|
6152
|
+
L.value && nn(L.value, c.value);
|
|
6151
6153
|
}, { immediate: !0 }), K(() => e.content, (t) => {
|
|
6152
6154
|
let n = ge(e.contentFormat);
|
|
6153
6155
|
if (!(!L.value || t === void 0)) {
|
|
@@ -6161,25 +6163,25 @@ function Os(e = {}) {
|
|
|
6161
6163
|
}), S.value = !1, B(L.value), l.value && z(L.value), H(L.value), O());
|
|
6162
6164
|
}
|
|
6163
6165
|
}), K(ye, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(_e, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ce, (e) => {
|
|
6164
|
-
let t =
|
|
6166
|
+
let t = nt(e, x.value);
|
|
6165
6167
|
x.value !== t && (x.value = t);
|
|
6166
6168
|
});
|
|
6167
6169
|
let Ce = de(() => {
|
|
6168
6170
|
L.value && h.value && te(L.value.view);
|
|
6169
|
-
}),
|
|
6170
|
-
e?.type === "scroll" &&
|
|
6171
|
+
}), Ee = (e) => {
|
|
6172
|
+
e?.type === "scroll" && gn(e.target) || h.value && Ce.schedule();
|
|
6171
6173
|
};
|
|
6172
6174
|
K(h, (e) => {
|
|
6173
|
-
e ?
|
|
6175
|
+
e ? Ee() : Ce.cancel();
|
|
6176
|
+
}), Sr(() => {
|
|
6177
|
+
window.addEventListener("resize", Ee), window.addEventListener("scroll", Ee, !0);
|
|
6174
6178
|
}), Cr(() => {
|
|
6175
|
-
window.
|
|
6176
|
-
}), wr(() => {
|
|
6177
|
-
Ce.cancel(), window.removeEventListener("resize", De), window.removeEventListener("scroll", De, !0);
|
|
6179
|
+
Ce.cancel(), window.removeEventListener("resize", Ee), window.removeEventListener("scroll", Ee, !0);
|
|
6178
6180
|
});
|
|
6179
|
-
let
|
|
6180
|
-
return
|
|
6181
|
+
let ke = null;
|
|
6182
|
+
return Cr(() => {
|
|
6181
6183
|
D !== null && window.clearTimeout(D);
|
|
6182
|
-
}),
|
|
6184
|
+
}), Sr(() => {
|
|
6183
6185
|
let e = () => {
|
|
6184
6186
|
if (!L.value || !ce.value.length) {
|
|
6185
6187
|
x.value = null;
|
|
@@ -6187,17 +6189,17 @@ function Os(e = {}) {
|
|
|
6187
6189
|
}
|
|
6188
6190
|
let e = null;
|
|
6189
6191
|
try {
|
|
6190
|
-
e =
|
|
6192
|
+
e = $e(L.value, ce.value);
|
|
6191
6193
|
} catch {
|
|
6192
6194
|
return;
|
|
6193
6195
|
}
|
|
6194
6196
|
x.value !== e && (x.value = e);
|
|
6195
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
6196
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
6197
|
+
}, t = () => window.requestAnimationFrame(e), n = ls(L.value?.view.dom ?? null);
|
|
6198
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), ke = () => {
|
|
6197
6199
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
6198
6200
|
};
|
|
6199
|
-
}),
|
|
6200
|
-
|
|
6201
|
+
}), Cr(() => {
|
|
6202
|
+
ke?.(), I = !0, ee && e.onAiEditControllerChange?.(null), M && e.onCommandControllerChange?.(null);
|
|
6201
6203
|
let t = j.value;
|
|
6202
6204
|
j.value = null, q(() => t?.destroy());
|
|
6203
6205
|
}), {
|
|
@@ -6230,7 +6232,7 @@ function Os(e = {}) {
|
|
|
6230
6232
|
}
|
|
6231
6233
|
};
|
|
6232
6234
|
}
|
|
6233
|
-
var
|
|
6235
|
+
var Os = J({
|
|
6234
6236
|
name: "MarkweaveEditor",
|
|
6235
6237
|
props: {
|
|
6236
6238
|
defaultContent: {
|
|
@@ -6285,6 +6287,10 @@ var ks = J({
|
|
|
6285
6287
|
type: String,
|
|
6286
6288
|
default: void 0
|
|
6287
6289
|
},
|
|
6290
|
+
revealLinkMarkdown: {
|
|
6291
|
+
type: Boolean,
|
|
6292
|
+
default: !0
|
|
6293
|
+
},
|
|
6288
6294
|
autoFocusFirstTableBodyCell: {
|
|
6289
6295
|
type: Boolean,
|
|
6290
6296
|
default: !1
|
|
@@ -6379,11 +6385,11 @@ var ks = J({
|
|
|
6379
6385
|
}
|
|
6380
6386
|
},
|
|
6381
6387
|
setup(e) {
|
|
6382
|
-
let t =
|
|
6388
|
+
let t = Ds(e);
|
|
6383
6389
|
return () => {
|
|
6384
6390
|
let r = t.editor.value;
|
|
6385
6391
|
if (!r) return null;
|
|
6386
|
-
let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s =
|
|
6392
|
+
let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = Ae(e.canvasColor);
|
|
6387
6393
|
return U("section", {
|
|
6388
6394
|
class: o,
|
|
6389
6395
|
role: "combobox",
|
|
@@ -6394,21 +6400,21 @@ var ks = J({
|
|
|
6394
6400
|
"aria-busy": i.slashState.value.name === "executing",
|
|
6395
6401
|
"data-testid": "markweave-editor-frame",
|
|
6396
6402
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
6397
|
-
"data-markweave-theme":
|
|
6403
|
+
"data-markweave-theme": je(e.theme),
|
|
6398
6404
|
style: s ? { "--markweave-canvas": s } : void 0,
|
|
6399
6405
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
6400
|
-
"data-markweave-inner-toc-placement":
|
|
6406
|
+
"data-markweave-inner-toc-placement": rt(e.innerTocPlacement),
|
|
6401
6407
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
6402
6408
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
6403
6409
|
onKeydownCapture: i.handleEditorKeyDown
|
|
6404
6410
|
}, [
|
|
6405
|
-
i.effectiveEditable.value ? U(
|
|
6411
|
+
i.effectiveEditable.value ? U(vs, {
|
|
6406
6412
|
editor: r,
|
|
6407
6413
|
lang: n(e.lang),
|
|
6408
6414
|
messages: i.messages,
|
|
6409
6415
|
askAi: e.askAi
|
|
6410
6416
|
}) : null,
|
|
6411
|
-
i.effectiveEditable.value ? U(
|
|
6417
|
+
i.effectiveEditable.value ? U(bs, {
|
|
6412
6418
|
commands: i.filteredSlashCommands.value,
|
|
6413
6419
|
state: i.slashState.value,
|
|
6414
6420
|
position: i.slashMenuPosition.value,
|
|
@@ -6419,7 +6425,7 @@ var ks = J({
|
|
|
6419
6425
|
onInputCommandChange: i.setSlashInputCommand,
|
|
6420
6426
|
onUpload: e.onSlashCommandUpload
|
|
6421
6427
|
}) : null,
|
|
6422
|
-
i.effectiveEditable.value ? U(
|
|
6428
|
+
i.effectiveEditable.value ? U(Cs, {
|
|
6423
6429
|
editor: r,
|
|
6424
6430
|
active: i.tableFocusState.value.active,
|
|
6425
6431
|
interactionState: i.tableInteractionState.value,
|
|
@@ -6429,11 +6435,11 @@ var ks = J({
|
|
|
6429
6435
|
onCommandResult: e.onTableCommandResult,
|
|
6430
6436
|
onEditWithAi: e.onEditWithAi
|
|
6431
6437
|
}) : null,
|
|
6432
|
-
i.effectiveEditable.value ? U(
|
|
6438
|
+
i.effectiveEditable.value ? U(ws, {
|
|
6433
6439
|
editor: r,
|
|
6434
6440
|
focusState: i.tableFocusState.value
|
|
6435
6441
|
}) : null,
|
|
6436
|
-
U(
|
|
6442
|
+
U(Ts, {
|
|
6437
6443
|
editor: r,
|
|
6438
6444
|
state: i.codeBlockState.value,
|
|
6439
6445
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -6441,14 +6447,14 @@ var ks = J({
|
|
|
6441
6447
|
onMermaidModeChange: i.setMermaidMode,
|
|
6442
6448
|
readOnly: !i.effectiveEditable.value
|
|
6443
6449
|
}),
|
|
6444
|
-
e.innerToc && i.tocState.value.items.length ? U(
|
|
6450
|
+
e.innerToc && i.tocState.value.items.length ? U(Es, {
|
|
6445
6451
|
editor: r,
|
|
6446
6452
|
state: i.tocState.value,
|
|
6447
6453
|
messages: i.messages,
|
|
6448
6454
|
editable: i.effectiveEditable.value,
|
|
6449
|
-
placement:
|
|
6455
|
+
placement: rt(e.innerTocPlacement)
|
|
6450
6456
|
}) : null,
|
|
6451
|
-
i.effectiveEditable.value && i.mathTarget.value ? U(
|
|
6457
|
+
i.effectiveEditable.value && i.mathTarget.value ? U(ys, {
|
|
6452
6458
|
editor: r,
|
|
6453
6459
|
messages: i.messages,
|
|
6454
6460
|
target: i.mathTarget.value,
|
|
@@ -6460,4 +6466,4 @@ var ks = J({
|
|
|
6460
6466
|
}
|
|
6461
6467
|
});
|
|
6462
6468
|
//#endregion
|
|
6463
|
-
export {
|
|
6469
|
+
export { Os as MarkweaveEditor, ne as createMarkweaveAiEditController, da as createMarkweaveEditorExtensions, da as createMarkweaveVue2EditorExtensions, Ds as useMarkweaveEditorController };
|