@markweave/vue2 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +25 -25
- package/dist/index.js +1658 -926
- package/dist/types/MarkweaveEditor.d.ts +2 -0
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/create-editor-extensions.d.ts +6 -1
- package/dist/types/create-editor-extensions.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/media-nodeviews.d.ts +3 -0
- package/dist/types/media-nodeviews.d.ts.map +1 -1
- package/dist/types/vue2-icons.d.ts +354 -0
- package/dist/types/vue2-icons.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8,51 +8,54 @@ import { MarkweaveLinkCard as h } from "markweave/internal/plugins/link-card/lin
|
|
|
8
8
|
import { openMarkweaveLinkCardComposer as g } from "markweave/internal/plugins/link-card/link-card-composer";
|
|
9
9
|
import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as v, replaceMarkweaveLinkCardWithLink as y } from "markweave/internal/plugins/link-card/link-card";
|
|
10
10
|
import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
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 {
|
|
11
|
+
import { createMarkweaveLightweightImageNodeViewRenderer as x } from "markweave/internal/plugins/media/lightweight-image-node-view";
|
|
12
|
+
import { resolveMarkweaveMediaSource as S } from "markweave/internal/plugins/media/media-source";
|
|
13
|
+
import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as M, normalizeMarkweaveCoreImageAlign as N, normalizeMarkweaveVideoEmbedUrl as P, numberAttribute as F, stringAttribute as I } from "markweave/internal/plugins/media/core-media-nodes";
|
|
14
|
+
import { detectUploadSource as L, getDirectUploadResult as ee, resolveMarkweaveUploadResult as R } from "markweave/internal/plugins/slash-command/upload";
|
|
15
|
+
import { BubbleMenu as z } from "@tiptap/vue-2/menus";
|
|
16
|
+
import { isEditorComposing as te } from "markweave/internal/editor-core/composition-guard";
|
|
17
|
+
import { saveMarkweaveBrowserFile as ne } from "markweave/internal/core/browser-file-save";
|
|
18
|
+
import { createMarkweaveFrameScheduler as B } from "markweave/internal/editor-core/frame-scheduler";
|
|
19
|
+
import { createMarkweaveEditorUpdatePayload as V, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
|
|
20
|
+
import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as ue, getFloatingToolbarTurnIntoOptions as de, runFloatingToolbarMoreAction as fe, setFloatingToolbarTurnInto as pe } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
21
|
+
import { openMarkweaveReadonlyLinkFromEvent as me } from "markweave/internal/editor-core/readonly-link";
|
|
22
|
+
import { createMarkweaveEditorRuntimeSnapshot as he } from "markweave/internal/editor-core/runtime-snapshot";
|
|
23
|
+
import { areEditorSelectionSnapshotsEquivalent as ge, calculateFloatingToolbarPopoverPlacement as _e, createSelectionSnapshot as ve, markweaveRuntimeProjectionDelayMs as ye, shouldShowFloatingToolbar as be } from "markweave/internal/editor-core/selection-state";
|
|
24
|
+
import { normalizeMarkweaveCanvasColor as xe, normalizeMarkweaveTheme as Se } from "markweave/internal/core/theme";
|
|
25
|
+
import { createMarkweaveTocState as Ce, emptyMarkweaveTocState as we, getActiveMarkweaveTocId as Te, getMarkweaveTocItemsFromState as Ee, getValidMarkweaveTocActiveId as De, normalizeMarkweaveInnerTocPlacement as Oe, observeMarkweaveInnerTocContainerPosition as ke, scrollToMarkweaveTocItem as Ae } from "markweave/internal/core/toc-state";
|
|
26
|
+
import { codeBlockCollapsePluginKey as je, copyActiveCodeBlock as Me, getActiveCodeBlockState as Ne, getCodeBlockCopyFeedbackSnapshot as Pe, markweaveCodeBlockBehavior as Fe, setCodeBlockCollapsedAtPosition as Ie, setCodeBlockLanguageAtPosition as Le, setCodeBlockMermaidPreviewModeAtPosition as Re } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
27
|
+
import { calculateCodeBlockLanguageMenuPosition as ze, clampFullscreenScale as Be, codeBlockCopyFeedbackTimeoutMs as Ve, copyCodeBlockText as He, createCodeBlockLanguageMenuDomId as Ue, createCodeBlockOverlayPosition as We, createMermaidFullscreenViewerState as Ge, createMermaidTabPosition as Ke, focusCodeBlockTarget as qe, formatCodeBlockLanguageLabel as Je, formatFullscreenZoom as Ye, getActiveCodeBlockElement as Xe, getAnchoredRect as Ze, getCodeBlockLanguageItems as Qe, getCodeBlockLanguageOptionDomId as $e, getCodeBlockPositionFromEventTarget as et, getCodeBlockStateAtPosition as tt, getFrameElement as nt, getInitialCodeBlockLanguageItemIndex as rt, getMermaidCodeBlockTargets as it, getMermaidSvgMarkup as at, isCodeBlockTargetCollapsed as ot, mergeStableMermaidTabPositions as st, mermaidFullscreenZoomStep as ct, moveCodeBlockLanguageItemIndex as lt, moveMermaidFullscreenViewer as ut, scrollCodeBlockLanguageItemIntoView as dt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
28
|
+
import { normalizeMarkdownLinkHref as ft } from "markweave/internal/plugins/markdown/markdown-input";
|
|
29
|
+
import { applyMarkweaveMathLatex as pt, calculateMarkweaveMathPopoverPosition as mt, getMarkweaveMathAnchorRect as ht, getMarkweaveMathBlockIndex as gt, getMarkweaveMathRenderedHtml as _t, getMarkweaveMathTargetAtPos as vt, getMarkweaveMathTargetFromDomEvent as yt, getMarkweaveMathTargetFromSelection as bt, renderMarkweaveMathPreview as xt, setMarkweaveMathEditingDomState as St, setMarkweaveMathEditingDomStateInView as Ct, setMarkweaveMathSelectionInView as wt } from "markweave/internal/plugins/math/math-ui-model";
|
|
30
|
+
import { isMermaidInlinePreviewTransaction as Tt, setMarkweaveMermaidTheme as Et, setMermaidInlinePreviewEditorMode as Dt, setReadonlyMermaidPreviewMode as Ot } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
31
|
+
import { getMermaidPreviewState as kt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
32
|
+
import { filterSlashCommands as At, isExecutableSlashCommand as jt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
33
|
+
import { getSlashCommandKeyboardAction as Mt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
34
|
+
import { areSlashCommandMenuPositionsEquivalent as Nt, executeSlashCommand as Pt, getNextSlashCommandState as Ft, getSlashCommandAnchoredMenuPosition as It, getSlashCommandContext as Lt, isSlashCommandAnchorVisible as Rt } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
35
|
+
import { initialSlashCommandState as zt, reduceSlashCommandState as Bt } from "markweave/internal/plugins/slash-command/slash-state";
|
|
36
|
+
import { setMarkweaveTableMenuAxisTarget as Vt } from "markweave/internal/plugins/table/table-clipboard";
|
|
37
|
+
import { getFirstTableDebugSnapshot as Ht } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
38
|
+
import { focusFirstTableBodyCell as Ut } from "markweave/internal/plugins/table/table-focus-position";
|
|
39
|
+
import { getTableFocusState as Wt } from "markweave/internal/plugins/table/table-focus-state";
|
|
40
|
+
import { getTableSelectionOverlayState as Gt, initialTableInteractionState as Kt, tableInteractionPluginKey as qt } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
41
|
+
import { applyTableAxisAlignment as Jt, applyTableAxisBackgroundColor as Yt, applyTableAxisTextColor as Xt, calculateAnchoredTableMenuPosition as Zt, calculateTableAxisHandleLayout as Qt, calculateTableExtendButtonLayout as $t, canRunTableCommand as en, executeTableMenuCommand as tn, formatTableCopyFeedback as nn, getActiveTableElement as rn, getAvailableCellMenuCommandSpecs as an, getTableAxisDropIndexAtPoint as on, getTableAxisFormattingState as sn, getTableAxisTargetRect as cn, getTableControlAxisSelectionModel as ln, getTableEditWithAiRequest as un, getTableMenuItemGroup as dn, getTableMenuItemLabel as fn, getTableMenuItems as pn, getTableSelectionTargetRect as mn, measureTableSelectionOverlay as hn, moveTargetedTableAxis as gn, selectTableAxisFromCell as _n, tableColorOptions as vn, tableCopyFeedbackTimeoutMs as yn, tableHorizontalAlignmentOptions as bn, tableMenuLabel as xn, tableVerticalAlignmentOptions as Sn, targetTableAxisFromCell as Cn } from "markweave/internal/plugins/table/table-ui-model";
|
|
39
42
|
//#region src/vue2-compat.ts
|
|
40
|
-
var
|
|
41
|
-
function
|
|
43
|
+
var wn = l.default ?? l, Tn = null, En = null, Dn = null;
|
|
44
|
+
function On(e) {
|
|
42
45
|
return !!(e && typeof e == "object" && "value" in e);
|
|
43
46
|
}
|
|
44
|
-
function
|
|
47
|
+
function kn(e) {
|
|
45
48
|
let t = e.slice(2);
|
|
46
49
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
47
50
|
}
|
|
48
|
-
function
|
|
51
|
+
function An(e) {
|
|
49
52
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
50
53
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
51
54
|
if (o === "class" || o === "style" || o === "key") {
|
|
52
55
|
t[o] = s;
|
|
53
56
|
continue;
|
|
54
57
|
}
|
|
55
|
-
if (o === "ref" &&
|
|
58
|
+
if (o === "ref" && On(s)) {
|
|
56
59
|
a.insert = (e) => {
|
|
57
60
|
s.value = e.elm;
|
|
58
61
|
}, a.destroy = () => {
|
|
@@ -61,7 +64,7 @@ function dn(e) {
|
|
|
61
64
|
continue;
|
|
62
65
|
}
|
|
63
66
|
if (/^on[A-Z]/.test(o)) {
|
|
64
|
-
i[
|
|
67
|
+
i[kn(o)] = s;
|
|
65
68
|
continue;
|
|
66
69
|
}
|
|
67
70
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -72,14 +75,14 @@ function dn(e) {
|
|
|
72
75
|
}
|
|
73
76
|
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;
|
|
74
77
|
}
|
|
75
|
-
function
|
|
78
|
+
function jn(e) {
|
|
76
79
|
let t = {}, n = {}, r = {}, i = {};
|
|
77
80
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
78
81
|
if (a === "class" || a === "style" || a === "key") {
|
|
79
82
|
t[a] = o;
|
|
80
83
|
continue;
|
|
81
84
|
}
|
|
82
|
-
if (a === "ref" &&
|
|
85
|
+
if (a === "ref" && On(o)) {
|
|
83
86
|
i.insert = (e) => {
|
|
84
87
|
o.value = e.componentInstance ?? e.elm;
|
|
85
88
|
}, i.destroy = () => {
|
|
@@ -95,47 +98,47 @@ function fn(e) {
|
|
|
95
98
|
}
|
|
96
99
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
97
100
|
}
|
|
98
|
-
function
|
|
101
|
+
function Mn(e) {
|
|
99
102
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
100
103
|
}
|
|
101
|
-
function
|
|
104
|
+
function Nn(e) {
|
|
102
105
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
103
106
|
}
|
|
104
|
-
function
|
|
107
|
+
function Pn(e) {
|
|
105
108
|
return e == null || Array.isArray(e) ? e : [e];
|
|
106
109
|
}
|
|
107
|
-
function
|
|
108
|
-
return typeof e == "function" ?
|
|
110
|
+
function Fn(e) {
|
|
111
|
+
return typeof e == "function" ? Pn(e()) : Mn(e) ? Pn(e.default()) : Nn(e) ? [e] : e;
|
|
109
112
|
}
|
|
110
|
-
function
|
|
111
|
-
if (!
|
|
112
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
113
|
-
return
|
|
113
|
+
function H(e, t, n) {
|
|
114
|
+
if (!Dn) throw Error("Vue 2 render context is not available.");
|
|
115
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? An(r) : jn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Fn(n);
|
|
116
|
+
return Dn(e, i, a);
|
|
114
117
|
}
|
|
115
|
-
function V(e) {
|
|
116
|
-
return an.observable({ value: e });
|
|
117
|
-
}
|
|
118
|
-
var H = V;
|
|
119
118
|
function U(e) {
|
|
119
|
+
return wn.observable({ value: e });
|
|
120
|
+
}
|
|
121
|
+
var W = U;
|
|
122
|
+
function G(e) {
|
|
120
123
|
return { get value() {
|
|
121
124
|
return e();
|
|
122
125
|
} };
|
|
123
126
|
}
|
|
124
|
-
function
|
|
127
|
+
function K(e, t, n) {
|
|
125
128
|
let r = typeof e == "function" ? e : () => e.value;
|
|
126
|
-
return
|
|
129
|
+
return Tn?.$watch ? Tn.$watch(r, t, n) : () => void 0;
|
|
127
130
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
function K(e) {
|
|
132
|
-
sn?.beforeUnmount.push(e);
|
|
131
|
+
function In(e) {
|
|
132
|
+
En?.mounted.push(e);
|
|
133
133
|
}
|
|
134
134
|
function q(e) {
|
|
135
|
-
|
|
135
|
+
En?.beforeUnmount.push(e);
|
|
136
136
|
}
|
|
137
137
|
function J(e) {
|
|
138
|
-
return
|
|
138
|
+
return wn.nextTick(e);
|
|
139
|
+
}
|
|
140
|
+
function Y(e) {
|
|
141
|
+
return wn.extend({
|
|
139
142
|
name: e.name,
|
|
140
143
|
props: e.props,
|
|
141
144
|
created() {
|
|
@@ -143,12 +146,12 @@ function J(e) {
|
|
|
143
146
|
mounted: [],
|
|
144
147
|
beforeUnmount: []
|
|
145
148
|
};
|
|
146
|
-
|
|
149
|
+
Tn = this, En = t;
|
|
147
150
|
try {
|
|
148
151
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
149
152
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
150
153
|
} finally {
|
|
151
|
-
|
|
154
|
+
Tn = null, En = null;
|
|
152
155
|
}
|
|
153
156
|
},
|
|
154
157
|
mounted() {
|
|
@@ -158,19 +161,413 @@ function J(e) {
|
|
|
158
161
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
159
162
|
},
|
|
160
163
|
render(t) {
|
|
161
|
-
|
|
164
|
+
Dn = t;
|
|
162
165
|
try {
|
|
163
166
|
let n = this.__markweaveVue2Render;
|
|
164
167
|
return n ? n() : e.render?.(t) ?? null;
|
|
165
168
|
} finally {
|
|
166
|
-
|
|
169
|
+
Dn = null;
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
174
|
//#endregion
|
|
172
175
|
//#region src/vue2-icons.ts
|
|
173
|
-
var
|
|
176
|
+
var Ln = {
|
|
177
|
+
AlignVerticalJustifyCenter: {
|
|
178
|
+
iconName: "align-vertical-justify-center",
|
|
179
|
+
node: [
|
|
180
|
+
["rect", {
|
|
181
|
+
width: "14",
|
|
182
|
+
height: "6",
|
|
183
|
+
x: "5",
|
|
184
|
+
y: "16",
|
|
185
|
+
rx: "2",
|
|
186
|
+
key: "1i8z2d"
|
|
187
|
+
}],
|
|
188
|
+
["rect", {
|
|
189
|
+
width: "10",
|
|
190
|
+
height: "6",
|
|
191
|
+
x: "7",
|
|
192
|
+
y: "2",
|
|
193
|
+
rx: "2",
|
|
194
|
+
key: "ypihtt"
|
|
195
|
+
}],
|
|
196
|
+
["path", {
|
|
197
|
+
d: "M2 12h20",
|
|
198
|
+
key: "9i4pu4"
|
|
199
|
+
}]
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
AlignVerticalJustifyEnd: {
|
|
203
|
+
iconName: "align-vertical-justify-end",
|
|
204
|
+
node: [
|
|
205
|
+
["rect", {
|
|
206
|
+
width: "14",
|
|
207
|
+
height: "6",
|
|
208
|
+
x: "5",
|
|
209
|
+
y: "12",
|
|
210
|
+
rx: "2",
|
|
211
|
+
key: "4l4tp2"
|
|
212
|
+
}],
|
|
213
|
+
["rect", {
|
|
214
|
+
width: "10",
|
|
215
|
+
height: "6",
|
|
216
|
+
x: "7",
|
|
217
|
+
y: "2",
|
|
218
|
+
rx: "2",
|
|
219
|
+
key: "ypihtt"
|
|
220
|
+
}],
|
|
221
|
+
["path", {
|
|
222
|
+
d: "M2 22h20",
|
|
223
|
+
key: "272qi7"
|
|
224
|
+
}]
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
AlignVerticalJustifyStart: {
|
|
228
|
+
iconName: "align-vertical-justify-start",
|
|
229
|
+
node: [
|
|
230
|
+
["rect", {
|
|
231
|
+
width: "14",
|
|
232
|
+
height: "6",
|
|
233
|
+
x: "5",
|
|
234
|
+
y: "16",
|
|
235
|
+
rx: "2",
|
|
236
|
+
key: "1i8z2d"
|
|
237
|
+
}],
|
|
238
|
+
["rect", {
|
|
239
|
+
width: "10",
|
|
240
|
+
height: "6",
|
|
241
|
+
x: "7",
|
|
242
|
+
y: "6",
|
|
243
|
+
rx: "2",
|
|
244
|
+
key: "13squh"
|
|
245
|
+
}],
|
|
246
|
+
["path", {
|
|
247
|
+
d: "M2 2h20",
|
|
248
|
+
key: "1ennik"
|
|
249
|
+
}]
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
ArrowDown: {
|
|
253
|
+
iconName: "arrow-down",
|
|
254
|
+
node: [["path", {
|
|
255
|
+
d: "M12 5v14",
|
|
256
|
+
key: "s699le"
|
|
257
|
+
}], ["path", {
|
|
258
|
+
d: "m19 12-7 7-7-7",
|
|
259
|
+
key: "1idqje"
|
|
260
|
+
}]]
|
|
261
|
+
},
|
|
262
|
+
ArrowDownAZ: {
|
|
263
|
+
iconName: "arrow-down-a-z",
|
|
264
|
+
node: [
|
|
265
|
+
["path", {
|
|
266
|
+
d: "m3 16 4 4 4-4",
|
|
267
|
+
key: "1co6wj"
|
|
268
|
+
}],
|
|
269
|
+
["path", {
|
|
270
|
+
d: "M7 20V4",
|
|
271
|
+
key: "1yoxec"
|
|
272
|
+
}],
|
|
273
|
+
["path", {
|
|
274
|
+
d: "M20 8h-5",
|
|
275
|
+
key: "1vsyxs"
|
|
276
|
+
}],
|
|
277
|
+
["path", {
|
|
278
|
+
d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10",
|
|
279
|
+
key: "ag13bf"
|
|
280
|
+
}],
|
|
281
|
+
["path", {
|
|
282
|
+
d: "M15 14h5l-5 6h5",
|
|
283
|
+
key: "ur5jdg"
|
|
284
|
+
}]
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
ArrowLeft: {
|
|
288
|
+
iconName: "arrow-left",
|
|
289
|
+
node: [["path", {
|
|
290
|
+
d: "m12 19-7-7 7-7",
|
|
291
|
+
key: "1l729n"
|
|
292
|
+
}], ["path", {
|
|
293
|
+
d: "M19 12H5",
|
|
294
|
+
key: "x3x0zl"
|
|
295
|
+
}]]
|
|
296
|
+
},
|
|
297
|
+
ArrowRight: {
|
|
298
|
+
iconName: "arrow-right",
|
|
299
|
+
node: [["path", {
|
|
300
|
+
d: "M5 12h14",
|
|
301
|
+
key: "1ays0h"
|
|
302
|
+
}], ["path", {
|
|
303
|
+
d: "m12 5 7 7-7 7",
|
|
304
|
+
key: "xquz4c"
|
|
305
|
+
}]]
|
|
306
|
+
},
|
|
307
|
+
ArrowUp: {
|
|
308
|
+
iconName: "arrow-up",
|
|
309
|
+
node: [["path", {
|
|
310
|
+
d: "m5 12 7-7 7 7",
|
|
311
|
+
key: "hav0vg"
|
|
312
|
+
}], ["path", {
|
|
313
|
+
d: "M12 19V5",
|
|
314
|
+
key: "x0mq9r"
|
|
315
|
+
}]]
|
|
316
|
+
},
|
|
317
|
+
ArrowUpZA: {
|
|
318
|
+
iconName: "arrow-up-z-a",
|
|
319
|
+
node: [
|
|
320
|
+
["path", {
|
|
321
|
+
d: "m3 8 4-4 4 4",
|
|
322
|
+
key: "11wl7u"
|
|
323
|
+
}],
|
|
324
|
+
["path", {
|
|
325
|
+
d: "M7 4v16",
|
|
326
|
+
key: "1glfcx"
|
|
327
|
+
}],
|
|
328
|
+
["path", {
|
|
329
|
+
d: "M15 4h5l-5 6h5",
|
|
330
|
+
key: "8asdl1"
|
|
331
|
+
}],
|
|
332
|
+
["path", {
|
|
333
|
+
d: "M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",
|
|
334
|
+
key: "r6l5cz"
|
|
335
|
+
}],
|
|
336
|
+
["path", {
|
|
337
|
+
d: "M20 18h-5",
|
|
338
|
+
key: "18j1r2"
|
|
339
|
+
}]
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
BetweenHorizontalEnd: {
|
|
343
|
+
iconName: "between-horizontal-end",
|
|
344
|
+
node: [
|
|
345
|
+
["rect", {
|
|
346
|
+
width: "13",
|
|
347
|
+
height: "7",
|
|
348
|
+
x: "3",
|
|
349
|
+
y: "3",
|
|
350
|
+
rx: "1",
|
|
351
|
+
key: "11xb64"
|
|
352
|
+
}],
|
|
353
|
+
["path", {
|
|
354
|
+
d: "m22 15-3-3 3-3",
|
|
355
|
+
key: "26chmm"
|
|
356
|
+
}],
|
|
357
|
+
["rect", {
|
|
358
|
+
width: "13",
|
|
359
|
+
height: "7",
|
|
360
|
+
x: "3",
|
|
361
|
+
y: "14",
|
|
362
|
+
rx: "1",
|
|
363
|
+
key: "k6ky7n"
|
|
364
|
+
}]
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
BetweenHorizontalStart: {
|
|
368
|
+
iconName: "between-horizontal-start",
|
|
369
|
+
node: [
|
|
370
|
+
["rect", {
|
|
371
|
+
width: "13",
|
|
372
|
+
height: "7",
|
|
373
|
+
x: "8",
|
|
374
|
+
y: "3",
|
|
375
|
+
rx: "1",
|
|
376
|
+
key: "pkso9a"
|
|
377
|
+
}],
|
|
378
|
+
["path", {
|
|
379
|
+
d: "m2 9 3 3-3 3",
|
|
380
|
+
key: "1agib5"
|
|
381
|
+
}],
|
|
382
|
+
["rect", {
|
|
383
|
+
width: "13",
|
|
384
|
+
height: "7",
|
|
385
|
+
x: "8",
|
|
386
|
+
y: "14",
|
|
387
|
+
rx: "1",
|
|
388
|
+
key: "1q5fc1"
|
|
389
|
+
}]
|
|
390
|
+
]
|
|
391
|
+
},
|
|
392
|
+
BetweenVerticalEnd: {
|
|
393
|
+
iconName: "between-vertical-end",
|
|
394
|
+
node: [
|
|
395
|
+
["rect", {
|
|
396
|
+
width: "7",
|
|
397
|
+
height: "13",
|
|
398
|
+
x: "3",
|
|
399
|
+
y: "3",
|
|
400
|
+
rx: "1",
|
|
401
|
+
key: "1fdu0f"
|
|
402
|
+
}],
|
|
403
|
+
["path", {
|
|
404
|
+
d: "m9 22 3-3 3 3",
|
|
405
|
+
key: "17z65a"
|
|
406
|
+
}],
|
|
407
|
+
["rect", {
|
|
408
|
+
width: "7",
|
|
409
|
+
height: "13",
|
|
410
|
+
x: "14",
|
|
411
|
+
y: "3",
|
|
412
|
+
rx: "1",
|
|
413
|
+
key: "1squn4"
|
|
414
|
+
}]
|
|
415
|
+
]
|
|
416
|
+
},
|
|
417
|
+
BetweenVerticalStart: {
|
|
418
|
+
iconName: "between-vertical-start",
|
|
419
|
+
node: [
|
|
420
|
+
["rect", {
|
|
421
|
+
width: "7",
|
|
422
|
+
height: "13",
|
|
423
|
+
x: "3",
|
|
424
|
+
y: "8",
|
|
425
|
+
rx: "1",
|
|
426
|
+
key: "1fjrkv"
|
|
427
|
+
}],
|
|
428
|
+
["path", {
|
|
429
|
+
d: "m15 2-3 3-3-3",
|
|
430
|
+
key: "1uh6eb"
|
|
431
|
+
}],
|
|
432
|
+
["rect", {
|
|
433
|
+
width: "7",
|
|
434
|
+
height: "13",
|
|
435
|
+
x: "14",
|
|
436
|
+
y: "8",
|
|
437
|
+
rx: "1",
|
|
438
|
+
key: "w3fjg8"
|
|
439
|
+
}]
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
ChevronRight: {
|
|
443
|
+
iconName: "chevron-right",
|
|
444
|
+
node: [["path", {
|
|
445
|
+
d: "m9 18 6-6-6-6",
|
|
446
|
+
key: "mthhwq"
|
|
447
|
+
}]]
|
|
448
|
+
},
|
|
449
|
+
Copy: {
|
|
450
|
+
iconName: "copy",
|
|
451
|
+
node: [["rect", {
|
|
452
|
+
width: "14",
|
|
453
|
+
height: "14",
|
|
454
|
+
x: "8",
|
|
455
|
+
y: "8",
|
|
456
|
+
rx: "2",
|
|
457
|
+
ry: "2",
|
|
458
|
+
key: "17jyea"
|
|
459
|
+
}], ["path", {
|
|
460
|
+
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
|
|
461
|
+
key: "zix9uf"
|
|
462
|
+
}]]
|
|
463
|
+
},
|
|
464
|
+
PaintBucket: {
|
|
465
|
+
iconName: "paint-bucket",
|
|
466
|
+
node: [
|
|
467
|
+
["path", {
|
|
468
|
+
d: "m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",
|
|
469
|
+
key: "irua1i"
|
|
470
|
+
}],
|
|
471
|
+
["path", {
|
|
472
|
+
d: "m5 2 5 5",
|
|
473
|
+
key: "1lls2c"
|
|
474
|
+
}],
|
|
475
|
+
["path", {
|
|
476
|
+
d: "M2 13h15",
|
|
477
|
+
key: "1hkzvu"
|
|
478
|
+
}],
|
|
479
|
+
["path", {
|
|
480
|
+
d: "M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",
|
|
481
|
+
key: "xk76lq"
|
|
482
|
+
}]
|
|
483
|
+
]
|
|
484
|
+
},
|
|
485
|
+
Plus: {
|
|
486
|
+
iconName: "plus",
|
|
487
|
+
node: [["path", {
|
|
488
|
+
d: "M5 12h14",
|
|
489
|
+
key: "1ays0h"
|
|
490
|
+
}], ["path", {
|
|
491
|
+
d: "M12 5v14",
|
|
492
|
+
key: "s699le"
|
|
493
|
+
}]]
|
|
494
|
+
},
|
|
495
|
+
SquareX: {
|
|
496
|
+
iconName: "square-x",
|
|
497
|
+
node: [
|
|
498
|
+
["rect", {
|
|
499
|
+
width: "18",
|
|
500
|
+
height: "18",
|
|
501
|
+
x: "3",
|
|
502
|
+
y: "3",
|
|
503
|
+
rx: "2",
|
|
504
|
+
ry: "2",
|
|
505
|
+
key: "1m3agn"
|
|
506
|
+
}],
|
|
507
|
+
["path", {
|
|
508
|
+
d: "m15 9-6 6",
|
|
509
|
+
key: "1uzhvr"
|
|
510
|
+
}],
|
|
511
|
+
["path", {
|
|
512
|
+
d: "m9 9 6 6",
|
|
513
|
+
key: "z0biqf"
|
|
514
|
+
}]
|
|
515
|
+
]
|
|
516
|
+
},
|
|
517
|
+
TableCellsMerge: {
|
|
518
|
+
iconName: "table-cells-merge",
|
|
519
|
+
node: [
|
|
520
|
+
["path", {
|
|
521
|
+
d: "M12 21v-6",
|
|
522
|
+
key: "lihzve"
|
|
523
|
+
}],
|
|
524
|
+
["path", {
|
|
525
|
+
d: "M12 9V3",
|
|
526
|
+
key: "da5inc"
|
|
527
|
+
}],
|
|
528
|
+
["path", {
|
|
529
|
+
d: "M3 15h18",
|
|
530
|
+
key: "5xshup"
|
|
531
|
+
}],
|
|
532
|
+
["path", {
|
|
533
|
+
d: "M3 9h18",
|
|
534
|
+
key: "1pudct"
|
|
535
|
+
}],
|
|
536
|
+
["rect", {
|
|
537
|
+
width: "18",
|
|
538
|
+
height: "18",
|
|
539
|
+
x: "3",
|
|
540
|
+
y: "3",
|
|
541
|
+
rx: "2",
|
|
542
|
+
key: "afitv7"
|
|
543
|
+
}]
|
|
544
|
+
]
|
|
545
|
+
},
|
|
546
|
+
TableCellsSplit: {
|
|
547
|
+
iconName: "table-cells-split",
|
|
548
|
+
node: [
|
|
549
|
+
["path", {
|
|
550
|
+
d: "M12 15V9",
|
|
551
|
+
key: "8c7uyn"
|
|
552
|
+
}],
|
|
553
|
+
["path", {
|
|
554
|
+
d: "M3 15h18",
|
|
555
|
+
key: "5xshup"
|
|
556
|
+
}],
|
|
557
|
+
["path", {
|
|
558
|
+
d: "M3 9h18",
|
|
559
|
+
key: "1pudct"
|
|
560
|
+
}],
|
|
561
|
+
["rect", {
|
|
562
|
+
width: "18",
|
|
563
|
+
height: "18",
|
|
564
|
+
x: "3",
|
|
565
|
+
y: "3",
|
|
566
|
+
rx: "2",
|
|
567
|
+
key: "afitv7"
|
|
568
|
+
}]
|
|
569
|
+
]
|
|
570
|
+
},
|
|
174
571
|
AlignCenter: {
|
|
175
572
|
iconName: "text-align-center",
|
|
176
573
|
node: [
|
|
@@ -1035,11 +1432,11 @@ var _n = {
|
|
|
1035
1432
|
}]]
|
|
1036
1433
|
}
|
|
1037
1434
|
};
|
|
1038
|
-
function
|
|
1039
|
-
return e.map(([e, t]) =>
|
|
1435
|
+
function Rn(e) {
|
|
1436
|
+
return e.map(([e, t]) => H(e, t));
|
|
1040
1437
|
}
|
|
1041
|
-
function
|
|
1042
|
-
return
|
|
1438
|
+
function X(e) {
|
|
1439
|
+
return Y({
|
|
1043
1440
|
name: `MarkweaveVue2Icon${e}`,
|
|
1044
1441
|
props: {
|
|
1045
1442
|
size: {
|
|
@@ -1056,8 +1453,8 @@ function Y(e) {
|
|
|
1056
1453
|
}
|
|
1057
1454
|
},
|
|
1058
1455
|
setup(t) {
|
|
1059
|
-
let n =
|
|
1060
|
-
return () =>
|
|
1456
|
+
let n = Ln[e];
|
|
1457
|
+
return () => H("svg", {
|
|
1061
1458
|
class: `lucide lucide-${n.iconName}`,
|
|
1062
1459
|
viewBox: "0 0 24 24",
|
|
1063
1460
|
width: t.size,
|
|
@@ -1069,12 +1466,12 @@ function Y(e) {
|
|
|
1069
1466
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1070
1467
|
"aria-hidden": "true",
|
|
1071
1468
|
focusable: "false"
|
|
1072
|
-
},
|
|
1469
|
+
}, Rn(n.node));
|
|
1073
1470
|
}
|
|
1074
1471
|
});
|
|
1075
1472
|
}
|
|
1076
|
-
var
|
|
1077
|
-
function
|
|
1473
|
+
var zn = X("AlignCenter"), Bn = X("AlignJustify"), Vn = X("AlignLeft"), Hn = X("AlignRight"), Un = X("AlignVerticalJustifyCenter"), Wn = X("AlignVerticalJustifyEnd"), Gn = X("AlignVerticalJustifyStart"), Kn = X("AlertTriangle"), qn = X("ArrowDown"), Jn = X("ArrowDownAZ"), Yn = X("ArrowLeft"), Xn = X("ArrowRight"), Zn = X("ArrowUp"), Qn = X("ArrowUpZA"), $n = X("BetweenHorizontalEnd"), er = X("BetweenHorizontalStart"), tr = X("BetweenVerticalEnd"), nr = X("BetweenVerticalStart"), rr = X("Bold"), ir = X("Braces"), ar = X("Captions"), or = X("CheckCircle2"), sr = X("ChevronDown"), cr = X("ChevronRight"), lr = X("ChevronUp"), ur = X("CircleX"), dr = X("Code2"), fr = X("CornerDownLeft"), pr = X("Copy"), mr = X("Download"), hr = X("Eye"), gr = X("ExternalLink"), _r = X("Heading1"), vr = X("Heading2"), yr = X("Heading3"), br = X("Image"), xr = X("ImageUp"), Sr = X("IndentDecrease"), Cr = X("IndentIncrease"), wr = X("Info"), Tr = X("Italic"), Er = X("Lightbulb"), Dr = X("Link2"), Or = X("List"), kr = X("ListChecks"), Ar = X("ListOrdered"), jr = X("Minus"), Mr = X("MoreVertical"), Nr = X("PaintBucket"), Pr = X("Paperclip"), Fr = X("PencilLine"), Ir = X("Plus"), Lr = X("Quote"), Rr = X("Replace"), zr = X("Sigma"), Br = X("SmilePlus"), Vr = X("SquareX"), Hr = X("Strikethrough"), Ur = X("Subscript"), Wr = X("Superscript"), Gr = X("Table2"), Kr = X("TableCellsMerge"), qr = X("TableCellsSplit"), Jr = X("Text"), Yr = X("Trash2"), Xr = X("Type"), Zr = X("Underline"), Qr = X("Upload"), $r = X("Video"), ei = N;
|
|
1474
|
+
function ti(e) {
|
|
1078
1475
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1079
1476
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1080
1477
|
return n === "view" ? {
|
|
@@ -1084,7 +1481,7 @@ function hr(e) {
|
|
|
1084
1481
|
mode: "live",
|
|
1085
1482
|
editable: e.isEditable
|
|
1086
1483
|
} : u(e);
|
|
1087
|
-
}, r =
|
|
1484
|
+
}, r = U(n()), i = m(e, () => {
|
|
1088
1485
|
r.value = n();
|
|
1089
1486
|
}), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
|
|
1090
1487
|
r.value = n();
|
|
@@ -1092,28 +1489,28 @@ function hr(e) {
|
|
|
1092
1489
|
return a && t && a.observe(t, {
|
|
1093
1490
|
attributes: !0,
|
|
1094
1491
|
attributeFilter: ["data-markweave-mode"]
|
|
1095
|
-
}),
|
|
1492
|
+
}), q(() => {
|
|
1096
1493
|
i(), a?.disconnect();
|
|
1097
1494
|
}), r;
|
|
1098
1495
|
}
|
|
1099
|
-
function
|
|
1496
|
+
function ni(e) {
|
|
1100
1497
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1101
1498
|
}
|
|
1102
|
-
function
|
|
1499
|
+
function ri(e) {
|
|
1103
1500
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1104
1501
|
}
|
|
1105
|
-
function
|
|
1502
|
+
function ii(e) {
|
|
1106
1503
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1107
1504
|
}
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1505
|
+
function ai(e, t) {
|
|
1506
|
+
return H(e, {
|
|
1110
1507
|
size: 18,
|
|
1111
1508
|
strokeWidth: 1.8,
|
|
1112
1509
|
"aria-hidden": "true"
|
|
1113
1510
|
}, { default: () => t });
|
|
1114
1511
|
}
|
|
1115
|
-
function
|
|
1116
|
-
return
|
|
1512
|
+
function oi(e) {
|
|
1513
|
+
return H("button", {
|
|
1117
1514
|
type: "button",
|
|
1118
1515
|
"aria-label": e.label,
|
|
1119
1516
|
title: e.label,
|
|
@@ -1121,14 +1518,14 @@ function X(e) {
|
|
|
1121
1518
|
"data-active": e.active ? "true" : "false",
|
|
1122
1519
|
onMousedown: (e) => e.preventDefault(),
|
|
1123
1520
|
onClick: e.onClick
|
|
1124
|
-
}, [
|
|
1521
|
+
}, [ai(e.icon, e.label), H("span", {
|
|
1125
1522
|
class: "markweave-image-tooltip",
|
|
1126
1523
|
role: "tooltip"
|
|
1127
1524
|
}, e.label)]);
|
|
1128
1525
|
}
|
|
1129
|
-
function
|
|
1130
|
-
let t =
|
|
1131
|
-
return
|
|
1526
|
+
function si(e) {
|
|
1527
|
+
let t = U(null), n = e.messages.image;
|
|
1528
|
+
return H("section", {
|
|
1132
1529
|
class: "markweave-image-upload-placeholder",
|
|
1133
1530
|
"data-testid": "markweave-image-upload-placeholder",
|
|
1134
1531
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1146,7 +1543,7 @@ function br(e) {
|
|
|
1146
1543
|
n && e.onFile(n);
|
|
1147
1544
|
}
|
|
1148
1545
|
}, [
|
|
1149
|
-
|
|
1546
|
+
H("input", {
|
|
1150
1547
|
ref: t,
|
|
1151
1548
|
"data-testid": "markweave-image-file-input",
|
|
1152
1549
|
type: "file",
|
|
@@ -1157,20 +1554,20 @@ function br(e) {
|
|
|
1157
1554
|
r && e.onFile(r), n.value = "";
|
|
1158
1555
|
}
|
|
1159
1556
|
}),
|
|
1160
|
-
|
|
1557
|
+
H("div", {
|
|
1161
1558
|
class: "markweave-image-upload-icon",
|
|
1162
1559
|
"aria-hidden": "true"
|
|
1163
|
-
}, [
|
|
1560
|
+
}, [H(xr, {
|
|
1164
1561
|
size: 46,
|
|
1165
1562
|
strokeWidth: 1.6
|
|
1166
1563
|
})]),
|
|
1167
|
-
|
|
1564
|
+
H("div", { class: "markweave-image-upload-copy" }, [H("button", {
|
|
1168
1565
|
type: "button",
|
|
1169
1566
|
onClick: () => t.value?.click()
|
|
1170
|
-
}, n.clickToUpload),
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1567
|
+
}, n.clickToUpload), H("span", null, n.dragAndDrop)]),
|
|
1568
|
+
H("div", { class: "markweave-image-upload-note" }, n.uploadNote),
|
|
1569
|
+
H("div", { class: "markweave-image-upload-row" }, [
|
|
1570
|
+
H("input", {
|
|
1174
1571
|
"data-testid": "markweave-image-url-input",
|
|
1175
1572
|
value: e.inputValue,
|
|
1176
1573
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1180,30 +1577,30 @@ function br(e) {
|
|
|
1180
1577
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1181
1578
|
}
|
|
1182
1579
|
}),
|
|
1183
|
-
|
|
1580
|
+
H("button", {
|
|
1184
1581
|
type: "button",
|
|
1185
1582
|
"data-testid": "markweave-image-upload-submit",
|
|
1186
1583
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1187
1584
|
onClick: e.onSubmit
|
|
1188
|
-
}, [
|
|
1585
|
+
}, [H(xr, {
|
|
1189
1586
|
size: 16,
|
|
1190
1587
|
strokeWidth: 1.8
|
|
1191
1588
|
}), e.messages.common.insert]),
|
|
1192
|
-
|
|
1589
|
+
H("button", {
|
|
1193
1590
|
type: "button",
|
|
1194
1591
|
"data-testid": "markweave-image-upload-cancel",
|
|
1195
1592
|
onClick: e.onCancel
|
|
1196
1593
|
}, e.messages.common.cancel)
|
|
1197
1594
|
]),
|
|
1198
|
-
e.error ?
|
|
1595
|
+
e.error ? H("div", {
|
|
1199
1596
|
class: "markweave-image-upload-error",
|
|
1200
1597
|
role: "alert"
|
|
1201
1598
|
}, e.error) : null
|
|
1202
1599
|
]);
|
|
1203
1600
|
}
|
|
1204
|
-
function
|
|
1205
|
-
let t =
|
|
1206
|
-
return
|
|
1601
|
+
function ci(e) {
|
|
1602
|
+
let t = U(null), n = e.messages.video;
|
|
1603
|
+
return H("section", {
|
|
1207
1604
|
class: "markweave-video-upload-placeholder",
|
|
1208
1605
|
"data-testid": "markweave-video-upload-placeholder",
|
|
1209
1606
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1221,7 +1618,7 @@ function xr(e) {
|
|
|
1221
1618
|
n && e.onFile(n);
|
|
1222
1619
|
}
|
|
1223
1620
|
}, [
|
|
1224
|
-
|
|
1621
|
+
H("input", {
|
|
1225
1622
|
ref: t,
|
|
1226
1623
|
"data-testid": "markweave-video-file-input",
|
|
1227
1624
|
type: "file",
|
|
@@ -1232,20 +1629,20 @@ function xr(e) {
|
|
|
1232
1629
|
r && e.onFile(r), n.value = "";
|
|
1233
1630
|
}
|
|
1234
1631
|
}),
|
|
1235
|
-
|
|
1632
|
+
H("div", {
|
|
1236
1633
|
class: "markweave-video-upload-icon",
|
|
1237
1634
|
"aria-hidden": "true"
|
|
1238
|
-
}, [
|
|
1635
|
+
}, [H($r, {
|
|
1239
1636
|
size: 46,
|
|
1240
1637
|
strokeWidth: 1.6
|
|
1241
1638
|
})]),
|
|
1242
|
-
|
|
1639
|
+
H("div", { class: "markweave-video-upload-copy" }, [H("button", {
|
|
1243
1640
|
type: "button",
|
|
1244
1641
|
onClick: () => t.value?.click()
|
|
1245
|
-
}, n.clickToUpload),
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1642
|
+
}, n.clickToUpload), H("span", null, n.dragAndDrop)]),
|
|
1643
|
+
H("div", { class: "markweave-video-upload-note" }, n.uploadNote),
|
|
1644
|
+
H("div", { class: "markweave-video-upload-row" }, [
|
|
1645
|
+
H("input", {
|
|
1249
1646
|
"data-testid": "markweave-video-url-input",
|
|
1250
1647
|
value: e.inputValue,
|
|
1251
1648
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1255,28 +1652,28 @@ function xr(e) {
|
|
|
1255
1652
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1256
1653
|
}
|
|
1257
1654
|
}),
|
|
1258
|
-
|
|
1655
|
+
H("button", {
|
|
1259
1656
|
type: "button",
|
|
1260
1657
|
"data-testid": "markweave-video-upload-submit",
|
|
1261
1658
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1262
1659
|
onClick: e.onSubmit
|
|
1263
|
-
}, [
|
|
1660
|
+
}, [H(Qr, {
|
|
1264
1661
|
size: 16,
|
|
1265
1662
|
strokeWidth: 1.8
|
|
1266
1663
|
}), e.messages.common.insert]),
|
|
1267
|
-
|
|
1664
|
+
H("button", {
|
|
1268
1665
|
type: "button",
|
|
1269
1666
|
"data-testid": "markweave-video-upload-cancel",
|
|
1270
1667
|
onClick: e.onCancel
|
|
1271
1668
|
}, e.messages.common.cancel)
|
|
1272
1669
|
]),
|
|
1273
|
-
e.error ?
|
|
1670
|
+
e.error ? H("div", {
|
|
1274
1671
|
class: "markweave-video-upload-error",
|
|
1275
1672
|
role: "alert"
|
|
1276
1673
|
}, e.error) : null
|
|
1277
1674
|
]);
|
|
1278
1675
|
}
|
|
1279
|
-
var
|
|
1676
|
+
var li = Y({
|
|
1280
1677
|
name: "MarkweaveVueImageNodeView",
|
|
1281
1678
|
props: {
|
|
1282
1679
|
editor: {
|
|
@@ -1309,10 +1706,31 @@ var Sr = J({
|
|
|
1309
1706
|
}
|
|
1310
1707
|
},
|
|
1311
1708
|
setup(e) {
|
|
1312
|
-
let t =
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1709
|
+
let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!I(u.value.caption)), p = U(I(u.value.caption) ?? ""), m = ti(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => I(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
|
|
1710
|
+
K(v, (t) => {
|
|
1711
|
+
if (C?.abort(), C = null, !t) {
|
|
1712
|
+
x.value = null;
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
let n = y.value;
|
|
1716
|
+
if (!n) {
|
|
1717
|
+
x.value = { src: t };
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
let r = new AbortController();
|
|
1721
|
+
C = r, S(n, {
|
|
1722
|
+
kind: "image",
|
|
1723
|
+
priority: e.selected ? "visible" : "nearby",
|
|
1724
|
+
signal: r.signal,
|
|
1725
|
+
src: t
|
|
1726
|
+
}).then((e) => {
|
|
1727
|
+
r.signal.aborted || (x.value = e);
|
|
1728
|
+
});
|
|
1729
|
+
}, { immediate: !0 }), q(() => C?.abort());
|
|
1730
|
+
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => ei(u.value.align)), D = G(() => F(u.value.width)), A = G(() => I(u.value.caption)), M = G(() => h.value && (!v.value || i.value)), N = () => {
|
|
1731
|
+
w.value && b({
|
|
1732
|
+
src: w.value,
|
|
1733
|
+
alt: I(u.value.alt) ?? "",
|
|
1316
1734
|
messages: {
|
|
1317
1735
|
dialogAriaLabel: _.value.previewDialogAriaLabel,
|
|
1318
1736
|
zoomOut: _.value.previewZoomOut,
|
|
@@ -1322,67 +1740,67 @@ var Sr = J({
|
|
|
1322
1740
|
}
|
|
1323
1741
|
});
|
|
1324
1742
|
};
|
|
1325
|
-
|
|
1743
|
+
K(A, (e) => {
|
|
1326
1744
|
f.value || (p.value = e ?? "");
|
|
1327
1745
|
});
|
|
1328
|
-
let
|
|
1746
|
+
let P = () => {
|
|
1329
1747
|
if (!h.value) return;
|
|
1330
1748
|
let t = e.getPos();
|
|
1331
1749
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1332
|
-
},
|
|
1750
|
+
}, ee = () => {
|
|
1333
1751
|
if (o.value = "", c.value = null, a.value = !1, v.value) {
|
|
1334
1752
|
i.value = !1;
|
|
1335
1753
|
return;
|
|
1336
1754
|
}
|
|
1337
1755
|
e.deleteNode();
|
|
1338
|
-
},
|
|
1756
|
+
}, z = async (t) => {
|
|
1339
1757
|
if (!h.value) return;
|
|
1340
1758
|
let n = e.extension.options;
|
|
1341
1759
|
l.value = !0, c.value = null;
|
|
1342
1760
|
try {
|
|
1343
|
-
let r = await
|
|
1344
|
-
e.updateAttributes(
|
|
1761
|
+
let r = await R(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1762
|
+
e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
|
|
1345
1763
|
} catch (e) {
|
|
1346
1764
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
1347
1765
|
} finally {
|
|
1348
1766
|
l.value = !1, a.value = !1;
|
|
1349
1767
|
}
|
|
1350
|
-
},
|
|
1768
|
+
}, te = () => {
|
|
1351
1769
|
if (!o.value.trim()) {
|
|
1352
1770
|
c.value = _.value.uploadRequiredError;
|
|
1353
1771
|
return;
|
|
1354
1772
|
}
|
|
1355
|
-
|
|
1356
|
-
},
|
|
1357
|
-
|
|
1773
|
+
z(L(o.value));
|
|
1774
|
+
}, ne = (e) => {
|
|
1775
|
+
z({
|
|
1358
1776
|
type: "file",
|
|
1359
1777
|
file: e,
|
|
1360
1778
|
mimeType: e.type || "image/*"
|
|
1361
1779
|
});
|
|
1362
|
-
},
|
|
1363
|
-
f.value = !f.value, f.value && (p.value =
|
|
1364
|
-
},
|
|
1780
|
+
}, B = () => {
|
|
1781
|
+
f.value = !f.value, f.value && (p.value = A.value ?? "");
|
|
1782
|
+
}, V = (n, r) => {
|
|
1365
1783
|
if (!h.value || !v.value) return;
|
|
1366
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1784
|
+
r.preventDefault(), r.stopPropagation(), P();
|
|
1367
1785
|
let i = t.value;
|
|
1368
1786
|
if (!i) return;
|
|
1369
|
-
let a = r.clientX, o = i.getBoundingClientRect().width ||
|
|
1787
|
+
let a = r.clientX, o = i.getBoundingClientRect().width || D.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
|
|
1370
1788
|
let r = n === "right" ? t.clientX - a : a - t.clientX;
|
|
1371
|
-
e.updateAttributes({ width:
|
|
1789
|
+
e.updateAttributes({ width: O(o + r, s) });
|
|
1372
1790
|
}, l = () => {
|
|
1373
1791
|
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
|
|
1374
1792
|
};
|
|
1375
1793
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1376
1794
|
};
|
|
1377
|
-
return () =>
|
|
1795
|
+
return () => M.value ? H(s, {
|
|
1378
1796
|
as: "figure",
|
|
1379
1797
|
class: "markweave-image-node",
|
|
1380
1798
|
"data-testid": "markweave-image-node",
|
|
1381
|
-
"data-align":
|
|
1799
|
+
"data-align": E.value,
|
|
1382
1800
|
"data-selected": "false",
|
|
1383
1801
|
"data-hovered": "false",
|
|
1384
1802
|
"data-empty": "true"
|
|
1385
|
-
}, () =>
|
|
1803
|
+
}, () => si({
|
|
1386
1804
|
messages: g.value,
|
|
1387
1805
|
inputValue: o.value,
|
|
1388
1806
|
error: c.value,
|
|
@@ -1391,17 +1809,17 @@ var Sr = J({
|
|
|
1391
1809
|
onInputValue: (e) => {
|
|
1392
1810
|
o.value = e;
|
|
1393
1811
|
},
|
|
1394
|
-
onFile:
|
|
1395
|
-
onSubmit:
|
|
1396
|
-
onCancel:
|
|
1812
|
+
onFile: ne,
|
|
1813
|
+
onSubmit: te,
|
|
1814
|
+
onCancel: ee,
|
|
1397
1815
|
onDragActive: (e) => {
|
|
1398
1816
|
a.value = e;
|
|
1399
1817
|
}
|
|
1400
|
-
})) :
|
|
1818
|
+
})) : H(s, {
|
|
1401
1819
|
as: "figure",
|
|
1402
1820
|
class: "markweave-image-node",
|
|
1403
1821
|
"data-testid": "markweave-image-node",
|
|
1404
|
-
"data-align":
|
|
1822
|
+
"data-align": E.value,
|
|
1405
1823
|
"data-selected": h.value && e.selected ? "true" : "false",
|
|
1406
1824
|
"data-hovered": r.value ? "true" : "false",
|
|
1407
1825
|
"data-empty": "false",
|
|
@@ -1412,97 +1830,104 @@ var Sr = J({
|
|
|
1412
1830
|
r.value = !1;
|
|
1413
1831
|
},
|
|
1414
1832
|
onMousedown: (e) => {
|
|
1415
|
-
h.value && !
|
|
1833
|
+
h.value && !ni(e.target) && P();
|
|
1416
1834
|
}
|
|
1417
1835
|
}, () => [
|
|
1418
|
-
h.value ?
|
|
1836
|
+
h.value ? H("div", {
|
|
1419
1837
|
class: "markweave-image-toolbar",
|
|
1420
1838
|
"data-testid": "markweave-image-toolbar",
|
|
1421
1839
|
"data-markweave-image-ui": "true",
|
|
1422
1840
|
"aria-label": _.value.toolsAriaLabel
|
|
1423
1841
|
}, [
|
|
1424
|
-
|
|
1842
|
+
oi({
|
|
1425
1843
|
testId: "markweave-image-align-left",
|
|
1426
1844
|
label: _.value.alignLeft,
|
|
1427
|
-
icon:
|
|
1428
|
-
active:
|
|
1845
|
+
icon: Vn,
|
|
1846
|
+
active: E.value === "left",
|
|
1429
1847
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1430
1848
|
}),
|
|
1431
|
-
|
|
1849
|
+
oi({
|
|
1432
1850
|
testId: "markweave-image-align-center",
|
|
1433
1851
|
label: _.value.alignCenter,
|
|
1434
|
-
icon:
|
|
1435
|
-
active:
|
|
1852
|
+
icon: zn,
|
|
1853
|
+
active: E.value === "center",
|
|
1436
1854
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1437
1855
|
}),
|
|
1438
|
-
|
|
1856
|
+
oi({
|
|
1439
1857
|
testId: "markweave-image-align-right",
|
|
1440
1858
|
label: _.value.alignRight,
|
|
1441
|
-
icon:
|
|
1442
|
-
active:
|
|
1859
|
+
icon: Hn,
|
|
1860
|
+
active: E.value === "right",
|
|
1443
1861
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1444
1862
|
}),
|
|
1445
|
-
|
|
1863
|
+
H("span", {
|
|
1446
1864
|
class: "markweave-image-toolbar-divider",
|
|
1447
1865
|
"aria-hidden": "true"
|
|
1448
1866
|
}),
|
|
1449
|
-
|
|
1867
|
+
oi({
|
|
1450
1868
|
testId: "markweave-image-caption",
|
|
1451
1869
|
label: _.value.caption,
|
|
1452
|
-
icon:
|
|
1453
|
-
active: f.value || !!
|
|
1454
|
-
onClick:
|
|
1870
|
+
icon: ar,
|
|
1871
|
+
active: f.value || !!A.value,
|
|
1872
|
+
onClick: B
|
|
1455
1873
|
}),
|
|
1456
|
-
|
|
1874
|
+
oi({
|
|
1457
1875
|
testId: "markweave-image-preview",
|
|
1458
1876
|
label: _.value.preview,
|
|
1459
|
-
icon:
|
|
1460
|
-
onClick:
|
|
1877
|
+
icon: hr,
|
|
1878
|
+
onClick: N
|
|
1461
1879
|
}),
|
|
1462
|
-
|
|
1880
|
+
oi({
|
|
1463
1881
|
testId: "markweave-image-download",
|
|
1464
1882
|
label: _.value.download,
|
|
1465
|
-
icon:
|
|
1883
|
+
icon: mr,
|
|
1466
1884
|
onClick: () => {
|
|
1467
|
-
|
|
1885
|
+
w.value && j(w.value);
|
|
1468
1886
|
}
|
|
1469
1887
|
}),
|
|
1470
|
-
|
|
1888
|
+
oi({
|
|
1471
1889
|
testId: "markweave-image-replace",
|
|
1472
1890
|
label: _.value.replace,
|
|
1473
|
-
icon:
|
|
1891
|
+
icon: Rr,
|
|
1474
1892
|
onClick: () => {
|
|
1475
1893
|
o.value = "", c.value = null, i.value = !0;
|
|
1476
1894
|
}
|
|
1477
1895
|
}),
|
|
1478
|
-
|
|
1896
|
+
H("span", {
|
|
1479
1897
|
class: "markweave-image-toolbar-divider",
|
|
1480
1898
|
"aria-hidden": "true"
|
|
1481
1899
|
}),
|
|
1482
|
-
|
|
1900
|
+
oi({
|
|
1483
1901
|
testId: "markweave-image-delete",
|
|
1484
1902
|
label: _.value.delete,
|
|
1485
|
-
icon:
|
|
1903
|
+
icon: Yr,
|
|
1486
1904
|
onClick: () => e.deleteNode()
|
|
1487
1905
|
})
|
|
1488
1906
|
]) : null,
|
|
1489
|
-
|
|
1907
|
+
H("div", {
|
|
1490
1908
|
ref: t,
|
|
1491
1909
|
class: "markweave-image-box",
|
|
1492
|
-
style:
|
|
1910
|
+
style: {
|
|
1911
|
+
...D.value ? { width: `${Math.round(D.value)}px` } : {},
|
|
1912
|
+
...x.value?.width && x.value.height ? { aspectRatio: `${x.value.width} / ${x.value.height}` } : {}
|
|
1913
|
+
}
|
|
1493
1914
|
}, [
|
|
1494
|
-
|
|
1915
|
+
w.value ? H("img", {
|
|
1495
1916
|
class: "markweave-image",
|
|
1496
|
-
src:
|
|
1497
|
-
alt:
|
|
1498
|
-
title:
|
|
1499
|
-
draggable: !1
|
|
1500
|
-
|
|
1917
|
+
src: w.value,
|
|
1918
|
+
alt: I(u.value.alt) ?? "",
|
|
1919
|
+
title: I(u.value.title) ?? void 0,
|
|
1920
|
+
draggable: !1,
|
|
1921
|
+
loading: "lazy",
|
|
1922
|
+
decoding: "async",
|
|
1923
|
+
width: x.value?.width,
|
|
1924
|
+
height: x.value?.height
|
|
1925
|
+
}) : H("div", {
|
|
1501
1926
|
class: "markweave-image-readonly-empty",
|
|
1502
1927
|
"data-testid": "markweave-image-readonly-empty",
|
|
1503
1928
|
"aria-hidden": "true"
|
|
1504
1929
|
}),
|
|
1505
|
-
!h.value &&
|
|
1930
|
+
!h.value && w.value ? H("button", {
|
|
1506
1931
|
type: "button",
|
|
1507
1932
|
class: "markweave-image-preview-trigger",
|
|
1508
1933
|
"data-testid": "markweave-image-preview",
|
|
@@ -1510,34 +1935,34 @@ var Sr = J({
|
|
|
1510
1935
|
"aria-label": _.value.preview,
|
|
1511
1936
|
title: _.value.preview,
|
|
1512
1937
|
onMousedown: (e) => e.preventDefault(),
|
|
1513
|
-
onClick:
|
|
1514
|
-
}, [
|
|
1938
|
+
onClick: N
|
|
1939
|
+
}, [H(hr, {
|
|
1515
1940
|
size: 16,
|
|
1516
1941
|
strokeWidth: 1.8
|
|
1517
|
-
}),
|
|
1942
|
+
}), H("span", {
|
|
1518
1943
|
class: "markweave-image-tooltip",
|
|
1519
1944
|
role: "tooltip"
|
|
1520
1945
|
}, _.value.preview)]) : null,
|
|
1521
|
-
h.value ?
|
|
1946
|
+
h.value ? H("button", {
|
|
1522
1947
|
type: "button",
|
|
1523
1948
|
class: "markweave-image-resize-handle",
|
|
1524
1949
|
"data-testid": "markweave-image-resize-left",
|
|
1525
1950
|
"data-side": "left",
|
|
1526
1951
|
"aria-label": _.value.resizeLeft,
|
|
1527
1952
|
"data-markweave-image-ui": "true",
|
|
1528
|
-
onPointerdown: (e) =>
|
|
1953
|
+
onPointerdown: (e) => V("left", e)
|
|
1529
1954
|
}) : null,
|
|
1530
|
-
h.value ?
|
|
1955
|
+
h.value ? H("button", {
|
|
1531
1956
|
type: "button",
|
|
1532
1957
|
class: "markweave-image-resize-handle",
|
|
1533
1958
|
"data-testid": "markweave-image-resize-right",
|
|
1534
1959
|
"data-side": "right",
|
|
1535
1960
|
"aria-label": _.value.resizeRight,
|
|
1536
1961
|
"data-markweave-image-ui": "true",
|
|
1537
|
-
onPointerdown: (e) =>
|
|
1962
|
+
onPointerdown: (e) => V("right", e)
|
|
1538
1963
|
}) : null
|
|
1539
1964
|
]),
|
|
1540
|
-
h.value && (f.value ||
|
|
1965
|
+
h.value && (f.value || A.value) ? H("input", {
|
|
1541
1966
|
class: "markweave-image-caption-input",
|
|
1542
1967
|
"data-testid": "markweave-image-caption-input",
|
|
1543
1968
|
"data-markweave-image-ui": "true",
|
|
@@ -1550,13 +1975,13 @@ var Sr = J({
|
|
|
1550
1975
|
onKeydown: (e) => {
|
|
1551
1976
|
e.key === "Escape" && (e.preventDefault(), f.value = !1);
|
|
1552
1977
|
}
|
|
1553
|
-
}) :
|
|
1978
|
+
}) : A.value ? H("figcaption", {
|
|
1554
1979
|
class: "markweave-image-caption",
|
|
1555
1980
|
"data-testid": "markweave-image-caption"
|
|
1556
|
-
},
|
|
1981
|
+
}, A.value) : null
|
|
1557
1982
|
]);
|
|
1558
1983
|
}
|
|
1559
|
-
}),
|
|
1984
|
+
}), ui = Y({
|
|
1560
1985
|
name: "MarkweaveVueVideoNodeView",
|
|
1561
1986
|
props: {
|
|
1562
1987
|
editor: {
|
|
@@ -1589,15 +2014,15 @@ var Sr = J({
|
|
|
1589
2014
|
}
|
|
1590
2015
|
},
|
|
1591
2016
|
setup(e) {
|
|
1592
|
-
let t =
|
|
2017
|
+
let t = U(!1), r = U(""), i = U(null), a = U(!1), o = ti(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => I(f.value.src)), m = G(() => I(f.value.embedUrl)), h = G(() => I(f.value.provider)), g = G(() => m.value ? P(m.value, h.value) : null), _ = G(() => I(f.value.mimeType)), v = G(() => I(f.value.title)), y = () => {
|
|
1593
2018
|
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
1594
2019
|
}, b = async (n) => {
|
|
1595
2020
|
if (!c.value) return;
|
|
1596
2021
|
let o = e.extension.options;
|
|
1597
2022
|
a.value = !0, i.value = null;
|
|
1598
2023
|
try {
|
|
1599
|
-
let t = await
|
|
1600
|
-
e.updateAttributes(
|
|
2024
|
+
let t = await R(A(n), o?.onUpload);
|
|
2025
|
+
e.updateAttributes(E(t)), r.value = "";
|
|
1601
2026
|
} catch (e) {
|
|
1602
2027
|
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
1603
2028
|
} finally {
|
|
@@ -1605,7 +2030,7 @@ var Sr = J({
|
|
|
1605
2030
|
}
|
|
1606
2031
|
}, x = () => {
|
|
1607
2032
|
if (!c.value) return;
|
|
1608
|
-
let t =
|
|
2033
|
+
let t = D(r.value);
|
|
1609
2034
|
if (!t) {
|
|
1610
2035
|
i.value = u.value.unsupportedUrlError;
|
|
1611
2036
|
return;
|
|
@@ -1621,16 +2046,16 @@ var Sr = J({
|
|
|
1621
2046
|
if (!c.value) return;
|
|
1622
2047
|
let t = e.getPos();
|
|
1623
2048
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1624
|
-
},
|
|
2049
|
+
}, w = (t) => {
|
|
1625
2050
|
c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
1626
2051
|
};
|
|
1627
|
-
return () => c.value && !p.value ?
|
|
2052
|
+
return () => c.value && !p.value ? H(s, {
|
|
1628
2053
|
as: "figure",
|
|
1629
2054
|
class: "markweave-video-node",
|
|
1630
2055
|
"data-testid": "markweave-video-node",
|
|
1631
2056
|
"data-empty": "true",
|
|
1632
2057
|
"data-selected": "false"
|
|
1633
|
-
}, () =>
|
|
2058
|
+
}, () => ci({
|
|
1634
2059
|
messages: l.value,
|
|
1635
2060
|
inputValue: r.value,
|
|
1636
2061
|
error: i.value,
|
|
@@ -1645,7 +2070,7 @@ var Sr = J({
|
|
|
1645
2070
|
onDragActive: (e) => {
|
|
1646
2071
|
t.value = e;
|
|
1647
2072
|
}
|
|
1648
|
-
})) :
|
|
2073
|
+
})) : H(s, {
|
|
1649
2074
|
as: "figure",
|
|
1650
2075
|
class: "markweave-video-node",
|
|
1651
2076
|
"data-testid": "markweave-video-node",
|
|
@@ -1655,27 +2080,27 @@ var Sr = J({
|
|
|
1655
2080
|
"aria-label": u.value.nodeAriaLabel,
|
|
1656
2081
|
tabindex: c.value ? 0 : void 0,
|
|
1657
2082
|
onFocus: C,
|
|
1658
|
-
onKeydown:
|
|
2083
|
+
onKeydown: w,
|
|
1659
2084
|
onMousedown: (e) => {
|
|
1660
|
-
c.value && !
|
|
2085
|
+
c.value && !ri(e.target) && (e.preventDefault(), C());
|
|
1661
2086
|
}
|
|
1662
|
-
}, () => [g.value ?
|
|
2087
|
+
}, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
|
|
1663
2088
|
class: "markweave-video-iframe",
|
|
1664
2089
|
src: g.value,
|
|
1665
2090
|
title: v.value ?? `${h.value ?? "Video"} embed`,
|
|
1666
2091
|
"data-markweave-video-embed": "true",
|
|
1667
2092
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
1668
2093
|
"data-markweave-video-src": p.value ?? void 0,
|
|
1669
|
-
allow:
|
|
2094
|
+
allow: M,
|
|
1670
2095
|
loading: "lazy",
|
|
1671
2096
|
allowfullscreen: "true"
|
|
1672
|
-
}), c.value ?
|
|
2097
|
+
}), c.value ? H("button", {
|
|
1673
2098
|
type: "button",
|
|
1674
2099
|
class: "markweave-video-selection-layer",
|
|
1675
2100
|
"data-testid": "markweave-video-selection-layer",
|
|
1676
2101
|
tabindex: -1,
|
|
1677
2102
|
"aria-label": u.value.selectAriaLabel
|
|
1678
|
-
}) : null]) : p.value ?
|
|
2103
|
+
}) : null]) : p.value ? H("div", { class: "markweave-video-box" }, [H("video", {
|
|
1679
2104
|
class: "markweave-video",
|
|
1680
2105
|
src: p.value,
|
|
1681
2106
|
title: v.value ?? void 0,
|
|
@@ -1683,41 +2108,51 @@ var Sr = J({
|
|
|
1683
2108
|
controls: !0,
|
|
1684
2109
|
"data-markweave-video": "true",
|
|
1685
2110
|
"data-markweave-mime-type": _.value ?? void 0
|
|
1686
|
-
}), c.value ?
|
|
2111
|
+
}), c.value ? H("button", {
|
|
1687
2112
|
type: "button",
|
|
1688
2113
|
class: "markweave-video-selection-layer",
|
|
1689
2114
|
"data-testid": "markweave-video-selection-layer",
|
|
1690
2115
|
tabindex: -1,
|
|
1691
2116
|
"aria-label": u.value.selectAriaLabel
|
|
1692
|
-
}) : null]) :
|
|
2117
|
+
}) : null]) : H("div", {
|
|
1693
2118
|
class: "markweave-video-readonly-empty",
|
|
1694
2119
|
"data-testid": "markweave-video-readonly-empty",
|
|
1695
2120
|
"aria-hidden": "true"
|
|
1696
2121
|
})]);
|
|
1697
2122
|
}
|
|
1698
|
-
}),
|
|
2123
|
+
}), di = C.extend({
|
|
1699
2124
|
addOptions() {
|
|
1700
2125
|
return {
|
|
1701
2126
|
...this.parent?.(),
|
|
1702
2127
|
messages: n("zh"),
|
|
1703
|
-
onUpload: void 0
|
|
2128
|
+
onUpload: void 0,
|
|
2129
|
+
resolveMediaSource: void 0
|
|
1704
2130
|
};
|
|
1705
2131
|
},
|
|
1706
2132
|
addNodeView() {
|
|
1707
|
-
|
|
2133
|
+
if (typeof document > "u") return null;
|
|
2134
|
+
let e = c(li, { stopEvent: ({ event: e }) => ni(e.target) }), t = this.options.resolveMediaSource;
|
|
2135
|
+
if (!t) return e;
|
|
2136
|
+
let r = x({
|
|
2137
|
+
messages: this.options.messages ?? n("zh"),
|
|
2138
|
+
onUpload: this.options.onUpload,
|
|
2139
|
+
resolveMediaSource: t
|
|
2140
|
+
});
|
|
2141
|
+
return (t) => I(t.node.attrs.src) ? r(t) : e(t);
|
|
1708
2142
|
}
|
|
1709
|
-
}),
|
|
2143
|
+
}), fi = w.extend({
|
|
1710
2144
|
addOptions() {
|
|
1711
2145
|
return {
|
|
1712
2146
|
...this.parent?.(),
|
|
1713
2147
|
messages: n("zh"),
|
|
1714
|
-
onUpload: void 0
|
|
2148
|
+
onUpload: void 0,
|
|
2149
|
+
resolveMediaSource: void 0
|
|
1715
2150
|
};
|
|
1716
2151
|
},
|
|
1717
2152
|
addNodeView() {
|
|
1718
|
-
return typeof document > "u" ? null : c(
|
|
2153
|
+
return typeof document > "u" ? null : c(ui, { stopEvent: ({ event: e }) => ri(e.target) });
|
|
1719
2154
|
}
|
|
1720
|
-
}),
|
|
2155
|
+
}), pi = Y({
|
|
1721
2156
|
name: "MarkweaveVueLinkCardNodeView",
|
|
1722
2157
|
props: {
|
|
1723
2158
|
editor: {
|
|
@@ -1750,11 +2185,11 @@ var Sr = J({
|
|
|
1750
2185
|
}
|
|
1751
2186
|
},
|
|
1752
2187
|
setup(e) {
|
|
1753
|
-
let t = e.extension.options, r = t.messages ?? n("zh"), i =
|
|
1754
|
-
|
|
2188
|
+
let t = e.extension.options, r = t.messages ?? n("zh"), i = ti(e.editor), a = U(!1), o = U(!1), c = U(!1), l = G(() => _(e.node.attrs ?? {})), u = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
|
|
2189
|
+
K(l, (e) => {
|
|
1755
2190
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
1756
2191
|
});
|
|
1757
|
-
let p =
|
|
2192
|
+
let p = G(() => d(i.value)), m = G(() => {
|
|
1758
2193
|
try {
|
|
1759
2194
|
return new URL(l.value?.href ?? "").host;
|
|
1760
2195
|
} catch {
|
|
@@ -1778,18 +2213,18 @@ var Sr = J({
|
|
|
1778
2213
|
...r,
|
|
1779
2214
|
...i
|
|
1780
2215
|
}) ?? r);
|
|
1781
|
-
}, C = (e, t, n, r) =>
|
|
2216
|
+
}, C = (e, t, n, r) => H("button", {
|
|
1782
2217
|
type: "button",
|
|
1783
2218
|
title: e,
|
|
1784
2219
|
"aria-label": e,
|
|
1785
2220
|
"data-testid": n,
|
|
1786
2221
|
onMousedown: h,
|
|
1787
2222
|
onClick: r
|
|
1788
|
-
}, [
|
|
2223
|
+
}, [ai(t, e), H("span", { role: "tooltip" }, e)]);
|
|
1789
2224
|
return () => {
|
|
1790
2225
|
let n = l.value;
|
|
1791
2226
|
if (!n) return null;
|
|
1792
|
-
let i = !c.value && n.imageUrl ?
|
|
2227
|
+
let i = !c.value && n.imageUrl ? H("img", {
|
|
1793
2228
|
src: n.imageUrl,
|
|
1794
2229
|
alt: "",
|
|
1795
2230
|
loading: "lazy",
|
|
@@ -1797,7 +2232,7 @@ var Sr = J({
|
|
|
1797
2232
|
onError: () => {
|
|
1798
2233
|
c.value = !0;
|
|
1799
2234
|
}
|
|
1800
|
-
}) : !c.value && n.faviconUrl ?
|
|
2235
|
+
}) : !c.value && n.faviconUrl ? H("img", {
|
|
1801
2236
|
class: "markweave-link-card-favicon",
|
|
1802
2237
|
src: n.faviconUrl,
|
|
1803
2238
|
alt: "",
|
|
@@ -1806,8 +2241,8 @@ var Sr = J({
|
|
|
1806
2241
|
onError: () => {
|
|
1807
2242
|
c.value = !0;
|
|
1808
2243
|
}
|
|
1809
|
-
}) :
|
|
1810
|
-
return
|
|
2244
|
+
}) : H("b", null, m.value.slice(0, 1).toUpperCase());
|
|
2245
|
+
return H(s, {
|
|
1811
2246
|
as: "article",
|
|
1812
2247
|
class: "markweave-link-card",
|
|
1813
2248
|
"data-testid": "markweave-link-card",
|
|
@@ -1821,32 +2256,32 @@ var Sr = J({
|
|
|
1821
2256
|
a.value = !1;
|
|
1822
2257
|
},
|
|
1823
2258
|
onMousedown: (e) => {
|
|
1824
|
-
|
|
2259
|
+
ii(e.target) || e.preventDefault();
|
|
1825
2260
|
},
|
|
1826
2261
|
onClick: (e) => {
|
|
1827
|
-
|
|
2262
|
+
ii(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
1828
2263
|
}
|
|
1829
2264
|
}, () => [
|
|
1830
|
-
|
|
2265
|
+
H("a", {
|
|
1831
2266
|
class: "markweave-link-card-main",
|
|
1832
2267
|
href: n.href,
|
|
1833
2268
|
"aria-label": r.linkCard.open
|
|
1834
|
-
}, [
|
|
1835
|
-
|
|
1836
|
-
n.description ?
|
|
1837
|
-
|
|
1838
|
-
]),
|
|
2269
|
+
}, [H("span", { class: "markweave-link-card-copy" }, [
|
|
2270
|
+
H("strong", null, n.title),
|
|
2271
|
+
n.description ? H("span", null, n.description) : null,
|
|
2272
|
+
H("small", null, n.siteName ?? m.value)
|
|
2273
|
+
]), H("span", {
|
|
1839
2274
|
class: "markweave-link-card-media",
|
|
1840
2275
|
"aria-hidden": "true"
|
|
1841
2276
|
}, [i])]),
|
|
1842
|
-
p.value && a.value ?
|
|
2277
|
+
p.value && a.value ? H("div", {
|
|
1843
2278
|
class: "markweave-link-card-tools",
|
|
1844
2279
|
"data-markweave-link-card-ui": "true",
|
|
1845
2280
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
1846
2281
|
}, [
|
|
1847
|
-
C(r.linkCard.convertToLink,
|
|
1848
|
-
C(r.linkCard.copyAddress,
|
|
1849
|
-
C(r.linkCard.edit,
|
|
2282
|
+
C(r.linkCard.convertToLink, Dr, "markweave-link-card-convert", x),
|
|
2283
|
+
C(r.linkCard.copyAddress, mr, "markweave-link-card-copy", () => b(n.href)),
|
|
2284
|
+
C(r.linkCard.edit, Fr, "markweave-link-card-edit", (i) => g({
|
|
1850
2285
|
anchor: i.currentTarget,
|
|
1851
2286
|
editor: e.editor,
|
|
1852
2287
|
messages: r,
|
|
@@ -1856,15 +2291,15 @@ var Sr = J({
|
|
|
1856
2291
|
attrs: n
|
|
1857
2292
|
}
|
|
1858
2293
|
})),
|
|
1859
|
-
C(r.linkCard.delete,
|
|
2294
|
+
C(r.linkCard.delete, Yr, "markweave-link-card-delete", () => e.deleteNode())
|
|
1860
2295
|
]) : null,
|
|
1861
|
-
p.value && o.value ?
|
|
2296
|
+
p.value && o.value ? H("form", {
|
|
1862
2297
|
class: "markweave-link-card-editor",
|
|
1863
2298
|
"data-markweave-link-card-ui": "true",
|
|
1864
2299
|
"data-testid": "markweave-link-card-editor",
|
|
1865
2300
|
onSubmit: S
|
|
1866
2301
|
}, [
|
|
1867
|
-
|
|
2302
|
+
H("label", null, [H("span", null, r.linkCard.titleLabel), H("input", {
|
|
1868
2303
|
value: u.value,
|
|
1869
2304
|
placeholder: r.linkCard.titlePlaceholder,
|
|
1870
2305
|
"aria-label": r.linkCard.titleLabel,
|
|
@@ -1872,7 +2307,7 @@ var Sr = J({
|
|
|
1872
2307
|
u.value = e.target.value;
|
|
1873
2308
|
}
|
|
1874
2309
|
})]),
|
|
1875
|
-
|
|
2310
|
+
H("label", null, [H("span", null, r.linkCard.addressLabel), H("input", {
|
|
1876
2311
|
value: f.value,
|
|
1877
2312
|
placeholder: r.linkCard.addressPlaceholder,
|
|
1878
2313
|
"aria-label": r.linkCard.addressLabel,
|
|
@@ -1880,16 +2315,16 @@ var Sr = J({
|
|
|
1880
2315
|
f.value = e.target.value;
|
|
1881
2316
|
}
|
|
1882
2317
|
})]),
|
|
1883
|
-
|
|
2318
|
+
H("button", {
|
|
1884
2319
|
type: "submit",
|
|
1885
2320
|
disabled: !v(f.value),
|
|
1886
2321
|
"aria-label": r.linkCard.edit
|
|
1887
|
-
}, [
|
|
2322
|
+
}, [ai(Dr, r.linkCard.edit)])
|
|
1888
2323
|
]) : null
|
|
1889
2324
|
]);
|
|
1890
2325
|
};
|
|
1891
2326
|
}
|
|
1892
|
-
}),
|
|
2327
|
+
}), mi = h.extend({
|
|
1893
2328
|
addOptions() {
|
|
1894
2329
|
return {
|
|
1895
2330
|
...this.parent?.(),
|
|
@@ -1898,32 +2333,33 @@ var Sr = J({
|
|
|
1898
2333
|
};
|
|
1899
2334
|
},
|
|
1900
2335
|
addNodeView() {
|
|
1901
|
-
return typeof document > "u" ? null : c(
|
|
2336
|
+
return typeof document > "u" ? null : c(pi, { stopEvent: ({ event: e }) => ii(e.target) });
|
|
1902
2337
|
}
|
|
1903
2338
|
});
|
|
1904
2339
|
//#endregion
|
|
1905
2340
|
//#region src/create-editor-extensions.ts
|
|
1906
|
-
function
|
|
2341
|
+
function hi(t = {}) {
|
|
1907
2342
|
return e({
|
|
1908
2343
|
lang: t.lang,
|
|
1909
2344
|
onImageUpload: t.onImageUpload,
|
|
1910
|
-
linkCardExtension:
|
|
2345
|
+
linkCardExtension: mi.configure({
|
|
1911
2346
|
lang: t.lang,
|
|
1912
2347
|
messages: n(t.lang),
|
|
1913
2348
|
resolver: t.linkCardResolver
|
|
1914
2349
|
}),
|
|
1915
2350
|
mediaExtensions: i({
|
|
1916
|
-
image:
|
|
1917
|
-
video:
|
|
2351
|
+
image: di,
|
|
2352
|
+
video: fi,
|
|
1918
2353
|
lang: t.lang,
|
|
1919
2354
|
onImageUpload: t.onImageUpload,
|
|
1920
|
-
onVideoUpload: t.onVideoUpload
|
|
2355
|
+
onVideoUpload: t.onVideoUpload,
|
|
2356
|
+
resolveMediaSource: t.resolveMediaSource
|
|
1921
2357
|
})
|
|
1922
2358
|
});
|
|
1923
2359
|
}
|
|
1924
2360
|
//#endregion
|
|
1925
2361
|
//#region src/MarkweaveEditor.ts
|
|
1926
|
-
var
|
|
2362
|
+
var gi = {
|
|
1927
2363
|
active: !1,
|
|
1928
2364
|
mode: "outside",
|
|
1929
2365
|
activeCellPos: null,
|
|
@@ -1931,17 +2367,17 @@ var kr = {
|
|
|
1931
2367
|
selectedCellCount: 0,
|
|
1932
2368
|
selectionFrom: 0,
|
|
1933
2369
|
selectionTo: 0
|
|
1934
|
-
},
|
|
2370
|
+
}, _i = {
|
|
1935
2371
|
active: !1,
|
|
1936
|
-
language:
|
|
2372
|
+
language: Fe.defaultLanguage,
|
|
1937
2373
|
mermaidPreviewMode: "code",
|
|
1938
2374
|
pos: null,
|
|
1939
2375
|
text: ""
|
|
1940
2376
|
};
|
|
1941
|
-
function
|
|
1942
|
-
return
|
|
2377
|
+
function vi(e) {
|
|
2378
|
+
return qt.getState(e.state) ?? Kt;
|
|
1943
2379
|
}
|
|
1944
|
-
function
|
|
2380
|
+
function yi(e) {
|
|
1945
2381
|
if (!e || typeof window > "u") return null;
|
|
1946
2382
|
let t = e.parentElement;
|
|
1947
2383
|
for (; t;) {
|
|
@@ -1952,133 +2388,133 @@ function Mr(e) {
|
|
|
1952
2388
|
return null;
|
|
1953
2389
|
}
|
|
1954
2390
|
function Z(e, t, n = 18, r = 1.8) {
|
|
1955
|
-
return
|
|
2391
|
+
return H(e, {
|
|
1956
2392
|
size: n,
|
|
1957
2393
|
strokeWidth: r,
|
|
1958
2394
|
"aria-hidden": "true"
|
|
1959
2395
|
}, { default: () => t });
|
|
1960
2396
|
}
|
|
1961
|
-
function
|
|
1962
|
-
return e === "clipboard" ? [
|
|
2397
|
+
function bi(e) {
|
|
2398
|
+
return e === "clipboard" ? [H("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" }), H("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" ? [H("circle", {
|
|
1963
2399
|
cx: "10",
|
|
1964
2400
|
cy: "10",
|
|
1965
2401
|
r: "5.5"
|
|
1966
|
-
}),
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
2402
|
+
}), H("path", { d: "m14 14 4 4" })] : e === "check" ? [H("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
|
|
2403
|
+
H("path", { d: "M8 4H4v4" }),
|
|
2404
|
+
H("path", { d: "M4 4l5 5" }),
|
|
2405
|
+
H("path", { d: "M16 4h4v4" }),
|
|
2406
|
+
H("path", { d: "m20 4-5 5" }),
|
|
2407
|
+
H("path", { d: "M8 20H4v-4" }),
|
|
2408
|
+
H("path", { d: "m4 20 5-5" }),
|
|
2409
|
+
H("path", { d: "M16 20h4v-4" }),
|
|
2410
|
+
H("path", { d: "m20 20-5-5" })
|
|
1975
2411
|
] : e === "download" ? [
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
] : e === "close" ? [
|
|
1980
|
-
|
|
2412
|
+
H("path", { d: "M12 4v10" }),
|
|
2413
|
+
H("path", { d: "m8 10 4 4 4-4" }),
|
|
2414
|
+
H("path", { d: "M5 19h14" })
|
|
2415
|
+
] : e === "close" ? [H("path", { d: "M6 6l12 12" }), H("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
|
|
2416
|
+
H("circle", {
|
|
1981
2417
|
cx: "10",
|
|
1982
2418
|
cy: "10",
|
|
1983
2419
|
r: "5.25"
|
|
1984
2420
|
}),
|
|
1985
|
-
|
|
1986
|
-
|
|
2421
|
+
H("path", { d: "M7.5 10h5" }),
|
|
2422
|
+
H("path", { d: "m14 14 4 4" })
|
|
1987
2423
|
] : e === "zoomIn" ? [
|
|
1988
|
-
|
|
2424
|
+
H("circle", {
|
|
1989
2425
|
cx: "10",
|
|
1990
2426
|
cy: "10",
|
|
1991
2427
|
r: "5.25"
|
|
1992
2428
|
}),
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
] : e === "reset" ? [
|
|
2429
|
+
H("path", { d: "M7.5 10h5" }),
|
|
2430
|
+
H("path", { d: "M10 7.5v5" }),
|
|
2431
|
+
H("path", { d: "m14 14 4 4" })
|
|
2432
|
+
] : e === "reset" ? [H("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), H("path", { d: "M6.5 8.5H3.5v-3" })] : [H("path", { d: "m6 9 6 6 6-6" })];
|
|
1997
2433
|
}
|
|
1998
2434
|
function Q(e) {
|
|
1999
|
-
return
|
|
2435
|
+
return H("svg", {
|
|
2000
2436
|
viewBox: "0 0 24 24",
|
|
2001
2437
|
"aria-hidden": "true",
|
|
2002
2438
|
focusable: "false"
|
|
2003
|
-
},
|
|
2439
|
+
}, H("g", {
|
|
2004
2440
|
fill: "none",
|
|
2005
2441
|
stroke: "currentColor",
|
|
2006
2442
|
"stroke-linecap": "round",
|
|
2007
2443
|
"stroke-linejoin": "round",
|
|
2008
2444
|
"stroke-width": "1.8"
|
|
2009
|
-
},
|
|
2445
|
+
}, bi(e)));
|
|
2010
2446
|
}
|
|
2011
2447
|
function $(e) {
|
|
2012
2448
|
e.preventDefault();
|
|
2013
2449
|
}
|
|
2014
|
-
function
|
|
2015
|
-
let t =
|
|
2450
|
+
function xi(e) {
|
|
2451
|
+
let t = ft(e);
|
|
2016
2452
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
2017
2453
|
}
|
|
2018
|
-
var
|
|
2019
|
-
bold:
|
|
2020
|
-
italic:
|
|
2021
|
-
underline:
|
|
2022
|
-
strike:
|
|
2023
|
-
"inline-code":
|
|
2024
|
-
link:
|
|
2025
|
-
more:
|
|
2026
|
-
superscript:
|
|
2027
|
-
subscript:
|
|
2028
|
-
"inline-math":
|
|
2029
|
-
"align-left":
|
|
2030
|
-
"align-center":
|
|
2031
|
-
"align-right":
|
|
2032
|
-
"align-justify":
|
|
2033
|
-
"decrease-indent":
|
|
2034
|
-
"increase-indent":
|
|
2035
|
-
},
|
|
2036
|
-
type:
|
|
2037
|
-
"heading-1":
|
|
2038
|
-
"heading-2":
|
|
2039
|
-
"heading-3":
|
|
2040
|
-
"bullet-list":
|
|
2041
|
-
"ordered-list":
|
|
2042
|
-
"task-list":
|
|
2043
|
-
blockquote:
|
|
2044
|
-
"code-block":
|
|
2045
|
-
info:
|
|
2046
|
-
tip:
|
|
2047
|
-
warning:
|
|
2048
|
-
error:
|
|
2049
|
-
success:
|
|
2050
|
-
emoji:
|
|
2051
|
-
math:
|
|
2052
|
-
table:
|
|
2053
|
-
separator:
|
|
2054
|
-
image:
|
|
2055
|
-
video:
|
|
2056
|
-
attachment:
|
|
2454
|
+
var Si = {
|
|
2455
|
+
bold: rr,
|
|
2456
|
+
italic: Tr,
|
|
2457
|
+
underline: Zr,
|
|
2458
|
+
strike: Hr,
|
|
2459
|
+
"inline-code": dr,
|
|
2460
|
+
link: Dr,
|
|
2461
|
+
more: Mr,
|
|
2462
|
+
superscript: Wr,
|
|
2463
|
+
subscript: Ur,
|
|
2464
|
+
"inline-math": zr,
|
|
2465
|
+
"align-left": Vn,
|
|
2466
|
+
"align-center": zn,
|
|
2467
|
+
"align-right": Hn,
|
|
2468
|
+
"align-justify": Bn,
|
|
2469
|
+
"decrease-indent": Sr,
|
|
2470
|
+
"increase-indent": Cr
|
|
2471
|
+
}, Ci = {
|
|
2472
|
+
type: Jr,
|
|
2473
|
+
"heading-1": _r,
|
|
2474
|
+
"heading-2": vr,
|
|
2475
|
+
"heading-3": yr,
|
|
2476
|
+
"bullet-list": Or,
|
|
2477
|
+
"ordered-list": Ar,
|
|
2478
|
+
"task-list": kr,
|
|
2479
|
+
blockquote: Lr,
|
|
2480
|
+
"code-block": ir,
|
|
2481
|
+
info: wr,
|
|
2482
|
+
tip: Er,
|
|
2483
|
+
warning: Kn,
|
|
2484
|
+
error: ur,
|
|
2485
|
+
success: or,
|
|
2486
|
+
emoji: Br,
|
|
2487
|
+
math: zr,
|
|
2488
|
+
table: Gr,
|
|
2489
|
+
separator: jr,
|
|
2490
|
+
image: br,
|
|
2491
|
+
video: $r,
|
|
2492
|
+
attachment: Pr
|
|
2057
2493
|
};
|
|
2058
|
-
function
|
|
2059
|
-
let t =
|
|
2060
|
-
return
|
|
2494
|
+
function wi(e) {
|
|
2495
|
+
let t = Ci[e];
|
|
2496
|
+
return H(t, {
|
|
2061
2497
|
size: 18,
|
|
2062
2498
|
strokeWidth: 1.6,
|
|
2063
2499
|
absoluteStrokeWidth: !0,
|
|
2064
2500
|
"aria-hidden": "true"
|
|
2065
2501
|
});
|
|
2066
2502
|
}
|
|
2067
|
-
var
|
|
2068
|
-
paragraph:
|
|
2069
|
-
"heading-1":
|
|
2070
|
-
"heading-2":
|
|
2071
|
-
"heading-3":
|
|
2072
|
-
"bullet-list":
|
|
2073
|
-
"numbered-list":
|
|
2074
|
-
"todo-list":
|
|
2075
|
-
quote:
|
|
2076
|
-
"code-block":
|
|
2503
|
+
var Ti = {
|
|
2504
|
+
paragraph: Xr,
|
|
2505
|
+
"heading-1": _r,
|
|
2506
|
+
"heading-2": vr,
|
|
2507
|
+
"heading-3": yr,
|
|
2508
|
+
"bullet-list": Or,
|
|
2509
|
+
"numbered-list": Ar,
|
|
2510
|
+
"todo-list": kr,
|
|
2511
|
+
quote: Lr,
|
|
2512
|
+
"code-block": ir
|
|
2077
2513
|
};
|
|
2078
|
-
function
|
|
2514
|
+
function Ei(e, t) {
|
|
2079
2515
|
return se(e, t).label;
|
|
2080
2516
|
}
|
|
2081
|
-
var
|
|
2517
|
+
var Di = Y({
|
|
2082
2518
|
name: "MarkweaveVueFloatingToolbar",
|
|
2083
2519
|
props: {
|
|
2084
2520
|
editor: {
|
|
@@ -2095,28 +2531,28 @@ var Br = J({
|
|
|
2095
2531
|
}
|
|
2096
2532
|
},
|
|
2097
2533
|
setup(e) {
|
|
2098
|
-
let t =
|
|
2534
|
+
let t = U(null), n = U(""), r = U(null), i = U(null), a = U("bottom"), o = U(null), s = U(null), c = U(null), l = G(() => ft(n.value.trim())), u = G(() => e.messages.floatingToolbar), d = G(() => de(e.messages).map((e) => [
|
|
2099
2535
|
e.id,
|
|
2100
2536
|
e.label,
|
|
2101
|
-
|
|
2102
|
-
])), f =
|
|
2537
|
+
Ti[e.id]
|
|
2538
|
+
])), f = G(() => ue(e.messages).map((e) => [
|
|
2103
2539
|
e.id,
|
|
2104
2540
|
e.value,
|
|
2105
2541
|
e.label
|
|
2106
|
-
])), p =
|
|
2542
|
+
])), p = G(() => ce(e.messages).map((e) => [
|
|
2107
2543
|
e.id,
|
|
2108
2544
|
e.value,
|
|
2109
2545
|
e.label
|
|
2110
|
-
])), m =
|
|
2546
|
+
])), m = G(() => le(e.messages).map((e) => e.id)), h = () => {
|
|
2111
2547
|
l.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: l.value }).run(), t.value = null);
|
|
2112
2548
|
}, g = () => {
|
|
2113
2549
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
2114
2550
|
}, _ = (r) => {
|
|
2115
2551
|
t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
|
|
2116
|
-
}, v =
|
|
2552
|
+
}, v = B(() => {
|
|
2117
2553
|
let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
2118
2554
|
if (!t.value || !n || !r) return;
|
|
2119
|
-
let s =
|
|
2555
|
+
let s = _e({
|
|
2120
2556
|
toolbarRect: n.getBoundingClientRect(),
|
|
2121
2557
|
popoverSize: r.getBoundingClientRect(),
|
|
2122
2558
|
viewport: {
|
|
@@ -2128,11 +2564,11 @@ var Br = J({
|
|
|
2128
2564
|
});
|
|
2129
2565
|
a.value = s.placement;
|
|
2130
2566
|
});
|
|
2131
|
-
|
|
2132
|
-
e &&
|
|
2133
|
-
}),
|
|
2567
|
+
K(t, (e) => {
|
|
2568
|
+
e && J(v.schedule);
|
|
2569
|
+
}), In(() => {
|
|
2134
2570
|
window.addEventListener("resize", v.schedule), window.addEventListener("scroll", v.schedule, !0);
|
|
2135
|
-
}),
|
|
2571
|
+
}), q(() => {
|
|
2136
2572
|
v.cancel(), window.removeEventListener("resize", v.schedule), window.removeEventListener("scroll", v.schedule, !0);
|
|
2137
2573
|
});
|
|
2138
2574
|
let y = (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, b = (e, t) => {
|
|
@@ -2146,7 +2582,7 @@ var Br = J({
|
|
|
2146
2582
|
let e = r.value;
|
|
2147
2583
|
if (!e || t.value !== null) return null;
|
|
2148
2584
|
let n = u.value.buttons[e];
|
|
2149
|
-
return n ?
|
|
2585
|
+
return n ? H("div", {
|
|
2150
2586
|
class: "markweave-floating-toolbar-tooltip",
|
|
2151
2587
|
role: "tooltip",
|
|
2152
2588
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
@@ -2154,7 +2590,7 @@ var Br = J({
|
|
|
2154
2590
|
"data-active": y(e),
|
|
2155
2591
|
style: i.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${i.value}px` }
|
|
2156
2592
|
}, n) : null;
|
|
2157
|
-
}, S = (n, i, a, o, s = !1, c) =>
|
|
2593
|
+
}, S = (n, i, a, o, s = !1, c) => H("button", {
|
|
2158
2594
|
type: "button",
|
|
2159
2595
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
2160
2596
|
"aria-label": i,
|
|
@@ -2173,13 +2609,13 @@ var Br = J({
|
|
|
2173
2609
|
onMouseenter: (e) => b(n, e.currentTarget),
|
|
2174
2610
|
onMouseleave: () => b(null),
|
|
2175
2611
|
onClick: o
|
|
2176
|
-
}, n === "block-type" ? [
|
|
2612
|
+
}, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Ei(e.editor, e.messages)), Z(t.value === "block-type" ? lr : sr, i)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? lr : sr, i)])] : [Z(a, i)]), C = () => H("span", {
|
|
2177
2613
|
class: "markweave-floating-toolbar-divider",
|
|
2178
2614
|
"aria-hidden": "true"
|
|
2179
|
-
}), w = (n, r, i) =>
|
|
2615
|
+
}), w = (n, r, i) => H("section", {
|
|
2180
2616
|
class: "markweave-floating-toolbar-color-section",
|
|
2181
2617
|
"aria-label": n
|
|
2182
|
-
}, [
|
|
2618
|
+
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
|
|
2183
2619
|
key: `${r}-${n}`,
|
|
2184
2620
|
type: "button",
|
|
2185
2621
|
"aria-label": a,
|
|
@@ -2188,33 +2624,33 @@ var Br = J({
|
|
|
2188
2624
|
onClick: () => {
|
|
2189
2625
|
r === "text" ? i ? e.editor.chain().focus().setColor(i).run() : e.editor.chain().focus().unsetColor().run() : i ? e.editor.chain().focus().toggleHighlight({ color: i }).run() : e.editor.chain().focus().unsetHighlight().run(), t.value = null;
|
|
2190
2626
|
}
|
|
2191
|
-
}, r === "text" ? [
|
|
2627
|
+
}, r === "text" ? [H("span", {
|
|
2192
2628
|
class: "markweave-floating-toolbar-text-swatch",
|
|
2193
2629
|
style: { color: i ?? "#646970" }
|
|
2194
|
-
}, "A")] : [
|
|
2630
|
+
}, "A")] : [H("span", {
|
|
2195
2631
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
2196
2632
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
2197
2633
|
"aria-hidden": "true"
|
|
2198
|
-
})])))]), T = () => t.value === "block-type" ?
|
|
2634
|
+
})])))]), T = () => t.value === "block-type" ? H("div", {
|
|
2199
2635
|
ref: c,
|
|
2200
2636
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
|
|
2201
2637
|
"data-testid": "markweave-floating-toolbar-turn-menu"
|
|
2202
|
-
}, [
|
|
2638
|
+
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, u.value.turnIntoTitle), ...d.value.map(([n, r, i]) => H("button", {
|
|
2203
2639
|
key: n,
|
|
2204
2640
|
type: "button",
|
|
2205
2641
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
2206
2642
|
onMousedown: $,
|
|
2207
2643
|
onClick: () => {
|
|
2208
|
-
|
|
2644
|
+
pe(e.editor, n), t.value = null;
|
|
2209
2645
|
}
|
|
2210
|
-
}, [
|
|
2646
|
+
}, [H("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), H("span", null, r)]))]) : t.value === "link" ? H("form", {
|
|
2211
2647
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
2212
2648
|
ref: c,
|
|
2213
2649
|
"data-testid": "markweave-floating-toolbar-link-popover",
|
|
2214
2650
|
onSubmit: (e) => {
|
|
2215
2651
|
e.preventDefault(), h();
|
|
2216
2652
|
}
|
|
2217
|
-
}, [
|
|
2653
|
+
}, [H("input", {
|
|
2218
2654
|
value: n.value,
|
|
2219
2655
|
placeholder: u.value.linkPlaceholder,
|
|
2220
2656
|
"aria-label": u.value.linkUrlLabel,
|
|
@@ -2222,45 +2658,45 @@ var Br = J({
|
|
|
2222
2658
|
onInput: (e) => {
|
|
2223
2659
|
n.value = e.target.value;
|
|
2224
2660
|
}
|
|
2225
|
-
}),
|
|
2226
|
-
|
|
2661
|
+
}), H("span", { class: "markweave-floating-toolbar-link-actions" }, [
|
|
2662
|
+
H("button", {
|
|
2227
2663
|
type: "submit",
|
|
2228
2664
|
disabled: !l.value,
|
|
2229
2665
|
"aria-label": u.value.applyLink,
|
|
2230
2666
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2231
2667
|
onMousedown: $
|
|
2232
|
-
}, [Z(
|
|
2233
|
-
|
|
2668
|
+
}, [Z(fr, u.value.applyLink)]),
|
|
2669
|
+
H("span", {
|
|
2234
2670
|
class: "markweave-floating-toolbar-link-divider",
|
|
2235
2671
|
"aria-hidden": "true"
|
|
2236
2672
|
}),
|
|
2237
|
-
|
|
2673
|
+
H("button", {
|
|
2238
2674
|
type: "button",
|
|
2239
2675
|
disabled: !l.value,
|
|
2240
2676
|
"aria-label": u.value.openLink,
|
|
2241
2677
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2242
2678
|
onMousedown: $,
|
|
2243
|
-
onClick: () =>
|
|
2244
|
-
}, [Z(
|
|
2245
|
-
|
|
2679
|
+
onClick: () => xi(n.value)
|
|
2680
|
+
}, [Z(gr, u.value.openLink)]),
|
|
2681
|
+
H("button", {
|
|
2246
2682
|
type: "button",
|
|
2247
2683
|
"aria-label": u.value.removeLink,
|
|
2248
2684
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2249
2685
|
onMousedown: $,
|
|
2250
2686
|
onClick: g
|
|
2251
|
-
}, [Z(
|
|
2252
|
-
])]) : t.value === "color" ?
|
|
2687
|
+
}, [Z(Yr, u.value.removeLink)])
|
|
2688
|
+
])]) : t.value === "color" ? H("div", {
|
|
2253
2689
|
ref: c,
|
|
2254
2690
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2255
2691
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
2256
|
-
}, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ?
|
|
2692
|
+
}, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ? H("div", {
|
|
2257
2693
|
ref: c,
|
|
2258
2694
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2259
2695
|
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
2260
|
-
}, m.value.map((n) =>
|
|
2696
|
+
}, m.value.map((n) => H("span", {
|
|
2261
2697
|
key: n,
|
|
2262
2698
|
class: "markweave-floating-toolbar-more-item"
|
|
2263
|
-
}, [
|
|
2699
|
+
}, [H("button", {
|
|
2264
2700
|
type: "button",
|
|
2265
2701
|
"aria-label": u.value.moreActions[n],
|
|
2266
2702
|
"data-testid": `markweave-floating-toolbar-more-${n}`,
|
|
@@ -2273,43 +2709,43 @@ var Br = J({
|
|
|
2273
2709
|
r.value = null;
|
|
2274
2710
|
},
|
|
2275
2711
|
onClick: () => {
|
|
2276
|
-
|
|
2712
|
+
fe(e.editor, n), t.value = null;
|
|
2277
2713
|
}
|
|
2278
|
-
}, [Z(
|
|
2714
|
+
}, [Z(Si[n], u.value.moreActions[n])]), r.value === n ? H("div", {
|
|
2279
2715
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2280
2716
|
role: "tooltip"
|
|
2281
2717
|
}, u.value.moreActions[n]) : null]))) : null;
|
|
2282
|
-
return () =>
|
|
2718
|
+
return () => H(z, {
|
|
2283
2719
|
editor: e.editor,
|
|
2284
|
-
shouldShow: ({ editor: e }) => e.isEditable &&
|
|
2720
|
+
shouldShow: ({ editor: e }) => e.isEditable && be(ve(e)),
|
|
2285
2721
|
options: { placement: "top" }
|
|
2286
|
-
}, { default: () =>
|
|
2722
|
+
}, { default: () => H("div", {
|
|
2287
2723
|
ref: o,
|
|
2288
2724
|
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
2289
2725
|
"data-popover-placement": t.value ? a.value : void 0,
|
|
2290
2726
|
"data-testid": "markweave-floating-toolbar"
|
|
2291
|
-
}, [
|
|
2727
|
+
}, [H("div", {
|
|
2292
2728
|
ref: s,
|
|
2293
2729
|
class: "markweave-floating-toolbar-content",
|
|
2294
2730
|
"data-menu": t.value ?? "none"
|
|
2295
2731
|
}, [
|
|
2296
|
-
S("block-type", u.value.buttons["block-type"],
|
|
2732
|
+
S("block-type", u.value.buttons["block-type"], Xr, () => _("block-type"), t.value === "block-type"),
|
|
2297
2733
|
C(),
|
|
2298
|
-
S("bold", u.value.buttons.bold,
|
|
2299
|
-
S("italic", u.value.buttons.italic,
|
|
2300
|
-
S("underline", u.value.buttons.underline,
|
|
2301
|
-
S("strike", u.value.buttons.strike,
|
|
2302
|
-
S("inline-code", u.value.buttons["inline-code"],
|
|
2734
|
+
S("bold", u.value.buttons.bold, rr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2735
|
+
S("italic", u.value.buttons.italic, Tr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2736
|
+
S("underline", u.value.buttons.underline, Zr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2737
|
+
S("strike", u.value.buttons.strike, Hr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2738
|
+
S("inline-code", u.value.buttons["inline-code"], dr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2303
2739
|
C(),
|
|
2304
|
-
S("link", u.value.buttons.link,
|
|
2305
|
-
S("color", u.value.buttons.color,
|
|
2740
|
+
S("link", u.value.buttons.link, Dr, () => _("link"), e.editor.isActive("link")),
|
|
2741
|
+
S("color", u.value.buttons.color, Xr, () => _("color"), t.value === "color"),
|
|
2306
2742
|
C(),
|
|
2307
|
-
S("more", u.value.buttons.more,
|
|
2743
|
+
S("more", u.value.buttons.more, Mr, () => _("more"), t.value === "more"),
|
|
2308
2744
|
T(),
|
|
2309
2745
|
x()
|
|
2310
2746
|
])]) });
|
|
2311
2747
|
}
|
|
2312
|
-
}),
|
|
2748
|
+
}), Oi = Y({
|
|
2313
2749
|
name: "MarkweaveVueMathEditorPopover",
|
|
2314
2750
|
props: {
|
|
2315
2751
|
editor: {
|
|
@@ -2330,17 +2766,17 @@ var Br = J({
|
|
|
2330
2766
|
}
|
|
2331
2767
|
},
|
|
2332
2768
|
setup(e) {
|
|
2333
|
-
let t =
|
|
2769
|
+
let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(_t(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
|
|
2334
2770
|
html: a.value,
|
|
2335
2771
|
error: !1
|
|
2336
|
-
} :
|
|
2772
|
+
} : xt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => gt(e.editor, e.target) ?? 1), u = () => {
|
|
2337
2773
|
if (typeof window > "u") return;
|
|
2338
|
-
let r =
|
|
2774
|
+
let r = ht(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2339
2775
|
if (!r || !i) {
|
|
2340
2776
|
e.onClose();
|
|
2341
2777
|
return;
|
|
2342
2778
|
}
|
|
2343
|
-
n.value =
|
|
2779
|
+
n.value = mt({
|
|
2344
2780
|
anchorRect: r,
|
|
2345
2781
|
frameRect: i,
|
|
2346
2782
|
kind: e.target.kind,
|
|
@@ -2349,7 +2785,7 @@ var Br = J({
|
|
|
2349
2785
|
viewportWidth: window.innerWidth
|
|
2350
2786
|
});
|
|
2351
2787
|
}, d = () => {
|
|
2352
|
-
s.value &&
|
|
2788
|
+
s.value && pt(e.editor, e.target, t.value) && e.onClose();
|
|
2353
2789
|
}, f = (t) => {
|
|
2354
2790
|
if (t.key === "Escape") {
|
|
2355
2791
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2360,14 +2796,14 @@ var Br = J({
|
|
|
2360
2796
|
let n = t.target;
|
|
2361
2797
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2362
2798
|
};
|
|
2363
|
-
return
|
|
2364
|
-
t.value = e.target.latex, a.value =
|
|
2365
|
-
}),
|
|
2366
|
-
|
|
2799
|
+
return K(() => [e.target.pos, e.target.latex], () => {
|
|
2800
|
+
t.value = e.target.latex, a.value = _t(e.editor, e.target), J(u);
|
|
2801
|
+
}), In(() => {
|
|
2802
|
+
St(e.editor, e.target, !0), u(), J(() => {
|
|
2367
2803
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2368
2804
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2369
|
-
}),
|
|
2370
|
-
|
|
2805
|
+
}), q(() => {
|
|
2806
|
+
St(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2371
2807
|
}), () => {
|
|
2372
2808
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2373
2809
|
ref: i,
|
|
@@ -2380,7 +2816,7 @@ var Br = J({
|
|
|
2380
2816
|
},
|
|
2381
2817
|
onKeydown: f
|
|
2382
2818
|
};
|
|
2383
|
-
return e.target.kind === "inline" ?
|
|
2819
|
+
return e.target.kind === "inline" ? H("form", {
|
|
2384
2820
|
ref: r,
|
|
2385
2821
|
class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
|
|
2386
2822
|
"aria-label": a,
|
|
@@ -2395,22 +2831,22 @@ var Br = J({
|
|
|
2395
2831
|
onSubmit: (e) => {
|
|
2396
2832
|
e.preventDefault(), d();
|
|
2397
2833
|
}
|
|
2398
|
-
}, [
|
|
2834
|
+
}, [H("label", {
|
|
2399
2835
|
class: "markweave-math-inline-source",
|
|
2400
2836
|
"data-testid": "markweave-math-inline-source"
|
|
2401
2837
|
}, [
|
|
2402
|
-
|
|
2403
|
-
|
|
2838
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$"),
|
|
2839
|
+
H("input", {
|
|
2404
2840
|
...u,
|
|
2405
2841
|
"aria-label": c.value.latexLabel,
|
|
2406
2842
|
size: Math.max(t.value.length, 1)
|
|
2407
2843
|
}),
|
|
2408
|
-
|
|
2409
|
-
]),
|
|
2844
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$")
|
|
2845
|
+
]), H("div", {
|
|
2410
2846
|
class: "markweave-math-inline-preview",
|
|
2411
2847
|
"data-error": o.value.error ? "true" : "false",
|
|
2412
2848
|
"data-testid": "markweave-math-editor-preview"
|
|
2413
|
-
}, [
|
|
2849
|
+
}, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])]) : H("form", {
|
|
2414
2850
|
ref: r,
|
|
2415
2851
|
class: "markweave-math-editor-popover markweave-math-editor-popover--block",
|
|
2416
2852
|
"aria-label": a,
|
|
@@ -2426,39 +2862,39 @@ var Br = J({
|
|
|
2426
2862
|
e.preventDefault(), d();
|
|
2427
2863
|
}
|
|
2428
2864
|
}, [
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
Z(
|
|
2432
|
-
|
|
2865
|
+
H("div", { class: "markweave-math-block-toolbar" }, [
|
|
2866
|
+
H("span", null, c.value.label),
|
|
2867
|
+
Z(dr, c.value.label, 15, 1.75),
|
|
2868
|
+
H("button", {
|
|
2433
2869
|
type: "submit",
|
|
2434
2870
|
title: c.value.apply,
|
|
2435
2871
|
"aria-label": c.value.apply,
|
|
2436
2872
|
disabled: !s.value,
|
|
2437
2873
|
"data-testid": "markweave-math-editor-apply"
|
|
2438
|
-
}, [Z(
|
|
2874
|
+
}, [Z(or, c.value.apply, 16, 2)])
|
|
2439
2875
|
]),
|
|
2440
|
-
|
|
2876
|
+
H("label", {
|
|
2441
2877
|
class: "markweave-math-block-source",
|
|
2442
2878
|
"data-testid": "markweave-math-block-source"
|
|
2443
2879
|
}, [
|
|
2444
|
-
|
|
2445
|
-
|
|
2880
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$$"),
|
|
2881
|
+
H("textarea", {
|
|
2446
2882
|
...u,
|
|
2447
2883
|
"aria-label": c.value.latexLabel,
|
|
2448
2884
|
rows: 3
|
|
2449
2885
|
}),
|
|
2450
|
-
|
|
2886
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$$")
|
|
2451
2887
|
]),
|
|
2452
|
-
|
|
2888
|
+
H("div", {
|
|
2453
2889
|
class: "markweave-math-block-preview",
|
|
2454
2890
|
"data-error": o.value.error ? "true" : "false",
|
|
2455
2891
|
"data-math-number": String(l.value),
|
|
2456
2892
|
"data-testid": "markweave-math-editor-preview"
|
|
2457
|
-
}, [
|
|
2893
|
+
}, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])
|
|
2458
2894
|
]);
|
|
2459
2895
|
};
|
|
2460
2896
|
}
|
|
2461
|
-
}),
|
|
2897
|
+
}), ki = Y({
|
|
2462
2898
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2463
2899
|
props: {
|
|
2464
2900
|
commands: {
|
|
@@ -2495,7 +2931,7 @@ var Br = J({
|
|
|
2495
2931
|
}
|
|
2496
2932
|
},
|
|
2497
2933
|
setup(e) {
|
|
2498
|
-
let t =
|
|
2934
|
+
let t = U(""), n = U(null), r = U(null), i = U(!1), a = U(""), o = U(0), s = G(() => {
|
|
2499
2935
|
let t = a.value.trim().toLowerCase();
|
|
2500
2936
|
return (t ? e.messages.slash.emojiItems.filter((e) => [
|
|
2501
2937
|
e.emoji,
|
|
@@ -2517,13 +2953,13 @@ var Br = J({
|
|
|
2517
2953
|
} : {
|
|
2518
2954
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2519
2955
|
trigger: "slash-command",
|
|
2520
|
-
source:
|
|
2956
|
+
source: L(t.value)
|
|
2521
2957
|
};
|
|
2522
2958
|
if (!n.value && !t.value.trim()) {
|
|
2523
2959
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2524
2960
|
return;
|
|
2525
2961
|
}
|
|
2526
|
-
let a = await
|
|
2962
|
+
let a = await R(i, e.onUpload);
|
|
2527
2963
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2528
2964
|
} catch (t) {
|
|
2529
2965
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -2550,32 +2986,32 @@ var Br = J({
|
|
|
2550
2986
|
group: t,
|
|
2551
2987
|
commands: e.commands.filter((e) => e.group === t)
|
|
2552
2988
|
})).filter((e) => e.commands.length);
|
|
2553
|
-
return
|
|
2989
|
+
return H("div", {
|
|
2554
2990
|
class: "markweave-slash-layer",
|
|
2555
2991
|
style: { display: "contents" },
|
|
2556
2992
|
"data-testid": "markweave-slash-layer"
|
|
2557
|
-
}, [
|
|
2993
|
+
}, [H("div", {
|
|
2558
2994
|
class: "markweave-slash-trigger",
|
|
2559
2995
|
style: d,
|
|
2560
2996
|
"aria-hidden": "true",
|
|
2561
2997
|
"data-testid": "markweave-slash-trigger"
|
|
2562
|
-
}, [
|
|
2998
|
+
}, [H("span", null, "/"), H("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), H("div", {
|
|
2563
2999
|
class: "markweave-slash-menu",
|
|
2564
3000
|
style: u,
|
|
2565
3001
|
role: "listbox",
|
|
2566
3002
|
"aria-label": e.messages.slash.ariaLabel,
|
|
2567
3003
|
"data-placement": e.position.placement,
|
|
2568
3004
|
"data-testid": "markweave-slash-menu"
|
|
2569
|
-
}, [e.inputCommand?.inputKind === "emoji" ?
|
|
3005
|
+
}, [e.inputCommand?.inputKind === "emoji" ? H("div", {
|
|
2570
3006
|
class: "markweave-slash-subpanel",
|
|
2571
3007
|
"data-testid": "markweave-slash-emoji-picker"
|
|
2572
3008
|
}, [
|
|
2573
|
-
|
|
3009
|
+
H("div", { class: "markweave-slash-subpanel-header" }, [H("button", {
|
|
2574
3010
|
type: "button",
|
|
2575
3011
|
onMousedown: $,
|
|
2576
3012
|
onClick: () => e.onInputCommandChange(null)
|
|
2577
|
-
}, e.messages.common.back),
|
|
2578
|
-
|
|
3013
|
+
}, e.messages.common.back), H("span", null, e.messages.slash.emojiTitle)]),
|
|
3014
|
+
H("label", { class: "markweave-slash-input" }, [H("span", null, "/"), H("input", {
|
|
2579
3015
|
autofocus: !0,
|
|
2580
3016
|
value: a.value,
|
|
2581
3017
|
placeholder: e.messages.slash.emojiSearchPlaceholder,
|
|
@@ -2586,11 +3022,11 @@ var Br = J({
|
|
|
2586
3022
|
t.key === "Escape" ? (t.preventDefault(), e.onInputCommandChange(null)) : t.key === "ArrowDown" ? (t.preventDefault(), o.value = s.value.length ? (o.value + 1) % s.value.length : 0) : t.key === "ArrowUp" ? (t.preventDefault(), o.value = s.value.length ? (o.value - 1 + s.value.length) % s.value.length : 0) : (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), l(o.value));
|
|
2587
3023
|
}
|
|
2588
3024
|
})]),
|
|
2589
|
-
|
|
3025
|
+
H("div", {
|
|
2590
3026
|
class: "markweave-slash-emoji-grid",
|
|
2591
3027
|
role: "listbox",
|
|
2592
3028
|
"aria-label": e.messages.slash.emojiTitle
|
|
2593
|
-
}, s.value.map((e, t) =>
|
|
3029
|
+
}, s.value.map((e, t) => H("button", {
|
|
2594
3030
|
key: `${e.emoji}-${e.label}`,
|
|
2595
3031
|
type: "button",
|
|
2596
3032
|
role: "option",
|
|
@@ -2599,17 +3035,17 @@ var Br = J({
|
|
|
2599
3035
|
onMouseenter: () => o.value = t,
|
|
2600
3036
|
onMousedown: $,
|
|
2601
3037
|
onClick: () => l(t)
|
|
2602
|
-
}, [
|
|
2603
|
-
]) : e.inputCommand?.inputKind === "upload" ?
|
|
3038
|
+
}, [H("span", null, e.emoji), H("small", null, e.label)])))
|
|
3039
|
+
]) : e.inputCommand?.inputKind === "upload" ? H("div", {
|
|
2604
3040
|
class: "markweave-slash-subpanel",
|
|
2605
3041
|
"data-testid": "markweave-slash-upload-panel"
|
|
2606
3042
|
}, [
|
|
2607
|
-
|
|
3043
|
+
H("div", { class: "markweave-slash-upload-header" }, [H("button", {
|
|
2608
3044
|
type: "button",
|
|
2609
3045
|
onMousedown: $,
|
|
2610
3046
|
onClick: () => e.onInputCommandChange(null)
|
|
2611
|
-
}, e.messages.common.back),
|
|
2612
|
-
|
|
3047
|
+
}, e.messages.common.back), H("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
|
|
3048
|
+
H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.slash.uploadValueLabel), H("input", {
|
|
2613
3049
|
autofocus: !0,
|
|
2614
3050
|
value: t.value,
|
|
2615
3051
|
placeholder: e.messages.slash.uploadValuePlaceholder,
|
|
@@ -2620,32 +3056,32 @@ var Br = J({
|
|
|
2620
3056
|
e.key === "Enter" && (e.preventDefault(), c());
|
|
2621
3057
|
}
|
|
2622
3058
|
})]),
|
|
2623
|
-
|
|
3059
|
+
H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.common.file), H("input", {
|
|
2624
3060
|
type: "file",
|
|
2625
3061
|
onChange: (e) => n.value = e.target.files?.[0] ?? null
|
|
2626
3062
|
})]),
|
|
2627
|
-
r.value ?
|
|
3063
|
+
r.value ? H("div", {
|
|
2628
3064
|
class: "markweave-slash-upload-error",
|
|
2629
3065
|
role: "alert"
|
|
2630
3066
|
}, r.value) : null,
|
|
2631
|
-
|
|
3067
|
+
H("div", { class: "markweave-slash-upload-actions" }, [H("button", {
|
|
2632
3068
|
type: "button",
|
|
2633
3069
|
onMousedown: $,
|
|
2634
3070
|
onClick: () => e.onInputCommandChange(null)
|
|
2635
|
-
}, e.messages.common.cancel),
|
|
3071
|
+
}, e.messages.common.cancel), H("button", {
|
|
2636
3072
|
type: "button",
|
|
2637
3073
|
"data-primary": "true",
|
|
2638
3074
|
disabled: i.value,
|
|
2639
3075
|
onMousedown: $,
|
|
2640
3076
|
onClick: c
|
|
2641
3077
|
}, e.messages.common.insert)])
|
|
2642
|
-
]) : e.commands.length ?
|
|
3078
|
+
]) : e.commands.length ? H("div", { class: "markweave-slash-command-list" }, f.map((t) => H("section", {
|
|
2643
3079
|
key: t.group,
|
|
2644
3080
|
class: "markweave-slash-group",
|
|
2645
3081
|
"aria-label": t.group
|
|
2646
|
-
}, [
|
|
2647
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
2648
|
-
return
|
|
3082
|
+
}, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
3083
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = jt(t);
|
|
3084
|
+
return H("button", {
|
|
2649
3085
|
key: t.id,
|
|
2650
3086
|
type: "button",
|
|
2651
3087
|
role: "option",
|
|
@@ -2667,18 +3103,44 @@ var Br = J({
|
|
|
2667
3103
|
}
|
|
2668
3104
|
}
|
|
2669
3105
|
}, [
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
t.disabledReason ?
|
|
3106
|
+
wi(t.icon),
|
|
3107
|
+
H("span", null, t.label),
|
|
3108
|
+
t.disabledReason ? H("small", null, t.disabledReason) : null
|
|
2673
3109
|
]);
|
|
2674
|
-
})]))) :
|
|
3110
|
+
})]))) : H("div", {
|
|
2675
3111
|
class: "markweave-slash-menu__empty",
|
|
2676
3112
|
role: "option",
|
|
2677
3113
|
"aria-disabled": "true"
|
|
2678
3114
|
}, e.messages.slash.noResults)])]);
|
|
2679
3115
|
};
|
|
2680
3116
|
}
|
|
2681
|
-
}),
|
|
3117
|
+
}), Ai = {
|
|
3118
|
+
"move-left": Yn,
|
|
3119
|
+
"move-right": Xn,
|
|
3120
|
+
"move-up": Zn,
|
|
3121
|
+
"move-down": qn,
|
|
3122
|
+
"insert-left": nr,
|
|
3123
|
+
"insert-right": tr,
|
|
3124
|
+
"insert-above": er,
|
|
3125
|
+
"insert-below": $n,
|
|
3126
|
+
"sort-asc": Jn,
|
|
3127
|
+
"sort-desc": Qn,
|
|
3128
|
+
color: Nr,
|
|
3129
|
+
alignment: Vn,
|
|
3130
|
+
clear: Vr,
|
|
3131
|
+
duplicate: pr,
|
|
3132
|
+
copy: pr,
|
|
3133
|
+
merge: Kr,
|
|
3134
|
+
split: qr,
|
|
3135
|
+
delete: Yr
|
|
3136
|
+
}, ji = {
|
|
3137
|
+
left: Vn,
|
|
3138
|
+
center: zn,
|
|
3139
|
+
right: Hn,
|
|
3140
|
+
top: Gn,
|
|
3141
|
+
middle: Un,
|
|
3142
|
+
bottom: Wn
|
|
3143
|
+
}, Mi = Y({
|
|
2682
3144
|
name: "MarkweaveVueTableControls",
|
|
2683
3145
|
props: {
|
|
2684
3146
|
editor: {
|
|
@@ -2711,221 +3173,422 @@ var Br = J({
|
|
|
2711
3173
|
}
|
|
2712
3174
|
},
|
|
2713
3175
|
setup(e) {
|
|
2714
|
-
let t =
|
|
2715
|
-
|
|
2716
|
-
},
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
},
|
|
2720
|
-
},
|
|
3176
|
+
let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(0), f = U(null), p = U(null), m = U(null), h = U(null), g = U(null), _ = null, v = null, y = null, b = G(() => e.active ? Wt(e.editor.state) : gi), x = G(() => ln(e.editor, e.interactionState, "row", b.value.activeCellPos)), S = G(() => ln(e.editor, e.interactionState, "column", b.value.activeCellPos)), C = G(() => an(e.editor)), w = G(() => (C.value, b.value.active)), T = G(() => t.value ? pn(e.editor, t.value) : []), E = () => {
|
|
3177
|
+
_ === null || typeof window > "u" || (window.clearTimeout(_), _ = null);
|
|
3178
|
+
}, D = (e) => {
|
|
3179
|
+
E(), u.value = e, !(!e || typeof window > "u") && (_ = window.setTimeout(() => {
|
|
3180
|
+
u.value = null, _ = null;
|
|
3181
|
+
}, yn));
|
|
3182
|
+
}, O = () => {
|
|
2721
3183
|
if (!e.active) {
|
|
2722
|
-
|
|
3184
|
+
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, D(null);
|
|
2723
3185
|
return;
|
|
2724
3186
|
}
|
|
2725
|
-
let
|
|
2726
|
-
if (!
|
|
2727
|
-
|
|
3187
|
+
let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement;
|
|
3188
|
+
if (!n) {
|
|
3189
|
+
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
|
|
2728
3190
|
return;
|
|
2729
3191
|
}
|
|
2730
|
-
let
|
|
2731
|
-
|
|
2732
|
-
targetRect:
|
|
2733
|
-
frameRect:
|
|
3192
|
+
let l = n.getBoundingClientRect(), u = x.value ? cn(e.editor, x.value) : null, d = S.value ? cn(e.editor, S.value) : null, f = w.value ? mn(e.editor) : null, p = rn(e.editor)?.getBoundingClientRect() ?? null;
|
|
3193
|
+
u ? i.value = Qt({
|
|
3194
|
+
targetRect: u,
|
|
3195
|
+
frameRect: l,
|
|
2734
3196
|
kind: "row"
|
|
2735
|
-
}) : t.value === "row" &&
|
|
2736
|
-
targetRect:
|
|
2737
|
-
frameRect:
|
|
3197
|
+
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Qt({
|
|
3198
|
+
targetRect: d,
|
|
3199
|
+
frameRect: l,
|
|
2738
3200
|
kind: "column"
|
|
2739
|
-
}) : t.value === "column" &&
|
|
2740
|
-
targetRect:
|
|
2741
|
-
frameRect:
|
|
3201
|
+
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Qt({
|
|
3202
|
+
targetRect: f,
|
|
3203
|
+
frameRect: l,
|
|
2742
3204
|
kind: "selection"
|
|
2743
|
-
}) : t.value === "selection" &&
|
|
2744
|
-
|
|
3205
|
+
}) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
|
|
3206
|
+
let m = e.interactionState.hoverCellPos !== null && !!(x.value && x.value.index === x.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(S.value && S.value.index === S.value.visualWidth - 1);
|
|
3207
|
+
s.value = p && m ? $t({
|
|
3208
|
+
tableRect: p,
|
|
3209
|
+
frameRect: l,
|
|
3210
|
+
kind: "row"
|
|
3211
|
+
}) : null, c.value = p && h ? $t({
|
|
3212
|
+
tableRect: p,
|
|
3213
|
+
frameRect: l,
|
|
3214
|
+
kind: "column"
|
|
3215
|
+
}) : null;
|
|
3216
|
+
}, k = () => {
|
|
2745
3217
|
if (!e.active || !t.value) {
|
|
2746
|
-
|
|
3218
|
+
l.value = null;
|
|
2747
3219
|
return;
|
|
2748
3220
|
}
|
|
2749
|
-
let
|
|
2750
|
-
if (!
|
|
2751
|
-
|
|
3221
|
+
let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = r.value === "row-edge" ? p.value : r.value === "column-edge" ? m.value : h.value;
|
|
3222
|
+
if (!n || !i || !g.value) {
|
|
3223
|
+
l.value = null;
|
|
2752
3224
|
return;
|
|
2753
3225
|
}
|
|
2754
|
-
let a = i.getBoundingClientRect(),
|
|
3226
|
+
let a = i.getBoundingClientRect(), o = t.value === "row" ? rn(e.editor)?.getBoundingClientRect() : null, s = o ? {
|
|
2755
3227
|
left: a.left,
|
|
2756
|
-
top:
|
|
3228
|
+
top: o.top,
|
|
2757
3229
|
width: a.width,
|
|
2758
3230
|
height: a.height
|
|
2759
|
-
} : a,
|
|
2760
|
-
|
|
2761
|
-
anchorRect:
|
|
2762
|
-
frameRect:
|
|
3231
|
+
} : a, c = n.getBoundingClientRect(), u = g.value.getBoundingClientRect();
|
|
3232
|
+
l.value = Zt({
|
|
3233
|
+
anchorRect: s,
|
|
3234
|
+
frameRect: c,
|
|
2763
3235
|
menuSize: {
|
|
2764
|
-
width:
|
|
2765
|
-
height:
|
|
3236
|
+
width: u.width || 254,
|
|
3237
|
+
height: u.height || 410
|
|
2766
3238
|
},
|
|
2767
3239
|
kind: t.value
|
|
2768
3240
|
});
|
|
2769
|
-
},
|
|
2770
|
-
|
|
2771
|
-
},
|
|
2772
|
-
|
|
2773
|
-
},
|
|
2774
|
-
let
|
|
2775
|
-
|
|
2776
|
-
},
|
|
2777
|
-
e.editor.view.dispatch(
|
|
2778
|
-
},
|
|
2779
|
-
let r = e.interactionState.hoverCellPos ??
|
|
2780
|
-
r !== null &&
|
|
2781
|
-
},
|
|
2782
|
-
|
|
2783
|
-
},
|
|
2784
|
-
t.value = null,
|
|
2785
|
-
},
|
|
2786
|
-
let i = await
|
|
3241
|
+
}, A = () => {
|
|
3242
|
+
O(), k();
|
|
3243
|
+
}, j = () => {
|
|
3244
|
+
J(A);
|
|
3245
|
+
}, M = (e, i) => {
|
|
3246
|
+
let a = t.value === e && r.value === i;
|
|
3247
|
+
r.value = i, t.value = a ? null : e, n.value = null, j();
|
|
3248
|
+
}, N = () => {
|
|
3249
|
+
e.editor.view.dispatch(Vt(e.editor.state.tr, null));
|
|
3250
|
+
}, P = (t, n) => {
|
|
3251
|
+
let r = e.interactionState.hoverCellPos ?? b.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
3252
|
+
r !== null && _n(e.editor, r, t, { visualIndex: i }), M(t, n);
|
|
3253
|
+
}, F = () => {
|
|
3254
|
+
N(), M("selection", "selection-edge");
|
|
3255
|
+
}, I = (r = !1) => {
|
|
3256
|
+
t.value = null, n.value = null, l.value = null, r && e.editor.view.focus();
|
|
3257
|
+
}, L = async (n, r) => {
|
|
3258
|
+
let i = await tn({
|
|
2787
3259
|
editor: e.editor,
|
|
2788
3260
|
commandId: n,
|
|
2789
3261
|
menu: r ?? t.value ?? "selection",
|
|
2790
3262
|
messages: e.messages
|
|
2791
3263
|
});
|
|
2792
|
-
return i.copyFeedback ? (
|
|
2793
|
-
},
|
|
2794
|
-
let n =
|
|
2795
|
-
n && e.onEditWithAi?.(n),
|
|
2796
|
-
},
|
|
2797
|
-
|
|
2798
|
-
},
|
|
2799
|
-
t.value
|
|
3264
|
+
return i.copyFeedback ? (D(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : D(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
3265
|
+
}, ee = (t) => {
|
|
3266
|
+
let n = un(e.editor, t);
|
|
3267
|
+
n && e.onEditWithAi?.(n), I(!0);
|
|
3268
|
+
}, R = (e) => {
|
|
3269
|
+
t.value !== "row" && t.value !== "column" || e(t.value) && (d.value += 1, j());
|
|
3270
|
+
}, z = (t) => {
|
|
3271
|
+
let n = t === "row" ? x.value : S.value, r = e.interactionState.hoverCellPos ?? b.value.activeCellPos;
|
|
3272
|
+
!n || r === null || Cn(e.editor, r, t, { visualIndex: n.index }) && L(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
3273
|
+
}, te = (e, t, n) => {
|
|
3274
|
+
v = {
|
|
3275
|
+
axis: e,
|
|
3276
|
+
index: t
|
|
3277
|
+
}, y = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
3278
|
+
}, ne = (t) => {
|
|
3279
|
+
if (!v) return;
|
|
3280
|
+
let n = on(e.editor, v.axis, t.clientX, t.clientY);
|
|
3281
|
+
n !== null && (t.preventDefault(), y = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
3282
|
+
}, B = (t) => {
|
|
3283
|
+
let n = v;
|
|
3284
|
+
if (!n) return;
|
|
3285
|
+
let r = on(e.editor, n.axis, t.clientX, t.clientY) ?? y;
|
|
3286
|
+
t.preventDefault(), v = null, y = null, r !== null && gn(e.editor, n.axis, n.index, r);
|
|
3287
|
+
}, V = G(() => (d.value, t.value === "row" || t.value === "column" ? sn(e.editor, t.value) : null)), re = (e) => {
|
|
3288
|
+
if (!(!t.value || e.key !== "Escape")) {
|
|
3289
|
+
if (n.value) {
|
|
3290
|
+
n.value = null;
|
|
3291
|
+
return;
|
|
3292
|
+
}
|
|
3293
|
+
I(!0);
|
|
3294
|
+
}
|
|
3295
|
+
}, ie = (e) => {
|
|
3296
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
3297
|
+
let t = e.currentTarget;
|
|
3298
|
+
if (!(t instanceof HTMLElement)) return;
|
|
3299
|
+
let n = Array.from(t.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), r = n.indexOf(document.activeElement), i = e.key === "ArrowDown" ? 1 : -1, a = r < 0 ? 0 : Math.min(n.length - 1, Math.max(0, r + i));
|
|
3300
|
+
e.preventDefault(), e.stopPropagation(), n[a]?.focus();
|
|
3301
|
+
}, ae = (e) => {
|
|
3302
|
+
t.value && (e.target instanceof Node && f.value?.contains(e.target) || I());
|
|
2800
3303
|
};
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
}),
|
|
2804
|
-
|
|
2805
|
-
}),
|
|
3304
|
+
In(() => {
|
|
3305
|
+
A(), window.addEventListener("resize", A), window.addEventListener("scroll", A, !0), document.addEventListener("keydown", re), document.addEventListener("mousedown", ae), document.addEventListener("dragover", ne), document.addEventListener("drop", B);
|
|
3306
|
+
}), q(() => {
|
|
3307
|
+
E(), window.removeEventListener("resize", A), window.removeEventListener("scroll", A, !0), document.removeEventListener("keydown", re), document.removeEventListener("mousedown", ae), document.removeEventListener("dragover", ne), document.removeEventListener("drop", B);
|
|
3308
|
+
}), K(() => [
|
|
2806
3309
|
e.active,
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
3310
|
+
b.value.activeCellPos,
|
|
3311
|
+
b.value.selectionFrom,
|
|
3312
|
+
b.value.selectionTo,
|
|
2810
3313
|
e.interactionState.hoverCellPos,
|
|
2811
3314
|
e.interactionState.hoverVisualColumnIndex,
|
|
2812
3315
|
e.interactionState.hoverVisualRowIndex,
|
|
2813
3316
|
t.value,
|
|
2814
|
-
|
|
2815
|
-
],
|
|
2816
|
-
let
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
3317
|
+
r.value
|
|
3318
|
+
], j, { flush: "post" });
|
|
3319
|
+
let oe = () => {
|
|
3320
|
+
if (!t.value) return null;
|
|
3321
|
+
let r = T.value.map((r, i) => {
|
|
3322
|
+
let a = dn(r), o = i === 0 ? a : dn(T.value[i - 1]), s = i > 0 && o !== a, c = r.submenuId ? !0 : r.commandId === null ? !!e.onEditWithAi : en(e.editor, r.commandId), l = fn(r, e.messages), u = Ai[r.icon];
|
|
3323
|
+
return H("button", {
|
|
3324
|
+
key: `${r.id}-${i}`,
|
|
3325
|
+
type: "button",
|
|
3326
|
+
role: "menuitem",
|
|
3327
|
+
"aria-label": l,
|
|
3328
|
+
"aria-disabled": !c,
|
|
3329
|
+
"aria-haspopup": r.submenuId ? "menu" : void 0,
|
|
3330
|
+
"aria-expanded": r.submenuId ? n.value === r.submenuId : void 0,
|
|
3331
|
+
disabled: !c,
|
|
3332
|
+
"data-menu-group": a,
|
|
3333
|
+
"data-starts-group": s ? "true" : "false",
|
|
3334
|
+
"data-command-enabled": c ? "true" : "false",
|
|
3335
|
+
"data-submenu-trigger": r.submenuId ?? void 0,
|
|
3336
|
+
"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",
|
|
3337
|
+
onMousedown: $,
|
|
3338
|
+
onMouseenter: () => {
|
|
3339
|
+
n.value = r.submenuId;
|
|
3340
|
+
},
|
|
3341
|
+
onClick: () => {
|
|
3342
|
+
if (c) {
|
|
3343
|
+
if (r.submenuId) {
|
|
3344
|
+
n.value = r.submenuId;
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
3347
|
+
if (r.commandId === null) {
|
|
3348
|
+
ee(t.value === "row" || t.value === "column" ? t.value : "selection");
|
|
3349
|
+
return;
|
|
3350
|
+
}
|
|
3351
|
+
L(r.commandId).finally(() => I());
|
|
2846
3352
|
}
|
|
2847
|
-
A(n.commandId).finally(() => k());
|
|
2848
3353
|
}
|
|
2849
|
-
}
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
3354
|
+
}, [
|
|
3355
|
+
H("span", {
|
|
3356
|
+
class: "markweave-table-menu-item-icon",
|
|
3357
|
+
"aria-hidden": "true"
|
|
3358
|
+
}, [H(u, {
|
|
3359
|
+
size: 18,
|
|
3360
|
+
strokeWidth: 1.8
|
|
3361
|
+
})]),
|
|
3362
|
+
H("span", { class: "markweave-table-menu-item-label" }, l),
|
|
3363
|
+
r.submenuId ? H(cr, {
|
|
3364
|
+
class: "markweave-table-menu-chevron",
|
|
3365
|
+
size: 16,
|
|
3366
|
+
"aria-hidden": "true"
|
|
3367
|
+
}) : null
|
|
3368
|
+
]);
|
|
3369
|
+
});
|
|
3370
|
+
if (n.value === "color" && (t.value === "row" || t.value === "column") && r.push(H("div", {
|
|
3371
|
+
class: "markweave-table-submenu markweave-table-color-menu",
|
|
3372
|
+
role: "menu",
|
|
3373
|
+
"aria-label": e.messages.table.submenus.color,
|
|
3374
|
+
"data-testid": "markweave-table-color-menu",
|
|
3375
|
+
onKeydown: ie
|
|
3376
|
+
}, [
|
|
3377
|
+
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
3378
|
+
...vn.map((t) => H("button", {
|
|
3379
|
+
key: `text-${t.id}`,
|
|
3380
|
+
type: "button",
|
|
3381
|
+
role: "menuitemradio",
|
|
3382
|
+
"aria-checked": V.value?.textColorId === t.id,
|
|
3383
|
+
"data-active": V.value?.textColorId === t.id ? "true" : "false",
|
|
3384
|
+
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
3385
|
+
onMousedown: $,
|
|
3386
|
+
onClick: () => R((n) => Xt(e.editor, n, t.id))
|
|
3387
|
+
}, [H("span", {
|
|
3388
|
+
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3389
|
+
"aria-hidden": "true",
|
|
3390
|
+
style: { backgroundColor: t.textColor ?? "var(--markweave-text)" }
|
|
3391
|
+
}), H("span", null, e.messages.table.colors[t.id].text)])),
|
|
3392
|
+
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3393
|
+
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
3394
|
+
...vn.map((t) => H("button", {
|
|
3395
|
+
key: `background-${t.id}`,
|
|
3396
|
+
type: "button",
|
|
3397
|
+
role: "menuitemradio",
|
|
3398
|
+
"aria-checked": V.value?.backgroundColorId === t.id,
|
|
3399
|
+
"data-active": V.value?.backgroundColorId === t.id ? "true" : "false",
|
|
3400
|
+
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
3401
|
+
onMousedown: $,
|
|
3402
|
+
onClick: () => R((n) => Yt(e.editor, n, t.id))
|
|
3403
|
+
}, [H("span", {
|
|
3404
|
+
class: "markweave-table-color-swatch",
|
|
3405
|
+
"aria-hidden": "true",
|
|
3406
|
+
style: { backgroundColor: t.backgroundColor }
|
|
3407
|
+
}), H("span", null, e.messages.table.colors[t.id].background)]))
|
|
3408
|
+
])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
|
|
3409
|
+
let t = (t, n) => {
|
|
3410
|
+
let r = ji[t];
|
|
3411
|
+
return H("button", {
|
|
3412
|
+
key: t,
|
|
3413
|
+
type: "button",
|
|
3414
|
+
role: "menuitemradio",
|
|
3415
|
+
"aria-checked": n,
|
|
3416
|
+
"data-active": n ? "true" : "false",
|
|
3417
|
+
"data-testid": `markweave-table-alignment-${t}`,
|
|
3418
|
+
onMousedown: $,
|
|
3419
|
+
onClick: () => R((n) => Jt(e.editor, n, t))
|
|
3420
|
+
}, [H(r, {
|
|
3421
|
+
size: 18,
|
|
3422
|
+
strokeWidth: 1.8,
|
|
3423
|
+
"aria-hidden": "true"
|
|
3424
|
+
}), H("span", null, e.messages.table.alignments[t])]);
|
|
3425
|
+
};
|
|
3426
|
+
r.push(H("div", {
|
|
3427
|
+
class: "markweave-table-submenu markweave-table-alignment-menu",
|
|
3428
|
+
role: "menu",
|
|
3429
|
+
"aria-label": e.messages.table.submenus.alignment,
|
|
3430
|
+
"data-testid": "markweave-table-alignment-menu",
|
|
3431
|
+
onKeydown: ie
|
|
3432
|
+
}, [
|
|
3433
|
+
...bn.map((e) => t(e, V.value?.textAlign === e)),
|
|
3434
|
+
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3435
|
+
...Sn.map((e) => t(e, V.value?.verticalAlign === e))
|
|
3436
|
+
]));
|
|
3437
|
+
}
|
|
3438
|
+
return H("div", {
|
|
3439
|
+
ref: g,
|
|
3440
|
+
class: "markweave-table-menu",
|
|
3441
|
+
role: "menu",
|
|
3442
|
+
"aria-label": xn(t.value, e.messages),
|
|
3443
|
+
"data-testid": "markweave-table-menu",
|
|
3444
|
+
"data-positioned": l.value ? "true" : "false",
|
|
3445
|
+
"data-submenu": n.value ?? "none",
|
|
3446
|
+
style: l.value ? {
|
|
3447
|
+
left: `${l.value.left}px`,
|
|
3448
|
+
top: `${l.value.top}px`
|
|
3449
|
+
} : void 0,
|
|
3450
|
+
onKeydown: ie
|
|
3451
|
+
}, r);
|
|
3452
|
+
};
|
|
3453
|
+
return () => e.active ? H("div", {
|
|
3454
|
+
ref: f,
|
|
2854
3455
|
class: "markweave-table-controls",
|
|
2855
3456
|
"data-testid": "markweave-table-controls",
|
|
2856
3457
|
"aria-label": e.messages.table.controlsAriaLabel,
|
|
2857
3458
|
"data-open-menu": t.value ?? "none",
|
|
2858
|
-
"data-positioned":
|
|
3459
|
+
"data-positioned": i.value || a.value || o.value ? "true" : "false",
|
|
3460
|
+
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(qt, { type: "clear-hover" }))
|
|
2859
3461
|
}, [
|
|
2860
|
-
|
|
3462
|
+
u.value ? H("div", {
|
|
2861
3463
|
class: "markweave-table-copy-feedback",
|
|
2862
3464
|
role: "status",
|
|
2863
3465
|
"aria-live": "polite",
|
|
2864
3466
|
"data-testid": "markweave-table-copy-feedback",
|
|
2865
|
-
"data-copy-kind":
|
|
2866
|
-
"data-text-length":
|
|
2867
|
-
"data-html-length":
|
|
2868
|
-
},
|
|
2869
|
-
|
|
2870
|
-
ref:
|
|
3467
|
+
"data-copy-kind": u.value.kind,
|
|
3468
|
+
"data-text-length": u.value.textLength,
|
|
3469
|
+
"data-html-length": u.value.htmlLength
|
|
3470
|
+
}, nn(u.value)) : null,
|
|
3471
|
+
i.value ? H("button", {
|
|
3472
|
+
ref: p,
|
|
2871
3473
|
type: "button",
|
|
3474
|
+
draggable: !0,
|
|
2872
3475
|
class: "markweave-table-edge-handle markweave-table-edge-handle--row",
|
|
2873
3476
|
"aria-label": e.messages.table.activeRowActions,
|
|
2874
|
-
"aria-expanded": t.value === "row" &&
|
|
3477
|
+
"aria-expanded": t.value === "row" && r.value === "row-edge",
|
|
2875
3478
|
"aria-haspopup": "menu",
|
|
2876
3479
|
title: e.messages.table.rowActions,
|
|
2877
3480
|
"data-testid": "markweave-table-hover-row-handle",
|
|
2878
|
-
"data-axis-index":
|
|
2879
|
-
"data-axis-selected-cells":
|
|
2880
|
-
"data-axis-visual-cells":
|
|
2881
|
-
"data-axis-visual-size":
|
|
3481
|
+
"data-axis-index": x.value?.index ?? "",
|
|
3482
|
+
"data-axis-selected-cells": x.value?.selectedCellCount ?? "",
|
|
3483
|
+
"data-axis-visual-cells": x.value?.visualCellCount ?? "",
|
|
3484
|
+
"data-axis-visual-size": x.value?.visualHeight ?? "",
|
|
2882
3485
|
style: {
|
|
2883
|
-
left: `${
|
|
2884
|
-
top: `${
|
|
3486
|
+
left: `${i.value.left}px`,
|
|
3487
|
+
top: `${i.value.top}px`,
|
|
3488
|
+
width: `${i.value.width}px`,
|
|
3489
|
+
height: `${i.value.height}px`
|
|
2885
3490
|
},
|
|
2886
3491
|
onMousedown: $,
|
|
2887
|
-
onClick: () =>
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
3492
|
+
onClick: () => P("row", "row-edge"),
|
|
3493
|
+
onDragstart: (e) => te("row", x.value?.index ?? 0, e),
|
|
3494
|
+
onDragend: () => {
|
|
3495
|
+
v = null, y = null;
|
|
3496
|
+
}
|
|
3497
|
+
}, [H(Mr, {
|
|
3498
|
+
size: 14,
|
|
3499
|
+
"aria-hidden": "true"
|
|
3500
|
+
})]) : null,
|
|
3501
|
+
a.value ? H("button", {
|
|
3502
|
+
ref: m,
|
|
2891
3503
|
type: "button",
|
|
3504
|
+
draggable: !0,
|
|
2892
3505
|
class: "markweave-table-edge-handle markweave-table-edge-handle--column",
|
|
2893
3506
|
"aria-label": e.messages.table.activeColumnActions,
|
|
2894
|
-
"aria-expanded": t.value === "column" &&
|
|
3507
|
+
"aria-expanded": t.value === "column" && r.value === "column-edge",
|
|
2895
3508
|
"aria-haspopup": "menu",
|
|
2896
3509
|
title: e.messages.table.columnActions,
|
|
2897
3510
|
"data-testid": "markweave-table-hover-column-handle",
|
|
2898
|
-
"data-axis-index":
|
|
2899
|
-
"data-axis-selected-cells":
|
|
2900
|
-
"data-axis-visual-cells":
|
|
2901
|
-
"data-axis-visual-size":
|
|
3511
|
+
"data-axis-index": S.value?.index ?? "",
|
|
3512
|
+
"data-axis-selected-cells": S.value?.selectedCellCount ?? "",
|
|
3513
|
+
"data-axis-visual-cells": S.value?.visualCellCount ?? "",
|
|
3514
|
+
"data-axis-visual-size": S.value?.visualWidth ?? "",
|
|
2902
3515
|
style: {
|
|
2903
|
-
left: `${
|
|
2904
|
-
top: `${
|
|
3516
|
+
left: `${a.value.left}px`,
|
|
3517
|
+
top: `${a.value.top}px`,
|
|
3518
|
+
width: `${a.value.width}px`,
|
|
3519
|
+
height: `${a.value.height}px`
|
|
2905
3520
|
},
|
|
2906
3521
|
onMousedown: $,
|
|
2907
|
-
onClick: () =>
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
3522
|
+
onClick: () => P("column", "column-edge"),
|
|
3523
|
+
onDragstart: (e) => te("column", S.value?.index ?? 0, e),
|
|
3524
|
+
onDragend: () => {
|
|
3525
|
+
v = null, y = null;
|
|
3526
|
+
}
|
|
3527
|
+
}, [H(Mr, {
|
|
3528
|
+
size: 14,
|
|
3529
|
+
"aria-hidden": "true"
|
|
3530
|
+
})]) : null,
|
|
3531
|
+
w.value && o.value ? H("button", {
|
|
3532
|
+
ref: h,
|
|
2911
3533
|
type: "button",
|
|
2912
3534
|
class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
2913
3535
|
"aria-label": e.messages.table.selectionActions,
|
|
2914
|
-
"aria-expanded": t.value === "selection" &&
|
|
3536
|
+
"aria-expanded": t.value === "selection" && r.value === "selection-edge",
|
|
2915
3537
|
"aria-haspopup": "menu",
|
|
2916
3538
|
title: e.messages.table.selectionActions,
|
|
2917
3539
|
"data-testid": "markweave-table-cell-handle",
|
|
2918
3540
|
style: {
|
|
2919
|
-
left: `${
|
|
2920
|
-
top: `${
|
|
3541
|
+
left: `${o.value.left}px`,
|
|
3542
|
+
top: `${o.value.top}px`,
|
|
3543
|
+
width: `${o.value.width}px`,
|
|
3544
|
+
height: `${o.value.height}px`
|
|
2921
3545
|
},
|
|
2922
3546
|
onMousedown: $,
|
|
2923
|
-
onClick:
|
|
2924
|
-
}, [
|
|
2925
|
-
|
|
3547
|
+
onClick: F
|
|
3548
|
+
}, [H(Mr, {
|
|
3549
|
+
size: 14,
|
|
3550
|
+
"aria-hidden": "true"
|
|
3551
|
+
})]) : null,
|
|
3552
|
+
s.value ? H("button", {
|
|
3553
|
+
type: "button",
|
|
3554
|
+
class: "markweave-table-extend-button markweave-table-extend-button--row",
|
|
3555
|
+
"aria-label": e.messages.table.addRow,
|
|
3556
|
+
title: e.messages.table.addRow,
|
|
3557
|
+
"data-testid": "markweave-table-add-row",
|
|
3558
|
+
style: {
|
|
3559
|
+
left: `${s.value.left}px`,
|
|
3560
|
+
top: `${s.value.top}px`,
|
|
3561
|
+
width: `${s.value.width}px`,
|
|
3562
|
+
height: `${s.value.height}px`
|
|
3563
|
+
},
|
|
3564
|
+
onMousedown: $,
|
|
3565
|
+
onClick: () => z("row")
|
|
3566
|
+
}, [H(Ir, {
|
|
3567
|
+
size: 14,
|
|
3568
|
+
"aria-hidden": "true"
|
|
3569
|
+
})]) : null,
|
|
3570
|
+
c.value ? H("button", {
|
|
3571
|
+
type: "button",
|
|
3572
|
+
class: "markweave-table-extend-button markweave-table-extend-button--column",
|
|
3573
|
+
"aria-label": e.messages.table.addColumn,
|
|
3574
|
+
title: e.messages.table.addColumn,
|
|
3575
|
+
"data-testid": "markweave-table-add-column",
|
|
3576
|
+
style: {
|
|
3577
|
+
left: `${c.value.left}px`,
|
|
3578
|
+
top: `${c.value.top}px`,
|
|
3579
|
+
width: `${c.value.width}px`,
|
|
3580
|
+
height: `${c.value.height}px`
|
|
3581
|
+
},
|
|
3582
|
+
onMousedown: $,
|
|
3583
|
+
onClick: () => z("column")
|
|
3584
|
+
}, [H(Ir, {
|
|
3585
|
+
size: 14,
|
|
3586
|
+
"aria-hidden": "true"
|
|
3587
|
+
})]) : null,
|
|
3588
|
+
oe()
|
|
2926
3589
|
]) : null;
|
|
2927
3590
|
}
|
|
2928
|
-
}),
|
|
3591
|
+
}), Ni = Y({
|
|
2929
3592
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2930
3593
|
props: {
|
|
2931
3594
|
editor: {
|
|
@@ -2938,18 +3601,18 @@ var Br = J({
|
|
|
2938
3601
|
}
|
|
2939
3602
|
},
|
|
2940
3603
|
setup(e) {
|
|
2941
|
-
let t =
|
|
3604
|
+
let t = U(null), n = () => {
|
|
2942
3605
|
if (e.focusState.mode !== "cell-selection") {
|
|
2943
3606
|
t.value = null;
|
|
2944
3607
|
return;
|
|
2945
3608
|
}
|
|
2946
|
-
t.value =
|
|
3609
|
+
t.value = hn(e.editor, Gt(e.editor.state));
|
|
2947
3610
|
};
|
|
2948
|
-
return
|
|
3611
|
+
return In(() => {
|
|
2949
3612
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
2950
|
-
}),
|
|
3613
|
+
}), q(() => {
|
|
2951
3614
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
2952
|
-
}),
|
|
3615
|
+
}), K(() => [
|
|
2953
3616
|
e.focusState.activeCellPos,
|
|
2954
3617
|
e.focusState.anchorCellPos,
|
|
2955
3618
|
e.focusState.mode,
|
|
@@ -2957,10 +3620,10 @@ var Br = J({
|
|
|
2957
3620
|
e.focusState.selectionFrom,
|
|
2958
3621
|
e.focusState.selectionTo
|
|
2959
3622
|
], () => {
|
|
2960
|
-
|
|
3623
|
+
J(n);
|
|
2961
3624
|
}, { flush: "post" }), () => {
|
|
2962
3625
|
let e = t.value;
|
|
2963
|
-
return e ?
|
|
3626
|
+
return e ? H("div", {
|
|
2964
3627
|
"aria-hidden": "true",
|
|
2965
3628
|
class: "markweave-table-selection-overlay",
|
|
2966
3629
|
"data-anchor-cell-pos": e.anchorCellPos ?? "",
|
|
@@ -2981,7 +3644,7 @@ var Br = J({
|
|
|
2981
3644
|
}) : null;
|
|
2982
3645
|
};
|
|
2983
3646
|
}
|
|
2984
|
-
}),
|
|
3647
|
+
}), Pi = Y({
|
|
2985
3648
|
name: "MarkweaveVueCodeBlockControls",
|
|
2986
3649
|
props: {
|
|
2987
3650
|
editor: {
|
|
@@ -3010,200 +3673,234 @@ var Br = J({
|
|
|
3010
3673
|
}
|
|
3011
3674
|
},
|
|
3012
3675
|
setup(e) {
|
|
3013
|
-
let t =
|
|
3676
|
+
let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U([]), l = U(null), u = U(!1), d = U(""), f = U(-1), p = U(null), m = U(!1), h = U(null), g = U(null), _ = U(!1), v = U({
|
|
3014
3677
|
active: !1,
|
|
3015
3678
|
lastX: 0,
|
|
3016
3679
|
lastY: 0
|
|
3017
|
-
}),
|
|
3680
|
+
}), y = U(0), b = U(0), x = U(0), S = null, C = G(() => (x.value, tt(e.editor, o.value))), w = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
3018
3681
|
...e.state,
|
|
3019
3682
|
pos: e.state.pos,
|
|
3020
3683
|
active: !0
|
|
3021
|
-
} : null),
|
|
3022
|
-
|
|
3023
|
-
},
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
},
|
|
3684
|
+
} : null), T = G(() => C.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() => ot(e.editor, T.value)), k = G(() => E.value && T.value !== null && !O.value), A = G(() => !e.readOnly), j = G(() => T.value ? Je(T.value.language) : Je("text")), M = G(() => p.value?.status ?? "idle"), N = G(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), P = G(() => D.value && N.value === "preview"), F = G(() => (x.value, y.value, b.value, it(e.editor))), I = G(() => `${b.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => Qe(d.value)), ee = G(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), R = () => {
|
|
3685
|
+
S !== null && (window.clearTimeout(S), S = null);
|
|
3686
|
+
}, z = (e) => {
|
|
3687
|
+
R(), p.value = e, e && (S = window.setTimeout(() => {
|
|
3688
|
+
p.value = null, S = null;
|
|
3689
|
+
}, Ve));
|
|
3027
3690
|
}, te = () => {
|
|
3028
|
-
|
|
3691
|
+
h.value = null, g.value = null, _.value = !1, v.value = {
|
|
3029
3692
|
active: !1,
|
|
3030
3693
|
lastX: 0,
|
|
3031
3694
|
lastY: 0
|
|
3032
3695
|
}, e.editor.view.focus();
|
|
3033
|
-
},
|
|
3696
|
+
}, B = () => {
|
|
3034
3697
|
let n = t.value;
|
|
3035
3698
|
if (!n) return;
|
|
3036
|
-
if (
|
|
3037
|
-
|
|
3699
|
+
if (!nt(n) || F.value.length === 0) {
|
|
3700
|
+
c.value = [];
|
|
3038
3701
|
return;
|
|
3039
3702
|
}
|
|
3040
|
-
let r = n.getBoundingClientRect(), i =
|
|
3041
|
-
let n =
|
|
3042
|
-
return n ? [
|
|
3703
|
+
let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
|
|
3704
|
+
let n = Ze(Xe(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
3705
|
+
return n ? [Ke(t, n, r)] : [];
|
|
3043
3706
|
});
|
|
3044
|
-
|
|
3045
|
-
},
|
|
3046
|
-
if (!
|
|
3047
|
-
|
|
3707
|
+
c.value = st(c.value, i, F.value.map((e) => e.pos));
|
|
3708
|
+
}, V = () => {
|
|
3709
|
+
if (!k.value || !T.value) {
|
|
3710
|
+
s.value = null, l.value = null;
|
|
3048
3711
|
return;
|
|
3049
3712
|
}
|
|
3050
3713
|
let r = t.value;
|
|
3051
3714
|
if (!r) return;
|
|
3052
|
-
let i =
|
|
3053
|
-
if (!
|
|
3054
|
-
|
|
3715
|
+
let i = Xe(e.editor, T.value.pos, N.value), a = r.getBoundingClientRect(), o = Ze(i, a);
|
|
3716
|
+
if (!o) {
|
|
3717
|
+
s.value = s.value?.pos === T.value.pos ? s.value : null, l.value = u.value ? l.value : null;
|
|
3055
3718
|
return;
|
|
3056
3719
|
}
|
|
3057
|
-
if (
|
|
3720
|
+
if (s.value = We(T.value.pos, o, a), u.value && n.value) {
|
|
3058
3721
|
let e = n.value.getBoundingClientRect();
|
|
3059
|
-
|
|
3060
|
-
overlayRect:
|
|
3722
|
+
l.value = ze({
|
|
3723
|
+
overlayRect: a,
|
|
3061
3724
|
buttonRect: e,
|
|
3062
3725
|
windowWidth: window.innerWidth,
|
|
3063
3726
|
windowHeight: window.innerHeight
|
|
3064
3727
|
});
|
|
3065
3728
|
}
|
|
3066
|
-
},
|
|
3729
|
+
}, re = async () => {
|
|
3067
3730
|
if (e.readOnly) {
|
|
3068
|
-
if (!
|
|
3069
|
-
let e = await
|
|
3070
|
-
|
|
3731
|
+
if (!T.value) return;
|
|
3732
|
+
let e = await He(T.value.text);
|
|
3733
|
+
z(Pe(T.value, e ? "copied" : "failed"));
|
|
3071
3734
|
return;
|
|
3072
3735
|
}
|
|
3073
|
-
if (!
|
|
3074
|
-
let t = await
|
|
3075
|
-
|
|
3076
|
-
},
|
|
3736
|
+
if (!qe(e.editor, T.value)) return;
|
|
3737
|
+
let t = await Me(e.editor);
|
|
3738
|
+
z(Pe(Ne(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
3739
|
+
}, ie = (t, n) => {
|
|
3077
3740
|
if (e.readOnly) {
|
|
3078
|
-
|
|
3741
|
+
Ot(e.editor, t.pos, n) && (b.value += 1, x.value += 1);
|
|
3079
3742
|
return;
|
|
3080
3743
|
}
|
|
3081
3744
|
let r = e.state.active && e.state.pos === t.pos;
|
|
3082
|
-
|
|
3083
|
-
},
|
|
3084
|
-
if (e.readOnly || !
|
|
3085
|
-
let n = e.state.active && e.state.pos ===
|
|
3086
|
-
|
|
3087
|
-
}, ae = () => {
|
|
3088
|
-
e.readOnly || !S.value || Fe(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
3745
|
+
Re(e.editor, t.pos, n) && (e.onMermaidModeChange(n), x.value += 1, r && e.editor.view.focus());
|
|
3746
|
+
}, ae = (t) => {
|
|
3747
|
+
if (e.readOnly || !T.value) return;
|
|
3748
|
+
let n = e.state.active && e.state.pos === T.value.pos;
|
|
3749
|
+
Le(e.editor, T.value.pos, t) && (t === "mermaid" && Re(e.editor, T.value.pos, "preview") && e.onMermaidModeChange("preview"), u.value = !1, d.value = "", f.value = -1, x.value += 1, n && e.editor.view.focus());
|
|
3089
3750
|
}, oe = () => {
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3751
|
+
u.value = !u.value, u.value && a.value === null && (a.value = Ue()), f.value = u.value ? rt(L.value, T.value?.language ?? null) : -1;
|
|
3752
|
+
}, se = (e) => {
|
|
3753
|
+
let t = Qe(e);
|
|
3754
|
+
d.value = e, f.value = rt(t, e.trim() ? null : T.value?.language ?? null);
|
|
3755
|
+
}, ce = (t) => {
|
|
3756
|
+
if (!t.isComposing) {
|
|
3757
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
3758
|
+
t.preventDefault(), f.value = lt(f.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
3759
|
+
return;
|
|
3760
|
+
}
|
|
3761
|
+
if (t.key === "Enter") {
|
|
3762
|
+
let e = L.value[f.value];
|
|
3763
|
+
e && (t.preventDefault(), ae(e.language));
|
|
3764
|
+
return;
|
|
3765
|
+
}
|
|
3766
|
+
t.key === "Escape" && (t.preventDefault(), u.value = !1, f.value = -1, e.editor.view.focus());
|
|
3767
|
+
}
|
|
3768
|
+
}, le = () => {
|
|
3769
|
+
e.readOnly || !T.value || Ie(e.editor, T.value.pos, !O.value) && (y.value += 1, x.value += 1, o.value = null);
|
|
3770
|
+
}, ue = () => {
|
|
3771
|
+
if (!T.value) return;
|
|
3772
|
+
let t = at(e.editor, T.value.pos);
|
|
3773
|
+
t && ne({
|
|
3774
|
+
data: new Blob([t], { type: "image/svg+xml" }),
|
|
3775
|
+
fileName: "markweave-mermaid.svg",
|
|
3776
|
+
onSettled: () => e.editor.view.focus(),
|
|
3777
|
+
ownerDocument: document
|
|
3778
|
+
});
|
|
3779
|
+
}, de = () => {
|
|
3780
|
+
if (!T.value) return;
|
|
3781
|
+
let t = at(e.editor, T.value.pos);
|
|
3782
|
+
t && (h.value = Ge(t), g.value = null, _.value = !1, v.value = {
|
|
3099
3783
|
active: !1,
|
|
3100
3784
|
lastX: 0,
|
|
3101
3785
|
lastY: 0
|
|
3102
3786
|
});
|
|
3103
|
-
},
|
|
3104
|
-
|
|
3105
|
-
...
|
|
3106
|
-
scale:
|
|
3787
|
+
}, fe = (e) => {
|
|
3788
|
+
h.value = h.value ? {
|
|
3789
|
+
...h.value,
|
|
3790
|
+
scale: Be(h.value.scale + e)
|
|
3107
3791
|
} : null;
|
|
3108
|
-
},
|
|
3109
|
-
|
|
3792
|
+
}, pe = () => {
|
|
3793
|
+
h.value = h.value ? Ge(h.value.svg) : null, v.value = {
|
|
3110
3794
|
active: !1,
|
|
3111
3795
|
lastX: 0,
|
|
3112
3796
|
lastY: 0
|
|
3113
|
-
},
|
|
3114
|
-
},
|
|
3115
|
-
e.preventDefault(),
|
|
3116
|
-
},
|
|
3117
|
-
e.button === 0 && (e.preventDefault(),
|
|
3797
|
+
}, _.value = !1;
|
|
3798
|
+
}, me = (e) => {
|
|
3799
|
+
e.preventDefault(), fe(e.deltaY < 0 ? ct : -ct);
|
|
3800
|
+
}, he = (e) => {
|
|
3801
|
+
e.button === 0 && (e.preventDefault(), v.value = {
|
|
3118
3802
|
active: !0,
|
|
3119
3803
|
lastX: e.clientX,
|
|
3120
3804
|
lastY: e.clientY
|
|
3121
|
-
},
|
|
3122
|
-
},
|
|
3123
|
-
let t =
|
|
3805
|
+
}, _.value = !0);
|
|
3806
|
+
}, ge = (e) => {
|
|
3807
|
+
let t = v.value;
|
|
3124
3808
|
if (!t.active) return;
|
|
3125
3809
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
3126
|
-
|
|
3810
|
+
v.value = {
|
|
3127
3811
|
active: !0,
|
|
3128
3812
|
lastX: e.clientX,
|
|
3129
3813
|
lastY: e.clientY
|
|
3130
|
-
},
|
|
3131
|
-
},
|
|
3132
|
-
|
|
3814
|
+
}, h.value = ut(h.value, n, r);
|
|
3815
|
+
}, _e = () => {
|
|
3816
|
+
v.value = {
|
|
3133
3817
|
active: !1,
|
|
3134
3818
|
lastX: 0,
|
|
3135
3819
|
lastY: 0
|
|
3136
|
-
},
|
|
3820
|
+
}, _.value = !1;
|
|
3137
3821
|
};
|
|
3138
|
-
|
|
3139
|
-
e && (
|
|
3140
|
-
}),
|
|
3141
|
-
|
|
3142
|
-
}),
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3822
|
+
K(() => e.readOnly, (e) => {
|
|
3823
|
+
e && (u.value = !1, d.value = "");
|
|
3824
|
+
}), K(ee, () => {
|
|
3825
|
+
z(null), u.value = !1, d.value = "", f.value = -1, h.value = null, g.value = null, _.value = !1;
|
|
3826
|
+
}), K(u, async (e) => {
|
|
3827
|
+
if (!e) {
|
|
3828
|
+
f.value = -1;
|
|
3829
|
+
return;
|
|
3830
|
+
}
|
|
3831
|
+
await J(), V(), r.value?.focus({ preventScroll: !0 });
|
|
3832
|
+
}), K(() => [
|
|
3833
|
+
u.value,
|
|
3834
|
+
d.value,
|
|
3835
|
+
f.value
|
|
3150
3836
|
], async () => {
|
|
3151
|
-
|
|
3837
|
+
if (!u.value || f.value < 0) return;
|
|
3838
|
+
await J();
|
|
3839
|
+
let e = i.value, t = e?.querySelector(`[data-language-index="${f.value}"]`);
|
|
3840
|
+
e && t && dt(e, t);
|
|
3841
|
+
}, { flush: "post" }), K(() => [
|
|
3842
|
+
k.value,
|
|
3843
|
+
y.value,
|
|
3844
|
+
T.value?.pos ?? null,
|
|
3845
|
+
u.value,
|
|
3846
|
+
N.value
|
|
3847
|
+
], async () => {
|
|
3848
|
+
await J(), V();
|
|
3152
3849
|
}, {
|
|
3153
3850
|
flush: "post",
|
|
3154
3851
|
immediate: !0
|
|
3155
|
-
}),
|
|
3156
|
-
await
|
|
3852
|
+
}), K(I, async () => {
|
|
3853
|
+
await J(), B(), window.requestAnimationFrame(B);
|
|
3157
3854
|
}, {
|
|
3158
3855
|
flush: "post",
|
|
3159
3856
|
immediate: !0
|
|
3160
3857
|
});
|
|
3161
|
-
let
|
|
3162
|
-
return
|
|
3163
|
-
|
|
3858
|
+
let ve = null;
|
|
3859
|
+
return In(() => {
|
|
3860
|
+
J(() => {
|
|
3164
3861
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
3165
|
-
if (n.target instanceof Node && t.value?.contains(n.target) ||
|
|
3166
|
-
let r =
|
|
3167
|
-
|
|
3168
|
-
},
|
|
3169
|
-
|
|
3170
|
-
},
|
|
3862
|
+
if (n.target instanceof Node && t.value?.contains(n.target) || u.value) return;
|
|
3863
|
+
let r = et(e.editor, n.target), i = tt(e.editor, r), a = i && !ot(e.editor, i) ? i.pos : null;
|
|
3864
|
+
o.value = o.value === a ? o.value : a;
|
|
3865
|
+
}, i = () => {
|
|
3866
|
+
u.value || (o.value = null);
|
|
3867
|
+
}, a = (t) => {
|
|
3171
3868
|
if (t.key === "Escape") {
|
|
3172
|
-
if (
|
|
3869
|
+
if (h.value) {
|
|
3173
3870
|
te();
|
|
3174
3871
|
return;
|
|
3175
3872
|
}
|
|
3176
|
-
|
|
3873
|
+
u.value && (u.value = !1, f.value = -1, e.editor.view.focus());
|
|
3177
3874
|
}
|
|
3178
3875
|
}, s = (e) => {
|
|
3179
|
-
|
|
3180
|
-
},
|
|
3181
|
-
e.getMeta(
|
|
3876
|
+
u.value && (e.target instanceof Node && t.value?.contains(e.target) || (u.value = !1, f.value = -1));
|
|
3877
|
+
}, c = ({ transaction: e }) => {
|
|
3878
|
+
e.getMeta(je) && (y.value += 1), (e.docChanged || e.selectionSet || e.getMeta(je) || Tt(e)) && (x.value += 1);
|
|
3182
3879
|
};
|
|
3183
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave",
|
|
3184
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave",
|
|
3880
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", V), window.addEventListener("scroll", V, !0), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", s), e.editor.on("transaction", c), ve = () => {
|
|
3881
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", V), window.removeEventListener("scroll", V, !0), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", s), e.editor.off("transaction", c), R();
|
|
3185
3882
|
};
|
|
3186
3883
|
});
|
|
3187
|
-
}),
|
|
3188
|
-
|
|
3884
|
+
}), q(() => {
|
|
3885
|
+
ve?.(), ve = null, R();
|
|
3189
3886
|
}), () => {
|
|
3190
|
-
if (!
|
|
3191
|
-
let
|
|
3192
|
-
top: `${
|
|
3193
|
-
right: `${
|
|
3194
|
-
} : void 0,
|
|
3195
|
-
left: `${
|
|
3196
|
-
top: `${
|
|
3887
|
+
if (!k.value && F.value.length === 0 && !h.value) return null;
|
|
3888
|
+
let o = s.value ? {
|
|
3889
|
+
top: `${s.value.top}px`,
|
|
3890
|
+
right: `${s.value.right}px`
|
|
3891
|
+
} : void 0, p = l.value ? {
|
|
3892
|
+
left: `${l.value.left}px`,
|
|
3893
|
+
top: `${l.value.top}px`
|
|
3197
3894
|
} : void 0;
|
|
3198
|
-
return
|
|
3895
|
+
return H("div", {
|
|
3199
3896
|
ref: t,
|
|
3200
3897
|
class: "markweave-codeblock-overlay",
|
|
3201
3898
|
"data-testid": "markweave-codeblock-overlay",
|
|
3202
3899
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
3203
3900
|
}, [
|
|
3204
|
-
...
|
|
3205
|
-
let t =
|
|
3206
|
-
return
|
|
3901
|
+
...F.value.map((e) => {
|
|
3902
|
+
let t = c.value.find((t) => t.pos === e.pos);
|
|
3903
|
+
return H("div", {
|
|
3207
3904
|
key: e.pos,
|
|
3208
3905
|
class: "markweave-mermaid-tabs",
|
|
3209
3906
|
"data-testid": "markweave-mermaid-tabs",
|
|
@@ -3213,241 +3910,253 @@ var Br = J({
|
|
|
3213
3910
|
top: `${t.top}px`,
|
|
3214
3911
|
left: `${t.left}px`
|
|
3215
3912
|
} : void 0
|
|
3216
|
-
}, ["code", "preview"].map((t) =>
|
|
3913
|
+
}, ["code", "preview"].map((t) => H("button", {
|
|
3217
3914
|
key: t,
|
|
3218
3915
|
type: "button",
|
|
3219
3916
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
3220
3917
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
3221
3918
|
onMousedown: $,
|
|
3222
|
-
onClick: () =>
|
|
3919
|
+
onClick: () => ie(e, t)
|
|
3223
3920
|
}, t === "code" ? "Code" : "Preview")));
|
|
3224
3921
|
}),
|
|
3225
|
-
|
|
3922
|
+
k.value && T.value ? H("div", {
|
|
3226
3923
|
class: "markweave-codeblock-controls",
|
|
3227
3924
|
"data-testid": "markweave-codeblock-controls",
|
|
3228
|
-
"data-positioned":
|
|
3229
|
-
"data-collapsed":
|
|
3925
|
+
"data-positioned": s.value ? "true" : "false",
|
|
3926
|
+
"data-collapsed": O.value ? "true" : "false",
|
|
3230
3927
|
"data-read-only": e.readOnly ? "true" : "false",
|
|
3231
3928
|
"aria-label": "Code block controls",
|
|
3232
|
-
style:
|
|
3929
|
+
style: o
|
|
3233
3930
|
}, [
|
|
3234
|
-
e.readOnly ?
|
|
3931
|
+
e.readOnly ? H("span", {
|
|
3235
3932
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
3236
3933
|
"aria-label": "Code block language",
|
|
3237
3934
|
"data-testid": "markweave-codeblock-language"
|
|
3238
|
-
}, [
|
|
3935
|
+
}, [H("span", null, j.value)]) : H("button", {
|
|
3239
3936
|
ref: n,
|
|
3240
3937
|
type: "button",
|
|
3241
3938
|
class: "markweave-codeblock-language-button",
|
|
3242
3939
|
"aria-label": "Code block language",
|
|
3243
|
-
"aria-expanded":
|
|
3940
|
+
"aria-expanded": u.value ? "true" : "false",
|
|
3244
3941
|
"aria-haspopup": "listbox",
|
|
3245
3942
|
"data-testid": "markweave-codeblock-language",
|
|
3246
3943
|
onMousedown: $,
|
|
3247
|
-
onClick:
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
}, [B("span", null, D.value), Q("chevron")]),
|
|
3251
|
-
ee.value ? B("button", {
|
|
3944
|
+
onClick: oe
|
|
3945
|
+
}, [H("span", null, j.value), Q("chevron")]),
|
|
3946
|
+
A.value ? H("button", {
|
|
3252
3947
|
type: "button",
|
|
3253
3948
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
3254
|
-
"aria-label":
|
|
3255
|
-
title:
|
|
3949
|
+
"aria-label": O.value ? "Expand code block" : "Collapse code block",
|
|
3950
|
+
title: O.value ? "Expand code block" : "Collapse code block",
|
|
3256
3951
|
"data-testid": "markweave-codeblock-collapse",
|
|
3257
|
-
"data-collapsed":
|
|
3952
|
+
"data-collapsed": O.value ? "true" : "false",
|
|
3258
3953
|
onMousedown: $,
|
|
3259
|
-
onClick:
|
|
3954
|
+
onClick: le
|
|
3260
3955
|
}, [Q("chevron")]) : null,
|
|
3261
|
-
|
|
3956
|
+
H("span", { class: "markweave-codeblock-copy-wrap" }, [H("button", {
|
|
3262
3957
|
type: "button",
|
|
3263
3958
|
class: "markweave-codeblock-icon-button",
|
|
3264
3959
|
"aria-label": "Copy to clipboard",
|
|
3265
3960
|
"data-testid": "markweave-codeblock-copy",
|
|
3266
|
-
"data-copy-state":
|
|
3961
|
+
"data-copy-state": M.value,
|
|
3267
3962
|
onMousedown: $,
|
|
3268
3963
|
onMouseenter: () => {
|
|
3269
|
-
|
|
3964
|
+
m.value = !0;
|
|
3270
3965
|
},
|
|
3271
3966
|
onMouseleave: () => {
|
|
3272
|
-
|
|
3967
|
+
m.value = !1;
|
|
3273
3968
|
},
|
|
3274
3969
|
onFocus: () => {
|
|
3275
|
-
|
|
3970
|
+
m.value = !0;
|
|
3276
3971
|
},
|
|
3277
3972
|
onBlur: () => {
|
|
3278
|
-
|
|
3973
|
+
m.value = !1;
|
|
3279
3974
|
},
|
|
3280
3975
|
onClick: () => {
|
|
3281
|
-
|
|
3976
|
+
re();
|
|
3282
3977
|
}
|
|
3283
|
-
}, [Q(
|
|
3978
|
+
}, [Q(M.value === "copied" ? "check" : "clipboard")]), m.value ? H("span", {
|
|
3284
3979
|
class: "markweave-codeblock-tooltip",
|
|
3285
3980
|
role: "tooltip",
|
|
3286
3981
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
3287
3982
|
}, "Copy to clipboard") : null]),
|
|
3288
|
-
|
|
3983
|
+
D.value && N.value === "preview" ? H("div", {
|
|
3289
3984
|
class: "markweave-mermaid-preview-actions",
|
|
3290
3985
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
3291
|
-
}, [
|
|
3986
|
+
}, [H("button", {
|
|
3292
3987
|
type: "button",
|
|
3293
3988
|
class: "markweave-codeblock-icon-button",
|
|
3294
3989
|
"aria-label": "Fullscreen Mermaid preview",
|
|
3295
3990
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3296
|
-
disabled: !
|
|
3991
|
+
disabled: !P.value,
|
|
3297
3992
|
onMousedown: $,
|
|
3298
|
-
onClick:
|
|
3299
|
-
}, [Q("expand")]),
|
|
3993
|
+
onClick: de
|
|
3994
|
+
}, [Q("expand")]), H("button", {
|
|
3300
3995
|
type: "button",
|
|
3301
3996
|
class: "markweave-codeblock-icon-button",
|
|
3302
3997
|
"aria-label": "Download Mermaid SVG",
|
|
3303
3998
|
"data-testid": "markweave-mermaid-download",
|
|
3304
|
-
disabled: !
|
|
3999
|
+
disabled: !P.value,
|
|
3305
4000
|
onMousedown: $,
|
|
3306
|
-
onClick:
|
|
4001
|
+
onClick: ue
|
|
3307
4002
|
}, [Q("download")])]) : null
|
|
3308
4003
|
]) : null,
|
|
3309
|
-
|
|
4004
|
+
A.value && k.value && u.value && T.value ? H("div", {
|
|
3310
4005
|
class: "markweave-codeblock-language-menu",
|
|
3311
|
-
role: "listbox",
|
|
3312
|
-
"aria-label": "Code block languages",
|
|
3313
4006
|
"data-testid": "markweave-codeblock-language-menu",
|
|
3314
|
-
"data-positioned":
|
|
3315
|
-
style:
|
|
3316
|
-
}, [
|
|
4007
|
+
"data-positioned": l.value ? "true" : "false",
|
|
4008
|
+
style: p
|
|
4009
|
+
}, [H("label", { class: "markweave-codeblock-language-search" }, [H("input", {
|
|
3317
4010
|
ref: r,
|
|
3318
|
-
|
|
4011
|
+
role: "combobox",
|
|
4012
|
+
"aria-autocomplete": "list",
|
|
4013
|
+
"aria-controls": a.value ?? void 0,
|
|
4014
|
+
"aria-expanded": "true",
|
|
4015
|
+
"aria-activedescendant": a.value && L.value[f.value] ? $e(a.value, L.value[f.value].language) : void 0,
|
|
4016
|
+
"aria-label": "Search code block languages",
|
|
4017
|
+
value: d.value,
|
|
3319
4018
|
placeholder: "Search...",
|
|
3320
4019
|
"data-testid": "markweave-codeblock-language-search",
|
|
3321
4020
|
onInput: (e) => {
|
|
3322
|
-
|
|
4021
|
+
se(e.target.value);
|
|
3323
4022
|
},
|
|
3324
|
-
onKeydown:
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
4023
|
+
onKeydown: ce
|
|
4024
|
+
}), Q("search")]), H("div", {
|
|
4025
|
+
ref: i,
|
|
4026
|
+
id: a.value ?? void 0,
|
|
4027
|
+
class: "markweave-codeblock-language-list",
|
|
4028
|
+
role: "listbox",
|
|
4029
|
+
"aria-label": "Code block languages"
|
|
4030
|
+
}, L.value.map((e, t) => {
|
|
4031
|
+
let n = T.value?.language === e.language, r = t === f.value;
|
|
4032
|
+
return H("button", {
|
|
3330
4033
|
key: e.language,
|
|
4034
|
+
id: a.value ? $e(a.value, e.language) : void 0,
|
|
3331
4035
|
type: "button",
|
|
3332
4036
|
role: "option",
|
|
3333
|
-
"aria-selected":
|
|
4037
|
+
"aria-selected": n ? "true" : "false",
|
|
3334
4038
|
"data-testid": `markweave-codeblock-language-option-${e.language}`,
|
|
3335
|
-
"data-active":
|
|
4039
|
+
"data-active": n ? "true" : "false",
|
|
4040
|
+
"data-highlighted": r ? "true" : "false",
|
|
4041
|
+
"data-language-index": t,
|
|
3336
4042
|
onMousedown: $,
|
|
3337
|
-
|
|
3338
|
-
|
|
4043
|
+
onMouseenter: () => {
|
|
4044
|
+
f.value = t;
|
|
4045
|
+
},
|
|
4046
|
+
onClick: () => ae(e.language)
|
|
4047
|
+
}, [H("span", null, e.label), n ? Q("check") : null]);
|
|
3339
4048
|
}))]) : null,
|
|
3340
|
-
|
|
4049
|
+
h.value ? H("div", {
|
|
3341
4050
|
class: "markweave-mermaid-fullscreen-layer",
|
|
3342
4051
|
role: "dialog",
|
|
3343
4052
|
"aria-modal": "true",
|
|
3344
4053
|
"aria-label": "Mermaid preview",
|
|
3345
4054
|
"data-testid": "markweave-mermaid-fullscreen-layer"
|
|
3346
4055
|
}, [
|
|
3347
|
-
|
|
4056
|
+
H("div", {
|
|
3348
4057
|
class: "markweave-mermaid-fullscreen-toolbar",
|
|
3349
4058
|
"data-testid": "markweave-mermaid-fullscreen-toolbar"
|
|
3350
4059
|
}, [
|
|
3351
|
-
|
|
4060
|
+
H("button", {
|
|
3352
4061
|
type: "button",
|
|
3353
4062
|
class: "markweave-mermaid-fullscreen-control",
|
|
3354
4063
|
"aria-label": "Zoom out",
|
|
3355
4064
|
"data-testid": "markweave-mermaid-fullscreen-zoom-out",
|
|
3356
4065
|
onMouseenter: () => {
|
|
3357
|
-
|
|
4066
|
+
g.value = "zoom-out";
|
|
3358
4067
|
},
|
|
3359
4068
|
onMouseleave: () => {
|
|
3360
|
-
|
|
4069
|
+
g.value = null;
|
|
3361
4070
|
},
|
|
3362
4071
|
onFocus: () => {
|
|
3363
|
-
|
|
4072
|
+
g.value = "zoom-out";
|
|
3364
4073
|
},
|
|
3365
4074
|
onBlur: () => {
|
|
3366
|
-
|
|
4075
|
+
g.value = null;
|
|
3367
4076
|
},
|
|
3368
|
-
onClick: () =>
|
|
4077
|
+
onClick: () => fe(-ct)
|
|
3369
4078
|
}, [Q("zoomOut")]),
|
|
3370
|
-
|
|
4079
|
+
H("span", {
|
|
3371
4080
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3372
4081
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3373
|
-
},
|
|
3374
|
-
|
|
4082
|
+
}, Ye(h.value.scale)),
|
|
4083
|
+
H("button", {
|
|
3375
4084
|
type: "button",
|
|
3376
4085
|
class: "markweave-mermaid-fullscreen-control",
|
|
3377
4086
|
"aria-label": "Zoom in",
|
|
3378
4087
|
"data-testid": "markweave-mermaid-fullscreen-zoom-in",
|
|
3379
4088
|
onMouseenter: () => {
|
|
3380
|
-
|
|
4089
|
+
g.value = "zoom-in";
|
|
3381
4090
|
},
|
|
3382
4091
|
onMouseleave: () => {
|
|
3383
|
-
|
|
4092
|
+
g.value = null;
|
|
3384
4093
|
},
|
|
3385
4094
|
onFocus: () => {
|
|
3386
|
-
|
|
4095
|
+
g.value = "zoom-in";
|
|
3387
4096
|
},
|
|
3388
4097
|
onBlur: () => {
|
|
3389
|
-
|
|
4098
|
+
g.value = null;
|
|
3390
4099
|
},
|
|
3391
|
-
onClick: () =>
|
|
4100
|
+
onClick: () => fe(ct)
|
|
3392
4101
|
}, [Q("zoomIn")]),
|
|
3393
|
-
|
|
4102
|
+
H("button", {
|
|
3394
4103
|
type: "button",
|
|
3395
4104
|
class: "markweave-mermaid-fullscreen-control",
|
|
3396
4105
|
"aria-label": "Reset zoom",
|
|
3397
4106
|
"data-testid": "markweave-mermaid-fullscreen-reset",
|
|
3398
4107
|
onMouseenter: () => {
|
|
3399
|
-
|
|
4108
|
+
g.value = "reset";
|
|
3400
4109
|
},
|
|
3401
4110
|
onMouseleave: () => {
|
|
3402
|
-
|
|
4111
|
+
g.value = null;
|
|
3403
4112
|
},
|
|
3404
4113
|
onFocus: () => {
|
|
3405
|
-
|
|
4114
|
+
g.value = "reset";
|
|
3406
4115
|
},
|
|
3407
4116
|
onBlur: () => {
|
|
3408
|
-
|
|
4117
|
+
g.value = null;
|
|
3409
4118
|
},
|
|
3410
|
-
onClick:
|
|
4119
|
+
onClick: pe
|
|
3411
4120
|
}, [Q("reset")]),
|
|
3412
|
-
|
|
4121
|
+
g.value ? H("span", {
|
|
3413
4122
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
3414
4123
|
role: "tooltip",
|
|
3415
4124
|
"data-testid": "markweave-mermaid-fullscreen-tooltip"
|
|
3416
|
-
},
|
|
4125
|
+
}, g.value === "zoom-out" ? "Zoom out" : g.value === "zoom-in" ? "Zoom in" : "Reset") : null
|
|
3417
4126
|
]),
|
|
3418
|
-
|
|
4127
|
+
H("button", {
|
|
3419
4128
|
type: "button",
|
|
3420
4129
|
class: "markweave-mermaid-fullscreen-close",
|
|
3421
4130
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3422
4131
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3423
4132
|
onClick: te
|
|
3424
4133
|
}, [Q("close")]),
|
|
3425
|
-
|
|
4134
|
+
H("div", {
|
|
3426
4135
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
3427
4136
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
3428
|
-
"data-dragging":
|
|
3429
|
-
onWheel:
|
|
3430
|
-
onMousedown:
|
|
3431
|
-
onMousemove:
|
|
3432
|
-
onMouseup:
|
|
3433
|
-
onMouseleave:
|
|
3434
|
-
}, [
|
|
4137
|
+
"data-dragging": _.value ? "true" : "false",
|
|
4138
|
+
onWheel: me,
|
|
4139
|
+
onMousedown: he,
|
|
4140
|
+
onMousemove: ge,
|
|
4141
|
+
onMouseup: _e,
|
|
4142
|
+
onMouseleave: _e
|
|
4143
|
+
}, [H("div", {
|
|
3435
4144
|
class: "markweave-mermaid-fullscreen-content",
|
|
3436
4145
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
3437
|
-
"data-scale-percent": Math.round(
|
|
3438
|
-
"data-translate": `${Math.round(
|
|
4146
|
+
"data-scale-percent": Math.round(h.value.scale * 100),
|
|
4147
|
+
"data-translate": `${Math.round(h.value.translateX)},${Math.round(h.value.translateY)}`,
|
|
3439
4148
|
style: {
|
|
3440
|
-
width: `${
|
|
3441
|
-
height: `${
|
|
3442
|
-
transform: `translate(${
|
|
4149
|
+
width: `${h.value.width}px`,
|
|
4150
|
+
height: `${h.value.height}px`,
|
|
4151
|
+
transform: `translate(${h.value.translateX}px, ${h.value.translateY}px) scale(${h.value.scale})`
|
|
3443
4152
|
},
|
|
3444
|
-
innerHTML:
|
|
4153
|
+
innerHTML: h.value.svg
|
|
3445
4154
|
})])
|
|
3446
4155
|
]) : null
|
|
3447
4156
|
]);
|
|
3448
4157
|
};
|
|
3449
4158
|
}
|
|
3450
|
-
}),
|
|
4159
|
+
}), Fi = Y({
|
|
3451
4160
|
name: "MarkweaveVueInnerToc",
|
|
3452
4161
|
props: {
|
|
3453
4162
|
editor: {
|
|
@@ -3472,22 +4181,22 @@ var Br = J({
|
|
|
3472
4181
|
}
|
|
3473
4182
|
},
|
|
3474
4183
|
setup(e) {
|
|
3475
|
-
let t =
|
|
3476
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
4184
|
+
let t = U(null), n, r = () => {
|
|
4185
|
+
n?.(), n = e.placement === "container" && t.value ? ke(t.value) : void 0;
|
|
3477
4186
|
};
|
|
3478
|
-
return
|
|
4187
|
+
return In(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
|
|
3479
4188
|
ref: t,
|
|
3480
4189
|
class: "markweave-inner-toc",
|
|
3481
4190
|
"data-testid": "markweave-inner-toc",
|
|
3482
4191
|
"aria-label": e.messages.toc.ariaLabel
|
|
3483
|
-
}, [
|
|
4192
|
+
}, [H("div", {
|
|
3484
4193
|
class: "markweave-inner-toc-rail",
|
|
3485
4194
|
"aria-hidden": "true"
|
|
3486
|
-
}, e.state.items.map((e) =>
|
|
4195
|
+
}, e.state.items.map((e) => H("span", {
|
|
3487
4196
|
key: e.id,
|
|
3488
4197
|
"data-level": e.level,
|
|
3489
4198
|
"data-active": e.active ? "true" : "false"
|
|
3490
|
-
}))),
|
|
4199
|
+
}))), H("div", { class: "markweave-inner-toc-panel" }, [H("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => H("button", {
|
|
3491
4200
|
key: t.id,
|
|
3492
4201
|
type: "button",
|
|
3493
4202
|
class: "markweave-inner-toc-item",
|
|
@@ -3496,32 +4205,33 @@ var Br = J({
|
|
|
3496
4205
|
"aria-current": t.active ? "location" : void 0,
|
|
3497
4206
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3498
4207
|
title: t.text,
|
|
3499
|
-
onClick: () =>
|
|
4208
|
+
onClick: () => Ae(e.editor, t, {
|
|
3500
4209
|
behavior: "smooth",
|
|
3501
4210
|
focus: e.editable
|
|
3502
4211
|
})
|
|
3503
4212
|
}, t.text)))])]) : null;
|
|
3504
4213
|
}
|
|
3505
4214
|
});
|
|
3506
|
-
function
|
|
3507
|
-
let i = r(e.lang), o = n(i), s = t(i), c =
|
|
3508
|
-
function
|
|
3509
|
-
|
|
4215
|
+
function Ii(e = {}) {
|
|
4216
|
+
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Se(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(zt), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(Kt), x = U(null), S = U(!1), C = W(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
|
|
4217
|
+
function O() {
|
|
4218
|
+
D !== null && (window.clearTimeout(D), D = null), d.value += 1;
|
|
3510
4219
|
}
|
|
3511
|
-
function
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
},
|
|
4220
|
+
function k() {
|
|
4221
|
+
D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
|
|
4222
|
+
D = null, d.value += 1;
|
|
4223
|
+
}, ye);
|
|
3515
4224
|
}
|
|
3516
|
-
let
|
|
3517
|
-
|
|
3518
|
-
extensions:
|
|
4225
|
+
let A = e.onSlashCommandUpload, j = W(null);
|
|
4226
|
+
j.value = new a({
|
|
4227
|
+
extensions: hi({
|
|
3519
4228
|
lang: i,
|
|
3520
4229
|
linkCardResolver: e.linkCardResolver,
|
|
3521
|
-
onImageUpload: (e) =>
|
|
3522
|
-
onVideoUpload: (e) =>
|
|
4230
|
+
onImageUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4231
|
+
onVideoUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4232
|
+
resolveMediaSource: e.resolveMediaSource
|
|
3523
4233
|
}),
|
|
3524
|
-
content:
|
|
4234
|
+
content: T,
|
|
3525
4235
|
contentType: re(w),
|
|
3526
4236
|
editable: u.value,
|
|
3527
4237
|
autofocus: e.autofocus,
|
|
@@ -3529,41 +4239,42 @@ function qr(e = {}) {
|
|
|
3529
4239
|
attributes: {
|
|
3530
4240
|
class: "markweave-editor-surface",
|
|
3531
4241
|
"data-testid": "markweave-editor-surface",
|
|
4242
|
+
"data-markweave-large-document": E ? "true" : "false",
|
|
3532
4243
|
autocapitalize: "off",
|
|
3533
4244
|
autocorrect: "off",
|
|
3534
4245
|
spellcheck: "false",
|
|
3535
4246
|
translate: "no"
|
|
3536
4247
|
},
|
|
3537
4248
|
handleClick: (e, t, n) => {
|
|
3538
|
-
if (!u.value) return
|
|
3539
|
-
let r =
|
|
3540
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
4249
|
+
if (!u.value) return me(n);
|
|
4250
|
+
let r = yt(e, n);
|
|
4251
|
+
return r ? (n.preventDefault(), n.stopPropagation(), N(), Ct(e, r, !0), wt(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
3541
4252
|
},
|
|
3542
4253
|
handleDOMEvents: {
|
|
3543
|
-
compositionstart: () => u.value ? (h.value =
|
|
3544
|
-
compositionend: (e) => (u.value && window.setTimeout(() =>
|
|
4254
|
+
compositionstart: () => u.value ? (h.value = Bt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
4255
|
+
compositionend: (e) => (u.value && window.setTimeout(() => P(e), 0), !1),
|
|
3545
4256
|
click: (e, t) => {
|
|
3546
|
-
if (!u.value) return
|
|
3547
|
-
let n =
|
|
3548
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
4257
|
+
if (!u.value) return me(t);
|
|
4258
|
+
let n = yt(e, t);
|
|
4259
|
+
return n ? (t.preventDefault(), t.stopPropagation(), N(), Ct(e, n, !0), wt(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
3549
4260
|
}
|
|
3550
4261
|
}
|
|
3551
4262
|
},
|
|
3552
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
4263
|
+
onSelectionUpdate: ({ editor: e }) => I(e),
|
|
3553
4264
|
onCreate: ({ editor: t }) => {
|
|
3554
4265
|
p(t, {
|
|
3555
4266
|
mode: c.value,
|
|
3556
4267
|
editable: u.value
|
|
3557
|
-
}),
|
|
4268
|
+
}), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Ut(t), L(t), I(t), O();
|
|
3558
4269
|
},
|
|
3559
4270
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3560
|
-
if (
|
|
3561
|
-
let t =
|
|
4271
|
+
if (L(e), (t.docChanged || Tt(t)) && k(), t.docChanged && y.value) {
|
|
4272
|
+
let t = vt(e, y.value.pos);
|
|
3562
4273
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
3563
4274
|
}
|
|
3564
4275
|
},
|
|
3565
4276
|
onUpdate: ({ editor: t }) => {
|
|
3566
|
-
|
|
4277
|
+
I(t), u.value && F(t), S.value || e.onUpdate?.(V(t, { onContentRead: (n, r) => {
|
|
3567
4278
|
let i = oe(e.contentFormat);
|
|
3568
4279
|
e.content !== void 0 && n === i && (C.value = {
|
|
3569
4280
|
content: r,
|
|
@@ -3573,173 +4284,190 @@ function qr(e = {}) {
|
|
|
3573
4284
|
} }));
|
|
3574
4285
|
}
|
|
3575
4286
|
});
|
|
3576
|
-
let
|
|
3577
|
-
function
|
|
3578
|
-
g.value = null, _.value = null, h.value =
|
|
4287
|
+
let M = G(() => j.value ?? null);
|
|
4288
|
+
function N() {
|
|
4289
|
+
g.value = null, _.value = null, h.value = zt;
|
|
3579
4290
|
}
|
|
3580
|
-
function
|
|
3581
|
-
let t =
|
|
4291
|
+
function P(e) {
|
|
4292
|
+
let t = Lt(e.state);
|
|
3582
4293
|
if (!t) {
|
|
3583
|
-
h.value = h.value.name === "idle" ? h.value :
|
|
4294
|
+
h.value = h.value.name === "idle" ? h.value : zt, g.value = null, _.value = null;
|
|
3584
4295
|
return;
|
|
3585
4296
|
}
|
|
3586
4297
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3587
|
-
|
|
4298
|
+
if (!Rt(r, { frameRect: i })) {
|
|
4299
|
+
N();
|
|
4300
|
+
return;
|
|
4301
|
+
}
|
|
4302
|
+
let a = It(n, {
|
|
3588
4303
|
frameRect: i,
|
|
3589
4304
|
triggerRect: r
|
|
3590
|
-
})
|
|
4305
|
+
});
|
|
4306
|
+
Nt(g.value, a) || (g.value = a), h.value = Ft(h.value, t);
|
|
3591
4307
|
}
|
|
3592
|
-
function
|
|
3593
|
-
|
|
4308
|
+
function F(e) {
|
|
4309
|
+
P(e.view);
|
|
3594
4310
|
}
|
|
3595
|
-
function
|
|
3596
|
-
let t =
|
|
3597
|
-
|
|
3598
|
-
let n =
|
|
3599
|
-
n && (
|
|
3600
|
-
let r =
|
|
4311
|
+
function I(e) {
|
|
4312
|
+
let t = ve(e);
|
|
4313
|
+
ge(m.value, t) || (m.value = t);
|
|
4314
|
+
let n = bt(e);
|
|
4315
|
+
n && (St(e, n, !0), y.value = n);
|
|
4316
|
+
let r = Ne(e);
|
|
3601
4317
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
3602
4318
|
}
|
|
3603
|
-
function
|
|
3604
|
-
b.value =
|
|
4319
|
+
function L(e) {
|
|
4320
|
+
b.value = vi(e);
|
|
3605
4321
|
}
|
|
3606
|
-
let
|
|
4322
|
+
let R = G(() => M.value ? Ne(M.value) : _i), z = G(() => M.value ? Wt(M.value.state) : gi), ne = G(() => m.value?.currentNode === "codeBlock"), se = G(() => ne.value && R.value.language === "mermaid"), ce = G(() => M.value ? kt({
|
|
3607
4323
|
active: se.value,
|
|
3608
4324
|
mode: v.value,
|
|
3609
|
-
source:
|
|
3610
|
-
}) :
|
|
4325
|
+
source: R.value.text
|
|
4326
|
+
}) : kt({
|
|
3611
4327
|
active: !1,
|
|
3612
4328
|
mode: "code",
|
|
3613
4329
|
source: ""
|
|
3614
|
-
})), le =
|
|
4330
|
+
})), le = G(() => M.value && e.onRuntimeStateChange ? Ht(M.value.state) : null), ue = G(() => M.value ? Ee(M.value.state) : we.items), de = G(() => De(ue.value, x.value)), fe = G(() => Ce(ue.value, de.value)), pe = G(() => At(h.value.query, s)), _e = G(() => he({
|
|
3615
4331
|
revision: d.value,
|
|
3616
4332
|
mode: c.value,
|
|
3617
4333
|
editable: u.value,
|
|
3618
|
-
toc:
|
|
4334
|
+
toc: fe.value,
|
|
3619
4335
|
selection: m.value,
|
|
3620
4336
|
slash: h.value,
|
|
3621
|
-
table:
|
|
4337
|
+
table: z.value,
|
|
3622
4338
|
tableInteraction: b.value,
|
|
3623
|
-
codeBlock:
|
|
4339
|
+
codeBlock: R.value,
|
|
3624
4340
|
mermaid: ce.value,
|
|
3625
4341
|
tableDebugSnapshot: le.value
|
|
3626
|
-
})),
|
|
3627
|
-
closeSlashMenu:
|
|
3628
|
-
focusFirstTableBodyCell: () =>
|
|
4342
|
+
})), be = {
|
|
4343
|
+
closeSlashMenu: N,
|
|
4344
|
+
focusFirstTableBodyCell: () => M.value ? Ut(M.value) : !1,
|
|
3629
4345
|
setContent: (e, t = {}) => {
|
|
3630
|
-
if (!
|
|
4346
|
+
if (!M.value) return !1;
|
|
3631
4347
|
let n = oe(t.format);
|
|
3632
|
-
return
|
|
4348
|
+
return M.value.commands.setContent(e, {
|
|
3633
4349
|
contentType: re(n),
|
|
3634
4350
|
emitUpdate: t.emitUpdate ?? !1
|
|
3635
|
-
}), t.focusFirstTableBodyCell &&
|
|
4351
|
+
}), t.focusFirstTableBodyCell && Ut(M.value), I(M.value), u.value && F(M.value), L(M.value), O(), !0;
|
|
3636
4352
|
}
|
|
3637
4353
|
};
|
|
3638
|
-
function
|
|
3639
|
-
if (!(!
|
|
4354
|
+
function xe(e, t) {
|
|
4355
|
+
if (!(!M.value || !u.value || !jt(e))) {
|
|
3640
4356
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3641
4357
|
_.value = e;
|
|
3642
4358
|
return;
|
|
3643
4359
|
}
|
|
3644
|
-
|
|
4360
|
+
Pt(M.value, h.value, e, t), h.value = Bt(h.value, { type: "execute" }), N();
|
|
3645
4361
|
}
|
|
3646
4362
|
}
|
|
3647
|
-
function
|
|
3648
|
-
if (!
|
|
3649
|
-
let t =
|
|
4363
|
+
function Oe(e) {
|
|
4364
|
+
if (!M.value || _.value || !u.value) return;
|
|
4365
|
+
let t = Mt(h.value, pe.value, e.key, { isComposing: e.isComposing || te(M.value.state) });
|
|
3650
4366
|
if (t.type !== "ignore") {
|
|
3651
4367
|
if (e.preventDefault(), t.type === "close") {
|
|
3652
|
-
h.value =
|
|
4368
|
+
h.value = Bt(h.value, { type: "escape" }), N();
|
|
3653
4369
|
return;
|
|
3654
4370
|
}
|
|
3655
4371
|
if (t.type === "move-active") {
|
|
3656
|
-
h.value =
|
|
4372
|
+
h.value = Bt(h.value, {
|
|
3657
4373
|
type: "move-active",
|
|
3658
4374
|
delta: t.delta,
|
|
3659
4375
|
optionCount: t.optionCount
|
|
3660
4376
|
});
|
|
3661
4377
|
return;
|
|
3662
4378
|
}
|
|
3663
|
-
|
|
4379
|
+
xe(t.command);
|
|
3664
4380
|
}
|
|
3665
4381
|
}
|
|
3666
|
-
|
|
3667
|
-
c.value = f(e.mode),
|
|
4382
|
+
K(() => [e.mode, e.editable], () => {
|
|
4383
|
+
c.value = f(e.mode), M.value && (M.value.setEditable(u.value), p(M.value, {
|
|
3668
4384
|
mode: c.value,
|
|
3669
4385
|
editable: u.value
|
|
3670
|
-
}),
|
|
3671
|
-
}, { immediate: !0 }),
|
|
3672
|
-
|
|
3673
|
-
}, { immediate: !0 }),
|
|
4386
|
+
}), Dt(M.value, u.value ? "live" : "view"), O(), u.value || N());
|
|
4387
|
+
}, { immediate: !0 }), K(() => e.theme, () => {
|
|
4388
|
+
M.value && Et(M.value, l.value);
|
|
4389
|
+
}, { immediate: !0 }), K(() => e.content, (t) => {
|
|
3674
4390
|
let n = oe(e.contentFormat);
|
|
3675
|
-
if (!(!
|
|
3676
|
-
if (ae(
|
|
4391
|
+
if (!(!M.value || t === void 0)) {
|
|
4392
|
+
if (ae(M.value, C.value, t, n)) {
|
|
3677
4393
|
C.value = null;
|
|
3678
4394
|
return;
|
|
3679
4395
|
}
|
|
3680
|
-
C.value = null, !ie(
|
|
4396
|
+
C.value = null, !ie(M.value, t, n) && (S.value = !0, M.value.commands.setContent(t, {
|
|
3681
4397
|
contentType: re(n),
|
|
3682
4398
|
emitUpdate: !1
|
|
3683
|
-
}), S.value = !1,
|
|
4399
|
+
}), S.value = !1, I(M.value), u.value && F(M.value), L(M.value), O());
|
|
3684
4400
|
}
|
|
3685
|
-
}),
|
|
3686
|
-
let t =
|
|
4401
|
+
}), K(_e, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(fe, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ue, (e) => {
|
|
4402
|
+
let t = De(e, x.value);
|
|
3687
4403
|
x.value !== t && (x.value = t);
|
|
3688
4404
|
});
|
|
3689
|
-
let
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
4405
|
+
let ke = B(() => {
|
|
4406
|
+
M.value && g.value && P(M.value.view);
|
|
4407
|
+
}), Ae = () => {
|
|
4408
|
+
g.value && ke.schedule();
|
|
4409
|
+
};
|
|
4410
|
+
K(g, (e) => {
|
|
4411
|
+
e ? Ae() : ke.cancel();
|
|
4412
|
+
}), In(() => {
|
|
4413
|
+
window.addEventListener("resize", Ae), window.addEventListener("scroll", Ae, !0);
|
|
4414
|
+
}), q(() => {
|
|
4415
|
+
ke.cancel(), window.removeEventListener("resize", Ae), window.removeEventListener("scroll", Ae, !0);
|
|
4416
|
+
});
|
|
4417
|
+
let je = null;
|
|
4418
|
+
return q(() => {
|
|
4419
|
+
D !== null && window.clearTimeout(D);
|
|
4420
|
+
}), In(() => {
|
|
3693
4421
|
let e = () => {
|
|
3694
|
-
if (!
|
|
4422
|
+
if (!M.value || !ue.value.length) {
|
|
3695
4423
|
x.value = null;
|
|
3696
4424
|
return;
|
|
3697
4425
|
}
|
|
3698
4426
|
let e = null;
|
|
3699
4427
|
try {
|
|
3700
|
-
e =
|
|
4428
|
+
e = Te(M.value, ue.value);
|
|
3701
4429
|
} catch {
|
|
3702
4430
|
return;
|
|
3703
4431
|
}
|
|
3704
4432
|
x.value !== e && (x.value = e);
|
|
3705
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3706
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
4433
|
+
}, t = () => window.requestAnimationFrame(e), n = yi(M.value?.view.dom ?? null);
|
|
4434
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), je = () => {
|
|
3707
4435
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3708
4436
|
};
|
|
3709
|
-
}),
|
|
3710
|
-
|
|
3711
|
-
let e =
|
|
3712
|
-
|
|
4437
|
+
}), q(() => {
|
|
4438
|
+
je?.();
|
|
4439
|
+
let e = j.value;
|
|
4440
|
+
j.value = null, J(() => e?.destroy());
|
|
3713
4441
|
}), {
|
|
3714
|
-
editor:
|
|
3715
|
-
runtimeSnapshot:
|
|
3716
|
-
actions:
|
|
4442
|
+
editor: M,
|
|
4443
|
+
runtimeSnapshot: _e,
|
|
4444
|
+
actions: be,
|
|
3717
4445
|
__render: {
|
|
3718
4446
|
messages: o,
|
|
3719
4447
|
effectiveEditable: u,
|
|
3720
|
-
tableFocusState:
|
|
4448
|
+
tableFocusState: z,
|
|
3721
4449
|
tableInteractionState: b,
|
|
3722
|
-
codeBlockState:
|
|
3723
|
-
isCodeBlockActive:
|
|
4450
|
+
codeBlockState: R,
|
|
4451
|
+
isCodeBlockActive: ne,
|
|
3724
4452
|
mermaidMode: v,
|
|
3725
4453
|
mathTarget: y,
|
|
3726
4454
|
setMermaidMode: (e) => {
|
|
3727
4455
|
v.value = e;
|
|
3728
4456
|
},
|
|
3729
|
-
tocState:
|
|
3730
|
-
filteredSlashCommands:
|
|
4457
|
+
tocState: fe,
|
|
4458
|
+
filteredSlashCommands: pe,
|
|
3731
4459
|
slashState: h,
|
|
3732
4460
|
slashMenuPosition: g,
|
|
3733
4461
|
slashInputCommand: _,
|
|
3734
|
-
runSlashCommand:
|
|
3735
|
-
handleEditorKeyDown:
|
|
4462
|
+
runSlashCommand: xe,
|
|
4463
|
+
handleEditorKeyDown: Oe,
|
|
3736
4464
|
setSlashInputCommand: (e) => {
|
|
3737
4465
|
_.value = e;
|
|
3738
4466
|
}
|
|
3739
4467
|
}
|
|
3740
4468
|
};
|
|
3741
4469
|
}
|
|
3742
|
-
var
|
|
4470
|
+
var Li = Y({
|
|
3743
4471
|
name: "MarkweaveEditor",
|
|
3744
4472
|
props: {
|
|
3745
4473
|
defaultContent: {
|
|
@@ -3802,6 +4530,10 @@ var Jr = J({
|
|
|
3802
4530
|
type: Function,
|
|
3803
4531
|
default: void 0
|
|
3804
4532
|
},
|
|
4533
|
+
resolveMediaSource: {
|
|
4534
|
+
type: Function,
|
|
4535
|
+
default: void 0
|
|
4536
|
+
},
|
|
3805
4537
|
className: {
|
|
3806
4538
|
type: String,
|
|
3807
4539
|
default: void 0
|
|
@@ -3844,29 +4576,29 @@ var Jr = J({
|
|
|
3844
4576
|
}
|
|
3845
4577
|
},
|
|
3846
4578
|
setup(e) {
|
|
3847
|
-
let t =
|
|
4579
|
+
let t = Ii(e);
|
|
3848
4580
|
return () => {
|
|
3849
4581
|
let n = t.editor.value;
|
|
3850
4582
|
if (!n) return null;
|
|
3851
|
-
let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a =
|
|
3852
|
-
return
|
|
4583
|
+
let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a = xe(e.canvasColor);
|
|
4584
|
+
return H("section", {
|
|
3853
4585
|
class: i,
|
|
3854
4586
|
"aria-label": e.ariaLabel ?? r.messages.common.editorAriaLabel,
|
|
3855
4587
|
"data-testid": "markweave-editor-frame",
|
|
3856
4588
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3857
|
-
"data-markweave-theme":
|
|
4589
|
+
"data-markweave-theme": Se(e.theme),
|
|
3858
4590
|
style: a ? { "--markweave-canvas": a } : void 0,
|
|
3859
4591
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3860
|
-
"data-markweave-inner-toc-placement":
|
|
4592
|
+
"data-markweave-inner-toc-placement": Oe(e.innerTocPlacement),
|
|
3861
4593
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3862
4594
|
"data-table-focus-mode": r.tableFocusState.value.mode,
|
|
3863
4595
|
onKeydownCapture: r.handleEditorKeyDown
|
|
3864
4596
|
}, [
|
|
3865
|
-
r.effectiveEditable.value ?
|
|
4597
|
+
r.effectiveEditable.value ? H(Di, {
|
|
3866
4598
|
editor: n,
|
|
3867
4599
|
messages: r.messages
|
|
3868
4600
|
}) : null,
|
|
3869
|
-
r.effectiveEditable.value ?
|
|
4601
|
+
r.effectiveEditable.value ? H(ki, {
|
|
3870
4602
|
commands: r.filteredSlashCommands.value,
|
|
3871
4603
|
state: r.slashState.value,
|
|
3872
4604
|
position: r.slashMenuPosition.value,
|
|
@@ -3876,7 +4608,7 @@ var Jr = J({
|
|
|
3876
4608
|
onInputCommandChange: r.setSlashInputCommand,
|
|
3877
4609
|
onUpload: e.onSlashCommandUpload
|
|
3878
4610
|
}) : null,
|
|
3879
|
-
r.effectiveEditable.value ?
|
|
4611
|
+
r.effectiveEditable.value ? H(Mi, {
|
|
3880
4612
|
editor: n,
|
|
3881
4613
|
active: r.tableFocusState.value.active,
|
|
3882
4614
|
interactionState: r.tableInteractionState.value,
|
|
@@ -3885,11 +4617,11 @@ var Jr = J({
|
|
|
3885
4617
|
onCommandResult: e.onTableCommandResult,
|
|
3886
4618
|
onEditWithAi: e.onEditWithAi
|
|
3887
4619
|
}) : null,
|
|
3888
|
-
r.effectiveEditable.value ?
|
|
4620
|
+
r.effectiveEditable.value ? H(Ni, {
|
|
3889
4621
|
editor: n,
|
|
3890
4622
|
focusState: r.tableFocusState.value
|
|
3891
4623
|
}) : null,
|
|
3892
|
-
|
|
4624
|
+
H(Pi, {
|
|
3893
4625
|
editor: n,
|
|
3894
4626
|
state: r.codeBlockState.value,
|
|
3895
4627
|
active: r.effectiveEditable.value && r.isCodeBlockActive.value,
|
|
@@ -3897,23 +4629,23 @@ var Jr = J({
|
|
|
3897
4629
|
onMermaidModeChange: r.setMermaidMode,
|
|
3898
4630
|
readOnly: !r.effectiveEditable.value
|
|
3899
4631
|
}),
|
|
3900
|
-
e.innerToc && r.tocState.value.items.length ?
|
|
4632
|
+
e.innerToc && r.tocState.value.items.length ? H(Fi, {
|
|
3901
4633
|
editor: n,
|
|
3902
4634
|
state: r.tocState.value,
|
|
3903
4635
|
messages: r.messages,
|
|
3904
4636
|
editable: r.effectiveEditable.value,
|
|
3905
|
-
placement:
|
|
4637
|
+
placement: Oe(e.innerTocPlacement)
|
|
3906
4638
|
}) : null,
|
|
3907
|
-
r.effectiveEditable.value && r.mathTarget.value ?
|
|
4639
|
+
r.effectiveEditable.value && r.mathTarget.value ? H(Oi, {
|
|
3908
4640
|
editor: n,
|
|
3909
4641
|
messages: r.messages,
|
|
3910
4642
|
target: r.mathTarget.value,
|
|
3911
4643
|
onClose: () => r.mathTarget.value = null
|
|
3912
4644
|
}) : null,
|
|
3913
|
-
|
|
4645
|
+
H(o, { editor: n })
|
|
3914
4646
|
]);
|
|
3915
4647
|
};
|
|
3916
4648
|
}
|
|
3917
4649
|
});
|
|
3918
4650
|
//#endregion
|
|
3919
|
-
export {
|
|
4651
|
+
export { Li as MarkweaveEditor, hi as createMarkweaveEditorExtensions, hi as createMarkweaveVue2EditorExtensions, Ii as useMarkweaveEditorController };
|