@markweave/vue2 0.9.2 → 0.10.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/dist/index.js +1118 -1011
- package/dist/legacy/chunks/markdown-parser-worker-source.generated-Csu6jOOf.js +4 -0
- package/dist/legacy/index.js +10727 -8146
- package/dist/types/MarkweaveEditor.d.ts +10 -0
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.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
|
@@ -11,61 +11,64 @@ import { openMarkweaveImagePreview as y } from "markweave/internal/plugins/media
|
|
|
11
11
|
import { createMarkweaveLightweightImageNodeViewRenderer as b } from "markweave/internal/plugins/media/lightweight-image-node-view";
|
|
12
12
|
import { resolveMarkweaveMediaSource as x } from "markweave/internal/plugins/media/media-source";
|
|
13
13
|
import { MarkweaveCoreImage as S, MarkweaveCoreVideo as C, attrsFromMarkweaveImageUploadResult as w, attrsFromMarkweaveVideoUploadResult as T, attrsFromMarkweaveVideoUrl as E, clampMarkweaveImageWidth as D, createMarkweaveImageUploadRequest as O, createMarkweaveVideoUploadRequest as k, downloadMarkweaveImage as A, markweaveVideoIframeAllow as j, normalizeMarkweaveCoreImageAlign as M, normalizeMarkweaveVideoEmbedUrl as N, numberAttribute as P, stringAttribute as F } from "markweave/internal/plugins/media/core-media-nodes";
|
|
14
|
-
import { activateMarkweaveAttachmentDownload as I, attrsFromMarkweaveAttachmentUploadResult as ee, createMarkweaveAttachmentRefFromAttrs as L, createMarkweaveAttachmentUploadRequest as
|
|
15
|
-
import { MarkweaveAttachment as
|
|
16
|
-
import { detectUploadSource as
|
|
17
|
-
import { createMarkweaveAiEditController as
|
|
18
|
-
import { isTextSelection as
|
|
19
|
-
import { NodeSelection as
|
|
20
|
-
import { CellSelection as
|
|
21
|
-
import { isEditorComposing as
|
|
22
|
-
import { saveMarkweaveBrowserFile as
|
|
23
|
-
import { createMarkweaveFrameScheduler as
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
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 {
|
|
14
|
+
import { activateMarkweaveAttachmentDownload as I, attrsFromMarkweaveAttachmentUploadResult as ee, createMarkweaveAttachmentRefFromAttrs as L, createMarkweaveAttachmentUploadRequest as te, formatMarkweaveAttachmentSize as ne } from "markweave/internal/plugins/media/attachment-download";
|
|
15
|
+
import { MarkweaveAttachment as R } from "markweave/internal/plugins/media/media-nodes";
|
|
16
|
+
import { detectUploadSource as re, getDirectUploadResult as z, resolveMarkweaveUploadResult as B } from "markweave/internal/plugins/slash-command/upload";
|
|
17
|
+
import { createMarkweaveAiEditController as ie, prepareMarkweaveEditorForOutput as ae } from "markweave";
|
|
18
|
+
import { isTextSelection as oe, posToDOMRect as V } from "@tiptap/core";
|
|
19
|
+
import { NodeSelection as se, Plugin as ce, PluginKey as le } from "@tiptap/pm/state";
|
|
20
|
+
import { CellSelection as H } from "@tiptap/pm/tables";
|
|
21
|
+
import { isEditorComposing as ue } from "markweave/internal/editor-core/composition-guard";
|
|
22
|
+
import { saveMarkweaveBrowserFile as de } from "markweave/internal/core/browser-file-save";
|
|
23
|
+
import { createMarkweaveFrameScheduler as fe } from "markweave/internal/editor-core/frame-scheduler";
|
|
24
|
+
import { createMarkweaveDocumentViewportCoordinator as pe } from "markweave/internal/core/document-viewport";
|
|
25
|
+
import { createMarkweaveEditorUpdatePayload as me, getMarkweaveContentType as he, isEditorContentCurrent as ge, isMarkweaveControlledContentEchoCurrent as _e, normalizeMarkweaveContentFormat as ve } from "markweave/internal/editor-core/editor-content";
|
|
26
|
+
import { getCurrentFloatingToolbarBlockType as ye, getFloatingToolbarHighlightColorOptions as be, getFloatingToolbarMoreActions as xe, getFloatingToolbarTextColorOptions as Se, getFloatingToolbarTurnIntoOptions as Ce, runFloatingToolbarMoreAction as we, setFloatingToolbarTurnInto as Te } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
27
|
+
import { createMarkweaveEditorRuntimeSnapshot as Ee } from "markweave/internal/editor-core/runtime-snapshot";
|
|
28
|
+
import { createMarkweaveDocumentLoadState as De, getMarkweaveContentLength as Oe, getMarkweaveDocumentLoadMeta as ke, loadMarkweaveDocument as Ae, profileMarkweaveDocument as je, resolveMarkweavePerformanceTier as Me, shouldCoordinateMarkweaveDocumentLoad as Ne } from "markweave/internal/editor-core/document-load";
|
|
29
|
+
import { areEditorSelectionSnapshotsEquivalent as Pe, calculateFloatingToolbarPopoverPlacement as Fe, createSelectionSnapshot as Ie, markweaveRuntimeProjectionDelayMs as Le, shouldShowFloatingToolbarForAiState as Re } from "markweave/internal/editor-core/selection-state";
|
|
30
|
+
import { normalizeMarkweaveCanvasColor as ze, normalizeMarkweaveTheme as Be } from "markweave/internal/core/theme";
|
|
31
|
+
import { createMarkweaveAiEditController as Ve } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
|
|
32
|
+
import { createMarkweaveSearchController as He } from "markweave/internal/plugins/search/search-controller";
|
|
33
|
+
import { MarkweaveAskAiError as Ue, acceptMarkweaveAskAiResult as We, calculateMarkweaveAskAiPanelPosition as Ge, canStartMarkweaveAskAiTableTarget as Ke, clearMarkweaveAskAiPreview as qe, clearMarkweaveAskAiTarget as Je, createMarkweaveAskAiRequest as Ye, getMappedMarkweaveAskAiSelection as Xe, getMarkweaveAskAiSurfaceRect as Ze, getMarkweaveAskAiTarget as Qe, getMarkweaveAskAiTargetRect as $e, hasMarkweaveAskAiPreview as et, isMarkweaveAskAiSelectionEligible as tt, restoreMarkweaveAskAiTargetSelection as nt, runMarkweaveAskAiHandler as rt, setMarkweaveAskAiPreview as it, startMarkweaveAskAiTableTarget as at, startMarkweaveAskAiTarget as ot } from "markweave/internal/plugins/ask-ai/ask-ai-session";
|
|
34
|
+
import { createMarkweaveTocState as st, emptyMarkweaveTocState as ct, getActiveMarkweaveTocId as lt, getMarkweaveInnerTocRailHeight as ut, getMarkweaveTocItemsFromState as dt, getValidMarkweaveTocActiveId as ft, normalizeMarkweaveInnerTocPlacement as pt, observeMarkweaveInnerTocContainerPosition as mt, observeMarkweaveInnerTocRailOverflow as ht, scrollToMarkweaveTocItem as gt } from "markweave/internal/core/toc-state";
|
|
35
|
+
import { codeBlockCollapsePluginKey as _t, copyActiveCodeBlock as vt, getActiveCodeBlockState as yt, getCodeBlockCopyFeedbackSnapshot as bt, markweaveCodeBlockBehavior as xt, setCodeBlockCollapsedAtPosition as St, setCodeBlockLanguageAtPosition as Ct, setCodeBlockMermaidPreviewModeAtPosition as wt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
36
|
+
import { calculateCodeBlockLanguageMenuPosition as Tt, clampFullscreenScale as Et, codeBlockCopyFeedbackTimeoutMs as Dt, copyCodeBlockText as Ot, createCodeBlockLanguageMenuDomId as kt, createCodeBlockOverlayPosition as At, createMermaidFullscreenViewerState as jt, createMermaidTabPosition as Mt, focusCodeBlockTarget as Nt, formatCodeBlockLanguageLabel as Pt, formatFullscreenZoom as Ft, getActiveCodeBlockElement as It, getAnchoredRect as Lt, getCodeBlockLanguageItems as Rt, getCodeBlockLanguageOptionDomId as zt, getCodeBlockPositionFromEventTarget as Bt, getCodeBlockStateAtPosition as Vt, getFrameElement as Ht, getInitialCodeBlockLanguageItemIndex as Ut, getMermaidCodeBlockTargets as Wt, getMermaidSvgMarkup as Gt, isCodeBlockTargetCollapsed as Kt, mergeStableMermaidTabPositions as qt, mermaidFullscreenZoomStep as Jt, moveCodeBlockLanguageItemIndex as Yt, moveMermaidFullscreenViewer as Xt, scrollCodeBlockLanguageItemIntoView as Zt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
37
|
+
import { normalizeMarkdownLinkHref as Qt } from "markweave/internal/plugins/markdown/markdown-input";
|
|
38
|
+
import { applyMarkweaveMathLatex as $t, calculateMarkweaveMathPopoverPosition as en, getMarkweaveMathAnchorRect as tn, getMarkweaveMathBlockIndex as nn, getMarkweaveMathRenderedHtml as rn, getMarkweaveMathTargetAtPos as an, getMarkweaveMathTargetFromDomEvent as on, getMarkweaveMathTargetFromSelection as sn, renderMarkweaveMathPreview as cn, setMarkweaveMathEditingDomState as ln, setMarkweaveMathEditingDomStateInView as un, setMarkweaveMathSelectionInView as dn } from "markweave/internal/plugins/math/math-ui-model";
|
|
39
|
+
import { isMermaidInlinePreviewTransaction as fn, setMarkweaveMermaidTheme as pn, setMermaidInlinePreviewEditorMode as mn, setReadonlyMermaidPreviewMode as hn } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
40
|
+
import { getMermaidPreviewState as gn } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
41
|
+
import { createResolvedSlashCommandSpecs as _n, getSlashCommandTextIconLength as vn, isExecutableSlashCommand as yn } from "markweave/internal/plugins/slash-command/command-spec";
|
|
42
|
+
import { getSlashCommandKeyboardAction as bn } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
43
|
+
import { scrollSlashCommandItemIntoView as xn } from "markweave/internal/plugins/slash-command/slash-menu-scroll";
|
|
44
|
+
import { areSlashCommandMenuPositionsEquivalent as Sn, getNextSlashCommandState as Cn, getSlashCommandAnchoredMenuPosition as wn, getSlashCommandContext as Tn, isMarkweaveSlashMenuScrollTarget as En, isSlashCommandAnchorVisible as Dn } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
45
|
+
import { createMarkweaveCommandController as On, executeMarkweaveSlashCommand as kn, setMarkweaveCommandContentFormat as An, setMarkweaveCommandRegistry as jn } from "markweave/internal/commands/command-runtime";
|
|
46
|
+
import { createMarkweaveCommandRegistry as Mn } from "markweave/internal/commands/command-registry";
|
|
47
|
+
import { initialSlashCommandState as Nn, reduceSlashCommandState as Pn } from "markweave/internal/plugins/slash-command/slash-state";
|
|
48
|
+
import { setMarkweaveTableMenuAxisTarget as Fn } from "markweave/internal/plugins/table/table-clipboard";
|
|
49
|
+
import { isMarkweaveTableCapabilityAllowed as In } from "markweave/internal/plugins/table/table-capabilities";
|
|
50
|
+
import { getFirstTableDebugSnapshot as Ln } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
51
|
+
import { focusFirstTableBodyCell as Rn } from "markweave/internal/plugins/table/table-focus-position";
|
|
52
|
+
import { getTableFocusState as zn } from "markweave/internal/plugins/table/table-focus-state";
|
|
53
|
+
import { getTableSelectionOverlayState as Bn, initialTableInteractionState as Vn, tableInteractionPluginKey as Hn } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
54
|
+
import { applyTableAxisAlignment as Un, applyTableAxisBackgroundColor as Wn, applyTableAxisTextColor as Gn, calculateAnchoredTableMenuPosition as Kn, calculateAnchoredTableSubmenuPosition as qn, calculateTableAxisHandleLayout as Jn, calculateTableExtendButtonLayout as Yn, canRunTableCommand as Xn, executeTableMenuCommand as Zn, formatTableCopyFeedback as Qn, getActiveTableElement as $n, getAvailableCellMenuCommandSpecs as er, getTableAxisDropIndexAtPoint as tr, getTableAxisFormattingState as nr, getTableAxisTargetRect as rr, getTableControlAxisSelectionModel as ir, getTableMenuBoundaryRect as ar, getTableMenuItemGroup as or, getTableMenuItemLabel as sr, getTableMenuItems as cr, getTableSelectionTargetRect as lr, measureTableSelectionOverlay as ur, moveTargetedTableAxis as dr, selectTableAxisFromCell as fr, tableColorOptions as pr, tableCopyFeedbackTimeoutMs as mr, tableHorizontalAlignmentOptions as hr, tableMenuLabel as gr, tableVerticalAlignmentOptions as _r, targetTableAxisFromCell as vr } from "markweave/internal/plugins/table/table-ui-model";
|
|
52
55
|
//#region src/vue2-compat.ts
|
|
53
|
-
var
|
|
54
|
-
function
|
|
56
|
+
var yr = c.default ?? c, br = null, xr = null, Sr = null;
|
|
57
|
+
function Cr(e) {
|
|
55
58
|
return !!(e && typeof e == "object" && "value" in e);
|
|
56
59
|
}
|
|
57
|
-
function
|
|
60
|
+
function wr(e) {
|
|
58
61
|
let t = e.slice(2);
|
|
59
62
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
60
63
|
}
|
|
61
|
-
function
|
|
64
|
+
function Tr(e) {
|
|
62
65
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
63
66
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
64
67
|
if (o === "class" || o === "style" || o === "key") {
|
|
65
68
|
t[o] = s;
|
|
66
69
|
continue;
|
|
67
70
|
}
|
|
68
|
-
if (o === "ref" &&
|
|
71
|
+
if (o === "ref" && Cr(s)) {
|
|
69
72
|
a.insert = (e) => {
|
|
70
73
|
s.value = e.elm;
|
|
71
74
|
}, a.destroy = () => {
|
|
@@ -74,7 +77,7 @@ function hr(e) {
|
|
|
74
77
|
continue;
|
|
75
78
|
}
|
|
76
79
|
if (/^on[A-Z]/.test(o)) {
|
|
77
|
-
i[
|
|
80
|
+
i[wr(o)] = s;
|
|
78
81
|
continue;
|
|
79
82
|
}
|
|
80
83
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -85,14 +88,14 @@ function hr(e) {
|
|
|
85
88
|
}
|
|
86
89
|
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;
|
|
87
90
|
}
|
|
88
|
-
function
|
|
91
|
+
function Er(e) {
|
|
89
92
|
let t = {}, n = {}, r = {}, i = {};
|
|
90
93
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
91
94
|
if (a === "class" || a === "style" || a === "key") {
|
|
92
95
|
t[a] = o;
|
|
93
96
|
continue;
|
|
94
97
|
}
|
|
95
|
-
if (a === "ref" &&
|
|
98
|
+
if (a === "ref" && Cr(o)) {
|
|
96
99
|
i.insert = (e) => {
|
|
97
100
|
o.value = e.componentInstance ?? e.elm;
|
|
98
101
|
}, i.destroy = () => {
|
|
@@ -108,34 +111,34 @@ function gr(e) {
|
|
|
108
111
|
}
|
|
109
112
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
110
113
|
}
|
|
111
|
-
function
|
|
114
|
+
function Dr(e) {
|
|
112
115
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
113
116
|
}
|
|
114
|
-
function
|
|
117
|
+
function Or(e) {
|
|
115
118
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
116
119
|
}
|
|
117
|
-
function
|
|
120
|
+
function kr(e) {
|
|
118
121
|
return e == null || Array.isArray(e) ? e : [e];
|
|
119
122
|
}
|
|
120
|
-
function
|
|
121
|
-
return typeof e == "function" ?
|
|
123
|
+
function Ar(e) {
|
|
124
|
+
return typeof e == "function" ? kr(e()) : Dr(e) ? kr(e.default()) : Or(e) ? [e] : e;
|
|
122
125
|
}
|
|
123
126
|
function U(e, t, n) {
|
|
124
|
-
if (!
|
|
125
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
126
|
-
return
|
|
127
|
+
if (!Sr) throw Error("Vue 2 render context is not available.");
|
|
128
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Tr(r) : Er(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Ar(n);
|
|
129
|
+
return Sr(e, i, a);
|
|
127
130
|
}
|
|
128
131
|
function W(e) {
|
|
129
|
-
return
|
|
132
|
+
return yr.observable({ value: e });
|
|
130
133
|
}
|
|
131
|
-
var
|
|
132
|
-
function
|
|
134
|
+
var G = W;
|
|
135
|
+
function K(e) {
|
|
133
136
|
return { get value() {
|
|
134
137
|
return e();
|
|
135
138
|
} };
|
|
136
139
|
}
|
|
137
|
-
function
|
|
138
|
-
let r = typeof e == "function" ? e : () => e.value, i =
|
|
140
|
+
function q(e, t, n) {
|
|
141
|
+
let r = typeof e == "function" ? e : () => e.value, i = br;
|
|
139
142
|
if (!i?.$watch) return () => void 0;
|
|
140
143
|
let a = n ? {
|
|
141
144
|
deep: n.deep,
|
|
@@ -143,25 +146,25 @@ function K(e, t, n) {
|
|
|
143
146
|
} : void 0;
|
|
144
147
|
if (n?.flush !== "post") return i.$watch(r, t, a);
|
|
145
148
|
let o = !1, s = !1, c, l, u = i.$watch(r, (e, n) => {
|
|
146
|
-
c = e, !s && (s = !0, l = n, Promise.resolve(
|
|
149
|
+
c = e, !s && (s = !0, l = n, Promise.resolve(yr.nextTick()).then(() => {
|
|
147
150
|
o || (s = !1, t(c, l));
|
|
148
151
|
}));
|
|
149
152
|
}, a), d = () => {
|
|
150
153
|
o || (o = !0, u());
|
|
151
154
|
};
|
|
152
|
-
return
|
|
155
|
+
return xr?.beforeUnmount.push(d), d;
|
|
153
156
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
function Cr(e) {
|
|
158
|
-
dr?.beforeUnmount.push(e);
|
|
157
|
+
function jr(e) {
|
|
158
|
+
xr?.mounted.push(e);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
|
|
160
|
+
function Mr(e) {
|
|
161
|
+
xr?.beforeUnmount.push(e);
|
|
162
162
|
}
|
|
163
163
|
function J(e) {
|
|
164
|
-
return
|
|
164
|
+
return e ? yr.nextTick(e) : yr.nextTick();
|
|
165
|
+
}
|
|
166
|
+
function Y(e) {
|
|
167
|
+
return yr.extend({
|
|
165
168
|
name: e.name,
|
|
166
169
|
props: e.props,
|
|
167
170
|
created() {
|
|
@@ -169,12 +172,12 @@ function J(e) {
|
|
|
169
172
|
mounted: [],
|
|
170
173
|
beforeUnmount: []
|
|
171
174
|
};
|
|
172
|
-
|
|
175
|
+
br = this, xr = t;
|
|
173
176
|
try {
|
|
174
177
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
175
178
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
176
179
|
} finally {
|
|
177
|
-
|
|
180
|
+
br = null, xr = null;
|
|
178
181
|
}
|
|
179
182
|
},
|
|
180
183
|
mounted() {
|
|
@@ -184,19 +187,19 @@ function J(e) {
|
|
|
184
187
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
185
188
|
},
|
|
186
189
|
render(t) {
|
|
187
|
-
|
|
190
|
+
Sr = t;
|
|
188
191
|
try {
|
|
189
192
|
let n = this.__markweaveVue2Render;
|
|
190
193
|
return n ? n() : e.render?.(t) ?? null;
|
|
191
194
|
} finally {
|
|
192
|
-
|
|
195
|
+
Sr = null;
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
});
|
|
196
199
|
}
|
|
197
200
|
//#endregion
|
|
198
201
|
//#region src/vue2-icons.ts
|
|
199
|
-
var
|
|
202
|
+
var Nr = {
|
|
200
203
|
AlignVerticalJustifyCenter: {
|
|
201
204
|
iconName: "align-vertical-justify-center",
|
|
202
205
|
node: [
|
|
@@ -1518,11 +1521,11 @@ var wr = {
|
|
|
1518
1521
|
}]]
|
|
1519
1522
|
}
|
|
1520
1523
|
};
|
|
1521
|
-
function
|
|
1524
|
+
function Pr(e) {
|
|
1522
1525
|
return e.map(([e, t]) => U(e, t));
|
|
1523
1526
|
}
|
|
1524
|
-
function
|
|
1525
|
-
return
|
|
1527
|
+
function X(e) {
|
|
1528
|
+
return Y({
|
|
1526
1529
|
name: `MarkweaveVue2Icon${e}`,
|
|
1527
1530
|
props: {
|
|
1528
1531
|
size: {
|
|
@@ -1539,7 +1542,7 @@ function Y(e) {
|
|
|
1539
1542
|
}
|
|
1540
1543
|
},
|
|
1541
1544
|
setup(t) {
|
|
1542
|
-
let n =
|
|
1545
|
+
let n = Nr[e];
|
|
1543
1546
|
return () => U("svg", {
|
|
1544
1547
|
class: `lucide lucide-${n.iconName}`,
|
|
1545
1548
|
viewBox: "0 0 24 24",
|
|
@@ -1552,12 +1555,12 @@ function Y(e) {
|
|
|
1552
1555
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1553
1556
|
"aria-hidden": "true",
|
|
1554
1557
|
focusable: "false"
|
|
1555
|
-
},
|
|
1558
|
+
}, Pr(n.node));
|
|
1556
1559
|
}
|
|
1557
1560
|
});
|
|
1558
1561
|
}
|
|
1559
|
-
var
|
|
1560
|
-
function
|
|
1562
|
+
var Fr = X("AlignCenter"), Ir = X("AlignJustify"), Lr = X("AlignLeft"), Rr = X("AlignRight"), zr = X("AlignVerticalJustifyCenter"), Br = X("AlignVerticalJustifyEnd"), Vr = X("AlignVerticalJustifyStart"), Hr = X("AlertTriangle"), Ur = X("ArrowDown"), Wr = X("ArrowDownAZ"), Gr = X("ArrowLeft"), Kr = X("ArrowRight"), qr = X("ArrowUp"), Jr = X("ArrowUpZA"), Yr = X("BetweenHorizontalEnd"), Xr = X("BetweenHorizontalStart"), Zr = X("BetweenVerticalEnd"), Qr = X("BetweenVerticalStart"), $r = X("Bold"), ei = X("Braces"), ti = X("Captions"), ni = X("Check"), ri = X("CheckCircle2"), ii = X("ChevronDown"), ai = X("ChevronRight"), oi = X("ChevronUp"), si = X("CircleX"), ci = X("Code2"), li = X("CornerDownLeft"), ui = X("Copy"), di = X("Download"), fi = X("Eye"), pi = X("ExternalLink"), mi = X("Heading1"), hi = X("Heading2"), gi = X("Heading3"), _i = X("Image"), vi = X("ImageUp"), yi = X("IndentDecrease"), bi = X("IndentIncrease"), xi = X("Info"), Si = X("Italic"), Ci = X("Lightbulb"), wi = X("Link2"), Ti = X("List"), Ei = X("ListChecks"), Di = X("ListOrdered"), Oi = X("Minus"), ki = X("MoreVertical"), Ai = X("PaintBucket"), ji = X("Paperclip"), Mi = X("PencilLine"), Ni = X("Plus"), Pi = X("Quote"), Fi = X("Replace"), Ii = X("RotateCcw"), Li = X("Sigma"), Ri = X("SmilePlus"), zi = X("Sparkles"), Bi = X("Square"), Vi = X("SquareX"), Hi = X("Strikethrough"), Ui = X("Subscript"), Wi = X("Superscript"), Gi = X("Table2"), Ki = X("TableCellsMerge"), qi = X("TableCellsSplit"), Ji = X("Text"), Yi = X("Trash2"), Xi = X("Type"), Zi = X("Underline"), Qi = X("Upload"), $i = X("Video"), ea = X("X"), ta = M;
|
|
1563
|
+
function na(e) {
|
|
1561
1564
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1562
1565
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1563
1566
|
return n === "view" ? {
|
|
@@ -1575,27 +1578,27 @@ function qi(e) {
|
|
|
1575
1578
|
return a && t && a.observe(t, {
|
|
1576
1579
|
attributes: !0,
|
|
1577
1580
|
attributeFilter: ["data-markweave-mode"]
|
|
1578
|
-
}),
|
|
1581
|
+
}), Mr(() => {
|
|
1579
1582
|
i(), a?.disconnect();
|
|
1580
1583
|
}), r;
|
|
1581
1584
|
}
|
|
1582
|
-
function
|
|
1585
|
+
function ra(e) {
|
|
1583
1586
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1584
1587
|
}
|
|
1585
|
-
function
|
|
1588
|
+
function ia(e) {
|
|
1586
1589
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1587
1590
|
}
|
|
1588
|
-
function
|
|
1591
|
+
function aa(e) {
|
|
1589
1592
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1590
1593
|
}
|
|
1591
|
-
function
|
|
1594
|
+
function oa(e, t) {
|
|
1592
1595
|
return U(e, {
|
|
1593
1596
|
size: 18,
|
|
1594
1597
|
strokeWidth: 1.8,
|
|
1595
1598
|
"aria-hidden": "true"
|
|
1596
1599
|
}, { default: () => t });
|
|
1597
1600
|
}
|
|
1598
|
-
function
|
|
1601
|
+
function sa(e) {
|
|
1599
1602
|
return U("button", {
|
|
1600
1603
|
type: "button",
|
|
1601
1604
|
"aria-label": e.label,
|
|
@@ -1604,12 +1607,12 @@ function Qi(e) {
|
|
|
1604
1607
|
"data-active": e.active ? "true" : "false",
|
|
1605
1608
|
onMousedown: (e) => e.preventDefault(),
|
|
1606
1609
|
onClick: e.onClick
|
|
1607
|
-
}, [
|
|
1610
|
+
}, [oa(e.icon, e.label), U("span", {
|
|
1608
1611
|
class: "markweave-image-tooltip",
|
|
1609
1612
|
role: "tooltip"
|
|
1610
1613
|
}, e.label)]);
|
|
1611
1614
|
}
|
|
1612
|
-
function
|
|
1615
|
+
function ca(e) {
|
|
1613
1616
|
let t = W(null), n = e.messages.image;
|
|
1614
1617
|
return U("section", {
|
|
1615
1618
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1651,7 +1654,7 @@ function $i(e) {
|
|
|
1651
1654
|
U("span", {
|
|
1652
1655
|
class: "markweave-image-upload-icon",
|
|
1653
1656
|
"aria-hidden": "true"
|
|
1654
|
-
}, [U(
|
|
1657
|
+
}, [U(vi, {
|
|
1655
1658
|
size: 16,
|
|
1656
1659
|
strokeWidth: 1.8
|
|
1657
1660
|
})]),
|
|
@@ -1677,7 +1680,7 @@ function $i(e) {
|
|
|
1677
1680
|
"data-testid": "markweave-image-upload-submit",
|
|
1678
1681
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1679
1682
|
onClick: e.onSubmit
|
|
1680
|
-
}, [U(
|
|
1683
|
+
}, [U(vi, {
|
|
1681
1684
|
size: 16,
|
|
1682
1685
|
strokeWidth: 1.8
|
|
1683
1686
|
}), e.messages.common.insert]),
|
|
@@ -1693,7 +1696,7 @@ function $i(e) {
|
|
|
1693
1696
|
}, e.error) : null
|
|
1694
1697
|
]);
|
|
1695
1698
|
}
|
|
1696
|
-
function
|
|
1699
|
+
function la(e) {
|
|
1697
1700
|
let t = W(null), n = e.messages.video;
|
|
1698
1701
|
return U("section", {
|
|
1699
1702
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1735,7 +1738,7 @@ function ea(e) {
|
|
|
1735
1738
|
U("span", {
|
|
1736
1739
|
class: "markweave-video-upload-icon",
|
|
1737
1740
|
"aria-hidden": "true"
|
|
1738
|
-
}, [U(
|
|
1741
|
+
}, [U($i, {
|
|
1739
1742
|
size: 16,
|
|
1740
1743
|
strokeWidth: 1.8
|
|
1741
1744
|
})]),
|
|
@@ -1761,7 +1764,7 @@ function ea(e) {
|
|
|
1761
1764
|
"data-testid": "markweave-video-upload-submit",
|
|
1762
1765
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1763
1766
|
onClick: e.onSubmit
|
|
1764
|
-
}, [U(
|
|
1767
|
+
}, [U(Qi, {
|
|
1765
1768
|
size: 16,
|
|
1766
1769
|
strokeWidth: 1.8
|
|
1767
1770
|
}), e.messages.common.insert]),
|
|
@@ -1777,7 +1780,7 @@ function ea(e) {
|
|
|
1777
1780
|
}, e.error) : null
|
|
1778
1781
|
]);
|
|
1779
1782
|
}
|
|
1780
|
-
var
|
|
1783
|
+
var ua = Y({
|
|
1781
1784
|
name: "MarkweaveVueImageNodeView",
|
|
1782
1785
|
props: {
|
|
1783
1786
|
editor: {
|
|
@@ -1810,8 +1813,8 @@ var ta = J({
|
|
|
1810
1813
|
}
|
|
1811
1814
|
},
|
|
1812
1815
|
setup(e) {
|
|
1813
|
-
let n = W(null), r = W(!1), i = W(!1), a = W(!1), s = W(""), c = W(null), l = W(!1), d =
|
|
1814
|
-
|
|
1816
|
+
let n = W(null), r = W(!1), i = W(!1), a = W(!1), s = W(""), c = W(null), l = W(!1), d = K(() => e.node.attrs), f = W(!!F(d.value.caption)), p = W(F(d.value.caption) ?? ""), m = na(e.editor), h = K(() => u(m.value)), g = K(() => e.extension.options?.messages ?? t("zh")), _ = K(() => g.value.image), v = K(() => F(d.value.src)), b = K(() => e.extension.options?.resolveMediaSource), S = W(null), C = null;
|
|
1817
|
+
q(v, (t) => {
|
|
1815
1818
|
if (C?.abort(), C = null, !t) {
|
|
1816
1819
|
S.value = null;
|
|
1817
1820
|
return;
|
|
@@ -1830,8 +1833,8 @@ var ta = J({
|
|
|
1830
1833
|
}).then((e) => {
|
|
1831
1834
|
r.signal.aborted || (S.value = e);
|
|
1832
1835
|
});
|
|
1833
|
-
}, { immediate: !0 }),
|
|
1834
|
-
let T =
|
|
1836
|
+
}, { immediate: !0 }), Mr(() => C?.abort());
|
|
1837
|
+
let T = K(() => S.value?.src ?? (b.value ? null : v.value)), E = K(() => ta(d.value.align)), k = K(() => P(d.value.width)), j = K(() => F(d.value.caption)), M = K(() => h.value && (!v.value || i.value)), N = () => {
|
|
1835
1838
|
T.value && y({
|
|
1836
1839
|
src: T.value,
|
|
1837
1840
|
alt: F(d.value.alt) ?? "",
|
|
@@ -1844,7 +1847,7 @@ var ta = J({
|
|
|
1844
1847
|
}
|
|
1845
1848
|
});
|
|
1846
1849
|
};
|
|
1847
|
-
|
|
1850
|
+
q(j, (e) => {
|
|
1848
1851
|
f.value || (p.value = e ?? "");
|
|
1849
1852
|
});
|
|
1850
1853
|
let I = () => {
|
|
@@ -1862,28 +1865,28 @@ var ta = J({
|
|
|
1862
1865
|
let n = e.extension.options;
|
|
1863
1866
|
l.value = !0, c.value = null;
|
|
1864
1867
|
try {
|
|
1865
|
-
let r = await
|
|
1868
|
+
let r = await B(O(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1866
1869
|
e.updateAttributes(w(d.value, r)), s.value = "", i.value = !1;
|
|
1867
1870
|
} catch (e) {
|
|
1868
1871
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
1869
1872
|
} finally {
|
|
1870
1873
|
l.value = !1, a.value = !1;
|
|
1871
1874
|
}
|
|
1872
|
-
},
|
|
1875
|
+
}, te = () => {
|
|
1873
1876
|
if (!s.value.trim()) {
|
|
1874
1877
|
c.value = _.value.uploadRequiredError;
|
|
1875
1878
|
return;
|
|
1876
1879
|
}
|
|
1877
|
-
L(
|
|
1878
|
-
},
|
|
1880
|
+
L(re(s.value));
|
|
1881
|
+
}, ne = (e) => {
|
|
1879
1882
|
L({
|
|
1880
1883
|
type: "file",
|
|
1881
1884
|
file: e,
|
|
1882
1885
|
mimeType: e.type || "image/*"
|
|
1883
1886
|
});
|
|
1884
|
-
},
|
|
1887
|
+
}, R = () => {
|
|
1885
1888
|
f.value = !f.value, f.value && (p.value = j.value ?? "");
|
|
1886
|
-
},
|
|
1889
|
+
}, z = (t, r) => {
|
|
1887
1890
|
if (!h.value || !v.value) return;
|
|
1888
1891
|
r.preventDefault(), r.stopPropagation(), I();
|
|
1889
1892
|
let i = n.value;
|
|
@@ -1904,7 +1907,7 @@ var ta = J({
|
|
|
1904
1907
|
"data-selected": "false",
|
|
1905
1908
|
"data-hovered": "false",
|
|
1906
1909
|
"data-empty": "true"
|
|
1907
|
-
}, () =>
|
|
1910
|
+
}, () => ca({
|
|
1908
1911
|
messages: g.value,
|
|
1909
1912
|
inputValue: s.value,
|
|
1910
1913
|
error: c.value,
|
|
@@ -1913,8 +1916,8 @@ var ta = J({
|
|
|
1913
1916
|
onInputValue: (e) => {
|
|
1914
1917
|
s.value = e;
|
|
1915
1918
|
},
|
|
1916
|
-
onFile:
|
|
1917
|
-
onSubmit:
|
|
1919
|
+
onFile: ne,
|
|
1920
|
+
onSubmit: te,
|
|
1918
1921
|
onCancel: ee,
|
|
1919
1922
|
onDragActive: (e) => {
|
|
1920
1923
|
a.value = e;
|
|
@@ -1934,7 +1937,7 @@ var ta = J({
|
|
|
1934
1937
|
r.value = !1;
|
|
1935
1938
|
},
|
|
1936
1939
|
onMousedown: (e) => {
|
|
1937
|
-
h.value && !
|
|
1940
|
+
h.value && !ra(e.target) && I();
|
|
1938
1941
|
}
|
|
1939
1942
|
}, () => [
|
|
1940
1943
|
h.value ? U("div", {
|
|
@@ -1943,24 +1946,24 @@ var ta = J({
|
|
|
1943
1946
|
"data-markweave-image-ui": "true",
|
|
1944
1947
|
"aria-label": _.value.toolsAriaLabel
|
|
1945
1948
|
}, [
|
|
1946
|
-
|
|
1949
|
+
sa({
|
|
1947
1950
|
testId: "markweave-image-align-left",
|
|
1948
1951
|
label: _.value.alignLeft,
|
|
1949
|
-
icon:
|
|
1952
|
+
icon: Lr,
|
|
1950
1953
|
active: E.value === "left",
|
|
1951
1954
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1952
1955
|
}),
|
|
1953
|
-
|
|
1956
|
+
sa({
|
|
1954
1957
|
testId: "markweave-image-align-center",
|
|
1955
1958
|
label: _.value.alignCenter,
|
|
1956
|
-
icon:
|
|
1959
|
+
icon: Fr,
|
|
1957
1960
|
active: E.value === "center",
|
|
1958
1961
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1959
1962
|
}),
|
|
1960
|
-
|
|
1963
|
+
sa({
|
|
1961
1964
|
testId: "markweave-image-align-right",
|
|
1962
1965
|
label: _.value.alignRight,
|
|
1963
|
-
icon:
|
|
1966
|
+
icon: Rr,
|
|
1964
1967
|
active: E.value === "right",
|
|
1965
1968
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1966
1969
|
}),
|
|
@@ -1968,31 +1971,31 @@ var ta = J({
|
|
|
1968
1971
|
class: "markweave-image-toolbar-divider",
|
|
1969
1972
|
"aria-hidden": "true"
|
|
1970
1973
|
}),
|
|
1971
|
-
|
|
1974
|
+
sa({
|
|
1972
1975
|
testId: "markweave-image-caption",
|
|
1973
1976
|
label: _.value.caption,
|
|
1974
|
-
icon:
|
|
1977
|
+
icon: ti,
|
|
1975
1978
|
active: f.value || !!j.value,
|
|
1976
|
-
onClick:
|
|
1979
|
+
onClick: R
|
|
1977
1980
|
}),
|
|
1978
|
-
|
|
1981
|
+
sa({
|
|
1979
1982
|
testId: "markweave-image-preview",
|
|
1980
1983
|
label: _.value.preview,
|
|
1981
|
-
icon:
|
|
1984
|
+
icon: fi,
|
|
1982
1985
|
onClick: N
|
|
1983
1986
|
}),
|
|
1984
|
-
|
|
1987
|
+
sa({
|
|
1985
1988
|
testId: "markweave-image-download",
|
|
1986
1989
|
label: _.value.download,
|
|
1987
|
-
icon:
|
|
1990
|
+
icon: di,
|
|
1988
1991
|
onClick: () => {
|
|
1989
1992
|
T.value && A(T.value);
|
|
1990
1993
|
}
|
|
1991
1994
|
}),
|
|
1992
|
-
|
|
1995
|
+
sa({
|
|
1993
1996
|
testId: "markweave-image-replace",
|
|
1994
1997
|
label: _.value.replace,
|
|
1995
|
-
icon:
|
|
1998
|
+
icon: Fi,
|
|
1996
1999
|
onClick: () => {
|
|
1997
2000
|
s.value = "", c.value = null, i.value = !0;
|
|
1998
2001
|
}
|
|
@@ -2001,10 +2004,10 @@ var ta = J({
|
|
|
2001
2004
|
class: "markweave-image-toolbar-divider",
|
|
2002
2005
|
"aria-hidden": "true"
|
|
2003
2006
|
}),
|
|
2004
|
-
|
|
2007
|
+
sa({
|
|
2005
2008
|
testId: "markweave-image-delete",
|
|
2006
2009
|
label: _.value.delete,
|
|
2007
|
-
icon:
|
|
2010
|
+
icon: Yi,
|
|
2008
2011
|
onClick: () => e.deleteNode()
|
|
2009
2012
|
})
|
|
2010
2013
|
]) : null,
|
|
@@ -2040,7 +2043,7 @@ var ta = J({
|
|
|
2040
2043
|
title: _.value.preview,
|
|
2041
2044
|
onMousedown: (e) => e.preventDefault(),
|
|
2042
2045
|
onClick: N
|
|
2043
|
-
}, [U(
|
|
2046
|
+
}, [U(fi, {
|
|
2044
2047
|
size: 16,
|
|
2045
2048
|
strokeWidth: 1.8
|
|
2046
2049
|
}), U("span", {
|
|
@@ -2054,7 +2057,7 @@ var ta = J({
|
|
|
2054
2057
|
"data-side": "left",
|
|
2055
2058
|
"aria-label": _.value.resizeLeft,
|
|
2056
2059
|
"data-markweave-image-ui": "true",
|
|
2057
|
-
onPointerdown: (e) =>
|
|
2060
|
+
onPointerdown: (e) => z("left", e)
|
|
2058
2061
|
}) : null,
|
|
2059
2062
|
h.value ? U("button", {
|
|
2060
2063
|
type: "button",
|
|
@@ -2063,7 +2066,7 @@ var ta = J({
|
|
|
2063
2066
|
"data-side": "right",
|
|
2064
2067
|
"aria-label": _.value.resizeRight,
|
|
2065
2068
|
"data-markweave-image-ui": "true",
|
|
2066
|
-
onPointerdown: (e) =>
|
|
2069
|
+
onPointerdown: (e) => z("right", e)
|
|
2067
2070
|
}) : null
|
|
2068
2071
|
]),
|
|
2069
2072
|
h.value && (f.value || j.value) ? U("input", {
|
|
@@ -2085,7 +2088,7 @@ var ta = J({
|
|
|
2085
2088
|
}, j.value) : null
|
|
2086
2089
|
]);
|
|
2087
2090
|
}
|
|
2088
|
-
}),
|
|
2091
|
+
}), da = Y({
|
|
2089
2092
|
name: "MarkweaveVueVideoNodeView",
|
|
2090
2093
|
props: {
|
|
2091
2094
|
editor: {
|
|
@@ -2118,21 +2121,25 @@ var ta = J({
|
|
|
2118
2121
|
}
|
|
2119
2122
|
},
|
|
2120
2123
|
setup(e) {
|
|
2121
|
-
let n = W(!1), r = W(""), i = W(null), a = W(!1), s =
|
|
2124
|
+
let n = W(!1), r = W(""), i = W(null), a = W(!1), s = na(e.editor), c = K(() => u(s.value)), l = K(() => e.extension.options?.messages ?? t("zh")), d = K(() => l.value.video), f = K(() => e.node.attrs), p = K(() => F(f.value.src)), m = K(() => F(f.value.embedUrl)), h = K(() => F(f.value.provider)), g = K(() => m.value ? N(m.value, h.value) : null), _ = W("pending"), v = K(() => F(f.value.mimeType)), y = K(() => F(f.value.title));
|
|
2125
|
+
q(g, () => {
|
|
2126
|
+
_.value = "pending";
|
|
2127
|
+
});
|
|
2128
|
+
let b = () => {
|
|
2122
2129
|
p.value || e.deleteNode(), r.value = "", i.value = null, n.value = !1;
|
|
2123
|
-
},
|
|
2130
|
+
}, x = async (t) => {
|
|
2124
2131
|
if (!c.value) return;
|
|
2125
2132
|
let o = e.extension.options;
|
|
2126
2133
|
a.value = !0, i.value = null;
|
|
2127
2134
|
try {
|
|
2128
|
-
let n = await
|
|
2135
|
+
let n = await B(k(t), o?.onUpload);
|
|
2129
2136
|
e.updateAttributes(T(n)), r.value = "";
|
|
2130
2137
|
} catch (e) {
|
|
2131
2138
|
i.value = e instanceof Error ? e.message : d.value.uploadFailedError;
|
|
2132
2139
|
} finally {
|
|
2133
2140
|
a.value = !1, n.value = !1;
|
|
2134
2141
|
}
|
|
2135
|
-
},
|
|
2142
|
+
}, S = () => {
|
|
2136
2143
|
if (!c.value) return;
|
|
2137
2144
|
let t = E(r.value);
|
|
2138
2145
|
if (!t) {
|
|
@@ -2140,17 +2147,17 @@ var ta = J({
|
|
|
2140
2147
|
return;
|
|
2141
2148
|
}
|
|
2142
2149
|
i.value = null, e.updateAttributes(t), r.value = "";
|
|
2143
|
-
},
|
|
2144
|
-
|
|
2150
|
+
}, C = (e) => {
|
|
2151
|
+
x({
|
|
2145
2152
|
type: "file",
|
|
2146
2153
|
file: e,
|
|
2147
2154
|
mimeType: e.type || "video/*"
|
|
2148
2155
|
});
|
|
2149
|
-
},
|
|
2156
|
+
}, w = () => {
|
|
2150
2157
|
if (!c.value) return;
|
|
2151
2158
|
let t = e.getPos();
|
|
2152
2159
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
2153
|
-
},
|
|
2160
|
+
}, D = (t) => {
|
|
2154
2161
|
c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
2155
2162
|
};
|
|
2156
2163
|
return () => c.value && !p.value ? U(o, {
|
|
@@ -2159,7 +2166,7 @@ var ta = J({
|
|
|
2159
2166
|
"data-testid": "markweave-video-node",
|
|
2160
2167
|
"data-empty": "true",
|
|
2161
2168
|
"data-selected": "false"
|
|
2162
|
-
}, () =>
|
|
2169
|
+
}, () => la({
|
|
2163
2170
|
messages: l.value,
|
|
2164
2171
|
inputValue: r.value,
|
|
2165
2172
|
error: i.value,
|
|
@@ -2168,9 +2175,9 @@ var ta = J({
|
|
|
2168
2175
|
onInputValue: (e) => {
|
|
2169
2176
|
r.value = e;
|
|
2170
2177
|
},
|
|
2171
|
-
onFile:
|
|
2172
|
-
onSubmit:
|
|
2173
|
-
onCancel:
|
|
2178
|
+
onFile: C,
|
|
2179
|
+
onSubmit: S,
|
|
2180
|
+
onCancel: b,
|
|
2174
2181
|
onDragActive: (e) => {
|
|
2175
2182
|
n.value = e;
|
|
2176
2183
|
}
|
|
@@ -2183,21 +2190,29 @@ var ta = J({
|
|
|
2183
2190
|
"data-selected": c.value && e.selected ? "true" : "false",
|
|
2184
2191
|
"aria-label": d.value.nodeAriaLabel,
|
|
2185
2192
|
tabindex: c.value ? 0 : void 0,
|
|
2186
|
-
onFocus:
|
|
2187
|
-
onKeydown:
|
|
2193
|
+
onFocus: w,
|
|
2194
|
+
onKeydown: D,
|
|
2188
2195
|
onMousedown: (e) => {
|
|
2189
|
-
c.value && !
|
|
2196
|
+
c.value && !ia(e.target) && (e.preventDefault(), w());
|
|
2190
2197
|
}
|
|
2191
2198
|
}, () => [g.value ? U("div", { class: "markweave-video-embed" }, [U("iframe", {
|
|
2199
|
+
key: g.value,
|
|
2192
2200
|
class: "markweave-video-iframe",
|
|
2193
2201
|
src: g.value,
|
|
2194
|
-
title:
|
|
2202
|
+
title: y.value ?? `${h.value ?? "Video"} embed`,
|
|
2195
2203
|
"data-markweave-video-embed": "true",
|
|
2196
2204
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
2197
2205
|
"data-markweave-video-src": p.value ?? void 0,
|
|
2206
|
+
"data-markweave-iframe-state": _.value,
|
|
2198
2207
|
allow: j,
|
|
2199
2208
|
loading: "lazy",
|
|
2200
|
-
allowfullscreen: "true"
|
|
2209
|
+
allowfullscreen: "true",
|
|
2210
|
+
onLoad: () => {
|
|
2211
|
+
_.value = "resolved";
|
|
2212
|
+
},
|
|
2213
|
+
onError: () => {
|
|
2214
|
+
_.value = "unreadable";
|
|
2215
|
+
}
|
|
2201
2216
|
}), c.value ? U("button", {
|
|
2202
2217
|
type: "button",
|
|
2203
2218
|
class: "markweave-video-selection-layer",
|
|
@@ -2207,12 +2222,12 @@ var ta = J({
|
|
|
2207
2222
|
}) : null]) : p.value ? U("div", { class: "markweave-video-box" }, [U("video", {
|
|
2208
2223
|
class: "markweave-video",
|
|
2209
2224
|
src: p.value,
|
|
2210
|
-
title:
|
|
2225
|
+
title: y.value ?? void 0,
|
|
2211
2226
|
preload: "metadata",
|
|
2212
2227
|
autoplay: !1,
|
|
2213
2228
|
controls: !0,
|
|
2214
2229
|
"data-markweave-video": "true",
|
|
2215
|
-
"data-markweave-mime-type":
|
|
2230
|
+
"data-markweave-mime-type": v.value ?? void 0
|
|
2216
2231
|
}), c.value ? U("button", {
|
|
2217
2232
|
type: "button",
|
|
2218
2233
|
class: "markweave-video-selection-layer",
|
|
@@ -2225,7 +2240,7 @@ var ta = J({
|
|
|
2225
2240
|
"aria-hidden": "true"
|
|
2226
2241
|
})]);
|
|
2227
2242
|
}
|
|
2228
|
-
}),
|
|
2243
|
+
}), fa = S.extend({
|
|
2229
2244
|
addOptions() {
|
|
2230
2245
|
return {
|
|
2231
2246
|
...this.parent?.(),
|
|
@@ -2236,7 +2251,7 @@ var ta = J({
|
|
|
2236
2251
|
},
|
|
2237
2252
|
addNodeView() {
|
|
2238
2253
|
if (typeof document > "u") return null;
|
|
2239
|
-
let e = s(
|
|
2254
|
+
let e = s(ua, { stopEvent: ({ event: e }) => ra(e.target) }), n = this.options.resolveMediaSource;
|
|
2240
2255
|
if (!n) return e;
|
|
2241
2256
|
let r = b({
|
|
2242
2257
|
messages: this.options.messages ?? t("zh"),
|
|
@@ -2245,7 +2260,7 @@ var ta = J({
|
|
|
2245
2260
|
});
|
|
2246
2261
|
return (t) => F(t.node.attrs.src) ? r(t) : e(t);
|
|
2247
2262
|
}
|
|
2248
|
-
}),
|
|
2263
|
+
}), pa = C.extend({
|
|
2249
2264
|
addOptions() {
|
|
2250
2265
|
return {
|
|
2251
2266
|
...this.parent?.(),
|
|
@@ -2255,16 +2270,16 @@ var ta = J({
|
|
|
2255
2270
|
};
|
|
2256
2271
|
},
|
|
2257
2272
|
addNodeView() {
|
|
2258
|
-
return typeof document > "u" ? null : s(
|
|
2273
|
+
return typeof document > "u" ? null : s(da, { stopEvent: ({ event: e }) => ia(e.target) });
|
|
2259
2274
|
}
|
|
2260
2275
|
});
|
|
2261
|
-
function
|
|
2276
|
+
function ma(e) {
|
|
2262
2277
|
return e instanceof Element && !!e.closest("[data-markweave-attachment-ui=\"true\"], .markweave-attachment-upload-placeholder, .markweave-attachment-uploading");
|
|
2263
2278
|
}
|
|
2264
|
-
function
|
|
2279
|
+
function ha(e, t) {
|
|
2265
2280
|
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? null : Math.max(0, Math.min(100, Math.round(e / t * 100)));
|
|
2266
2281
|
}
|
|
2267
|
-
var
|
|
2282
|
+
var ga = Y({
|
|
2268
2283
|
name: "MarkweaveVueAttachmentNodeView",
|
|
2269
2284
|
props: {
|
|
2270
2285
|
editor: {
|
|
@@ -2297,7 +2312,7 @@ var sa = J({
|
|
|
2297
2312
|
}
|
|
2298
2313
|
},
|
|
2299
2314
|
setup(e) {
|
|
2300
|
-
let n =
|
|
2315
|
+
let n = K(() => e.extension.options), r = K(() => n.value?.messages ?? t("zh")), i = na(e.editor), a = K(() => u(i.value)), s = K(() => L(e.node.attrs ?? {})), c = K(() => s.value?.name ?? F(e.node.attrs?.src) ?? r.value.attachment.missingSrc), d = K(() => [F(e.node.attrs?.mimeType), ne(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 = () => {
|
|
2301
2316
|
if (!a.value) return;
|
|
2302
2317
|
let t = e.getPos();
|
|
2303
2318
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
@@ -2307,14 +2322,14 @@ var sa = J({
|
|
|
2307
2322
|
if (!(!a.value || !t || m.value)) {
|
|
2308
2323
|
h.value = null, m.value = !0, g.value = t.name, _.value = t.size, v.value = null;
|
|
2309
2324
|
try {
|
|
2310
|
-
let r = await
|
|
2311
|
-
...
|
|
2325
|
+
let r = await B({
|
|
2326
|
+
...te({
|
|
2312
2327
|
type: "file",
|
|
2313
2328
|
file: t,
|
|
2314
2329
|
mimeType: t.type || void 0
|
|
2315
2330
|
}),
|
|
2316
2331
|
onProgress: (e) => {
|
|
2317
|
-
v.value =
|
|
2332
|
+
v.value = ha(e.loaded, e.total);
|
|
2318
2333
|
}
|
|
2319
2334
|
}, n.value?.onUpload);
|
|
2320
2335
|
e.updateAttributes(ee(r));
|
|
@@ -2330,10 +2345,10 @@ var sa = J({
|
|
|
2330
2345
|
event: t
|
|
2331
2346
|
}, n.value?.onDownload);
|
|
2332
2347
|
}, C = (e) => {
|
|
2333
|
-
|
|
2348
|
+
ma(e.target) || (e.preventDefault(), e.stopPropagation(), s.value && S(e));
|
|
2334
2349
|
};
|
|
2335
2350
|
return () => {
|
|
2336
|
-
let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [
|
|
2351
|
+
let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [ne(_.value), v.value === null ? null : `${v.value}%`].filter(Boolean).join(" · ");
|
|
2337
2352
|
return n ? U(o, {
|
|
2338
2353
|
as: "div",
|
|
2339
2354
|
class: "markweave-attachment markweave-attachment-upload-placeholder",
|
|
@@ -2366,7 +2381,7 @@ var sa = J({
|
|
|
2366
2381
|
U("span", {
|
|
2367
2382
|
class: "markweave-attachment-icon",
|
|
2368
2383
|
"aria-hidden": "true"
|
|
2369
|
-
}, [
|
|
2384
|
+
}, [oa(Qi, t.uploadLabel)]),
|
|
2370
2385
|
U("span", { class: "markweave-attachment-upload-label" }, t.uploadLabel),
|
|
2371
2386
|
h.value ? U("span", { class: "markweave-attachment-upload-error" }, h.value) : null
|
|
2372
2387
|
])]) : i ? U(o, {
|
|
@@ -2388,7 +2403,7 @@ var sa = J({
|
|
|
2388
2403
|
}, [U("span", {
|
|
2389
2404
|
class: "markweave-attachment-icon",
|
|
2390
2405
|
"aria-hidden": "true"
|
|
2391
|
-
}, [
|
|
2406
|
+
}, [oa(Qi, 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", {
|
|
2392
2407
|
class: "markweave-attachment-spinner",
|
|
2393
2408
|
"aria-hidden": "true"
|
|
2394
2409
|
}), u || t.uploading])])]) : U(o, {
|
|
@@ -2407,7 +2422,7 @@ var sa = J({
|
|
|
2407
2422
|
p.value = !1;
|
|
2408
2423
|
},
|
|
2409
2424
|
onMousedown: (e) => {
|
|
2410
|
-
!a.value ||
|
|
2425
|
+
!a.value || ma(e.target) || (e.preventDefault(), y());
|
|
2411
2426
|
},
|
|
2412
2427
|
onKeydown: (t) => {
|
|
2413
2428
|
a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
|
|
@@ -2417,7 +2432,7 @@ var sa = J({
|
|
|
2417
2432
|
U("span", {
|
|
2418
2433
|
class: "markweave-attachment-icon",
|
|
2419
2434
|
"aria-hidden": "true"
|
|
2420
|
-
}, [
|
|
2435
|
+
}, [oa(ji, t.nodeAriaLabel)]),
|
|
2421
2436
|
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]),
|
|
2422
2437
|
l ? U("span", {
|
|
2423
2438
|
class: "markweave-attachment-actions",
|
|
@@ -2430,7 +2445,7 @@ var sa = J({
|
|
|
2430
2445
|
"aria-label": t.downloadAriaLabel,
|
|
2431
2446
|
onMousedown: (e) => e.preventDefault(),
|
|
2432
2447
|
onClick: S
|
|
2433
|
-
}, [
|
|
2448
|
+
}, [oa(di, t.download), U("span", {
|
|
2434
2449
|
class: "markweave-attachment-tooltip",
|
|
2435
2450
|
role: "tooltip"
|
|
2436
2451
|
}, t.download)]), a.value ? U("button", {
|
|
@@ -2443,14 +2458,14 @@ var sa = J({
|
|
|
2443
2458
|
onClick: (t) => {
|
|
2444
2459
|
t.preventDefault(), t.stopPropagation(), e.deleteNode();
|
|
2445
2460
|
}
|
|
2446
|
-
}, [
|
|
2461
|
+
}, [oa(Yi, t.delete), U("span", {
|
|
2447
2462
|
class: "markweave-attachment-tooltip",
|
|
2448
2463
|
role: "tooltip"
|
|
2449
2464
|
}, t.delete)]) : null]) : null
|
|
2450
2465
|
]);
|
|
2451
2466
|
};
|
|
2452
2467
|
}
|
|
2453
|
-
}),
|
|
2468
|
+
}), _a = R.extend({
|
|
2454
2469
|
addOptions() {
|
|
2455
2470
|
return {
|
|
2456
2471
|
...this.parent?.(),
|
|
@@ -2461,9 +2476,9 @@ var sa = J({
|
|
|
2461
2476
|
};
|
|
2462
2477
|
},
|
|
2463
2478
|
addNodeView() {
|
|
2464
|
-
return typeof document > "u" ? null : s(
|
|
2479
|
+
return typeof document > "u" ? null : s(ga, { stopEvent: ({ event: e }) => ma(e.target) });
|
|
2465
2480
|
}
|
|
2466
|
-
}),
|
|
2481
|
+
}), va = Y({
|
|
2467
2482
|
name: "MarkweaveVueLinkCardNodeView",
|
|
2468
2483
|
props: {
|
|
2469
2484
|
editor: {
|
|
@@ -2496,11 +2511,11 @@ var sa = J({
|
|
|
2496
2511
|
}
|
|
2497
2512
|
},
|
|
2498
2513
|
setup(e) {
|
|
2499
|
-
let n = e.extension.options, r = n.messages ?? t("zh"), i =
|
|
2500
|
-
|
|
2514
|
+
let n = e.extension.options, r = n.messages ?? t("zh"), i = na(e.editor), a = W(!1), s = W(!1), c = W(!1), l = K(() => g(e.node.attrs ?? {})), d = W(l.value?.title ?? ""), f = W(l.value?.href ?? "");
|
|
2515
|
+
q(l, (e) => {
|
|
2501
2516
|
d.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
2502
2517
|
});
|
|
2503
|
-
let p =
|
|
2518
|
+
let p = K(() => u(i.value)), m = K(() => {
|
|
2504
2519
|
try {
|
|
2505
2520
|
return new URL(l.value?.href ?? "").host;
|
|
2506
2521
|
} catch {
|
|
@@ -2531,7 +2546,7 @@ var sa = J({
|
|
|
2531
2546
|
"data-testid": n,
|
|
2532
2547
|
onMousedown: y,
|
|
2533
2548
|
onClick: r
|
|
2534
|
-
}, [
|
|
2549
|
+
}, [oa(t, e), U("span", { role: "tooltip" }, e)]);
|
|
2535
2550
|
return () => {
|
|
2536
2551
|
let t = l.value;
|
|
2537
2552
|
if (!t) return null;
|
|
@@ -2567,10 +2582,10 @@ var sa = J({
|
|
|
2567
2582
|
a.value = !1;
|
|
2568
2583
|
},
|
|
2569
2584
|
onMousedown: (e) => {
|
|
2570
|
-
|
|
2585
|
+
aa(e.target) || e.preventDefault();
|
|
2571
2586
|
},
|
|
2572
2587
|
onClick: (e) => {
|
|
2573
|
-
|
|
2588
|
+
aa(e.target) || (e.preventDefault(), t.href && window.open(t.href, "_blank", "noopener,noreferrer"));
|
|
2574
2589
|
}
|
|
2575
2590
|
}, () => [
|
|
2576
2591
|
U("a", {
|
|
@@ -2590,9 +2605,9 @@ var sa = J({
|
|
|
2590
2605
|
"data-markweave-link-card-ui": "true",
|
|
2591
2606
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
2592
2607
|
}, [
|
|
2593
|
-
C(r.linkCard.convertToLink,
|
|
2594
|
-
C(r.linkCard.copyAddress,
|
|
2595
|
-
C(r.linkCard.edit,
|
|
2608
|
+
C(r.linkCard.convertToLink, wi, "markweave-link-card-convert", x),
|
|
2609
|
+
C(r.linkCard.copyAddress, di, "markweave-link-card-copy", () => b(t.href)),
|
|
2610
|
+
C(r.linkCard.edit, Mi, "markweave-link-card-edit", (i) => h({
|
|
2596
2611
|
anchor: i.currentTarget,
|
|
2597
2612
|
editor: e.editor,
|
|
2598
2613
|
messages: r,
|
|
@@ -2602,7 +2617,7 @@ var sa = J({
|
|
|
2602
2617
|
attrs: t
|
|
2603
2618
|
}
|
|
2604
2619
|
})),
|
|
2605
|
-
C(r.linkCard.delete,
|
|
2620
|
+
C(r.linkCard.delete, Yi, "markweave-link-card-delete", () => e.deleteNode())
|
|
2606
2621
|
]) : null,
|
|
2607
2622
|
p.value && s.value ? U("form", {
|
|
2608
2623
|
class: "markweave-link-card-editor",
|
|
@@ -2630,12 +2645,12 @@ var sa = J({
|
|
|
2630
2645
|
type: "submit",
|
|
2631
2646
|
disabled: !_(f.value),
|
|
2632
2647
|
"aria-label": r.linkCard.edit
|
|
2633
|
-
}, [
|
|
2648
|
+
}, [oa(wi, r.linkCard.edit)])
|
|
2634
2649
|
]) : null
|
|
2635
2650
|
]);
|
|
2636
2651
|
};
|
|
2637
2652
|
}
|
|
2638
|
-
}),
|
|
2653
|
+
}), ya = m.extend({
|
|
2639
2654
|
addOptions() {
|
|
2640
2655
|
return {
|
|
2641
2656
|
...this.parent?.(),
|
|
@@ -2644,12 +2659,12 @@ var sa = J({
|
|
|
2644
2659
|
};
|
|
2645
2660
|
},
|
|
2646
2661
|
addNodeView() {
|
|
2647
|
-
return typeof document > "u" ? null : s(
|
|
2662
|
+
return typeof document > "u" ? null : s(va, { stopEvent: ({ event: e }) => aa(e.target) });
|
|
2648
2663
|
}
|
|
2649
2664
|
});
|
|
2650
2665
|
//#endregion
|
|
2651
2666
|
//#region src/create-editor-extensions.ts
|
|
2652
|
-
function
|
|
2667
|
+
function ba(n = {}) {
|
|
2653
2668
|
return e({
|
|
2654
2669
|
lang: n.lang,
|
|
2655
2670
|
revealLinkMarkdown: n.revealLinkMarkdown,
|
|
@@ -2657,15 +2672,15 @@ function da(n = {}) {
|
|
|
2657
2672
|
tableCapabilities: n.tableCapabilities,
|
|
2658
2673
|
referenceSuggestion: n.referenceSuggestion,
|
|
2659
2674
|
internalLinkCard: n.internalLinkCard,
|
|
2660
|
-
linkCardExtension:
|
|
2675
|
+
linkCardExtension: ya.configure({
|
|
2661
2676
|
lang: n.lang,
|
|
2662
2677
|
messages: t(n.lang),
|
|
2663
2678
|
resolver: n.linkCardResolver
|
|
2664
2679
|
}),
|
|
2665
2680
|
mediaExtensions: r({
|
|
2666
|
-
image:
|
|
2667
|
-
video:
|
|
2668
|
-
attachment:
|
|
2681
|
+
image: fa,
|
|
2682
|
+
video: pa,
|
|
2683
|
+
attachment: _a,
|
|
2669
2684
|
lang: n.lang,
|
|
2670
2685
|
onImageUpload: n.onImageUpload,
|
|
2671
2686
|
onVideoUpload: n.onVideoUpload,
|
|
@@ -2678,64 +2693,64 @@ function da(n = {}) {
|
|
|
2678
2693
|
}
|
|
2679
2694
|
//#endregion
|
|
2680
2695
|
//#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
|
|
2681
|
-
var
|
|
2696
|
+
var xa = [
|
|
2682
2697
|
"top",
|
|
2683
2698
|
"right",
|
|
2684
2699
|
"bottom",
|
|
2685
2700
|
"left"
|
|
2686
|
-
],
|
|
2701
|
+
], Sa = ["start", "end"], Ca = /* @__PURE__ */ xa.reduce((e, t) => e.concat(t, t + "-" + Sa[0], t + "-" + Sa[1]), []), wa = Math.min, Z = Math.max, Ta = Math.round, Ea = (e) => ({
|
|
2687
2702
|
x: e,
|
|
2688
2703
|
y: e
|
|
2689
|
-
}),
|
|
2704
|
+
}), Da = {
|
|
2690
2705
|
left: "right",
|
|
2691
2706
|
right: "left",
|
|
2692
2707
|
bottom: "top",
|
|
2693
2708
|
top: "bottom"
|
|
2694
|
-
},
|
|
2709
|
+
}, Oa = {
|
|
2695
2710
|
start: "end",
|
|
2696
2711
|
end: "start"
|
|
2697
2712
|
};
|
|
2698
|
-
function
|
|
2699
|
-
return
|
|
2713
|
+
function ka(e, t, n) {
|
|
2714
|
+
return Z(e, wa(t, n));
|
|
2700
2715
|
}
|
|
2701
|
-
function
|
|
2716
|
+
function Aa(e, t) {
|
|
2702
2717
|
return typeof e == "function" ? e(t) : e;
|
|
2703
2718
|
}
|
|
2704
|
-
function
|
|
2719
|
+
function ja(e) {
|
|
2705
2720
|
return e.split("-")[0];
|
|
2706
2721
|
}
|
|
2707
|
-
function
|
|
2722
|
+
function Ma(e) {
|
|
2708
2723
|
return e.split("-")[1];
|
|
2709
2724
|
}
|
|
2710
|
-
function
|
|
2725
|
+
function Na(e) {
|
|
2711
2726
|
return e === "x" ? "y" : "x";
|
|
2712
2727
|
}
|
|
2713
|
-
function
|
|
2728
|
+
function Pa(e) {
|
|
2714
2729
|
return e === "y" ? "height" : "width";
|
|
2715
2730
|
}
|
|
2716
|
-
function
|
|
2717
|
-
return ["top", "bottom"].includes(
|
|
2731
|
+
function Fa(e) {
|
|
2732
|
+
return ["top", "bottom"].includes(ja(e)) ? "y" : "x";
|
|
2718
2733
|
}
|
|
2719
|
-
function
|
|
2720
|
-
return
|
|
2734
|
+
function Ia(e) {
|
|
2735
|
+
return Na(Fa(e));
|
|
2721
2736
|
}
|
|
2722
|
-
function
|
|
2737
|
+
function La(e, t, n) {
|
|
2723
2738
|
n === void 0 && (n = !1);
|
|
2724
|
-
let r =
|
|
2725
|
-
return t.reference[a] > t.floating[a] && (o =
|
|
2739
|
+
let r = Ma(e), i = Ia(e), a = Pa(i), o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
2740
|
+
return t.reference[a] > t.floating[a] && (o = Ha(o)), [o, Ha(o)];
|
|
2726
2741
|
}
|
|
2727
|
-
function
|
|
2728
|
-
let t =
|
|
2742
|
+
function Ra(e) {
|
|
2743
|
+
let t = Ha(e);
|
|
2729
2744
|
return [
|
|
2730
|
-
|
|
2745
|
+
za(e),
|
|
2731
2746
|
t,
|
|
2732
|
-
|
|
2747
|
+
za(t)
|
|
2733
2748
|
];
|
|
2734
2749
|
}
|
|
2735
|
-
function
|
|
2736
|
-
return e.replace(/start|end/g, (e) =>
|
|
2750
|
+
function za(e) {
|
|
2751
|
+
return e.replace(/start|end/g, (e) => Oa[e]);
|
|
2737
2752
|
}
|
|
2738
|
-
function
|
|
2753
|
+
function Ba(e, t, n) {
|
|
2739
2754
|
let r = ["left", "right"], i = ["right", "left"], a = ["top", "bottom"], o = ["bottom", "top"];
|
|
2740
2755
|
switch (e) {
|
|
2741
2756
|
case "top":
|
|
@@ -2745,14 +2760,14 @@ function ja(e, t, n) {
|
|
|
2745
2760
|
default: return [];
|
|
2746
2761
|
}
|
|
2747
2762
|
}
|
|
2748
|
-
function
|
|
2749
|
-
let i =
|
|
2750
|
-
return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(
|
|
2763
|
+
function Va(e, t, n, r) {
|
|
2764
|
+
let i = Ma(e), a = Ba(ja(e), n === "start", r);
|
|
2765
|
+
return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(za)))), a;
|
|
2751
2766
|
}
|
|
2752
|
-
function
|
|
2753
|
-
return e.replace(/left|right|bottom|top/g, (e) =>
|
|
2767
|
+
function Ha(e) {
|
|
2768
|
+
return e.replace(/left|right|bottom|top/g, (e) => Da[e]);
|
|
2754
2769
|
}
|
|
2755
|
-
function
|
|
2770
|
+
function Ua(e) {
|
|
2756
2771
|
return {
|
|
2757
2772
|
top: 0,
|
|
2758
2773
|
right: 0,
|
|
@@ -2761,15 +2776,15 @@ function Pa(e) {
|
|
|
2761
2776
|
...e
|
|
2762
2777
|
};
|
|
2763
2778
|
}
|
|
2764
|
-
function
|
|
2779
|
+
function Wa(e) {
|
|
2765
2780
|
return typeof e == "number" ? {
|
|
2766
2781
|
top: e,
|
|
2767
2782
|
right: e,
|
|
2768
2783
|
bottom: e,
|
|
2769
2784
|
left: e
|
|
2770
|
-
} :
|
|
2785
|
+
} : Ua(e);
|
|
2771
2786
|
}
|
|
2772
|
-
function
|
|
2787
|
+
function Ga(e) {
|
|
2773
2788
|
let { x: t, y: n, width: r, height: i } = e;
|
|
2774
2789
|
return {
|
|
2775
2790
|
width: r,
|
|
@@ -2782,8 +2797,8 @@ function Ia(e) {
|
|
|
2782
2797
|
y: n
|
|
2783
2798
|
};
|
|
2784
2799
|
}
|
|
2785
|
-
function
|
|
2786
|
-
let { reference: r, floating: i } = e, a =
|
|
2800
|
+
function Ka(e, t, n) {
|
|
2801
|
+
let { reference: r, floating: i } = e, a = Fa(t), o = Ia(t), s = Pa(o), c = ja(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;
|
|
2787
2802
|
switch (c) {
|
|
2788
2803
|
case "top":
|
|
2789
2804
|
p = {
|
|
@@ -2814,7 +2829,7 @@ function La(e, t, n) {
|
|
|
2814
2829
|
y: r.y
|
|
2815
2830
|
};
|
|
2816
2831
|
}
|
|
2817
|
-
switch (
|
|
2832
|
+
switch (Ma(t)) {
|
|
2818
2833
|
case "start":
|
|
2819
2834
|
p[o] -= f * (n && l ? -1 : 1);
|
|
2820
2835
|
break;
|
|
@@ -2824,12 +2839,12 @@ function La(e, t, n) {
|
|
|
2824
2839
|
}
|
|
2825
2840
|
return p;
|
|
2826
2841
|
}
|
|
2827
|
-
var
|
|
2842
|
+
var qa = async (e, t, n) => {
|
|
2828
2843
|
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({
|
|
2829
2844
|
reference: e,
|
|
2830
2845
|
floating: t,
|
|
2831
2846
|
strategy: i
|
|
2832
|
-
}), { x: u, y: d } =
|
|
2847
|
+
}), { x: u, y: d } = Ka(l, r, c), f = r, p = {}, m = 0;
|
|
2833
2848
|
for (let n = 0; n < s.length; n++) {
|
|
2834
2849
|
let { name: a, fn: h } = s[n], { x: g, y: _, data: v, reset: y } = await h({
|
|
2835
2850
|
x: u,
|
|
@@ -2855,7 +2870,7 @@ var Ra = async (e, t, n) => {
|
|
|
2855
2870
|
reference: e,
|
|
2856
2871
|
floating: t,
|
|
2857
2872
|
strategy: i
|
|
2858
|
-
}) : y.rects), {x: u, y: d} =
|
|
2873
|
+
}) : y.rects), {x: u, y: d} = Ka(l, f, c)), n = -1);
|
|
2859
2874
|
}
|
|
2860
2875
|
return {
|
|
2861
2876
|
x: u,
|
|
@@ -2865,9 +2880,9 @@ var Ra = async (e, t, n) => {
|
|
|
2865
2880
|
middlewareData: p
|
|
2866
2881
|
};
|
|
2867
2882
|
};
|
|
2868
|
-
async function
|
|
2883
|
+
async function Ja(e, t) {
|
|
2869
2884
|
t === void 0 && (t = {});
|
|
2870
|
-
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 } =
|
|
2885
|
+
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 } = Aa(t, e), p = Wa(f), m = o[d ? u === "floating" ? "reference" : "floating" : u], h = Ga(await i.getClippingRect({
|
|
2871
2886
|
element: await (i.isElement == null ? void 0 : i.isElement(m)) ?? !0 ? m : m.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(o.floating)),
|
|
2872
2887
|
boundary: c,
|
|
2873
2888
|
rootBoundary: l,
|
|
@@ -2880,7 +2895,7 @@ async function za(e, t) {
|
|
|
2880
2895
|
} : 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(_)) || {
|
|
2881
2896
|
x: 1,
|
|
2882
2897
|
y: 1
|
|
2883
|
-
}, y =
|
|
2898
|
+
}, y = Ga(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2884
2899
|
elements: o,
|
|
2885
2900
|
rect: g,
|
|
2886
2901
|
offsetParent: _,
|
|
@@ -2893,18 +2908,18 @@ async function za(e, t) {
|
|
|
2893
2908
|
right: (y.right - h.right + p.right) / v.x
|
|
2894
2909
|
};
|
|
2895
2910
|
}
|
|
2896
|
-
var
|
|
2911
|
+
var Ya = (e) => ({
|
|
2897
2912
|
name: "arrow",
|
|
2898
2913
|
options: e,
|
|
2899
2914
|
async fn(t) {
|
|
2900
|
-
let { x: n, y: r, placement: i, rects: a, platform: o, elements: s, middlewareData: c } = t, { element: l, padding: u = 0 } =
|
|
2915
|
+
let { x: n, y: r, placement: i, rects: a, platform: o, elements: s, middlewareData: c } = t, { element: l, padding: u = 0 } = Aa(e, t) || {};
|
|
2901
2916
|
if (l == null) return {};
|
|
2902
|
-
let d =
|
|
2917
|
+
let d = Wa(u), f = {
|
|
2903
2918
|
x: n,
|
|
2904
2919
|
y: r
|
|
2905
|
-
}, p =
|
|
2920
|
+
}, p = Ia(i), m = Pa(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;
|
|
2906
2921
|
(!C || !await (o.isElement == null ? void 0 : o.isElement(S))) && (C = s.floating[y] || a.floating[m]);
|
|
2907
|
-
let w = b / 2 - x / 2, T = C / 2 - h[m] / 2 - 1, E =
|
|
2922
|
+
let w = b / 2 - x / 2, T = C / 2 - h[m] / 2 - 1, E = wa(d[_], T), D = wa(d[v], T), O = E, k = C - h[m] - D, A = C / 2 - h[m] / 2 + w, j = ka(O, A, k), M = !c.arrow && Ma(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;
|
|
2908
2923
|
return {
|
|
2909
2924
|
[p]: f[p] + N,
|
|
2910
2925
|
data: {
|
|
@@ -2916,20 +2931,20 @@ var Ba = (e) => ({
|
|
|
2916
2931
|
};
|
|
2917
2932
|
}
|
|
2918
2933
|
});
|
|
2919
|
-
function
|
|
2920
|
-
return (e ? [...n.filter((t) =>
|
|
2934
|
+
function Xa(e, t, n) {
|
|
2935
|
+
return (e ? [...n.filter((t) => Ma(t) === e), ...n.filter((t) => Ma(t) !== e)] : n.filter((e) => ja(e) === e)).filter((n) => e ? Ma(n) === e || (t ? za(n) !== n : !1) : !0);
|
|
2921
2936
|
}
|
|
2922
|
-
var
|
|
2937
|
+
var Za = function(e) {
|
|
2923
2938
|
return e === void 0 && (e = {}), {
|
|
2924
2939
|
name: "autoPlacement",
|
|
2925
2940
|
options: e,
|
|
2926
2941
|
async fn(t) {
|
|
2927
|
-
let { rects: n, middlewareData: r, placement: i, platform: a, elements: o } = t, { crossAxis: s = !1, alignment: c, allowedPlacements: l =
|
|
2942
|
+
let { rects: n, middlewareData: r, placement: i, platform: a, elements: o } = t, { crossAxis: s = !1, alignment: c, allowedPlacements: l = Ca, autoAlignment: u = !0, ...d } = Aa(e, t), f = c !== void 0 || l === Ca ? Xa(c || null, u, l) : l, p = await Ja(t, d), m = r.autoPlacement?.index || 0, h = f[m];
|
|
2928
2943
|
if (h == null) return {};
|
|
2929
|
-
let g =
|
|
2944
|
+
let g = La(h, n, await (a.isRTL == null ? void 0 : a.isRTL(o.floating)));
|
|
2930
2945
|
if (i !== h) return { reset: { placement: f[0] } };
|
|
2931
2946
|
let _ = [
|
|
2932
|
-
p[
|
|
2947
|
+
p[ja(h)],
|
|
2933
2948
|
p[g[0]],
|
|
2934
2949
|
p[g[1]]
|
|
2935
2950
|
], v = [...r.autoPlacement?.overflows || [], {
|
|
@@ -2944,13 +2959,13 @@ var Ha = function(e) {
|
|
|
2944
2959
|
reset: { placement: y }
|
|
2945
2960
|
};
|
|
2946
2961
|
let b = v.map((e) => {
|
|
2947
|
-
let t =
|
|
2962
|
+
let t = Ma(e.placement);
|
|
2948
2963
|
return [
|
|
2949
2964
|
e.placement,
|
|
2950
2965
|
t && s ? e.overflows.slice(0, 2).reduce((e, t) => e + t, 0) : e.overflows[0],
|
|
2951
2966
|
e.overflows
|
|
2952
2967
|
];
|
|
2953
|
-
}).sort((e, t) => e[1] - t[1]), x = b.filter((e) => e[2].slice(0,
|
|
2968
|
+
}).sort((e, t) => e[1] - t[1]), x = b.filter((e) => e[2].slice(0, Ma(e[0]) ? 2 : 3).every((e) => e <= 0))[0]?.[0] || b[0][0];
|
|
2954
2969
|
return x === i ? {} : {
|
|
2955
2970
|
data: {
|
|
2956
2971
|
index: m + 1,
|
|
@@ -2960,19 +2975,19 @@ var Ha = function(e) {
|
|
|
2960
2975
|
};
|
|
2961
2976
|
}
|
|
2962
2977
|
};
|
|
2963
|
-
},
|
|
2978
|
+
}, Qa = function(e) {
|
|
2964
2979
|
return e === void 0 && (e = {}), {
|
|
2965
2980
|
name: "flip",
|
|
2966
2981
|
options: e,
|
|
2967
2982
|
async fn(t) {
|
|
2968
2983
|
var n;
|
|
2969
|
-
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 } =
|
|
2984
|
+
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 } = Aa(e, t);
|
|
2970
2985
|
if ((n = i.arrow) != null && n.alignmentOffset) return {};
|
|
2971
|
-
let g =
|
|
2972
|
-
!d && x && b.push(...
|
|
2973
|
-
let S = [o, ...b], C = await
|
|
2986
|
+
let g = ja(r), _ = Fa(o), v = ja(o) === o, y = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), b = d || (v || !m ? [Ha(o)] : Ra(o)), x = p !== "none";
|
|
2987
|
+
!d && x && b.push(...Va(o, m, p, y));
|
|
2988
|
+
let S = [o, ...b], C = await Ja(t, h), w = [], T = i.flip?.overflows || [];
|
|
2974
2989
|
if (l && w.push(C[g]), u) {
|
|
2975
|
-
let e =
|
|
2990
|
+
let e = La(r, a, y);
|
|
2976
2991
|
w.push(C[e[0]], C[e[1]]);
|
|
2977
2992
|
}
|
|
2978
2993
|
if (T = [...T, {
|
|
@@ -2992,7 +3007,7 @@ var Ha = function(e) {
|
|
|
2992
3007
|
case "bestFit": {
|
|
2993
3008
|
let e = T.filter((e) => {
|
|
2994
3009
|
if (x) {
|
|
2995
|
-
let t =
|
|
3010
|
+
let t = Fa(e.placement);
|
|
2996
3011
|
return t === _ || t === "y";
|
|
2997
3012
|
}
|
|
2998
3013
|
return !0;
|
|
@@ -3010,7 +3025,7 @@ var Ha = function(e) {
|
|
|
3010
3025
|
}
|
|
3011
3026
|
};
|
|
3012
3027
|
};
|
|
3013
|
-
function
|
|
3028
|
+
function $a(e, t) {
|
|
3014
3029
|
return {
|
|
3015
3030
|
top: e.top - t.height,
|
|
3016
3031
|
right: e.right - t.width,
|
|
@@ -3018,34 +3033,34 @@ function Wa(e, t) {
|
|
|
3018
3033
|
left: e.left - t.width
|
|
3019
3034
|
};
|
|
3020
3035
|
}
|
|
3021
|
-
function
|
|
3022
|
-
return
|
|
3036
|
+
function eo(e) {
|
|
3037
|
+
return xa.some((t) => e[t] >= 0);
|
|
3023
3038
|
}
|
|
3024
|
-
var
|
|
3039
|
+
var to = function(e) {
|
|
3025
3040
|
return e === void 0 && (e = {}), {
|
|
3026
3041
|
name: "hide",
|
|
3027
3042
|
options: e,
|
|
3028
3043
|
async fn(t) {
|
|
3029
|
-
let { rects: n } = t, { strategy: r = "referenceHidden", ...i } =
|
|
3044
|
+
let { rects: n } = t, { strategy: r = "referenceHidden", ...i } = Aa(e, t);
|
|
3030
3045
|
switch (r) {
|
|
3031
3046
|
case "referenceHidden": {
|
|
3032
|
-
let e =
|
|
3047
|
+
let e = $a(await Ja(t, {
|
|
3033
3048
|
...i,
|
|
3034
3049
|
elementContext: "reference"
|
|
3035
3050
|
}), n.reference);
|
|
3036
3051
|
return { data: {
|
|
3037
3052
|
referenceHiddenOffsets: e,
|
|
3038
|
-
referenceHidden:
|
|
3053
|
+
referenceHidden: eo(e)
|
|
3039
3054
|
} };
|
|
3040
3055
|
}
|
|
3041
3056
|
case "escaped": {
|
|
3042
|
-
let e =
|
|
3057
|
+
let e = $a(await Ja(t, {
|
|
3043
3058
|
...i,
|
|
3044
3059
|
altBoundary: !0
|
|
3045
3060
|
}), n.floating);
|
|
3046
3061
|
return { data: {
|
|
3047
3062
|
escapedOffsets: e,
|
|
3048
|
-
escaped:
|
|
3063
|
+
escaped: eo(e)
|
|
3049
3064
|
} };
|
|
3050
3065
|
}
|
|
3051
3066
|
default: return {};
|
|
@@ -3053,8 +3068,8 @@ var Ka = function(e) {
|
|
|
3053
3068
|
}
|
|
3054
3069
|
};
|
|
3055
3070
|
};
|
|
3056
|
-
function
|
|
3057
|
-
let t =
|
|
3071
|
+
function no(e) {
|
|
3072
|
+
let t = wa(...e.map((e) => e.left)), n = wa(...e.map((e) => e.top)), r = Z(...e.map((e) => e.right)), i = Z(...e.map((e) => e.bottom));
|
|
3058
3073
|
return {
|
|
3059
3074
|
x: t,
|
|
3060
3075
|
y: n,
|
|
@@ -3062,25 +3077,25 @@ function qa(e) {
|
|
|
3062
3077
|
height: i - n
|
|
3063
3078
|
};
|
|
3064
3079
|
}
|
|
3065
|
-
function
|
|
3080
|
+
function ro(e) {
|
|
3066
3081
|
let t = e.slice().sort((e, t) => e.y - t.y), n = [], r = null;
|
|
3067
3082
|
for (let e = 0; e < t.length; e++) {
|
|
3068
3083
|
let i = t[e];
|
|
3069
3084
|
!r || i.y - r.y > r.height / 2 ? n.push([i]) : n[n.length - 1].push(i), r = i;
|
|
3070
3085
|
}
|
|
3071
|
-
return n.map((e) =>
|
|
3086
|
+
return n.map((e) => Ga(no(e)));
|
|
3072
3087
|
}
|
|
3073
|
-
var
|
|
3088
|
+
var io = function(e) {
|
|
3074
3089
|
return e === void 0 && (e = {}), {
|
|
3075
3090
|
name: "inline",
|
|
3076
3091
|
options: e,
|
|
3077
3092
|
async fn(t) {
|
|
3078
|
-
let { placement: n, elements: r, rects: i, platform: a, strategy: o } = t, { padding: s = 2, x: c, y: l } =
|
|
3093
|
+
let { placement: n, elements: r, rects: i, platform: a, strategy: o } = t, { padding: s = 2, x: c, y: l } = Aa(e, t), u = Array.from(await (a.getClientRects == null ? void 0 : a.getClientRects(r.reference)) || []), d = ro(u), f = Ga(no(u)), p = Wa(s);
|
|
3079
3094
|
function m() {
|
|
3080
3095
|
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;
|
|
3081
3096
|
if (d.length >= 2) {
|
|
3082
|
-
if (
|
|
3083
|
-
let e = d[0], t = d[d.length - 1], r =
|
|
3097
|
+
if (Fa(n) === "y") {
|
|
3098
|
+
let e = d[0], t = d[d.length - 1], r = ja(n) === "top", i = e.top, a = t.bottom, o = r ? e.left : t.left, s = r ? e.right : t.right;
|
|
3084
3099
|
return {
|
|
3085
3100
|
top: i,
|
|
3086
3101
|
bottom: a,
|
|
@@ -3092,7 +3107,7 @@ var Ya = function(e) {
|
|
|
3092
3107
|
y: i
|
|
3093
3108
|
};
|
|
3094
3109
|
}
|
|
3095
|
-
let e =
|
|
3110
|
+
let e = ja(n) === "left", t = Z(...d.map((e) => e.right)), r = wa(...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;
|
|
3096
3111
|
return {
|
|
3097
3112
|
top: a,
|
|
3098
3113
|
bottom: o,
|
|
@@ -3115,8 +3130,8 @@ var Ya = function(e) {
|
|
|
3115
3130
|
}
|
|
3116
3131
|
};
|
|
3117
3132
|
};
|
|
3118
|
-
async function
|
|
3119
|
-
let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o =
|
|
3133
|
+
async function ao(e, t) {
|
|
3134
|
+
let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = ja(n), s = Ma(n), c = Fa(n) === "y", l = ["left", "top"].includes(o) ? -1 : 1, u = a && c ? -1 : 1, d = Aa(t, e), { mainAxis: f, crossAxis: p, alignmentAxis: m } = typeof d == "number" ? {
|
|
3120
3135
|
mainAxis: d,
|
|
3121
3136
|
crossAxis: 0,
|
|
3122
3137
|
alignmentAxis: null
|
|
@@ -3133,13 +3148,13 @@ async function Xa(e, t) {
|
|
|
3133
3148
|
y: p * u
|
|
3134
3149
|
};
|
|
3135
3150
|
}
|
|
3136
|
-
var
|
|
3151
|
+
var oo = function(e) {
|
|
3137
3152
|
return e === void 0 && (e = 0), {
|
|
3138
3153
|
name: "offset",
|
|
3139
3154
|
options: e,
|
|
3140
3155
|
async fn(t) {
|
|
3141
3156
|
var n;
|
|
3142
|
-
let { x: r, y: i, placement: a, middlewareData: o } = t, s = await
|
|
3157
|
+
let { x: r, y: i, placement: a, middlewareData: o } = t, s = await ao(t, e);
|
|
3143
3158
|
return a === o.offset?.placement && (n = o.arrow) != null && n.alignmentOffset ? {} : {
|
|
3144
3159
|
x: r + s.x,
|
|
3145
3160
|
y: i + s.y,
|
|
@@ -3150,7 +3165,7 @@ var Za = function(e) {
|
|
|
3150
3165
|
};
|
|
3151
3166
|
}
|
|
3152
3167
|
};
|
|
3153
|
-
},
|
|
3168
|
+
}, so = function(e) {
|
|
3154
3169
|
return e === void 0 && (e = {}), {
|
|
3155
3170
|
name: "shift",
|
|
3156
3171
|
options: e,
|
|
@@ -3161,17 +3176,17 @@ var Za = function(e) {
|
|
|
3161
3176
|
x: t,
|
|
3162
3177
|
y: n
|
|
3163
3178
|
};
|
|
3164
|
-
} }, ...c } =
|
|
3179
|
+
} }, ...c } = Aa(e, t), l = {
|
|
3165
3180
|
x: n,
|
|
3166
3181
|
y: r
|
|
3167
|
-
}, u = await
|
|
3182
|
+
}, u = await Ja(t, c), d = Fa(ja(i)), f = Na(d), p = l[f], m = l[d];
|
|
3168
3183
|
if (a) {
|
|
3169
3184
|
let e = f === "y" ? "top" : "left", t = f === "y" ? "bottom" : "right", n = p + u[e], r = p - u[t];
|
|
3170
|
-
p =
|
|
3185
|
+
p = ka(n, p, r);
|
|
3171
3186
|
}
|
|
3172
3187
|
if (o) {
|
|
3173
3188
|
let e = d === "y" ? "top" : "left", t = d === "y" ? "bottom" : "right", n = m + u[e], r = m - u[t];
|
|
3174
|
-
m =
|
|
3189
|
+
m = ka(n, m, r);
|
|
3175
3190
|
}
|
|
3176
3191
|
let h = s.fn({
|
|
3177
3192
|
...t,
|
|
@@ -3191,18 +3206,18 @@ var Za = function(e) {
|
|
|
3191
3206
|
};
|
|
3192
3207
|
}
|
|
3193
3208
|
};
|
|
3194
|
-
},
|
|
3209
|
+
}, co = function(e) {
|
|
3195
3210
|
return e === void 0 && (e = {}), {
|
|
3196
3211
|
name: "size",
|
|
3197
3212
|
options: e,
|
|
3198
3213
|
async fn(t) {
|
|
3199
3214
|
var n, r;
|
|
3200
|
-
let { placement: i, rects: a, platform: o, elements: s } = t, { apply: c = () => {}, ...l } =
|
|
3215
|
+
let { placement: i, rects: a, platform: o, elements: s } = t, { apply: c = () => {}, ...l } = Aa(e, t), u = await Ja(t, l), d = ja(i), f = Ma(i), p = Fa(i) === "y", { width: m, height: h } = a.floating, g, _;
|
|
3201
3216
|
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");
|
|
3202
|
-
let v = h - u.top - u.bottom, y = m - u.left - u.right, b =
|
|
3217
|
+
let v = h - u.top - u.bottom, y = m - u.left - u.right, b = wa(h - u[g], v), x = wa(m - u[_], y), S = !t.middlewareData.shift, C = b, w = x;
|
|
3203
3218
|
if ((n = t.middlewareData.shift) != null && n.enabled.x && (w = y), (r = t.middlewareData.shift) != null && r.enabled.y && (C = v), S && !f) {
|
|
3204
|
-
let e =
|
|
3205
|
-
p ? w = m - 2 * (e !== 0 || t !== 0 ? e + t :
|
|
3219
|
+
let e = Z(u.left, 0), t = Z(u.right, 0), n = Z(u.top, 0), r = Z(u.bottom, 0);
|
|
3220
|
+
p ? w = m - 2 * (e !== 0 || t !== 0 ? e + t : Z(u.left, u.right)) : C = h - 2 * (n !== 0 || r !== 0 ? n + r : Z(u.top, u.bottom));
|
|
3206
3221
|
}
|
|
3207
3222
|
await c({
|
|
3208
3223
|
...t,
|
|
@@ -3214,43 +3229,43 @@ var Za = function(e) {
|
|
|
3214
3229
|
}
|
|
3215
3230
|
};
|
|
3216
3231
|
};
|
|
3217
|
-
function
|
|
3232
|
+
function lo() {
|
|
3218
3233
|
return typeof window < "u";
|
|
3219
3234
|
}
|
|
3220
|
-
function
|
|
3221
|
-
return
|
|
3235
|
+
function uo(e) {
|
|
3236
|
+
return mo(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
3222
3237
|
}
|
|
3223
|
-
function
|
|
3238
|
+
function fo(e) {
|
|
3224
3239
|
var t;
|
|
3225
3240
|
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
3226
3241
|
}
|
|
3227
|
-
function
|
|
3228
|
-
return ((
|
|
3242
|
+
function po(e) {
|
|
3243
|
+
return ((mo(e) ? e.ownerDocument : e.document) || window.document)?.documentElement;
|
|
3229
3244
|
}
|
|
3230
|
-
function
|
|
3231
|
-
return
|
|
3245
|
+
function mo(e) {
|
|
3246
|
+
return lo() ? e instanceof Node || e instanceof fo(e).Node : !1;
|
|
3232
3247
|
}
|
|
3233
|
-
function
|
|
3234
|
-
return
|
|
3248
|
+
function ho(e) {
|
|
3249
|
+
return lo() ? e instanceof Element || e instanceof fo(e).Element : !1;
|
|
3235
3250
|
}
|
|
3236
|
-
function
|
|
3237
|
-
return
|
|
3251
|
+
function go(e) {
|
|
3252
|
+
return lo() ? e instanceof HTMLElement || e instanceof fo(e).HTMLElement : !1;
|
|
3238
3253
|
}
|
|
3239
|
-
function
|
|
3240
|
-
return !
|
|
3254
|
+
function _o(e) {
|
|
3255
|
+
return !lo() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof fo(e).ShadowRoot;
|
|
3241
3256
|
}
|
|
3242
|
-
function
|
|
3243
|
-
let { overflow: t, overflowX: n, overflowY: r, display: i } =
|
|
3257
|
+
function vo(e) {
|
|
3258
|
+
let { overflow: t, overflowX: n, overflowY: r, display: i } = To(e);
|
|
3244
3259
|
return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(i);
|
|
3245
3260
|
}
|
|
3246
|
-
function
|
|
3261
|
+
function yo(e) {
|
|
3247
3262
|
return [
|
|
3248
3263
|
"table",
|
|
3249
3264
|
"td",
|
|
3250
3265
|
"th"
|
|
3251
|
-
].includes(
|
|
3266
|
+
].includes(uo(e));
|
|
3252
3267
|
}
|
|
3253
|
-
function
|
|
3268
|
+
function bo(e) {
|
|
3254
3269
|
return [":popover-open", ":modal"].some((t) => {
|
|
3255
3270
|
try {
|
|
3256
3271
|
return e.matches(t);
|
|
@@ -3259,8 +3274,8 @@ function lo(e) {
|
|
|
3259
3274
|
}
|
|
3260
3275
|
});
|
|
3261
3276
|
}
|
|
3262
|
-
function
|
|
3263
|
-
let t =
|
|
3277
|
+
function xo(e) {
|
|
3278
|
+
let t = Co(), n = ho(e) ? To(e) : e;
|
|
3264
3279
|
return [
|
|
3265
3280
|
"transform",
|
|
3266
3281
|
"translate",
|
|
@@ -3281,30 +3296,30 @@ function uo(e) {
|
|
|
3281
3296
|
"content"
|
|
3282
3297
|
].some((e) => (n.contain || "").includes(e));
|
|
3283
3298
|
}
|
|
3284
|
-
function
|
|
3285
|
-
let t =
|
|
3286
|
-
for (;
|
|
3287
|
-
if (
|
|
3288
|
-
if (
|
|
3289
|
-
t =
|
|
3299
|
+
function So(e) {
|
|
3300
|
+
let t = Do(e);
|
|
3301
|
+
for (; go(t) && !wo(t);) {
|
|
3302
|
+
if (xo(t)) return t;
|
|
3303
|
+
if (bo(t)) return null;
|
|
3304
|
+
t = Do(t);
|
|
3290
3305
|
}
|
|
3291
3306
|
return null;
|
|
3292
3307
|
}
|
|
3293
|
-
function
|
|
3308
|
+
function Co() {
|
|
3294
3309
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
3295
3310
|
}
|
|
3296
|
-
function
|
|
3311
|
+
function wo(e) {
|
|
3297
3312
|
return [
|
|
3298
3313
|
"html",
|
|
3299
3314
|
"body",
|
|
3300
3315
|
"#document"
|
|
3301
|
-
].includes(
|
|
3316
|
+
].includes(uo(e));
|
|
3302
3317
|
}
|
|
3303
|
-
function
|
|
3304
|
-
return
|
|
3318
|
+
function To(e) {
|
|
3319
|
+
return fo(e).getComputedStyle(e);
|
|
3305
3320
|
}
|
|
3306
|
-
function
|
|
3307
|
-
return
|
|
3321
|
+
function Eo(e) {
|
|
3322
|
+
return ho(e) ? {
|
|
3308
3323
|
scrollLeft: e.scrollLeft,
|
|
3309
3324
|
scrollTop: e.scrollTop
|
|
3310
3325
|
} : {
|
|
@@ -3312,101 +3327,101 @@ function go(e) {
|
|
|
3312
3327
|
scrollTop: e.scrollY
|
|
3313
3328
|
};
|
|
3314
3329
|
}
|
|
3315
|
-
function
|
|
3316
|
-
if (
|
|
3317
|
-
let t = e.assignedSlot || e.parentNode ||
|
|
3318
|
-
return
|
|
3330
|
+
function Do(e) {
|
|
3331
|
+
if (uo(e) === "html") return e;
|
|
3332
|
+
let t = e.assignedSlot || e.parentNode || _o(e) && e.host || po(e);
|
|
3333
|
+
return _o(t) ? t.host : t;
|
|
3319
3334
|
}
|
|
3320
|
-
function
|
|
3321
|
-
let t =
|
|
3322
|
-
return
|
|
3335
|
+
function Oo(e) {
|
|
3336
|
+
let t = Do(e);
|
|
3337
|
+
return wo(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : go(t) && vo(t) ? t : Oo(t);
|
|
3323
3338
|
}
|
|
3324
|
-
function
|
|
3339
|
+
function ko(e, t, n) {
|
|
3325
3340
|
t === void 0 && (t = []), n === void 0 && (n = !0);
|
|
3326
|
-
let r =
|
|
3341
|
+
let r = Oo(e), i = r === e.ownerDocument?.body, a = fo(r);
|
|
3327
3342
|
if (i) {
|
|
3328
|
-
let e =
|
|
3329
|
-
return t.concat(a, a.visualViewport || [],
|
|
3343
|
+
let e = Ao(a);
|
|
3344
|
+
return t.concat(a, a.visualViewport || [], vo(r) ? r : [], e && n ? ko(e) : []);
|
|
3330
3345
|
}
|
|
3331
|
-
return t.concat(r,
|
|
3346
|
+
return t.concat(r, ko(r, [], n));
|
|
3332
3347
|
}
|
|
3333
|
-
function
|
|
3348
|
+
function Ao(e) {
|
|
3334
3349
|
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
3335
3350
|
}
|
|
3336
|
-
function
|
|
3337
|
-
let t =
|
|
3351
|
+
function jo(e) {
|
|
3352
|
+
let t = To(e), n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0, i = go(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = Ta(n) !== a || Ta(r) !== o;
|
|
3338
3353
|
return s && (n = a, r = o), {
|
|
3339
3354
|
width: n,
|
|
3340
3355
|
height: r,
|
|
3341
3356
|
$: s
|
|
3342
3357
|
};
|
|
3343
3358
|
}
|
|
3344
|
-
function
|
|
3345
|
-
return
|
|
3359
|
+
function Mo(e) {
|
|
3360
|
+
return ho(e) ? e : e.contextElement;
|
|
3346
3361
|
}
|
|
3347
|
-
function
|
|
3348
|
-
let t =
|
|
3349
|
-
if (!
|
|
3350
|
-
let n = t.getBoundingClientRect(), { width: r, height: i, $: a } =
|
|
3362
|
+
function No(e) {
|
|
3363
|
+
let t = Mo(e);
|
|
3364
|
+
if (!go(t)) return Ea(1);
|
|
3365
|
+
let n = t.getBoundingClientRect(), { width: r, height: i, $: a } = jo(t), o = (a ? Ta(n.width) : n.width) / r, s = (a ? Ta(n.height) : n.height) / i;
|
|
3351
3366
|
return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
|
|
3352
3367
|
x: o,
|
|
3353
3368
|
y: s
|
|
3354
3369
|
};
|
|
3355
3370
|
}
|
|
3356
|
-
var
|
|
3357
|
-
function
|
|
3358
|
-
let t =
|
|
3359
|
-
return !
|
|
3371
|
+
var Po = /* @__PURE__ */ Ea(0);
|
|
3372
|
+
function Fo(e) {
|
|
3373
|
+
let t = fo(e);
|
|
3374
|
+
return !Co() || !t.visualViewport ? Po : {
|
|
3360
3375
|
x: t.visualViewport.offsetLeft,
|
|
3361
3376
|
y: t.visualViewport.offsetTop
|
|
3362
3377
|
};
|
|
3363
3378
|
}
|
|
3364
|
-
function
|
|
3365
|
-
return t === void 0 && (t = !1), !n || t && n !==
|
|
3379
|
+
function Io(e, t, n) {
|
|
3380
|
+
return t === void 0 && (t = !1), !n || t && n !== fo(e) ? !1 : t;
|
|
3366
3381
|
}
|
|
3367
|
-
function
|
|
3382
|
+
function Lo(e, t, n, r) {
|
|
3368
3383
|
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
3369
|
-
let i = e.getBoundingClientRect(), a =
|
|
3370
|
-
t && (r ?
|
|
3371
|
-
let s =
|
|
3384
|
+
let i = e.getBoundingClientRect(), a = Mo(e), o = Ea(1);
|
|
3385
|
+
t && (r ? ho(r) && (o = No(r)) : o = No(e));
|
|
3386
|
+
let s = Io(a, n, r) ? Fo(a) : Ea(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;
|
|
3372
3387
|
if (a) {
|
|
3373
|
-
let e =
|
|
3388
|
+
let e = fo(a), t = r && ho(r) ? fo(r) : r, n = e, i = Ao(n);
|
|
3374
3389
|
for (; i && r && t !== n;) {
|
|
3375
|
-
let e =
|
|
3376
|
-
c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n =
|
|
3390
|
+
let e = No(i), t = i.getBoundingClientRect(), r = To(i), a = t.left + (i.clientLeft + parseFloat(r.paddingLeft)) * e.x, o = t.top + (i.clientTop + parseFloat(r.paddingTop)) * e.y;
|
|
3391
|
+
c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n = fo(i), i = Ao(n);
|
|
3377
3392
|
}
|
|
3378
3393
|
}
|
|
3379
|
-
return
|
|
3394
|
+
return Ga({
|
|
3380
3395
|
width: u,
|
|
3381
3396
|
height: d,
|
|
3382
3397
|
x: c,
|
|
3383
3398
|
y: l
|
|
3384
3399
|
});
|
|
3385
3400
|
}
|
|
3386
|
-
function
|
|
3387
|
-
let n =
|
|
3388
|
-
return t ? t.left + n :
|
|
3401
|
+
function Ro(e, t) {
|
|
3402
|
+
let n = Eo(e).scrollLeft;
|
|
3403
|
+
return t ? t.left + n : Lo(po(e)).left + n;
|
|
3389
3404
|
}
|
|
3390
|
-
function
|
|
3405
|
+
function zo(e, t, n) {
|
|
3391
3406
|
n === void 0 && (n = !1);
|
|
3392
3407
|
let r = e.getBoundingClientRect();
|
|
3393
3408
|
return {
|
|
3394
|
-
x: r.left + t.scrollLeft - (n ? 0 :
|
|
3409
|
+
x: r.left + t.scrollLeft - (n ? 0 : Ro(e, r)),
|
|
3395
3410
|
y: r.top + t.scrollTop
|
|
3396
3411
|
};
|
|
3397
3412
|
}
|
|
3398
|
-
function
|
|
3399
|
-
let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o =
|
|
3413
|
+
function Bo(e) {
|
|
3414
|
+
let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o = po(r), s = t ? bo(t.floating) : !1;
|
|
3400
3415
|
if (r === o || s && a) return n;
|
|
3401
3416
|
let c = {
|
|
3402
3417
|
scrollLeft: 0,
|
|
3403
3418
|
scrollTop: 0
|
|
3404
|
-
}, l =
|
|
3405
|
-
if ((d || !d && !a) && ((
|
|
3406
|
-
let e =
|
|
3407
|
-
l =
|
|
3419
|
+
}, l = Ea(1), u = Ea(0), d = go(r);
|
|
3420
|
+
if ((d || !d && !a) && ((uo(r) !== "body" || vo(o)) && (c = Eo(r)), go(r))) {
|
|
3421
|
+
let e = Lo(r);
|
|
3422
|
+
l = No(r), u.x = e.x + r.clientLeft, u.y = e.y + r.clientTop;
|
|
3408
3423
|
}
|
|
3409
|
-
let f = o && !d && !a ?
|
|
3424
|
+
let f = o && !d && !a ? zo(o, c, !0) : Ea(0);
|
|
3410
3425
|
return {
|
|
3411
3426
|
width: n.width * l.x,
|
|
3412
3427
|
height: n.height * l.y,
|
|
@@ -3414,23 +3429,23 @@ function Ao(e) {
|
|
|
3414
3429
|
y: n.y * l.y - c.scrollTop * l.y + u.y + f.y
|
|
3415
3430
|
};
|
|
3416
3431
|
}
|
|
3417
|
-
function
|
|
3432
|
+
function Vo(e) {
|
|
3418
3433
|
return Array.from(e.getClientRects());
|
|
3419
3434
|
}
|
|
3420
|
-
function
|
|
3421
|
-
let t =
|
|
3422
|
-
return
|
|
3435
|
+
function Ho(e) {
|
|
3436
|
+
let t = po(e), n = Eo(e), r = e.ownerDocument.body, i = Z(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = Z(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight), o = -n.scrollLeft + Ro(e), s = -n.scrollTop;
|
|
3437
|
+
return To(r).direction === "rtl" && (o += Z(t.clientWidth, r.clientWidth) - i), {
|
|
3423
3438
|
width: i,
|
|
3424
3439
|
height: a,
|
|
3425
3440
|
x: o,
|
|
3426
3441
|
y: s
|
|
3427
3442
|
};
|
|
3428
3443
|
}
|
|
3429
|
-
function
|
|
3430
|
-
let n =
|
|
3444
|
+
function Uo(e, t) {
|
|
3445
|
+
let n = fo(e), r = po(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
|
|
3431
3446
|
if (i) {
|
|
3432
3447
|
a = i.width, o = i.height;
|
|
3433
|
-
let e =
|
|
3448
|
+
let e = Co();
|
|
3434
3449
|
(!e || e && t === "fixed") && (s = i.offsetLeft, c = i.offsetTop);
|
|
3435
3450
|
}
|
|
3436
3451
|
return {
|
|
@@ -3440,8 +3455,8 @@ function No(e, t) {
|
|
|
3440
3455
|
y: c
|
|
3441
3456
|
};
|
|
3442
3457
|
}
|
|
3443
|
-
function
|
|
3444
|
-
let n =
|
|
3458
|
+
function Wo(e, t) {
|
|
3459
|
+
let n = Lo(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = go(e) ? No(e) : Ea(1);
|
|
3445
3460
|
return {
|
|
3446
3461
|
width: e.clientWidth * a.x,
|
|
3447
3462
|
height: e.clientHeight * a.y,
|
|
@@ -3449,13 +3464,13 @@ function Po(e, t) {
|
|
|
3449
3464
|
y: r * a.y
|
|
3450
3465
|
};
|
|
3451
3466
|
}
|
|
3452
|
-
function
|
|
3467
|
+
function Go(e, t, n) {
|
|
3453
3468
|
let r;
|
|
3454
|
-
if (t === "viewport") r =
|
|
3455
|
-
else if (t === "document") r =
|
|
3456
|
-
else if (
|
|
3469
|
+
if (t === "viewport") r = Uo(e, n);
|
|
3470
|
+
else if (t === "document") r = Ho(po(e));
|
|
3471
|
+
else if (ho(t)) r = Wo(t, n);
|
|
3457
3472
|
else {
|
|
3458
|
-
let n =
|
|
3473
|
+
let n = Fo(e);
|
|
3459
3474
|
r = {
|
|
3460
3475
|
x: t.x - n.x,
|
|
3461
3476
|
y: t.y - n.y,
|
|
@@ -3463,27 +3478,27 @@ function Fo(e, t, n) {
|
|
|
3463
3478
|
height: t.height
|
|
3464
3479
|
};
|
|
3465
3480
|
}
|
|
3466
|
-
return
|
|
3481
|
+
return Ga(r);
|
|
3467
3482
|
}
|
|
3468
|
-
function
|
|
3469
|
-
let n =
|
|
3470
|
-
return n === t || !
|
|
3483
|
+
function Ko(e, t) {
|
|
3484
|
+
let n = Do(e);
|
|
3485
|
+
return n === t || !ho(n) || wo(n) ? !1 : To(n).position === "fixed" || Ko(n, t);
|
|
3471
3486
|
}
|
|
3472
|
-
function
|
|
3487
|
+
function qo(e, t) {
|
|
3473
3488
|
let n = t.get(e);
|
|
3474
3489
|
if (n) return n;
|
|
3475
|
-
let r =
|
|
3476
|
-
for (;
|
|
3477
|
-
let t =
|
|
3478
|
-
!n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && ["absolute", "fixed"].includes(i.position) ||
|
|
3490
|
+
let r = ko(e, [], !1).filter((e) => ho(e) && uo(e) !== "body"), i = null, a = To(e).position === "fixed", o = a ? Do(e) : e;
|
|
3491
|
+
for (; ho(o) && !wo(o);) {
|
|
3492
|
+
let t = To(o), n = xo(o);
|
|
3493
|
+
!n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && ["absolute", "fixed"].includes(i.position) || vo(o) && !n && Ko(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = Do(o);
|
|
3479
3494
|
}
|
|
3480
3495
|
return t.set(e, r), r;
|
|
3481
3496
|
}
|
|
3482
|
-
function
|
|
3483
|
-
let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ?
|
|
3484
|
-
let r =
|
|
3485
|
-
return e.top =
|
|
3486
|
-
},
|
|
3497
|
+
function Jo(e) {
|
|
3498
|
+
let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ? bo(t) ? [] : qo(t, this._c) : [].concat(n), r], o = a[0], s = a.reduce((e, n) => {
|
|
3499
|
+
let r = Go(t, n, i);
|
|
3500
|
+
return e.top = Z(r.top, e.top), e.right = wa(r.right, e.right), e.bottom = wa(r.bottom, e.bottom), e.left = Z(r.left, e.left), e;
|
|
3501
|
+
}, Go(t, o, i));
|
|
3487
3502
|
return {
|
|
3488
3503
|
width: s.right - s.left,
|
|
3489
3504
|
height: s.bottom - s.top,
|
|
@@ -3491,23 +3506,23 @@ function Ro(e) {
|
|
|
3491
3506
|
y: s.top
|
|
3492
3507
|
};
|
|
3493
3508
|
}
|
|
3494
|
-
function
|
|
3495
|
-
let { width: t, height: n } =
|
|
3509
|
+
function Yo(e) {
|
|
3510
|
+
let { width: t, height: n } = jo(e);
|
|
3496
3511
|
return {
|
|
3497
3512
|
width: t,
|
|
3498
3513
|
height: n
|
|
3499
3514
|
};
|
|
3500
3515
|
}
|
|
3501
|
-
function
|
|
3502
|
-
let r =
|
|
3516
|
+
function Xo(e, t, n) {
|
|
3517
|
+
let r = go(t), i = po(t), a = n === "fixed", o = Lo(e, !0, a, t), s = {
|
|
3503
3518
|
scrollLeft: 0,
|
|
3504
3519
|
scrollTop: 0
|
|
3505
|
-
}, c =
|
|
3506
|
-
if (r || !r && !a) if ((
|
|
3507
|
-
let e =
|
|
3520
|
+
}, c = Ea(0);
|
|
3521
|
+
if (r || !r && !a) if ((uo(t) !== "body" || vo(i)) && (s = Eo(t)), r) {
|
|
3522
|
+
let e = Lo(t, !0, a, t);
|
|
3508
3523
|
c.x = e.x + t.clientLeft, c.y = e.y + t.clientTop;
|
|
3509
|
-
} else i && (c.x =
|
|
3510
|
-
let l = i && !r && !a ?
|
|
3524
|
+
} else i && (c.x = Ro(i));
|
|
3525
|
+
let l = i && !r && !a ? zo(i, s) : Ea(0);
|
|
3511
3526
|
return {
|
|
3512
3527
|
x: o.left + s.scrollLeft - c.x - l.x,
|
|
3513
3528
|
y: o.top + s.scrollTop - c.y - l.y,
|
|
@@ -3515,34 +3530,34 @@ function Bo(e, t, n) {
|
|
|
3515
3530
|
height: o.height
|
|
3516
3531
|
};
|
|
3517
3532
|
}
|
|
3518
|
-
function
|
|
3519
|
-
return
|
|
3533
|
+
function Zo(e) {
|
|
3534
|
+
return To(e).position === "static";
|
|
3520
3535
|
}
|
|
3521
|
-
function
|
|
3522
|
-
if (!
|
|
3536
|
+
function Qo(e, t) {
|
|
3537
|
+
if (!go(e) || To(e).position === "fixed") return null;
|
|
3523
3538
|
if (t) return t(e);
|
|
3524
3539
|
let n = e.offsetParent;
|
|
3525
|
-
return
|
|
3540
|
+
return po(e) === n && (n = n.ownerDocument.body), n;
|
|
3526
3541
|
}
|
|
3527
|
-
function
|
|
3528
|
-
let n =
|
|
3529
|
-
if (
|
|
3530
|
-
if (!
|
|
3531
|
-
let t =
|
|
3532
|
-
for (; t && !
|
|
3533
|
-
if (
|
|
3534
|
-
t =
|
|
3542
|
+
function $o(e, t) {
|
|
3543
|
+
let n = fo(e);
|
|
3544
|
+
if (bo(e)) return n;
|
|
3545
|
+
if (!go(e)) {
|
|
3546
|
+
let t = Do(e);
|
|
3547
|
+
for (; t && !wo(t);) {
|
|
3548
|
+
if (ho(t) && !Zo(t)) return t;
|
|
3549
|
+
t = Do(t);
|
|
3535
3550
|
}
|
|
3536
3551
|
return n;
|
|
3537
3552
|
}
|
|
3538
|
-
let r =
|
|
3539
|
-
for (; r &&
|
|
3540
|
-
return r &&
|
|
3553
|
+
let r = Qo(e, t);
|
|
3554
|
+
for (; r && yo(r) && Zo(r);) r = Qo(r, t);
|
|
3555
|
+
return r && wo(r) && Zo(r) && !xo(r) ? n : r || So(e) || n;
|
|
3541
3556
|
}
|
|
3542
|
-
var
|
|
3543
|
-
let t = this.getOffsetParent ||
|
|
3557
|
+
var es = async function(e) {
|
|
3558
|
+
let t = this.getOffsetParent || $o, n = this.getDimensions, r = await n(e.floating);
|
|
3544
3559
|
return {
|
|
3545
|
-
reference:
|
|
3560
|
+
reference: Xo(e.reference, await t(e.floating), e.strategy),
|
|
3546
3561
|
floating: {
|
|
3547
3562
|
x: 0,
|
|
3548
3563
|
y: 0,
|
|
@@ -3551,38 +3566,38 @@ var Wo = async function(e) {
|
|
|
3551
3566
|
}
|
|
3552
3567
|
};
|
|
3553
3568
|
};
|
|
3554
|
-
function
|
|
3555
|
-
return
|
|
3569
|
+
function ts(e) {
|
|
3570
|
+
return To(e).direction === "rtl";
|
|
3556
3571
|
}
|
|
3557
|
-
var
|
|
3558
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
3559
|
-
getDocumentElement:
|
|
3560
|
-
getClippingRect:
|
|
3561
|
-
getOffsetParent:
|
|
3562
|
-
getElementRects:
|
|
3563
|
-
getClientRects:
|
|
3564
|
-
getDimensions:
|
|
3565
|
-
getScale:
|
|
3566
|
-
isElement:
|
|
3567
|
-
isRTL:
|
|
3568
|
-
},
|
|
3572
|
+
var ns = {
|
|
3573
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Bo,
|
|
3574
|
+
getDocumentElement: po,
|
|
3575
|
+
getClippingRect: Jo,
|
|
3576
|
+
getOffsetParent: $o,
|
|
3577
|
+
getElementRects: es,
|
|
3578
|
+
getClientRects: Vo,
|
|
3579
|
+
getDimensions: Yo,
|
|
3580
|
+
getScale: No,
|
|
3581
|
+
isElement: ho,
|
|
3582
|
+
isRTL: ts
|
|
3583
|
+
}, rs = oo, is = Za, as = so, os = Qa, ss = co, cs = to, ls = Ya, us = io, ds = (e, t, n) => {
|
|
3569
3584
|
let r = /* @__PURE__ */ new Map(), i = {
|
|
3570
|
-
platform:
|
|
3585
|
+
platform: ns,
|
|
3571
3586
|
...n
|
|
3572
3587
|
}, a = {
|
|
3573
3588
|
...i.platform,
|
|
3574
3589
|
_c: r
|
|
3575
3590
|
};
|
|
3576
|
-
return
|
|
3591
|
+
return qa(e, t, {
|
|
3577
3592
|
...i,
|
|
3578
3593
|
platform: a
|
|
3579
3594
|
});
|
|
3580
3595
|
};
|
|
3581
|
-
function
|
|
3596
|
+
function fs(e, t) {
|
|
3582
3597
|
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;
|
|
3583
3598
|
return new DOMRect(i, n, a, o);
|
|
3584
3599
|
}
|
|
3585
|
-
var
|
|
3600
|
+
var ps = class {
|
|
3586
3601
|
constructor({ editor: e, element: t, view: n, pluginKey: r = "bubbleMenu", updateDelay: i = 250, resizeDelay: a = 60, shouldShow: o, appendTo: s, getReferencedVirtualElement: c, options: l }) {
|
|
3587
3602
|
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
|
|
3588
3603
|
strategy: "absolute",
|
|
@@ -3600,7 +3615,7 @@ var rs = class {
|
|
|
3600
3615
|
onUpdate: void 0,
|
|
3601
3616
|
onDestroy: void 0
|
|
3602
3617
|
}, this.shouldShow = ({ view: e, state: t, from: n, to: r }) => {
|
|
3603
|
-
let { doc: i, selection: a } = t, { empty: o } = a, s = !i.textBetween(n, r).length &&
|
|
3618
|
+
let { doc: i, selection: a } = t, { empty: o } = a, s = !i.textBetween(n, r).length && oe(t.selection), c = this.element.contains(document.activeElement);
|
|
3604
3619
|
return !(!(e.hasFocus() || c) || o || s || !this.editor.isEditable);
|
|
3605
3620
|
}, this.mousedownHandler = () => {
|
|
3606
3621
|
this.preventHide = !0;
|
|
@@ -3646,27 +3661,27 @@ var rs = class {
|
|
|
3646
3661
|
}
|
|
3647
3662
|
get middlewares() {
|
|
3648
3663
|
let e = [];
|
|
3649
|
-
return this.floatingUIOptions.flip && e.push(
|
|
3664
|
+
return this.floatingUIOptions.flip && e.push(os(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(as(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(rs(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(ls(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(ss(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(is(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(cs(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(us(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
|
|
3650
3665
|
}
|
|
3651
3666
|
get virtualElement() {
|
|
3652
3667
|
let { selection: e } = this.editor.state, t = this.getReferencedVirtualElement?.call(this);
|
|
3653
3668
|
if (t) return t;
|
|
3654
3669
|
if (!this.view?.dom?.parentNode) return;
|
|
3655
|
-
let n =
|
|
3670
|
+
let n = V(this.view, e.from, e.to), r = {
|
|
3656
3671
|
getBoundingClientRect: () => n,
|
|
3657
3672
|
getClientRects: () => [n]
|
|
3658
3673
|
};
|
|
3659
|
-
if (e instanceof
|
|
3674
|
+
if (e instanceof se) {
|
|
3660
3675
|
let t = this.view.nodeDOM(e.from), n = t.dataset.nodeViewWrapper ? t : t.querySelector("[data-node-view-wrapper]");
|
|
3661
3676
|
n && (t = n), t && (r = {
|
|
3662
3677
|
getBoundingClientRect: () => t.getBoundingClientRect(),
|
|
3663
3678
|
getClientRects: () => [t.getBoundingClientRect()]
|
|
3664
3679
|
});
|
|
3665
3680
|
}
|
|
3666
|
-
if (e instanceof
|
|
3681
|
+
if (e instanceof H) {
|
|
3667
3682
|
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);
|
|
3668
3683
|
if (!o || !s) return;
|
|
3669
|
-
let c = o === s ? o.getBoundingClientRect() :
|
|
3684
|
+
let c = o === s ? o.getBoundingClientRect() : fs(o.getBoundingClientRect(), s.getBoundingClientRect());
|
|
3670
3685
|
r = {
|
|
3671
3686
|
getBoundingClientRect: () => c,
|
|
3672
3687
|
getClientRects: () => [c]
|
|
@@ -3677,7 +3692,7 @@ var rs = class {
|
|
|
3677
3692
|
updatePosition() {
|
|
3678
3693
|
if (!this.isVisible) return;
|
|
3679
3694
|
let e = this.virtualElement;
|
|
3680
|
-
e &&
|
|
3695
|
+
e && ds(e, this.element, {
|
|
3681
3696
|
placement: this.floatingUIOptions.placement,
|
|
3682
3697
|
strategy: this.floatingUIOptions.strategy,
|
|
3683
3698
|
middleware: this.middlewares
|
|
@@ -3731,13 +3746,13 @@ var rs = class {
|
|
|
3731
3746
|
destroy() {
|
|
3732
3747
|
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();
|
|
3733
3748
|
}
|
|
3734
|
-
},
|
|
3735
|
-
key: typeof e.pluginKey == "string" ? new
|
|
3736
|
-
view: (t) => new
|
|
3749
|
+
}, ms = (e) => new ce({
|
|
3750
|
+
key: typeof e.pluginKey == "string" ? new le(e.pluginKey) : e.pluginKey,
|
|
3751
|
+
view: (t) => new ps({
|
|
3737
3752
|
view: t,
|
|
3738
3753
|
...e
|
|
3739
3754
|
})
|
|
3740
|
-
}),
|
|
3755
|
+
}), hs = {
|
|
3741
3756
|
name: "BubbleMenu",
|
|
3742
3757
|
inheritAttrs: !1,
|
|
3743
3758
|
props: {
|
|
@@ -3767,7 +3782,7 @@ var rs = class {
|
|
|
3767
3782
|
mounted() {
|
|
3768
3783
|
let e = this.editor, t = this.$el;
|
|
3769
3784
|
!e || !t || (t.style.visibility = "hidden", t.style.position = "absolute", t.remove(), this.$nextTick(() => {
|
|
3770
|
-
e.registerPlugin(
|
|
3785
|
+
e.registerPlugin(ms({
|
|
3771
3786
|
updateDelay: this.updateDelay,
|
|
3772
3787
|
resizeDelay: this.resizeDelay,
|
|
3773
3788
|
options: this.options,
|
|
@@ -3793,9 +3808,9 @@ var rs = class {
|
|
|
3793
3808
|
this.editor.unregisterPlugin(this.getPluginKey());
|
|
3794
3809
|
},
|
|
3795
3810
|
methods: { getPluginKey() {
|
|
3796
|
-
return this.generatedPluginKey ||= this.pluginKey ?? new
|
|
3811
|
+
return this.generatedPluginKey ||= this.pluginKey ?? new le("bubbleMenu"), this.generatedPluginKey;
|
|
3797
3812
|
} }
|
|
3798
|
-
},
|
|
3813
|
+
}, gs = {
|
|
3799
3814
|
active: !1,
|
|
3800
3815
|
mode: "outside",
|
|
3801
3816
|
activeCellPos: null,
|
|
@@ -3803,17 +3818,17 @@ var rs = class {
|
|
|
3803
3818
|
selectedCellCount: 0,
|
|
3804
3819
|
selectionFrom: 0,
|
|
3805
3820
|
selectionTo: 0
|
|
3806
|
-
},
|
|
3821
|
+
}, _s = {
|
|
3807
3822
|
active: !1,
|
|
3808
|
-
language:
|
|
3823
|
+
language: xt.defaultLanguage,
|
|
3809
3824
|
mermaidPreviewMode: "code",
|
|
3810
3825
|
pos: null,
|
|
3811
3826
|
text: ""
|
|
3812
3827
|
};
|
|
3813
|
-
function
|
|
3814
|
-
return
|
|
3828
|
+
function vs(e) {
|
|
3829
|
+
return Hn.getState(e.state) ?? Vn;
|
|
3815
3830
|
}
|
|
3816
|
-
function
|
|
3831
|
+
function ys(e) {
|
|
3817
3832
|
if (!e || typeof window > "u") return null;
|
|
3818
3833
|
let t = e.parentElement;
|
|
3819
3834
|
for (; t;) {
|
|
@@ -3830,7 +3845,7 @@ function Q(e, t, n = 18, r = 1.8) {
|
|
|
3830
3845
|
"aria-hidden": "true"
|
|
3831
3846
|
}, { default: () => t });
|
|
3832
3847
|
}
|
|
3833
|
-
function
|
|
3848
|
+
function bs(e) {
|
|
3834
3849
|
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", {
|
|
3835
3850
|
cx: "10",
|
|
3836
3851
|
cy: "10",
|
|
@@ -3867,7 +3882,7 @@ function us(e) {
|
|
|
3867
3882
|
U("path", { d: "m14 14 4 4" })
|
|
3868
3883
|
] : 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" })];
|
|
3869
3884
|
}
|
|
3870
|
-
function
|
|
3885
|
+
function xs(e) {
|
|
3871
3886
|
return U("svg", {
|
|
3872
3887
|
viewBox: "0 0 24 24",
|
|
3873
3888
|
"aria-hidden": "true",
|
|
@@ -3878,66 +3893,66 @@ function ds(e) {
|
|
|
3878
3893
|
"stroke-linecap": "round",
|
|
3879
3894
|
"stroke-linejoin": "round",
|
|
3880
3895
|
"stroke-width": "1.8"
|
|
3881
|
-
},
|
|
3896
|
+
}, bs(e)));
|
|
3882
3897
|
}
|
|
3883
3898
|
function $(e) {
|
|
3884
3899
|
e.preventDefault();
|
|
3885
3900
|
}
|
|
3886
|
-
function
|
|
3887
|
-
let t =
|
|
3901
|
+
function Ss(e) {
|
|
3902
|
+
let t = Qt(e);
|
|
3888
3903
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
3889
3904
|
}
|
|
3890
|
-
var
|
|
3891
|
-
bold:
|
|
3892
|
-
italic:
|
|
3893
|
-
underline:
|
|
3894
|
-
strike:
|
|
3895
|
-
"inline-code":
|
|
3896
|
-
link:
|
|
3897
|
-
more:
|
|
3898
|
-
superscript:
|
|
3899
|
-
subscript:
|
|
3900
|
-
"inline-math":
|
|
3901
|
-
"align-left":
|
|
3902
|
-
"align-center":
|
|
3903
|
-
"align-right":
|
|
3904
|
-
"align-justify":
|
|
3905
|
-
"decrease-indent":
|
|
3906
|
-
"increase-indent":
|
|
3907
|
-
},
|
|
3908
|
-
type:
|
|
3909
|
-
"heading-1":
|
|
3910
|
-
"heading-2":
|
|
3911
|
-
"heading-3":
|
|
3912
|
-
"bullet-list":
|
|
3913
|
-
"ordered-list":
|
|
3914
|
-
"task-list":
|
|
3915
|
-
blockquote:
|
|
3916
|
-
"code-block":
|
|
3917
|
-
details:
|
|
3918
|
-
info:
|
|
3919
|
-
tip:
|
|
3920
|
-
warning:
|
|
3921
|
-
error:
|
|
3922
|
-
success:
|
|
3923
|
-
emoji:
|
|
3924
|
-
math:
|
|
3925
|
-
table:
|
|
3926
|
-
separator:
|
|
3927
|
-
image:
|
|
3928
|
-
video:
|
|
3929
|
-
attachment:
|
|
3905
|
+
var Cs = {
|
|
3906
|
+
bold: $r,
|
|
3907
|
+
italic: Si,
|
|
3908
|
+
underline: Zi,
|
|
3909
|
+
strike: Hi,
|
|
3910
|
+
"inline-code": ci,
|
|
3911
|
+
link: wi,
|
|
3912
|
+
more: ki,
|
|
3913
|
+
superscript: Wi,
|
|
3914
|
+
subscript: Ui,
|
|
3915
|
+
"inline-math": Li,
|
|
3916
|
+
"align-left": Lr,
|
|
3917
|
+
"align-center": Fr,
|
|
3918
|
+
"align-right": Rr,
|
|
3919
|
+
"align-justify": Ir,
|
|
3920
|
+
"decrease-indent": yi,
|
|
3921
|
+
"increase-indent": bi
|
|
3922
|
+
}, ws = {
|
|
3923
|
+
type: Ji,
|
|
3924
|
+
"heading-1": mi,
|
|
3925
|
+
"heading-2": hi,
|
|
3926
|
+
"heading-3": gi,
|
|
3927
|
+
"bullet-list": Ti,
|
|
3928
|
+
"ordered-list": Di,
|
|
3929
|
+
"task-list": Ei,
|
|
3930
|
+
blockquote: Pi,
|
|
3931
|
+
"code-block": ei,
|
|
3932
|
+
details: ai,
|
|
3933
|
+
info: xi,
|
|
3934
|
+
tip: Ci,
|
|
3935
|
+
warning: Hr,
|
|
3936
|
+
error: si,
|
|
3937
|
+
success: ri,
|
|
3938
|
+
emoji: Ri,
|
|
3939
|
+
math: Li,
|
|
3940
|
+
table: Gi,
|
|
3941
|
+
separator: Oi,
|
|
3942
|
+
image: _i,
|
|
3943
|
+
video: $i,
|
|
3944
|
+
attachment: ji
|
|
3930
3945
|
};
|
|
3931
|
-
function
|
|
3946
|
+
function Ts(e) {
|
|
3932
3947
|
if (typeof e != "string") {
|
|
3933
3948
|
if (e.kind === "text") return U("span", {
|
|
3934
3949
|
class: "markweave-slash-command-text-icon",
|
|
3935
|
-
"data-icon-length":
|
|
3950
|
+
"data-icon-length": vn(e),
|
|
3936
3951
|
"aria-hidden": "true"
|
|
3937
3952
|
}, e.text);
|
|
3938
3953
|
e = e.name;
|
|
3939
3954
|
}
|
|
3940
|
-
let t =
|
|
3955
|
+
let t = ws[e];
|
|
3941
3956
|
return U(t, {
|
|
3942
3957
|
size: 18,
|
|
3943
3958
|
strokeWidth: 1.6,
|
|
@@ -3945,21 +3960,21 @@ function hs(e) {
|
|
|
3945
3960
|
"aria-hidden": "true"
|
|
3946
3961
|
});
|
|
3947
3962
|
}
|
|
3948
|
-
var
|
|
3949
|
-
paragraph:
|
|
3950
|
-
"heading-1":
|
|
3951
|
-
"heading-2":
|
|
3952
|
-
"heading-3":
|
|
3953
|
-
"bullet-list":
|
|
3954
|
-
"numbered-list":
|
|
3955
|
-
"todo-list":
|
|
3956
|
-
quote:
|
|
3957
|
-
"code-block":
|
|
3963
|
+
var Es = {
|
|
3964
|
+
paragraph: Xi,
|
|
3965
|
+
"heading-1": mi,
|
|
3966
|
+
"heading-2": hi,
|
|
3967
|
+
"heading-3": gi,
|
|
3968
|
+
"bullet-list": Ti,
|
|
3969
|
+
"numbered-list": Di,
|
|
3970
|
+
"todo-list": Ei,
|
|
3971
|
+
quote: Pi,
|
|
3972
|
+
"code-block": ei
|
|
3958
3973
|
};
|
|
3959
|
-
function
|
|
3960
|
-
return
|
|
3974
|
+
function Ds(e, t) {
|
|
3975
|
+
return ye(e, t).label;
|
|
3961
3976
|
}
|
|
3962
|
-
var
|
|
3977
|
+
var Os = Y({
|
|
3963
3978
|
name: "MarkweaveVueFloatingToolbar",
|
|
3964
3979
|
props: {
|
|
3965
3980
|
editor: {
|
|
@@ -3984,32 +3999,32 @@ var vs = J({
|
|
|
3984
3999
|
}
|
|
3985
4000
|
},
|
|
3986
4001
|
setup(e) {
|
|
3987
|
-
let t = W(null), n = W("input"), r = W(""), i = W(""), a = W(""), o = W(""), s =
|
|
4002
|
+
let t = W(null), n = W("input"), r = W(""), i = W(""), a = W(""), o = W(""), s = G(null), c = G(null), l = W(null), u = W(null), d = "", f = K(() => 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 = K(() => Qt(p.value.trim())), x = K(() => e.messages.floatingToolbar), S = K(() => Ce(e.messages).map((e) => [
|
|
3988
4003
|
e.id,
|
|
3989
4004
|
e.label,
|
|
3990
|
-
|
|
3991
|
-
])), C =
|
|
4005
|
+
Es[e.id]
|
|
4006
|
+
])), C = K(() => Se(e.messages).map((e) => [
|
|
3992
4007
|
e.id,
|
|
3993
4008
|
e.value,
|
|
3994
4009
|
e.label
|
|
3995
|
-
])), w =
|
|
4010
|
+
])), w = K(() => be(e.messages).map((e) => [
|
|
3996
4011
|
e.id,
|
|
3997
4012
|
e.value,
|
|
3998
4013
|
e.label
|
|
3999
|
-
])), T =
|
|
4014
|
+
])), T = K(() => xe(e.messages).map((e) => e.id)), E = () => {
|
|
4000
4015
|
b.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: b.value }).run(), t.value = null);
|
|
4001
4016
|
}, D = () => {
|
|
4002
4017
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), p.value = "", t.value = null;
|
|
4003
4018
|
}, O = (n) => {
|
|
4004
4019
|
t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
|
|
4005
|
-
}, k =
|
|
4006
|
-
|
|
4020
|
+
}, k = fe(() => {
|
|
4021
|
+
it(e.editor, d), a.value = d;
|
|
4007
4022
|
}), A = (n = !0) => {
|
|
4008
|
-
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n &&
|
|
4023
|
+
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && nt(e.editor), Je(e.editor), t.value = null, n && e.editor.commands.focus(void 0, { scrollIntoView: !1 });
|
|
4009
4024
|
}, j = () => {
|
|
4010
4025
|
if (!f.value) return;
|
|
4011
|
-
let r =
|
|
4012
|
-
r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai",
|
|
4026
|
+
let r = ot(e.editor);
|
|
4027
|
+
r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus()));
|
|
4013
4028
|
}, M = async (t) => {
|
|
4014
4029
|
if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
|
|
4015
4030
|
let u = (t ?? r.value).trim();
|
|
@@ -4017,40 +4032,40 @@ var vs = J({
|
|
|
4017
4032
|
o.value = e.messages.askAi.emptyPrompt, n.value = "error";
|
|
4018
4033
|
return;
|
|
4019
4034
|
}
|
|
4020
|
-
let p =
|
|
4035
|
+
let p = Xe(e.editor, s.value);
|
|
4021
4036
|
if (!p) {
|
|
4022
4037
|
n.value = "conflict";
|
|
4023
4038
|
return;
|
|
4024
4039
|
}
|
|
4025
|
-
s.value = p, c.value?.abort(),
|
|
4026
|
-
let m = new AbortController(), h =
|
|
4040
|
+
s.value = p, c.value?.abort(), qe(e.editor);
|
|
4041
|
+
let m = new AbortController(), h = Ye(p, u, e.lang, m.signal, void 0, Qe(e.editor)?.target);
|
|
4027
4042
|
c.value = m, l.value = h.id, i.value = u, k.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
|
|
4028
4043
|
try {
|
|
4029
|
-
let t = await
|
|
4044
|
+
let t = await rt(e.askAi.handler, h, (e) => {
|
|
4030
4045
|
l.value === h.id && !m.signal.aborted && (d = e, k.schedule());
|
|
4031
4046
|
});
|
|
4032
4047
|
if (l.value !== h.id || m.signal.aborted) return;
|
|
4033
|
-
if (k.cancel(), d = t, !
|
|
4034
|
-
a.value = t, r.value = "", n.value =
|
|
4048
|
+
if (k.cancel(), d = t, !it(e.editor, t)) throw new Ue("invalid-output", "Ask AI output is incompatible with the selected content.");
|
|
4049
|
+
a.value = t, r.value = "", n.value = Qe(e.editor)?.status === "target" ? "result" : "conflict";
|
|
4035
4050
|
} catch (t) {
|
|
4036
4051
|
if (l.value !== h.id) return;
|
|
4037
4052
|
if (k.cancel(), m.signal.aborted) {
|
|
4038
|
-
|
|
4053
|
+
qe(e.editor), n.value = Qe(e.editor)?.status === "conflict" ? "conflict" : "input";
|
|
4039
4054
|
return;
|
|
4040
4055
|
}
|
|
4041
|
-
|
|
4056
|
+
qe(e.editor), o.value = t instanceof Ue ? 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";
|
|
4042
4057
|
}
|
|
4043
4058
|
}, N = () => {
|
|
4044
|
-
if (!
|
|
4045
|
-
n.value =
|
|
4059
|
+
if (!We(e.editor, a.value)) {
|
|
4060
|
+
n.value = Qe(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
|
|
4046
4061
|
return;
|
|
4047
4062
|
}
|
|
4048
|
-
t.value = null, window.setTimeout(() =>
|
|
4049
|
-
}, P =
|
|
4063
|
+
t.value = null, window.setTimeout(() => Je(e.editor), 560), e.editor.commands.focus(void 0, { scrollIntoView: !1 });
|
|
4064
|
+
}, P = fe(() => {
|
|
4050
4065
|
let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
4051
4066
|
if (!t.value || !n || !r) return;
|
|
4052
4067
|
if (t.value === "ask-ai") {
|
|
4053
|
-
let t =
|
|
4068
|
+
let t = $e(e.editor), n = v.value?.getBoundingClientRect();
|
|
4054
4069
|
if (!t || !n) return;
|
|
4055
4070
|
let a = {
|
|
4056
4071
|
anchorRect: n,
|
|
@@ -4060,18 +4075,18 @@ var vs = J({
|
|
|
4060
4075
|
height: window.innerHeight
|
|
4061
4076
|
},
|
|
4062
4077
|
frameRect: i?.getBoundingClientRect() ?? null,
|
|
4063
|
-
surfaceRect:
|
|
4064
|
-
}, o =
|
|
4078
|
+
surfaceRect: Ze(e.editor.view.dom)
|
|
4079
|
+
}, o = Ge({
|
|
4065
4080
|
...a,
|
|
4066
4081
|
panelSize: r.getBoundingClientRect()
|
|
4067
4082
|
}), s = `${o.width}px`;
|
|
4068
|
-
r.style.width !== s && (r.style.width = s, o =
|
|
4083
|
+
r.style.width !== s && (r.style.width = s, o = Ge({
|
|
4069
4084
|
...a,
|
|
4070
4085
|
panelSize: r.getBoundingClientRect()
|
|
4071
4086
|
})), 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;
|
|
4072
4087
|
return;
|
|
4073
4088
|
}
|
|
4074
|
-
let a =
|
|
4089
|
+
let a = Fe({
|
|
4075
4090
|
toolbarRect: n.getBoundingClientRect(),
|
|
4076
4091
|
popoverSize: r.getBoundingClientRect(),
|
|
4077
4092
|
viewport: {
|
|
@@ -4083,9 +4098,9 @@ var vs = J({
|
|
|
4083
4098
|
});
|
|
4084
4099
|
g.value = a.placement;
|
|
4085
4100
|
}), F = () => {
|
|
4086
|
-
let l =
|
|
4101
|
+
let l = Qe(e.editor);
|
|
4087
4102
|
if (l?.target.kind === "table" && l.status === "target" && t.value !== "ask-ai") {
|
|
4088
|
-
s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai",
|
|
4103
|
+
s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus());
|
|
4089
4104
|
return;
|
|
4090
4105
|
}
|
|
4091
4106
|
t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), k.cancel(), n.value = "conflict");
|
|
@@ -4100,26 +4115,26 @@ var vs = J({
|
|
|
4100
4115
|
t.value = null;
|
|
4101
4116
|
}
|
|
4102
4117
|
};
|
|
4103
|
-
|
|
4118
|
+
q(() => [
|
|
4104
4119
|
t.value,
|
|
4105
4120
|
n.value,
|
|
4106
4121
|
a.value,
|
|
4107
4122
|
o.value
|
|
4108
4123
|
], ([e]) => {
|
|
4109
|
-
e &&
|
|
4110
|
-
}),
|
|
4124
|
+
e && J(P.schedule);
|
|
4125
|
+
}), jr(() => {
|
|
4111
4126
|
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);
|
|
4112
|
-
}),
|
|
4113
|
-
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(),
|
|
4127
|
+
}), Mr(() => {
|
|
4128
|
+
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(), Je(e.editor);
|
|
4114
4129
|
});
|
|
4115
|
-
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,
|
|
4130
|
+
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, te = (e, t) => {
|
|
4116
4131
|
if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
|
|
4117
4132
|
h.value = null;
|
|
4118
4133
|
return;
|
|
4119
4134
|
}
|
|
4120
4135
|
let n = t.getBoundingClientRect(), r = v.value.getBoundingClientRect();
|
|
4121
4136
|
h.value = n.left + n.width / 2 - r.left;
|
|
4122
|
-
},
|
|
4137
|
+
}, ne = () => {
|
|
4123
4138
|
let e = m.value;
|
|
4124
4139
|
if (!e || t.value !== null) return null;
|
|
4125
4140
|
let n = x.value.buttons[e];
|
|
@@ -4131,7 +4146,7 @@ var vs = J({
|
|
|
4131
4146
|
"data-active": L(e),
|
|
4132
4147
|
style: h.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${h.value}px` }
|
|
4133
4148
|
}, n) : null;
|
|
4134
|
-
},
|
|
4149
|
+
}, R = (n, r, i, a, o = !1, s) => U("button", {
|
|
4135
4150
|
type: "button",
|
|
4136
4151
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
4137
4152
|
"aria-label": r,
|
|
@@ -4145,16 +4160,16 @@ var vs = J({
|
|
|
4145
4160
|
"data-active": o || t.value === n,
|
|
4146
4161
|
"data-tooltip-active": m.value === n ? "true" : "false",
|
|
4147
4162
|
"data-testid": `markweave-floating-toolbar-button-${n}`,
|
|
4148
|
-
onBlur: () =>
|
|
4149
|
-
onFocus: (e) =>
|
|
4163
|
+
onBlur: () => te(null),
|
|
4164
|
+
onFocus: (e) => te(n, e.currentTarget),
|
|
4150
4165
|
onMousedown: $,
|
|
4151
|
-
onMouseenter: (e) =>
|
|
4152
|
-
onMouseleave: () =>
|
|
4166
|
+
onMouseenter: (e) => te(n, e.currentTarget),
|
|
4167
|
+
onMouseleave: () => te(null),
|
|
4153
4168
|
onClick: a
|
|
4154
|
-
}, 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" },
|
|
4169
|
+
}, 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" }, Ds(e.editor, e.messages)), Q(t.value === "block-type" ? oi : ii, 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" ? oi : ii, r)])] : [Q(i, r)]), re = () => U("span", {
|
|
4155
4170
|
class: "markweave-floating-toolbar-divider",
|
|
4156
4171
|
"aria-hidden": "true"
|
|
4157
|
-
}),
|
|
4172
|
+
}), z = (n, r, i) => U("section", {
|
|
4158
4173
|
class: "markweave-floating-toolbar-color-section",
|
|
4159
4174
|
"aria-label": n
|
|
4160
4175
|
}, [U("div", { class: "markweave-floating-toolbar-menu-title" }, n), U("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => U("button", {
|
|
@@ -4173,7 +4188,7 @@ var vs = J({
|
|
|
4173
4188
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
4174
4189
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
4175
4190
|
"aria-hidden": "true"
|
|
4176
|
-
})])))]),
|
|
4191
|
+
})])))]), B = () => {
|
|
4177
4192
|
if (t.value === "ask-ai") {
|
|
4178
4193
|
let t = (e, t, n, r) => U("button", {
|
|
4179
4194
|
type: "button",
|
|
@@ -4205,7 +4220,7 @@ var vs = J({
|
|
|
4205
4220
|
onClick: () => {
|
|
4206
4221
|
M();
|
|
4207
4222
|
}
|
|
4208
|
-
}, [Q(
|
|
4223
|
+
}, [Q(qr, e.messages.askAi.send)])]) : null;
|
|
4209
4224
|
return U("section", {
|
|
4210
4225
|
ref: y,
|
|
4211
4226
|
class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
|
|
@@ -4221,7 +4236,7 @@ var vs = J({
|
|
|
4221
4236
|
U("span", {
|
|
4222
4237
|
class: "markweave-ask-ai-sparkles",
|
|
4223
4238
|
"aria-hidden": "true"
|
|
4224
|
-
}, [Q(
|
|
4239
|
+
}, [Q(zi, "")]),
|
|
4225
4240
|
U("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
|
|
4226
4241
|
U("button", {
|
|
4227
4242
|
type: "button",
|
|
@@ -4229,17 +4244,17 @@ var vs = J({
|
|
|
4229
4244
|
"aria-label": e.messages.askAi.stop,
|
|
4230
4245
|
onMousedown: $,
|
|
4231
4246
|
onClick: () => {
|
|
4232
|
-
c.value?.abort(), k.cancel(),
|
|
4247
|
+
c.value?.abort(), k.cancel(), qe(e.editor), n.value = "input";
|
|
4233
4248
|
}
|
|
4234
|
-
}, [Q(
|
|
4249
|
+
}, [Q(Bi, e.messages.askAi.stop)])
|
|
4235
4250
|
]) : null,
|
|
4236
4251
|
n.value === "result" ? U("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
4237
4252
|
t(e.messages.askAi.retry, () => {
|
|
4238
4253
|
M(i.value);
|
|
4239
|
-
}, "markweave-ask-ai-retry",
|
|
4254
|
+
}, "markweave-ask-ai-retry", Ii),
|
|
4240
4255
|
U("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
4241
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
4242
|
-
t(e.messages.askAi.accept, N, "markweave-ask-ai-accept",
|
|
4256
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", ea),
|
|
4257
|
+
t(e.messages.askAi.accept, N, "markweave-ask-ai-accept", ni)
|
|
4243
4258
|
]) : null,
|
|
4244
4259
|
n.value === "error" || n.value === "conflict" ? U("div", {
|
|
4245
4260
|
class: "markweave-ask-ai-error",
|
|
@@ -4247,9 +4262,9 @@ var vs = J({
|
|
|
4247
4262
|
}, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, U("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
4248
4263
|
n.value === "error" ? t(e.messages.askAi.retry, () => {
|
|
4249
4264
|
M(i.value);
|
|
4250
|
-
}, "markweave-ask-ai-retry",
|
|
4265
|
+
}, "markweave-ask-ai-retry", Ii) : null,
|
|
4251
4266
|
U("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
4252
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
4267
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", ea)
|
|
4253
4268
|
])]) : null
|
|
4254
4269
|
]);
|
|
4255
4270
|
}
|
|
@@ -4263,7 +4278,7 @@ var vs = J({
|
|
|
4263
4278
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
4264
4279
|
onMousedown: $,
|
|
4265
4280
|
onClick: () => {
|
|
4266
|
-
|
|
4281
|
+
Te(e.editor, n), t.value = null;
|
|
4267
4282
|
}
|
|
4268
4283
|
}, [U("span", { class: "markweave-floating-toolbar-menu-icon" }, [Q(i, r)]), U("span", null, r)]))]) : t.value === "link" ? U("form", {
|
|
4269
4284
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
@@ -4287,7 +4302,7 @@ var vs = J({
|
|
|
4287
4302
|
"aria-label": x.value.applyLink,
|
|
4288
4303
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
4289
4304
|
onMousedown: $
|
|
4290
|
-
}, [Q(
|
|
4305
|
+
}, [Q(li, x.value.applyLink)]),
|
|
4291
4306
|
U("span", {
|
|
4292
4307
|
class: "markweave-floating-toolbar-link-divider",
|
|
4293
4308
|
"aria-hidden": "true"
|
|
@@ -4298,20 +4313,20 @@ var vs = J({
|
|
|
4298
4313
|
"aria-label": x.value.openLink,
|
|
4299
4314
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
4300
4315
|
onMousedown: $,
|
|
4301
|
-
onClick: () =>
|
|
4302
|
-
}, [Q(
|
|
4316
|
+
onClick: () => Ss(p.value)
|
|
4317
|
+
}, [Q(pi, x.value.openLink)]),
|
|
4303
4318
|
U("button", {
|
|
4304
4319
|
type: "button",
|
|
4305
4320
|
"aria-label": x.value.removeLink,
|
|
4306
4321
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
4307
4322
|
onMousedown: $,
|
|
4308
4323
|
onClick: D
|
|
4309
|
-
}, [Q(
|
|
4324
|
+
}, [Q(Yi, x.value.removeLink)])
|
|
4310
4325
|
])]) : t.value === "color" ? U("div", {
|
|
4311
4326
|
ref: y,
|
|
4312
4327
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
4313
4328
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
4314
|
-
}, [
|
|
4329
|
+
}, [z(x.value.textColorTitle, "text", C.value), z(x.value.highlightColorTitle, "highlight", w.value)]) : t.value === "more" ? U("div", {
|
|
4315
4330
|
ref: y,
|
|
4316
4331
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
4317
4332
|
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
@@ -4331,25 +4346,25 @@ var vs = J({
|
|
|
4331
4346
|
m.value = null;
|
|
4332
4347
|
},
|
|
4333
4348
|
onClick: () => {
|
|
4334
|
-
|
|
4349
|
+
we(e.editor, n), t.value = null;
|
|
4335
4350
|
}
|
|
4336
|
-
}, [Q(
|
|
4351
|
+
}, [Q(Cs[n], x.value.moreActions[n])]), m.value === n ? U("div", {
|
|
4337
4352
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
4338
4353
|
role: "tooltip"
|
|
4339
4354
|
}, x.value.moreActions[n]) : null]))) : null;
|
|
4340
4355
|
};
|
|
4341
|
-
return () => U(
|
|
4356
|
+
return () => U(hs, {
|
|
4342
4357
|
editor: e.editor,
|
|
4343
4358
|
shouldShow: ({ editor: e }) => {
|
|
4344
|
-
let t =
|
|
4345
|
-
return
|
|
4359
|
+
let t = Qe(e);
|
|
4360
|
+
return Re(Ie(e), {
|
|
4346
4361
|
editable: e.isEditable,
|
|
4347
|
-
hasAskAiPreview:
|
|
4362
|
+
hasAskAiPreview: et(e.state),
|
|
4348
4363
|
hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
|
|
4349
4364
|
});
|
|
4350
4365
|
},
|
|
4351
4366
|
getReferencedVirtualElement: () => {
|
|
4352
|
-
let t =
|
|
4367
|
+
let t = Qe(e.editor)?.target.kind === "table" ? $e(e.editor) : null;
|
|
4353
4368
|
return t ? {
|
|
4354
4369
|
getBoundingClientRect: () => new DOMRect(t.left, t.top, t.width, t.height),
|
|
4355
4370
|
getClientRects: () => [new DOMRect(t.left, t.top, t.width, t.height)]
|
|
@@ -4367,25 +4382,25 @@ var vs = J({
|
|
|
4367
4382
|
class: "markweave-floating-toolbar-content",
|
|
4368
4383
|
"data-menu": t.value ?? "none"
|
|
4369
4384
|
}, [
|
|
4370
|
-
f.value &&
|
|
4371
|
-
f.value &&
|
|
4372
|
-
|
|
4385
|
+
f.value && tt(e.editor) ? R("ask-ai", x.value.buttons["ask-ai"], zi, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
|
|
4386
|
+
f.value && tt(e.editor) ? re() : null,
|
|
4387
|
+
R("block-type", x.value.buttons["block-type"], Xi, () => O("block-type"), t.value === "block-type"),
|
|
4388
|
+
re(),
|
|
4389
|
+
R("bold", x.value.buttons.bold, $r, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
4390
|
+
R("italic", x.value.buttons.italic, Si, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
4391
|
+
R("underline", x.value.buttons.underline, Zi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
4392
|
+
R("strike", x.value.buttons.strike, Hi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
4393
|
+
R("inline-code", x.value.buttons["inline-code"], ci, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
4394
|
+
re(),
|
|
4395
|
+
R("link", x.value.buttons.link, wi, () => O("link"), e.editor.isActive("link")),
|
|
4396
|
+
R("color", x.value.buttons.color, Xi, () => O("color"), t.value === "color"),
|
|
4397
|
+
re(),
|
|
4398
|
+
R("more", x.value.buttons.more, ki, () => O("more"), t.value === "more"),
|
|
4373
4399
|
B(),
|
|
4374
|
-
|
|
4375
|
-
z("italic", x.value.buttons.italic, pi, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
4376
|
-
z("underline", x.value.buttons.underline, Hi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
4377
|
-
z("strike", x.value.buttons.strike, Ni, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
4378
|
-
z("inline-code", x.value.buttons["inline-code"], $r, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
4379
|
-
B(),
|
|
4380
|
-
z("link", x.value.buttons.link, hi, () => O("link"), e.editor.isActive("link")),
|
|
4381
|
-
z("color", x.value.buttons.color, Vi, () => O("color"), t.value === "color"),
|
|
4382
|
-
B(),
|
|
4383
|
-
z("more", x.value.buttons.more, bi, () => O("more"), t.value === "more"),
|
|
4384
|
-
H(),
|
|
4385
|
-
te()
|
|
4400
|
+
ne()
|
|
4386
4401
|
])]) });
|
|
4387
4402
|
}
|
|
4388
|
-
}),
|
|
4403
|
+
}), ks = Y({
|
|
4389
4404
|
name: "MarkweaveVueMathEditorPopover",
|
|
4390
4405
|
props: {
|
|
4391
4406
|
editor: {
|
|
@@ -4406,17 +4421,17 @@ var vs = J({
|
|
|
4406
4421
|
}
|
|
4407
4422
|
},
|
|
4408
4423
|
setup(e) {
|
|
4409
|
-
let t = W(e.target.latex), n =
|
|
4424
|
+
let t = W(e.target.latex), n = G(null), r = W(null), i = W(null), a = G(rn(e.editor, e.target)), o = K(() => t.value === e.target.latex && a.value ? {
|
|
4410
4425
|
html: a.value,
|
|
4411
4426
|
error: !1
|
|
4412
|
-
} :
|
|
4427
|
+
} : cn(t.value, e.target.kind, e.editor)), s = K(() => t.value.trim().length > 0), c = K(() => e.messages.math), l = K(() => nn(e.editor, e.target) ?? 1), u = () => {
|
|
4413
4428
|
if (typeof window > "u") return;
|
|
4414
|
-
let r =
|
|
4429
|
+
let r = tn(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4415
4430
|
if (!r || !i) {
|
|
4416
4431
|
e.onClose();
|
|
4417
4432
|
return;
|
|
4418
4433
|
}
|
|
4419
|
-
n.value =
|
|
4434
|
+
n.value = en({
|
|
4420
4435
|
anchorRect: r,
|
|
4421
4436
|
frameRect: i,
|
|
4422
4437
|
kind: e.target.kind,
|
|
@@ -4425,10 +4440,10 @@ var vs = J({
|
|
|
4425
4440
|
viewportWidth: window.innerWidth
|
|
4426
4441
|
});
|
|
4427
4442
|
}, d = () => {
|
|
4428
|
-
s.value &&
|
|
4443
|
+
s.value && $t(e.editor, e.target, t.value) && e.onClose();
|
|
4429
4444
|
}, f = (t) => {
|
|
4430
4445
|
if (t.key === "Escape") {
|
|
4431
|
-
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
4446
|
+
t.preventDefault(), e.onClose(), e.editor.commands.focus(void 0, { scrollIntoView: !1 });
|
|
4432
4447
|
return;
|
|
4433
4448
|
}
|
|
4434
4449
|
t.key === "Enter" && (e.target.kind === "inline" || t.metaKey || t.ctrlKey) && (t.preventDefault(), d());
|
|
@@ -4436,14 +4451,14 @@ var vs = J({
|
|
|
4436
4451
|
let n = t.target;
|
|
4437
4452
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
4438
4453
|
};
|
|
4439
|
-
return
|
|
4440
|
-
t.value = e.target.latex, a.value =
|
|
4441
|
-
}),
|
|
4442
|
-
|
|
4454
|
+
return q(() => [e.target.pos, e.target.latex], () => {
|
|
4455
|
+
t.value = e.target.latex, a.value = rn(e.editor, e.target), J(u);
|
|
4456
|
+
}), jr(() => {
|
|
4457
|
+
ln(e.editor, e.target, !0), u(), J(() => {
|
|
4443
4458
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
4444
4459
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
4445
|
-
}),
|
|
4446
|
-
|
|
4460
|
+
}), Mr(() => {
|
|
4461
|
+
ln(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
4447
4462
|
}), () => {
|
|
4448
4463
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
4449
4464
|
ref: i,
|
|
@@ -4504,14 +4519,14 @@ var vs = J({
|
|
|
4504
4519
|
}, [
|
|
4505
4520
|
U("div", { class: "markweave-math-block-toolbar" }, [
|
|
4506
4521
|
U("span", null, c.value.label),
|
|
4507
|
-
Q(
|
|
4522
|
+
Q(ci, c.value.label, 15, 1.75),
|
|
4508
4523
|
U("button", {
|
|
4509
4524
|
type: "submit",
|
|
4510
4525
|
title: c.value.apply,
|
|
4511
4526
|
"aria-label": c.value.apply,
|
|
4512
4527
|
disabled: !s.value,
|
|
4513
4528
|
"data-testid": "markweave-math-editor-apply"
|
|
4514
|
-
}, [Q(
|
|
4529
|
+
}, [Q(ri, c.value.apply, 16, 2)])
|
|
4515
4530
|
]),
|
|
4516
4531
|
U("label", {
|
|
4517
4532
|
class: "markweave-math-block-source",
|
|
@@ -4534,7 +4549,7 @@ var vs = J({
|
|
|
4534
4549
|
]);
|
|
4535
4550
|
};
|
|
4536
4551
|
}
|
|
4537
|
-
}),
|
|
4552
|
+
}), As = Y({
|
|
4538
4553
|
name: "MarkweaveVueSlashCommandMenu",
|
|
4539
4554
|
props: {
|
|
4540
4555
|
commands: {
|
|
@@ -4575,7 +4590,7 @@ var vs = J({
|
|
|
4575
4590
|
}
|
|
4576
4591
|
},
|
|
4577
4592
|
setup(e) {
|
|
4578
|
-
let t = W(""), n = W(null), r = W(null), i = W(!1), a = W(""), o = W(0), s = W(null), c =
|
|
4593
|
+
let t = W(""), n = W(null), r = W(null), i = W(!1), a = W(""), o = W(0), s = W(null), c = K(() => {
|
|
4579
4594
|
let t = a.value.trim().toLowerCase();
|
|
4580
4595
|
return (t ? e.messages.slash.emojiItems.filter((e) => [
|
|
4581
4596
|
e.emoji,
|
|
@@ -4583,16 +4598,16 @@ var vs = J({
|
|
|
4583
4598
|
...e.terms
|
|
4584
4599
|
].join(" ").toLowerCase().includes(t)) : e.messages.slash.emojiItems).slice(0, 12);
|
|
4585
4600
|
});
|
|
4586
|
-
|
|
4601
|
+
q(() => [
|
|
4587
4602
|
e.state.name,
|
|
4588
4603
|
e.state.activeIndex,
|
|
4589
4604
|
e.commands.length,
|
|
4590
4605
|
e.inputCommand?.id ?? null
|
|
4591
4606
|
], async () => {
|
|
4592
4607
|
if (e.state.name !== "keyboard-selecting" || e.inputCommand || !e.commands.length) return;
|
|
4593
|
-
await
|
|
4608
|
+
await J();
|
|
4594
4609
|
let t = s.value, n = t?.querySelector("[data-active=\"true\"]");
|
|
4595
|
-
t && n &&
|
|
4610
|
+
t && n && xn(t, n);
|
|
4596
4611
|
}, { flush: "post" });
|
|
4597
4612
|
let l = async () => {
|
|
4598
4613
|
if (e.inputCommand) {
|
|
@@ -4609,13 +4624,13 @@ var vs = J({
|
|
|
4609
4624
|
} : {
|
|
4610
4625
|
kind: i,
|
|
4611
4626
|
trigger: i === "attachment" ? "attachment-insert" : "slash-command",
|
|
4612
|
-
source:
|
|
4627
|
+
source: re(t.value)
|
|
4613
4628
|
};
|
|
4614
4629
|
if (!n.value && !t.value.trim()) {
|
|
4615
4630
|
r.value = e.messages.slash.uploadRequiredError;
|
|
4616
4631
|
return;
|
|
4617
4632
|
}
|
|
4618
|
-
let o = await
|
|
4633
|
+
let o = await B(a, e.onUpload);
|
|
4619
4634
|
e.onSelect(e.inputCommand, { uploadResult: o }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
4620
4635
|
} catch (t) {
|
|
4621
4636
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -4736,7 +4751,7 @@ var vs = J({
|
|
|
4736
4751
|
class: "markweave-slash-group",
|
|
4737
4752
|
"aria-label": t.group
|
|
4738
4753
|
}, [U("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
4739
|
-
let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i =
|
|
4754
|
+
let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i = yn(t);
|
|
4740
4755
|
return U("button", {
|
|
4741
4756
|
key: t.id,
|
|
4742
4757
|
id: `markweave-slash-command-option-${n}`,
|
|
@@ -4747,7 +4762,7 @@ var vs = J({
|
|
|
4747
4762
|
"data-active": r,
|
|
4748
4763
|
"data-disabled": t.disabled ? "true" : "false",
|
|
4749
4764
|
"data-execution-kind": t.executionKind,
|
|
4750
|
-
"data-text-icon-length":
|
|
4765
|
+
"data-text-icon-length": vn(t.icon) ?? void 0,
|
|
4751
4766
|
"data-testid": `markweave-slash-command-${t.id}`,
|
|
4752
4767
|
title: t.disabledReason,
|
|
4753
4768
|
onMousedown: $,
|
|
@@ -4761,7 +4776,7 @@ var vs = J({
|
|
|
4761
4776
|
}
|
|
4762
4777
|
}
|
|
4763
4778
|
}, [
|
|
4764
|
-
|
|
4779
|
+
Ts(t.icon),
|
|
4765
4780
|
U("span", null, t.label),
|
|
4766
4781
|
t.disabledReason ? U("small", null, t.disabledReason) : null
|
|
4767
4782
|
]);
|
|
@@ -4777,34 +4792,34 @@ var vs = J({
|
|
|
4777
4792
|
}, e.errorMessage ?? "")]);
|
|
4778
4793
|
};
|
|
4779
4794
|
}
|
|
4780
|
-
}),
|
|
4781
|
-
"ask-ai":
|
|
4782
|
-
"move-left":
|
|
4783
|
-
"move-right":
|
|
4784
|
-
"move-up":
|
|
4785
|
-
"move-down":
|
|
4786
|
-
"insert-left":
|
|
4787
|
-
"insert-right":
|
|
4788
|
-
"insert-above":
|
|
4789
|
-
"insert-below":
|
|
4790
|
-
"sort-asc":
|
|
4791
|
-
"sort-desc":
|
|
4792
|
-
color:
|
|
4793
|
-
alignment:
|
|
4794
|
-
clear:
|
|
4795
|
-
duplicate:
|
|
4796
|
-
copy:
|
|
4797
|
-
merge:
|
|
4798
|
-
split:
|
|
4799
|
-
delete:
|
|
4800
|
-
},
|
|
4801
|
-
left:
|
|
4802
|
-
center:
|
|
4803
|
-
right:
|
|
4804
|
-
top:
|
|
4805
|
-
middle:
|
|
4806
|
-
bottom:
|
|
4807
|
-
},
|
|
4795
|
+
}), js = {
|
|
4796
|
+
"ask-ai": zi,
|
|
4797
|
+
"move-left": Gr,
|
|
4798
|
+
"move-right": Kr,
|
|
4799
|
+
"move-up": qr,
|
|
4800
|
+
"move-down": Ur,
|
|
4801
|
+
"insert-left": Qr,
|
|
4802
|
+
"insert-right": Zr,
|
|
4803
|
+
"insert-above": Xr,
|
|
4804
|
+
"insert-below": Yr,
|
|
4805
|
+
"sort-asc": Wr,
|
|
4806
|
+
"sort-desc": Jr,
|
|
4807
|
+
color: Ai,
|
|
4808
|
+
alignment: Lr,
|
|
4809
|
+
clear: Vi,
|
|
4810
|
+
duplicate: ui,
|
|
4811
|
+
copy: ui,
|
|
4812
|
+
merge: Ki,
|
|
4813
|
+
split: qi,
|
|
4814
|
+
delete: Yi
|
|
4815
|
+
}, Ms = {
|
|
4816
|
+
left: Lr,
|
|
4817
|
+
center: Fr,
|
|
4818
|
+
right: Rr,
|
|
4819
|
+
top: Vr,
|
|
4820
|
+
middle: zr,
|
|
4821
|
+
bottom: Br
|
|
4822
|
+
}, Ns = Y({
|
|
4808
4823
|
name: "MarkweaveVueTableControls",
|
|
4809
4824
|
props: {
|
|
4810
4825
|
editor: {
|
|
@@ -4841,12 +4856,12 @@ var vs = J({
|
|
|
4841
4856
|
}
|
|
4842
4857
|
},
|
|
4843
4858
|
setup(e) {
|
|
4844
|
-
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 =
|
|
4859
|
+
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 = K(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = () => In(e.editor.state, "structure"), T = K(() => e.active ? zn(e.editor.state) : gs), E = K(() => ir(e.editor, e.interactionState, "row", T.value.activeCellPos)), D = K(() => ir(e.editor, e.interactionState, "column", T.value.activeCellPos)), O = K(() => er(e.editor)), k = K(() => (O.value, T.value.active && cr(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), A = K(() => t.value ? cr(e.editor, t.value, { askAiEnabled: C.value }) : []), j = () => {
|
|
4845
4860
|
b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
|
|
4846
4861
|
}, M = (e) => {
|
|
4847
4862
|
j(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
|
|
4848
4863
|
d.value = null, b = null;
|
|
4849
|
-
},
|
|
4864
|
+
}, mr));
|
|
4850
4865
|
}, N = () => {
|
|
4851
4866
|
if (!e.active) {
|
|
4852
4867
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, M(null);
|
|
@@ -4857,26 +4872,26 @@ var vs = J({
|
|
|
4857
4872
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
|
|
4858
4873
|
return;
|
|
4859
4874
|
}
|
|
4860
|
-
let l = n.getBoundingClientRect(), u = E.value ?
|
|
4861
|
-
u ? i.value =
|
|
4875
|
+
let l = n.getBoundingClientRect(), u = E.value ? rr(e.editor, E.value) : null, d = D.value ? rr(e.editor, D.value) : null, f = k.value ? lr(e.editor) : null, p = $n(e.editor)?.getBoundingClientRect() ?? null;
|
|
4876
|
+
u ? i.value = Jn({
|
|
4862
4877
|
targetRect: u,
|
|
4863
4878
|
frameRect: l,
|
|
4864
4879
|
kind: "row"
|
|
4865
|
-
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value =
|
|
4880
|
+
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Jn({
|
|
4866
4881
|
targetRect: d,
|
|
4867
4882
|
frameRect: l,
|
|
4868
4883
|
kind: "column"
|
|
4869
|
-
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value =
|
|
4884
|
+
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Jn({
|
|
4870
4885
|
targetRect: f,
|
|
4871
4886
|
frameRect: l,
|
|
4872
4887
|
kind: "selection"
|
|
4873
4888
|
}) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
|
|
4874
4889
|
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);
|
|
4875
|
-
s.value = p && m ?
|
|
4890
|
+
s.value = p && m ? Yn({
|
|
4876
4891
|
tableRect: p,
|
|
4877
4892
|
frameRect: l,
|
|
4878
4893
|
kind: "row"
|
|
4879
|
-
}) : null, c.value = p && h ?
|
|
4894
|
+
}) : null, c.value = p && h ? Yn({
|
|
4880
4895
|
tableRect: p,
|
|
4881
4896
|
frameRect: l,
|
|
4882
4897
|
kind: "column"
|
|
@@ -4891,16 +4906,16 @@ var vs = J({
|
|
|
4891
4906
|
l.value = null;
|
|
4892
4907
|
return;
|
|
4893
4908
|
}
|
|
4894
|
-
let a = i.getBoundingClientRect(), o = t.value === "row" ?
|
|
4909
|
+
let a = i.getBoundingClientRect(), o = t.value === "row" ? $n(e.editor)?.getBoundingClientRect() : null, s = o ? {
|
|
4895
4910
|
left: a.left,
|
|
4896
4911
|
top: o.top,
|
|
4897
4912
|
width: a.width,
|
|
4898
4913
|
height: a.height
|
|
4899
4914
|
} : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
|
|
4900
|
-
l.value =
|
|
4915
|
+
l.value = Kn({
|
|
4901
4916
|
anchorRect: s,
|
|
4902
4917
|
frameRect: c,
|
|
4903
|
-
boundaryRect:
|
|
4918
|
+
boundaryRect: ar(n),
|
|
4904
4919
|
menuSize: {
|
|
4905
4920
|
width: u.width || 254,
|
|
4906
4921
|
height: f || u.height || 410
|
|
@@ -4918,10 +4933,10 @@ var vs = J({
|
|
|
4918
4933
|
return;
|
|
4919
4934
|
}
|
|
4920
4935
|
let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
|
|
4921
|
-
u.value =
|
|
4936
|
+
u.value = qn({
|
|
4922
4937
|
triggerRect: i.getBoundingClientRect(),
|
|
4923
4938
|
parentMenuRect: _.value.getBoundingClientRect(),
|
|
4924
|
-
boundaryRect:
|
|
4939
|
+
boundaryRect: ar(r),
|
|
4925
4940
|
submenuSize: {
|
|
4926
4941
|
width: a.width || 238,
|
|
4927
4942
|
height: o || 410
|
|
@@ -4930,35 +4945,35 @@ var vs = J({
|
|
|
4930
4945
|
}, I = () => {
|
|
4931
4946
|
N(), P(), F();
|
|
4932
4947
|
}, ee = () => {
|
|
4933
|
-
|
|
4948
|
+
J(I);
|
|
4934
4949
|
}, L = (e, i) => {
|
|
4935
4950
|
let a = t.value === e && r.value === i;
|
|
4936
4951
|
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, ee();
|
|
4937
|
-
},
|
|
4938
|
-
e.editor.view.dispatch(
|
|
4939
|
-
},
|
|
4952
|
+
}, te = () => {
|
|
4953
|
+
e.editor.view.dispatch(Fn(e.editor.state.tr, null));
|
|
4954
|
+
}, ne = (t, n) => {
|
|
4940
4955
|
let r = e.interactionState.hoverCellPos ?? T.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
4941
|
-
r !== null &&
|
|
4942
|
-
},
|
|
4943
|
-
|
|
4944
|
-
},
|
|
4956
|
+
r !== null && fr(e.editor, r, t, { visualIndex: i }), L(t, n);
|
|
4957
|
+
}, R = () => {
|
|
4958
|
+
te(), L("selection", "selection-edge");
|
|
4959
|
+
}, re = (r = !1) => {
|
|
4945
4960
|
t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
|
|
4946
|
-
},
|
|
4947
|
-
let i = await
|
|
4961
|
+
}, z = async (n, r) => {
|
|
4962
|
+
let i = await Zn({
|
|
4948
4963
|
editor: e.editor,
|
|
4949
4964
|
commandId: n,
|
|
4950
4965
|
menu: r ?? t.value ?? "selection",
|
|
4951
4966
|
messages: e.messages
|
|
4952
4967
|
});
|
|
4953
4968
|
return i.copyFeedback ? (M(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : M(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
4954
|
-
},
|
|
4955
|
-
C.value && (
|
|
4956
|
-
},
|
|
4969
|
+
}, B = (t) => {
|
|
4970
|
+
C.value && (at(e.editor, t), re(!1));
|
|
4971
|
+
}, ie = (e) => {
|
|
4957
4972
|
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, ee());
|
|
4958
|
-
},
|
|
4973
|
+
}, ae = (t) => {
|
|
4959
4974
|
let n = t === "row" ? E.value : D.value, r = e.interactionState.hoverCellPos ?? T.value.activeCellPos;
|
|
4960
|
-
!n || r === null ||
|
|
4961
|
-
},
|
|
4975
|
+
!n || r === null || vr(e.editor, r, t, { visualIndex: n.index }) && z(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
4976
|
+
}, oe = (e, t, n) => {
|
|
4962
4977
|
if (!w()) {
|
|
4963
4978
|
n.preventDefault();
|
|
4964
4979
|
return;
|
|
@@ -4967,37 +4982,37 @@ var vs = J({
|
|
|
4967
4982
|
axis: e,
|
|
4968
4983
|
index: t
|
|
4969
4984
|
}, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
4970
|
-
},
|
|
4985
|
+
}, V = (t) => {
|
|
4971
4986
|
if (!x) return;
|
|
4972
|
-
let n =
|
|
4987
|
+
let n = tr(e.editor, x.axis, t.clientX, t.clientY);
|
|
4973
4988
|
n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
4974
|
-
},
|
|
4989
|
+
}, se = (t) => {
|
|
4975
4990
|
let n = x;
|
|
4976
4991
|
if (!n) return;
|
|
4977
|
-
let r =
|
|
4978
|
-
t.preventDefault(), x = null, S = null, r !== null &&
|
|
4979
|
-
},
|
|
4992
|
+
let r = tr(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
4993
|
+
t.preventDefault(), x = null, S = null, r !== null && dr(e.editor, n.axis, n.index, r);
|
|
4994
|
+
}, ce = K(() => (f.value, t.value === "row" || t.value === "column" ? nr(e.editor, t.value) : null)), le = (e) => {
|
|
4980
4995
|
if (!(!t.value || e.key !== "Escape")) {
|
|
4981
4996
|
if (n.value) {
|
|
4982
4997
|
n.value = null;
|
|
4983
4998
|
return;
|
|
4984
4999
|
}
|
|
4985
|
-
|
|
5000
|
+
re(!0);
|
|
4986
5001
|
}
|
|
4987
|
-
},
|
|
5002
|
+
}, H = (e) => {
|
|
4988
5003
|
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
4989
5004
|
let t = e.currentTarget;
|
|
4990
5005
|
if (!(t instanceof HTMLElement)) return;
|
|
4991
5006
|
let n = t.classList.contains("markweave-table-menu") ? t.querySelector(":scope > .markweave-table-menu-scroll") ?? t : t, r = Array.from(n.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), i = r.indexOf(document.activeElement), a = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? 0 : Math.min(r.length - 1, Math.max(0, i + a));
|
|
4992
5007
|
e.preventDefault(), e.stopPropagation(), r[o]?.focus();
|
|
4993
5008
|
}, ue = (e) => {
|
|
4994
|
-
t.value && (e.target instanceof Node && p.value?.contains(e.target) ||
|
|
5009
|
+
t.value && (e.target instanceof Node && p.value?.contains(e.target) || re());
|
|
4995
5010
|
};
|
|
4996
|
-
|
|
4997
|
-
I(), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), document.addEventListener("keydown",
|
|
4998
|
-
}),
|
|
4999
|
-
j(), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), document.removeEventListener("keydown",
|
|
5000
|
-
}),
|
|
5011
|
+
jr(() => {
|
|
5012
|
+
I(), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), document.addEventListener("keydown", le), document.addEventListener("mousedown", ue), document.addEventListener("dragover", V), document.addEventListener("drop", se);
|
|
5013
|
+
}), Mr(() => {
|
|
5014
|
+
j(), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), document.removeEventListener("keydown", le), document.removeEventListener("mousedown", ue), document.removeEventListener("dragover", V), document.removeEventListener("drop", se);
|
|
5015
|
+
}), q(() => [
|
|
5001
5016
|
e.active,
|
|
5002
5017
|
T.value.activeCellPos,
|
|
5003
5018
|
T.value.selectionFrom,
|
|
@@ -5012,7 +5027,7 @@ var vs = J({
|
|
|
5012
5027
|
let de = () => {
|
|
5013
5028
|
if (!t.value) return null;
|
|
5014
5029
|
let r = A.value.map((r, i) => {
|
|
5015
|
-
let a =
|
|
5030
|
+
let a = or(r), o = i === 0 ? a : or(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 && Ke(e.editor, c) : Xn(e.editor, r.commandId), u = sr(r, e.messages), d = js[r.icon];
|
|
5016
5031
|
return U("button", {
|
|
5017
5032
|
key: `${r.id}-${i}`,
|
|
5018
5033
|
type: "button",
|
|
@@ -5029,7 +5044,7 @@ var vs = J({
|
|
|
5029
5044
|
"data-submenu-trigger": r.submenuId ?? void 0,
|
|
5030
5045
|
"data-testid": r.commandId ? `markweave-table-menu-command-${r.commandId}` : r.submenuId ? `markweave-table-menu-submenu-${r.submenuId}` : "markweave-table-menu-command-edit-with-ai",
|
|
5031
5046
|
onMousedown: (e) => {
|
|
5032
|
-
$(e), l && r.id === "edit-with-ai" &&
|
|
5047
|
+
$(e), l && r.id === "edit-with-ai" && B(c);
|
|
5033
5048
|
},
|
|
5034
5049
|
onMouseenter: () => {
|
|
5035
5050
|
n.value = r.submenuId;
|
|
@@ -5041,10 +5056,10 @@ var vs = J({
|
|
|
5041
5056
|
return;
|
|
5042
5057
|
}
|
|
5043
5058
|
if (r.commandId === null) {
|
|
5044
|
-
e.detail === 0 &&
|
|
5059
|
+
e.detail === 0 && B(c);
|
|
5045
5060
|
return;
|
|
5046
5061
|
}
|
|
5047
|
-
|
|
5062
|
+
z(r.commandId).finally(() => re());
|
|
5048
5063
|
}
|
|
5049
5064
|
}
|
|
5050
5065
|
}, [
|
|
@@ -5056,7 +5071,7 @@ var vs = J({
|
|
|
5056
5071
|
strokeWidth: 1.8
|
|
5057
5072
|
})]),
|
|
5058
5073
|
U("span", { class: "markweave-table-menu-item-label" }, u),
|
|
5059
|
-
r.submenuId ? U(
|
|
5074
|
+
r.submenuId ? U(ai, {
|
|
5060
5075
|
class: "markweave-table-menu-chevron",
|
|
5061
5076
|
size: 16,
|
|
5062
5077
|
"aria-hidden": "true"
|
|
@@ -5080,18 +5095,18 @@ var vs = J({
|
|
|
5080
5095
|
top: `${u.value.top}px`,
|
|
5081
5096
|
maxHeight: `${u.value.maxHeight}px`
|
|
5082
5097
|
} : void 0,
|
|
5083
|
-
onKeydown:
|
|
5098
|
+
onKeydown: H
|
|
5084
5099
|
}, [
|
|
5085
5100
|
U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
5086
|
-
...
|
|
5101
|
+
...pr.map((t) => U("button", {
|
|
5087
5102
|
key: `text-${t.id}`,
|
|
5088
5103
|
type: "button",
|
|
5089
5104
|
role: "menuitemradio",
|
|
5090
|
-
"aria-checked":
|
|
5091
|
-
"data-active":
|
|
5105
|
+
"aria-checked": ce.value?.textColorId === t.id,
|
|
5106
|
+
"data-active": ce.value?.textColorId === t.id ? "true" : "false",
|
|
5092
5107
|
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
5093
5108
|
onMousedown: $,
|
|
5094
|
-
onClick: () =>
|
|
5109
|
+
onClick: () => ie((n) => Gn(e.editor, n, t.id))
|
|
5095
5110
|
}, [U("span", {
|
|
5096
5111
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
5097
5112
|
"aria-hidden": "true",
|
|
@@ -5099,15 +5114,15 @@ var vs = J({
|
|
|
5099
5114
|
}), U("span", null, e.messages.table.colors[t.id].text)])),
|
|
5100
5115
|
U("div", { class: "markweave-table-submenu-separator" }),
|
|
5101
5116
|
U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
5102
|
-
...
|
|
5117
|
+
...pr.map((t) => U("button", {
|
|
5103
5118
|
key: `background-${t.id}`,
|
|
5104
5119
|
type: "button",
|
|
5105
5120
|
role: "menuitemradio",
|
|
5106
|
-
"aria-checked":
|
|
5107
|
-
"data-active":
|
|
5121
|
+
"aria-checked": ce.value?.backgroundColorId === t.id,
|
|
5122
|
+
"data-active": ce.value?.backgroundColorId === t.id ? "true" : "false",
|
|
5108
5123
|
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
5109
5124
|
onMousedown: $,
|
|
5110
|
-
onClick: () =>
|
|
5125
|
+
onClick: () => ie((n) => Wn(e.editor, n, t.id))
|
|
5111
5126
|
}, [U("span", {
|
|
5112
5127
|
class: "markweave-table-color-swatch",
|
|
5113
5128
|
"aria-hidden": "true",
|
|
@@ -5115,7 +5130,7 @@ var vs = J({
|
|
|
5115
5130
|
}), U("span", null, e.messages.table.colors[t.id].background)]))
|
|
5116
5131
|
])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
|
|
5117
5132
|
let t = (t, n) => {
|
|
5118
|
-
let r =
|
|
5133
|
+
let r = Ms[t];
|
|
5119
5134
|
return U("button", {
|
|
5120
5135
|
key: t,
|
|
5121
5136
|
type: "button",
|
|
@@ -5124,7 +5139,7 @@ var vs = J({
|
|
|
5124
5139
|
"data-active": n ? "true" : "false",
|
|
5125
5140
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
5126
5141
|
onMousedown: $,
|
|
5127
|
-
onClick: () =>
|
|
5142
|
+
onClick: () => ie((n) => Un(e.editor, n, t))
|
|
5128
5143
|
}, [U(r, {
|
|
5129
5144
|
size: 18,
|
|
5130
5145
|
strokeWidth: 1.8,
|
|
@@ -5144,18 +5159,18 @@ var vs = J({
|
|
|
5144
5159
|
top: `${u.value.top}px`,
|
|
5145
5160
|
maxHeight: `${u.value.maxHeight}px`
|
|
5146
5161
|
} : void 0,
|
|
5147
|
-
onKeydown:
|
|
5162
|
+
onKeydown: H
|
|
5148
5163
|
}, [
|
|
5149
|
-
...
|
|
5164
|
+
...hr.map((e) => t(e, ce.value?.textAlign === e)),
|
|
5150
5165
|
U("div", { class: "markweave-table-submenu-separator" }),
|
|
5151
|
-
...
|
|
5166
|
+
..._r.map((e) => t(e, ce.value?.verticalAlign === e))
|
|
5152
5167
|
]));
|
|
5153
5168
|
}
|
|
5154
5169
|
return U("div", {
|
|
5155
5170
|
ref: _,
|
|
5156
5171
|
class: "markweave-table-menu",
|
|
5157
5172
|
role: "menu",
|
|
5158
|
-
"aria-label":
|
|
5173
|
+
"aria-label": gr(t.value, e.messages),
|
|
5159
5174
|
"data-testid": "markweave-table-menu",
|
|
5160
5175
|
"data-positioned": l.value ? "true" : "false",
|
|
5161
5176
|
"data-placement": l.value?.placement,
|
|
@@ -5164,7 +5179,7 @@ var vs = J({
|
|
|
5164
5179
|
left: `${l.value.left}px`,
|
|
5165
5180
|
top: `${l.value.top}px`
|
|
5166
5181
|
} : void 0,
|
|
5167
|
-
onKeydown:
|
|
5182
|
+
onKeydown: H
|
|
5168
5183
|
}, i);
|
|
5169
5184
|
};
|
|
5170
5185
|
return () => e.active ? U("div", {
|
|
@@ -5174,7 +5189,7 @@ var vs = J({
|
|
|
5174
5189
|
"aria-label": e.messages.table.controlsAriaLabel,
|
|
5175
5190
|
"data-open-menu": t.value ?? "none",
|
|
5176
5191
|
"data-positioned": i.value || a.value || o.value ? "true" : "false",
|
|
5177
|
-
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(
|
|
5192
|
+
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(Hn, { type: "clear-hover" }))
|
|
5178
5193
|
}, [
|
|
5179
5194
|
d.value ? U("div", {
|
|
5180
5195
|
class: "markweave-table-copy-feedback",
|
|
@@ -5184,7 +5199,7 @@ var vs = J({
|
|
|
5184
5199
|
"data-copy-kind": d.value.kind,
|
|
5185
5200
|
"data-text-length": d.value.textLength,
|
|
5186
5201
|
"data-html-length": d.value.htmlLength
|
|
5187
|
-
},
|
|
5202
|
+
}, Qn(d.value)) : null,
|
|
5188
5203
|
i.value ? U("button", {
|
|
5189
5204
|
ref: m,
|
|
5190
5205
|
type: "button",
|
|
@@ -5206,12 +5221,12 @@ var vs = J({
|
|
|
5206
5221
|
height: `${i.value.height}px`
|
|
5207
5222
|
},
|
|
5208
5223
|
onMousedown: $,
|
|
5209
|
-
onClick: () =>
|
|
5210
|
-
onDragstart: (e) =>
|
|
5224
|
+
onClick: () => ne("row", "row-edge"),
|
|
5225
|
+
onDragstart: (e) => oe("row", E.value?.index ?? 0, e),
|
|
5211
5226
|
onDragend: () => {
|
|
5212
5227
|
x = null, S = null;
|
|
5213
5228
|
}
|
|
5214
|
-
}, [U(
|
|
5229
|
+
}, [U(ki, {
|
|
5215
5230
|
size: 14,
|
|
5216
5231
|
"aria-hidden": "true"
|
|
5217
5232
|
})]) : null,
|
|
@@ -5236,12 +5251,12 @@ var vs = J({
|
|
|
5236
5251
|
height: `${a.value.height}px`
|
|
5237
5252
|
},
|
|
5238
5253
|
onMousedown: $,
|
|
5239
|
-
onClick: () =>
|
|
5240
|
-
onDragstart: (e) =>
|
|
5254
|
+
onClick: () => ne("column", "column-edge"),
|
|
5255
|
+
onDragstart: (e) => oe("column", D.value?.index ?? 0, e),
|
|
5241
5256
|
onDragend: () => {
|
|
5242
5257
|
x = null, S = null;
|
|
5243
5258
|
}
|
|
5244
|
-
}, [U(
|
|
5259
|
+
}, [U(ki, {
|
|
5245
5260
|
size: 14,
|
|
5246
5261
|
"aria-hidden": "true"
|
|
5247
5262
|
})]) : null,
|
|
@@ -5261,8 +5276,8 @@ var vs = J({
|
|
|
5261
5276
|
height: `${o.value.height}px`
|
|
5262
5277
|
},
|
|
5263
5278
|
onMousedown: $,
|
|
5264
|
-
onClick:
|
|
5265
|
-
}, [U(
|
|
5279
|
+
onClick: R
|
|
5280
|
+
}, [U(ki, {
|
|
5266
5281
|
size: 14,
|
|
5267
5282
|
"aria-hidden": "true"
|
|
5268
5283
|
})]) : null,
|
|
@@ -5279,8 +5294,8 @@ var vs = J({
|
|
|
5279
5294
|
height: `${s.value.height}px`
|
|
5280
5295
|
},
|
|
5281
5296
|
onMousedown: $,
|
|
5282
|
-
onClick: () =>
|
|
5283
|
-
}, [U(
|
|
5297
|
+
onClick: () => ae("row")
|
|
5298
|
+
}, [U(Ni, {
|
|
5284
5299
|
size: 14,
|
|
5285
5300
|
"aria-hidden": "true"
|
|
5286
5301
|
})]) : null,
|
|
@@ -5297,15 +5312,15 @@ var vs = J({
|
|
|
5297
5312
|
height: `${c.value.height}px`
|
|
5298
5313
|
},
|
|
5299
5314
|
onMousedown: $,
|
|
5300
|
-
onClick: () =>
|
|
5301
|
-
}, [U(
|
|
5315
|
+
onClick: () => ae("column")
|
|
5316
|
+
}, [U(Ni, {
|
|
5302
5317
|
size: 14,
|
|
5303
5318
|
"aria-hidden": "true"
|
|
5304
5319
|
})]) : null,
|
|
5305
5320
|
de()
|
|
5306
5321
|
]) : null;
|
|
5307
5322
|
}
|
|
5308
|
-
}),
|
|
5323
|
+
}), Ps = Y({
|
|
5309
5324
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
5310
5325
|
props: {
|
|
5311
5326
|
editor: {
|
|
@@ -5323,13 +5338,13 @@ var vs = J({
|
|
|
5323
5338
|
t.value = null;
|
|
5324
5339
|
return;
|
|
5325
5340
|
}
|
|
5326
|
-
t.value =
|
|
5341
|
+
t.value = ur(e.editor, Bn(e.editor.state));
|
|
5327
5342
|
};
|
|
5328
|
-
return
|
|
5343
|
+
return jr(() => {
|
|
5329
5344
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
5330
|
-
}),
|
|
5345
|
+
}), Mr(() => {
|
|
5331
5346
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
5332
|
-
}),
|
|
5347
|
+
}), q(() => [
|
|
5333
5348
|
e.focusState.activeCellPos,
|
|
5334
5349
|
e.focusState.anchorCellPos,
|
|
5335
5350
|
e.focusState.mode,
|
|
@@ -5337,7 +5352,7 @@ var vs = J({
|
|
|
5337
5352
|
e.focusState.selectionFrom,
|
|
5338
5353
|
e.focusState.selectionTo
|
|
5339
5354
|
], () => {
|
|
5340
|
-
|
|
5355
|
+
J(n);
|
|
5341
5356
|
}, { flush: "post" }), () => {
|
|
5342
5357
|
let e = t.value;
|
|
5343
5358
|
return e ? U("div", {
|
|
@@ -5362,7 +5377,7 @@ var vs = J({
|
|
|
5362
5377
|
}) : null;
|
|
5363
5378
|
};
|
|
5364
5379
|
}
|
|
5365
|
-
}),
|
|
5380
|
+
}), Fs = Y({
|
|
5366
5381
|
name: "MarkweaveVueCodeBlockControls",
|
|
5367
5382
|
props: {
|
|
5368
5383
|
editor: {
|
|
@@ -5395,49 +5410,49 @@ var vs = J({
|
|
|
5395
5410
|
active: !1,
|
|
5396
5411
|
lastX: 0,
|
|
5397
5412
|
lastY: 0
|
|
5398
|
-
}), b = W(0), x = W(0), S = W(0), C = null, w =
|
|
5413
|
+
}), b = W(0), x = W(0), S = W(0), C = null, w = K(() => (S.value, Vt(e.editor, s.value))), T = K(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
5399
5414
|
...e.state,
|
|
5400
5415
|
pos: e.state.pos,
|
|
5401
5416
|
active: !0
|
|
5402
|
-
} : null), E =
|
|
5417
|
+
} : null), E = K(() => w.value ?? T.value), D = K(() => E.value !== null), O = K(() => E.value?.language === "mermaid"), k = K(() => Kt(e.editor, E.value)), A = K(() => D.value && E.value !== null && !k.value), j = K(() => !e.readOnly), M = K(() => E.value ? Pt(E.value.language) : Pt("text")), N = K(() => m.value?.status ?? "idle"), P = K(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), F = K(() => O.value && P.value === "preview"), I = K(() => (S.value, b.value, x.value, Wt(e.editor))), ee = K(() => `${x.value}|${I.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = K(() => Rt(f.value)), te = K(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), ne = () => {
|
|
5403
5418
|
C !== null && (window.clearTimeout(C), C = null);
|
|
5404
|
-
},
|
|
5405
|
-
|
|
5419
|
+
}, R = (e) => {
|
|
5420
|
+
ne(), m.value = e, e && (C = window.setTimeout(() => {
|
|
5406
5421
|
m.value = null, C = null;
|
|
5407
|
-
},
|
|
5408
|
-
},
|
|
5422
|
+
}, Dt));
|
|
5423
|
+
}, re = () => {
|
|
5409
5424
|
g.value = null, _.value = null, v.value = !1, y.value = {
|
|
5410
5425
|
active: !1,
|
|
5411
5426
|
lastX: 0,
|
|
5412
5427
|
lastY: 0
|
|
5413
5428
|
}, e.editor.view.focus();
|
|
5414
|
-
},
|
|
5429
|
+
}, z = () => {
|
|
5415
5430
|
let n = t.value;
|
|
5416
5431
|
if (!n) return;
|
|
5417
|
-
if (!
|
|
5432
|
+
if (!Ht(n) || I.value.length === 0) {
|
|
5418
5433
|
l.value = [];
|
|
5419
5434
|
return;
|
|
5420
5435
|
}
|
|
5421
5436
|
let r = n.getBoundingClientRect(), i = I.value.flatMap((t) => {
|
|
5422
|
-
let n =
|
|
5423
|
-
return n ? [
|
|
5437
|
+
let n = Lt(It(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
5438
|
+
return n ? [Mt(t, n, r)] : [];
|
|
5424
5439
|
});
|
|
5425
|
-
l.value =
|
|
5426
|
-
},
|
|
5440
|
+
l.value = qt(l.value, i, I.value.map((e) => e.pos));
|
|
5441
|
+
}, B = () => {
|
|
5427
5442
|
if (!A.value || !E.value) {
|
|
5428
5443
|
c.value = null, u.value = null;
|
|
5429
5444
|
return;
|
|
5430
5445
|
}
|
|
5431
5446
|
let i = t.value;
|
|
5432
5447
|
if (!i) return;
|
|
5433
|
-
let a =
|
|
5448
|
+
let a = It(e.editor, E.value.pos, P.value), o = i.getBoundingClientRect(), s = Lt(a, o);
|
|
5434
5449
|
if (!s) {
|
|
5435
5450
|
c.value = c.value?.pos === E.value.pos ? c.value : null, u.value = d.value ? u.value : null;
|
|
5436
5451
|
return;
|
|
5437
5452
|
}
|
|
5438
|
-
if (c.value =
|
|
5453
|
+
if (c.value = At(E.value.pos, s, o), d.value && n.value) {
|
|
5439
5454
|
let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
|
|
5440
|
-
u.value =
|
|
5455
|
+
u.value = Tt({
|
|
5441
5456
|
overlayRect: o,
|
|
5442
5457
|
buttonRect: e,
|
|
5443
5458
|
menuHeight: t,
|
|
@@ -5445,60 +5460,60 @@ var vs = J({
|
|
|
5445
5460
|
windowHeight: window.innerHeight
|
|
5446
5461
|
});
|
|
5447
5462
|
}
|
|
5448
|
-
},
|
|
5463
|
+
}, ie = async () => {
|
|
5449
5464
|
if (e.readOnly) {
|
|
5450
5465
|
if (!E.value) return;
|
|
5451
|
-
let e = await
|
|
5452
|
-
|
|
5466
|
+
let e = await Ot(E.value.text);
|
|
5467
|
+
R(bt(E.value, e ? "copied" : "failed"));
|
|
5453
5468
|
return;
|
|
5454
5469
|
}
|
|
5455
|
-
if (!
|
|
5456
|
-
let t = await
|
|
5457
|
-
|
|
5458
|
-
},
|
|
5470
|
+
if (!Nt(e.editor, E.value)) return;
|
|
5471
|
+
let t = await vt(e.editor);
|
|
5472
|
+
R(bt(yt(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
5473
|
+
}, ae = (t, n) => {
|
|
5459
5474
|
if (e.readOnly) {
|
|
5460
|
-
|
|
5475
|
+
hn(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
|
|
5461
5476
|
return;
|
|
5462
5477
|
}
|
|
5463
5478
|
let r = e.state.active && e.state.pos === t.pos;
|
|
5464
|
-
|
|
5465
|
-
},
|
|
5479
|
+
wt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
|
|
5480
|
+
}, oe = (t) => {
|
|
5466
5481
|
if (e.readOnly || !E.value) return;
|
|
5467
5482
|
let n = e.state.active && e.state.pos === E.value.pos;
|
|
5468
|
-
|
|
5469
|
-
},
|
|
5470
|
-
d.value = !d.value, d.value && o.value === null && (o.value =
|
|
5471
|
-
},
|
|
5472
|
-
let t =
|
|
5473
|
-
f.value = e, p.value =
|
|
5474
|
-
},
|
|
5483
|
+
Ct(e.editor, E.value.pos, t) && (t === "mermaid" && wt(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());
|
|
5484
|
+
}, V = () => {
|
|
5485
|
+
d.value = !d.value, d.value && o.value === null && (o.value = kt()), p.value = d.value ? Ut(L.value, E.value?.language ?? null) : -1;
|
|
5486
|
+
}, se = (e) => {
|
|
5487
|
+
let t = Rt(e);
|
|
5488
|
+
f.value = e, p.value = Ut(t, e.trim() ? null : E.value?.language ?? null);
|
|
5489
|
+
}, ce = (t) => {
|
|
5475
5490
|
if (!t.isComposing) {
|
|
5476
5491
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
5477
|
-
t.preventDefault(), p.value =
|
|
5492
|
+
t.preventDefault(), p.value = Yt(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
5478
5493
|
return;
|
|
5479
5494
|
}
|
|
5480
5495
|
if (t.key === "Enter") {
|
|
5481
5496
|
let e = L.value[p.value];
|
|
5482
|
-
e && (t.preventDefault(),
|
|
5497
|
+
e && (t.preventDefault(), oe(e.language));
|
|
5483
5498
|
return;
|
|
5484
5499
|
}
|
|
5485
5500
|
t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
|
|
5486
5501
|
}
|
|
5487
|
-
}, ce = () => {
|
|
5488
|
-
e.readOnly || !E.value || ft(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
5489
5502
|
}, le = () => {
|
|
5503
|
+
e.readOnly || !E.value || St(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
5504
|
+
}, H = () => {
|
|
5490
5505
|
if (!E.value) return;
|
|
5491
|
-
let t =
|
|
5492
|
-
t &&
|
|
5506
|
+
let t = Gt(e.editor, E.value.pos);
|
|
5507
|
+
t && de({
|
|
5493
5508
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
5494
5509
|
fileName: "markweave-mermaid.svg",
|
|
5495
5510
|
onSettled: () => e.editor.view.focus(),
|
|
5496
5511
|
ownerDocument: document
|
|
5497
5512
|
});
|
|
5498
|
-
},
|
|
5513
|
+
}, ue = () => {
|
|
5499
5514
|
if (!E.value) return;
|
|
5500
|
-
let t =
|
|
5501
|
-
t && (g.value =
|
|
5515
|
+
let t = Gt(e.editor, E.value.pos);
|
|
5516
|
+
t && (g.value = jt(t), _.value = null, v.value = !1, y.value = {
|
|
5502
5517
|
active: !1,
|
|
5503
5518
|
lastX: 0,
|
|
5504
5519
|
lastY: 0
|
|
@@ -5506,16 +5521,16 @@ var vs = J({
|
|
|
5506
5521
|
}, fe = (e) => {
|
|
5507
5522
|
g.value = g.value ? {
|
|
5508
5523
|
...g.value,
|
|
5509
|
-
scale:
|
|
5524
|
+
scale: Et(g.value.scale + e)
|
|
5510
5525
|
} : null;
|
|
5511
5526
|
}, pe = () => {
|
|
5512
|
-
g.value = g.value ?
|
|
5527
|
+
g.value = g.value ? jt(g.value.svg) : null, y.value = {
|
|
5513
5528
|
active: !1,
|
|
5514
5529
|
lastX: 0,
|
|
5515
5530
|
lastY: 0
|
|
5516
5531
|
}, v.value = !1;
|
|
5517
5532
|
}, me = (e) => {
|
|
5518
|
-
e.preventDefault(), fe(e.deltaY < 0 ?
|
|
5533
|
+
e.preventDefault(), fe(e.deltaY < 0 ? Jt : -Jt);
|
|
5519
5534
|
}, he = (e) => {
|
|
5520
5535
|
e.button === 0 && (e.preventDefault(), y.value = {
|
|
5521
5536
|
active: !0,
|
|
@@ -5530,7 +5545,7 @@ var vs = J({
|
|
|
5530
5545
|
active: !0,
|
|
5531
5546
|
lastX: e.clientX,
|
|
5532
5547
|
lastY: e.clientY
|
|
5533
|
-
}, g.value =
|
|
5548
|
+
}, g.value = Xt(g.value, n, r);
|
|
5534
5549
|
}, _e = () => {
|
|
5535
5550
|
y.value = {
|
|
5536
5551
|
active: !1,
|
|
@@ -5538,26 +5553,26 @@ var vs = J({
|
|
|
5538
5553
|
lastY: 0
|
|
5539
5554
|
}, v.value = !1;
|
|
5540
5555
|
};
|
|
5541
|
-
|
|
5556
|
+
q(() => e.readOnly, (e) => {
|
|
5542
5557
|
e && (d.value = !1, f.value = "");
|
|
5543
|
-
}),
|
|
5544
|
-
|
|
5545
|
-
}),
|
|
5558
|
+
}), q(te, () => {
|
|
5559
|
+
R(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
|
|
5560
|
+
}), q(d, async (e) => {
|
|
5546
5561
|
if (!e) {
|
|
5547
5562
|
p.value = -1;
|
|
5548
5563
|
return;
|
|
5549
5564
|
}
|
|
5550
|
-
await
|
|
5551
|
-
}),
|
|
5565
|
+
await J(), B(), i.value?.focus({ preventScroll: !0 });
|
|
5566
|
+
}), q(() => [
|
|
5552
5567
|
d.value,
|
|
5553
5568
|
f.value,
|
|
5554
5569
|
p.value
|
|
5555
5570
|
], async () => {
|
|
5556
5571
|
if (!d.value || p.value < 0) return;
|
|
5557
|
-
await
|
|
5572
|
+
await J();
|
|
5558
5573
|
let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
|
|
5559
|
-
e && t &&
|
|
5560
|
-
}, { flush: "post" }),
|
|
5574
|
+
e && t && Zt(e, t);
|
|
5575
|
+
}, { flush: "post" }), q(() => [
|
|
5561
5576
|
A.value,
|
|
5562
5577
|
b.value,
|
|
5563
5578
|
E.value?.pos ?? null,
|
|
@@ -5565,29 +5580,29 @@ var vs = J({
|
|
|
5565
5580
|
d.value,
|
|
5566
5581
|
P.value
|
|
5567
5582
|
], async () => {
|
|
5568
|
-
await
|
|
5583
|
+
await J(), B();
|
|
5569
5584
|
}, {
|
|
5570
5585
|
flush: "post",
|
|
5571
5586
|
immediate: !0
|
|
5572
|
-
}),
|
|
5573
|
-
await
|
|
5587
|
+
}), q(ee, async () => {
|
|
5588
|
+
await J(), z(), window.requestAnimationFrame(z);
|
|
5574
5589
|
}, {
|
|
5575
5590
|
flush: "post",
|
|
5576
5591
|
immediate: !0
|
|
5577
5592
|
});
|
|
5578
5593
|
let ve = null;
|
|
5579
|
-
return
|
|
5580
|
-
|
|
5594
|
+
return jr(() => {
|
|
5595
|
+
J(() => {
|
|
5581
5596
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
5582
5597
|
if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
|
|
5583
|
-
let r =
|
|
5598
|
+
let r = Bt(e.editor, n.target), i = Vt(e.editor, r), a = i && !Kt(e.editor, i) ? i.pos : null;
|
|
5584
5599
|
s.value = s.value === a ? s.value : a;
|
|
5585
5600
|
}, i = () => {
|
|
5586
5601
|
d.value || (s.value = null);
|
|
5587
5602
|
}, a = (t) => {
|
|
5588
5603
|
if (t.key === "Escape") {
|
|
5589
5604
|
if (g.value) {
|
|
5590
|
-
|
|
5605
|
+
re();
|
|
5591
5606
|
return;
|
|
5592
5607
|
}
|
|
5593
5608
|
d.value && (d.value = !1, p.value = -1, e.editor.view.focus());
|
|
@@ -5595,14 +5610,14 @@ var vs = J({
|
|
|
5595
5610
|
}, o = (e) => {
|
|
5596
5611
|
d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
|
|
5597
5612
|
}, c = ({ transaction: e }) => {
|
|
5598
|
-
e.getMeta(
|
|
5613
|
+
e.getMeta(_t) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(_t) || fn(e)) && (S.value += 1);
|
|
5599
5614
|
};
|
|
5600
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize",
|
|
5601
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize",
|
|
5615
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), window.addEventListener("resize", z), window.addEventListener("scroll", z, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ve = () => {
|
|
5616
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", z), window.removeEventListener("scroll", z, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), ne();
|
|
5602
5617
|
};
|
|
5603
5618
|
});
|
|
5604
|
-
}),
|
|
5605
|
-
ve?.(), ve = null,
|
|
5619
|
+
}), Mr(() => {
|
|
5620
|
+
ve?.(), ve = null, ne();
|
|
5606
5621
|
}), () => {
|
|
5607
5622
|
if (!A.value && I.value.length === 0 && !g.value) return null;
|
|
5608
5623
|
let s = c.value ? {
|
|
@@ -5636,7 +5651,7 @@ var vs = J({
|
|
|
5636
5651
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
5637
5652
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
5638
5653
|
onMousedown: $,
|
|
5639
|
-
onClick: () =>
|
|
5654
|
+
onClick: () => ae(e, t)
|
|
5640
5655
|
}, t === "code" ? "Code" : "Preview")));
|
|
5641
5656
|
}),
|
|
5642
5657
|
A.value && E.value ? U("div", {
|
|
@@ -5661,8 +5676,8 @@ var vs = J({
|
|
|
5661
5676
|
"aria-haspopup": "listbox",
|
|
5662
5677
|
"data-testid": "markweave-codeblock-language",
|
|
5663
5678
|
onMousedown: $,
|
|
5664
|
-
onClick:
|
|
5665
|
-
}, [U("span", null, M.value),
|
|
5679
|
+
onClick: V
|
|
5680
|
+
}, [U("span", null, M.value), xs("chevron")]),
|
|
5666
5681
|
j.value ? U("button", {
|
|
5667
5682
|
type: "button",
|
|
5668
5683
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
@@ -5671,8 +5686,8 @@ var vs = J({
|
|
|
5671
5686
|
"data-testid": "markweave-codeblock-collapse",
|
|
5672
5687
|
"data-collapsed": k.value ? "true" : "false",
|
|
5673
5688
|
onMousedown: $,
|
|
5674
|
-
onClick:
|
|
5675
|
-
}, [
|
|
5689
|
+
onClick: le
|
|
5690
|
+
}, [xs("chevron")]) : null,
|
|
5676
5691
|
U("span", { class: "markweave-codeblock-copy-wrap" }, [U("button", {
|
|
5677
5692
|
type: "button",
|
|
5678
5693
|
class: "markweave-codeblock-icon-button",
|
|
@@ -5693,9 +5708,9 @@ var vs = J({
|
|
|
5693
5708
|
h.value = !1;
|
|
5694
5709
|
},
|
|
5695
5710
|
onClick: () => {
|
|
5696
|
-
|
|
5711
|
+
ie();
|
|
5697
5712
|
}
|
|
5698
|
-
}, [
|
|
5713
|
+
}, [xs(N.value === "copied" ? "check" : "clipboard")]), h.value ? U("span", {
|
|
5699
5714
|
class: "markweave-codeblock-tooltip",
|
|
5700
5715
|
role: "tooltip",
|
|
5701
5716
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
@@ -5710,16 +5725,16 @@ var vs = J({
|
|
|
5710
5725
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
5711
5726
|
disabled: !F.value,
|
|
5712
5727
|
onMousedown: $,
|
|
5713
|
-
onClick:
|
|
5714
|
-
}, [
|
|
5728
|
+
onClick: ue
|
|
5729
|
+
}, [xs("expand")]), U("button", {
|
|
5715
5730
|
type: "button",
|
|
5716
5731
|
class: "markweave-codeblock-icon-button",
|
|
5717
5732
|
"aria-label": "Download Mermaid SVG",
|
|
5718
5733
|
"data-testid": "markweave-mermaid-download",
|
|
5719
5734
|
disabled: !F.value,
|
|
5720
5735
|
onMousedown: $,
|
|
5721
|
-
onClick:
|
|
5722
|
-
}, [
|
|
5736
|
+
onClick: H
|
|
5737
|
+
}, [xs("download")])]) : null
|
|
5723
5738
|
]) : null,
|
|
5724
5739
|
j.value && A.value && d.value && E.value ? U("div", {
|
|
5725
5740
|
ref: r,
|
|
@@ -5733,16 +5748,16 @@ var vs = J({
|
|
|
5733
5748
|
"aria-autocomplete": "list",
|
|
5734
5749
|
"aria-controls": o.value ?? void 0,
|
|
5735
5750
|
"aria-expanded": "true",
|
|
5736
|
-
"aria-activedescendant": o.value && L.value[p.value] ?
|
|
5751
|
+
"aria-activedescendant": o.value && L.value[p.value] ? zt(o.value, L.value[p.value].language) : void 0,
|
|
5737
5752
|
"aria-label": "Search code block languages",
|
|
5738
5753
|
value: f.value,
|
|
5739
5754
|
placeholder: "Search...",
|
|
5740
5755
|
"data-testid": "markweave-codeblock-language-search",
|
|
5741
5756
|
onInput: (e) => {
|
|
5742
|
-
|
|
5757
|
+
se(e.target.value);
|
|
5743
5758
|
},
|
|
5744
|
-
onKeydown:
|
|
5745
|
-
}),
|
|
5759
|
+
onKeydown: ce
|
|
5760
|
+
}), xs("search")]), U("div", {
|
|
5746
5761
|
ref: a,
|
|
5747
5762
|
id: o.value ?? void 0,
|
|
5748
5763
|
class: "markweave-codeblock-language-list",
|
|
@@ -5752,7 +5767,7 @@ var vs = J({
|
|
|
5752
5767
|
let n = E.value?.language === e.language, r = t === p.value;
|
|
5753
5768
|
return U("button", {
|
|
5754
5769
|
key: e.language,
|
|
5755
|
-
id: o.value ?
|
|
5770
|
+
id: o.value ? zt(o.value, e.language) : void 0,
|
|
5756
5771
|
type: "button",
|
|
5757
5772
|
role: "option",
|
|
5758
5773
|
"aria-selected": n ? "true" : "false",
|
|
@@ -5764,8 +5779,8 @@ var vs = J({
|
|
|
5764
5779
|
onMouseenter: () => {
|
|
5765
5780
|
p.value = t;
|
|
5766
5781
|
},
|
|
5767
|
-
onClick: () =>
|
|
5768
|
-
}, [U("span", null, e.label), n ?
|
|
5782
|
+
onClick: () => oe(e.language)
|
|
5783
|
+
}, [U("span", null, e.label), n ? xs("check") : null]);
|
|
5769
5784
|
}))]) : null,
|
|
5770
5785
|
g.value ? U("div", {
|
|
5771
5786
|
class: "markweave-mermaid-fullscreen-layer",
|
|
@@ -5795,12 +5810,12 @@ var vs = J({
|
|
|
5795
5810
|
onBlur: () => {
|
|
5796
5811
|
_.value = null;
|
|
5797
5812
|
},
|
|
5798
|
-
onClick: () => fe(-
|
|
5799
|
-
}, [
|
|
5813
|
+
onClick: () => fe(-Jt)
|
|
5814
|
+
}, [xs("zoomOut")]),
|
|
5800
5815
|
U("span", {
|
|
5801
5816
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
5802
5817
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
5803
|
-
},
|
|
5818
|
+
}, Ft(g.value.scale)),
|
|
5804
5819
|
U("button", {
|
|
5805
5820
|
type: "button",
|
|
5806
5821
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -5818,8 +5833,8 @@ var vs = J({
|
|
|
5818
5833
|
onBlur: () => {
|
|
5819
5834
|
_.value = null;
|
|
5820
5835
|
},
|
|
5821
|
-
onClick: () => fe(
|
|
5822
|
-
}, [
|
|
5836
|
+
onClick: () => fe(Jt)
|
|
5837
|
+
}, [xs("zoomIn")]),
|
|
5823
5838
|
U("button", {
|
|
5824
5839
|
type: "button",
|
|
5825
5840
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -5838,7 +5853,7 @@ var vs = J({
|
|
|
5838
5853
|
_.value = null;
|
|
5839
5854
|
},
|
|
5840
5855
|
onClick: pe
|
|
5841
|
-
}, [
|
|
5856
|
+
}, [xs("reset")]),
|
|
5842
5857
|
_.value ? U("span", {
|
|
5843
5858
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
5844
5859
|
role: "tooltip",
|
|
@@ -5850,8 +5865,8 @@ var vs = J({
|
|
|
5850
5865
|
class: "markweave-mermaid-fullscreen-close",
|
|
5851
5866
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
5852
5867
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
5853
|
-
onClick:
|
|
5854
|
-
}, [
|
|
5868
|
+
onClick: re
|
|
5869
|
+
}, [xs("close")]),
|
|
5855
5870
|
U("div", {
|
|
5856
5871
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
5857
5872
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
@@ -5877,7 +5892,7 @@ var vs = J({
|
|
|
5877
5892
|
]);
|
|
5878
5893
|
};
|
|
5879
5894
|
}
|
|
5880
|
-
}),
|
|
5895
|
+
}), Is = Y({
|
|
5881
5896
|
name: "MarkweaveVueInnerToc",
|
|
5882
5897
|
props: {
|
|
5883
5898
|
editor: {
|
|
@@ -5903,20 +5918,20 @@ var vs = J({
|
|
|
5903
5918
|
},
|
|
5904
5919
|
setup(e) {
|
|
5905
5920
|
let t = W(null), n, r, i = () => {
|
|
5906
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
5921
|
+
n?.(), n = e.placement === "container" && t.value ? mt(t.value) : void 0;
|
|
5907
5922
|
}, a = () => {
|
|
5908
|
-
r?.(), r = t.value && e.state.items.length ?
|
|
5923
|
+
r?.(), r = t.value && e.state.items.length ? ht(t.value, e.state.items.length) : void 0;
|
|
5909
5924
|
};
|
|
5910
|
-
return
|
|
5925
|
+
return jr(() => {
|
|
5911
5926
|
i(), a();
|
|
5912
|
-
}),
|
|
5927
|
+
}), Mr(() => {
|
|
5913
5928
|
n?.(), r?.();
|
|
5914
|
-
}),
|
|
5929
|
+
}), q(() => e.placement, i), q(() => e.state.items.length, a, { flush: "post" }), () => e.state.items.length ? U("nav", {
|
|
5915
5930
|
ref: t,
|
|
5916
5931
|
class: "markweave-inner-toc",
|
|
5917
5932
|
"data-testid": "markweave-inner-toc",
|
|
5918
5933
|
"aria-label": e.messages.toc.ariaLabel,
|
|
5919
|
-
style: { "--markweave-inner-toc-rail-height":
|
|
5934
|
+
style: { "--markweave-inner-toc-rail-height": ut(e.state.items.length) }
|
|
5920
5935
|
}, [U("div", {
|
|
5921
5936
|
class: "markweave-inner-toc-rail",
|
|
5922
5937
|
"aria-hidden": "true"
|
|
@@ -5933,89 +5948,111 @@ var vs = J({
|
|
|
5933
5948
|
"aria-current": t.active ? "location" : void 0,
|
|
5934
5949
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
5935
5950
|
title: t.text,
|
|
5936
|
-
onClick: () =>
|
|
5951
|
+
onClick: () => gt(e.editor, t, {
|
|
5937
5952
|
behavior: "smooth",
|
|
5938
5953
|
focus: e.editable
|
|
5939
5954
|
})
|
|
5940
5955
|
}, t.text)))])]) : null;
|
|
5941
5956
|
}
|
|
5942
5957
|
});
|
|
5943
|
-
function
|
|
5944
|
-
let r = n(e.lang), a = t(r), o =
|
|
5958
|
+
function Ls(e = {}) {
|
|
5959
|
+
let r = n(e.lang), a = t(r), o = K(() => Mn({
|
|
5945
5960
|
lang: r,
|
|
5946
5961
|
commandGroups: e.commandGroups,
|
|
5947
5962
|
commands: e.commands,
|
|
5948
5963
|
builtinCommands: e.builtinCommands
|
|
5949
|
-
})), s = W(d(e.mode)), c =
|
|
5950
|
-
|
|
5951
|
-
|
|
5964
|
+
})), s = W(d(e.mode)), c = K(() => Be(e.theme)), l = W(0), u = G({
|
|
5965
|
+
state: "idle",
|
|
5966
|
+
pendingVisualWork: 0
|
|
5967
|
+
}), p = G(null), m = W(Nn), h = G(null), g = G(null), _ = W(null), v = W("code"), y = G(null), b = G(Vn), x = W(null), S = W(!1), C = G(null), w = ve(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = e.performancePolicy ?? "auto", D = Ne(T, E), O = G(De({
|
|
5968
|
+
phase: D ? "parsing" : "ready",
|
|
5969
|
+
tier: E === "auto" ? Oe(T) >= 2e5 ? "large" : "standard" : E,
|
|
5970
|
+
progress: D ? null : 1
|
|
5971
|
+
})), k = K(() => s.value === "live" && e.editable !== !1 && O.value.phase === "ready"), A = K(() => O.value.tier !== "standard" || D), j = null, M = null;
|
|
5972
|
+
function N(e, t) {
|
|
5973
|
+
let n = je(e.state.doc, t ?? e.state.doc.content.size);
|
|
5974
|
+
O.value = {
|
|
5975
|
+
...O.value,
|
|
5976
|
+
tier: Me(n, E),
|
|
5977
|
+
profile: n
|
|
5978
|
+
}, P(e);
|
|
5979
|
+
}
|
|
5980
|
+
function P(e) {
|
|
5981
|
+
e.view.dom.setAttribute("data-markweave-large-document", O.value.tier === "standard" ? "false" : "true"), e.view.dom.setAttribute("data-markweave-performance-tier", O.value.tier);
|
|
5952
5982
|
}
|
|
5953
|
-
function
|
|
5954
|
-
|
|
5955
|
-
D = null, u.value += 1;
|
|
5956
|
-
}, Oe);
|
|
5983
|
+
function F() {
|
|
5984
|
+
j !== null && (window.clearTimeout(j), j = null), l.value += 1;
|
|
5957
5985
|
}
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5986
|
+
function I() {
|
|
5987
|
+
j !== null && window.clearTimeout(j), j = window.setTimeout(() => {
|
|
5988
|
+
j = null, l.value += 1;
|
|
5989
|
+
}, Le);
|
|
5990
|
+
}
|
|
5991
|
+
let ee = e.onSlashCommandUpload, L = G(null), te = !1;
|
|
5992
|
+
L.value = new i({
|
|
5993
|
+
extensions: ba({
|
|
5961
5994
|
lang: r,
|
|
5962
5995
|
revealLinkMarkdown: e.revealLinkMarkdown !== !1,
|
|
5963
5996
|
linkCardResolver: e.linkCardResolver,
|
|
5964
|
-
onImageUpload: (e) =>
|
|
5965
|
-
onVideoUpload: (e) =>
|
|
5966
|
-
onAttachmentUpload: (t) => e.onSlashCommandUpload?.(t) ??
|
|
5997
|
+
onImageUpload: (e) => ee?.(e) ?? z(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
5998
|
+
onVideoUpload: (e) => ee?.(e) ?? z(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
5999
|
+
onAttachmentUpload: (t) => e.onSlashCommandUpload?.(t) ?? z(t) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
5967
6000
|
onAttachmentDownload: (t, n) => e.onAttachmentDownload?.(t, n),
|
|
5968
6001
|
resolveMediaSource: e.resolveMediaSource,
|
|
5969
6002
|
tableCapabilities: (t) => e.tableCapabilities?.(t),
|
|
6003
|
+
referenceSuggestion: e.referenceSuggestion,
|
|
6004
|
+
internalLinkCard: e.internalLinkCard,
|
|
5970
6005
|
editorExtensions: e.editorExtensions
|
|
5971
6006
|
}),
|
|
5972
|
-
content: T,
|
|
5973
|
-
contentType:
|
|
5974
|
-
editable:
|
|
5975
|
-
autofocus: e.autofocus,
|
|
6007
|
+
content: D ? "" : T,
|
|
6008
|
+
contentType: he(w),
|
|
6009
|
+
editable: k.value,
|
|
6010
|
+
autofocus: D ? !1 : e.autofocus,
|
|
5976
6011
|
editorProps: {
|
|
5977
6012
|
attributes: {
|
|
5978
6013
|
class: "markweave-editor-surface",
|
|
5979
6014
|
"data-testid": "markweave-editor-surface",
|
|
5980
|
-
"data-markweave-large-document":
|
|
6015
|
+
"data-markweave-large-document": A.value ? "true" : "false",
|
|
5981
6016
|
autocapitalize: "off",
|
|
5982
6017
|
autocorrect: "off",
|
|
5983
6018
|
spellcheck: "false",
|
|
5984
6019
|
translate: "no"
|
|
5985
6020
|
},
|
|
5986
6021
|
handleClick: (e, t, n) => {
|
|
5987
|
-
if (!
|
|
5988
|
-
let r =
|
|
5989
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
6022
|
+
if (!k.value) return !1;
|
|
6023
|
+
let r = on(e, n);
|
|
6024
|
+
return r ? (n.preventDefault(), n.stopPropagation(), H(), un(e, r, !0), dn(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
5990
6025
|
},
|
|
5991
6026
|
handleDOMEvents: {
|
|
5992
|
-
compositionstart: () =>
|
|
5993
|
-
compositionend: (e) => (
|
|
6027
|
+
compositionstart: () => k.value ? (m.value = Pn(m.value, { type: "composition-start" }), h.value = null, !1) : !1,
|
|
6028
|
+
compositionend: (e) => (k.value && window.setTimeout(() => de(e), 0), !1),
|
|
5994
6029
|
click: (e, t) => {
|
|
5995
|
-
if (!
|
|
5996
|
-
let n =
|
|
5997
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
6030
|
+
if (!k.value) return !1;
|
|
6031
|
+
let n = on(e, t);
|
|
6032
|
+
return n ? (t.preventDefault(), t.stopPropagation(), H(), un(e, n, !0), dn(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
5998
6033
|
}
|
|
5999
6034
|
}
|
|
6000
6035
|
},
|
|
6001
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
6036
|
+
onSelectionUpdate: ({ editor: e }) => be(e),
|
|
6002
6037
|
onCreate: ({ editor: t }) => {
|
|
6003
|
-
|
|
6038
|
+
jn(t, o.value, (t) => {
|
|
6004
6039
|
_.value = t.message, e.onCommandError?.(t);
|
|
6005
|
-
}),
|
|
6040
|
+
}), An(t, w), te = !0, e.onCommandControllerChange?.(On(t)), f(t, {
|
|
6006
6041
|
mode: s.value,
|
|
6007
|
-
editable:
|
|
6008
|
-
}),
|
|
6042
|
+
editable: k.value
|
|
6043
|
+
}), pn(t, c.value), mn(t, k.value ? "live" : "view"), !D && e.autoFocusFirstTableBodyCell && k.value && Rn(t), xe(t), be(t), F();
|
|
6009
6044
|
},
|
|
6010
6045
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
6011
|
-
if (
|
|
6012
|
-
|
|
6046
|
+
if (!ke(t) && (xe(e), (t.docChanged || fn(t)) && I(), t.docChanged && O.value.phase === "ready" && (M !== null && window.clearTimeout(M), M = window.setTimeout(() => {
|
|
6047
|
+
M = null, N(e);
|
|
6048
|
+
}, 250)), t.docChanged && y.value)) {
|
|
6049
|
+
let t = an(e, y.value.pos);
|
|
6013
6050
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
6014
6051
|
}
|
|
6015
6052
|
},
|
|
6016
6053
|
onUpdate: ({ editor: t }) => {
|
|
6017
|
-
|
|
6018
|
-
let i =
|
|
6054
|
+
be(t), k.value && ye(t), S.value || e.onUpdate?.(me(t, { onContentRead: (n, r) => {
|
|
6055
|
+
let i = ve(e.contentFormat);
|
|
6019
6056
|
e.content !== void 0 && n === i && (C.value = {
|
|
6020
6057
|
content: r,
|
|
6021
6058
|
format: n,
|
|
@@ -6024,126 +6061,157 @@ function Ds(e = {}) {
|
|
|
6024
6061
|
} }));
|
|
6025
6062
|
}
|
|
6026
6063
|
});
|
|
6027
|
-
let
|
|
6028
|
-
|
|
6064
|
+
let ne = L.value;
|
|
6065
|
+
jn(ne, o.value, (t) => {
|
|
6029
6066
|
_.value = t.message, e.onCommandError?.(t);
|
|
6030
|
-
}),
|
|
6031
|
-
|
|
6067
|
+
}), An(ne, w), q(o, (t) => {
|
|
6068
|
+
L.value && jn(L.value, t, (t) => {
|
|
6032
6069
|
_.value = t.message, e.onCommandError?.(t);
|
|
6033
6070
|
});
|
|
6034
|
-
}),
|
|
6035
|
-
|
|
6071
|
+
}), q(() => [e.content === void 0 ? e.defaultContentFormat : e.contentFormat, e.content], () => {
|
|
6072
|
+
L.value && An(L.value, ve(e.content === void 0 ? e.defaultContentFormat : e.contentFormat));
|
|
6036
6073
|
});
|
|
6037
|
-
let
|
|
6038
|
-
|
|
6039
|
-
|
|
6074
|
+
let R = L.value, re = Ve(R), B = !1, ie = !1;
|
|
6075
|
+
J(() => {
|
|
6076
|
+
B || L.value !== R || (ie = !0, e.onAiEditControllerChange?.(re));
|
|
6040
6077
|
});
|
|
6041
|
-
let
|
|
6042
|
-
|
|
6043
|
-
|
|
6078
|
+
let ae = He(R), oe = !1;
|
|
6079
|
+
J(() => {
|
|
6080
|
+
B || L.value !== R || (oe = !0, e.onSearchControllerChange?.(ae));
|
|
6081
|
+
});
|
|
6082
|
+
let V = K(() => L.value ?? null), se = null, ce = () => void 0;
|
|
6083
|
+
q(V, (e) => {
|
|
6084
|
+
ce(), se?.destroy(), se = e ? pe(e) : null, ce = se?.subscribe((e) => {
|
|
6085
|
+
u.value = e;
|
|
6086
|
+
}) ?? (() => void 0);
|
|
6087
|
+
}, { immediate: !0 });
|
|
6088
|
+
let le = D ? new AbortController() : null;
|
|
6089
|
+
D && L.value && le ? (S.value = !0, Ae(L.value, {
|
|
6090
|
+
content: T,
|
|
6091
|
+
format: w,
|
|
6092
|
+
performancePolicy: E,
|
|
6093
|
+
allowProgressiveMount: !e.editorExtensions?.length || e.editorExtensionsLoadPolicy === "transactional-safe",
|
|
6094
|
+
allowBuiltInMarkdownWorker: !e.editorExtensions?.length,
|
|
6095
|
+
signal: le.signal,
|
|
6096
|
+
onStateChange: (t) => {
|
|
6097
|
+
O.value = t, L.value && P(L.value), e.onDocumentLoadStateChange?.(t);
|
|
6098
|
+
}
|
|
6099
|
+
}).then(() => {
|
|
6100
|
+
le.signal.aborted || !L.value || (be(L.value), xe(L.value), F(), e.autoFocusFirstTableBodyCell && k.value ? Rn(L.value) : e.autofocus && k.value && L.value.commands.focus("start", { scrollIntoView: !1 }));
|
|
6101
|
+
}).catch(() => void 0).finally(() => {
|
|
6102
|
+
le.signal.aborted || (S.value = !1);
|
|
6103
|
+
})) : (L.value && N(L.value, Oe(T)), e.onDocumentLoadStateChange?.(O.value));
|
|
6104
|
+
function H() {
|
|
6105
|
+
h.value = null, g.value = null, m.value = Nn;
|
|
6044
6106
|
}
|
|
6045
|
-
function
|
|
6046
|
-
let t =
|
|
6107
|
+
function de(e) {
|
|
6108
|
+
let t = Tn(e.state);
|
|
6047
6109
|
if (!t) {
|
|
6048
|
-
m.value = m.value.name === "idle" ? m.value :
|
|
6110
|
+
m.value = m.value.name === "idle" ? m.value : Nn, h.value = null, g.value = null;
|
|
6049
6111
|
return;
|
|
6050
6112
|
}
|
|
6051
6113
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
6052
|
-
if (!
|
|
6053
|
-
|
|
6114
|
+
if (!Dn(r, { frameRect: i })) {
|
|
6115
|
+
H();
|
|
6054
6116
|
return;
|
|
6055
6117
|
}
|
|
6056
|
-
let a =
|
|
6118
|
+
let a = wn(n, {
|
|
6057
6119
|
frameRect: i,
|
|
6058
6120
|
triggerRect: r
|
|
6059
6121
|
});
|
|
6060
|
-
|
|
6122
|
+
Sn(h.value, a) || (h.value = a), m.value = Cn(m.value, t);
|
|
6061
6123
|
}
|
|
6062
|
-
function
|
|
6063
|
-
|
|
6124
|
+
function ye(e) {
|
|
6125
|
+
de(e.view);
|
|
6064
6126
|
}
|
|
6065
|
-
function
|
|
6066
|
-
let t =
|
|
6067
|
-
|
|
6068
|
-
let n =
|
|
6069
|
-
n && (
|
|
6070
|
-
let r =
|
|
6127
|
+
function be(e) {
|
|
6128
|
+
let t = Ie(e);
|
|
6129
|
+
Pe(p.value, t) || (p.value = t);
|
|
6130
|
+
let n = sn(e);
|
|
6131
|
+
n && (ln(e, n, !0), y.value = n);
|
|
6132
|
+
let r = yt(e);
|
|
6071
6133
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
6072
6134
|
}
|
|
6073
|
-
function
|
|
6074
|
-
b.value =
|
|
6135
|
+
function xe(e) {
|
|
6136
|
+
b.value = vs(e);
|
|
6075
6137
|
}
|
|
6076
|
-
let
|
|
6077
|
-
active:
|
|
6138
|
+
let Se = K(() => V.value ? yt(V.value) : _s), Ce = K(() => V.value ? zn(V.value.state) : gs), we = K(() => p.value?.currentNode === "codeBlock"), Te = K(() => we.value && Se.value.language === "mermaid"), Fe = K(() => V.value ? gn({
|
|
6139
|
+
active: Te.value,
|
|
6078
6140
|
mode: v.value,
|
|
6079
|
-
source:
|
|
6080
|
-
}) :
|
|
6141
|
+
source: Se.value.text
|
|
6142
|
+
}) : gn({
|
|
6081
6143
|
active: !1,
|
|
6082
6144
|
mode: "code",
|
|
6083
6145
|
source: ""
|
|
6084
|
-
})),
|
|
6085
|
-
|
|
6086
|
-
let e =
|
|
6087
|
-
return
|
|
6146
|
+
})), Re = K(() => V.value && e.onRuntimeStateChange ? Ln(V.value.state) : null), ze = K(() => V.value ? dt(V.value.state) : ct.items), Ue = K(() => ft(ze.value, x.value)), We = K(() => st(ze.value, Ue.value)), Ge = K(() => {
|
|
6147
|
+
l.value, p.value, k.value;
|
|
6148
|
+
let e = V.value;
|
|
6149
|
+
return _n(e ? On(e).getCommands({
|
|
6088
6150
|
surface: "slash",
|
|
6089
6151
|
query: m.value.query
|
|
6090
6152
|
}) : o.value.commands, r);
|
|
6091
|
-
}),
|
|
6092
|
-
revision:
|
|
6153
|
+
}), Ke = K(() => Ee({
|
|
6154
|
+
revision: l.value,
|
|
6093
6155
|
mode: s.value,
|
|
6094
|
-
editable:
|
|
6095
|
-
toc:
|
|
6156
|
+
editable: k.value,
|
|
6157
|
+
toc: We.value,
|
|
6096
6158
|
selection: p.value,
|
|
6097
6159
|
slash: m.value,
|
|
6098
|
-
table:
|
|
6160
|
+
table: Ce.value,
|
|
6099
6161
|
tableInteraction: b.value,
|
|
6100
|
-
codeBlock:
|
|
6101
|
-
mermaid:
|
|
6102
|
-
tableDebugSnapshot:
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6162
|
+
codeBlock: Se.value,
|
|
6163
|
+
mermaid: Fe.value,
|
|
6164
|
+
tableDebugSnapshot: Re.value,
|
|
6165
|
+
performance: {
|
|
6166
|
+
tier: O.value.tier,
|
|
6167
|
+
loadPhase: O.value.phase,
|
|
6168
|
+
viewportState: u.value.state,
|
|
6169
|
+
pendingVisualWork: u.value.pendingVisualWork
|
|
6170
|
+
}
|
|
6171
|
+
})), qe = {
|
|
6172
|
+
closeSlashMenu: H,
|
|
6173
|
+
focusFirstTableBodyCell: () => V.value ? Rn(V.value) : !1,
|
|
6106
6174
|
setContent: (e, t = {}) => {
|
|
6107
|
-
if (!
|
|
6108
|
-
let n =
|
|
6109
|
-
return
|
|
6110
|
-
contentType:
|
|
6175
|
+
if (!V.value) return !1;
|
|
6176
|
+
let n = ve(t.format);
|
|
6177
|
+
return V.value.commands.setContent(e, {
|
|
6178
|
+
contentType: he(n),
|
|
6111
6179
|
emitUpdate: t.emitUpdate ?? !1
|
|
6112
|
-
}), t.focusFirstTableBodyCell &&
|
|
6180
|
+
}), t.focusFirstTableBodyCell && Rn(V.value), be(V.value), k.value && ye(V.value), xe(V.value), N(V.value, Oe(e)), F(), !0;
|
|
6113
6181
|
}
|
|
6114
6182
|
};
|
|
6115
|
-
function
|
|
6116
|
-
if (!
|
|
6183
|
+
function Je(e, t) {
|
|
6184
|
+
if (!V.value || !k.value || !yn(e)) return;
|
|
6117
6185
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
6118
6186
|
g.value = e;
|
|
6119
6187
|
return;
|
|
6120
6188
|
}
|
|
6121
|
-
let n =
|
|
6189
|
+
let n = Tn(V.value.state);
|
|
6122
6190
|
if (!n) return;
|
|
6123
|
-
_.value = null, m.value =
|
|
6124
|
-
let r =
|
|
6125
|
-
|
|
6191
|
+
_.value = null, m.value = Pn(m.value, { type: "execute" }), g.value = null;
|
|
6192
|
+
let r = V.value;
|
|
6193
|
+
kn(r, e.id, n, t).then((e) => {
|
|
6126
6194
|
if (e.ok && e.outcome === "applied") {
|
|
6127
|
-
|
|
6195
|
+
H();
|
|
6128
6196
|
return;
|
|
6129
6197
|
}
|
|
6130
|
-
e.ok || (_.value = e.message),
|
|
6198
|
+
e.ok || (_.value = e.message), ye(r), r.commands.focus(void 0, { scrollIntoView: !1 });
|
|
6131
6199
|
});
|
|
6132
6200
|
}
|
|
6133
|
-
function
|
|
6134
|
-
if (!
|
|
6201
|
+
function Ye(e) {
|
|
6202
|
+
if (!V.value || g.value || !k.value) return;
|
|
6135
6203
|
if (m.value.name === "executing" && e.key === "Escape") {
|
|
6136
|
-
e.preventDefault(),
|
|
6204
|
+
e.preventDefault(), On(V.value).cancel(), H();
|
|
6137
6205
|
return;
|
|
6138
6206
|
}
|
|
6139
|
-
let t =
|
|
6207
|
+
let t = bn(m.value, Ge.value, e.key, { isComposing: e.isComposing || ue(V.value.state) });
|
|
6140
6208
|
if (t.type !== "ignore") {
|
|
6141
6209
|
if (e.preventDefault(), t.type === "close") {
|
|
6142
|
-
|
|
6210
|
+
On(V.value).cancel(), m.value = Pn(m.value, { type: "escape" }), H();
|
|
6143
6211
|
return;
|
|
6144
6212
|
}
|
|
6145
6213
|
if (t.type === "move-active") {
|
|
6146
|
-
m.value =
|
|
6214
|
+
m.value = Pn(m.value, {
|
|
6147
6215
|
type: "move-active",
|
|
6148
6216
|
delta: t.delta,
|
|
6149
6217
|
optionCount: t.optionCount
|
|
@@ -6151,102 +6219,115 @@ function Ds(e = {}) {
|
|
|
6151
6219
|
return;
|
|
6152
6220
|
}
|
|
6153
6221
|
if (t.type === "set-active") {
|
|
6154
|
-
m.value =
|
|
6222
|
+
m.value = Pn(m.value, t);
|
|
6155
6223
|
return;
|
|
6156
6224
|
}
|
|
6157
|
-
|
|
6225
|
+
Je(t.command);
|
|
6158
6226
|
}
|
|
6159
6227
|
}
|
|
6160
|
-
|
|
6161
|
-
|
|
6228
|
+
q(() => [
|
|
6229
|
+
e.mode,
|
|
6230
|
+
e.editable,
|
|
6231
|
+
O.value.phase
|
|
6232
|
+
], () => {
|
|
6233
|
+
s.value = d(e.mode), V.value && (V.value.setEditable(k.value, !1), f(V.value, {
|
|
6162
6234
|
mode: s.value,
|
|
6163
|
-
editable:
|
|
6164
|
-
}),
|
|
6165
|
-
}, { immediate: !0 }),
|
|
6166
|
-
|
|
6167
|
-
}, { immediate: !0 }),
|
|
6168
|
-
let n =
|
|
6169
|
-
if (!(!
|
|
6170
|
-
|
|
6235
|
+
editable: k.value
|
|
6236
|
+
}), mn(V.value, k.value ? "live" : "view"), F(), k.value || H());
|
|
6237
|
+
}, { immediate: !0 }), q(() => e.theme, () => {
|
|
6238
|
+
V.value && pn(V.value, c.value);
|
|
6239
|
+
}, { immediate: !0 }), q(() => [e.content, O.value.phase], ([t]) => {
|
|
6240
|
+
let n = ve(e.contentFormat);
|
|
6241
|
+
if (!(!V.value || t === void 0) && !(D && ![
|
|
6242
|
+
"ready",
|
|
6243
|
+
"error",
|
|
6244
|
+
"cancelled"
|
|
6245
|
+
].includes(O.value.phase))) {
|
|
6246
|
+
if (_e(V.value, C.value, t, n)) {
|
|
6171
6247
|
C.value = null;
|
|
6172
6248
|
return;
|
|
6173
6249
|
}
|
|
6174
|
-
C.value = null, !
|
|
6175
|
-
contentType:
|
|
6250
|
+
C.value = null, !ge(V.value, t, n) && (S.value = !0, V.value.commands.setContent(t, {
|
|
6251
|
+
contentType: he(n),
|
|
6176
6252
|
emitUpdate: !1
|
|
6177
|
-
}), S.value = !1,
|
|
6253
|
+
}), S.value = !1, O.value.phase !== "ready" && (O.value = {
|
|
6254
|
+
...O.value,
|
|
6255
|
+
phase: "ready",
|
|
6256
|
+
progress: 1,
|
|
6257
|
+
error: null
|
|
6258
|
+
}), be(V.value), k.value && ye(V.value), xe(V.value), N(V.value, Oe(t)), F());
|
|
6178
6259
|
}
|
|
6179
|
-
}),
|
|
6180
|
-
let t =
|
|
6260
|
+
}), q(Ke, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), q(We, (t) => e.onTocChange?.(t), { immediate: !0 }), q(ze, (e) => {
|
|
6261
|
+
let t = ft(e, x.value);
|
|
6181
6262
|
x.value !== t && (x.value = t);
|
|
6182
6263
|
});
|
|
6183
|
-
let
|
|
6184
|
-
|
|
6185
|
-
}),
|
|
6186
|
-
e?.type === "scroll" &&
|
|
6264
|
+
let Xe = fe(() => {
|
|
6265
|
+
V.value && h.value && de(V.value.view);
|
|
6266
|
+
}), Ze = (e) => {
|
|
6267
|
+
e?.type === "scroll" && En(e.target) || h.value && Xe.schedule();
|
|
6187
6268
|
};
|
|
6188
|
-
|
|
6189
|
-
e ?
|
|
6190
|
-
}),
|
|
6191
|
-
window.addEventListener("resize",
|
|
6192
|
-
}),
|
|
6193
|
-
|
|
6269
|
+
q(h, (e) => {
|
|
6270
|
+
e ? Ze() : Xe.cancel();
|
|
6271
|
+
}), jr(() => {
|
|
6272
|
+
window.addEventListener("resize", Ze), window.addEventListener("scroll", Ze, !0);
|
|
6273
|
+
}), Mr(() => {
|
|
6274
|
+
Xe.cancel(), window.removeEventListener("resize", Ze), window.removeEventListener("scroll", Ze, !0);
|
|
6194
6275
|
});
|
|
6195
|
-
let
|
|
6196
|
-
return
|
|
6197
|
-
|
|
6198
|
-
}),
|
|
6276
|
+
let Qe = null;
|
|
6277
|
+
return Mr(() => {
|
|
6278
|
+
j !== null && window.clearTimeout(j), M !== null && window.clearTimeout(M), le?.abort(), ce(), se?.destroy();
|
|
6279
|
+
}), jr(() => {
|
|
6199
6280
|
let e = () => {
|
|
6200
|
-
if (!
|
|
6281
|
+
if (!V.value || !ze.value.length) {
|
|
6201
6282
|
x.value = null;
|
|
6202
6283
|
return;
|
|
6203
6284
|
}
|
|
6204
6285
|
let e = null;
|
|
6205
6286
|
try {
|
|
6206
|
-
e =
|
|
6287
|
+
e = lt(V.value, ze.value);
|
|
6207
6288
|
} catch {
|
|
6208
6289
|
return;
|
|
6209
6290
|
}
|
|
6210
6291
|
x.value !== e && (x.value = e);
|
|
6211
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
6212
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
6292
|
+
}, t = () => window.requestAnimationFrame(e), n = ys(V.value?.view.dom ?? null);
|
|
6293
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Qe = () => {
|
|
6213
6294
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
6214
6295
|
};
|
|
6215
|
-
}),
|
|
6216
|
-
|
|
6217
|
-
let t =
|
|
6218
|
-
|
|
6296
|
+
}), Mr(() => {
|
|
6297
|
+
Qe?.(), B = !0, ie && e.onAiEditControllerChange?.(null), oe && e.onSearchControllerChange?.(null), te && e.onCommandControllerChange?.(null);
|
|
6298
|
+
let t = L.value;
|
|
6299
|
+
L.value = null, J(() => t?.destroy());
|
|
6219
6300
|
}), {
|
|
6220
|
-
editor:
|
|
6221
|
-
runtimeSnapshot:
|
|
6222
|
-
actions:
|
|
6301
|
+
editor: V,
|
|
6302
|
+
runtimeSnapshot: Ke,
|
|
6303
|
+
actions: qe,
|
|
6223
6304
|
__render: {
|
|
6224
6305
|
messages: a,
|
|
6225
|
-
effectiveEditable:
|
|
6226
|
-
tableFocusState:
|
|
6306
|
+
effectiveEditable: k,
|
|
6307
|
+
tableFocusState: Ce,
|
|
6227
6308
|
tableInteractionState: b,
|
|
6228
|
-
codeBlockState:
|
|
6229
|
-
isCodeBlockActive:
|
|
6309
|
+
codeBlockState: Se,
|
|
6310
|
+
isCodeBlockActive: we,
|
|
6230
6311
|
mermaidMode: v,
|
|
6231
6312
|
mathTarget: y,
|
|
6232
6313
|
setMermaidMode: (e) => {
|
|
6233
6314
|
v.value = e;
|
|
6234
6315
|
},
|
|
6235
|
-
tocState:
|
|
6236
|
-
filteredSlashCommands:
|
|
6316
|
+
tocState: We,
|
|
6317
|
+
filteredSlashCommands: Ge,
|
|
6237
6318
|
slashState: m,
|
|
6238
6319
|
slashMenuPosition: h,
|
|
6239
6320
|
slashInputCommand: g,
|
|
6240
6321
|
slashCommandError: _,
|
|
6241
|
-
runSlashCommand:
|
|
6242
|
-
handleEditorKeyDown:
|
|
6322
|
+
runSlashCommand: Je,
|
|
6323
|
+
handleEditorKeyDown: Ye,
|
|
6243
6324
|
setSlashInputCommand: (e) => {
|
|
6244
6325
|
g.value = e;
|
|
6245
6326
|
}
|
|
6246
6327
|
}
|
|
6247
6328
|
};
|
|
6248
6329
|
}
|
|
6249
|
-
var
|
|
6330
|
+
var Rs = Y({
|
|
6250
6331
|
name: "MarkweaveEditor",
|
|
6251
6332
|
props: {
|
|
6252
6333
|
defaultContent: {
|
|
@@ -6293,6 +6374,18 @@ var Os = J({
|
|
|
6293
6374
|
type: Boolean,
|
|
6294
6375
|
default: !1
|
|
6295
6376
|
},
|
|
6377
|
+
performancePolicy: {
|
|
6378
|
+
type: String,
|
|
6379
|
+
default: "auto"
|
|
6380
|
+
},
|
|
6381
|
+
editorExtensionsLoadPolicy: {
|
|
6382
|
+
type: String,
|
|
6383
|
+
default: "atomic"
|
|
6384
|
+
},
|
|
6385
|
+
onDocumentLoadStateChange: {
|
|
6386
|
+
type: Function,
|
|
6387
|
+
default: void 0
|
|
6388
|
+
},
|
|
6296
6389
|
lang: {
|
|
6297
6390
|
type: String,
|
|
6298
6391
|
default: void 0
|
|
@@ -6317,6 +6410,14 @@ var Os = J({
|
|
|
6317
6410
|
type: Function,
|
|
6318
6411
|
default: void 0
|
|
6319
6412
|
},
|
|
6413
|
+
referenceSuggestion: {
|
|
6414
|
+
type: Object,
|
|
6415
|
+
default: void 0
|
|
6416
|
+
},
|
|
6417
|
+
internalLinkCard: {
|
|
6418
|
+
type: Object,
|
|
6419
|
+
default: void 0
|
|
6420
|
+
},
|
|
6320
6421
|
className: {
|
|
6321
6422
|
type: String,
|
|
6322
6423
|
default: void 0
|
|
@@ -6369,6 +6470,10 @@ var Os = J({
|
|
|
6369
6470
|
type: Function,
|
|
6370
6471
|
default: void 0
|
|
6371
6472
|
},
|
|
6473
|
+
onSearchControllerChange: {
|
|
6474
|
+
type: Function,
|
|
6475
|
+
default: void 0
|
|
6476
|
+
},
|
|
6372
6477
|
commandGroups: {
|
|
6373
6478
|
type: Array,
|
|
6374
6479
|
default: void 0
|
|
@@ -6399,36 +6504,38 @@ var Os = J({
|
|
|
6399
6504
|
}
|
|
6400
6505
|
},
|
|
6401
6506
|
setup(e) {
|
|
6402
|
-
let t =
|
|
6507
|
+
let t = Ls(e);
|
|
6403
6508
|
return () => {
|
|
6404
6509
|
let r = t.editor.value;
|
|
6405
6510
|
if (!r) return null;
|
|
6406
|
-
let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s =
|
|
6511
|
+
let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = ze(e.canvasColor);
|
|
6407
6512
|
return U("section", {
|
|
6408
6513
|
class: o,
|
|
6409
|
-
role: "combobox",
|
|
6514
|
+
role: i.slashMenuPosition.value !== null && i.slashState.value.name !== "executing" ? "combobox" : void 0,
|
|
6410
6515
|
"aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
|
|
6411
6516
|
"aria-expanded": i.slashMenuPosition.value !== null && i.slashState.value.name !== "executing",
|
|
6412
|
-
"aria-controls": "markweave-slash-command-listbox",
|
|
6413
|
-
"aria-activedescendant": i.filteredSlashCommands.value.length && i.slashState.value.name !== "executing" ? `markweave-slash-command-option-${Math.min(i.filteredSlashCommands.value.length - 1, Math.max(0, i.slashState.value.activeIndex))}` : void 0,
|
|
6414
|
-
"aria-busy": i.slashState.value.name === "executing",
|
|
6517
|
+
"aria-controls": i.slashMenuPosition.value !== null && i.slashState.value.name !== "executing" ? "markweave-slash-command-listbox" : void 0,
|
|
6518
|
+
"aria-activedescendant": i.slashMenuPosition.value !== null && i.filteredSlashCommands.value.length && i.slashState.value.name !== "executing" ? `markweave-slash-command-option-${Math.min(i.filteredSlashCommands.value.length - 1, Math.max(0, i.slashState.value.activeIndex))}` : void 0,
|
|
6519
|
+
"aria-busy": t.runtimeSnapshot.value.performance?.loadPhase !== "ready" || i.slashState.value.name === "executing",
|
|
6415
6520
|
"data-testid": "markweave-editor-frame",
|
|
6416
6521
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
6417
|
-
"data-markweave-
|
|
6522
|
+
"data-markweave-document-loading": t.runtimeSnapshot.value.performance?.loadPhase === "ready" ? "false" : "true",
|
|
6523
|
+
"data-markweave-performance-tier": t.runtimeSnapshot.value.performance?.tier ?? "standard",
|
|
6524
|
+
"data-markweave-theme": Be(e.theme),
|
|
6418
6525
|
style: s ? { "--markweave-canvas": s } : void 0,
|
|
6419
6526
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
6420
|
-
"data-markweave-inner-toc-placement":
|
|
6527
|
+
"data-markweave-inner-toc-placement": pt(e.innerTocPlacement),
|
|
6421
6528
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
6422
6529
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
6423
6530
|
onKeydownCapture: i.handleEditorKeyDown
|
|
6424
6531
|
}, [
|
|
6425
|
-
i.effectiveEditable.value ? U(
|
|
6532
|
+
i.effectiveEditable.value ? U(Os, {
|
|
6426
6533
|
editor: r,
|
|
6427
6534
|
lang: n(e.lang),
|
|
6428
6535
|
messages: i.messages,
|
|
6429
6536
|
askAi: e.askAi
|
|
6430
6537
|
}) : null,
|
|
6431
|
-
i.effectiveEditable.value ? U(
|
|
6538
|
+
i.effectiveEditable.value ? U(As, {
|
|
6432
6539
|
commands: i.filteredSlashCommands.value,
|
|
6433
6540
|
state: i.slashState.value,
|
|
6434
6541
|
position: i.slashMenuPosition.value,
|
|
@@ -6439,7 +6546,7 @@ var Os = J({
|
|
|
6439
6546
|
onInputCommandChange: i.setSlashInputCommand,
|
|
6440
6547
|
onUpload: e.onSlashCommandUpload
|
|
6441
6548
|
}) : null,
|
|
6442
|
-
i.effectiveEditable.value ? U(
|
|
6549
|
+
i.effectiveEditable.value ? U(Ns, {
|
|
6443
6550
|
editor: r,
|
|
6444
6551
|
active: i.tableFocusState.value.active,
|
|
6445
6552
|
interactionState: i.tableInteractionState.value,
|
|
@@ -6449,11 +6556,11 @@ var Os = J({
|
|
|
6449
6556
|
onCommandResult: e.onTableCommandResult,
|
|
6450
6557
|
onEditWithAi: e.onEditWithAi
|
|
6451
6558
|
}) : null,
|
|
6452
|
-
i.effectiveEditable.value ? U(
|
|
6559
|
+
i.effectiveEditable.value ? U(Ps, {
|
|
6453
6560
|
editor: r,
|
|
6454
6561
|
focusState: i.tableFocusState.value
|
|
6455
6562
|
}) : null,
|
|
6456
|
-
U(
|
|
6563
|
+
U(Fs, {
|
|
6457
6564
|
editor: r,
|
|
6458
6565
|
state: i.codeBlockState.value,
|
|
6459
6566
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -6461,14 +6568,14 @@ var Os = J({
|
|
|
6461
6568
|
onMermaidModeChange: i.setMermaidMode,
|
|
6462
6569
|
readOnly: !i.effectiveEditable.value
|
|
6463
6570
|
}),
|
|
6464
|
-
e.innerToc && i.tocState.value.items.length ? U(
|
|
6571
|
+
e.innerToc && i.tocState.value.items.length ? U(Is, {
|
|
6465
6572
|
editor: r,
|
|
6466
6573
|
state: i.tocState.value,
|
|
6467
6574
|
messages: i.messages,
|
|
6468
6575
|
editable: i.effectiveEditable.value,
|
|
6469
|
-
placement:
|
|
6576
|
+
placement: pt(e.innerTocPlacement)
|
|
6470
6577
|
}) : null,
|
|
6471
|
-
i.effectiveEditable.value && i.mathTarget.value ? U(
|
|
6578
|
+
i.effectiveEditable.value && i.mathTarget.value ? U(ks, {
|
|
6472
6579
|
editor: r,
|
|
6473
6580
|
messages: i.messages,
|
|
6474
6581
|
target: i.mathTarget.value,
|
|
@@ -6480,4 +6587,4 @@ var Os = J({
|
|
|
6480
6587
|
}
|
|
6481
6588
|
});
|
|
6482
6589
|
//#endregion
|
|
6483
|
-
export {
|
|
6590
|
+
export { Rs as MarkweaveEditor, ie as createMarkweaveAiEditController, ba as createMarkweaveEditorExtensions, ba as createMarkweaveVue2EditorExtensions, ae as prepareMarkweaveEditorForOutput, Ls as useMarkweaveEditorController };
|