@markweave/vue2 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/index.js +3602 -0
- package/dist/types/MarkweaveEditor.d.ts +46 -0
- package/dist/types/MarkweaveEditor.d.ts.map +1 -0
- package/dist/types/create-editor-extensions.d.ts +10 -0
- package/dist/types/create-editor-extensions.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/media-nodeviews.d.ts +17 -0
- package/dist/types/media-nodeviews.d.ts.map +1 -0
- package/dist/types/vue2-compat.d.ts +26 -0
- package/dist/types/vue2-compat.d.ts.map +1 -0
- package/dist/types/vue2-icons.d.ts +758 -0
- package/dist/types/vue2-icons.d.ts.map +1 -0
- package/package.json +64 -0
- package/styles.css +1 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3602 @@
|
|
|
1
|
+
import { createMarkweaveEditorExtensions as e } from "markweave/internal/editor-core/create-editor-extensions";
|
|
2
|
+
import { createMarkweaveAdapterMediaExtensions as t } from "markweave/internal/plugins/media/media-extension-factory";
|
|
3
|
+
import { Editor as n, EditorContent as r, NodeViewWrapper as i, VueNodeViewRenderer as a } from "@tiptap/vue-2";
|
|
4
|
+
import * as o from "vue";
|
|
5
|
+
import { getMarkweaveEditorModeState as s, isMarkweaveEditorLiveEditable as c, normalizeMarkweaveEditorMode as l, setMarkweaveEditorModeState as u, subscribeToMarkweaveEditorMode as d } from "markweave/internal/core/editor-mode-state";
|
|
6
|
+
import { getLocalizedSlashCommandSpecs as f, getMarkweaveMessages as p, normalizeMarkweaveLang as m } from "markweave/internal/i18n";
|
|
7
|
+
import { MarkweaveCoreImage as h, MarkweaveCoreVideo as g, attrsFromMarkweaveImageUploadResult as _, attrsFromMarkweaveVideoUploadResult as v, attrsFromMarkweaveVideoUrl as y, clampMarkweaveImageWidth as b, createMarkweaveImageUploadRequest as x, createMarkweaveVideoUploadRequest as S, downloadMarkweaveImage as C, markweaveVideoIframeAllow as w, normalizeMarkweaveCoreImageAlign as T, normalizeMarkweaveVideoEmbedUrl as E, numberAttribute as D, stringAttribute as O } from "markweave/internal/plugins/media/core-media-nodes";
|
|
8
|
+
import { detectUploadSource as k, getDirectUploadResult as A, resolveMarkweaveUploadResult as j } from "markweave/internal/plugins/slash-command/upload";
|
|
9
|
+
import { BubbleMenu as M } from "@tiptap/vue-2/menus";
|
|
10
|
+
import { isEditorComposing as N } from "markweave/internal/editor-core/composition-guard";
|
|
11
|
+
import { createMarkweaveEditorUpdatePayload as ee, getMarkweaveContentType as P, isEditorContentCurrent as te, normalizeMarkweaveContentFormat as F } from "markweave/internal/editor-core/editor-content";
|
|
12
|
+
import { getCurrentFloatingToolbarBlockType as I, getFloatingToolbarHighlightColorOptions as L, getFloatingToolbarMoreActions as R, getFloatingToolbarTextColorOptions as ne, getFloatingToolbarTurnIntoOptions as re, runFloatingToolbarMoreAction as z, setFloatingToolbarTurnInto as ie } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
13
|
+
import { openMarkweaveReadonlyLinkFromEvent as ae } from "markweave/internal/editor-core/readonly-link";
|
|
14
|
+
import { createMarkweaveEditorRuntimeSnapshot as oe } from "markweave/internal/editor-core/runtime-snapshot";
|
|
15
|
+
import { createSelectionSnapshot as B, shouldShowFloatingToolbar as se } from "markweave/internal/editor-core/selection-state";
|
|
16
|
+
import { createMarkweaveTocState as ce, emptyMarkweaveTocState as le, getActiveMarkweaveTocId as ue, getMarkweaveTocItems as de, getValidMarkweaveTocActiveId as fe, scrollToMarkweaveTocItem as pe } from "markweave/internal/core/toc-state";
|
|
17
|
+
import { codeBlockCollapsePluginKey as me, copyActiveCodeBlock as he, getActiveCodeBlockState as ge, getCodeBlockCopyFeedbackSnapshot as _e, markweaveCodeBlockBehavior as ve, setCodeBlockCollapsedAtPosition as ye, setCodeBlockLanguageAtPosition as be, setCodeBlockMermaidPreviewModeAtPosition as xe } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
18
|
+
import { calculateCodeBlockLanguageMenuPosition as Se, clampFullscreenScale as Ce, codeBlockCopyFeedbackTimeoutMs as we, copyCodeBlockText as Te, createCodeBlockOverlayPosition as Ee, createMermaidFullscreenViewerState as De, createMermaidTabPosition as Oe, focusCodeBlockTarget as ke, formatCodeBlockLanguageLabel as Ae, formatFullscreenZoom as je, getActiveCodeBlockElement as Me, getAnchoredRect as Ne, getCodeBlockLanguageItems as Pe, getCodeBlockPositionFromEventTarget as Fe, getCodeBlockStateAtPosition as Ie, getFrameElement as Le, getMermaidCodeBlockTargets as Re, getMermaidSvgMarkup as ze, isCodeBlockTargetCollapsed as Be, mergeStableMermaidTabPositions as Ve, mermaidFullscreenZoomStep as He, moveMermaidFullscreenViewer as Ue } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
19
|
+
import { normalizeMarkdownLinkHref as We } from "markweave/internal/plugins/markdown/markdown-input";
|
|
20
|
+
import { applyMarkweaveMathLatex as Ge, calculateMarkweaveMathPopoverPosition as Ke, getMarkweaveMathAnchorRect as qe, getMarkweaveMathBlockIndex as Je, getMarkweaveMathRenderedHtml as Ye, getMarkweaveMathTargetAtPos as Xe, getMarkweaveMathTargetFromDomEvent as Ze, getMarkweaveMathTargetFromSelection as Qe, renderMarkweaveMathPreview as $e, setMarkweaveMathEditingDomState as et, setMarkweaveMathEditingDomStateInView as tt, setMarkweaveMathSelectionInView as nt } from "markweave/internal/plugins/math/math-ui-model";
|
|
21
|
+
import { isMermaidInlinePreviewTransaction as rt, setMermaidInlinePreviewEditorMode as it, setReadonlyMermaidPreviewMode as at } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
22
|
+
import { getMermaidPreviewState as ot } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
23
|
+
import { filterSlashCommands as st, isExecutableSlashCommand as ct } from "markweave/internal/plugins/slash-command/command-spec";
|
|
24
|
+
import { getSlashCommandKeyboardAction as lt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
25
|
+
import { executeSlashCommand as ut, getNextSlashCommandState as dt, getSlashCommandAnchoredMenuPosition as ft, getSlashCommandContext as pt } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
26
|
+
import { initialSlashCommandState as mt, reduceSlashCommandState as ht } from "markweave/internal/plugins/slash-command/slash-state";
|
|
27
|
+
import { setMarkweaveTableMenuAxisTarget as gt } from "markweave/internal/plugins/table/table-clipboard";
|
|
28
|
+
import { getFirstTableDebugSnapshot as _t } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
29
|
+
import { focusFirstTableBodyCell as vt } from "markweave/internal/plugins/table/table-focus-position";
|
|
30
|
+
import { getTableFocusState as yt } from "markweave/internal/plugins/table/table-focus-state";
|
|
31
|
+
import { getTableSelectionOverlayState as bt, initialTableInteractionState as xt, tableInteractionPluginKey as St } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
32
|
+
import { calculateAnchoredTableMenuPosition as Ct, calculateTableEdgeHandlePosition as wt, canRunTableCommand as Tt, executeTableMenuCommand as Et, formatTableCopyFeedback as Dt, getActiveTableElement as Ot, getAvailableCellMenuCommandSpecs as kt, getTableAxisTargetRect as At, getTableControlAxisSelectionModel as jt, getTableEditWithAiRequest as Mt, getTableMenuItemGroup as Nt, getTableMenuItemLabel as Pt, getTableMenuItems as Ft, getTableSelectionTargetRect as It, measureTableSelectionOverlay as Lt, selectTableAxisFromCell as Rt, tableCopyFeedbackTimeoutMs as zt, tableMenuLabel as Bt } from "markweave/internal/plugins/table/table-ui-model";
|
|
33
|
+
//#region src/vue2-compat.ts
|
|
34
|
+
var Vt = o.default ?? o, Ht = null, Ut = null, Wt = null;
|
|
35
|
+
function Gt(e) {
|
|
36
|
+
return !!(e && typeof e == "object" && "value" in e);
|
|
37
|
+
}
|
|
38
|
+
function Kt(e) {
|
|
39
|
+
let t = e.slice(2);
|
|
40
|
+
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
41
|
+
}
|
|
42
|
+
function qt(e) {
|
|
43
|
+
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
44
|
+
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
45
|
+
if (o === "class" || o === "style" || o === "key") {
|
|
46
|
+
t[o] = s;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (o === "ref" && Gt(s)) {
|
|
50
|
+
a.insert = (e) => {
|
|
51
|
+
s.value = e.elm;
|
|
52
|
+
}, a.destroy = () => {
|
|
53
|
+
s.value = null;
|
|
54
|
+
};
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (/^on[A-Z]/.test(o)) {
|
|
58
|
+
i[Kt(o)] = s;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
62
|
+
r[o] = s;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
n[o] = s;
|
|
66
|
+
}
|
|
67
|
+
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;
|
|
68
|
+
}
|
|
69
|
+
function Jt(e) {
|
|
70
|
+
let t = {}, n = {}, r = {}, i = {};
|
|
71
|
+
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
72
|
+
if (a === "class" || a === "style" || a === "key") {
|
|
73
|
+
t[a] = o;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (a === "ref" && Gt(o)) {
|
|
77
|
+
i.insert = (e) => {
|
|
78
|
+
o.value = e.componentInstance ?? e.elm;
|
|
79
|
+
}, i.destroy = () => {
|
|
80
|
+
o.value = null;
|
|
81
|
+
};
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (a.startsWith("data-") || a.startsWith("aria-") || a === "role" || a === "tabindex") {
|
|
85
|
+
r[a] = o;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
n[a] = o;
|
|
89
|
+
}
|
|
90
|
+
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
91
|
+
}
|
|
92
|
+
function Yt(e) {
|
|
93
|
+
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
94
|
+
}
|
|
95
|
+
function Xt(e) {
|
|
96
|
+
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
97
|
+
}
|
|
98
|
+
function Zt(e) {
|
|
99
|
+
return e == null || Array.isArray(e) ? e : [e];
|
|
100
|
+
}
|
|
101
|
+
function Qt(e) {
|
|
102
|
+
return typeof e == "function" ? Zt(e()) : Yt(e) ? Zt(e.default()) : Xt(e) ? [e] : e;
|
|
103
|
+
}
|
|
104
|
+
function V(e, t, n) {
|
|
105
|
+
if (!Wt) throw Error("Vue 2 render context is not available.");
|
|
106
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? qt(r) : Jt(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Qt(n);
|
|
107
|
+
return Wt(e, i, a);
|
|
108
|
+
}
|
|
109
|
+
function H(e) {
|
|
110
|
+
return Vt.observable({ value: e });
|
|
111
|
+
}
|
|
112
|
+
var U = H;
|
|
113
|
+
function W(e) {
|
|
114
|
+
return { get value() {
|
|
115
|
+
return e();
|
|
116
|
+
} };
|
|
117
|
+
}
|
|
118
|
+
function G(e, t, n) {
|
|
119
|
+
let r = typeof e == "function" ? e : () => e.value;
|
|
120
|
+
return Ht?.$watch ? Ht.$watch(r, t, n) : () => void 0;
|
|
121
|
+
}
|
|
122
|
+
function $t(e) {
|
|
123
|
+
Ut?.mounted.push(e);
|
|
124
|
+
}
|
|
125
|
+
function K(e) {
|
|
126
|
+
Ut?.beforeUnmount.push(e);
|
|
127
|
+
}
|
|
128
|
+
function q(e) {
|
|
129
|
+
return Vt.nextTick(e);
|
|
130
|
+
}
|
|
131
|
+
function J(e) {
|
|
132
|
+
return Vt.extend({
|
|
133
|
+
name: e.name,
|
|
134
|
+
props: e.props,
|
|
135
|
+
created() {
|
|
136
|
+
let t = {
|
|
137
|
+
mounted: [],
|
|
138
|
+
beforeUnmount: []
|
|
139
|
+
};
|
|
140
|
+
Ht = this, Ut = t;
|
|
141
|
+
try {
|
|
142
|
+
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
143
|
+
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
144
|
+
} finally {
|
|
145
|
+
Ht = null, Ut = null;
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
mounted() {
|
|
149
|
+
this.__markweaveVue2Lifecycle?.mounted.forEach((e) => e());
|
|
150
|
+
},
|
|
151
|
+
beforeDestroy() {
|
|
152
|
+
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
153
|
+
},
|
|
154
|
+
render(t) {
|
|
155
|
+
Wt = t;
|
|
156
|
+
try {
|
|
157
|
+
let n = this.__markweaveVue2Render;
|
|
158
|
+
return n ? n() : e.render?.(t) ?? null;
|
|
159
|
+
} finally {
|
|
160
|
+
Wt = null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/vue2-icons.ts
|
|
167
|
+
var en = {
|
|
168
|
+
AlignCenter: {
|
|
169
|
+
iconName: "text-align-center",
|
|
170
|
+
node: [
|
|
171
|
+
["path", {
|
|
172
|
+
d: "M21 5H3",
|
|
173
|
+
key: "1fi0y6"
|
|
174
|
+
}],
|
|
175
|
+
["path", {
|
|
176
|
+
d: "M17 12H7",
|
|
177
|
+
key: "16if0g"
|
|
178
|
+
}],
|
|
179
|
+
["path", {
|
|
180
|
+
d: "M19 19H5",
|
|
181
|
+
key: "vjpgq2"
|
|
182
|
+
}]
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
AlignJustify: {
|
|
186
|
+
iconName: "text-align-justify",
|
|
187
|
+
node: [
|
|
188
|
+
["path", {
|
|
189
|
+
d: "M3 5h18",
|
|
190
|
+
key: "1u36vt"
|
|
191
|
+
}],
|
|
192
|
+
["path", {
|
|
193
|
+
d: "M3 12h18",
|
|
194
|
+
key: "1i2n21"
|
|
195
|
+
}],
|
|
196
|
+
["path", {
|
|
197
|
+
d: "M3 19h18",
|
|
198
|
+
key: "awlh7x"
|
|
199
|
+
}]
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
AlignLeft: {
|
|
203
|
+
iconName: "text-align-start",
|
|
204
|
+
node: [
|
|
205
|
+
["path", {
|
|
206
|
+
d: "M21 5H3",
|
|
207
|
+
key: "1fi0y6"
|
|
208
|
+
}],
|
|
209
|
+
["path", {
|
|
210
|
+
d: "M15 12H3",
|
|
211
|
+
key: "6jk70r"
|
|
212
|
+
}],
|
|
213
|
+
["path", {
|
|
214
|
+
d: "M17 19H3",
|
|
215
|
+
key: "z6ezky"
|
|
216
|
+
}]
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
AlignRight: {
|
|
220
|
+
iconName: "text-align-end",
|
|
221
|
+
node: [
|
|
222
|
+
["path", {
|
|
223
|
+
d: "M21 5H3",
|
|
224
|
+
key: "1fi0y6"
|
|
225
|
+
}],
|
|
226
|
+
["path", {
|
|
227
|
+
d: "M21 12H9",
|
|
228
|
+
key: "dn1m92"
|
|
229
|
+
}],
|
|
230
|
+
["path", {
|
|
231
|
+
d: "M21 19H7",
|
|
232
|
+
key: "4cu937"
|
|
233
|
+
}]
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
AlertTriangle: {
|
|
237
|
+
iconName: "triangle-alert",
|
|
238
|
+
node: [
|
|
239
|
+
["path", {
|
|
240
|
+
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
|
|
241
|
+
key: "wmoenq"
|
|
242
|
+
}],
|
|
243
|
+
["path", {
|
|
244
|
+
d: "M12 9v4",
|
|
245
|
+
key: "juzpu7"
|
|
246
|
+
}],
|
|
247
|
+
["path", {
|
|
248
|
+
d: "M12 17h.01",
|
|
249
|
+
key: "p32p05"
|
|
250
|
+
}]
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
Bold: {
|
|
254
|
+
iconName: "bold",
|
|
255
|
+
node: [["path", {
|
|
256
|
+
d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",
|
|
257
|
+
key: "mg9rjx"
|
|
258
|
+
}]]
|
|
259
|
+
},
|
|
260
|
+
Braces: {
|
|
261
|
+
iconName: "braces",
|
|
262
|
+
node: [["path", {
|
|
263
|
+
d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",
|
|
264
|
+
key: "ezmyqa"
|
|
265
|
+
}], ["path", {
|
|
266
|
+
d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
|
|
267
|
+
key: "e1hn23"
|
|
268
|
+
}]]
|
|
269
|
+
},
|
|
270
|
+
Captions: {
|
|
271
|
+
iconName: "captions",
|
|
272
|
+
node: [["rect", {
|
|
273
|
+
width: "18",
|
|
274
|
+
height: "14",
|
|
275
|
+
x: "3",
|
|
276
|
+
y: "5",
|
|
277
|
+
rx: "2",
|
|
278
|
+
ry: "2",
|
|
279
|
+
key: "12ruh7"
|
|
280
|
+
}], ["path", {
|
|
281
|
+
d: "M7 15h4M15 15h2M7 11h2M13 11h4",
|
|
282
|
+
key: "1ueiar"
|
|
283
|
+
}]]
|
|
284
|
+
},
|
|
285
|
+
CheckCircle2: {
|
|
286
|
+
iconName: "circle-check",
|
|
287
|
+
node: [["circle", {
|
|
288
|
+
cx: "12",
|
|
289
|
+
cy: "12",
|
|
290
|
+
r: "10",
|
|
291
|
+
key: "1mglay"
|
|
292
|
+
}], ["path", {
|
|
293
|
+
d: "m9 12 2 2 4-4",
|
|
294
|
+
key: "dzmm74"
|
|
295
|
+
}]]
|
|
296
|
+
},
|
|
297
|
+
ChevronDown: {
|
|
298
|
+
iconName: "chevron-down",
|
|
299
|
+
node: [["path", {
|
|
300
|
+
d: "m6 9 6 6 6-6",
|
|
301
|
+
key: "qrunsl"
|
|
302
|
+
}]]
|
|
303
|
+
},
|
|
304
|
+
ChevronUp: {
|
|
305
|
+
iconName: "chevron-up",
|
|
306
|
+
node: [["path", {
|
|
307
|
+
d: "m18 15-6-6-6 6",
|
|
308
|
+
key: "153udz"
|
|
309
|
+
}]]
|
|
310
|
+
},
|
|
311
|
+
CircleX: {
|
|
312
|
+
iconName: "circle-x",
|
|
313
|
+
node: [
|
|
314
|
+
["circle", {
|
|
315
|
+
cx: "12",
|
|
316
|
+
cy: "12",
|
|
317
|
+
r: "10",
|
|
318
|
+
key: "1mglay"
|
|
319
|
+
}],
|
|
320
|
+
["path", {
|
|
321
|
+
d: "m15 9-6 6",
|
|
322
|
+
key: "1uzhvr"
|
|
323
|
+
}],
|
|
324
|
+
["path", {
|
|
325
|
+
d: "m9 9 6 6",
|
|
326
|
+
key: "z0biqf"
|
|
327
|
+
}]
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
Code2: {
|
|
331
|
+
iconName: "code-xml",
|
|
332
|
+
node: [
|
|
333
|
+
["path", {
|
|
334
|
+
d: "m18 16 4-4-4-4",
|
|
335
|
+
key: "1inbqp"
|
|
336
|
+
}],
|
|
337
|
+
["path", {
|
|
338
|
+
d: "m6 8-4 4 4 4",
|
|
339
|
+
key: "15zrgr"
|
|
340
|
+
}],
|
|
341
|
+
["path", {
|
|
342
|
+
d: "m14.5 4-5 16",
|
|
343
|
+
key: "e7oirm"
|
|
344
|
+
}]
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
CornerDownLeft: {
|
|
348
|
+
iconName: "corner-down-left",
|
|
349
|
+
node: [["path", {
|
|
350
|
+
d: "M20 4v7a4 4 0 0 1-4 4H4",
|
|
351
|
+
key: "6o5b7l"
|
|
352
|
+
}], ["path", {
|
|
353
|
+
d: "m9 10-5 5 5 5",
|
|
354
|
+
key: "1kshq7"
|
|
355
|
+
}]]
|
|
356
|
+
},
|
|
357
|
+
Download: {
|
|
358
|
+
iconName: "download",
|
|
359
|
+
node: [
|
|
360
|
+
["path", {
|
|
361
|
+
d: "M12 15V3",
|
|
362
|
+
key: "m9g1x1"
|
|
363
|
+
}],
|
|
364
|
+
["path", {
|
|
365
|
+
d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
|
|
366
|
+
key: "ih7n3h"
|
|
367
|
+
}],
|
|
368
|
+
["path", {
|
|
369
|
+
d: "m7 10 5 5 5-5",
|
|
370
|
+
key: "brsn70"
|
|
371
|
+
}]
|
|
372
|
+
]
|
|
373
|
+
},
|
|
374
|
+
Eye: {
|
|
375
|
+
iconName: "eye",
|
|
376
|
+
node: [["path", {
|
|
377
|
+
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
378
|
+
key: "1nclc0"
|
|
379
|
+
}], ["circle", {
|
|
380
|
+
cx: "12",
|
|
381
|
+
cy: "12",
|
|
382
|
+
r: "3",
|
|
383
|
+
key: "1v7zrd"
|
|
384
|
+
}]]
|
|
385
|
+
},
|
|
386
|
+
ExternalLink: {
|
|
387
|
+
iconName: "external-link",
|
|
388
|
+
node: [
|
|
389
|
+
["path", {
|
|
390
|
+
d: "M15 3h6v6",
|
|
391
|
+
key: "1q9fwt"
|
|
392
|
+
}],
|
|
393
|
+
["path", {
|
|
394
|
+
d: "M10 14 21 3",
|
|
395
|
+
key: "gplh6r"
|
|
396
|
+
}],
|
|
397
|
+
["path", {
|
|
398
|
+
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
399
|
+
key: "a6xqqp"
|
|
400
|
+
}]
|
|
401
|
+
]
|
|
402
|
+
},
|
|
403
|
+
Heading1: {
|
|
404
|
+
iconName: "heading-1",
|
|
405
|
+
node: [
|
|
406
|
+
["path", {
|
|
407
|
+
d: "M4 12h8",
|
|
408
|
+
key: "17cfdx"
|
|
409
|
+
}],
|
|
410
|
+
["path", {
|
|
411
|
+
d: "M4 18V6",
|
|
412
|
+
key: "1rz3zl"
|
|
413
|
+
}],
|
|
414
|
+
["path", {
|
|
415
|
+
d: "M12 18V6",
|
|
416
|
+
key: "zqpxq5"
|
|
417
|
+
}],
|
|
418
|
+
["path", {
|
|
419
|
+
d: "m17 12 3-2v8",
|
|
420
|
+
key: "1hhhft"
|
|
421
|
+
}]
|
|
422
|
+
]
|
|
423
|
+
},
|
|
424
|
+
Heading2: {
|
|
425
|
+
iconName: "heading-2",
|
|
426
|
+
node: [
|
|
427
|
+
["path", {
|
|
428
|
+
d: "M4 12h8",
|
|
429
|
+
key: "17cfdx"
|
|
430
|
+
}],
|
|
431
|
+
["path", {
|
|
432
|
+
d: "M4 18V6",
|
|
433
|
+
key: "1rz3zl"
|
|
434
|
+
}],
|
|
435
|
+
["path", {
|
|
436
|
+
d: "M12 18V6",
|
|
437
|
+
key: "zqpxq5"
|
|
438
|
+
}],
|
|
439
|
+
["path", {
|
|
440
|
+
d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",
|
|
441
|
+
key: "9jr5yi"
|
|
442
|
+
}]
|
|
443
|
+
]
|
|
444
|
+
},
|
|
445
|
+
Heading3: {
|
|
446
|
+
iconName: "heading-3",
|
|
447
|
+
node: [
|
|
448
|
+
["path", {
|
|
449
|
+
d: "M4 12h8",
|
|
450
|
+
key: "17cfdx"
|
|
451
|
+
}],
|
|
452
|
+
["path", {
|
|
453
|
+
d: "M4 18V6",
|
|
454
|
+
key: "1rz3zl"
|
|
455
|
+
}],
|
|
456
|
+
["path", {
|
|
457
|
+
d: "M12 18V6",
|
|
458
|
+
key: "zqpxq5"
|
|
459
|
+
}],
|
|
460
|
+
["path", {
|
|
461
|
+
d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",
|
|
462
|
+
key: "68ncm8"
|
|
463
|
+
}],
|
|
464
|
+
["path", {
|
|
465
|
+
d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",
|
|
466
|
+
key: "1ejuhz"
|
|
467
|
+
}]
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
Image: {
|
|
471
|
+
iconName: "image",
|
|
472
|
+
node: [
|
|
473
|
+
["rect", {
|
|
474
|
+
width: "18",
|
|
475
|
+
height: "18",
|
|
476
|
+
x: "3",
|
|
477
|
+
y: "3",
|
|
478
|
+
rx: "2",
|
|
479
|
+
ry: "2",
|
|
480
|
+
key: "1m3agn"
|
|
481
|
+
}],
|
|
482
|
+
["circle", {
|
|
483
|
+
cx: "9",
|
|
484
|
+
cy: "9",
|
|
485
|
+
r: "2",
|
|
486
|
+
key: "af1f0g"
|
|
487
|
+
}],
|
|
488
|
+
["path", {
|
|
489
|
+
d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",
|
|
490
|
+
key: "1xmnt7"
|
|
491
|
+
}]
|
|
492
|
+
]
|
|
493
|
+
},
|
|
494
|
+
ImageUp: {
|
|
495
|
+
iconName: "image-up",
|
|
496
|
+
node: [
|
|
497
|
+
["path", {
|
|
498
|
+
d: "M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",
|
|
499
|
+
key: "9csbqa"
|
|
500
|
+
}],
|
|
501
|
+
["path", {
|
|
502
|
+
d: "m14 19.5 3-3 3 3",
|
|
503
|
+
key: "9vmjn0"
|
|
504
|
+
}],
|
|
505
|
+
["path", {
|
|
506
|
+
d: "M17 22v-5.5",
|
|
507
|
+
key: "1aa6fl"
|
|
508
|
+
}],
|
|
509
|
+
["circle", {
|
|
510
|
+
cx: "9",
|
|
511
|
+
cy: "9",
|
|
512
|
+
r: "2",
|
|
513
|
+
key: "af1f0g"
|
|
514
|
+
}]
|
|
515
|
+
]
|
|
516
|
+
},
|
|
517
|
+
IndentDecrease: {
|
|
518
|
+
iconName: "list-indent-decrease",
|
|
519
|
+
node: [
|
|
520
|
+
["path", {
|
|
521
|
+
d: "M21 5H11",
|
|
522
|
+
key: "us1j55"
|
|
523
|
+
}],
|
|
524
|
+
["path", {
|
|
525
|
+
d: "M21 12H11",
|
|
526
|
+
key: "wd7e0v"
|
|
527
|
+
}],
|
|
528
|
+
["path", {
|
|
529
|
+
d: "M21 19H11",
|
|
530
|
+
key: "saa85w"
|
|
531
|
+
}],
|
|
532
|
+
["path", {
|
|
533
|
+
d: "m7 8-4 4 4 4",
|
|
534
|
+
key: "o5hrat"
|
|
535
|
+
}]
|
|
536
|
+
]
|
|
537
|
+
},
|
|
538
|
+
IndentIncrease: {
|
|
539
|
+
iconName: "list-indent-increase",
|
|
540
|
+
node: [
|
|
541
|
+
["path", {
|
|
542
|
+
d: "M21 5H11",
|
|
543
|
+
key: "us1j55"
|
|
544
|
+
}],
|
|
545
|
+
["path", {
|
|
546
|
+
d: "M21 12H11",
|
|
547
|
+
key: "wd7e0v"
|
|
548
|
+
}],
|
|
549
|
+
["path", {
|
|
550
|
+
d: "M21 19H11",
|
|
551
|
+
key: "saa85w"
|
|
552
|
+
}],
|
|
553
|
+
["path", {
|
|
554
|
+
d: "m3 8 4 4-4 4",
|
|
555
|
+
key: "1a3j6y"
|
|
556
|
+
}]
|
|
557
|
+
]
|
|
558
|
+
},
|
|
559
|
+
Info: {
|
|
560
|
+
iconName: "info",
|
|
561
|
+
node: [
|
|
562
|
+
["circle", {
|
|
563
|
+
cx: "12",
|
|
564
|
+
cy: "12",
|
|
565
|
+
r: "10",
|
|
566
|
+
key: "1mglay"
|
|
567
|
+
}],
|
|
568
|
+
["path", {
|
|
569
|
+
d: "M12 16v-4",
|
|
570
|
+
key: "1dtifu"
|
|
571
|
+
}],
|
|
572
|
+
["path", {
|
|
573
|
+
d: "M12 8h.01",
|
|
574
|
+
key: "e9boi3"
|
|
575
|
+
}]
|
|
576
|
+
]
|
|
577
|
+
},
|
|
578
|
+
Italic: {
|
|
579
|
+
iconName: "italic",
|
|
580
|
+
node: [
|
|
581
|
+
["line", {
|
|
582
|
+
x1: "19",
|
|
583
|
+
x2: "10",
|
|
584
|
+
y1: "4",
|
|
585
|
+
y2: "4",
|
|
586
|
+
key: "15jd3p"
|
|
587
|
+
}],
|
|
588
|
+
["line", {
|
|
589
|
+
x1: "14",
|
|
590
|
+
x2: "5",
|
|
591
|
+
y1: "20",
|
|
592
|
+
y2: "20",
|
|
593
|
+
key: "bu0au3"
|
|
594
|
+
}],
|
|
595
|
+
["line", {
|
|
596
|
+
x1: "15",
|
|
597
|
+
x2: "9",
|
|
598
|
+
y1: "4",
|
|
599
|
+
y2: "20",
|
|
600
|
+
key: "uljnxc"
|
|
601
|
+
}]
|
|
602
|
+
]
|
|
603
|
+
},
|
|
604
|
+
Lightbulb: {
|
|
605
|
+
iconName: "lightbulb",
|
|
606
|
+
node: [
|
|
607
|
+
["path", {
|
|
608
|
+
d: "M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",
|
|
609
|
+
key: "1gvzjb"
|
|
610
|
+
}],
|
|
611
|
+
["path", {
|
|
612
|
+
d: "M9 18h6",
|
|
613
|
+
key: "x1upvd"
|
|
614
|
+
}],
|
|
615
|
+
["path", {
|
|
616
|
+
d: "M10 22h4",
|
|
617
|
+
key: "ceow96"
|
|
618
|
+
}]
|
|
619
|
+
]
|
|
620
|
+
},
|
|
621
|
+
Link2: {
|
|
622
|
+
iconName: "link-2",
|
|
623
|
+
node: [
|
|
624
|
+
["path", {
|
|
625
|
+
d: "M9 17H7A5 5 0 0 1 7 7h2",
|
|
626
|
+
key: "8i5ue5"
|
|
627
|
+
}],
|
|
628
|
+
["path", {
|
|
629
|
+
d: "M15 7h2a5 5 0 1 1 0 10h-2",
|
|
630
|
+
key: "1b9ql8"
|
|
631
|
+
}],
|
|
632
|
+
["line", {
|
|
633
|
+
x1: "8",
|
|
634
|
+
x2: "16",
|
|
635
|
+
y1: "12",
|
|
636
|
+
y2: "12",
|
|
637
|
+
key: "1jonct"
|
|
638
|
+
}]
|
|
639
|
+
]
|
|
640
|
+
},
|
|
641
|
+
List: {
|
|
642
|
+
iconName: "list",
|
|
643
|
+
node: [
|
|
644
|
+
["path", {
|
|
645
|
+
d: "M3 5h.01",
|
|
646
|
+
key: "18ugdj"
|
|
647
|
+
}],
|
|
648
|
+
["path", {
|
|
649
|
+
d: "M3 12h.01",
|
|
650
|
+
key: "nlz23k"
|
|
651
|
+
}],
|
|
652
|
+
["path", {
|
|
653
|
+
d: "M3 19h.01",
|
|
654
|
+
key: "noohij"
|
|
655
|
+
}],
|
|
656
|
+
["path", {
|
|
657
|
+
d: "M8 5h13",
|
|
658
|
+
key: "1pao27"
|
|
659
|
+
}],
|
|
660
|
+
["path", {
|
|
661
|
+
d: "M8 12h13",
|
|
662
|
+
key: "1za7za"
|
|
663
|
+
}],
|
|
664
|
+
["path", {
|
|
665
|
+
d: "M8 19h13",
|
|
666
|
+
key: "m83p4d"
|
|
667
|
+
}]
|
|
668
|
+
]
|
|
669
|
+
},
|
|
670
|
+
ListChecks: {
|
|
671
|
+
iconName: "list-checks",
|
|
672
|
+
node: [
|
|
673
|
+
["path", {
|
|
674
|
+
d: "M13 5h8",
|
|
675
|
+
key: "a7qcls"
|
|
676
|
+
}],
|
|
677
|
+
["path", {
|
|
678
|
+
d: "M13 12h8",
|
|
679
|
+
key: "h98zly"
|
|
680
|
+
}],
|
|
681
|
+
["path", {
|
|
682
|
+
d: "M13 19h8",
|
|
683
|
+
key: "c3s6r1"
|
|
684
|
+
}],
|
|
685
|
+
["path", {
|
|
686
|
+
d: "m3 17 2 2 4-4",
|
|
687
|
+
key: "1jhpwq"
|
|
688
|
+
}],
|
|
689
|
+
["path", {
|
|
690
|
+
d: "m3 7 2 2 4-4",
|
|
691
|
+
key: "1obspn"
|
|
692
|
+
}]
|
|
693
|
+
]
|
|
694
|
+
},
|
|
695
|
+
ListOrdered: {
|
|
696
|
+
iconName: "list-ordered",
|
|
697
|
+
node: [
|
|
698
|
+
["path", {
|
|
699
|
+
d: "M11 5h10",
|
|
700
|
+
key: "1cz7ny"
|
|
701
|
+
}],
|
|
702
|
+
["path", {
|
|
703
|
+
d: "M11 12h10",
|
|
704
|
+
key: "1438ji"
|
|
705
|
+
}],
|
|
706
|
+
["path", {
|
|
707
|
+
d: "M11 19h10",
|
|
708
|
+
key: "11t30w"
|
|
709
|
+
}],
|
|
710
|
+
["path", {
|
|
711
|
+
d: "M4 4h1v5",
|
|
712
|
+
key: "10yrso"
|
|
713
|
+
}],
|
|
714
|
+
["path", {
|
|
715
|
+
d: "M4 9h2",
|
|
716
|
+
key: "r1h2o0"
|
|
717
|
+
}],
|
|
718
|
+
["path", {
|
|
719
|
+
d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",
|
|
720
|
+
key: "xtkcd5"
|
|
721
|
+
}]
|
|
722
|
+
]
|
|
723
|
+
},
|
|
724
|
+
Minus: {
|
|
725
|
+
iconName: "minus",
|
|
726
|
+
node: [["path", {
|
|
727
|
+
d: "M5 12h14",
|
|
728
|
+
key: "1ays0h"
|
|
729
|
+
}]]
|
|
730
|
+
},
|
|
731
|
+
MoreVertical: {
|
|
732
|
+
iconName: "ellipsis-vertical",
|
|
733
|
+
node: [
|
|
734
|
+
["circle", {
|
|
735
|
+
cx: "12",
|
|
736
|
+
cy: "12",
|
|
737
|
+
r: "1",
|
|
738
|
+
key: "41hilf"
|
|
739
|
+
}],
|
|
740
|
+
["circle", {
|
|
741
|
+
cx: "12",
|
|
742
|
+
cy: "5",
|
|
743
|
+
r: "1",
|
|
744
|
+
key: "gxeob9"
|
|
745
|
+
}],
|
|
746
|
+
["circle", {
|
|
747
|
+
cx: "12",
|
|
748
|
+
cy: "19",
|
|
749
|
+
r: "1",
|
|
750
|
+
key: "lyex9k"
|
|
751
|
+
}]
|
|
752
|
+
]
|
|
753
|
+
},
|
|
754
|
+
Paperclip: {
|
|
755
|
+
iconName: "paperclip",
|
|
756
|
+
node: [["path", {
|
|
757
|
+
d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
|
|
758
|
+
key: "1miecu"
|
|
759
|
+
}]]
|
|
760
|
+
},
|
|
761
|
+
PencilLine: {
|
|
762
|
+
iconName: "pencil-line",
|
|
763
|
+
node: [
|
|
764
|
+
["path", {
|
|
765
|
+
d: "M13 21h8",
|
|
766
|
+
key: "1jsn5i"
|
|
767
|
+
}],
|
|
768
|
+
["path", {
|
|
769
|
+
d: "m15 5 4 4",
|
|
770
|
+
key: "1mk7zo"
|
|
771
|
+
}],
|
|
772
|
+
["path", {
|
|
773
|
+
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
774
|
+
key: "1a8usu"
|
|
775
|
+
}]
|
|
776
|
+
]
|
|
777
|
+
},
|
|
778
|
+
Quote: {
|
|
779
|
+
iconName: "quote",
|
|
780
|
+
node: [["path", {
|
|
781
|
+
d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
782
|
+
key: "rib7q0"
|
|
783
|
+
}], ["path", {
|
|
784
|
+
d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
785
|
+
key: "1ymkrd"
|
|
786
|
+
}]]
|
|
787
|
+
},
|
|
788
|
+
Replace: {
|
|
789
|
+
iconName: "replace",
|
|
790
|
+
node: [
|
|
791
|
+
["path", {
|
|
792
|
+
d: "M14 4a1 1 0 0 1 1-1",
|
|
793
|
+
key: "dhj8ez"
|
|
794
|
+
}],
|
|
795
|
+
["path", {
|
|
796
|
+
d: "M15 10a1 1 0 0 1-1-1",
|
|
797
|
+
key: "1mnyi5"
|
|
798
|
+
}],
|
|
799
|
+
["path", {
|
|
800
|
+
d: "M21 4a1 1 0 0 0-1-1",
|
|
801
|
+
key: "sfs9ap"
|
|
802
|
+
}],
|
|
803
|
+
["path", {
|
|
804
|
+
d: "M21 9a1 1 0 0 1-1 1",
|
|
805
|
+
key: "mp6qeo"
|
|
806
|
+
}],
|
|
807
|
+
["path", {
|
|
808
|
+
d: "m3 7 3 3 3-3",
|
|
809
|
+
key: "x25e72"
|
|
810
|
+
}],
|
|
811
|
+
["path", {
|
|
812
|
+
d: "M6 10V5a2 2 0 0 1 2-2h2",
|
|
813
|
+
key: "15xut4"
|
|
814
|
+
}],
|
|
815
|
+
["rect", {
|
|
816
|
+
x: "3",
|
|
817
|
+
y: "14",
|
|
818
|
+
width: "7",
|
|
819
|
+
height: "7",
|
|
820
|
+
rx: "1",
|
|
821
|
+
key: "1bkyp8"
|
|
822
|
+
}]
|
|
823
|
+
]
|
|
824
|
+
},
|
|
825
|
+
Sigma: {
|
|
826
|
+
iconName: "sigma",
|
|
827
|
+
node: [["path", {
|
|
828
|
+
d: "M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",
|
|
829
|
+
key: "wuwx1p"
|
|
830
|
+
}]]
|
|
831
|
+
},
|
|
832
|
+
SmilePlus: {
|
|
833
|
+
iconName: "smile-plus",
|
|
834
|
+
node: [
|
|
835
|
+
["path", {
|
|
836
|
+
d: "M22 11v1a10 10 0 1 1-9-10",
|
|
837
|
+
key: "ew0xw9"
|
|
838
|
+
}],
|
|
839
|
+
["path", {
|
|
840
|
+
d: "M8 14s1.5 2 4 2 4-2 4-2",
|
|
841
|
+
key: "1y1vjs"
|
|
842
|
+
}],
|
|
843
|
+
["line", {
|
|
844
|
+
x1: "9",
|
|
845
|
+
x2: "9.01",
|
|
846
|
+
y1: "9",
|
|
847
|
+
y2: "9",
|
|
848
|
+
key: "yxxnd0"
|
|
849
|
+
}],
|
|
850
|
+
["line", {
|
|
851
|
+
x1: "15",
|
|
852
|
+
x2: "15.01",
|
|
853
|
+
y1: "9",
|
|
854
|
+
y2: "9",
|
|
855
|
+
key: "1p4y9e"
|
|
856
|
+
}],
|
|
857
|
+
["path", {
|
|
858
|
+
d: "M16 5h6",
|
|
859
|
+
key: "1vod17"
|
|
860
|
+
}],
|
|
861
|
+
["path", {
|
|
862
|
+
d: "M19 2v6",
|
|
863
|
+
key: "4bpg5p"
|
|
864
|
+
}]
|
|
865
|
+
]
|
|
866
|
+
},
|
|
867
|
+
Strikethrough: {
|
|
868
|
+
iconName: "strikethrough",
|
|
869
|
+
node: [
|
|
870
|
+
["path", {
|
|
871
|
+
d: "M16 4H9a3 3 0 0 0-2.83 4",
|
|
872
|
+
key: "43sutm"
|
|
873
|
+
}],
|
|
874
|
+
["path", {
|
|
875
|
+
d: "M14 12a4 4 0 0 1 0 8H6",
|
|
876
|
+
key: "nlfj13"
|
|
877
|
+
}],
|
|
878
|
+
["line", {
|
|
879
|
+
x1: "4",
|
|
880
|
+
x2: "20",
|
|
881
|
+
y1: "12",
|
|
882
|
+
y2: "12",
|
|
883
|
+
key: "1e0a9i"
|
|
884
|
+
}]
|
|
885
|
+
]
|
|
886
|
+
},
|
|
887
|
+
Subscript: {
|
|
888
|
+
iconName: "subscript",
|
|
889
|
+
node: [
|
|
890
|
+
["path", {
|
|
891
|
+
d: "m4 5 8 8",
|
|
892
|
+
key: "1eunvl"
|
|
893
|
+
}],
|
|
894
|
+
["path", {
|
|
895
|
+
d: "m12 5-8 8",
|
|
896
|
+
key: "1ah0jp"
|
|
897
|
+
}],
|
|
898
|
+
["path", {
|
|
899
|
+
d: "M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",
|
|
900
|
+
key: "e8ta8j"
|
|
901
|
+
}]
|
|
902
|
+
]
|
|
903
|
+
},
|
|
904
|
+
Superscript: {
|
|
905
|
+
iconName: "superscript",
|
|
906
|
+
node: [
|
|
907
|
+
["path", {
|
|
908
|
+
d: "m4 19 8-8",
|
|
909
|
+
key: "hr47gm"
|
|
910
|
+
}],
|
|
911
|
+
["path", {
|
|
912
|
+
d: "m12 19-8-8",
|
|
913
|
+
key: "1dhhmo"
|
|
914
|
+
}],
|
|
915
|
+
["path", {
|
|
916
|
+
d: "M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",
|
|
917
|
+
key: "1dfcux"
|
|
918
|
+
}]
|
|
919
|
+
]
|
|
920
|
+
},
|
|
921
|
+
Table2: {
|
|
922
|
+
iconName: "table-2",
|
|
923
|
+
node: [["path", {
|
|
924
|
+
d: "M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",
|
|
925
|
+
key: "gugj83"
|
|
926
|
+
}]]
|
|
927
|
+
},
|
|
928
|
+
Text: {
|
|
929
|
+
iconName: "text-align-start",
|
|
930
|
+
node: [
|
|
931
|
+
["path", {
|
|
932
|
+
d: "M21 5H3",
|
|
933
|
+
key: "1fi0y6"
|
|
934
|
+
}],
|
|
935
|
+
["path", {
|
|
936
|
+
d: "M15 12H3",
|
|
937
|
+
key: "6jk70r"
|
|
938
|
+
}],
|
|
939
|
+
["path", {
|
|
940
|
+
d: "M17 19H3",
|
|
941
|
+
key: "z6ezky"
|
|
942
|
+
}]
|
|
943
|
+
]
|
|
944
|
+
},
|
|
945
|
+
Trash2: {
|
|
946
|
+
iconName: "trash-2",
|
|
947
|
+
node: [
|
|
948
|
+
["path", {
|
|
949
|
+
d: "M10 11v6",
|
|
950
|
+
key: "nco0om"
|
|
951
|
+
}],
|
|
952
|
+
["path", {
|
|
953
|
+
d: "M14 11v6",
|
|
954
|
+
key: "outv1u"
|
|
955
|
+
}],
|
|
956
|
+
["path", {
|
|
957
|
+
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",
|
|
958
|
+
key: "miytrc"
|
|
959
|
+
}],
|
|
960
|
+
["path", {
|
|
961
|
+
d: "M3 6h18",
|
|
962
|
+
key: "d0wm0j"
|
|
963
|
+
}],
|
|
964
|
+
["path", {
|
|
965
|
+
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
|
|
966
|
+
key: "e791ji"
|
|
967
|
+
}]
|
|
968
|
+
]
|
|
969
|
+
},
|
|
970
|
+
Type: {
|
|
971
|
+
iconName: "type",
|
|
972
|
+
node: [
|
|
973
|
+
["path", {
|
|
974
|
+
d: "M12 4v16",
|
|
975
|
+
key: "1654pz"
|
|
976
|
+
}],
|
|
977
|
+
["path", {
|
|
978
|
+
d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",
|
|
979
|
+
key: "e0r10z"
|
|
980
|
+
}],
|
|
981
|
+
["path", {
|
|
982
|
+
d: "M9 20h6",
|
|
983
|
+
key: "s66wpe"
|
|
984
|
+
}]
|
|
985
|
+
]
|
|
986
|
+
},
|
|
987
|
+
Underline: {
|
|
988
|
+
iconName: "underline",
|
|
989
|
+
node: [["path", {
|
|
990
|
+
d: "M6 4v6a6 6 0 0 0 12 0V4",
|
|
991
|
+
key: "9kb039"
|
|
992
|
+
}], ["line", {
|
|
993
|
+
x1: "4",
|
|
994
|
+
x2: "20",
|
|
995
|
+
y1: "20",
|
|
996
|
+
y2: "20",
|
|
997
|
+
key: "nun2al"
|
|
998
|
+
}]]
|
|
999
|
+
},
|
|
1000
|
+
Upload: {
|
|
1001
|
+
iconName: "upload",
|
|
1002
|
+
node: [
|
|
1003
|
+
["path", {
|
|
1004
|
+
d: "M12 3v12",
|
|
1005
|
+
key: "1x0j5s"
|
|
1006
|
+
}],
|
|
1007
|
+
["path", {
|
|
1008
|
+
d: "m17 8-5-5-5 5",
|
|
1009
|
+
key: "7q97r8"
|
|
1010
|
+
}],
|
|
1011
|
+
["path", {
|
|
1012
|
+
d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
|
|
1013
|
+
key: "ih7n3h"
|
|
1014
|
+
}]
|
|
1015
|
+
]
|
|
1016
|
+
},
|
|
1017
|
+
Video: {
|
|
1018
|
+
iconName: "video",
|
|
1019
|
+
node: [["path", {
|
|
1020
|
+
d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
|
|
1021
|
+
key: "ftymec"
|
|
1022
|
+
}], ["rect", {
|
|
1023
|
+
x: "2",
|
|
1024
|
+
y: "6",
|
|
1025
|
+
width: "14",
|
|
1026
|
+
height: "12",
|
|
1027
|
+
rx: "2",
|
|
1028
|
+
key: "158x01"
|
|
1029
|
+
}]]
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
function tn(e) {
|
|
1033
|
+
return e.map(([e, t]) => V(e, t));
|
|
1034
|
+
}
|
|
1035
|
+
function Y(e) {
|
|
1036
|
+
return J({
|
|
1037
|
+
name: `MarkweaveVue2Icon${e}`,
|
|
1038
|
+
props: {
|
|
1039
|
+
size: {
|
|
1040
|
+
type: [Number, String],
|
|
1041
|
+
default: 18
|
|
1042
|
+
},
|
|
1043
|
+
strokeWidth: {
|
|
1044
|
+
type: [Number, String],
|
|
1045
|
+
default: 2
|
|
1046
|
+
},
|
|
1047
|
+
absoluteStrokeWidth: {
|
|
1048
|
+
type: Boolean,
|
|
1049
|
+
default: !1
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
setup(t) {
|
|
1053
|
+
let n = en[e];
|
|
1054
|
+
return () => V("svg", {
|
|
1055
|
+
class: `lucide lucide-${n.iconName}`,
|
|
1056
|
+
viewBox: "0 0 24 24",
|
|
1057
|
+
width: t.size,
|
|
1058
|
+
height: t.size,
|
|
1059
|
+
fill: "none",
|
|
1060
|
+
stroke: "currentColor",
|
|
1061
|
+
"stroke-linecap": "round",
|
|
1062
|
+
"stroke-linejoin": "round",
|
|
1063
|
+
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1064
|
+
"aria-hidden": "true",
|
|
1065
|
+
focusable: "false"
|
|
1066
|
+
}, tn(n.node));
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
var nn = Y("AlignCenter"), rn = Y("AlignJustify"), an = Y("AlignLeft"), on = Y("AlignRight"), sn = Y("AlertTriangle"), cn = Y("Bold"), ln = Y("Braces"), un = Y("Captions"), dn = Y("CheckCircle2"), fn = Y("ChevronDown"), pn = Y("ChevronUp"), mn = Y("CircleX"), hn = Y("Code2"), gn = Y("CornerDownLeft"), _n = Y("Download");
|
|
1071
|
+
Y("Eye");
|
|
1072
|
+
var vn = Y("ExternalLink"), yn = Y("Heading1"), bn = Y("Heading2"), xn = Y("Heading3"), Sn = Y("Image"), Cn = Y("ImageUp"), wn = Y("IndentDecrease"), Tn = Y("IndentIncrease"), En = Y("Info"), Dn = Y("Italic"), On = Y("Lightbulb"), kn = Y("Link2"), An = Y("List"), jn = Y("ListChecks"), Mn = Y("ListOrdered"), Nn = Y("Minus"), Pn = Y("MoreVertical"), Fn = Y("Paperclip");
|
|
1073
|
+
Y("PencilLine");
|
|
1074
|
+
var In = Y("Quote"), Ln = Y("Replace"), Rn = Y("Sigma"), zn = Y("SmilePlus"), Bn = Y("Strikethrough"), Vn = Y("Subscript"), Hn = Y("Superscript"), Un = Y("Table2"), Wn = Y("Text"), Gn = Y("Trash2"), Kn = Y("Type"), qn = Y("Underline"), Jn = Y("Upload"), Yn = Y("Video"), Xn = T;
|
|
1075
|
+
function Zn(e) {
|
|
1076
|
+
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1077
|
+
let n = t?.getAttribute("data-markweave-mode");
|
|
1078
|
+
return n === "view" ? {
|
|
1079
|
+
mode: "view",
|
|
1080
|
+
editable: !1
|
|
1081
|
+
} : n === "live" ? {
|
|
1082
|
+
mode: "live",
|
|
1083
|
+
editable: e.isEditable
|
|
1084
|
+
} : s(e);
|
|
1085
|
+
}, r = H(n()), i = d(e, () => {
|
|
1086
|
+
r.value = n();
|
|
1087
|
+
}), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
|
|
1088
|
+
r.value = n();
|
|
1089
|
+
});
|
|
1090
|
+
return a && t && a.observe(t, {
|
|
1091
|
+
attributes: !0,
|
|
1092
|
+
attributeFilter: ["data-markweave-mode"]
|
|
1093
|
+
}), K(() => {
|
|
1094
|
+
i(), a?.disconnect();
|
|
1095
|
+
}), r;
|
|
1096
|
+
}
|
|
1097
|
+
function Qn(e) {
|
|
1098
|
+
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1099
|
+
}
|
|
1100
|
+
function $n(e) {
|
|
1101
|
+
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1102
|
+
}
|
|
1103
|
+
function er(e, t) {
|
|
1104
|
+
return V(e, {
|
|
1105
|
+
size: 18,
|
|
1106
|
+
strokeWidth: 1.8,
|
|
1107
|
+
"aria-hidden": "true"
|
|
1108
|
+
}, { default: () => t });
|
|
1109
|
+
}
|
|
1110
|
+
function X(e) {
|
|
1111
|
+
return V("button", {
|
|
1112
|
+
type: "button",
|
|
1113
|
+
"aria-label": e.label,
|
|
1114
|
+
title: e.label,
|
|
1115
|
+
"data-testid": e.testId,
|
|
1116
|
+
"data-active": e.active ? "true" : "false",
|
|
1117
|
+
onMousedown: (e) => e.preventDefault(),
|
|
1118
|
+
onClick: e.onClick
|
|
1119
|
+
}, [er(e.icon, e.label), V("span", {
|
|
1120
|
+
class: "markweave-image-tooltip",
|
|
1121
|
+
role: "tooltip"
|
|
1122
|
+
}, e.label)]);
|
|
1123
|
+
}
|
|
1124
|
+
function tr(e) {
|
|
1125
|
+
let t = H(null), n = e.messages.image;
|
|
1126
|
+
return V("section", {
|
|
1127
|
+
class: "markweave-image-upload-placeholder",
|
|
1128
|
+
"data-testid": "markweave-image-upload-placeholder",
|
|
1129
|
+
"data-drag-active": e.dragActive ? "true" : "false",
|
|
1130
|
+
"data-markweave-image-ui": "true",
|
|
1131
|
+
onDragenter: (t) => {
|
|
1132
|
+
t.preventDefault(), e.onDragActive(!0);
|
|
1133
|
+
},
|
|
1134
|
+
onDragover: (t) => {
|
|
1135
|
+
t.preventDefault(), e.onDragActive(!0);
|
|
1136
|
+
},
|
|
1137
|
+
onDragleave: () => e.onDragActive(!1),
|
|
1138
|
+
onDrop: (t) => {
|
|
1139
|
+
t.preventDefault(), e.onDragActive(!1);
|
|
1140
|
+
let n = t.dataTransfer?.files[0];
|
|
1141
|
+
n && e.onFile(n);
|
|
1142
|
+
}
|
|
1143
|
+
}, [
|
|
1144
|
+
V("input", {
|
|
1145
|
+
ref: t,
|
|
1146
|
+
"data-testid": "markweave-image-file-input",
|
|
1147
|
+
type: "file",
|
|
1148
|
+
accept: "image/*",
|
|
1149
|
+
hidden: !0,
|
|
1150
|
+
onChange: (t) => {
|
|
1151
|
+
let n = t.target, r = n.files?.[0];
|
|
1152
|
+
r && e.onFile(r), n.value = "";
|
|
1153
|
+
}
|
|
1154
|
+
}),
|
|
1155
|
+
V("div", {
|
|
1156
|
+
class: "markweave-image-upload-icon",
|
|
1157
|
+
"aria-hidden": "true"
|
|
1158
|
+
}, [V(Cn, {
|
|
1159
|
+
size: 46,
|
|
1160
|
+
strokeWidth: 1.6
|
|
1161
|
+
})]),
|
|
1162
|
+
V("div", { class: "markweave-image-upload-copy" }, [V("button", {
|
|
1163
|
+
type: "button",
|
|
1164
|
+
onClick: () => t.value?.click()
|
|
1165
|
+
}, n.clickToUpload), V("span", null, n.dragAndDrop)]),
|
|
1166
|
+
V("div", { class: "markweave-image-upload-note" }, n.uploadNote),
|
|
1167
|
+
V("div", { class: "markweave-image-upload-row" }, [
|
|
1168
|
+
V("input", {
|
|
1169
|
+
"data-testid": "markweave-image-url-input",
|
|
1170
|
+
value: e.inputValue,
|
|
1171
|
+
placeholder: n.uploadInputPlaceholder,
|
|
1172
|
+
"aria-label": n.uploadInputAriaLabel,
|
|
1173
|
+
onInput: (t) => e.onInputValue(t.target.value),
|
|
1174
|
+
onKeydown: (t) => {
|
|
1175
|
+
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1176
|
+
}
|
|
1177
|
+
}),
|
|
1178
|
+
V("button", {
|
|
1179
|
+
type: "button",
|
|
1180
|
+
"data-testid": "markweave-image-upload-submit",
|
|
1181
|
+
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1182
|
+
onClick: e.onSubmit
|
|
1183
|
+
}, [V(Cn, {
|
|
1184
|
+
size: 16,
|
|
1185
|
+
strokeWidth: 1.8
|
|
1186
|
+
}), e.messages.common.insert]),
|
|
1187
|
+
V("button", {
|
|
1188
|
+
type: "button",
|
|
1189
|
+
"data-testid": "markweave-image-upload-cancel",
|
|
1190
|
+
onClick: e.onCancel
|
|
1191
|
+
}, e.messages.common.cancel)
|
|
1192
|
+
]),
|
|
1193
|
+
e.error ? V("div", {
|
|
1194
|
+
class: "markweave-image-upload-error",
|
|
1195
|
+
role: "alert"
|
|
1196
|
+
}, e.error) : null
|
|
1197
|
+
]);
|
|
1198
|
+
}
|
|
1199
|
+
function nr(e) {
|
|
1200
|
+
let t = H(null), n = e.messages.video;
|
|
1201
|
+
return V("section", {
|
|
1202
|
+
class: "markweave-video-upload-placeholder",
|
|
1203
|
+
"data-testid": "markweave-video-upload-placeholder",
|
|
1204
|
+
"data-drag-active": e.dragActive ? "true" : "false",
|
|
1205
|
+
"data-markweave-video-ui": "true",
|
|
1206
|
+
onDragenter: (t) => {
|
|
1207
|
+
t.preventDefault(), e.onDragActive(!0);
|
|
1208
|
+
},
|
|
1209
|
+
onDragover: (t) => {
|
|
1210
|
+
t.preventDefault(), e.onDragActive(!0);
|
|
1211
|
+
},
|
|
1212
|
+
onDragleave: () => e.onDragActive(!1),
|
|
1213
|
+
onDrop: (t) => {
|
|
1214
|
+
t.preventDefault(), e.onDragActive(!1);
|
|
1215
|
+
let n = t.dataTransfer?.files[0];
|
|
1216
|
+
n && e.onFile(n);
|
|
1217
|
+
}
|
|
1218
|
+
}, [
|
|
1219
|
+
V("input", {
|
|
1220
|
+
ref: t,
|
|
1221
|
+
"data-testid": "markweave-video-file-input",
|
|
1222
|
+
type: "file",
|
|
1223
|
+
accept: "video/*",
|
|
1224
|
+
hidden: !0,
|
|
1225
|
+
onChange: (t) => {
|
|
1226
|
+
let n = t.target, r = n.files?.[0];
|
|
1227
|
+
r && e.onFile(r), n.value = "";
|
|
1228
|
+
}
|
|
1229
|
+
}),
|
|
1230
|
+
V("div", {
|
|
1231
|
+
class: "markweave-video-upload-icon",
|
|
1232
|
+
"aria-hidden": "true"
|
|
1233
|
+
}, [V(Yn, {
|
|
1234
|
+
size: 46,
|
|
1235
|
+
strokeWidth: 1.6
|
|
1236
|
+
})]),
|
|
1237
|
+
V("div", { class: "markweave-video-upload-copy" }, [V("button", {
|
|
1238
|
+
type: "button",
|
|
1239
|
+
onClick: () => t.value?.click()
|
|
1240
|
+
}, n.clickToUpload), V("span", null, n.dragAndDrop)]),
|
|
1241
|
+
V("div", { class: "markweave-video-upload-note" }, n.uploadNote),
|
|
1242
|
+
V("div", { class: "markweave-video-upload-row" }, [
|
|
1243
|
+
V("input", {
|
|
1244
|
+
"data-testid": "markweave-video-url-input",
|
|
1245
|
+
value: e.inputValue,
|
|
1246
|
+
placeholder: n.uploadInputPlaceholder,
|
|
1247
|
+
"aria-label": n.uploadInputAriaLabel,
|
|
1248
|
+
onInput: (t) => e.onInputValue(t.target.value),
|
|
1249
|
+
onKeydown: (t) => {
|
|
1250
|
+
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1251
|
+
}
|
|
1252
|
+
}),
|
|
1253
|
+
V("button", {
|
|
1254
|
+
type: "button",
|
|
1255
|
+
"data-testid": "markweave-video-upload-submit",
|
|
1256
|
+
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1257
|
+
onClick: e.onSubmit
|
|
1258
|
+
}, [V(Jn, {
|
|
1259
|
+
size: 16,
|
|
1260
|
+
strokeWidth: 1.8
|
|
1261
|
+
}), e.messages.common.insert]),
|
|
1262
|
+
V("button", {
|
|
1263
|
+
type: "button",
|
|
1264
|
+
"data-testid": "markweave-video-upload-cancel",
|
|
1265
|
+
onClick: e.onCancel
|
|
1266
|
+
}, e.messages.common.cancel)
|
|
1267
|
+
]),
|
|
1268
|
+
e.error ? V("div", {
|
|
1269
|
+
class: "markweave-video-upload-error",
|
|
1270
|
+
role: "alert"
|
|
1271
|
+
}, e.error) : null
|
|
1272
|
+
]);
|
|
1273
|
+
}
|
|
1274
|
+
var rr = J({
|
|
1275
|
+
name: "MarkweaveVueImageNodeView",
|
|
1276
|
+
props: {
|
|
1277
|
+
editor: {
|
|
1278
|
+
type: Object,
|
|
1279
|
+
required: !0
|
|
1280
|
+
},
|
|
1281
|
+
node: {
|
|
1282
|
+
type: Object,
|
|
1283
|
+
required: !0
|
|
1284
|
+
},
|
|
1285
|
+
selected: {
|
|
1286
|
+
type: Boolean,
|
|
1287
|
+
required: !0
|
|
1288
|
+
},
|
|
1289
|
+
extension: {
|
|
1290
|
+
type: Object,
|
|
1291
|
+
required: !0
|
|
1292
|
+
},
|
|
1293
|
+
getPos: {
|
|
1294
|
+
type: Function,
|
|
1295
|
+
required: !0
|
|
1296
|
+
},
|
|
1297
|
+
updateAttributes: {
|
|
1298
|
+
type: Function,
|
|
1299
|
+
required: !0
|
|
1300
|
+
},
|
|
1301
|
+
deleteNode: {
|
|
1302
|
+
type: Function,
|
|
1303
|
+
required: !0
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
setup(e) {
|
|
1307
|
+
let t = H(null), n = H(!1), r = H(!1), a = H(!1), o = H(""), s = H(null), l = H(!1), u = W(() => e.node.attrs), d = H(!!O(u.value.caption)), f = H(O(u.value.caption) ?? ""), m = Zn(e.editor), h = W(() => c(m.value)), g = W(() => e.extension.options?.messages ?? p("zh")), v = W(() => g.value.image), y = W(() => O(u.value.src)), S = W(() => Xn(u.value.align)), w = W(() => D(u.value.width)), T = W(() => O(u.value.caption)), E = W(() => h.value && (!y.value || r.value));
|
|
1308
|
+
G(T, (e) => {
|
|
1309
|
+
d.value || (f.value = e ?? "");
|
|
1310
|
+
});
|
|
1311
|
+
let A = () => {
|
|
1312
|
+
if (!h.value) return;
|
|
1313
|
+
let t = e.getPos();
|
|
1314
|
+
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1315
|
+
}, M = () => {
|
|
1316
|
+
if (o.value = "", s.value = null, a.value = !1, y.value) {
|
|
1317
|
+
r.value = !1;
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
e.deleteNode();
|
|
1321
|
+
}, N = async (t) => {
|
|
1322
|
+
if (!h.value) return;
|
|
1323
|
+
let n = e.extension.options;
|
|
1324
|
+
l.value = !0, s.value = null;
|
|
1325
|
+
try {
|
|
1326
|
+
let i = await j(x(t, y.value && r.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1327
|
+
e.updateAttributes(_(u.value, i)), o.value = "", r.value = !1;
|
|
1328
|
+
} catch (e) {
|
|
1329
|
+
s.value = e instanceof Error ? e.message : v.value.uploadFailedError;
|
|
1330
|
+
} finally {
|
|
1331
|
+
l.value = !1, a.value = !1;
|
|
1332
|
+
}
|
|
1333
|
+
}, ee = () => {
|
|
1334
|
+
if (!o.value.trim()) {
|
|
1335
|
+
s.value = v.value.uploadRequiredError;
|
|
1336
|
+
return;
|
|
1337
|
+
}
|
|
1338
|
+
N(k(o.value));
|
|
1339
|
+
}, P = (e) => {
|
|
1340
|
+
N({
|
|
1341
|
+
type: "file",
|
|
1342
|
+
file: e,
|
|
1343
|
+
mimeType: e.type || "image/*"
|
|
1344
|
+
});
|
|
1345
|
+
}, te = () => {
|
|
1346
|
+
d.value = !d.value, d.value && (f.value = T.value ?? "");
|
|
1347
|
+
}, F = (n, r) => {
|
|
1348
|
+
if (!h.value || !y.value) return;
|
|
1349
|
+
r.preventDefault(), r.stopPropagation(), A();
|
|
1350
|
+
let i = t.value;
|
|
1351
|
+
if (!i) return;
|
|
1352
|
+
let a = r.clientX, o = i.getBoundingClientRect().width || w.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
|
|
1353
|
+
let r = n === "right" ? t.clientX - a : a - t.clientX;
|
|
1354
|
+
e.updateAttributes({ width: b(o + r, s) });
|
|
1355
|
+
}, l = () => {
|
|
1356
|
+
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
|
|
1357
|
+
};
|
|
1358
|
+
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1359
|
+
};
|
|
1360
|
+
return () => E.value ? V(i, {
|
|
1361
|
+
as: "figure",
|
|
1362
|
+
class: "markweave-image-node",
|
|
1363
|
+
"data-testid": "markweave-image-node",
|
|
1364
|
+
"data-align": S.value,
|
|
1365
|
+
"data-selected": "false",
|
|
1366
|
+
"data-hovered": "false",
|
|
1367
|
+
"data-empty": "true"
|
|
1368
|
+
}, () => tr({
|
|
1369
|
+
messages: g.value,
|
|
1370
|
+
inputValue: o.value,
|
|
1371
|
+
error: s.value,
|
|
1372
|
+
dragActive: a.value,
|
|
1373
|
+
isSubmitting: l.value,
|
|
1374
|
+
onInputValue: (e) => {
|
|
1375
|
+
o.value = e;
|
|
1376
|
+
},
|
|
1377
|
+
onFile: P,
|
|
1378
|
+
onSubmit: ee,
|
|
1379
|
+
onCancel: M,
|
|
1380
|
+
onDragActive: (e) => {
|
|
1381
|
+
a.value = e;
|
|
1382
|
+
}
|
|
1383
|
+
})) : V(i, {
|
|
1384
|
+
as: "figure",
|
|
1385
|
+
class: "markweave-image-node",
|
|
1386
|
+
"data-testid": "markweave-image-node",
|
|
1387
|
+
"data-align": S.value,
|
|
1388
|
+
"data-selected": h.value && e.selected ? "true" : "false",
|
|
1389
|
+
"data-hovered": h.value && n.value ? "true" : "false",
|
|
1390
|
+
"data-empty": "false",
|
|
1391
|
+
onMouseenter: () => {
|
|
1392
|
+
n.value = !0;
|
|
1393
|
+
},
|
|
1394
|
+
onMouseleave: () => {
|
|
1395
|
+
n.value = !1;
|
|
1396
|
+
},
|
|
1397
|
+
onMousedown: (e) => {
|
|
1398
|
+
h.value && !Qn(e.target) && A();
|
|
1399
|
+
}
|
|
1400
|
+
}, () => [
|
|
1401
|
+
h.value ? V("div", {
|
|
1402
|
+
class: "markweave-image-toolbar",
|
|
1403
|
+
"data-testid": "markweave-image-toolbar",
|
|
1404
|
+
"data-markweave-image-ui": "true",
|
|
1405
|
+
"aria-label": v.value.toolsAriaLabel
|
|
1406
|
+
}, [
|
|
1407
|
+
X({
|
|
1408
|
+
testId: "markweave-image-align-left",
|
|
1409
|
+
label: v.value.alignLeft,
|
|
1410
|
+
icon: an,
|
|
1411
|
+
active: S.value === "left",
|
|
1412
|
+
onClick: () => e.updateAttributes({ align: "left" })
|
|
1413
|
+
}),
|
|
1414
|
+
X({
|
|
1415
|
+
testId: "markweave-image-align-center",
|
|
1416
|
+
label: v.value.alignCenter,
|
|
1417
|
+
icon: nn,
|
|
1418
|
+
active: S.value === "center",
|
|
1419
|
+
onClick: () => e.updateAttributes({ align: "center" })
|
|
1420
|
+
}),
|
|
1421
|
+
X({
|
|
1422
|
+
testId: "markweave-image-align-right",
|
|
1423
|
+
label: v.value.alignRight,
|
|
1424
|
+
icon: on,
|
|
1425
|
+
active: S.value === "right",
|
|
1426
|
+
onClick: () => e.updateAttributes({ align: "right" })
|
|
1427
|
+
}),
|
|
1428
|
+
V("span", {
|
|
1429
|
+
class: "markweave-image-toolbar-divider",
|
|
1430
|
+
"aria-hidden": "true"
|
|
1431
|
+
}),
|
|
1432
|
+
X({
|
|
1433
|
+
testId: "markweave-image-caption",
|
|
1434
|
+
label: v.value.caption,
|
|
1435
|
+
icon: un,
|
|
1436
|
+
active: d.value || !!T.value,
|
|
1437
|
+
onClick: te
|
|
1438
|
+
}),
|
|
1439
|
+
X({
|
|
1440
|
+
testId: "markweave-image-download",
|
|
1441
|
+
label: v.value.download,
|
|
1442
|
+
icon: _n,
|
|
1443
|
+
onClick: () => {
|
|
1444
|
+
y.value && C(y.value);
|
|
1445
|
+
}
|
|
1446
|
+
}),
|
|
1447
|
+
X({
|
|
1448
|
+
testId: "markweave-image-replace",
|
|
1449
|
+
label: v.value.replace,
|
|
1450
|
+
icon: Ln,
|
|
1451
|
+
onClick: () => {
|
|
1452
|
+
o.value = "", s.value = null, r.value = !0;
|
|
1453
|
+
}
|
|
1454
|
+
}),
|
|
1455
|
+
V("span", {
|
|
1456
|
+
class: "markweave-image-toolbar-divider",
|
|
1457
|
+
"aria-hidden": "true"
|
|
1458
|
+
}),
|
|
1459
|
+
X({
|
|
1460
|
+
testId: "markweave-image-delete",
|
|
1461
|
+
label: v.value.delete,
|
|
1462
|
+
icon: Gn,
|
|
1463
|
+
onClick: () => e.deleteNode()
|
|
1464
|
+
})
|
|
1465
|
+
]) : null,
|
|
1466
|
+
V("div", {
|
|
1467
|
+
ref: t,
|
|
1468
|
+
class: "markweave-image-box",
|
|
1469
|
+
style: w.value ? { width: `${Math.round(w.value)}px` } : void 0
|
|
1470
|
+
}, [
|
|
1471
|
+
y.value ? V("img", {
|
|
1472
|
+
class: "markweave-image",
|
|
1473
|
+
src: y.value,
|
|
1474
|
+
alt: O(u.value.alt) ?? "",
|
|
1475
|
+
title: O(u.value.title) ?? void 0,
|
|
1476
|
+
draggable: !1
|
|
1477
|
+
}) : V("div", {
|
|
1478
|
+
class: "markweave-image-readonly-empty",
|
|
1479
|
+
"data-testid": "markweave-image-readonly-empty",
|
|
1480
|
+
"aria-hidden": "true"
|
|
1481
|
+
}),
|
|
1482
|
+
h.value ? V("button", {
|
|
1483
|
+
type: "button",
|
|
1484
|
+
class: "markweave-image-resize-handle",
|
|
1485
|
+
"data-testid": "markweave-image-resize-left",
|
|
1486
|
+
"data-side": "left",
|
|
1487
|
+
"aria-label": v.value.resizeLeft,
|
|
1488
|
+
"data-markweave-image-ui": "true",
|
|
1489
|
+
onPointerdown: (e) => F("left", e)
|
|
1490
|
+
}) : null,
|
|
1491
|
+
h.value ? V("button", {
|
|
1492
|
+
type: "button",
|
|
1493
|
+
class: "markweave-image-resize-handle",
|
|
1494
|
+
"data-testid": "markweave-image-resize-right",
|
|
1495
|
+
"data-side": "right",
|
|
1496
|
+
"aria-label": v.value.resizeRight,
|
|
1497
|
+
"data-markweave-image-ui": "true",
|
|
1498
|
+
onPointerdown: (e) => F("right", e)
|
|
1499
|
+
}) : null
|
|
1500
|
+
]),
|
|
1501
|
+
h.value && (d.value || T.value) ? V("input", {
|
|
1502
|
+
class: "markweave-image-caption-input",
|
|
1503
|
+
"data-testid": "markweave-image-caption-input",
|
|
1504
|
+
"data-markweave-image-ui": "true",
|
|
1505
|
+
value: f.value,
|
|
1506
|
+
placeholder: v.value.captionPlaceholder,
|
|
1507
|
+
"aria-label": v.value.captionAriaLabel,
|
|
1508
|
+
onInput: (t) => {
|
|
1509
|
+
f.value = t.target.value, e.updateAttributes({ caption: f.value.trim() ? f.value : null });
|
|
1510
|
+
},
|
|
1511
|
+
onKeydown: (e) => {
|
|
1512
|
+
e.key === "Escape" && (e.preventDefault(), d.value = !1);
|
|
1513
|
+
}
|
|
1514
|
+
}) : T.value ? V("figcaption", {
|
|
1515
|
+
class: "markweave-image-caption",
|
|
1516
|
+
"data-testid": "markweave-image-caption"
|
|
1517
|
+
}, T.value) : null
|
|
1518
|
+
]);
|
|
1519
|
+
}
|
|
1520
|
+
}), ir = J({
|
|
1521
|
+
name: "MarkweaveVueVideoNodeView",
|
|
1522
|
+
props: {
|
|
1523
|
+
editor: {
|
|
1524
|
+
type: Object,
|
|
1525
|
+
required: !0
|
|
1526
|
+
},
|
|
1527
|
+
node: {
|
|
1528
|
+
type: Object,
|
|
1529
|
+
required: !0
|
|
1530
|
+
},
|
|
1531
|
+
selected: {
|
|
1532
|
+
type: Boolean,
|
|
1533
|
+
required: !0
|
|
1534
|
+
},
|
|
1535
|
+
extension: {
|
|
1536
|
+
type: Object,
|
|
1537
|
+
required: !0
|
|
1538
|
+
},
|
|
1539
|
+
getPos: {
|
|
1540
|
+
type: Function,
|
|
1541
|
+
required: !0
|
|
1542
|
+
},
|
|
1543
|
+
updateAttributes: {
|
|
1544
|
+
type: Function,
|
|
1545
|
+
required: !0
|
|
1546
|
+
},
|
|
1547
|
+
deleteNode: {
|
|
1548
|
+
type: Function,
|
|
1549
|
+
required: !0
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
setup(e) {
|
|
1553
|
+
let t = H(!1), n = H(""), r = H(null), a = H(!1), o = Zn(e.editor), s = W(() => c(o.value)), l = W(() => e.extension.options?.messages ?? p("zh")), u = W(() => l.value.video), d = W(() => e.node.attrs), f = W(() => O(d.value.src)), m = W(() => O(d.value.embedUrl)), h = W(() => O(d.value.provider)), g = W(() => m.value ? E(m.value, h.value) : null), _ = W(() => O(d.value.mimeType)), b = W(() => O(d.value.title)), x = () => {
|
|
1554
|
+
f.value || e.deleteNode(), n.value = "", r.value = null, t.value = !1;
|
|
1555
|
+
}, C = async (i) => {
|
|
1556
|
+
if (!s.value) return;
|
|
1557
|
+
let o = e.extension.options;
|
|
1558
|
+
a.value = !0, r.value = null;
|
|
1559
|
+
try {
|
|
1560
|
+
let t = await j(S(i), o?.onUpload);
|
|
1561
|
+
e.updateAttributes(v(t)), n.value = "";
|
|
1562
|
+
} catch (e) {
|
|
1563
|
+
r.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
1564
|
+
} finally {
|
|
1565
|
+
a.value = !1, t.value = !1;
|
|
1566
|
+
}
|
|
1567
|
+
}, T = () => {
|
|
1568
|
+
if (!s.value) return;
|
|
1569
|
+
let t = y(n.value);
|
|
1570
|
+
if (!t) {
|
|
1571
|
+
r.value = u.value.unsupportedUrlError;
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
r.value = null, e.updateAttributes(t), n.value = "";
|
|
1575
|
+
}, D = (e) => {
|
|
1576
|
+
C({
|
|
1577
|
+
type: "file",
|
|
1578
|
+
file: e,
|
|
1579
|
+
mimeType: e.type || "video/*"
|
|
1580
|
+
});
|
|
1581
|
+
}, k = () => {
|
|
1582
|
+
if (!s.value) return;
|
|
1583
|
+
let t = e.getPos();
|
|
1584
|
+
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1585
|
+
}, A = (t) => {
|
|
1586
|
+
s.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
1587
|
+
};
|
|
1588
|
+
return () => s.value && !f.value ? V(i, {
|
|
1589
|
+
as: "figure",
|
|
1590
|
+
class: "markweave-video-node",
|
|
1591
|
+
"data-testid": "markweave-video-node",
|
|
1592
|
+
"data-empty": "true",
|
|
1593
|
+
"data-selected": "false"
|
|
1594
|
+
}, () => nr({
|
|
1595
|
+
messages: l.value,
|
|
1596
|
+
inputValue: n.value,
|
|
1597
|
+
error: r.value,
|
|
1598
|
+
dragActive: t.value,
|
|
1599
|
+
isSubmitting: a.value,
|
|
1600
|
+
onInputValue: (e) => {
|
|
1601
|
+
n.value = e;
|
|
1602
|
+
},
|
|
1603
|
+
onFile: D,
|
|
1604
|
+
onSubmit: T,
|
|
1605
|
+
onCancel: x,
|
|
1606
|
+
onDragActive: (e) => {
|
|
1607
|
+
t.value = e;
|
|
1608
|
+
}
|
|
1609
|
+
})) : V(i, {
|
|
1610
|
+
as: "figure",
|
|
1611
|
+
class: "markweave-video-node",
|
|
1612
|
+
"data-testid": "markweave-video-node",
|
|
1613
|
+
"data-provider": h.value ?? "file",
|
|
1614
|
+
"data-empty": f.value ? "false" : "true",
|
|
1615
|
+
"data-selected": s.value && e.selected ? "true" : "false",
|
|
1616
|
+
"aria-label": u.value.nodeAriaLabel,
|
|
1617
|
+
tabindex: s.value ? 0 : void 0,
|
|
1618
|
+
onFocus: k,
|
|
1619
|
+
onKeydown: A,
|
|
1620
|
+
onMousedown: (e) => {
|
|
1621
|
+
s.value && !$n(e.target) && (e.preventDefault(), k());
|
|
1622
|
+
}
|
|
1623
|
+
}, () => [g.value ? V("div", { class: "markweave-video-embed" }, [V("iframe", {
|
|
1624
|
+
class: "markweave-video-iframe",
|
|
1625
|
+
src: g.value,
|
|
1626
|
+
title: b.value ?? `${h.value ?? "Video"} embed`,
|
|
1627
|
+
"data-markweave-video-embed": "true",
|
|
1628
|
+
"data-markweave-video-provider": h.value ?? void 0,
|
|
1629
|
+
"data-markweave-video-src": f.value ?? void 0,
|
|
1630
|
+
allow: w,
|
|
1631
|
+
allowfullscreen: "true"
|
|
1632
|
+
}), s.value ? V("button", {
|
|
1633
|
+
type: "button",
|
|
1634
|
+
class: "markweave-video-selection-layer",
|
|
1635
|
+
"data-testid": "markweave-video-selection-layer",
|
|
1636
|
+
tabindex: -1,
|
|
1637
|
+
"aria-label": u.value.selectAriaLabel
|
|
1638
|
+
}) : null]) : f.value ? V("div", { class: "markweave-video-box" }, [V("video", {
|
|
1639
|
+
class: "markweave-video",
|
|
1640
|
+
src: f.value,
|
|
1641
|
+
title: b.value ?? void 0,
|
|
1642
|
+
controls: !0,
|
|
1643
|
+
"data-markweave-video": "true",
|
|
1644
|
+
"data-markweave-mime-type": _.value ?? void 0
|
|
1645
|
+
}), s.value ? V("button", {
|
|
1646
|
+
type: "button",
|
|
1647
|
+
class: "markweave-video-selection-layer",
|
|
1648
|
+
"data-testid": "markweave-video-selection-layer",
|
|
1649
|
+
tabindex: -1,
|
|
1650
|
+
"aria-label": u.value.selectAriaLabel
|
|
1651
|
+
}) : null]) : V("div", {
|
|
1652
|
+
class: "markweave-video-readonly-empty",
|
|
1653
|
+
"data-testid": "markweave-video-readonly-empty",
|
|
1654
|
+
"aria-hidden": "true"
|
|
1655
|
+
})]);
|
|
1656
|
+
}
|
|
1657
|
+
}), ar = h.extend({
|
|
1658
|
+
addOptions() {
|
|
1659
|
+
return {
|
|
1660
|
+
...this.parent?.(),
|
|
1661
|
+
messages: p("zh"),
|
|
1662
|
+
onUpload: void 0
|
|
1663
|
+
};
|
|
1664
|
+
},
|
|
1665
|
+
addNodeView() {
|
|
1666
|
+
return typeof document > "u" ? null : a(rr, { stopEvent: ({ event: e }) => Qn(e.target) });
|
|
1667
|
+
}
|
|
1668
|
+
}), or = g.extend({
|
|
1669
|
+
addOptions() {
|
|
1670
|
+
return {
|
|
1671
|
+
...this.parent?.(),
|
|
1672
|
+
messages: p("zh"),
|
|
1673
|
+
onUpload: void 0
|
|
1674
|
+
};
|
|
1675
|
+
},
|
|
1676
|
+
addNodeView() {
|
|
1677
|
+
return typeof document > "u" ? null : a(ir, { stopEvent: ({ event: e }) => $n(e.target) });
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
//#endregion
|
|
1681
|
+
//#region src/create-editor-extensions.ts
|
|
1682
|
+
function sr(n = {}) {
|
|
1683
|
+
return e({
|
|
1684
|
+
lang: n.lang,
|
|
1685
|
+
mediaExtensions: t({
|
|
1686
|
+
image: ar,
|
|
1687
|
+
video: or,
|
|
1688
|
+
lang: n.lang,
|
|
1689
|
+
onImageUpload: n.onImageUpload,
|
|
1690
|
+
onVideoUpload: n.onVideoUpload
|
|
1691
|
+
})
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
//#endregion
|
|
1695
|
+
//#region src/MarkweaveEditor.ts
|
|
1696
|
+
var cr = {
|
|
1697
|
+
active: !1,
|
|
1698
|
+
mode: "outside",
|
|
1699
|
+
activeCellPos: null,
|
|
1700
|
+
anchorCellPos: null,
|
|
1701
|
+
selectedCellCount: 0,
|
|
1702
|
+
selectionFrom: 0,
|
|
1703
|
+
selectionTo: 0
|
|
1704
|
+
}, lr = {
|
|
1705
|
+
active: !1,
|
|
1706
|
+
language: ve.defaultLanguage,
|
|
1707
|
+
mermaidPreviewMode: "code",
|
|
1708
|
+
pos: null,
|
|
1709
|
+
text: ""
|
|
1710
|
+
};
|
|
1711
|
+
function ur(e) {
|
|
1712
|
+
return St.getState(e.state) ?? xt;
|
|
1713
|
+
}
|
|
1714
|
+
function dr(e) {
|
|
1715
|
+
if (!e || typeof window > "u") return null;
|
|
1716
|
+
let t = e.parentElement;
|
|
1717
|
+
for (; t;) {
|
|
1718
|
+
let e = window.getComputedStyle(t), n = `${e.overflow} ${e.overflowY}`;
|
|
1719
|
+
if (/(auto|scroll|overlay)/.test(n) && t.scrollHeight > t.clientHeight) return t;
|
|
1720
|
+
t = t.parentElement;
|
|
1721
|
+
}
|
|
1722
|
+
return null;
|
|
1723
|
+
}
|
|
1724
|
+
function Z(e, t, n = 18, r = 1.8) {
|
|
1725
|
+
return V(e, {
|
|
1726
|
+
size: n,
|
|
1727
|
+
strokeWidth: r,
|
|
1728
|
+
"aria-hidden": "true"
|
|
1729
|
+
}, { default: () => t });
|
|
1730
|
+
}
|
|
1731
|
+
function fr(e) {
|
|
1732
|
+
return e === "clipboard" ? [V("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" }), V("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" ? [V("circle", {
|
|
1733
|
+
cx: "10",
|
|
1734
|
+
cy: "10",
|
|
1735
|
+
r: "5.5"
|
|
1736
|
+
}), V("path", { d: "m14 14 4 4" })] : e === "check" ? [V("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
|
|
1737
|
+
V("path", { d: "M8 4H4v4" }),
|
|
1738
|
+
V("path", { d: "M4 4l5 5" }),
|
|
1739
|
+
V("path", { d: "M16 4h4v4" }),
|
|
1740
|
+
V("path", { d: "m20 4-5 5" }),
|
|
1741
|
+
V("path", { d: "M8 20H4v-4" }),
|
|
1742
|
+
V("path", { d: "m4 20 5-5" }),
|
|
1743
|
+
V("path", { d: "M16 20h4v-4" }),
|
|
1744
|
+
V("path", { d: "m20 20-5-5" })
|
|
1745
|
+
] : e === "download" ? [
|
|
1746
|
+
V("path", { d: "M12 4v10" }),
|
|
1747
|
+
V("path", { d: "m8 10 4 4 4-4" }),
|
|
1748
|
+
V("path", { d: "M5 19h14" })
|
|
1749
|
+
] : e === "close" ? [V("path", { d: "M6 6l12 12" }), V("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
|
|
1750
|
+
V("circle", {
|
|
1751
|
+
cx: "10",
|
|
1752
|
+
cy: "10",
|
|
1753
|
+
r: "5.25"
|
|
1754
|
+
}),
|
|
1755
|
+
V("path", { d: "M7.5 10h5" }),
|
|
1756
|
+
V("path", { d: "m14 14 4 4" })
|
|
1757
|
+
] : e === "zoomIn" ? [
|
|
1758
|
+
V("circle", {
|
|
1759
|
+
cx: "10",
|
|
1760
|
+
cy: "10",
|
|
1761
|
+
r: "5.25"
|
|
1762
|
+
}),
|
|
1763
|
+
V("path", { d: "M7.5 10h5" }),
|
|
1764
|
+
V("path", { d: "M10 7.5v5" }),
|
|
1765
|
+
V("path", { d: "m14 14 4 4" })
|
|
1766
|
+
] : e === "reset" ? [V("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), V("path", { d: "M6.5 8.5H3.5v-3" })] : [V("path", { d: "m6 9 6 6 6-6" })];
|
|
1767
|
+
}
|
|
1768
|
+
function Q(e) {
|
|
1769
|
+
return V("svg", {
|
|
1770
|
+
viewBox: "0 0 24 24",
|
|
1771
|
+
"aria-hidden": "true",
|
|
1772
|
+
focusable: "false"
|
|
1773
|
+
}, V("g", {
|
|
1774
|
+
fill: "none",
|
|
1775
|
+
stroke: "currentColor",
|
|
1776
|
+
"stroke-linecap": "round",
|
|
1777
|
+
"stroke-linejoin": "round",
|
|
1778
|
+
"stroke-width": "1.8"
|
|
1779
|
+
}, fr(e)));
|
|
1780
|
+
}
|
|
1781
|
+
function $(e) {
|
|
1782
|
+
e.preventDefault();
|
|
1783
|
+
}
|
|
1784
|
+
function pr(e) {
|
|
1785
|
+
let t = We(e);
|
|
1786
|
+
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
1787
|
+
}
|
|
1788
|
+
var mr = {
|
|
1789
|
+
bold: cn,
|
|
1790
|
+
italic: Dn,
|
|
1791
|
+
underline: qn,
|
|
1792
|
+
strike: Bn,
|
|
1793
|
+
"inline-code": hn,
|
|
1794
|
+
link: kn,
|
|
1795
|
+
more: Pn,
|
|
1796
|
+
superscript: Hn,
|
|
1797
|
+
subscript: Vn,
|
|
1798
|
+
"inline-math": Rn,
|
|
1799
|
+
"align-left": an,
|
|
1800
|
+
"align-center": nn,
|
|
1801
|
+
"align-right": on,
|
|
1802
|
+
"align-justify": rn,
|
|
1803
|
+
"decrease-indent": wn,
|
|
1804
|
+
"increase-indent": Tn
|
|
1805
|
+
}, hr = {
|
|
1806
|
+
type: Wn,
|
|
1807
|
+
"heading-1": yn,
|
|
1808
|
+
"heading-2": bn,
|
|
1809
|
+
"heading-3": xn,
|
|
1810
|
+
"bullet-list": An,
|
|
1811
|
+
"ordered-list": Mn,
|
|
1812
|
+
"task-list": jn,
|
|
1813
|
+
blockquote: In,
|
|
1814
|
+
"code-block": ln,
|
|
1815
|
+
info: En,
|
|
1816
|
+
tip: On,
|
|
1817
|
+
warning: sn,
|
|
1818
|
+
error: mn,
|
|
1819
|
+
success: dn,
|
|
1820
|
+
emoji: zn,
|
|
1821
|
+
math: Rn,
|
|
1822
|
+
table: Un,
|
|
1823
|
+
separator: Nn,
|
|
1824
|
+
image: Sn,
|
|
1825
|
+
video: Yn,
|
|
1826
|
+
attachment: Fn
|
|
1827
|
+
};
|
|
1828
|
+
function gr(e) {
|
|
1829
|
+
let t = hr[e];
|
|
1830
|
+
return V(t, {
|
|
1831
|
+
size: 18,
|
|
1832
|
+
strokeWidth: 1.6,
|
|
1833
|
+
absoluteStrokeWidth: !0,
|
|
1834
|
+
"aria-hidden": "true"
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
var _r = {
|
|
1838
|
+
paragraph: Kn,
|
|
1839
|
+
"heading-1": yn,
|
|
1840
|
+
"heading-2": bn,
|
|
1841
|
+
"heading-3": xn,
|
|
1842
|
+
"bullet-list": An,
|
|
1843
|
+
"numbered-list": Mn,
|
|
1844
|
+
"todo-list": jn,
|
|
1845
|
+
quote: In,
|
|
1846
|
+
"code-block": ln
|
|
1847
|
+
};
|
|
1848
|
+
function vr(e, t) {
|
|
1849
|
+
return I(e, t).label;
|
|
1850
|
+
}
|
|
1851
|
+
var yr = J({
|
|
1852
|
+
name: "MarkweaveVueFloatingToolbar",
|
|
1853
|
+
props: {
|
|
1854
|
+
editor: {
|
|
1855
|
+
type: Object,
|
|
1856
|
+
required: !0
|
|
1857
|
+
},
|
|
1858
|
+
messages: {
|
|
1859
|
+
type: Object,
|
|
1860
|
+
required: !0
|
|
1861
|
+
},
|
|
1862
|
+
onRewriteSelection: {
|
|
1863
|
+
type: Function,
|
|
1864
|
+
default: void 0
|
|
1865
|
+
}
|
|
1866
|
+
},
|
|
1867
|
+
setup(e) {
|
|
1868
|
+
let t = H(null), n = H(""), r = H(null), i = H(null), a = H(null), o = W(() => We(n.value.trim())), s = W(() => e.messages.floatingToolbar), c = W(() => re(e.messages).map((e) => [
|
|
1869
|
+
e.id,
|
|
1870
|
+
e.label,
|
|
1871
|
+
_r[e.id]
|
|
1872
|
+
])), l = W(() => ne(e.messages).map((e) => [
|
|
1873
|
+
e.id,
|
|
1874
|
+
e.value,
|
|
1875
|
+
e.label
|
|
1876
|
+
])), u = W(() => L(e.messages).map((e) => [
|
|
1877
|
+
e.id,
|
|
1878
|
+
e.value,
|
|
1879
|
+
e.label
|
|
1880
|
+
])), d = W(() => R(e.messages).map((e) => e.id)), f = () => {
|
|
1881
|
+
o.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: o.value }).run(), t.value = null);
|
|
1882
|
+
}, p = () => {
|
|
1883
|
+
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
1884
|
+
}, m = (r) => {
|
|
1885
|
+
t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
|
|
1886
|
+
}, h = (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, g = (e, t) => {
|
|
1887
|
+
if (r.value = e, !e || !(t instanceof HTMLElement) || !a.value) {
|
|
1888
|
+
i.value = null;
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
let n = t.getBoundingClientRect(), o = a.value.getBoundingClientRect();
|
|
1892
|
+
i.value = n.left + n.width / 2 - o.left;
|
|
1893
|
+
}, _ = () => {
|
|
1894
|
+
let e = r.value;
|
|
1895
|
+
if (!e || t.value !== null) return null;
|
|
1896
|
+
let n = s.value.buttons[e];
|
|
1897
|
+
return n ? V("div", {
|
|
1898
|
+
class: "markweave-floating-toolbar-tooltip",
|
|
1899
|
+
role: "tooltip",
|
|
1900
|
+
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
1901
|
+
"data-button-id": e,
|
|
1902
|
+
"data-active": h(e),
|
|
1903
|
+
style: i.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${i.value}px` }
|
|
1904
|
+
}, n) : null;
|
|
1905
|
+
}, v = (n, i, a, o, s = !1, c) => V("button", {
|
|
1906
|
+
type: "button",
|
|
1907
|
+
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
1908
|
+
"aria-label": i,
|
|
1909
|
+
"aria-expanded": [
|
|
1910
|
+
"block-type",
|
|
1911
|
+
"link",
|
|
1912
|
+
"color",
|
|
1913
|
+
"more"
|
|
1914
|
+
].includes(n) ? t.value === n : void 0,
|
|
1915
|
+
"data-active": s || t.value === n,
|
|
1916
|
+
"data-tooltip-active": r.value === n ? "true" : "false",
|
|
1917
|
+
"data-testid": `markweave-floating-toolbar-button-${n}`,
|
|
1918
|
+
onBlur: () => g(null),
|
|
1919
|
+
onFocus: (e) => g(n, e.currentTarget),
|
|
1920
|
+
onMousedown: $,
|
|
1921
|
+
onMouseenter: (e) => g(n, e.currentTarget),
|
|
1922
|
+
onMouseleave: () => g(null),
|
|
1923
|
+
onClick: o
|
|
1924
|
+
}, n === "block-type" ? [V("span", { class: "markweave-floating-toolbar-button-inner" }, [V("span", { class: "markweave-floating-toolbar-block-label" }, vr(e.editor, e.messages)), Z(t.value === "block-type" ? pn : fn, i)])] : n === "color" ? [V("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [V("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? pn : fn, i)])] : [Z(a, i)]), y = () => V("span", {
|
|
1925
|
+
class: "markweave-floating-toolbar-divider",
|
|
1926
|
+
"aria-hidden": "true"
|
|
1927
|
+
}), b = (n, r, i) => V("section", {
|
|
1928
|
+
class: "markweave-floating-toolbar-color-section",
|
|
1929
|
+
"aria-label": n
|
|
1930
|
+
}, [V("div", { class: "markweave-floating-toolbar-menu-title" }, n), V("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => V("button", {
|
|
1931
|
+
key: `${r}-${n}`,
|
|
1932
|
+
type: "button",
|
|
1933
|
+
"aria-label": a,
|
|
1934
|
+
"data-testid": `markweave-floating-toolbar-${r}-${n}`,
|
|
1935
|
+
onMousedown: $,
|
|
1936
|
+
onClick: () => {
|
|
1937
|
+
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;
|
|
1938
|
+
}
|
|
1939
|
+
}, r === "text" ? [V("span", {
|
|
1940
|
+
class: "markweave-floating-toolbar-text-swatch",
|
|
1941
|
+
style: { color: i ?? "#646970" }
|
|
1942
|
+
}, "A")] : [V("span", {
|
|
1943
|
+
class: "markweave-floating-toolbar-highlight-swatch",
|
|
1944
|
+
style: { backgroundColor: i ?? "#ffffff" },
|
|
1945
|
+
"aria-hidden": "true"
|
|
1946
|
+
})])))]), x = () => t.value === "block-type" ? V("div", {
|
|
1947
|
+
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
|
|
1948
|
+
"data-testid": "markweave-floating-toolbar-turn-menu"
|
|
1949
|
+
}, [V("div", { class: "markweave-floating-toolbar-menu-title" }, s.value.turnIntoTitle), ...c.value.map(([n, r, i]) => V("button", {
|
|
1950
|
+
key: n,
|
|
1951
|
+
type: "button",
|
|
1952
|
+
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
1953
|
+
onMousedown: $,
|
|
1954
|
+
onClick: () => {
|
|
1955
|
+
ie(e.editor, n), t.value = null;
|
|
1956
|
+
}
|
|
1957
|
+
}, [V("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), V("span", null, r)]))]) : t.value === "link" ? V("form", {
|
|
1958
|
+
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
1959
|
+
"data-testid": "markweave-floating-toolbar-link-popover",
|
|
1960
|
+
onSubmit: (e) => {
|
|
1961
|
+
e.preventDefault(), f();
|
|
1962
|
+
}
|
|
1963
|
+
}, [V("input", {
|
|
1964
|
+
value: n.value,
|
|
1965
|
+
placeholder: s.value.linkPlaceholder,
|
|
1966
|
+
"aria-label": s.value.linkUrlLabel,
|
|
1967
|
+
"data-testid": "markweave-floating-toolbar-link-input",
|
|
1968
|
+
onInput: (e) => {
|
|
1969
|
+
n.value = e.target.value;
|
|
1970
|
+
}
|
|
1971
|
+
}), V("span", { class: "markweave-floating-toolbar-link-actions" }, [
|
|
1972
|
+
V("button", {
|
|
1973
|
+
type: "submit",
|
|
1974
|
+
disabled: !o.value,
|
|
1975
|
+
"aria-label": s.value.applyLink,
|
|
1976
|
+
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
1977
|
+
onMousedown: $
|
|
1978
|
+
}, [Z(gn, s.value.applyLink)]),
|
|
1979
|
+
V("span", {
|
|
1980
|
+
class: "markweave-floating-toolbar-link-divider",
|
|
1981
|
+
"aria-hidden": "true"
|
|
1982
|
+
}),
|
|
1983
|
+
V("button", {
|
|
1984
|
+
type: "button",
|
|
1985
|
+
disabled: !o.value,
|
|
1986
|
+
"aria-label": s.value.openLink,
|
|
1987
|
+
"data-testid": "markweave-floating-toolbar-link-open",
|
|
1988
|
+
onMousedown: $,
|
|
1989
|
+
onClick: () => pr(n.value)
|
|
1990
|
+
}, [Z(vn, s.value.openLink)]),
|
|
1991
|
+
V("button", {
|
|
1992
|
+
type: "button",
|
|
1993
|
+
"aria-label": s.value.removeLink,
|
|
1994
|
+
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
1995
|
+
onMousedown: $,
|
|
1996
|
+
onClick: p
|
|
1997
|
+
}, [Z(Gn, s.value.removeLink)])
|
|
1998
|
+
])]) : t.value === "color" ? V("div", {
|
|
1999
|
+
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2000
|
+
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
2001
|
+
}, [b(s.value.textColorTitle, "text", l.value), b(s.value.highlightColorTitle, "highlight", u.value)]) : t.value === "more" ? V("div", {
|
|
2002
|
+
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2003
|
+
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
2004
|
+
}, d.value.map((n) => V("span", {
|
|
2005
|
+
key: n,
|
|
2006
|
+
class: "markweave-floating-toolbar-more-item"
|
|
2007
|
+
}, [V("button", {
|
|
2008
|
+
type: "button",
|
|
2009
|
+
"aria-label": s.value.moreActions[n],
|
|
2010
|
+
"data-testid": `markweave-floating-toolbar-more-${n}`,
|
|
2011
|
+
"data-tooltip-active": r.value === n ? "true" : "false",
|
|
2012
|
+
onMousedown: $,
|
|
2013
|
+
onMouseenter: () => {
|
|
2014
|
+
r.value = n;
|
|
2015
|
+
},
|
|
2016
|
+
onMouseleave: () => {
|
|
2017
|
+
r.value = null;
|
|
2018
|
+
},
|
|
2019
|
+
onClick: () => {
|
|
2020
|
+
z(e.editor, n), t.value = null;
|
|
2021
|
+
}
|
|
2022
|
+
}, [Z(mr[n], s.value.moreActions[n])]), r.value === n ? V("div", {
|
|
2023
|
+
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2024
|
+
role: "tooltip"
|
|
2025
|
+
}, s.value.moreActions[n]) : null]))) : null;
|
|
2026
|
+
return () => V(M, {
|
|
2027
|
+
editor: e.editor,
|
|
2028
|
+
shouldShow: ({ editor: e }) => e.isEditable && se(B(e)),
|
|
2029
|
+
options: { placement: "top" }
|
|
2030
|
+
}, { default: () => V("div", {
|
|
2031
|
+
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
2032
|
+
"data-testid": "markweave-floating-toolbar"
|
|
2033
|
+
}, [V("div", {
|
|
2034
|
+
ref: a,
|
|
2035
|
+
class: "markweave-floating-toolbar-content",
|
|
2036
|
+
"data-menu": t.value ?? "none"
|
|
2037
|
+
}, [
|
|
2038
|
+
v("block-type", s.value.buttons["block-type"], Kn, () => m("block-type"), t.value === "block-type"),
|
|
2039
|
+
y(),
|
|
2040
|
+
v("bold", s.value.buttons.bold, cn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2041
|
+
v("italic", s.value.buttons.italic, Dn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2042
|
+
v("underline", s.value.buttons.underline, qn, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2043
|
+
v("strike", s.value.buttons.strike, Bn, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2044
|
+
v("inline-code", s.value.buttons["inline-code"], hn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2045
|
+
y(),
|
|
2046
|
+
v("link", s.value.buttons.link, kn, () => m("link"), e.editor.isActive("link")),
|
|
2047
|
+
v("color", s.value.buttons.color, Kn, () => m("color"), t.value === "color"),
|
|
2048
|
+
y(),
|
|
2049
|
+
v("more", s.value.buttons.more, Pn, () => m("more"), t.value === "more"),
|
|
2050
|
+
x(),
|
|
2051
|
+
_()
|
|
2052
|
+
])]) });
|
|
2053
|
+
}
|
|
2054
|
+
}), br = J({
|
|
2055
|
+
name: "MarkweaveVueMathEditorPopover",
|
|
2056
|
+
props: {
|
|
2057
|
+
editor: {
|
|
2058
|
+
type: Object,
|
|
2059
|
+
required: !0
|
|
2060
|
+
},
|
|
2061
|
+
messages: {
|
|
2062
|
+
type: Object,
|
|
2063
|
+
required: !0
|
|
2064
|
+
},
|
|
2065
|
+
target: {
|
|
2066
|
+
type: Object,
|
|
2067
|
+
required: !0
|
|
2068
|
+
},
|
|
2069
|
+
onClose: {
|
|
2070
|
+
type: Function,
|
|
2071
|
+
required: !0
|
|
2072
|
+
}
|
|
2073
|
+
},
|
|
2074
|
+
setup(e) {
|
|
2075
|
+
let t = H(e.target.latex), n = U(null), r = H(null), i = H(null), a = U(Ye(e.editor, e.target)), o = W(() => t.value === e.target.latex && a.value ? {
|
|
2076
|
+
html: a.value,
|
|
2077
|
+
error: !1
|
|
2078
|
+
} : $e(t.value, e.target.kind, e.editor)), s = W(() => t.value.trim().length > 0), c = W(() => e.messages.math), l = W(() => Je(e.editor, e.target) ?? 1), u = () => {
|
|
2079
|
+
if (typeof window > "u") return;
|
|
2080
|
+
let r = qe(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2081
|
+
if (!r || !i) {
|
|
2082
|
+
e.onClose();
|
|
2083
|
+
return;
|
|
2084
|
+
}
|
|
2085
|
+
n.value = Ke({
|
|
2086
|
+
anchorRect: r,
|
|
2087
|
+
frameRect: i,
|
|
2088
|
+
kind: e.target.kind,
|
|
2089
|
+
latex: t.value,
|
|
2090
|
+
viewportHeight: window.innerHeight,
|
|
2091
|
+
viewportWidth: window.innerWidth
|
|
2092
|
+
});
|
|
2093
|
+
}, d = () => {
|
|
2094
|
+
s.value && Ge(e.editor, e.target, t.value) && e.onClose();
|
|
2095
|
+
}, f = (t) => {
|
|
2096
|
+
if (t.key === "Escape") {
|
|
2097
|
+
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
t.key === "Enter" && (e.target.kind === "inline" || t.metaKey || t.ctrlKey) && (t.preventDefault(), d());
|
|
2101
|
+
}, p = (t) => {
|
|
2102
|
+
let n = t.target;
|
|
2103
|
+
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2104
|
+
};
|
|
2105
|
+
return G(() => [e.target.pos, e.target.latex], () => {
|
|
2106
|
+
t.value = e.target.latex, a.value = Ye(e.editor, e.target), q(u);
|
|
2107
|
+
}), $t(() => {
|
|
2108
|
+
et(e.editor, e.target, !0), u(), q(() => {
|
|
2109
|
+
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2110
|
+
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2111
|
+
}), K(() => {
|
|
2112
|
+
et(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2113
|
+
}), () => {
|
|
2114
|
+
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2115
|
+
ref: i,
|
|
2116
|
+
"data-testid": "markweave-math-editor-input",
|
|
2117
|
+
placeholder: c.value.latexPlaceholder,
|
|
2118
|
+
spellcheck: "false",
|
|
2119
|
+
value: t.value,
|
|
2120
|
+
onInput: (e) => {
|
|
2121
|
+
t.value = e.target.value;
|
|
2122
|
+
},
|
|
2123
|
+
onKeydown: f
|
|
2124
|
+
};
|
|
2125
|
+
return e.target.kind === "inline" ? V("form", {
|
|
2126
|
+
ref: r,
|
|
2127
|
+
class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
|
|
2128
|
+
"aria-label": a,
|
|
2129
|
+
"data-kind": "inline",
|
|
2130
|
+
"data-placement": n.value?.placement ?? "bottom",
|
|
2131
|
+
"data-testid": "markweave-math-editor-popover",
|
|
2132
|
+
style: n.value ? {
|
|
2133
|
+
left: `${n.value.left}px`,
|
|
2134
|
+
top: `${n.value.top}px`,
|
|
2135
|
+
width: `${n.value.width}px`
|
|
2136
|
+
} : void 0,
|
|
2137
|
+
onSubmit: (e) => {
|
|
2138
|
+
e.preventDefault(), d();
|
|
2139
|
+
}
|
|
2140
|
+
}, [V("label", {
|
|
2141
|
+
class: "markweave-math-inline-source",
|
|
2142
|
+
"data-testid": "markweave-math-inline-source"
|
|
2143
|
+
}, [
|
|
2144
|
+
V("span", { attrs: { "aria-hidden": "true" } }, "$"),
|
|
2145
|
+
V("input", {
|
|
2146
|
+
...u,
|
|
2147
|
+
"aria-label": c.value.latexLabel,
|
|
2148
|
+
size: Math.max(t.value.length, 1)
|
|
2149
|
+
}),
|
|
2150
|
+
V("span", { attrs: { "aria-hidden": "true" } }, "$")
|
|
2151
|
+
]), V("div", {
|
|
2152
|
+
class: "markweave-math-inline-preview",
|
|
2153
|
+
"data-error": o.value.error ? "true" : "false",
|
|
2154
|
+
"data-testid": "markweave-math-editor-preview"
|
|
2155
|
+
}, [V("div", { innerHTML: o.value.html || " " }), o.value.error ? V("small", null, c.value.invalidPreview) : null])]) : V("form", {
|
|
2156
|
+
ref: r,
|
|
2157
|
+
class: "markweave-math-editor-popover markweave-math-editor-popover--block",
|
|
2158
|
+
"aria-label": a,
|
|
2159
|
+
"data-kind": e.target.kind,
|
|
2160
|
+
"data-placement": n.value?.placement ?? "bottom",
|
|
2161
|
+
"data-testid": "markweave-math-editor-popover",
|
|
2162
|
+
style: n.value ? {
|
|
2163
|
+
left: `${n.value.left}px`,
|
|
2164
|
+
top: `${n.value.top}px`,
|
|
2165
|
+
width: `${n.value.width}px`
|
|
2166
|
+
} : void 0,
|
|
2167
|
+
onSubmit: (e) => {
|
|
2168
|
+
e.preventDefault(), d();
|
|
2169
|
+
}
|
|
2170
|
+
}, [
|
|
2171
|
+
V("div", { class: "markweave-math-block-toolbar" }, [
|
|
2172
|
+
V("span", null, c.value.label),
|
|
2173
|
+
Z(hn, c.value.label, 15, 1.75),
|
|
2174
|
+
V("button", {
|
|
2175
|
+
type: "submit",
|
|
2176
|
+
title: c.value.apply,
|
|
2177
|
+
"aria-label": c.value.apply,
|
|
2178
|
+
disabled: !s.value,
|
|
2179
|
+
"data-testid": "markweave-math-editor-apply"
|
|
2180
|
+
}, [Z(dn, c.value.apply, 16, 2)])
|
|
2181
|
+
]),
|
|
2182
|
+
V("label", {
|
|
2183
|
+
class: "markweave-math-block-source",
|
|
2184
|
+
"data-testid": "markweave-math-block-source"
|
|
2185
|
+
}, [
|
|
2186
|
+
V("span", { attrs: { "aria-hidden": "true" } }, "$$"),
|
|
2187
|
+
V("textarea", {
|
|
2188
|
+
...u,
|
|
2189
|
+
"aria-label": c.value.latexLabel,
|
|
2190
|
+
rows: 3
|
|
2191
|
+
}),
|
|
2192
|
+
V("span", { attrs: { "aria-hidden": "true" } }, "$$")
|
|
2193
|
+
]),
|
|
2194
|
+
V("div", {
|
|
2195
|
+
class: "markweave-math-block-preview",
|
|
2196
|
+
"data-error": o.value.error ? "true" : "false",
|
|
2197
|
+
"data-math-number": String(l.value),
|
|
2198
|
+
"data-testid": "markweave-math-editor-preview"
|
|
2199
|
+
}, [V("div", { innerHTML: o.value.html || " " }), o.value.error ? V("small", null, c.value.invalidPreview) : null])
|
|
2200
|
+
]);
|
|
2201
|
+
};
|
|
2202
|
+
}
|
|
2203
|
+
}), xr = J({
|
|
2204
|
+
name: "MarkweaveVueSlashCommandMenu",
|
|
2205
|
+
props: {
|
|
2206
|
+
commands: {
|
|
2207
|
+
type: Array,
|
|
2208
|
+
required: !0
|
|
2209
|
+
},
|
|
2210
|
+
state: {
|
|
2211
|
+
type: Object,
|
|
2212
|
+
required: !0
|
|
2213
|
+
},
|
|
2214
|
+
position: {
|
|
2215
|
+
type: Object,
|
|
2216
|
+
default: null
|
|
2217
|
+
},
|
|
2218
|
+
inputCommand: {
|
|
2219
|
+
type: Object,
|
|
2220
|
+
default: null
|
|
2221
|
+
},
|
|
2222
|
+
messages: {
|
|
2223
|
+
type: Object,
|
|
2224
|
+
required: !0
|
|
2225
|
+
},
|
|
2226
|
+
onSelect: {
|
|
2227
|
+
type: Function,
|
|
2228
|
+
required: !0
|
|
2229
|
+
},
|
|
2230
|
+
onInputCommandChange: {
|
|
2231
|
+
type: Function,
|
|
2232
|
+
required: !0
|
|
2233
|
+
},
|
|
2234
|
+
onUpload: {
|
|
2235
|
+
type: Function,
|
|
2236
|
+
default: void 0
|
|
2237
|
+
}
|
|
2238
|
+
},
|
|
2239
|
+
setup(e) {
|
|
2240
|
+
let t = H(""), n = H(null), r = H(null), i = H(!1), a = H(""), o = H(0), s = W(() => {
|
|
2241
|
+
let t = a.value.trim().toLowerCase();
|
|
2242
|
+
return (t ? e.messages.slash.emojiItems.filter((e) => [
|
|
2243
|
+
e.emoji,
|
|
2244
|
+
e.label,
|
|
2245
|
+
...e.terms
|
|
2246
|
+
].join(" ").toLowerCase().includes(t)) : e.messages.slash.emojiItems).slice(0, 12);
|
|
2247
|
+
}), c = async () => {
|
|
2248
|
+
if (e.inputCommand) {
|
|
2249
|
+
r.value = null, i.value = !0;
|
|
2250
|
+
try {
|
|
2251
|
+
let i = n.value ? {
|
|
2252
|
+
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2253
|
+
trigger: "slash-command",
|
|
2254
|
+
source: {
|
|
2255
|
+
type: "file",
|
|
2256
|
+
file: n.value,
|
|
2257
|
+
mimeType: n.value.type
|
|
2258
|
+
}
|
|
2259
|
+
} : {
|
|
2260
|
+
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2261
|
+
trigger: "slash-command",
|
|
2262
|
+
source: k(t.value)
|
|
2263
|
+
};
|
|
2264
|
+
if (!n.value && !t.value.trim()) {
|
|
2265
|
+
r.value = e.messages.slash.uploadRequiredError;
|
|
2266
|
+
return;
|
|
2267
|
+
}
|
|
2268
|
+
let a = await j(i, e.onUpload);
|
|
2269
|
+
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2270
|
+
} catch (t) {
|
|
2271
|
+
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
2272
|
+
} finally {
|
|
2273
|
+
i.value = !1;
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
}, l = (t) => {
|
|
2277
|
+
if (!e.inputCommand) return;
|
|
2278
|
+
let n = s.value[Math.min(s.value.length - 1, Math.max(0, t))];
|
|
2279
|
+
n && (e.onSelect(e.inputCommand, { emoji: n.emoji }), e.onInputCommandChange(null));
|
|
2280
|
+
};
|
|
2281
|
+
return () => {
|
|
2282
|
+
if (!e.position) return null;
|
|
2283
|
+
let u = {
|
|
2284
|
+
left: `${e.position.left}px`,
|
|
2285
|
+
top: `${e.position.top}px`,
|
|
2286
|
+
maxHeight: `${e.position.maxHeight}px`,
|
|
2287
|
+
"--markweave-slash-menu-max-height": `${e.position.maxHeight}px`
|
|
2288
|
+
}, d = {
|
|
2289
|
+
left: `${e.position.triggerLeft}px`,
|
|
2290
|
+
top: `${e.position.triggerTop}px`
|
|
2291
|
+
}, f = Object.values(e.messages.slash.groups).map((t) => ({
|
|
2292
|
+
group: t,
|
|
2293
|
+
commands: e.commands.filter((e) => e.group === t)
|
|
2294
|
+
})).filter((e) => e.commands.length);
|
|
2295
|
+
return V("div", {
|
|
2296
|
+
class: "markweave-slash-layer",
|
|
2297
|
+
style: { display: "contents" },
|
|
2298
|
+
"data-testid": "markweave-slash-layer"
|
|
2299
|
+
}, [V("div", {
|
|
2300
|
+
class: "markweave-slash-trigger",
|
|
2301
|
+
style: d,
|
|
2302
|
+
"aria-hidden": "true",
|
|
2303
|
+
"data-testid": "markweave-slash-trigger"
|
|
2304
|
+
}, [V("span", null, "/"), V("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), V("div", {
|
|
2305
|
+
class: "markweave-slash-menu",
|
|
2306
|
+
style: u,
|
|
2307
|
+
role: "listbox",
|
|
2308
|
+
"aria-label": e.messages.slash.ariaLabel,
|
|
2309
|
+
"data-placement": e.position.placement,
|
|
2310
|
+
"data-testid": "markweave-slash-menu"
|
|
2311
|
+
}, [e.inputCommand?.inputKind === "emoji" ? V("div", {
|
|
2312
|
+
class: "markweave-slash-subpanel",
|
|
2313
|
+
"data-testid": "markweave-slash-emoji-picker"
|
|
2314
|
+
}, [
|
|
2315
|
+
V("div", { class: "markweave-slash-subpanel-header" }, [V("button", {
|
|
2316
|
+
type: "button",
|
|
2317
|
+
onMousedown: $,
|
|
2318
|
+
onClick: () => e.onInputCommandChange(null)
|
|
2319
|
+
}, e.messages.common.back), V("span", null, e.messages.slash.emojiTitle)]),
|
|
2320
|
+
V("label", { class: "markweave-slash-input" }, [V("span", null, "/"), V("input", {
|
|
2321
|
+
autofocus: !0,
|
|
2322
|
+
value: a.value,
|
|
2323
|
+
placeholder: e.messages.slash.emojiSearchPlaceholder,
|
|
2324
|
+
onInput: (e) => {
|
|
2325
|
+
a.value = e.target.value, o.value = 0;
|
|
2326
|
+
},
|
|
2327
|
+
onKeydown: (t) => {
|
|
2328
|
+
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));
|
|
2329
|
+
}
|
|
2330
|
+
})]),
|
|
2331
|
+
V("div", {
|
|
2332
|
+
class: "markweave-slash-emoji-grid",
|
|
2333
|
+
role: "listbox",
|
|
2334
|
+
"aria-label": e.messages.slash.emojiTitle
|
|
2335
|
+
}, s.value.map((e, t) => V("button", {
|
|
2336
|
+
key: `${e.emoji}-${e.label}`,
|
|
2337
|
+
type: "button",
|
|
2338
|
+
role: "option",
|
|
2339
|
+
"aria-selected": t === o.value,
|
|
2340
|
+
"data-active": t === o.value,
|
|
2341
|
+
onMouseenter: () => o.value = t,
|
|
2342
|
+
onMousedown: $,
|
|
2343
|
+
onClick: () => l(t)
|
|
2344
|
+
}, [V("span", null, e.emoji), V("small", null, e.label)])))
|
|
2345
|
+
]) : e.inputCommand?.inputKind === "upload" ? V("div", {
|
|
2346
|
+
class: "markweave-slash-subpanel",
|
|
2347
|
+
"data-testid": "markweave-slash-upload-panel"
|
|
2348
|
+
}, [
|
|
2349
|
+
V("div", { class: "markweave-slash-upload-header" }, [V("button", {
|
|
2350
|
+
type: "button",
|
|
2351
|
+
onMousedown: $,
|
|
2352
|
+
onClick: () => e.onInputCommandChange(null)
|
|
2353
|
+
}, e.messages.common.back), V("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
|
|
2354
|
+
V("label", { class: "markweave-slash-upload-field" }, [V("span", null, e.messages.slash.uploadValueLabel), V("input", {
|
|
2355
|
+
autofocus: !0,
|
|
2356
|
+
value: t.value,
|
|
2357
|
+
placeholder: e.messages.slash.uploadValuePlaceholder,
|
|
2358
|
+
onInput: (e) => {
|
|
2359
|
+
t.value = e.target.value;
|
|
2360
|
+
},
|
|
2361
|
+
onKeydown: (e) => {
|
|
2362
|
+
e.key === "Enter" && (e.preventDefault(), c());
|
|
2363
|
+
}
|
|
2364
|
+
})]),
|
|
2365
|
+
V("label", { class: "markweave-slash-upload-field" }, [V("span", null, e.messages.common.file), V("input", {
|
|
2366
|
+
type: "file",
|
|
2367
|
+
onChange: (e) => n.value = e.target.files?.[0] ?? null
|
|
2368
|
+
})]),
|
|
2369
|
+
r.value ? V("div", {
|
|
2370
|
+
class: "markweave-slash-upload-error",
|
|
2371
|
+
role: "alert"
|
|
2372
|
+
}, r.value) : null,
|
|
2373
|
+
V("div", { class: "markweave-slash-upload-actions" }, [V("button", {
|
|
2374
|
+
type: "button",
|
|
2375
|
+
onMousedown: $,
|
|
2376
|
+
onClick: () => e.onInputCommandChange(null)
|
|
2377
|
+
}, e.messages.common.cancel), V("button", {
|
|
2378
|
+
type: "button",
|
|
2379
|
+
"data-primary": "true",
|
|
2380
|
+
disabled: i.value,
|
|
2381
|
+
onMousedown: $,
|
|
2382
|
+
onClick: c
|
|
2383
|
+
}, e.messages.common.insert)])
|
|
2384
|
+
]) : e.commands.length ? V("div", { class: "markweave-slash-command-list" }, f.map((t) => V("section", {
|
|
2385
|
+
key: t.group,
|
|
2386
|
+
class: "markweave-slash-group",
|
|
2387
|
+
"aria-label": t.group
|
|
2388
|
+
}, [V("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2389
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = ct(t);
|
|
2390
|
+
return V("button", {
|
|
2391
|
+
key: t.id,
|
|
2392
|
+
type: "button",
|
|
2393
|
+
role: "option",
|
|
2394
|
+
"aria-selected": n,
|
|
2395
|
+
"aria-disabled": !r || t.disabled ? "true" : void 0,
|
|
2396
|
+
"data-active": n,
|
|
2397
|
+
"data-disabled": t.disabled ? "true" : "false",
|
|
2398
|
+
"data-execution-kind": t.executionKind,
|
|
2399
|
+
"data-testid": `markweave-slash-command-${t.id}`,
|
|
2400
|
+
title: t.disabledReason,
|
|
2401
|
+
onMousedown: $,
|
|
2402
|
+
onClick: () => {
|
|
2403
|
+
if (r) {
|
|
2404
|
+
if (t.inputKind) {
|
|
2405
|
+
e.onInputCommandChange(t);
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
e.onSelect(t);
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
}, [
|
|
2412
|
+
gr(t.icon),
|
|
2413
|
+
V("span", null, t.label),
|
|
2414
|
+
t.disabledReason ? V("small", null, t.disabledReason) : null
|
|
2415
|
+
]);
|
|
2416
|
+
})]))) : V("div", {
|
|
2417
|
+
class: "markweave-slash-menu__empty",
|
|
2418
|
+
role: "option",
|
|
2419
|
+
"aria-disabled": "true"
|
|
2420
|
+
}, e.messages.slash.noResults)])]);
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
}), Sr = J({
|
|
2424
|
+
name: "MarkweaveVueTableControls",
|
|
2425
|
+
props: {
|
|
2426
|
+
editor: {
|
|
2427
|
+
type: Object,
|
|
2428
|
+
required: !0
|
|
2429
|
+
},
|
|
2430
|
+
active: {
|
|
2431
|
+
type: Boolean,
|
|
2432
|
+
required: !0
|
|
2433
|
+
},
|
|
2434
|
+
interactionState: {
|
|
2435
|
+
type: Object,
|
|
2436
|
+
required: !0
|
|
2437
|
+
},
|
|
2438
|
+
messages: {
|
|
2439
|
+
type: Object,
|
|
2440
|
+
required: !0
|
|
2441
|
+
},
|
|
2442
|
+
onCopyPayload: {
|
|
2443
|
+
type: Function,
|
|
2444
|
+
default: void 0
|
|
2445
|
+
},
|
|
2446
|
+
onCommandResult: {
|
|
2447
|
+
type: Function,
|
|
2448
|
+
default: void 0
|
|
2449
|
+
},
|
|
2450
|
+
onEditWithAi: {
|
|
2451
|
+
type: Function,
|
|
2452
|
+
default: void 0
|
|
2453
|
+
}
|
|
2454
|
+
},
|
|
2455
|
+
setup(e) {
|
|
2456
|
+
let t = H(null), n = H("row-edge"), r = H(null), i = H(null), a = H(null), o = H(null), s = H(null), c = H(null), l = H(null), u = H(null), d = H(null), f = H(null), p = null, m = W(() => e.active ? yt(e.editor.state) : cr), h = W(() => jt(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = W(() => jt(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = W(() => kt(e.editor)), v = W(() => _.value.length > 0), y = W(() => t.value ? Ft(e.editor, t.value) : []), b = () => {
|
|
2457
|
+
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2458
|
+
}, x = (e) => {
|
|
2459
|
+
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
2460
|
+
s.value = null, p = null;
|
|
2461
|
+
}, zt));
|
|
2462
|
+
}, S = () => {
|
|
2463
|
+
if (!e.active) {
|
|
2464
|
+
r.value = null, i.value = null, a.value = null, x(null);
|
|
2465
|
+
return;
|
|
2466
|
+
}
|
|
2467
|
+
let o = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement;
|
|
2468
|
+
if (!o) {
|
|
2469
|
+
r.value = null, i.value = null, a.value = null;
|
|
2470
|
+
return;
|
|
2471
|
+
}
|
|
2472
|
+
let s = o.getBoundingClientRect(), c = h.value ? At(e.editor, h.value) : null, l = g.value ? At(e.editor, g.value) : null, u = v.value ? It(e.editor) : null;
|
|
2473
|
+
c ? r.value = wt({
|
|
2474
|
+
targetRect: c,
|
|
2475
|
+
frameRect: s,
|
|
2476
|
+
kind: "row"
|
|
2477
|
+
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = wt({
|
|
2478
|
+
targetRect: l,
|
|
2479
|
+
frameRect: s,
|
|
2480
|
+
kind: "column"
|
|
2481
|
+
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = wt({
|
|
2482
|
+
targetRect: u,
|
|
2483
|
+
frameRect: s,
|
|
2484
|
+
kind: "selection"
|
|
2485
|
+
}) : t.value === "selection" && n.value === "selection-edge" || (a.value = null);
|
|
2486
|
+
}, C = () => {
|
|
2487
|
+
if (!e.active || !t.value) {
|
|
2488
|
+
o.value = null;
|
|
2489
|
+
return;
|
|
2490
|
+
}
|
|
2491
|
+
let r = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = n.value === "row-edge" ? l.value : n.value === "column-edge" ? u.value : d.value;
|
|
2492
|
+
if (!r || !i || !f.value) {
|
|
2493
|
+
o.value = null;
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2496
|
+
let a = i.getBoundingClientRect(), s = t.value === "row" ? Ot(e.editor)?.getBoundingClientRect() : null, c = s ? {
|
|
2497
|
+
left: a.left,
|
|
2498
|
+
top: s.top,
|
|
2499
|
+
width: a.width,
|
|
2500
|
+
height: a.height
|
|
2501
|
+
} : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
|
|
2502
|
+
o.value = Ct({
|
|
2503
|
+
anchorRect: c,
|
|
2504
|
+
frameRect: p,
|
|
2505
|
+
menuSize: {
|
|
2506
|
+
width: m.width || 204,
|
|
2507
|
+
height: m.height || 220
|
|
2508
|
+
},
|
|
2509
|
+
kind: t.value
|
|
2510
|
+
});
|
|
2511
|
+
}, w = () => {
|
|
2512
|
+
S(), C();
|
|
2513
|
+
}, T = () => {
|
|
2514
|
+
q(w);
|
|
2515
|
+
}, E = (e, r) => {
|
|
2516
|
+
let i = t.value === e && n.value === r;
|
|
2517
|
+
n.value = r, t.value = i ? null : e, T();
|
|
2518
|
+
}, D = () => {
|
|
2519
|
+
e.editor.view.dispatch(gt(e.editor.state.tr, null));
|
|
2520
|
+
}, O = (t, n) => {
|
|
2521
|
+
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2522
|
+
r !== null && Rt(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2523
|
+
}, k = () => {
|
|
2524
|
+
D(), E("selection", "selection-edge");
|
|
2525
|
+
}, A = (n = !1) => {
|
|
2526
|
+
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2527
|
+
}, j = async (n, r) => {
|
|
2528
|
+
let i = await Et({
|
|
2529
|
+
editor: e.editor,
|
|
2530
|
+
commandId: n,
|
|
2531
|
+
menu: r ?? t.value ?? "selection",
|
|
2532
|
+
messages: e.messages
|
|
2533
|
+
});
|
|
2534
|
+
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2535
|
+
}, M = (t) => {
|
|
2536
|
+
let n = Mt(e.editor, t);
|
|
2537
|
+
n && e.onEditWithAi?.(n), A(!0);
|
|
2538
|
+
}, N = (e) => {
|
|
2539
|
+
!t.value || e.key !== "Escape" || A(!0);
|
|
2540
|
+
}, ee = (e) => {
|
|
2541
|
+
t.value && (e.target instanceof Node && c.value?.contains(e.target) || A());
|
|
2542
|
+
};
|
|
2543
|
+
$t(() => {
|
|
2544
|
+
w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", N), document.addEventListener("mousedown", ee);
|
|
2545
|
+
}), K(() => {
|
|
2546
|
+
b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", N), document.removeEventListener("mousedown", ee);
|
|
2547
|
+
}), G(() => [
|
|
2548
|
+
e.active,
|
|
2549
|
+
m.value.activeCellPos,
|
|
2550
|
+
m.value.selectionFrom,
|
|
2551
|
+
m.value.selectionTo,
|
|
2552
|
+
e.interactionState.hoverCellPos,
|
|
2553
|
+
e.interactionState.hoverVisualColumnIndex,
|
|
2554
|
+
e.interactionState.hoverVisualRowIndex,
|
|
2555
|
+
t.value,
|
|
2556
|
+
n.value
|
|
2557
|
+
], T, { flush: "post" });
|
|
2558
|
+
let P = () => t.value ? V("div", {
|
|
2559
|
+
ref: f,
|
|
2560
|
+
class: "markweave-table-menu",
|
|
2561
|
+
role: "menu",
|
|
2562
|
+
"aria-label": Bt(t.value, e.messages),
|
|
2563
|
+
"data-testid": "markweave-table-menu",
|
|
2564
|
+
"data-positioned": o.value ? "true" : "false",
|
|
2565
|
+
style: o.value ? {
|
|
2566
|
+
left: `${o.value.left}px`,
|
|
2567
|
+
top: `${o.value.top}px`
|
|
2568
|
+
} : void 0
|
|
2569
|
+
}, y.value.map((n, r) => {
|
|
2570
|
+
let i = Nt(n), a = r === 0 ? i : Nt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Tt(e.editor, n.commandId), c = Pt(n, e.messages);
|
|
2571
|
+
return V("button", {
|
|
2572
|
+
key: `${n.id}-${r}`,
|
|
2573
|
+
type: "button",
|
|
2574
|
+
role: "menuitem",
|
|
2575
|
+
"aria-label": c,
|
|
2576
|
+
"aria-disabled": !s,
|
|
2577
|
+
disabled: !s,
|
|
2578
|
+
"data-menu-group": i,
|
|
2579
|
+
"data-starts-group": o ? "true" : "false",
|
|
2580
|
+
"data-command-enabled": s ? "true" : "false",
|
|
2581
|
+
"data-testid": n.commandId ? `markweave-table-menu-command-${n.commandId}` : "markweave-table-menu-command-edit-with-ai",
|
|
2582
|
+
onMousedown: $,
|
|
2583
|
+
onClick: () => {
|
|
2584
|
+
if (s) {
|
|
2585
|
+
if (n.commandId === null) {
|
|
2586
|
+
M(t.value === "row" || t.value === "column" ? t.value : "selection");
|
|
2587
|
+
return;
|
|
2588
|
+
}
|
|
2589
|
+
j(n.commandId).finally(() => A());
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
}, c);
|
|
2593
|
+
})) : null;
|
|
2594
|
+
return () => e.active ? V("div", {
|
|
2595
|
+
ref: c,
|
|
2596
|
+
class: "markweave-table-controls",
|
|
2597
|
+
"data-testid": "markweave-table-controls",
|
|
2598
|
+
"aria-label": e.messages.table.controlsAriaLabel,
|
|
2599
|
+
"data-open-menu": t.value ?? "none",
|
|
2600
|
+
"data-positioned": r.value || i.value || a.value ? "true" : "false"
|
|
2601
|
+
}, [
|
|
2602
|
+
s.value ? V("div", {
|
|
2603
|
+
class: "markweave-table-copy-feedback",
|
|
2604
|
+
role: "status",
|
|
2605
|
+
"aria-live": "polite",
|
|
2606
|
+
"data-testid": "markweave-table-copy-feedback",
|
|
2607
|
+
"data-copy-kind": s.value.kind,
|
|
2608
|
+
"data-text-length": s.value.textLength,
|
|
2609
|
+
"data-html-length": s.value.htmlLength
|
|
2610
|
+
}, Dt(s.value)) : null,
|
|
2611
|
+
r.value ? V("button", {
|
|
2612
|
+
ref: l,
|
|
2613
|
+
type: "button",
|
|
2614
|
+
class: "markweave-table-edge-handle markweave-table-edge-handle--row",
|
|
2615
|
+
"aria-label": e.messages.table.activeRowActions,
|
|
2616
|
+
"aria-expanded": t.value === "row" && n.value === "row-edge",
|
|
2617
|
+
"aria-haspopup": "menu",
|
|
2618
|
+
title: e.messages.table.rowActions,
|
|
2619
|
+
"data-testid": "markweave-table-hover-row-handle",
|
|
2620
|
+
"data-axis-index": h.value?.index ?? "",
|
|
2621
|
+
"data-axis-selected-cells": h.value?.selectedCellCount ?? "",
|
|
2622
|
+
"data-axis-visual-cells": h.value?.visualCellCount ?? "",
|
|
2623
|
+
"data-axis-visual-size": h.value?.visualHeight ?? "",
|
|
2624
|
+
style: {
|
|
2625
|
+
left: `${r.value.left}px`,
|
|
2626
|
+
top: `${r.value.top}px`
|
|
2627
|
+
},
|
|
2628
|
+
onMousedown: $,
|
|
2629
|
+
onClick: () => O("row", "row-edge")
|
|
2630
|
+
}, [V("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2631
|
+
i.value ? V("button", {
|
|
2632
|
+
ref: u,
|
|
2633
|
+
type: "button",
|
|
2634
|
+
class: "markweave-table-edge-handle markweave-table-edge-handle--column",
|
|
2635
|
+
"aria-label": e.messages.table.activeColumnActions,
|
|
2636
|
+
"aria-expanded": t.value === "column" && n.value === "column-edge",
|
|
2637
|
+
"aria-haspopup": "menu",
|
|
2638
|
+
title: e.messages.table.columnActions,
|
|
2639
|
+
"data-testid": "markweave-table-hover-column-handle",
|
|
2640
|
+
"data-axis-index": g.value?.index ?? "",
|
|
2641
|
+
"data-axis-selected-cells": g.value?.selectedCellCount ?? "",
|
|
2642
|
+
"data-axis-visual-cells": g.value?.visualCellCount ?? "",
|
|
2643
|
+
"data-axis-visual-size": g.value?.visualWidth ?? "",
|
|
2644
|
+
style: {
|
|
2645
|
+
left: `${i.value.left}px`,
|
|
2646
|
+
top: `${i.value.top}px`
|
|
2647
|
+
},
|
|
2648
|
+
onMousedown: $,
|
|
2649
|
+
onClick: () => O("column", "column-edge")
|
|
2650
|
+
}, [V("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2651
|
+
v.value && a.value ? V("button", {
|
|
2652
|
+
ref: d,
|
|
2653
|
+
type: "button",
|
|
2654
|
+
class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
2655
|
+
"aria-label": e.messages.table.selectionActions,
|
|
2656
|
+
"aria-expanded": t.value === "selection" && n.value === "selection-edge",
|
|
2657
|
+
"aria-haspopup": "menu",
|
|
2658
|
+
title: e.messages.table.selectionActions,
|
|
2659
|
+
"data-testid": "markweave-table-cell-handle",
|
|
2660
|
+
style: {
|
|
2661
|
+
left: `${a.value.left}px`,
|
|
2662
|
+
top: `${a.value.top}px`
|
|
2663
|
+
},
|
|
2664
|
+
onMousedown: $,
|
|
2665
|
+
onClick: k
|
|
2666
|
+
}, [V("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2667
|
+
P()
|
|
2668
|
+
]) : null;
|
|
2669
|
+
}
|
|
2670
|
+
}), Cr = J({
|
|
2671
|
+
name: "MarkweaveVueTableSelectionOverlay",
|
|
2672
|
+
props: {
|
|
2673
|
+
editor: {
|
|
2674
|
+
type: Object,
|
|
2675
|
+
required: !0
|
|
2676
|
+
},
|
|
2677
|
+
focusState: {
|
|
2678
|
+
type: Object,
|
|
2679
|
+
required: !0
|
|
2680
|
+
}
|
|
2681
|
+
},
|
|
2682
|
+
setup(e) {
|
|
2683
|
+
let t = H(null), n = () => {
|
|
2684
|
+
if (e.focusState.mode !== "cell-selection") {
|
|
2685
|
+
t.value = null;
|
|
2686
|
+
return;
|
|
2687
|
+
}
|
|
2688
|
+
t.value = Lt(e.editor, bt(e.editor.state));
|
|
2689
|
+
};
|
|
2690
|
+
return $t(() => {
|
|
2691
|
+
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
2692
|
+
}), K(() => {
|
|
2693
|
+
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
2694
|
+
}), G(() => [
|
|
2695
|
+
e.focusState.activeCellPos,
|
|
2696
|
+
e.focusState.anchorCellPos,
|
|
2697
|
+
e.focusState.mode,
|
|
2698
|
+
e.focusState.selectedCellCount,
|
|
2699
|
+
e.focusState.selectionFrom,
|
|
2700
|
+
e.focusState.selectionTo
|
|
2701
|
+
], () => {
|
|
2702
|
+
q(n);
|
|
2703
|
+
}, { flush: "post" }), () => {
|
|
2704
|
+
let e = t.value;
|
|
2705
|
+
return e ? V("div", {
|
|
2706
|
+
"aria-hidden": "true",
|
|
2707
|
+
class: "markweave-table-selection-overlay",
|
|
2708
|
+
"data-anchor-cell-pos": e.anchorCellPos ?? "",
|
|
2709
|
+
"data-head-cell-pos": e.headCellPos ?? "",
|
|
2710
|
+
"data-selected-cells": e.selectedCellCount,
|
|
2711
|
+
"data-visual-columns": e.visualColumnCount,
|
|
2712
|
+
"data-visual-rows": e.visualRowCount,
|
|
2713
|
+
"data-visual-slots": e.visualSlotCount,
|
|
2714
|
+
"data-testid": "markweave-table-selection-overlay",
|
|
2715
|
+
style: {
|
|
2716
|
+
"--markweave-table-selection-columns": e.visualColumnCount,
|
|
2717
|
+
"--markweave-table-selection-rows": e.visualRowCount,
|
|
2718
|
+
left: `${e.left}px`,
|
|
2719
|
+
top: `${e.top}px`,
|
|
2720
|
+
width: `${e.width}px`,
|
|
2721
|
+
height: `${e.height}px`
|
|
2722
|
+
}
|
|
2723
|
+
}) : null;
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
}), wr = J({
|
|
2727
|
+
name: "MarkweaveVueCodeBlockControls",
|
|
2728
|
+
props: {
|
|
2729
|
+
editor: {
|
|
2730
|
+
type: Object,
|
|
2731
|
+
required: !0
|
|
2732
|
+
},
|
|
2733
|
+
state: {
|
|
2734
|
+
type: Object,
|
|
2735
|
+
required: !0
|
|
2736
|
+
},
|
|
2737
|
+
active: {
|
|
2738
|
+
type: Boolean,
|
|
2739
|
+
required: !0
|
|
2740
|
+
},
|
|
2741
|
+
mermaidMode: {
|
|
2742
|
+
type: String,
|
|
2743
|
+
required: !0
|
|
2744
|
+
},
|
|
2745
|
+
onMermaidModeChange: {
|
|
2746
|
+
type: Function,
|
|
2747
|
+
required: !0
|
|
2748
|
+
},
|
|
2749
|
+
readOnly: {
|
|
2750
|
+
type: Boolean,
|
|
2751
|
+
required: !0
|
|
2752
|
+
}
|
|
2753
|
+
},
|
|
2754
|
+
setup(e) {
|
|
2755
|
+
let t = H(null), n = H(null), r = H(null), i = H(null), a = H(null), o = H([]), s = H(null), c = H(!1), l = H(""), u = H(null), d = H(!1), f = H(null), p = H(null), m = H(!1), h = H({
|
|
2756
|
+
active: !1,
|
|
2757
|
+
lastX: 0,
|
|
2758
|
+
lastY: 0
|
|
2759
|
+
}), g = H(0), _ = H(0), v = H(0), y = null, b = W(() => (v.value, Ie(e.editor, i.value))), x = W(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
2760
|
+
...e.state,
|
|
2761
|
+
pos: e.state.pos,
|
|
2762
|
+
active: !0
|
|
2763
|
+
} : null), S = W(() => b.value ?? x.value), C = W(() => S.value !== null), w = W(() => S.value?.language === "mermaid"), T = W(() => Be(e.editor, S.value)), E = W(() => C.value && S.value !== null && !T.value), D = W(() => !e.readOnly), O = W(() => S.value ? Ae(S.value.language) : Ae("text")), k = W(() => u.value?.status ?? "idle"), A = W(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), j = W(() => w.value && A.value === "preview"), M = W(() => (v.value, g.value, _.value, Re(e.editor))), N = W(() => `${_.value}|${M.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), ee = W(() => Pe(l.value)), P = W(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), te = () => {
|
|
2764
|
+
y !== null && (window.clearTimeout(y), y = null);
|
|
2765
|
+
}, F = (e) => {
|
|
2766
|
+
te(), u.value = e, e && (y = window.setTimeout(() => {
|
|
2767
|
+
u.value = null, y = null;
|
|
2768
|
+
}, we));
|
|
2769
|
+
}, I = () => {
|
|
2770
|
+
f.value = null, p.value = null, m.value = !1, h.value = {
|
|
2771
|
+
active: !1,
|
|
2772
|
+
lastX: 0,
|
|
2773
|
+
lastY: 0
|
|
2774
|
+
}, e.editor.view.focus();
|
|
2775
|
+
}, L = () => {
|
|
2776
|
+
let n = t.value;
|
|
2777
|
+
if (!n) return;
|
|
2778
|
+
if (!Le(n) || M.value.length === 0) {
|
|
2779
|
+
o.value = [];
|
|
2780
|
+
return;
|
|
2781
|
+
}
|
|
2782
|
+
let r = n.getBoundingClientRect(), i = M.value.flatMap((t) => {
|
|
2783
|
+
let n = Ne(Me(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
2784
|
+
return n ? [Oe(t, n, r)] : [];
|
|
2785
|
+
});
|
|
2786
|
+
o.value = Ve(o.value, i, M.value.map((e) => e.pos));
|
|
2787
|
+
}, R = () => {
|
|
2788
|
+
if (!E.value || !S.value) {
|
|
2789
|
+
a.value = null, s.value = null;
|
|
2790
|
+
return;
|
|
2791
|
+
}
|
|
2792
|
+
let r = t.value;
|
|
2793
|
+
if (!r) return;
|
|
2794
|
+
let i = Me(e.editor, S.value.pos, A.value), o = r.getBoundingClientRect(), l = Ne(i, o);
|
|
2795
|
+
if (!l) {
|
|
2796
|
+
a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
|
|
2797
|
+
return;
|
|
2798
|
+
}
|
|
2799
|
+
if (a.value = Ee(S.value.pos, l, o), c.value && n.value) {
|
|
2800
|
+
let e = n.value.getBoundingClientRect();
|
|
2801
|
+
s.value = Se({
|
|
2802
|
+
overlayRect: o,
|
|
2803
|
+
buttonRect: e,
|
|
2804
|
+
windowWidth: window.innerWidth,
|
|
2805
|
+
windowHeight: window.innerHeight
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2808
|
+
}, ne = async () => {
|
|
2809
|
+
if (e.readOnly) {
|
|
2810
|
+
if (!S.value) return;
|
|
2811
|
+
let e = await Te(S.value.text);
|
|
2812
|
+
F(_e(S.value, e ? "copied" : "failed"));
|
|
2813
|
+
return;
|
|
2814
|
+
}
|
|
2815
|
+
if (!ke(e.editor, S.value)) return;
|
|
2816
|
+
let t = await he(e.editor);
|
|
2817
|
+
F(_e(ge(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
2818
|
+
}, re = (t, n) => {
|
|
2819
|
+
if (e.readOnly) {
|
|
2820
|
+
at(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
|
|
2821
|
+
return;
|
|
2822
|
+
}
|
|
2823
|
+
let r = e.state.active && e.state.pos === t.pos;
|
|
2824
|
+
xe(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
|
|
2825
|
+
}, z = (t) => {
|
|
2826
|
+
if (e.readOnly || !S.value) return;
|
|
2827
|
+
let n = e.state.active && e.state.pos === S.value.pos;
|
|
2828
|
+
be(e.editor, S.value.pos, t) && (t === "mermaid" && xe(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
|
|
2829
|
+
}, ie = () => {
|
|
2830
|
+
e.readOnly || !S.value || ye(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2831
|
+
}, ae = () => {
|
|
2832
|
+
if (!S.value) return;
|
|
2833
|
+
let t = ze(e.editor, S.value.pos);
|
|
2834
|
+
if (!t) return;
|
|
2835
|
+
let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
2836
|
+
i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
|
|
2837
|
+
}, oe = () => {
|
|
2838
|
+
if (!S.value) return;
|
|
2839
|
+
let t = ze(e.editor, S.value.pos);
|
|
2840
|
+
t && (f.value = De(t), p.value = null, m.value = !1, h.value = {
|
|
2841
|
+
active: !1,
|
|
2842
|
+
lastX: 0,
|
|
2843
|
+
lastY: 0
|
|
2844
|
+
});
|
|
2845
|
+
}, B = (e) => {
|
|
2846
|
+
f.value = f.value ? {
|
|
2847
|
+
...f.value,
|
|
2848
|
+
scale: Ce(f.value.scale + e)
|
|
2849
|
+
} : null;
|
|
2850
|
+
}, se = () => {
|
|
2851
|
+
f.value = f.value ? De(f.value.svg) : null, h.value = {
|
|
2852
|
+
active: !1,
|
|
2853
|
+
lastX: 0,
|
|
2854
|
+
lastY: 0
|
|
2855
|
+
}, m.value = !1;
|
|
2856
|
+
}, ce = (e) => {
|
|
2857
|
+
e.preventDefault(), B(e.deltaY < 0 ? He : -He);
|
|
2858
|
+
}, le = (e) => {
|
|
2859
|
+
e.button === 0 && (e.preventDefault(), h.value = {
|
|
2860
|
+
active: !0,
|
|
2861
|
+
lastX: e.clientX,
|
|
2862
|
+
lastY: e.clientY
|
|
2863
|
+
}, m.value = !0);
|
|
2864
|
+
}, ue = (e) => {
|
|
2865
|
+
let t = h.value;
|
|
2866
|
+
if (!t.active) return;
|
|
2867
|
+
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
2868
|
+
h.value = {
|
|
2869
|
+
active: !0,
|
|
2870
|
+
lastX: e.clientX,
|
|
2871
|
+
lastY: e.clientY
|
|
2872
|
+
}, f.value = Ue(f.value, n, r);
|
|
2873
|
+
}, de = () => {
|
|
2874
|
+
h.value = {
|
|
2875
|
+
active: !1,
|
|
2876
|
+
lastX: 0,
|
|
2877
|
+
lastY: 0
|
|
2878
|
+
}, m.value = !1;
|
|
2879
|
+
};
|
|
2880
|
+
G(() => e.readOnly, (e) => {
|
|
2881
|
+
e && (c.value = !1, l.value = "");
|
|
2882
|
+
}), G(P, () => {
|
|
2883
|
+
F(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
|
|
2884
|
+
}), G(c, async (e) => {
|
|
2885
|
+
e && (await q(), R(), r.value?.focus({ preventScroll: !0 }));
|
|
2886
|
+
}), G(() => [
|
|
2887
|
+
E.value,
|
|
2888
|
+
g.value,
|
|
2889
|
+
S.value?.pos ?? null,
|
|
2890
|
+
c.value,
|
|
2891
|
+
A.value
|
|
2892
|
+
], async () => {
|
|
2893
|
+
await q(), R();
|
|
2894
|
+
}, {
|
|
2895
|
+
flush: "post",
|
|
2896
|
+
immediate: !0
|
|
2897
|
+
}), G(N, async () => {
|
|
2898
|
+
await q(), L(), window.requestAnimationFrame(L);
|
|
2899
|
+
}, {
|
|
2900
|
+
flush: "post",
|
|
2901
|
+
immediate: !0
|
|
2902
|
+
});
|
|
2903
|
+
let fe = null;
|
|
2904
|
+
return $t(() => {
|
|
2905
|
+
q(() => {
|
|
2906
|
+
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
2907
|
+
if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
|
|
2908
|
+
let r = Fe(e.editor, n.target), a = Ie(e.editor, r), o = a && !Be(e.editor, a) ? a.pos : null;
|
|
2909
|
+
i.value = i.value === o ? i.value : o;
|
|
2910
|
+
}, a = () => {
|
|
2911
|
+
c.value || (i.value = null);
|
|
2912
|
+
}, o = (t) => {
|
|
2913
|
+
if (t.key === "Escape") {
|
|
2914
|
+
if (f.value) {
|
|
2915
|
+
I();
|
|
2916
|
+
return;
|
|
2917
|
+
}
|
|
2918
|
+
c.value && (c.value = !1, e.editor.view.focus());
|
|
2919
|
+
}
|
|
2920
|
+
}, s = (e) => {
|
|
2921
|
+
c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
|
|
2922
|
+
}, l = ({ transaction: e }) => {
|
|
2923
|
+
e.getMeta(me) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(me) || rt(e)) && (v.value += 1);
|
|
2924
|
+
};
|
|
2925
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", R), window.addEventListener("scroll", R, !0), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), fe = () => {
|
|
2926
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", R), window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), te();
|
|
2927
|
+
};
|
|
2928
|
+
});
|
|
2929
|
+
}), K(() => {
|
|
2930
|
+
fe?.(), fe = null, te();
|
|
2931
|
+
}), () => {
|
|
2932
|
+
if (!E.value && M.value.length === 0 && !f.value) return null;
|
|
2933
|
+
let i = a.value ? {
|
|
2934
|
+
top: `${a.value.top}px`,
|
|
2935
|
+
right: `${a.value.right}px`
|
|
2936
|
+
} : void 0, u = s.value ? {
|
|
2937
|
+
left: `${s.value.left}px`,
|
|
2938
|
+
top: `${s.value.top}px`
|
|
2939
|
+
} : void 0;
|
|
2940
|
+
return V("div", {
|
|
2941
|
+
ref: t,
|
|
2942
|
+
class: "markweave-codeblock-overlay",
|
|
2943
|
+
"data-testid": "markweave-codeblock-overlay",
|
|
2944
|
+
"data-read-only": e.readOnly ? "true" : "false"
|
|
2945
|
+
}, [
|
|
2946
|
+
...M.value.map((e) => {
|
|
2947
|
+
let t = o.value.find((t) => t.pos === e.pos);
|
|
2948
|
+
return V("div", {
|
|
2949
|
+
key: e.pos,
|
|
2950
|
+
class: "markweave-mermaid-tabs",
|
|
2951
|
+
"data-testid": "markweave-mermaid-tabs",
|
|
2952
|
+
"data-code-block-pos": e.pos,
|
|
2953
|
+
"data-positioned": t ? "true" : "false",
|
|
2954
|
+
style: t ? {
|
|
2955
|
+
top: `${t.top}px`,
|
|
2956
|
+
left: `${t.left}px`
|
|
2957
|
+
} : void 0
|
|
2958
|
+
}, ["code", "preview"].map((t) => V("button", {
|
|
2959
|
+
key: t,
|
|
2960
|
+
type: "button",
|
|
2961
|
+
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
2962
|
+
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
2963
|
+
onMousedown: $,
|
|
2964
|
+
onClick: () => re(e, t)
|
|
2965
|
+
}, t === "code" ? "Code" : "Preview")));
|
|
2966
|
+
}),
|
|
2967
|
+
E.value && S.value ? V("div", {
|
|
2968
|
+
class: "markweave-codeblock-controls",
|
|
2969
|
+
"data-testid": "markweave-codeblock-controls",
|
|
2970
|
+
"data-positioned": a.value ? "true" : "false",
|
|
2971
|
+
"data-collapsed": T.value ? "true" : "false",
|
|
2972
|
+
"data-read-only": e.readOnly ? "true" : "false",
|
|
2973
|
+
"aria-label": "Code block controls",
|
|
2974
|
+
style: i
|
|
2975
|
+
}, [
|
|
2976
|
+
e.readOnly ? V("span", {
|
|
2977
|
+
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
2978
|
+
"aria-label": "Code block language",
|
|
2979
|
+
"data-testid": "markweave-codeblock-language"
|
|
2980
|
+
}, [V("span", null, O.value)]) : V("button", {
|
|
2981
|
+
ref: n,
|
|
2982
|
+
type: "button",
|
|
2983
|
+
class: "markweave-codeblock-language-button",
|
|
2984
|
+
"aria-label": "Code block language",
|
|
2985
|
+
"aria-expanded": c.value ? "true" : "false",
|
|
2986
|
+
"aria-haspopup": "listbox",
|
|
2987
|
+
"data-testid": "markweave-codeblock-language",
|
|
2988
|
+
onMousedown: $,
|
|
2989
|
+
onClick: () => {
|
|
2990
|
+
c.value = !c.value;
|
|
2991
|
+
}
|
|
2992
|
+
}, [V("span", null, O.value), Q("chevron")]),
|
|
2993
|
+
D.value ? V("button", {
|
|
2994
|
+
type: "button",
|
|
2995
|
+
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
2996
|
+
"aria-label": T.value ? "Expand code block" : "Collapse code block",
|
|
2997
|
+
title: T.value ? "Expand code block" : "Collapse code block",
|
|
2998
|
+
"data-testid": "markweave-codeblock-collapse",
|
|
2999
|
+
"data-collapsed": T.value ? "true" : "false",
|
|
3000
|
+
onMousedown: $,
|
|
3001
|
+
onClick: ie
|
|
3002
|
+
}, [Q("chevron")]) : null,
|
|
3003
|
+
V("span", { class: "markweave-codeblock-copy-wrap" }, [V("button", {
|
|
3004
|
+
type: "button",
|
|
3005
|
+
class: "markweave-codeblock-icon-button",
|
|
3006
|
+
"aria-label": "Copy to clipboard",
|
|
3007
|
+
"data-testid": "markweave-codeblock-copy",
|
|
3008
|
+
"data-copy-state": k.value,
|
|
3009
|
+
onMousedown: $,
|
|
3010
|
+
onMouseenter: () => {
|
|
3011
|
+
d.value = !0;
|
|
3012
|
+
},
|
|
3013
|
+
onMouseleave: () => {
|
|
3014
|
+
d.value = !1;
|
|
3015
|
+
},
|
|
3016
|
+
onFocus: () => {
|
|
3017
|
+
d.value = !0;
|
|
3018
|
+
},
|
|
3019
|
+
onBlur: () => {
|
|
3020
|
+
d.value = !1;
|
|
3021
|
+
},
|
|
3022
|
+
onClick: () => {
|
|
3023
|
+
ne();
|
|
3024
|
+
}
|
|
3025
|
+
}, [Q(k.value === "copied" ? "check" : "clipboard")]), d.value ? V("span", {
|
|
3026
|
+
class: "markweave-codeblock-tooltip",
|
|
3027
|
+
role: "tooltip",
|
|
3028
|
+
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
3029
|
+
}, "Copy to clipboard") : null]),
|
|
3030
|
+
w.value && A.value === "preview" ? V("div", {
|
|
3031
|
+
class: "markweave-mermaid-preview-actions",
|
|
3032
|
+
"data-testid": "markweave-mermaid-preview-actions"
|
|
3033
|
+
}, [V("button", {
|
|
3034
|
+
type: "button",
|
|
3035
|
+
class: "markweave-codeblock-icon-button",
|
|
3036
|
+
"aria-label": "Fullscreen Mermaid preview",
|
|
3037
|
+
"data-testid": "markweave-mermaid-fullscreen",
|
|
3038
|
+
disabled: !j.value,
|
|
3039
|
+
onMousedown: $,
|
|
3040
|
+
onClick: oe
|
|
3041
|
+
}, [Q("expand")]), V("button", {
|
|
3042
|
+
type: "button",
|
|
3043
|
+
class: "markweave-codeblock-icon-button",
|
|
3044
|
+
"aria-label": "Download Mermaid SVG",
|
|
3045
|
+
"data-testid": "markweave-mermaid-download",
|
|
3046
|
+
disabled: !j.value,
|
|
3047
|
+
onMousedown: $,
|
|
3048
|
+
onClick: ae
|
|
3049
|
+
}, [Q("download")])]) : null
|
|
3050
|
+
]) : null,
|
|
3051
|
+
D.value && E.value && c.value && S.value ? V("div", {
|
|
3052
|
+
class: "markweave-codeblock-language-menu",
|
|
3053
|
+
role: "listbox",
|
|
3054
|
+
"aria-label": "Code block languages",
|
|
3055
|
+
"data-testid": "markweave-codeblock-language-menu",
|
|
3056
|
+
"data-positioned": s.value ? "true" : "false",
|
|
3057
|
+
style: u
|
|
3058
|
+
}, [V("label", { class: "markweave-codeblock-language-search" }, [V("input", {
|
|
3059
|
+
ref: r,
|
|
3060
|
+
value: l.value,
|
|
3061
|
+
placeholder: "Search...",
|
|
3062
|
+
"data-testid": "markweave-codeblock-language-search",
|
|
3063
|
+
onInput: (e) => {
|
|
3064
|
+
l.value = e.target.value;
|
|
3065
|
+
},
|
|
3066
|
+
onKeydown: (t) => {
|
|
3067
|
+
t.key === "Escape" && (t.preventDefault(), c.value = !1, e.editor.view.focus());
|
|
3068
|
+
}
|
|
3069
|
+
}), Q("search")]), V("div", { class: "markweave-codeblock-language-list" }, ee.value.map((e) => {
|
|
3070
|
+
let t = S.value?.language === e.language;
|
|
3071
|
+
return V("button", {
|
|
3072
|
+
key: e.language,
|
|
3073
|
+
type: "button",
|
|
3074
|
+
role: "option",
|
|
3075
|
+
"aria-selected": t ? "true" : "false",
|
|
3076
|
+
"data-testid": `markweave-codeblock-language-option-${e.language}`,
|
|
3077
|
+
"data-active": t ? "true" : "false",
|
|
3078
|
+
onMousedown: $,
|
|
3079
|
+
onClick: () => z(e.language)
|
|
3080
|
+
}, [V("span", null, e.label), t ? Q("check") : null]);
|
|
3081
|
+
}))]) : null,
|
|
3082
|
+
f.value ? V("div", {
|
|
3083
|
+
class: "markweave-mermaid-fullscreen-layer",
|
|
3084
|
+
role: "dialog",
|
|
3085
|
+
"aria-modal": "true",
|
|
3086
|
+
"aria-label": "Mermaid preview",
|
|
3087
|
+
"data-testid": "markweave-mermaid-fullscreen-layer"
|
|
3088
|
+
}, [
|
|
3089
|
+
V("div", {
|
|
3090
|
+
class: "markweave-mermaid-fullscreen-toolbar",
|
|
3091
|
+
"data-testid": "markweave-mermaid-fullscreen-toolbar"
|
|
3092
|
+
}, [
|
|
3093
|
+
V("button", {
|
|
3094
|
+
type: "button",
|
|
3095
|
+
class: "markweave-mermaid-fullscreen-control",
|
|
3096
|
+
"aria-label": "Zoom out",
|
|
3097
|
+
"data-testid": "markweave-mermaid-fullscreen-zoom-out",
|
|
3098
|
+
onMouseenter: () => {
|
|
3099
|
+
p.value = "zoom-out";
|
|
3100
|
+
},
|
|
3101
|
+
onMouseleave: () => {
|
|
3102
|
+
p.value = null;
|
|
3103
|
+
},
|
|
3104
|
+
onFocus: () => {
|
|
3105
|
+
p.value = "zoom-out";
|
|
3106
|
+
},
|
|
3107
|
+
onBlur: () => {
|
|
3108
|
+
p.value = null;
|
|
3109
|
+
},
|
|
3110
|
+
onClick: () => B(-He)
|
|
3111
|
+
}, [Q("zoomOut")]),
|
|
3112
|
+
V("span", {
|
|
3113
|
+
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3114
|
+
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3115
|
+
}, je(f.value.scale)),
|
|
3116
|
+
V("button", {
|
|
3117
|
+
type: "button",
|
|
3118
|
+
class: "markweave-mermaid-fullscreen-control",
|
|
3119
|
+
"aria-label": "Zoom in",
|
|
3120
|
+
"data-testid": "markweave-mermaid-fullscreen-zoom-in",
|
|
3121
|
+
onMouseenter: () => {
|
|
3122
|
+
p.value = "zoom-in";
|
|
3123
|
+
},
|
|
3124
|
+
onMouseleave: () => {
|
|
3125
|
+
p.value = null;
|
|
3126
|
+
},
|
|
3127
|
+
onFocus: () => {
|
|
3128
|
+
p.value = "zoom-in";
|
|
3129
|
+
},
|
|
3130
|
+
onBlur: () => {
|
|
3131
|
+
p.value = null;
|
|
3132
|
+
},
|
|
3133
|
+
onClick: () => B(He)
|
|
3134
|
+
}, [Q("zoomIn")]),
|
|
3135
|
+
V("button", {
|
|
3136
|
+
type: "button",
|
|
3137
|
+
class: "markweave-mermaid-fullscreen-control",
|
|
3138
|
+
"aria-label": "Reset zoom",
|
|
3139
|
+
"data-testid": "markweave-mermaid-fullscreen-reset",
|
|
3140
|
+
onMouseenter: () => {
|
|
3141
|
+
p.value = "reset";
|
|
3142
|
+
},
|
|
3143
|
+
onMouseleave: () => {
|
|
3144
|
+
p.value = null;
|
|
3145
|
+
},
|
|
3146
|
+
onFocus: () => {
|
|
3147
|
+
p.value = "reset";
|
|
3148
|
+
},
|
|
3149
|
+
onBlur: () => {
|
|
3150
|
+
p.value = null;
|
|
3151
|
+
},
|
|
3152
|
+
onClick: se
|
|
3153
|
+
}, [Q("reset")]),
|
|
3154
|
+
p.value ? V("span", {
|
|
3155
|
+
class: "markweave-mermaid-fullscreen-tooltip",
|
|
3156
|
+
role: "tooltip",
|
|
3157
|
+
"data-testid": "markweave-mermaid-fullscreen-tooltip"
|
|
3158
|
+
}, p.value === "zoom-out" ? "Zoom out" : p.value === "zoom-in" ? "Zoom in" : "Reset") : null
|
|
3159
|
+
]),
|
|
3160
|
+
V("button", {
|
|
3161
|
+
type: "button",
|
|
3162
|
+
class: "markweave-mermaid-fullscreen-close",
|
|
3163
|
+
"aria-label": "Close fullscreen Mermaid preview",
|
|
3164
|
+
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3165
|
+
onClick: I
|
|
3166
|
+
}, [Q("close")]),
|
|
3167
|
+
V("div", {
|
|
3168
|
+
class: "markweave-mermaid-fullscreen-viewport",
|
|
3169
|
+
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
3170
|
+
"data-dragging": m.value ? "true" : "false",
|
|
3171
|
+
onWheel: ce,
|
|
3172
|
+
onMousedown: le,
|
|
3173
|
+
onMousemove: ue,
|
|
3174
|
+
onMouseup: de,
|
|
3175
|
+
onMouseleave: de
|
|
3176
|
+
}, [V("div", {
|
|
3177
|
+
class: "markweave-mermaid-fullscreen-content",
|
|
3178
|
+
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
3179
|
+
"data-scale-percent": Math.round(f.value.scale * 100),
|
|
3180
|
+
"data-translate": `${Math.round(f.value.translateX)},${Math.round(f.value.translateY)}`,
|
|
3181
|
+
style: {
|
|
3182
|
+
width: `${f.value.width}px`,
|
|
3183
|
+
height: `${f.value.height}px`,
|
|
3184
|
+
transform: `translate(${f.value.translateX}px, ${f.value.translateY}px) scale(${f.value.scale})`
|
|
3185
|
+
},
|
|
3186
|
+
innerHTML: f.value.svg
|
|
3187
|
+
})])
|
|
3188
|
+
]) : null
|
|
3189
|
+
]);
|
|
3190
|
+
};
|
|
3191
|
+
}
|
|
3192
|
+
}), Tr = J({
|
|
3193
|
+
name: "MarkweaveVueInnerToc",
|
|
3194
|
+
props: {
|
|
3195
|
+
editor: {
|
|
3196
|
+
type: Object,
|
|
3197
|
+
required: !0
|
|
3198
|
+
},
|
|
3199
|
+
state: {
|
|
3200
|
+
type: Object,
|
|
3201
|
+
required: !0
|
|
3202
|
+
},
|
|
3203
|
+
messages: {
|
|
3204
|
+
type: Object,
|
|
3205
|
+
required: !0
|
|
3206
|
+
},
|
|
3207
|
+
editable: {
|
|
3208
|
+
type: Boolean,
|
|
3209
|
+
required: !0
|
|
3210
|
+
}
|
|
3211
|
+
},
|
|
3212
|
+
setup(e) {
|
|
3213
|
+
return () => e.state.items.length ? V("nav", {
|
|
3214
|
+
class: "markweave-inner-toc",
|
|
3215
|
+
"data-testid": "markweave-inner-toc",
|
|
3216
|
+
"aria-label": e.messages.toc.ariaLabel
|
|
3217
|
+
}, [V("div", {
|
|
3218
|
+
class: "markweave-inner-toc-rail",
|
|
3219
|
+
"aria-hidden": "true"
|
|
3220
|
+
}, e.state.items.map((e) => V("span", {
|
|
3221
|
+
key: e.id,
|
|
3222
|
+
"data-level": e.level,
|
|
3223
|
+
"data-active": e.active ? "true" : "false"
|
|
3224
|
+
}))), V("div", { class: "markweave-inner-toc-panel" }, [V("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => V("button", {
|
|
3225
|
+
key: t.id,
|
|
3226
|
+
type: "button",
|
|
3227
|
+
class: "markweave-inner-toc-item",
|
|
3228
|
+
"data-level": t.level,
|
|
3229
|
+
"data-active": t.active ? "true" : "false",
|
|
3230
|
+
"aria-current": t.active ? "location" : void 0,
|
|
3231
|
+
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3232
|
+
title: t.text,
|
|
3233
|
+
onClick: () => pe(e.editor, t, {
|
|
3234
|
+
behavior: "smooth",
|
|
3235
|
+
focus: e.editable
|
|
3236
|
+
})
|
|
3237
|
+
}, t.text)))])]) : null;
|
|
3238
|
+
}
|
|
3239
|
+
});
|
|
3240
|
+
function Er(e = {}) {
|
|
3241
|
+
let t = m(e.lang), r = p(t), i = f(t), a = H(l(e.mode)), o = W(() => a.value === "live" && e.editable !== !1), s = H(0), c = U(null), d = H(mt), h = U(null), g = U(null), _ = H("code"), v = U(null), y = U(xt), b = H(null), x = H(!1), S = F(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), C = e.onSlashCommandUpload, w = U(null);
|
|
3242
|
+
w.value = new n({
|
|
3243
|
+
extensions: sr({
|
|
3244
|
+
lang: t,
|
|
3245
|
+
onImageUpload: (e) => C?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3246
|
+
onVideoUpload: (e) => C?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
|
|
3247
|
+
}),
|
|
3248
|
+
content: e.content ?? e.defaultContent ?? "",
|
|
3249
|
+
contentType: P(S),
|
|
3250
|
+
editable: o.value,
|
|
3251
|
+
autofocus: e.autofocus,
|
|
3252
|
+
editorProps: {
|
|
3253
|
+
attributes: {
|
|
3254
|
+
class: "markweave-editor-surface",
|
|
3255
|
+
"data-testid": "markweave-editor-surface",
|
|
3256
|
+
autocapitalize: "off",
|
|
3257
|
+
autocorrect: "off",
|
|
3258
|
+
spellcheck: "false",
|
|
3259
|
+
translate: "no"
|
|
3260
|
+
},
|
|
3261
|
+
handleClick: (e, t, n) => {
|
|
3262
|
+
if (!o.value) return ae(n);
|
|
3263
|
+
let r = Ze(e, n);
|
|
3264
|
+
return r ? (n.preventDefault(), n.stopPropagation(), E(), tt(e, r, !0), nt(e, r), v.value = r, !0) : (v.value = null, !1);
|
|
3265
|
+
},
|
|
3266
|
+
handleDOMEvents: {
|
|
3267
|
+
compositionstart: () => o.value ? (d.value = ht(d.value, { type: "composition-start" }), h.value = null, !1) : !1,
|
|
3268
|
+
compositionend: (e) => (o.value && window.setTimeout(() => D(e), 0), !1),
|
|
3269
|
+
click: (e, t) => {
|
|
3270
|
+
if (!o.value) return ae(t);
|
|
3271
|
+
let n = Ze(e, t);
|
|
3272
|
+
return n ? (t.preventDefault(), t.stopPropagation(), E(), tt(e, n, !0), nt(e, n), v.value = n, !0) : (v.value = null, !1);
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3276
|
+
onSelectionUpdate: ({ editor: e }) => k(e),
|
|
3277
|
+
onCreate: ({ editor: t }) => {
|
|
3278
|
+
u(t, {
|
|
3279
|
+
mode: a.value,
|
|
3280
|
+
editable: o.value
|
|
3281
|
+
}), it(t, o.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && o.value && vt(t), j(t), k(t), s.value += 1;
|
|
3282
|
+
},
|
|
3283
|
+
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3284
|
+
if (j(e), (t.docChanged || rt(t)) && (s.value += 1), t.docChanged && v.value) {
|
|
3285
|
+
let t = Xe(e, v.value.pos);
|
|
3286
|
+
v.value = t?.kind === v.value.kind ? t : null;
|
|
3287
|
+
}
|
|
3288
|
+
},
|
|
3289
|
+
onUpdate: ({ editor: t }) => {
|
|
3290
|
+
k(t), o.value && O(t), x.value || e.onUpdate?.(ee(t));
|
|
3291
|
+
}
|
|
3292
|
+
});
|
|
3293
|
+
let T = W(() => w.value ?? null);
|
|
3294
|
+
function E() {
|
|
3295
|
+
h.value = null, g.value = null, d.value = mt;
|
|
3296
|
+
}
|
|
3297
|
+
function D(e) {
|
|
3298
|
+
let t = pt(e.state);
|
|
3299
|
+
if (!t) {
|
|
3300
|
+
d.value = d.value.name === "idle" ? d.value : mt, h.value = null, g.value = null;
|
|
3301
|
+
return;
|
|
3302
|
+
}
|
|
3303
|
+
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3304
|
+
h.value = ft(n, {
|
|
3305
|
+
frameRect: i,
|
|
3306
|
+
triggerRect: r
|
|
3307
|
+
}), d.value = dt(d.value, t);
|
|
3308
|
+
}
|
|
3309
|
+
function O(e) {
|
|
3310
|
+
D(e.view);
|
|
3311
|
+
}
|
|
3312
|
+
function k(e) {
|
|
3313
|
+
c.value = B(e);
|
|
3314
|
+
let t = Qe(e);
|
|
3315
|
+
t && (et(e, t, !0), v.value = t);
|
|
3316
|
+
let n = ge(e);
|
|
3317
|
+
n.active && n.language === "mermaid" && (_.value = n.mermaidPreviewMode);
|
|
3318
|
+
}
|
|
3319
|
+
function j(e) {
|
|
3320
|
+
y.value = ur(e);
|
|
3321
|
+
}
|
|
3322
|
+
let M = W(() => T.value ? ge(T.value) : lr), I = W(() => T.value ? yt(T.value.state) : cr), L = W(() => c.value?.currentNode === "codeBlock"), R = W(() => L.value && M.value.language === "mermaid"), ne = W(() => T.value ? ot({
|
|
3323
|
+
active: R.value,
|
|
3324
|
+
mode: _.value,
|
|
3325
|
+
source: M.value.text
|
|
3326
|
+
}) : ot({
|
|
3327
|
+
active: !1,
|
|
3328
|
+
mode: "code",
|
|
3329
|
+
source: ""
|
|
3330
|
+
})), re = W(() => T.value ? _t(T.value.state) : null), z = W(() => T.value ? de(T.value.state.doc) : le.items), ie = W(() => fe(z.value, b.value)), se = W(() => ce(z.value, ie.value)), pe = W(() => st(d.value.query, i)), me = W(() => oe({
|
|
3331
|
+
revision: s.value,
|
|
3332
|
+
mode: a.value,
|
|
3333
|
+
editable: o.value,
|
|
3334
|
+
toc: se.value,
|
|
3335
|
+
selection: c.value,
|
|
3336
|
+
slash: d.value,
|
|
3337
|
+
table: I.value,
|
|
3338
|
+
tableInteraction: y.value,
|
|
3339
|
+
codeBlock: M.value,
|
|
3340
|
+
mermaid: ne.value,
|
|
3341
|
+
tableDebugSnapshot: re.value
|
|
3342
|
+
})), he = {
|
|
3343
|
+
closeSlashMenu: E,
|
|
3344
|
+
focusFirstTableBodyCell: () => T.value ? vt(T.value) : !1,
|
|
3345
|
+
setContent: (e, t = {}) => {
|
|
3346
|
+
if (!T.value) return !1;
|
|
3347
|
+
let n = F(t.format);
|
|
3348
|
+
return T.value.commands.setContent(e, {
|
|
3349
|
+
contentType: P(n),
|
|
3350
|
+
emitUpdate: t.emitUpdate ?? !1
|
|
3351
|
+
}), t.focusFirstTableBodyCell && vt(T.value), k(T.value), o.value && O(T.value), j(T.value), s.value += 1, !0;
|
|
3352
|
+
}
|
|
3353
|
+
};
|
|
3354
|
+
function _e(e, t) {
|
|
3355
|
+
if (!(!T.value || !o.value || !ct(e))) {
|
|
3356
|
+
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3357
|
+
g.value = e;
|
|
3358
|
+
return;
|
|
3359
|
+
}
|
|
3360
|
+
ut(T.value, d.value, e, t), d.value = ht(d.value, { type: "execute" }), E();
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
function ve(e) {
|
|
3364
|
+
if (!T.value || g.value || !o.value) return;
|
|
3365
|
+
let t = lt(d.value, pe.value, e.key, { isComposing: e.isComposing || N(T.value.state) });
|
|
3366
|
+
if (t.type !== "ignore") {
|
|
3367
|
+
if (e.preventDefault(), t.type === "close") {
|
|
3368
|
+
d.value = ht(d.value, { type: "escape" }), E();
|
|
3369
|
+
return;
|
|
3370
|
+
}
|
|
3371
|
+
if (t.type === "move-active") {
|
|
3372
|
+
d.value = ht(d.value, {
|
|
3373
|
+
type: "move-active",
|
|
3374
|
+
delta: t.delta,
|
|
3375
|
+
optionCount: t.optionCount
|
|
3376
|
+
});
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
_e(t.command);
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
G(() => [e.mode, e.editable], () => {
|
|
3383
|
+
a.value = l(e.mode), T.value && (T.value.setEditable(o.value), u(T.value, {
|
|
3384
|
+
mode: a.value,
|
|
3385
|
+
editable: o.value
|
|
3386
|
+
}), it(T.value, o.value ? "live" : "view"), o.value || E());
|
|
3387
|
+
}, { immediate: !0 }), G(() => e.content, (t) => {
|
|
3388
|
+
!T.value || t === void 0 || te(T.value, t, F(e.contentFormat)) || (x.value = !0, T.value.commands.setContent(t, {
|
|
3389
|
+
contentType: P(F(e.contentFormat)),
|
|
3390
|
+
emitUpdate: !1
|
|
3391
|
+
}), x.value = !1, k(T.value), o.value && O(T.value), j(T.value), s.value += 1);
|
|
3392
|
+
}), G(me, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), G(se, (t) => e.onTocChange?.(t), { immediate: !0 }), G(z, (e) => {
|
|
3393
|
+
let t = fe(e, b.value);
|
|
3394
|
+
b.value !== t && (b.value = t);
|
|
3395
|
+
});
|
|
3396
|
+
let ye = null;
|
|
3397
|
+
return $t(() => {
|
|
3398
|
+
let e = () => {
|
|
3399
|
+
if (!T.value || !z.value.length) {
|
|
3400
|
+
b.value = null;
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
let e = null;
|
|
3404
|
+
try {
|
|
3405
|
+
e = ue(T.value, z.value);
|
|
3406
|
+
} catch {
|
|
3407
|
+
return;
|
|
3408
|
+
}
|
|
3409
|
+
b.value !== e && (b.value = e);
|
|
3410
|
+
}, t = () => window.requestAnimationFrame(e), n = dr(T.value?.view.dom ?? null);
|
|
3411
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), ye = () => {
|
|
3412
|
+
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3413
|
+
};
|
|
3414
|
+
}), K(() => {
|
|
3415
|
+
ye?.(), w.value?.destroy(), w.value = null;
|
|
3416
|
+
}), {
|
|
3417
|
+
editor: T,
|
|
3418
|
+
runtimeSnapshot: me,
|
|
3419
|
+
actions: he,
|
|
3420
|
+
__render: {
|
|
3421
|
+
messages: r,
|
|
3422
|
+
effectiveEditable: o,
|
|
3423
|
+
tableFocusState: I,
|
|
3424
|
+
tableInteractionState: y,
|
|
3425
|
+
codeBlockState: M,
|
|
3426
|
+
isCodeBlockActive: L,
|
|
3427
|
+
mermaidMode: _,
|
|
3428
|
+
mathTarget: v,
|
|
3429
|
+
setMermaidMode: (e) => {
|
|
3430
|
+
_.value = e;
|
|
3431
|
+
},
|
|
3432
|
+
tocState: se,
|
|
3433
|
+
filteredSlashCommands: pe,
|
|
3434
|
+
slashState: d,
|
|
3435
|
+
slashMenuPosition: h,
|
|
3436
|
+
slashInputCommand: g,
|
|
3437
|
+
runSlashCommand: _e,
|
|
3438
|
+
handleEditorKeyDown: ve,
|
|
3439
|
+
setSlashInputCommand: (e) => {
|
|
3440
|
+
g.value = e;
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
};
|
|
3444
|
+
}
|
|
3445
|
+
var Dr = J({
|
|
3446
|
+
name: "MarkweaveEditor",
|
|
3447
|
+
props: {
|
|
3448
|
+
defaultContent: {
|
|
3449
|
+
type: [String, Object],
|
|
3450
|
+
default: ""
|
|
3451
|
+
},
|
|
3452
|
+
defaultContentFormat: {
|
|
3453
|
+
type: String,
|
|
3454
|
+
default: void 0
|
|
3455
|
+
},
|
|
3456
|
+
content: {
|
|
3457
|
+
type: [String, Object],
|
|
3458
|
+
default: void 0
|
|
3459
|
+
},
|
|
3460
|
+
contentFormat: {
|
|
3461
|
+
type: String,
|
|
3462
|
+
default: void 0
|
|
3463
|
+
},
|
|
3464
|
+
editable: {
|
|
3465
|
+
type: Boolean,
|
|
3466
|
+
default: !0
|
|
3467
|
+
},
|
|
3468
|
+
mode: {
|
|
3469
|
+
type: String,
|
|
3470
|
+
default: "live"
|
|
3471
|
+
},
|
|
3472
|
+
innerToc: {
|
|
3473
|
+
type: Boolean,
|
|
3474
|
+
default: !0
|
|
3475
|
+
},
|
|
3476
|
+
autofocus: {
|
|
3477
|
+
type: Boolean,
|
|
3478
|
+
default: !1
|
|
3479
|
+
},
|
|
3480
|
+
lang: {
|
|
3481
|
+
type: String,
|
|
3482
|
+
default: void 0
|
|
3483
|
+
},
|
|
3484
|
+
ariaLabel: {
|
|
3485
|
+
type: String,
|
|
3486
|
+
default: void 0
|
|
3487
|
+
},
|
|
3488
|
+
autoFocusFirstTableBodyCell: {
|
|
3489
|
+
type: Boolean,
|
|
3490
|
+
default: !1
|
|
3491
|
+
},
|
|
3492
|
+
className: {
|
|
3493
|
+
type: String,
|
|
3494
|
+
default: void 0
|
|
3495
|
+
},
|
|
3496
|
+
onUpdate: {
|
|
3497
|
+
type: Function,
|
|
3498
|
+
default: void 0
|
|
3499
|
+
},
|
|
3500
|
+
onEditWithAi: {
|
|
3501
|
+
type: Function,
|
|
3502
|
+
default: void 0
|
|
3503
|
+
},
|
|
3504
|
+
onRewriteSelection: {
|
|
3505
|
+
type: Function,
|
|
3506
|
+
default: void 0
|
|
3507
|
+
},
|
|
3508
|
+
onExtractToNote: {
|
|
3509
|
+
type: Function,
|
|
3510
|
+
default: void 0
|
|
3511
|
+
},
|
|
3512
|
+
onSlashCommandUpload: {
|
|
3513
|
+
type: Function,
|
|
3514
|
+
default: void 0
|
|
3515
|
+
},
|
|
3516
|
+
onTableCopyPayload: {
|
|
3517
|
+
type: Function,
|
|
3518
|
+
default: void 0
|
|
3519
|
+
},
|
|
3520
|
+
onTableCommandResult: {
|
|
3521
|
+
type: Function,
|
|
3522
|
+
default: void 0
|
|
3523
|
+
},
|
|
3524
|
+
onRuntimeStateChange: {
|
|
3525
|
+
type: Function,
|
|
3526
|
+
default: void 0
|
|
3527
|
+
},
|
|
3528
|
+
onTocChange: {
|
|
3529
|
+
type: Function,
|
|
3530
|
+
default: void 0
|
|
3531
|
+
}
|
|
3532
|
+
},
|
|
3533
|
+
setup(e) {
|
|
3534
|
+
let t = Er(e);
|
|
3535
|
+
return () => {
|
|
3536
|
+
let n = t.editor.value;
|
|
3537
|
+
if (!n) return null;
|
|
3538
|
+
let i = t.__render;
|
|
3539
|
+
return V("section", {
|
|
3540
|
+
class: ["markweave-editor-frame", e.className].filter(Boolean).join(" "),
|
|
3541
|
+
"aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
|
|
3542
|
+
"data-testid": "markweave-editor-frame",
|
|
3543
|
+
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3544
|
+
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3545
|
+
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3546
|
+
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
3547
|
+
onKeydownCapture: i.handleEditorKeyDown
|
|
3548
|
+
}, [
|
|
3549
|
+
i.effectiveEditable.value ? V(yr, {
|
|
3550
|
+
editor: n,
|
|
3551
|
+
messages: i.messages
|
|
3552
|
+
}) : null,
|
|
3553
|
+
i.effectiveEditable.value ? V(xr, {
|
|
3554
|
+
commands: i.filteredSlashCommands.value,
|
|
3555
|
+
state: i.slashState.value,
|
|
3556
|
+
position: i.slashMenuPosition.value,
|
|
3557
|
+
inputCommand: i.slashInputCommand.value,
|
|
3558
|
+
messages: i.messages,
|
|
3559
|
+
onSelect: i.runSlashCommand,
|
|
3560
|
+
onInputCommandChange: i.setSlashInputCommand,
|
|
3561
|
+
onUpload: e.onSlashCommandUpload
|
|
3562
|
+
}) : null,
|
|
3563
|
+
i.effectiveEditable.value ? V(Sr, {
|
|
3564
|
+
editor: n,
|
|
3565
|
+
active: i.tableFocusState.value.active,
|
|
3566
|
+
interactionState: i.tableInteractionState.value,
|
|
3567
|
+
messages: i.messages,
|
|
3568
|
+
onCopyPayload: e.onTableCopyPayload,
|
|
3569
|
+
onCommandResult: e.onTableCommandResult,
|
|
3570
|
+
onEditWithAi: e.onEditWithAi
|
|
3571
|
+
}) : null,
|
|
3572
|
+
i.effectiveEditable.value ? V(Cr, {
|
|
3573
|
+
editor: n,
|
|
3574
|
+
focusState: i.tableFocusState.value
|
|
3575
|
+
}) : null,
|
|
3576
|
+
V(wr, {
|
|
3577
|
+
editor: n,
|
|
3578
|
+
state: i.codeBlockState.value,
|
|
3579
|
+
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
3580
|
+
mermaidMode: i.mermaidMode.value,
|
|
3581
|
+
onMermaidModeChange: i.setMermaidMode,
|
|
3582
|
+
readOnly: !i.effectiveEditable.value
|
|
3583
|
+
}),
|
|
3584
|
+
e.innerToc && i.tocState.value.items.length ? V(Tr, {
|
|
3585
|
+
editor: n,
|
|
3586
|
+
state: i.tocState.value,
|
|
3587
|
+
messages: i.messages,
|
|
3588
|
+
editable: i.effectiveEditable.value
|
|
3589
|
+
}) : null,
|
|
3590
|
+
i.effectiveEditable.value && i.mathTarget.value ? V(br, {
|
|
3591
|
+
editor: n,
|
|
3592
|
+
messages: i.messages,
|
|
3593
|
+
target: i.mathTarget.value,
|
|
3594
|
+
onClose: () => i.mathTarget.value = null
|
|
3595
|
+
}) : null,
|
|
3596
|
+
V(r, { editor: n })
|
|
3597
|
+
]);
|
|
3598
|
+
};
|
|
3599
|
+
}
|
|
3600
|
+
});
|
|
3601
|
+
//#endregion
|
|
3602
|
+
export { Dr as MarkweaveEditor, sr as createMarkweaveEditorExtensions, sr as createMarkweaveVue2EditorExtensions, Er as useMarkweaveEditorController };
|