md-editor-v3 6.5.4 → 6.5.5
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/lib/cjs/MdEditor.cjs +15 -15
- package/lib/cjs/chunks/index4.cjs +36 -36
- package/lib/es/MdEditor.mjs +942 -890
- package/lib/es/chunks/index4.mjs +453 -430
- package/lib/types/index.d.ts +5 -5
- package/package.json +1 -1
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { a as te, D as
|
|
2
|
-
import { s as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { inject as r, watch as
|
|
7
|
-
import {
|
|
8
|
-
import { linkTo as
|
|
9
|
-
import { deleteLine as Nt, history as $e, undo as At, redo as
|
|
10
|
-
import { markdown as
|
|
11
|
-
import { languages as
|
|
12
|
-
import { EditorState as
|
|
13
|
-
import { placeholder as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { autocompletion as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
1
|
+
import { a as te, D as lt } from "./chunks/index.mjs";
|
|
2
|
+
import { s as nt, a as rt, M as We } from "./chunks/index3.mjs";
|
|
3
|
+
import { e as T, C as st, c as it, a as ct, b as ut, d as dt, u as mt, f as bt, g as vt, h as gt, i as ht, j as pt, k as ft, l as Tt, M as wt } from "./chunks/index4.mjs";
|
|
4
|
+
import yt from "./ModalToolbar.mjs";
|
|
5
|
+
import Ct from "./NormalToolbar.mjs";
|
|
6
|
+
import { inject as r, watch as A, nextTick as ce, onMounted as K, ref as S, defineComponent as w, createVNode as a, reactive as Z, toRef as ke, computed as P, Fragment as _e, cloneVNode as re, createApp as kt, shallowRef as $t, onBeforeUnmount as pe } from "vue";
|
|
7
|
+
import { p as l, g as X, b as xt, M as le, d as St, a as It } from "./chunks/config.mjs";
|
|
8
|
+
import { linkTo as Et, throttle as Lt, createSmoothScroll as ze, draggingScroll as Dt } from "@vavt/util";
|
|
9
|
+
import { deleteLine as Nt, history as $e, undo as At, redo as Rt, defaultKeymap as Mt, historyKeymap as Ft, indentWithTab as Bt } from "@codemirror/commands";
|
|
10
|
+
import { markdown as Pt } from "@codemirror/lang-markdown";
|
|
11
|
+
import { languages as Ht } from "@codemirror/language-data";
|
|
12
|
+
import { EditorState as de, EditorSelection as U, Compartment as Y, StateEffect as se, StateField as qe, RangeSetBuilder as Ot } from "@codemirror/state";
|
|
13
|
+
import { placeholder as Vt, EditorView as B, showTooltip as Wt, Decoration as _t, WidgetType as zt, keymap as qt, drawSelection as Ut } from "@codemirror/view";
|
|
14
|
+
import { indentUnit as Kt, syntaxHighlighting as Ue, HighlightStyle as Ke } from "@codemirror/language";
|
|
15
|
+
import { b as L, E as J, C as Gt, U as fe, a as Ge, c as je, O as Ye, d as jt, R as Yt, e as Zt, T as Xt, S as Jt, G as xe } from "./chunks/event-bus.mjs";
|
|
16
|
+
import { autocompletion as Qt } from "@codemirror/autocomplete";
|
|
17
|
+
import { I as k, M as eo } from "./chunks/index2.mjs";
|
|
18
|
+
import { b as to } from "./chunks/index5.mjs";
|
|
19
|
+
import { a as oo } from "./chunks/dom.mjs";
|
|
20
20
|
import { tags as b } from "@lezer/highlight";
|
|
21
|
-
import { searchKeymap as
|
|
21
|
+
import { searchKeymap as ao } from "@codemirror/search";
|
|
22
22
|
import { g as Se } from "./chunks/vue-tsx.mjs";
|
|
23
|
-
const
|
|
23
|
+
const lo = (e, t, o) => {
|
|
24
24
|
const n = r("editorId"), i = r("setting");
|
|
25
25
|
let s = () => {
|
|
26
26
|
}, c = () => {
|
|
@@ -31,262 +31,35 @@ const oo = (e, t, o) => {
|
|
|
31
31
|
`#${n} .cm-scroller`
|
|
32
32
|
), m = u?.querySelector(
|
|
33
33
|
`[id="${n}-preview-wrapper"]`
|
|
34
|
-
),
|
|
34
|
+
), h = u?.querySelector(
|
|
35
35
|
`[id="${n}-html-wrapper"]`
|
|
36
36
|
);
|
|
37
|
-
(m ||
|
|
37
|
+
(m || h) && ([c, s] = (m ? nt : rt)(
|
|
38
38
|
v,
|
|
39
|
-
m ||
|
|
39
|
+
m || h,
|
|
40
40
|
o.value
|
|
41
41
|
), e.scrollAuto && c());
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}),
|
|
43
|
+
A([t, i], () => {
|
|
44
|
+
ce(d);
|
|
45
|
+
}), A(
|
|
46
46
|
() => e.scrollAuto,
|
|
47
47
|
(u) => {
|
|
48
48
|
u ? c() : s();
|
|
49
49
|
}
|
|
50
|
-
),
|
|
50
|
+
), A(
|
|
51
51
|
() => i.value.previewOnly,
|
|
52
52
|
(u) => {
|
|
53
53
|
u ? s() : c();
|
|
54
54
|
}
|
|
55
55
|
), K(d);
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
return ao(e, t);
|
|
59
|
-
if (e === "prettier")
|
|
60
|
-
return await lo(t, o);
|
|
61
|
-
switch (e) {
|
|
62
|
-
case "bold":
|
|
63
|
-
case "underline":
|
|
64
|
-
case "italic":
|
|
65
|
-
case "strikeThrough":
|
|
66
|
-
case "sub":
|
|
67
|
-
case "sup":
|
|
68
|
-
case "codeRow":
|
|
69
|
-
case "katexInline":
|
|
70
|
-
case "katexBlock":
|
|
71
|
-
return ro(e, t);
|
|
72
|
-
case "quote":
|
|
73
|
-
case "orderedList":
|
|
74
|
-
case "unorderedList":
|
|
75
|
-
case "task":
|
|
76
|
-
return io(e, t);
|
|
77
|
-
case "code":
|
|
78
|
-
return co(o, t);
|
|
79
|
-
case "table":
|
|
80
|
-
return bo(o);
|
|
81
|
-
case "link": {
|
|
82
|
-
const n = t.getSelectedText(), { desc: i = n, url: s = "" } = o, c = `[${i}](${s})`;
|
|
83
|
-
return {
|
|
84
|
-
text: c,
|
|
85
|
-
options: {
|
|
86
|
-
select: s === "",
|
|
87
|
-
deviationStart: c.length - s.length - 1,
|
|
88
|
-
deviationEnd: -1
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
case "image":
|
|
93
|
-
return mo(o, t);
|
|
94
|
-
case "flow":
|
|
95
|
-
case "sequence":
|
|
96
|
-
case "gantt":
|
|
97
|
-
case "class":
|
|
98
|
-
case "state":
|
|
99
|
-
case "pie":
|
|
100
|
-
case "relationship":
|
|
101
|
-
case "journey":
|
|
102
|
-
return uo(e);
|
|
103
|
-
case "universal":
|
|
104
|
-
return vo(t.getSelectedText(), o);
|
|
105
|
-
default:
|
|
106
|
-
return { text: "", options: {} };
|
|
107
|
-
}
|
|
108
|
-
}, ao = (e, t) => {
|
|
109
|
-
const o = e.slice(1), n = "#".repeat(Number(o)), [i, s, c] = pe(t, {
|
|
110
|
-
wholeLine: !0
|
|
111
|
-
});
|
|
112
|
-
return {
|
|
113
|
-
text: `${n} ${i}`,
|
|
114
|
-
options: { deviationStart: n.length + 1, replaceStart: s, replaceEnd: c }
|
|
115
|
-
};
|
|
116
|
-
}, lo = async (e, t) => {
|
|
117
|
-
const o = window.prettier || Z.editorExtensions.prettier?.prettierInstance, n = [
|
|
118
|
-
window.prettierPlugins?.markdown || Z.editorExtensions.prettier?.parserMarkdownInstance
|
|
119
|
-
];
|
|
120
|
-
return !o || !n[0] ? (h.emit(t.editorId, X, {
|
|
121
|
-
name: "prettier",
|
|
122
|
-
message: "prettier is undefined"
|
|
123
|
-
}), {
|
|
124
|
-
text: e.getValue(),
|
|
125
|
-
options: { select: !1, replaceAll: !0 }
|
|
126
|
-
}) : {
|
|
127
|
-
text: await o.format(e.getValue(), {
|
|
128
|
-
parser: "markdown",
|
|
129
|
-
plugins: n
|
|
130
|
-
}),
|
|
131
|
-
options: { select: !1, replaceAll: !0 }
|
|
132
|
-
};
|
|
133
|
-
}, no = {
|
|
134
|
-
bold: ["**", "**", 2, -2],
|
|
135
|
-
underline: ["<u>", "</u>", 3, -4],
|
|
136
|
-
italic: ["*", "*", 1, -1],
|
|
137
|
-
strikeThrough: ["~~", "~~", 2, -2],
|
|
138
|
-
sub: ["~", "~", 1, -1],
|
|
139
|
-
sup: ["^", "^", 1, -1],
|
|
140
|
-
codeRow: ["`", "`", 1, -1],
|
|
141
|
-
katexInline: ["$", "$", 1, -1],
|
|
142
|
-
katexBlock: [`
|
|
143
|
-
$$
|
|
144
|
-
`, `
|
|
145
|
-
$$
|
|
146
|
-
`, 4, -4]
|
|
147
|
-
}, ro = (e, t) => {
|
|
148
|
-
const o = t.getSelectedText(), [n, i, s, c] = no[e];
|
|
149
|
-
return {
|
|
150
|
-
text: `${n}${o}${i}`,
|
|
151
|
-
options: {
|
|
152
|
-
deviationStart: s,
|
|
153
|
-
deviationEnd: c
|
|
154
|
-
// replaceStart, replaceEnd
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}, so = {
|
|
158
|
-
quote: "> ",
|
|
159
|
-
unorderedList: "- ",
|
|
160
|
-
orderedList: 1,
|
|
161
|
-
task: "- [ ] "
|
|
162
|
-
}, io = (e, t) => {
|
|
163
|
-
const [o, n, i] = pe(t, {
|
|
164
|
-
wholeLine: !0
|
|
165
|
-
}), s = o.split(`
|
|
166
|
-
`), c = so[e], d = e === "orderedList" ? s.map((m, f) => `${c + f}. ${m}`) : s.map((m) => `${c}${m}`), u = e === "orderedList" ? "1. " : c.toString(), v = s.length === 1 ? u.length : 0;
|
|
167
|
-
return {
|
|
168
|
-
text: d.join(`
|
|
169
|
-
`),
|
|
170
|
-
options: { deviationStart: v, replaceStart: n, replaceEnd: i }
|
|
171
|
-
};
|
|
172
|
-
}, co = (e, t) => {
|
|
173
|
-
const [o, n, i] = pe(t), s = e.mode || "language", c = `
|
|
174
|
-
\`\`\`${s}
|
|
175
|
-
${e.text || o || ""}
|
|
176
|
-
\`\`\`
|
|
177
|
-
`;
|
|
178
|
-
return {
|
|
179
|
-
text: c,
|
|
180
|
-
options: {
|
|
181
|
-
deviationStart: 4,
|
|
182
|
-
deviationEnd: 4 + s.length - c.length,
|
|
183
|
-
replaceStart: n,
|
|
184
|
-
replaceEnd: i
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
}, uo = (e) => ({
|
|
188
|
-
text: `
|
|
189
|
-
\`\`\`mermaid
|
|
190
|
-
${{
|
|
191
|
-
flow: `flowchart TD
|
|
192
|
-
Start --> Stop`,
|
|
193
|
-
sequence: `sequenceDiagram
|
|
194
|
-
A->>B: hello!
|
|
195
|
-
B-->>A: hi!`,
|
|
196
|
-
gantt: `gantt
|
|
197
|
-
title Gantt Chart
|
|
198
|
-
dateFormat YYYY-MM-DD`,
|
|
199
|
-
class: `classDiagram
|
|
200
|
-
class Animal`,
|
|
201
|
-
state: `stateDiagram-v2
|
|
202
|
-
s1 --> s2`,
|
|
203
|
-
pie: `pie
|
|
204
|
-
"Dogs" : 386
|
|
205
|
-
"Cats" : 85
|
|
206
|
-
"Rats" : 15`,
|
|
207
|
-
relationship: `erDiagram
|
|
208
|
-
CAR ||--o{ NAMED-DRIVER : allows`,
|
|
209
|
-
journey: `journey
|
|
210
|
-
title My Journey`,
|
|
211
|
-
...Z.editorConfig.mermaidTemplate
|
|
212
|
-
}[e]}
|
|
213
|
-
\`\`\`
|
|
214
|
-
`,
|
|
215
|
-
options: { deviationStart: 12, deviationEnd: -5 }
|
|
216
|
-
}), mo = (e, t) => {
|
|
217
|
-
const o = t.getSelectedText(), { desc: n = o, url: i = "", urls: s } = e;
|
|
218
|
-
let c = "";
|
|
219
|
-
const d = i === "" && (!s || s instanceof Array && s.length === 0);
|
|
220
|
-
return s instanceof Array ? c = s.reduce((u, v) => {
|
|
221
|
-
const {
|
|
222
|
-
url: m = "",
|
|
223
|
-
alt: f = "",
|
|
224
|
-
title: g = ""
|
|
225
|
-
} = typeof v == "object" ? v : { url: v };
|
|
226
|
-
return u + `
|
|
227
|
-
`;
|
|
228
|
-
}, "") : c = `
|
|
229
|
-
`, {
|
|
230
|
-
text: c,
|
|
231
|
-
options: {
|
|
232
|
-
select: i === "",
|
|
233
|
-
deviationStart: d ? c.length - i.length - 2 : c.length,
|
|
234
|
-
deviationEnd: d ? -2 : 0
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
}, bo = (e) => {
|
|
238
|
-
const { selectedShape: t = { x: 1, y: 1 } } = e, { x: o, y: n } = t;
|
|
239
|
-
let i = `
|
|
240
|
-
| Column`;
|
|
241
|
-
for (let s = 0; s <= n; s++)
|
|
242
|
-
i += " |";
|
|
243
|
-
i += `
|
|
244
|
-
|`;
|
|
245
|
-
for (let s = 0; s <= n; s++)
|
|
246
|
-
i += " - |";
|
|
247
|
-
for (let s = 0; s <= o; s++) {
|
|
248
|
-
i += `
|
|
249
|
-
|`;
|
|
250
|
-
for (let c = 0; c <= n; c++)
|
|
251
|
-
i += " |";
|
|
252
|
-
}
|
|
253
|
-
return i += `
|
|
254
|
-
`, { text: i, options: { deviationStart: 3, deviationEnd: 10 - i.length } };
|
|
255
|
-
}, vo = (e, t) => {
|
|
256
|
-
const { generate: o } = t, n = o(e);
|
|
257
|
-
return {
|
|
258
|
-
text: n.targetValue,
|
|
259
|
-
options: {
|
|
260
|
-
select: n.select ?? !0,
|
|
261
|
-
deviationStart: n.deviationStart || 0,
|
|
262
|
-
deviationEnd: n.deviationEnd || 0
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
}, pe = (e, t = { wholeLine: !1 }) => {
|
|
266
|
-
const o = e.view.state, n = o.selection.main;
|
|
267
|
-
if (n.empty) {
|
|
268
|
-
const i = o.doc.lineAt(n.from);
|
|
269
|
-
return [o.doc.lineAt(n.from).text, i.from, i.to];
|
|
270
|
-
} else if (t.wholeLine) {
|
|
271
|
-
const i = o.doc.lineAt(n.from), s = o.doc.lineAt(n.to);
|
|
272
|
-
return [
|
|
273
|
-
o.doc.sliceString(i.from, s.to),
|
|
274
|
-
i.from,
|
|
275
|
-
s.to
|
|
276
|
-
];
|
|
277
|
-
}
|
|
278
|
-
return [
|
|
279
|
-
o.doc.sliceString(n.from, n.to),
|
|
280
|
-
n.from,
|
|
281
|
-
n.to
|
|
282
|
-
];
|
|
283
|
-
}, G = (e) => {
|
|
284
|
-
const t = new j();
|
|
56
|
+
}, j = (e) => {
|
|
57
|
+
const t = new Y();
|
|
285
58
|
return (n) => (t.get(e.state) ? e.dispatch({ effects: t.reconfigure(n) }) : e.dispatch({
|
|
286
|
-
effects:
|
|
59
|
+
effects: se.appendConfig.of(t.of(n))
|
|
287
60
|
}), !0);
|
|
288
61
|
};
|
|
289
|
-
class
|
|
62
|
+
class no {
|
|
290
63
|
view;
|
|
291
64
|
maxLength = Number.MAX_SAFE_INTEGER;
|
|
292
65
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
@@ -370,7 +143,7 @@ class go {
|
|
|
370
143
|
}), this.view.focus();
|
|
371
144
|
} catch (s) {
|
|
372
145
|
if (s.message === "The input text is too long")
|
|
373
|
-
|
|
146
|
+
L.emit(n, J, {
|
|
374
147
|
name: "overlength",
|
|
375
148
|
message: s.message,
|
|
376
149
|
data: t
|
|
@@ -380,7 +153,7 @@ class go {
|
|
|
380
153
|
}
|
|
381
154
|
}
|
|
382
155
|
constructor(t) {
|
|
383
|
-
this.view = t, this.toggleTabSize =
|
|
156
|
+
this.view = t, this.toggleTabSize = j(this.view), this.togglePlaceholder = j(this.view), this.setExtensions = j(this.view), this.toggleDisabled = j(this.view), this.toggleReadOnly = j(this.view), this.toggleMaxlength = j(this.view);
|
|
384
157
|
}
|
|
385
158
|
/**
|
|
386
159
|
* 设置tabSize
|
|
@@ -389,8 +162,8 @@ class go {
|
|
|
389
162
|
*/
|
|
390
163
|
setTabSize(t) {
|
|
391
164
|
this.toggleTabSize([
|
|
392
|
-
|
|
393
|
-
|
|
165
|
+
de.tabSize.of(t),
|
|
166
|
+
Kt.of(" ".repeat(t))
|
|
394
167
|
]);
|
|
395
168
|
}
|
|
396
169
|
/**
|
|
@@ -399,7 +172,7 @@ class go {
|
|
|
399
172
|
* @param t 目标内容
|
|
400
173
|
*/
|
|
401
174
|
setPlaceholder(t) {
|
|
402
|
-
this.togglePlaceholder(
|
|
175
|
+
this.togglePlaceholder(Vt(t));
|
|
403
176
|
}
|
|
404
177
|
focus(t) {
|
|
405
178
|
if (this.view.focus(), !t)
|
|
@@ -427,26 +200,26 @@ class go {
|
|
|
427
200
|
this.toggleDisabled([B.editable.of(!t)]);
|
|
428
201
|
}
|
|
429
202
|
setReadOnly(t) {
|
|
430
|
-
this.toggleReadOnly([
|
|
203
|
+
this.toggleReadOnly([de.readOnly.of(t)]);
|
|
431
204
|
}
|
|
432
205
|
setMaxLength(t) {
|
|
433
206
|
this.maxLength = t, this.toggleMaxlength([
|
|
434
|
-
|
|
207
|
+
de.changeFilter.of((o) => o.newDoc.length <= t)
|
|
435
208
|
]);
|
|
436
209
|
}
|
|
437
210
|
}
|
|
438
|
-
const
|
|
211
|
+
const ro = (e, t) => {
|
|
439
212
|
if (e === t) return !0;
|
|
440
213
|
if (e.length !== t.length) return !1;
|
|
441
214
|
for (let o = 0; o < e.length; o++)
|
|
442
215
|
if (e[o] !== t[o]) return !1;
|
|
443
216
|
return !0;
|
|
444
|
-
},
|
|
445
|
-
const o =
|
|
446
|
-
|
|
447
|
-
(!o.value || !
|
|
217
|
+
}, so = (e, t) => {
|
|
218
|
+
const o = S(t.value);
|
|
219
|
+
A([t], () => {
|
|
220
|
+
(!o.value || !ro(o.value, t.value)) && (o.value = t.value, e());
|
|
448
221
|
});
|
|
449
|
-
},
|
|
222
|
+
}, ne = (e, t, o, n, i) => (s, c, d, u) => {
|
|
450
223
|
const v = `${e}${t}${o}${n}`, m = d + c.label.length + (i === "title" ? o.length : 0);
|
|
451
224
|
s.dispatch({
|
|
452
225
|
changes: { from: d, to: u, insert: v },
|
|
@@ -499,7 +272,7 @@ const ho = (e, t) => {
|
|
|
499
272
|
].map((i) => ({
|
|
500
273
|
label: `${i[0]}${i[1]}`,
|
|
501
274
|
type: "text",
|
|
502
|
-
apply:
|
|
275
|
+
apply: ne(i[0], i[1], "", i[0] === "`" ? "`" : "\n```", "type")
|
|
503
276
|
})),
|
|
504
277
|
// 链接
|
|
505
278
|
{
|
|
@@ -524,12 +297,12 @@ const ho = (e, t) => {
|
|
|
524
297
|
{
|
|
525
298
|
label: "$",
|
|
526
299
|
type: "text",
|
|
527
|
-
apply:
|
|
300
|
+
apply: ne("$", "", "", "$", "type")
|
|
528
301
|
},
|
|
529
302
|
{
|
|
530
303
|
label: "$$",
|
|
531
304
|
type: "text",
|
|
532
|
-
apply:
|
|
305
|
+
apply: ne("$$", "", `
|
|
533
306
|
`, `
|
|
534
307
|
$$`, "title")
|
|
535
308
|
},
|
|
@@ -554,43 +327,38 @@ $$`, "title")
|
|
|
554
327
|
].map((i) => ({
|
|
555
328
|
label: `!!! ${i}`,
|
|
556
329
|
type: "text",
|
|
557
|
-
apply:
|
|
330
|
+
apply: ne("!!!", ` ${i}`, " Title", `
|
|
558
331
|
|
|
559
332
|
!!!`, "title")
|
|
560
333
|
}))
|
|
561
334
|
]
|
|
562
335
|
};
|
|
563
336
|
};
|
|
564
|
-
return
|
|
337
|
+
return Qt({
|
|
565
338
|
override: e ? [t, ...e] : [t]
|
|
566
339
|
});
|
|
567
|
-
},
|
|
568
|
-
name: `${l}-divider`,
|
|
569
|
-
setup() {
|
|
570
|
-
return () => a("div", {
|
|
571
|
-
class: `${l}-divider`
|
|
572
|
-
}, null);
|
|
573
|
-
}
|
|
574
|
-
}), To = /* @__PURE__ */ C({
|
|
340
|
+
}, io = /* @__PURE__ */ w({
|
|
575
341
|
name: "ToolbarBold",
|
|
576
342
|
setup() {
|
|
577
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
343
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
578
344
|
return () => a("button", {
|
|
579
345
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
580
346
|
title: t.value.toolbarTips?.bold,
|
|
581
347
|
"aria-label": t.value.toolbarTips?.bold,
|
|
582
348
|
disabled: o?.value,
|
|
583
349
|
onClick: () => {
|
|
584
|
-
|
|
350
|
+
T(e, {
|
|
351
|
+
direct: "bold"
|
|
352
|
+
});
|
|
585
353
|
},
|
|
586
354
|
type: "button"
|
|
587
|
-
}, [a(
|
|
355
|
+
}, [a(k, {
|
|
588
356
|
name: "bold"
|
|
589
357
|
}, null), n?.value && a("div", {
|
|
590
358
|
class: `${l}-toolbar-item-name`
|
|
591
359
|
}, [t.value.toolbarTips?.bold])]);
|
|
592
360
|
}
|
|
593
|
-
}),
|
|
361
|
+
}), co = /* @__PURE__ */ w({
|
|
594
362
|
name: "ToolbarCatalog",
|
|
595
363
|
setup() {
|
|
596
364
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = r("catalogVisible");
|
|
@@ -600,60 +368,64 @@ $$`, "title")
|
|
|
600
368
|
"aria-label": t.value.toolbarTips?.catalog,
|
|
601
369
|
disabled: o?.value,
|
|
602
370
|
onClick: () => {
|
|
603
|
-
|
|
371
|
+
L.emit(e, Gt);
|
|
604
372
|
},
|
|
605
373
|
key: "bar-catalog",
|
|
606
374
|
type: "button"
|
|
607
|
-
}, [a(
|
|
375
|
+
}, [a(k, {
|
|
608
376
|
name: "catalog"
|
|
609
377
|
}, null), n?.value && a("div", {
|
|
610
378
|
class: `${l}-toolbar-item-name`
|
|
611
379
|
}, [t.value.toolbarTips?.catalog])]);
|
|
612
380
|
}
|
|
613
|
-
}),
|
|
381
|
+
}), uo = /* @__PURE__ */ w({
|
|
614
382
|
name: "ToolbarCode",
|
|
615
383
|
setup() {
|
|
616
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
384
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
617
385
|
return () => a("button", {
|
|
618
386
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
619
387
|
title: t.value.toolbarTips?.code,
|
|
620
388
|
"aria-label": t.value.toolbarTips?.code,
|
|
621
389
|
disabled: o?.value,
|
|
622
390
|
onClick: () => {
|
|
623
|
-
|
|
391
|
+
T(e, {
|
|
392
|
+
direct: "code"
|
|
393
|
+
});
|
|
624
394
|
},
|
|
625
395
|
type: "button"
|
|
626
|
-
}, [a(
|
|
396
|
+
}, [a(k, {
|
|
627
397
|
name: "code"
|
|
628
398
|
}, null), n?.value && a("div", {
|
|
629
399
|
class: `${l}-toolbar-item-name`
|
|
630
400
|
}, [t.value.toolbarTips?.code])]);
|
|
631
401
|
}
|
|
632
|
-
}),
|
|
402
|
+
}), mo = /* @__PURE__ */ w({
|
|
633
403
|
name: "ToolbarCodeRow",
|
|
634
404
|
setup() {
|
|
635
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
405
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
636
406
|
return () => a("button", {
|
|
637
407
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
638
408
|
title: t.value.toolbarTips?.codeRow,
|
|
639
409
|
"aria-label": t.value.toolbarTips?.codeRow,
|
|
640
410
|
disabled: o?.value,
|
|
641
411
|
onClick: () => {
|
|
642
|
-
|
|
412
|
+
T(e, {
|
|
413
|
+
direct: "codeRow"
|
|
414
|
+
});
|
|
643
415
|
},
|
|
644
416
|
type: "button"
|
|
645
|
-
}, [a(
|
|
417
|
+
}, [a(k, {
|
|
646
418
|
name: "code-row"
|
|
647
419
|
}, null), n?.value && a("div", {
|
|
648
420
|
class: `${l}-toolbar-item-name`
|
|
649
421
|
}, [t.value.toolbarTips?.codeRow])]);
|
|
650
422
|
}
|
|
651
|
-
}),
|
|
423
|
+
}), bo = /* @__PURE__ */ w({
|
|
652
424
|
name: "ToolbarFullscreen",
|
|
653
425
|
setup() {
|
|
654
426
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), {
|
|
655
427
|
fullscreenHandler: i
|
|
656
|
-
} =
|
|
428
|
+
} = Ko();
|
|
657
429
|
return () => a("button", {
|
|
658
430
|
class: [`${l}-toolbar-item`, n.value.fullscreen && `${l}-toolbar-active`, t?.value && `${l}-disabled`],
|
|
659
431
|
title: e.value.toolbarTips?.fullscreen,
|
|
@@ -663,13 +435,13 @@ $$`, "title")
|
|
|
663
435
|
i();
|
|
664
436
|
},
|
|
665
437
|
type: "button"
|
|
666
|
-
}, [a(
|
|
438
|
+
}, [a(k, {
|
|
667
439
|
name: n.value.fullscreen ? "fullscreen-exit" : "fullscreen"
|
|
668
440
|
}, null), o?.value && a("div", {
|
|
669
441
|
class: `${l}-toolbar-item-name`
|
|
670
442
|
}, [e.value.toolbarTips?.fullscreen])]);
|
|
671
443
|
}
|
|
672
|
-
}),
|
|
444
|
+
}), vo = /* @__PURE__ */ w({
|
|
673
445
|
name: "ToolbarGithub",
|
|
674
446
|
setup() {
|
|
675
447
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName");
|
|
@@ -679,16 +451,16 @@ $$`, "title")
|
|
|
679
451
|
"aria-label": e.value.toolbarTips?.github,
|
|
680
452
|
disabled: t?.value,
|
|
681
453
|
onClick: () => {
|
|
682
|
-
|
|
454
|
+
Et("https://github.com/imzbf/md-editor-v3");
|
|
683
455
|
},
|
|
684
456
|
type: "button"
|
|
685
|
-
}, [a(
|
|
457
|
+
}, [a(k, {
|
|
686
458
|
name: "github"
|
|
687
459
|
}, null), o?.value && a("div", {
|
|
688
460
|
class: `${l}-toolbar-item-name`
|
|
689
461
|
}, [e.value.toolbarTips?.github])]);
|
|
690
462
|
}
|
|
691
|
-
}),
|
|
463
|
+
}), go = /* @__PURE__ */ w({
|
|
692
464
|
name: "ToolbarHtmlPreview",
|
|
693
465
|
setup() {
|
|
694
466
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
|
|
@@ -701,32 +473,34 @@ $$`, "title")
|
|
|
701
473
|
i("htmlPreview");
|
|
702
474
|
},
|
|
703
475
|
type: "button"
|
|
704
|
-
}, [a(
|
|
476
|
+
}, [a(k, {
|
|
705
477
|
name: "preview-html"
|
|
706
478
|
}, null), o?.value && a("div", {
|
|
707
479
|
class: `${l}-toolbar-item-name`
|
|
708
480
|
}, [e.value.toolbarTips?.htmlPreview])]);
|
|
709
481
|
}
|
|
710
|
-
}),
|
|
482
|
+
}), ho = /* @__PURE__ */ w({
|
|
711
483
|
name: "ToolbarImage",
|
|
712
484
|
setup() {
|
|
713
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
485
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
714
486
|
return () => a("button", {
|
|
715
487
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
716
488
|
title: t.value.toolbarTips?.image,
|
|
717
489
|
"aria-label": t.value.toolbarTips?.image,
|
|
718
490
|
disabled: o?.value,
|
|
719
491
|
onClick: () => {
|
|
720
|
-
|
|
492
|
+
T(e, {
|
|
493
|
+
direct: "image"
|
|
494
|
+
});
|
|
721
495
|
},
|
|
722
496
|
type: "button"
|
|
723
|
-
}, [a(
|
|
497
|
+
}, [a(k, {
|
|
724
498
|
name: "image"
|
|
725
499
|
}, null), n?.value && a("div", {
|
|
726
500
|
class: `${l}-toolbar-item-name`
|
|
727
501
|
}, [t.value.toolbarTips?.image])]);
|
|
728
502
|
}
|
|
729
|
-
}),
|
|
503
|
+
}), po = {
|
|
730
504
|
visible: {
|
|
731
505
|
type: Boolean,
|
|
732
506
|
default: !1
|
|
@@ -741,13 +515,13 @@ $$`, "title")
|
|
|
741
515
|
default: () => {
|
|
742
516
|
}
|
|
743
517
|
}
|
|
744
|
-
},
|
|
518
|
+
}, fo = /* @__PURE__ */ w({
|
|
745
519
|
name: `${l}-modal-clip`,
|
|
746
|
-
props:
|
|
520
|
+
props: po,
|
|
747
521
|
setup(e) {
|
|
748
522
|
const t = r("usedLanguageText"), o = r("editorId"), n = r("rootRef");
|
|
749
|
-
let i =
|
|
750
|
-
const s =
|
|
523
|
+
let i = X.editorExtensions.cropper.instance;
|
|
524
|
+
const s = S(), c = S(), d = S(), u = Z({
|
|
751
525
|
cropperInited: !1,
|
|
752
526
|
imgSelected: !1,
|
|
753
527
|
imgSrc: "",
|
|
@@ -755,10 +529,10 @@ $$`, "title")
|
|
|
755
529
|
isFullscreen: !1
|
|
756
530
|
});
|
|
757
531
|
let v = null;
|
|
758
|
-
|
|
532
|
+
A(() => e.visible, () => {
|
|
759
533
|
e.visible && !u.cropperInited && (i = i || window.Cropper, s.value.onchange = () => {
|
|
760
534
|
if (!i) {
|
|
761
|
-
|
|
535
|
+
L.emit(o, J, {
|
|
762
536
|
name: "Cropper",
|
|
763
537
|
message: "Cropper is undefined"
|
|
764
538
|
});
|
|
@@ -767,15 +541,15 @@ $$`, "title")
|
|
|
767
541
|
const g = s.value.files || [];
|
|
768
542
|
if (u.imgSelected = !0, g?.length > 0) {
|
|
769
543
|
const p = new FileReader();
|
|
770
|
-
p.onload = (
|
|
771
|
-
u.imgSrc =
|
|
544
|
+
p.onload = (y) => {
|
|
545
|
+
u.imgSrc = y.target.result;
|
|
772
546
|
}, p.readAsDataURL(g[0]);
|
|
773
547
|
}
|
|
774
548
|
});
|
|
775
|
-
}),
|
|
549
|
+
}), A(() => [u.imgSelected], () => {
|
|
776
550
|
d.value.style = "";
|
|
777
|
-
}),
|
|
778
|
-
u.imgSrc &&
|
|
551
|
+
}), A([ke(() => u.isFullscreen), ke(() => u.imgSrc)], () => {
|
|
552
|
+
u.imgSrc && ce(() => {
|
|
779
553
|
v?.destroy(), d.value.style = "", c.value && (v = new i(c.value, {
|
|
780
554
|
viewMode: 2,
|
|
781
555
|
preview: n.value.getRootNode().querySelector(`.${l}-clip-preview-target`)
|
|
@@ -785,17 +559,17 @@ $$`, "title")
|
|
|
785
559
|
});
|
|
786
560
|
const m = () => {
|
|
787
561
|
v.clear(), v.destroy(), v = null, s.value.value = "", u.imgSelected = !1, u.imgSrc = "";
|
|
788
|
-
},
|
|
562
|
+
}, h = (g) => {
|
|
789
563
|
u.isFullscreen = g;
|
|
790
564
|
};
|
|
791
|
-
return () => a(
|
|
565
|
+
return () => a(eo, {
|
|
792
566
|
class: `${l}-modal-clip`,
|
|
793
567
|
title: t.value.clipModalTips?.title,
|
|
794
568
|
visible: e.visible,
|
|
795
569
|
onClose: e.onCancel,
|
|
796
570
|
showAdjust: !0,
|
|
797
571
|
isFullscreen: u.isFullscreen,
|
|
798
|
-
onAdjust:
|
|
572
|
+
onAdjust: h,
|
|
799
573
|
width: "668px",
|
|
800
574
|
height: "421px"
|
|
801
575
|
}, {
|
|
@@ -815,7 +589,7 @@ $$`, "title")
|
|
|
815
589
|
}, null), a("div", {
|
|
816
590
|
class: `${l}-clip-delete`,
|
|
817
591
|
onClick: m
|
|
818
|
-
}, [a(
|
|
592
|
+
}, [a(k, {
|
|
819
593
|
name: "delete"
|
|
820
594
|
}, null)])]) : a("div", {
|
|
821
595
|
class: `${l}-clip-upload`,
|
|
@@ -825,7 +599,7 @@ $$`, "title")
|
|
|
825
599
|
role: "button",
|
|
826
600
|
tabindex: "0",
|
|
827
601
|
"aria-label": t.value.imgTitleItem?.upload
|
|
828
|
-
}, [a(
|
|
602
|
+
}, [a(k, {
|
|
829
603
|
name: "upload"
|
|
830
604
|
}, null)])]), a("div", {
|
|
831
605
|
class: `${l}-clip-preview`
|
|
@@ -840,7 +614,7 @@ $$`, "title")
|
|
|
840
614
|
onClick: () => {
|
|
841
615
|
if (v) {
|
|
842
616
|
const g = v.getCroppedCanvas();
|
|
843
|
-
|
|
617
|
+
L.emit(o, fe, [to(g.toDataURL("image/png"))], e.onOk), m();
|
|
844
618
|
}
|
|
845
619
|
}
|
|
846
620
|
}, [t.value.clipModalTips?.buttonUpload || t.value.linkModalTips?.buttonOK])]), a("input", {
|
|
@@ -855,7 +629,7 @@ $$`, "title")
|
|
|
855
629
|
}, null)]
|
|
856
630
|
});
|
|
857
631
|
}
|
|
858
|
-
}),
|
|
632
|
+
}), To = {
|
|
859
633
|
clipVisible: {
|
|
860
634
|
type: Boolean,
|
|
861
635
|
default: !1
|
|
@@ -870,35 +644,38 @@ $$`, "title")
|
|
|
870
644
|
default: () => {
|
|
871
645
|
}
|
|
872
646
|
}
|
|
873
|
-
},
|
|
647
|
+
}, wo = /* @__PURE__ */ w({
|
|
874
648
|
name: `${l}-modals`,
|
|
875
|
-
props:
|
|
649
|
+
props: To,
|
|
876
650
|
setup(e) {
|
|
877
|
-
return () => a(
|
|
651
|
+
return () => a(fo, {
|
|
878
652
|
visible: e.clipVisible,
|
|
879
653
|
onOk: e.onOk,
|
|
880
654
|
onCancel: e.onCancel
|
|
881
655
|
}, null);
|
|
882
656
|
}
|
|
883
|
-
}),
|
|
657
|
+
}), yo = /* @__PURE__ */ w({
|
|
884
658
|
name: "ToolbarImageDropdown",
|
|
885
659
|
setup() {
|
|
886
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
887
|
-
|
|
888
|
-
}, v = (
|
|
889
|
-
o?.value ||
|
|
660
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = S(!1), c = S(!1), d = S(), u = () => {
|
|
661
|
+
L.emit(e, fe, Array.from(d.value.files || [])), d.value.value = "";
|
|
662
|
+
}, v = (y, I) => {
|
|
663
|
+
o?.value || T(e, {
|
|
664
|
+
direct: y,
|
|
665
|
+
params: I
|
|
666
|
+
});
|
|
890
667
|
};
|
|
891
668
|
K(() => {
|
|
892
669
|
d.value.addEventListener("change", u);
|
|
893
670
|
});
|
|
894
|
-
const m = (
|
|
895
|
-
s.value =
|
|
896
|
-
},
|
|
671
|
+
const m = (y) => {
|
|
672
|
+
s.value = y;
|
|
673
|
+
}, h = () => {
|
|
897
674
|
c.value = !1;
|
|
898
|
-
}, g = (
|
|
899
|
-
|
|
900
|
-
desc:
|
|
901
|
-
url:
|
|
675
|
+
}, g = (y) => {
|
|
676
|
+
y && v("image", {
|
|
677
|
+
desc: y.desc,
|
|
678
|
+
url: y.url,
|
|
902
679
|
transform: !0
|
|
903
680
|
}), c.value = !1;
|
|
904
681
|
}, p = P(() => a("ul", {
|
|
@@ -957,41 +734,45 @@ $$`, "title")
|
|
|
957
734
|
"aria-label": t.value.toolbarTips?.image,
|
|
958
735
|
disabled: o?.value,
|
|
959
736
|
type: "button"
|
|
960
|
-
}, [a(
|
|
737
|
+
}, [a(k, {
|
|
961
738
|
name: "image"
|
|
962
739
|
}, null), n?.value && a("div", {
|
|
963
740
|
class: `${l}-toolbar-item-name`
|
|
964
741
|
}, [t.value.toolbarTips?.image])])]
|
|
965
|
-
}), a(
|
|
742
|
+
}), a(wo, {
|
|
966
743
|
clipVisible: c.value,
|
|
967
|
-
onCancel:
|
|
744
|
+
onCancel: h,
|
|
968
745
|
onOk: g
|
|
969
746
|
}, null)]);
|
|
970
747
|
}
|
|
971
|
-
}),
|
|
748
|
+
}), Co = /* @__PURE__ */ w({
|
|
972
749
|
name: "ToolbarItalic",
|
|
973
750
|
setup() {
|
|
974
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
751
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
975
752
|
return () => a("button", {
|
|
976
753
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
977
754
|
title: t.value.toolbarTips?.italic,
|
|
978
755
|
"aria-label": t.value.toolbarTips?.italic,
|
|
979
756
|
disabled: o?.value,
|
|
980
757
|
onClick: () => {
|
|
981
|
-
|
|
758
|
+
T(e, {
|
|
759
|
+
direct: "italic"
|
|
760
|
+
});
|
|
982
761
|
},
|
|
983
762
|
type: "button"
|
|
984
|
-
}, [a(
|
|
763
|
+
}, [a(k, {
|
|
985
764
|
name: "italic"
|
|
986
765
|
}, null), n?.value && a("div", {
|
|
987
766
|
class: `${l}-toolbar-item-name`
|
|
988
767
|
}, [t.value.toolbarTips?.italic])]);
|
|
989
768
|
}
|
|
990
|
-
}),
|
|
769
|
+
}), ko = /* @__PURE__ */ w({
|
|
991
770
|
name: "ToolbarKatex",
|
|
992
771
|
setup() {
|
|
993
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
994
|
-
o?.value ||
|
|
772
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = S(!1), c = (v) => {
|
|
773
|
+
o?.value || T(e, {
|
|
774
|
+
direct: v
|
|
775
|
+
});
|
|
995
776
|
}, d = (v) => {
|
|
996
777
|
s.value = v;
|
|
997
778
|
}, u = P(() => a("ul", {
|
|
@@ -1029,37 +810,41 @@ $$`, "title")
|
|
|
1029
810
|
"aria-label": t.value.toolbarTips?.katex,
|
|
1030
811
|
disabled: o?.value,
|
|
1031
812
|
type: "button"
|
|
1032
|
-
}, [a(
|
|
813
|
+
}, [a(k, {
|
|
1033
814
|
name: "formula"
|
|
1034
815
|
}, null), n?.value && a("div", {
|
|
1035
816
|
class: `${l}-toolbar-item-name`
|
|
1036
817
|
}, [t.value.toolbarTips?.katex])])]
|
|
1037
818
|
});
|
|
1038
819
|
}
|
|
1039
|
-
}),
|
|
820
|
+
}), $o = /* @__PURE__ */ w({
|
|
1040
821
|
name: "ToolbarLink",
|
|
1041
822
|
setup() {
|
|
1042
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
823
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1043
824
|
return () => a("button", {
|
|
1044
825
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1045
826
|
title: t.value.toolbarTips?.link,
|
|
1046
827
|
"aria-label": t.value.toolbarTips?.link,
|
|
1047
828
|
disabled: o?.value,
|
|
1048
829
|
onClick: () => {
|
|
1049
|
-
|
|
830
|
+
T(e, {
|
|
831
|
+
direct: "link"
|
|
832
|
+
});
|
|
1050
833
|
},
|
|
1051
834
|
type: "button"
|
|
1052
|
-
}, [a(
|
|
835
|
+
}, [a(k, {
|
|
1053
836
|
name: "link"
|
|
1054
837
|
}, null), n?.value && a("div", {
|
|
1055
838
|
class: `${l}-toolbar-item-name`
|
|
1056
839
|
}, [t.value.toolbarTips?.link])]);
|
|
1057
840
|
}
|
|
1058
|
-
}),
|
|
841
|
+
}), xo = /* @__PURE__ */ w({
|
|
1059
842
|
name: "ToolbarMermaid",
|
|
1060
843
|
setup() {
|
|
1061
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1062
|
-
o?.value ||
|
|
844
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = S(!1), c = (v) => {
|
|
845
|
+
o?.value || T(e, {
|
|
846
|
+
direct: v
|
|
847
|
+
});
|
|
1063
848
|
}, d = (v) => {
|
|
1064
849
|
s.value = v;
|
|
1065
850
|
}, u = P(() => a("ul", {
|
|
@@ -1139,52 +924,54 @@ $$`, "title")
|
|
|
1139
924
|
"aria-label": t.value.toolbarTips?.mermaid,
|
|
1140
925
|
disabled: o?.value,
|
|
1141
926
|
type: "button"
|
|
1142
|
-
}, [a(
|
|
927
|
+
}, [a(k, {
|
|
1143
928
|
name: "mermaid"
|
|
1144
929
|
}, null), n?.value && a("div", {
|
|
1145
930
|
class: `${l}-toolbar-item-name`
|
|
1146
931
|
}, [t.value.toolbarTips?.mermaid])])]
|
|
1147
932
|
});
|
|
1148
933
|
}
|
|
1149
|
-
}),
|
|
934
|
+
}), So = /* @__PURE__ */ w({
|
|
1150
935
|
name: "ToolbarNext",
|
|
1151
936
|
setup() {
|
|
1152
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
937
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1153
938
|
return () => a("button", {
|
|
1154
939
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1155
940
|
title: t.value.toolbarTips?.next,
|
|
1156
941
|
"aria-label": t.value.toolbarTips?.next,
|
|
1157
942
|
disabled: o?.value,
|
|
1158
943
|
onClick: () => {
|
|
1159
|
-
|
|
944
|
+
L.emit(e, Ge);
|
|
1160
945
|
},
|
|
1161
946
|
type: "button"
|
|
1162
|
-
}, [a(
|
|
947
|
+
}, [a(k, {
|
|
1163
948
|
name: "next"
|
|
1164
949
|
}, null), n?.value && a("div", {
|
|
1165
950
|
class: `${l}-toolbar-item-name`
|
|
1166
951
|
}, [t.value.toolbarTips?.next])]);
|
|
1167
952
|
}
|
|
1168
|
-
}),
|
|
953
|
+
}), Io = /* @__PURE__ */ w({
|
|
1169
954
|
name: "ToolbarOrderedList",
|
|
1170
955
|
setup() {
|
|
1171
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
956
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1172
957
|
return () => a("button", {
|
|
1173
958
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1174
959
|
title: t.value.toolbarTips?.orderedList,
|
|
1175
960
|
"aria-label": t.value.toolbarTips?.orderedList,
|
|
1176
961
|
disabled: o?.value,
|
|
1177
962
|
onClick: () => {
|
|
1178
|
-
|
|
963
|
+
T(e, {
|
|
964
|
+
direct: "orderedList"
|
|
965
|
+
});
|
|
1179
966
|
},
|
|
1180
967
|
type: "button"
|
|
1181
|
-
}, [a(
|
|
968
|
+
}, [a(k, {
|
|
1182
969
|
name: "ordered-list"
|
|
1183
970
|
}, null), n?.value && a("div", {
|
|
1184
971
|
class: `${l}-toolbar-item-name`
|
|
1185
972
|
}, [t.value.toolbarTips?.orderedList])]);
|
|
1186
973
|
}
|
|
1187
|
-
}),
|
|
974
|
+
}), Eo = /* @__PURE__ */ w({
|
|
1188
975
|
name: "ToolbarPageFullscreen",
|
|
1189
976
|
setup() {
|
|
1190
977
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
|
|
@@ -1197,32 +984,34 @@ $$`, "title")
|
|
|
1197
984
|
i("pageFullscreen");
|
|
1198
985
|
},
|
|
1199
986
|
type: "button"
|
|
1200
|
-
}, [a(
|
|
987
|
+
}, [a(k, {
|
|
1201
988
|
name: n.value.pageFullscreen ? "minimize" : "maximize"
|
|
1202
989
|
}, null), o?.value && a("div", {
|
|
1203
990
|
class: `${l}-toolbar-item-name`
|
|
1204
991
|
}, [e.value.toolbarTips?.pageFullscreen])]);
|
|
1205
992
|
}
|
|
1206
|
-
}),
|
|
993
|
+
}), Lo = /* @__PURE__ */ w({
|
|
1207
994
|
name: "ToolbarPrettier",
|
|
1208
995
|
setup() {
|
|
1209
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
996
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1210
997
|
return () => a("button", {
|
|
1211
998
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1212
999
|
title: t.value.toolbarTips?.prettier,
|
|
1213
1000
|
"aria-label": t.value.toolbarTips?.prettier,
|
|
1214
1001
|
disabled: o?.value,
|
|
1215
1002
|
onClick: () => {
|
|
1216
|
-
|
|
1003
|
+
T(e, {
|
|
1004
|
+
direct: "prettier"
|
|
1005
|
+
});
|
|
1217
1006
|
},
|
|
1218
1007
|
type: "button"
|
|
1219
|
-
}, [a(
|
|
1008
|
+
}, [a(k, {
|
|
1220
1009
|
name: "prettier"
|
|
1221
1010
|
}, null), n?.value && a("div", {
|
|
1222
1011
|
class: `${l}-toolbar-item-name`
|
|
1223
1012
|
}, [t.value.toolbarTips?.prettier])]);
|
|
1224
1013
|
}
|
|
1225
|
-
}),
|
|
1014
|
+
}), Do = /* @__PURE__ */ w({
|
|
1226
1015
|
name: "ToolbarPreview",
|
|
1227
1016
|
setup() {
|
|
1228
1017
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
|
|
@@ -1235,13 +1024,13 @@ $$`, "title")
|
|
|
1235
1024
|
i("preview");
|
|
1236
1025
|
},
|
|
1237
1026
|
type: "button"
|
|
1238
|
-
}, [a(
|
|
1027
|
+
}, [a(k, {
|
|
1239
1028
|
name: "preview"
|
|
1240
1029
|
}, null), o?.value && a("div", {
|
|
1241
1030
|
class: `${l}-toolbar-item-name`
|
|
1242
1031
|
}, [e.value.toolbarTips?.preview])]);
|
|
1243
1032
|
}
|
|
1244
|
-
}),
|
|
1033
|
+
}), No = /* @__PURE__ */ w({
|
|
1245
1034
|
name: "ToolbarPreviewOnly",
|
|
1246
1035
|
setup() {
|
|
1247
1036
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
|
|
@@ -1254,51 +1043,53 @@ $$`, "title")
|
|
|
1254
1043
|
i("previewOnly");
|
|
1255
1044
|
},
|
|
1256
1045
|
type: "button"
|
|
1257
|
-
}, [a(
|
|
1046
|
+
}, [a(k, {
|
|
1258
1047
|
name: "preview-only"
|
|
1259
1048
|
}, null), o?.value && a("div", {
|
|
1260
1049
|
class: `${l}-toolbar-item-name`
|
|
1261
1050
|
}, [e.value.toolbarTips?.previewOnly])]);
|
|
1262
1051
|
}
|
|
1263
|
-
}),
|
|
1052
|
+
}), Ao = /* @__PURE__ */ w({
|
|
1264
1053
|
name: "ToolbarQuote",
|
|
1265
1054
|
setup() {
|
|
1266
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1055
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1267
1056
|
return () => a("button", {
|
|
1268
1057
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1269
1058
|
title: t.value.toolbarTips?.quote,
|
|
1270
1059
|
"aria-label": t.value.toolbarTips?.quote,
|
|
1271
1060
|
disabled: o?.value,
|
|
1272
1061
|
onClick: () => {
|
|
1273
|
-
|
|
1062
|
+
T(e, {
|
|
1063
|
+
direct: "quote"
|
|
1064
|
+
});
|
|
1274
1065
|
},
|
|
1275
1066
|
type: "button"
|
|
1276
|
-
}, [a(
|
|
1067
|
+
}, [a(k, {
|
|
1277
1068
|
name: "quote"
|
|
1278
1069
|
}, null), n?.value && a("div", {
|
|
1279
1070
|
class: `${l}-toolbar-item-name`
|
|
1280
1071
|
}, [t.value.toolbarTips?.quote])]);
|
|
1281
1072
|
}
|
|
1282
|
-
}),
|
|
1073
|
+
}), Ro = /* @__PURE__ */ w({
|
|
1283
1074
|
name: "ToolbarRevoke",
|
|
1284
1075
|
setup() {
|
|
1285
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1076
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1286
1077
|
return () => a("button", {
|
|
1287
1078
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1288
1079
|
title: t.value.toolbarTips?.revoke,
|
|
1289
1080
|
"aria-label": t.value.toolbarTips?.revoke,
|
|
1290
1081
|
disabled: o?.value,
|
|
1291
1082
|
onClick: () => {
|
|
1292
|
-
|
|
1083
|
+
L.emit(e, je);
|
|
1293
1084
|
},
|
|
1294
1085
|
type: "button"
|
|
1295
|
-
}, [a(
|
|
1086
|
+
}, [a(k, {
|
|
1296
1087
|
name: "revoke"
|
|
1297
1088
|
}, null), n?.value && a("div", {
|
|
1298
1089
|
class: `${l}-toolbar-item-name`
|
|
1299
1090
|
}, [t.value.toolbarTips?.revoke])]);
|
|
1300
1091
|
}
|
|
1301
|
-
}),
|
|
1092
|
+
}), Mo = /* @__PURE__ */ w({
|
|
1302
1093
|
name: "ToolbarSave",
|
|
1303
1094
|
setup() {
|
|
1304
1095
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1308,73 +1099,79 @@ $$`, "title")
|
|
|
1308
1099
|
"aria-label": t.value.toolbarTips?.save,
|
|
1309
1100
|
disabled: o?.value,
|
|
1310
1101
|
onClick: () => {
|
|
1311
|
-
|
|
1102
|
+
L.emit(e, Ye);
|
|
1312
1103
|
},
|
|
1313
1104
|
type: "button"
|
|
1314
|
-
}, [a(
|
|
1105
|
+
}, [a(k, {
|
|
1315
1106
|
name: "save"
|
|
1316
1107
|
}, null), n?.value && a("div", {
|
|
1317
1108
|
class: `${l}-toolbar-item-name`
|
|
1318
1109
|
}, [t.value.toolbarTips?.save])]);
|
|
1319
1110
|
}
|
|
1320
|
-
}),
|
|
1111
|
+
}), Fo = /* @__PURE__ */ w({
|
|
1321
1112
|
name: "ToolbarStrikeThrough",
|
|
1322
1113
|
setup() {
|
|
1323
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1114
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1324
1115
|
return () => a("button", {
|
|
1325
1116
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1326
1117
|
title: t.value.toolbarTips?.strikeThrough,
|
|
1327
1118
|
"aria-label": t.value.toolbarTips?.strikeThrough,
|
|
1328
1119
|
disabled: o?.value,
|
|
1329
1120
|
onClick: () => {
|
|
1330
|
-
|
|
1121
|
+
T(e, {
|
|
1122
|
+
direct: "strikeThrough"
|
|
1123
|
+
});
|
|
1331
1124
|
},
|
|
1332
1125
|
type: "button"
|
|
1333
|
-
}, [a(
|
|
1126
|
+
}, [a(k, {
|
|
1334
1127
|
name: "strike-through"
|
|
1335
1128
|
}, null), n?.value && a("div", {
|
|
1336
1129
|
class: `${l}-toolbar-item-name`
|
|
1337
1130
|
}, [t.value.toolbarTips?.strikeThrough])]);
|
|
1338
1131
|
}
|
|
1339
|
-
}),
|
|
1132
|
+
}), Bo = /* @__PURE__ */ w({
|
|
1340
1133
|
name: "ToolbarSub",
|
|
1341
1134
|
setup() {
|
|
1342
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1135
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1343
1136
|
return () => a("button", {
|
|
1344
1137
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1345
1138
|
title: t.value.toolbarTips?.sub,
|
|
1346
1139
|
"aria-label": t.value.toolbarTips?.sub,
|
|
1347
1140
|
disabled: o?.value,
|
|
1348
1141
|
onClick: () => {
|
|
1349
|
-
|
|
1142
|
+
T(e, {
|
|
1143
|
+
direct: "sub"
|
|
1144
|
+
});
|
|
1350
1145
|
},
|
|
1351
1146
|
type: "button"
|
|
1352
|
-
}, [a(
|
|
1147
|
+
}, [a(k, {
|
|
1353
1148
|
name: "sub"
|
|
1354
1149
|
}, null), n?.value && a("div", {
|
|
1355
1150
|
class: `${l}-toolbar-item-name`
|
|
1356
1151
|
}, [t.value.toolbarTips?.sub])]);
|
|
1357
1152
|
}
|
|
1358
|
-
}),
|
|
1153
|
+
}), Po = /* @__PURE__ */ w({
|
|
1359
1154
|
name: "ToolbarSup",
|
|
1360
1155
|
setup() {
|
|
1361
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1156
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1362
1157
|
return () => a("button", {
|
|
1363
1158
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1364
1159
|
title: t.value.toolbarTips?.sup,
|
|
1365
1160
|
"aria-label": t.value.toolbarTips?.sup,
|
|
1366
1161
|
disabled: o?.value,
|
|
1367
1162
|
onClick: () => {
|
|
1368
|
-
|
|
1163
|
+
T(e, {
|
|
1164
|
+
direct: "sup"
|
|
1165
|
+
});
|
|
1369
1166
|
},
|
|
1370
1167
|
type: "button"
|
|
1371
|
-
}, [a(
|
|
1168
|
+
}, [a(k, {
|
|
1372
1169
|
name: "sup"
|
|
1373
1170
|
}, null), n?.value && a("div", {
|
|
1374
1171
|
class: `${l}-toolbar-item-name`
|
|
1375
1172
|
}, [t.value.toolbarTips?.sup])]);
|
|
1376
1173
|
}
|
|
1377
|
-
}),
|
|
1174
|
+
}), Ho = {
|
|
1378
1175
|
tableShape: {
|
|
1379
1176
|
type: Array,
|
|
1380
1177
|
default: () => [6, 4]
|
|
@@ -1384,18 +1181,18 @@ $$`, "title")
|
|
|
1384
1181
|
default: () => {
|
|
1385
1182
|
}
|
|
1386
1183
|
}
|
|
1387
|
-
},
|
|
1184
|
+
}, Oo = /* @__PURE__ */ w({
|
|
1388
1185
|
name: "TableShape",
|
|
1389
|
-
props:
|
|
1186
|
+
props: Ho,
|
|
1390
1187
|
setup(e) {
|
|
1391
|
-
const t =
|
|
1188
|
+
const t = Z({
|
|
1392
1189
|
x: -1,
|
|
1393
1190
|
y: -1
|
|
1394
1191
|
}), o = P(() => JSON.stringify(e.tableShape)), n = () => {
|
|
1395
1192
|
const s = [...JSON.parse(o.value)];
|
|
1396
1193
|
return (!s[2] || s[2] < s[0]) && (s[2] = s[0]), (!s[3] || s[3] < s[3]) && (s[3] = s[1]), s;
|
|
1397
|
-
}, i =
|
|
1398
|
-
return
|
|
1194
|
+
}, i = S(n());
|
|
1195
|
+
return A([o], () => {
|
|
1399
1196
|
i.value = n();
|
|
1400
1197
|
}), () => a("div", {
|
|
1401
1198
|
class: `${l}-table-shape`,
|
|
@@ -1418,16 +1215,19 @@ $$`, "title")
|
|
|
1418
1215
|
class: [`${l}-table-shape-col-default`, c <= t.x && u <= t.y && `${l}-table-shape-col-include`]
|
|
1419
1216
|
}, null)]))]))]);
|
|
1420
1217
|
}
|
|
1421
|
-
}),
|
|
1218
|
+
}), Vo = /* @__PURE__ */ w({
|
|
1422
1219
|
name: "ToolbarTable",
|
|
1423
1220
|
setup() {
|
|
1424
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1221
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = r("tableShape"), s = `${e}-toolbar-wrapper`, c = S(!1), d = (m) => {
|
|
1425
1222
|
c.value = m;
|
|
1426
1223
|
}, u = (m) => {
|
|
1427
|
-
o?.value ||
|
|
1428
|
-
|
|
1224
|
+
o?.value || T(e, {
|
|
1225
|
+
direct: "table",
|
|
1226
|
+
params: {
|
|
1227
|
+
selectedShape: m
|
|
1228
|
+
}
|
|
1429
1229
|
});
|
|
1430
|
-
}, v = P(() => a(
|
|
1230
|
+
}, v = P(() => a(Oo, {
|
|
1431
1231
|
tableShape: i.value,
|
|
1432
1232
|
onSelected: u
|
|
1433
1233
|
}, null));
|
|
@@ -1445,37 +1245,41 @@ $$`, "title")
|
|
|
1445
1245
|
"aria-label": t.value.toolbarTips?.table,
|
|
1446
1246
|
disabled: o?.value,
|
|
1447
1247
|
type: "button"
|
|
1448
|
-
}, [a(
|
|
1248
|
+
}, [a(k, {
|
|
1449
1249
|
name: "table"
|
|
1450
1250
|
}, null), n?.value && a("div", {
|
|
1451
1251
|
class: `${l}-toolbar-item-name`
|
|
1452
1252
|
}, [t.value.toolbarTips?.table])])]
|
|
1453
1253
|
});
|
|
1454
1254
|
}
|
|
1455
|
-
}),
|
|
1255
|
+
}), Wo = /* @__PURE__ */ w({
|
|
1456
1256
|
name: "ToolbarTask",
|
|
1457
1257
|
setup() {
|
|
1458
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1258
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1459
1259
|
return () => a("button", {
|
|
1460
1260
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1461
1261
|
title: t.value.toolbarTips?.task,
|
|
1462
1262
|
"aria-label": t.value.toolbarTips?.task,
|
|
1463
1263
|
disabled: o?.value,
|
|
1464
1264
|
onClick: () => {
|
|
1465
|
-
|
|
1265
|
+
T(e, {
|
|
1266
|
+
direct: "task"
|
|
1267
|
+
});
|
|
1466
1268
|
},
|
|
1467
1269
|
type: "button"
|
|
1468
|
-
}, [a(
|
|
1270
|
+
}, [a(k, {
|
|
1469
1271
|
name: "task"
|
|
1470
1272
|
}, null), n?.value && a("div", {
|
|
1471
1273
|
class: `${l}-toolbar-item-name`
|
|
1472
1274
|
}, [t.value.toolbarTips?.task])]);
|
|
1473
1275
|
}
|
|
1474
|
-
}),
|
|
1276
|
+
}), _o = /* @__PURE__ */ w({
|
|
1475
1277
|
name: "ToolbarTitle",
|
|
1476
1278
|
setup() {
|
|
1477
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1478
|
-
o?.value ||
|
|
1279
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = S(!1), c = (v) => {
|
|
1280
|
+
o?.value || T(e, {
|
|
1281
|
+
direct: v
|
|
1282
|
+
});
|
|
1479
1283
|
}, d = (v) => {
|
|
1480
1284
|
s.value = v;
|
|
1481
1285
|
}, u = P(() => a("ul", {
|
|
@@ -1540,60 +1344,71 @@ $$`, "title")
|
|
|
1540
1344
|
title: t.value.toolbarTips?.title,
|
|
1541
1345
|
"aria-label": t.value.toolbarTips?.title,
|
|
1542
1346
|
type: "button"
|
|
1543
|
-
}, [a(
|
|
1347
|
+
}, [a(k, {
|
|
1544
1348
|
name: "title"
|
|
1545
1349
|
}, null), n?.value && a("div", {
|
|
1546
1350
|
class: `${l}-toolbar-item-name`
|
|
1547
1351
|
}, [t.value.toolbarTips?.title])])]
|
|
1548
1352
|
});
|
|
1549
1353
|
}
|
|
1550
|
-
}),
|
|
1354
|
+
}), zo = /* @__PURE__ */ w({
|
|
1551
1355
|
name: "ToolbarUnderline",
|
|
1552
1356
|
setup() {
|
|
1553
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1357
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1554
1358
|
return () => a("button", {
|
|
1555
1359
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1556
1360
|
title: t.value.toolbarTips?.underline,
|
|
1557
1361
|
"aria-label": t.value.toolbarTips?.underline,
|
|
1558
1362
|
disabled: o?.value,
|
|
1559
1363
|
onClick: () => {
|
|
1560
|
-
|
|
1364
|
+
T(e, {
|
|
1365
|
+
direct: "underline"
|
|
1366
|
+
});
|
|
1561
1367
|
},
|
|
1562
1368
|
type: "button"
|
|
1563
|
-
}, [a(
|
|
1369
|
+
}, [a(k, {
|
|
1564
1370
|
name: "underline"
|
|
1565
1371
|
}, null), n?.value && a("div", {
|
|
1566
1372
|
class: `${l}-toolbar-item-name`
|
|
1567
1373
|
}, [t.value.toolbarTips?.underline])]);
|
|
1568
1374
|
}
|
|
1569
|
-
}),
|
|
1375
|
+
}), qo = /* @__PURE__ */ w({
|
|
1570
1376
|
name: "ToolbarUnorderedList",
|
|
1571
1377
|
setup() {
|
|
1572
|
-
const e = r("editorId"), t = r("usedLanguageText"), o = r("
|
|
1378
|
+
const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
|
|
1573
1379
|
return () => a("button", {
|
|
1574
1380
|
class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
|
|
1575
1381
|
title: t.value.toolbarTips?.unorderedList,
|
|
1576
1382
|
"aria-label": t.value.toolbarTips?.unorderedList,
|
|
1577
1383
|
disabled: o?.value,
|
|
1578
1384
|
onClick: () => {
|
|
1579
|
-
|
|
1385
|
+
T(e, {
|
|
1386
|
+
direct: "unorderedList"
|
|
1387
|
+
});
|
|
1580
1388
|
},
|
|
1581
1389
|
type: "button"
|
|
1582
|
-
}, [a(
|
|
1390
|
+
}, [a(k, {
|
|
1583
1391
|
name: "unordered-list"
|
|
1584
1392
|
}, null), n?.value && a("div", {
|
|
1585
1393
|
class: `${l}-toolbar-item-name`
|
|
1586
1394
|
}, [t.value.toolbarTips?.unorderedList])]);
|
|
1587
1395
|
}
|
|
1588
|
-
}),
|
|
1396
|
+
}), Uo = /* @__PURE__ */ w({
|
|
1397
|
+
name: `${l}-divider`,
|
|
1398
|
+
setup() {
|
|
1399
|
+
return () => a("div", {
|
|
1400
|
+
class: `${l}-divider`
|
|
1401
|
+
}, null);
|
|
1402
|
+
}
|
|
1403
|
+
}), Ko = () => {
|
|
1589
1404
|
const e = r("editorId"), t = r("setting"), o = r("updateSetting"), {
|
|
1590
1405
|
editorExtensions: n,
|
|
1591
1406
|
editorExtensionsAttrs: i
|
|
1592
|
-
} =
|
|
1407
|
+
} = X;
|
|
1593
1408
|
let s = n.screenfull.instance;
|
|
1594
|
-
const c =
|
|
1409
|
+
const c = S(!1), d = (m) => {
|
|
1595
1410
|
if (!s) {
|
|
1596
|
-
|
|
1411
|
+
L.emit(e, J, {
|
|
1597
1412
|
name: "fullscreen",
|
|
1598
1413
|
message: "fullscreen is undefined"
|
|
1599
1414
|
});
|
|
@@ -1608,178 +1423,187 @@ $$`, "title")
|
|
|
1608
1423
|
s = window.screenfull, u();
|
|
1609
1424
|
};
|
|
1610
1425
|
return K(() => {
|
|
1611
|
-
u(), s ||
|
|
1426
|
+
u(), s || oo("script", {
|
|
1612
1427
|
...i.screenfull?.js,
|
|
1613
1428
|
src: n.screenfull.js,
|
|
1614
|
-
id:
|
|
1429
|
+
id: st.screenfull,
|
|
1615
1430
|
onload: v
|
|
1616
1431
|
}, "screenfull");
|
|
1617
1432
|
}), K(() => {
|
|
1618
|
-
|
|
1619
|
-
name:
|
|
1433
|
+
L.on(e, {
|
|
1434
|
+
name: jt,
|
|
1620
1435
|
callback: d
|
|
1621
1436
|
});
|
|
1622
1437
|
}), {
|
|
1623
1438
|
fullscreenHandler: d
|
|
1624
1439
|
};
|
|
1625
1440
|
};
|
|
1626
|
-
let
|
|
1441
|
+
let Go = 0;
|
|
1627
1442
|
const Ze = () => {
|
|
1628
1443
|
const e = r("editorId"), t = r("theme"), o = r("previewTheme"), n = r("language"), i = r("disabled"), s = r("noUploadImg"), c = r("noPrettier"), d = r("codeTheme"), u = r("showToolbarName"), v = r("setting"), m = r("defToolbars");
|
|
1629
1444
|
return {
|
|
1630
1445
|
barRender: (g) => {
|
|
1631
|
-
if (
|
|
1446
|
+
if (xt.includes(g))
|
|
1632
1447
|
switch (g) {
|
|
1633
1448
|
case "-":
|
|
1634
|
-
return a(
|
|
1635
|
-
key: `bar-${
|
|
1449
|
+
return a(Uo, {
|
|
1450
|
+
key: `bar-${Go++}`
|
|
1636
1451
|
}, null);
|
|
1637
1452
|
case "bold":
|
|
1638
|
-
return a(
|
|
1453
|
+
return a(io, {
|
|
1639
1454
|
key: "bar-bold"
|
|
1640
1455
|
}, null);
|
|
1641
1456
|
case "underline":
|
|
1642
|
-
return a(
|
|
1457
|
+
return a(zo, {
|
|
1643
1458
|
key: "bar-unorderline"
|
|
1644
1459
|
}, null);
|
|
1645
1460
|
case "italic":
|
|
1646
|
-
return a(
|
|
1461
|
+
return a(Co, {
|
|
1647
1462
|
key: "bar-italic"
|
|
1648
1463
|
}, null);
|
|
1649
1464
|
case "strikeThrough":
|
|
1650
|
-
return a(
|
|
1465
|
+
return a(Fo, {
|
|
1651
1466
|
key: "bar-strikeThrough"
|
|
1652
1467
|
}, null);
|
|
1653
1468
|
case "title":
|
|
1654
|
-
return a(
|
|
1469
|
+
return a(_o, {
|
|
1655
1470
|
key: "bar-title"
|
|
1656
1471
|
}, null);
|
|
1657
1472
|
case "sub":
|
|
1658
|
-
return a(
|
|
1473
|
+
return a(Bo, {
|
|
1659
1474
|
key: "bar-sub"
|
|
1660
1475
|
}, null);
|
|
1661
1476
|
case "sup":
|
|
1662
|
-
return a(
|
|
1477
|
+
return a(Po, {
|
|
1663
1478
|
key: "bar-sup"
|
|
1664
1479
|
}, null);
|
|
1665
1480
|
case "quote":
|
|
1666
|
-
return a(
|
|
1481
|
+
return a(Ao, {
|
|
1667
1482
|
key: "bar-quote"
|
|
1668
1483
|
}, null);
|
|
1669
1484
|
case "unorderedList":
|
|
1670
|
-
return a(
|
|
1485
|
+
return a(qo, {
|
|
1671
1486
|
key: "bar-unorderedList"
|
|
1672
1487
|
}, null);
|
|
1673
1488
|
case "orderedList":
|
|
1674
|
-
return a(
|
|
1489
|
+
return a(Io, {
|
|
1675
1490
|
key: "bar-orderedList"
|
|
1676
1491
|
}, null);
|
|
1677
1492
|
case "task":
|
|
1678
|
-
return a(
|
|
1493
|
+
return a(Wo, {
|
|
1679
1494
|
key: "bar-task"
|
|
1680
1495
|
}, null);
|
|
1681
1496
|
case "codeRow":
|
|
1682
|
-
return a(
|
|
1497
|
+
return a(mo, {
|
|
1683
1498
|
key: "bar-codeRow"
|
|
1684
1499
|
}, null);
|
|
1685
1500
|
case "code":
|
|
1686
|
-
return a(
|
|
1501
|
+
return a(uo, {
|
|
1687
1502
|
key: "bar-code"
|
|
1688
1503
|
}, null);
|
|
1689
1504
|
case "link":
|
|
1690
|
-
return a(
|
|
1505
|
+
return a($o, {
|
|
1691
1506
|
key: "bar-link"
|
|
1692
1507
|
}, null);
|
|
1693
1508
|
case "image":
|
|
1694
|
-
return s ? a(
|
|
1509
|
+
return s ? a(ho, {
|
|
1695
1510
|
key: "bar-image"
|
|
1696
|
-
}, null) : a(
|
|
1511
|
+
}, null) : a(yo, {
|
|
1697
1512
|
key: "bar-imageDropdown"
|
|
1698
1513
|
}, null);
|
|
1699
1514
|
case "table":
|
|
1700
|
-
return a(
|
|
1515
|
+
return a(Vo, {
|
|
1701
1516
|
key: "bar-table"
|
|
1702
1517
|
}, null);
|
|
1703
1518
|
case "revoke":
|
|
1704
|
-
return a(
|
|
1519
|
+
return a(Ro, {
|
|
1705
1520
|
key: "bar-revoke"
|
|
1706
1521
|
}, null);
|
|
1707
1522
|
case "next":
|
|
1708
|
-
return a(
|
|
1523
|
+
return a(So, {
|
|
1709
1524
|
key: "bar-next"
|
|
1710
1525
|
}, null);
|
|
1711
1526
|
case "save":
|
|
1712
|
-
return a(
|
|
1527
|
+
return a(Mo, {
|
|
1713
1528
|
key: "bar-save"
|
|
1714
1529
|
}, null);
|
|
1715
1530
|
case "prettier":
|
|
1716
|
-
return !c && a(
|
|
1531
|
+
return !c && a(Lo, {
|
|
1717
1532
|
key: "bar-prettier"
|
|
1718
1533
|
}, null);
|
|
1719
1534
|
case "pageFullscreen":
|
|
1720
|
-
return !v.value.fullscreen && a(
|
|
1535
|
+
return !v.value.fullscreen && a(Eo, {
|
|
1721
1536
|
key: "bar-pageFullscreen"
|
|
1722
1537
|
}, null);
|
|
1723
1538
|
case "fullscreen":
|
|
1724
|
-
return a(
|
|
1539
|
+
return a(bo, {
|
|
1725
1540
|
key: "bar-fullscreen"
|
|
1726
1541
|
}, null);
|
|
1727
1542
|
case "catalog":
|
|
1728
|
-
return a(
|
|
1543
|
+
return a(co, {
|
|
1729
1544
|
key: "bar-catalog"
|
|
1730
1545
|
}, null);
|
|
1731
1546
|
case "preview":
|
|
1732
|
-
return a(
|
|
1547
|
+
return a(Do, {
|
|
1733
1548
|
key: "bar-preview"
|
|
1734
1549
|
}, null);
|
|
1735
1550
|
case "previewOnly":
|
|
1736
|
-
return a(
|
|
1551
|
+
return a(No, {
|
|
1737
1552
|
key: "bar-previewOnly"
|
|
1738
1553
|
}, null);
|
|
1739
1554
|
case "htmlPreview":
|
|
1740
|
-
return a(
|
|
1555
|
+
return a(go, {
|
|
1741
1556
|
key: "bar-htmlPreview"
|
|
1742
1557
|
}, null);
|
|
1743
1558
|
case "github":
|
|
1744
|
-
return a(
|
|
1559
|
+
return a(vo, {
|
|
1745
1560
|
key: "bar-github"
|
|
1746
1561
|
}, null);
|
|
1747
1562
|
case "mermaid":
|
|
1748
|
-
return a(
|
|
1563
|
+
return a(xo, {
|
|
1749
1564
|
key: "bar-mermaid"
|
|
1750
1565
|
}, null);
|
|
1751
1566
|
case "katex":
|
|
1752
|
-
return a(
|
|
1567
|
+
return a(ko, {
|
|
1753
1568
|
key: "bar-katex"
|
|
1754
1569
|
}, null);
|
|
1755
1570
|
}
|
|
1756
1571
|
else if (m.value instanceof Array) {
|
|
1757
1572
|
const p = m.value[g];
|
|
1758
|
-
return p ?
|
|
1573
|
+
return p ? re(p, {
|
|
1759
1574
|
theme: p.props?.theme || t.value,
|
|
1760
1575
|
previewTheme: p.props?.theme || o.value,
|
|
1761
1576
|
language: p.props?.theme || n.value,
|
|
1762
1577
|
codeTheme: p.props?.codeTheme || d.value,
|
|
1578
|
+
// `disabled` 是自定义工具栏的公开属性,只绑定真正的 disabled 状态;
|
|
1579
|
+
// 只读下的正文写入由统一替换入口拦截。
|
|
1763
1580
|
disabled: p.props?.disabled || i.value,
|
|
1764
1581
|
showToolbarName: p.props?.showToolbarName || u.value,
|
|
1765
|
-
insert(
|
|
1766
|
-
|
|
1767
|
-
|
|
1582
|
+
insert(I) {
|
|
1583
|
+
T(e, {
|
|
1584
|
+
direct: "universal",
|
|
1585
|
+
params: {
|
|
1586
|
+
generate: I
|
|
1587
|
+
}
|
|
1768
1588
|
});
|
|
1769
1589
|
}
|
|
1770
1590
|
}) : "";
|
|
1771
1591
|
} else if (m.value?.children instanceof Array) {
|
|
1772
1592
|
const p = m.value.children[g];
|
|
1773
|
-
return p ?
|
|
1593
|
+
return p ? re(p, {
|
|
1774
1594
|
theme: p.props?.theme || t.value,
|
|
1775
1595
|
previewTheme: p.props?.theme || o.value,
|
|
1776
1596
|
language: p.props?.theme || n.value,
|
|
1777
1597
|
codeTheme: p.props?.codeTheme || d.value,
|
|
1598
|
+
// 只读时仍保留非编辑型自定义操作的可用性。
|
|
1778
1599
|
disabled: p.props?.disabled || i.value,
|
|
1779
1600
|
showToolbarName: p.props?.showToolbarName || u.value,
|
|
1780
|
-
insert(
|
|
1781
|
-
|
|
1782
|
-
|
|
1601
|
+
insert(I) {
|
|
1602
|
+
T(e, {
|
|
1603
|
+
direct: "universal",
|
|
1604
|
+
params: {
|
|
1605
|
+
generate: I
|
|
1606
|
+
}
|
|
1783
1607
|
});
|
|
1784
1608
|
}
|
|
1785
1609
|
}) : "";
|
|
@@ -1787,7 +1611,7 @@ const Ze = () => {
|
|
|
1787
1611
|
return "";
|
|
1788
1612
|
}
|
|
1789
1613
|
};
|
|
1790
|
-
},
|
|
1614
|
+
}, jo = /* @__PURE__ */ w({
|
|
1791
1615
|
name: "FloatingToolbar",
|
|
1792
1616
|
setup() {
|
|
1793
1617
|
const e = r("floatingToolbars"), {
|
|
@@ -1797,20 +1621,20 @@ const Ze = () => {
|
|
|
1797
1621
|
class: `${l}-floating-toolbar`
|
|
1798
1622
|
}, [e.value.map((o) => t(o))]);
|
|
1799
1623
|
}
|
|
1800
|
-
}),
|
|
1624
|
+
}), he = se.define(), Yo = qe.define({
|
|
1801
1625
|
create() {
|
|
1802
1626
|
return null;
|
|
1803
1627
|
},
|
|
1804
1628
|
update(e, t) {
|
|
1805
|
-
for (const o of t.effects) o.is(
|
|
1629
|
+
for (const o of t.effects) o.is(he) && (e = o.value);
|
|
1806
1630
|
return e;
|
|
1807
1631
|
},
|
|
1808
|
-
provide: (e) =>
|
|
1809
|
-
}),
|
|
1632
|
+
provide: (e) => Wt.from(e)
|
|
1633
|
+
}), Zo = (e) => {
|
|
1810
1634
|
let t = null;
|
|
1811
1635
|
const o = (s, c) => {
|
|
1812
1636
|
t && t.kind === c.kind && t.pos === c.pos || (t = c, s.dispatch({
|
|
1813
|
-
effects:
|
|
1637
|
+
effects: he.of({
|
|
1814
1638
|
pos: c.pos,
|
|
1815
1639
|
above: !0,
|
|
1816
1640
|
arrow: !0,
|
|
@@ -1821,13 +1645,13 @@ const Ze = () => {
|
|
|
1821
1645
|
});
|
|
1822
1646
|
const v = document.createElement("div");
|
|
1823
1647
|
d.appendChild(v);
|
|
1824
|
-
const m =
|
|
1648
|
+
const m = kt(jo);
|
|
1825
1649
|
return e.privide(m), m.mount(d), { dom: d, destroy: () => m.unmount() };
|
|
1826
1650
|
}
|
|
1827
1651
|
})
|
|
1828
1652
|
}));
|
|
1829
1653
|
}, n = (s) => {
|
|
1830
|
-
t && (t = null, s.dispatch({ effects:
|
|
1654
|
+
t && (t = null, s.dispatch({ effects: he.of(null) }));
|
|
1831
1655
|
}, i = B.updateListener.of((s) => {
|
|
1832
1656
|
if (s.selectionSet || s.docChanged) {
|
|
1833
1657
|
const c = s.state, d = c.selection.main;
|
|
@@ -1839,19 +1663,19 @@ const Ze = () => {
|
|
|
1839
1663
|
}
|
|
1840
1664
|
}
|
|
1841
1665
|
});
|
|
1842
|
-
return [
|
|
1843
|
-
},
|
|
1666
|
+
return [Yo, i];
|
|
1667
|
+
}, Xo = "#e5c07b", Le = "var(--md-color)", Jo = "#56b6c2", Qo = "#fff", Q = "#3f4a54", De = "#2d8cf0", ea = "#2d8cf0", ta = "#3f4a54", Ne = "#d19a66", oa = "#c678dd", aa = "#f6f6f6", la = "#ceedfa33", Ae = "var(--md-bk-color)", me = "var(--md-bk-color)", na = "#bad5fa", Re = "#3f4a54", ra = B.theme(
|
|
1844
1668
|
{
|
|
1845
1669
|
"&": {
|
|
1846
1670
|
color: Q,
|
|
1847
|
-
backgroundColor:
|
|
1671
|
+
backgroundColor: Ae
|
|
1848
1672
|
},
|
|
1849
1673
|
".cm-content": {
|
|
1850
1674
|
caretColor: Re
|
|
1851
1675
|
},
|
|
1852
1676
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: Re },
|
|
1853
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1854
|
-
".cm-panels": { backgroundColor:
|
|
1677
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: na },
|
|
1678
|
+
".cm-panels": { backgroundColor: aa, color: Q },
|
|
1855
1679
|
".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
|
|
1856
1680
|
".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
|
|
1857
1681
|
".cm-searchMatch": {
|
|
@@ -1867,13 +1691,13 @@ const Ze = () => {
|
|
|
1867
1691
|
backgroundColor: "#bad0f847"
|
|
1868
1692
|
},
|
|
1869
1693
|
".cm-gutters": {
|
|
1870
|
-
backgroundColor:
|
|
1694
|
+
backgroundColor: Ae,
|
|
1871
1695
|
color: Q,
|
|
1872
1696
|
borderRight: "1px solid",
|
|
1873
1697
|
borderColor: "var(--md-border-color)"
|
|
1874
1698
|
},
|
|
1875
1699
|
".cm-activeLineGutter": {
|
|
1876
|
-
backgroundColor:
|
|
1700
|
+
backgroundColor: la
|
|
1877
1701
|
},
|
|
1878
1702
|
".cm-foldPlaceholder": {
|
|
1879
1703
|
backgroundColor: "transparent",
|
|
@@ -1882,7 +1706,7 @@ const Ze = () => {
|
|
|
1882
1706
|
},
|
|
1883
1707
|
".cm-tooltip": {
|
|
1884
1708
|
border: "1px solid var(--md-border-color)",
|
|
1885
|
-
backgroundColor:
|
|
1709
|
+
backgroundColor: me
|
|
1886
1710
|
},
|
|
1887
1711
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1888
1712
|
borderTopColor: "var(--md-border-color)",
|
|
@@ -1890,8 +1714,8 @@ const Ze = () => {
|
|
|
1890
1714
|
borderBottomColor: "var(--md-border-color)"
|
|
1891
1715
|
},
|
|
1892
1716
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1893
|
-
borderTopColor:
|
|
1894
|
-
borderBottomColor:
|
|
1717
|
+
borderTopColor: me,
|
|
1718
|
+
borderBottomColor: me
|
|
1895
1719
|
},
|
|
1896
1720
|
".cm-tooltip-autocomplete": {
|
|
1897
1721
|
"& > ul > li[aria-selected]": {
|
|
@@ -1900,11 +1724,11 @@ const Ze = () => {
|
|
|
1900
1724
|
}
|
|
1901
1725
|
}
|
|
1902
1726
|
// { dark: true }
|
|
1903
|
-
),
|
|
1904
|
-
{ tag: b.keyword, color:
|
|
1727
|
+
), sa = Ke.define([
|
|
1728
|
+
{ tag: b.keyword, color: oa },
|
|
1905
1729
|
{ tag: [b.name, b.deleted, b.character, b.propertyName, b.macroName], color: Le },
|
|
1906
|
-
{ tag: [b.function(b.variableName), b.labelName], color:
|
|
1907
|
-
{ tag: [b.color, b.constant(b.name), b.standard(b.name)], color:
|
|
1730
|
+
{ tag: [b.function(b.variableName), b.labelName], color: ea },
|
|
1731
|
+
{ tag: [b.color, b.constant(b.name), b.standard(b.name)], color: Ne },
|
|
1908
1732
|
{ tag: [b.definition(b.name), b.separator], color: Q },
|
|
1909
1733
|
{
|
|
1910
1734
|
tag: [
|
|
@@ -1917,7 +1741,7 @@ const Ze = () => {
|
|
|
1917
1741
|
b.self,
|
|
1918
1742
|
b.namespace
|
|
1919
1743
|
],
|
|
1920
|
-
color:
|
|
1744
|
+
color: Xo
|
|
1921
1745
|
},
|
|
1922
1746
|
{
|
|
1923
1747
|
tag: [
|
|
@@ -1929,21 +1753,21 @@ const Ze = () => {
|
|
|
1929
1753
|
b.link,
|
|
1930
1754
|
b.special(b.string)
|
|
1931
1755
|
],
|
|
1932
|
-
color:
|
|
1756
|
+
color: Jo
|
|
1933
1757
|
},
|
|
1934
|
-
{ tag: [b.meta, b.comment], color:
|
|
1758
|
+
{ tag: [b.meta, b.comment], color: De },
|
|
1935
1759
|
{ tag: b.strong, fontWeight: "bold" },
|
|
1936
1760
|
{ tag: b.emphasis, fontStyle: "italic" },
|
|
1937
1761
|
{ tag: b.strikethrough, textDecoration: "line-through" },
|
|
1938
|
-
{ tag: b.link, color:
|
|
1762
|
+
{ tag: b.link, color: De, textDecoration: "underline" },
|
|
1939
1763
|
{ tag: b.heading, fontWeight: "bold", color: Le },
|
|
1940
|
-
{ tag: [b.atom, b.bool, b.special(b.variableName)], color:
|
|
1941
|
-
{ tag: [b.processingInstruction, b.string, b.inserted], color:
|
|
1942
|
-
{ tag: b.invalid, color:
|
|
1764
|
+
{ tag: [b.atom, b.bool, b.special(b.variableName)], color: Ne },
|
|
1765
|
+
{ tag: [b.processingInstruction, b.string, b.inserted], color: ta },
|
|
1766
|
+
{ tag: b.invalid, color: Qo }
|
|
1943
1767
|
]), Me = [
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
],
|
|
1768
|
+
ra,
|
|
1769
|
+
Ue(sa)
|
|
1770
|
+
], ia = "#e5c07b", Fe = "var(--md-color)", ca = "#56b6c2", ua = "#ffffff", ee = "var(--md-color)", Be = "#e5c07b", da = "#e5c07b", ma = "var(--md-color)", Pe = "#d19a66", ba = "#c678dd", va = "#21252b", ga = "#2c313a", He = "var(--md-bk-color)", be = "var(--md-bk-color)", ha = "#ceedfa33", Oe = "#528bff", pa = B.theme(
|
|
1947
1771
|
{
|
|
1948
1772
|
"&": {
|
|
1949
1773
|
color: ee,
|
|
@@ -1953,8 +1777,8 @@ const Ze = () => {
|
|
|
1953
1777
|
caretColor: Oe
|
|
1954
1778
|
},
|
|
1955
1779
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: Oe },
|
|
1956
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1957
|
-
".cm-panels": { backgroundColor:
|
|
1780
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ha },
|
|
1781
|
+
".cm-panels": { backgroundColor: va, color: ee },
|
|
1958
1782
|
".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
|
|
1959
1783
|
".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
|
|
1960
1784
|
".cm-searchMatch": {
|
|
@@ -1976,7 +1800,7 @@ const Ze = () => {
|
|
|
1976
1800
|
borderColor: "var(--md-border-color)"
|
|
1977
1801
|
},
|
|
1978
1802
|
".cm-activeLineGutter": {
|
|
1979
|
-
backgroundColor:
|
|
1803
|
+
backgroundColor: ga
|
|
1980
1804
|
},
|
|
1981
1805
|
".cm-foldPlaceholder": {
|
|
1982
1806
|
backgroundColor: "transparent",
|
|
@@ -1985,7 +1809,7 @@ const Ze = () => {
|
|
|
1985
1809
|
},
|
|
1986
1810
|
".cm-tooltip": {
|
|
1987
1811
|
border: "1px solid var(--md-border-color)",
|
|
1988
|
-
backgroundColor:
|
|
1812
|
+
backgroundColor: be
|
|
1989
1813
|
},
|
|
1990
1814
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1991
1815
|
borderTopColor: "var(--md-border-color)",
|
|
@@ -1993,8 +1817,8 @@ const Ze = () => {
|
|
|
1993
1817
|
borderBottomColor: "var(--md-border-color)"
|
|
1994
1818
|
},
|
|
1995
1819
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1996
|
-
borderTopColor:
|
|
1997
|
-
borderBottomColor:
|
|
1820
|
+
borderTopColor: be,
|
|
1821
|
+
borderBottomColor: be
|
|
1998
1822
|
},
|
|
1999
1823
|
".cm-tooltip-autocomplete": {
|
|
2000
1824
|
"& > ul > li[aria-selected]": {
|
|
@@ -2003,10 +1827,10 @@ const Ze = () => {
|
|
|
2003
1827
|
}
|
|
2004
1828
|
},
|
|
2005
1829
|
{ dark: !0 }
|
|
2006
|
-
),
|
|
2007
|
-
{ tag: b.keyword, color:
|
|
1830
|
+
), fa = Ke.define([
|
|
1831
|
+
{ tag: b.keyword, color: ba },
|
|
2008
1832
|
{ tag: [b.name, b.deleted, b.character, b.propertyName, b.macroName], color: Fe },
|
|
2009
|
-
{ tag: [b.function(b.variableName), b.labelName], color:
|
|
1833
|
+
{ tag: [b.function(b.variableName), b.labelName], color: da },
|
|
2010
1834
|
{ tag: [b.color, b.constant(b.name), b.standard(b.name)], color: Pe },
|
|
2011
1835
|
{ tag: [b.definition(b.name), b.separator], color: ee },
|
|
2012
1836
|
{
|
|
@@ -2020,7 +1844,7 @@ const Ze = () => {
|
|
|
2020
1844
|
b.self,
|
|
2021
1845
|
b.namespace
|
|
2022
1846
|
],
|
|
2023
|
-
color:
|
|
1847
|
+
color: ia
|
|
2024
1848
|
},
|
|
2025
1849
|
{
|
|
2026
1850
|
tag: [
|
|
@@ -2032,7 +1856,7 @@ const Ze = () => {
|
|
|
2032
1856
|
b.link,
|
|
2033
1857
|
b.special(b.string)
|
|
2034
1858
|
],
|
|
2035
|
-
color:
|
|
1859
|
+
color: ca
|
|
2036
1860
|
},
|
|
2037
1861
|
{ tag: [b.meta, b.comment], color: Be },
|
|
2038
1862
|
{ tag: b.strong, fontWeight: "bold" },
|
|
@@ -2041,28 +1865,34 @@ const Ze = () => {
|
|
|
2041
1865
|
{ tag: b.link, color: Be, textDecoration: "underline" },
|
|
2042
1866
|
{ tag: b.heading, fontWeight: "bold", color: Fe },
|
|
2043
1867
|
{ tag: [b.atom, b.bool, b.special(b.variableName)], color: Pe },
|
|
2044
|
-
{ tag: [b.processingInstruction, b.string, b.inserted], color:
|
|
2045
|
-
{ tag: b.invalid, color:
|
|
1868
|
+
{ tag: [b.processingInstruction, b.string, b.inserted], color: ma },
|
|
1869
|
+
{ tag: b.invalid, color: ua }
|
|
2046
1870
|
]), Ve = [
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
],
|
|
1871
|
+
pa,
|
|
1872
|
+
Ue(fa)
|
|
1873
|
+
], Ta = (e, t) => {
|
|
2050
1874
|
const o = r("editorId"), n = (s) => {
|
|
2051
1875
|
s instanceof Promise ? s.then((c) => {
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
1876
|
+
T(o, {
|
|
1877
|
+
direct: "universal",
|
|
1878
|
+
params: {
|
|
1879
|
+
generate() {
|
|
1880
|
+
return {
|
|
1881
|
+
targetValue: c
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
2057
1884
|
}
|
|
2058
1885
|
});
|
|
2059
1886
|
}).catch((c) => {
|
|
2060
1887
|
console.error(c);
|
|
2061
|
-
}) :
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
1888
|
+
}) : T(o, {
|
|
1889
|
+
direct: "universal",
|
|
1890
|
+
params: {
|
|
1891
|
+
generate() {
|
|
1892
|
+
return {
|
|
1893
|
+
targetValue: s
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
2066
1896
|
}
|
|
2067
1897
|
});
|
|
2068
1898
|
};
|
|
@@ -2071,25 +1901,25 @@ const Ze = () => {
|
|
|
2071
1901
|
return;
|
|
2072
1902
|
if (s.clipboardData.files.length > 0) {
|
|
2073
1903
|
const { files: g } = s.clipboardData;
|
|
2074
|
-
|
|
1904
|
+
L.emit(
|
|
2075
1905
|
o,
|
|
2076
1906
|
fe,
|
|
2077
1907
|
Array.from(g).filter((p) => /image\/.*/.test(p.type))
|
|
2078
1908
|
), s.preventDefault();
|
|
2079
1909
|
return;
|
|
2080
1910
|
}
|
|
2081
|
-
const c = s.clipboardData.getData("text/plain"), d = t.value?.view.state.selection.main.to || 0, u = t.value?.view.state.doc.lineAt(d).from || 0, v = t.value?.view.state.doc.sliceString(u, d) || "", m = /!\[.*\]\(\s*$/.test(v),
|
|
1911
|
+
const c = s.clipboardData.getData("text/plain"), d = t.value?.view.state.selection.main.to || 0, u = t.value?.view.state.doc.lineAt(d).from || 0, v = t.value?.view.state.doc.sliceString(u, d) || "", m = /!\[.*\]\(\s*$/.test(v), h = /!\[.*\]\((.*)\s?.*\)/.test(c);
|
|
2082
1912
|
if (m) {
|
|
2083
1913
|
const g = e.transformImgUrl(c);
|
|
2084
1914
|
n(g), s.preventDefault();
|
|
2085
1915
|
return;
|
|
2086
|
-
} else if (
|
|
1916
|
+
} else if (h) {
|
|
2087
1917
|
const g = c.match(new RegExp(`(?<=!\\[.*\\]\\()([^)\\s]+)(?=\\s?["']?.*["']?\\))`, "g"));
|
|
2088
1918
|
g ? Promise.all(
|
|
2089
|
-
g.map((p) => e.transformImgUrl(p))
|
|
1919
|
+
g.map((p) => Promise.resolve(e.transformImgUrl(p)))
|
|
2090
1920
|
).then((p) => {
|
|
2091
1921
|
n(
|
|
2092
|
-
p.reduce((
|
|
1922
|
+
p.reduce((y, I, M) => y.replace(g[M], I), c)
|
|
2093
1923
|
);
|
|
2094
1924
|
}).catch((p) => {
|
|
2095
1925
|
console.error(p);
|
|
@@ -2098,23 +1928,26 @@ const Ze = () => {
|
|
|
2098
1928
|
}
|
|
2099
1929
|
if (e.autoDetectCode && s.clipboardData.types.includes("vscode-editor-data")) {
|
|
2100
1930
|
const g = JSON.parse(s.clipboardData.getData("vscode-editor-data"));
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
1931
|
+
T(o, {
|
|
1932
|
+
direct: "code",
|
|
1933
|
+
params: {
|
|
1934
|
+
mode: g.mode,
|
|
1935
|
+
text: s.clipboardData.getData("text/plain")
|
|
1936
|
+
}
|
|
2104
1937
|
}), s.preventDefault();
|
|
2105
1938
|
return;
|
|
2106
1939
|
}
|
|
2107
|
-
e.maxlength && c.length + e.modelValue.length > e.maxlength &&
|
|
1940
|
+
e.maxlength && c.length + e.modelValue.length > e.maxlength && L.emit(o, J, {
|
|
2108
1941
|
name: "overlength",
|
|
2109
1942
|
message: "The input text is too long",
|
|
2110
1943
|
data: c
|
|
2111
1944
|
});
|
|
2112
1945
|
};
|
|
2113
|
-
},
|
|
1946
|
+
}, wa = (e, t) => [
|
|
2114
1947
|
{
|
|
2115
1948
|
key: "Ctrl-b",
|
|
2116
1949
|
mac: "Cmd-b",
|
|
2117
|
-
run: () => (
|
|
1950
|
+
run: () => (T(e, { direct: "bold" }), !0)
|
|
2118
1951
|
},
|
|
2119
1952
|
{
|
|
2120
1953
|
key: "Ctrl-d",
|
|
@@ -2125,145 +1958,145 @@ const Ze = () => {
|
|
|
2125
1958
|
{
|
|
2126
1959
|
key: "Ctrl-s",
|
|
2127
1960
|
mac: "Cmd-s",
|
|
2128
|
-
run: (
|
|
2129
|
-
shift: () => (
|
|
1961
|
+
run: (D) => (L.emit(e, Ye, D.state.doc.toString()), !0),
|
|
1962
|
+
shift: () => (T(e, { direct: "strikeThrough" }), !0)
|
|
2130
1963
|
},
|
|
2131
1964
|
{
|
|
2132
1965
|
key: "Ctrl-u",
|
|
2133
1966
|
mac: "Cmd-u",
|
|
2134
1967
|
preventDefault: !0,
|
|
2135
|
-
run: () => (
|
|
2136
|
-
shift: () => (
|
|
1968
|
+
run: () => (T(e, { direct: "underline" }), !0),
|
|
1969
|
+
shift: () => (T(e, { direct: "unorderedList" }), !0)
|
|
2137
1970
|
},
|
|
2138
1971
|
{
|
|
2139
1972
|
key: "Ctrl-i",
|
|
2140
1973
|
mac: "Cmd-i",
|
|
2141
1974
|
preventDefault: !0,
|
|
2142
|
-
run: () => (
|
|
2143
|
-
shift: () => (
|
|
1975
|
+
run: () => (T(e, { direct: "italic" }), !0),
|
|
1976
|
+
shift: () => (T(e, { direct: "image" }), !0)
|
|
2144
1977
|
},
|
|
2145
1978
|
{
|
|
2146
1979
|
key: "Ctrl-1",
|
|
2147
1980
|
mac: "Cmd-1",
|
|
2148
|
-
run: () => (
|
|
1981
|
+
run: () => (T(e, { direct: "h1" }), !0)
|
|
2149
1982
|
},
|
|
2150
1983
|
{
|
|
2151
1984
|
key: "Ctrl-2",
|
|
2152
1985
|
mac: "Cmd-2",
|
|
2153
|
-
run: () => (
|
|
1986
|
+
run: () => (T(e, { direct: "h2" }), !0)
|
|
2154
1987
|
},
|
|
2155
1988
|
{
|
|
2156
1989
|
key: "Ctrl-3",
|
|
2157
1990
|
mac: "Cmd-3",
|
|
2158
|
-
run: () => (
|
|
1991
|
+
run: () => (T(e, { direct: "h3" }), !0)
|
|
2159
1992
|
},
|
|
2160
1993
|
{
|
|
2161
1994
|
key: "Ctrl-4",
|
|
2162
1995
|
mac: "Cmd-4",
|
|
2163
|
-
run: () => (
|
|
1996
|
+
run: () => (T(e, { direct: "h4" }), !0)
|
|
2164
1997
|
},
|
|
2165
1998
|
{
|
|
2166
1999
|
key: "Ctrl-5",
|
|
2167
2000
|
mac: "Cmd-5",
|
|
2168
|
-
run: () => (
|
|
2001
|
+
run: () => (T(e, { direct: "h5" }), !0)
|
|
2169
2002
|
},
|
|
2170
2003
|
{
|
|
2171
2004
|
key: "Ctrl-6",
|
|
2172
2005
|
mac: "Cmd-6",
|
|
2173
|
-
run: () => (
|
|
2006
|
+
run: () => (T(e, { direct: "h6" }), !0)
|
|
2174
2007
|
},
|
|
2175
2008
|
{
|
|
2176
2009
|
key: "Ctrl-ArrowUp",
|
|
2177
2010
|
mac: "Cmd-ArrowUp",
|
|
2178
|
-
run: () => (
|
|
2011
|
+
run: () => (T(e, { direct: "sup" }), !0)
|
|
2179
2012
|
},
|
|
2180
2013
|
{
|
|
2181
2014
|
key: "Ctrl-ArrowDown",
|
|
2182
2015
|
mac: "Cmd-ArrowDown",
|
|
2183
|
-
run: () => (
|
|
2016
|
+
run: () => (T(e, { direct: "sub" }), !0)
|
|
2184
2017
|
},
|
|
2185
2018
|
{
|
|
2186
2019
|
key: "Ctrl-o",
|
|
2187
2020
|
mac: "Cmd-o",
|
|
2188
|
-
run: () => (
|
|
2021
|
+
run: () => (T(e, { direct: "orderedList" }), !0)
|
|
2189
2022
|
},
|
|
2190
2023
|
{
|
|
2191
2024
|
key: "Ctrl-c",
|
|
2192
2025
|
mac: "Cmd-c",
|
|
2193
|
-
shift: () => (
|
|
2194
|
-
any(
|
|
2195
|
-
return (
|
|
2026
|
+
shift: () => (T(e, { direct: "code" }), !0),
|
|
2027
|
+
any(D, E) {
|
|
2028
|
+
return (E.ctrlKey || E.metaKey) && E.altKey && E.code === "KeyC" ? (T(e, { direct: "codeRow" }), !0) : !1;
|
|
2196
2029
|
}
|
|
2197
2030
|
},
|
|
2198
2031
|
{
|
|
2199
2032
|
key: "Ctrl-l",
|
|
2200
2033
|
mac: "Cmd-l",
|
|
2201
|
-
run: () => (
|
|
2034
|
+
run: () => (T(e, { direct: "link" }), !0)
|
|
2202
2035
|
},
|
|
2203
2036
|
{
|
|
2204
2037
|
key: "Ctrl-f",
|
|
2205
2038
|
mac: "Cmd-f",
|
|
2206
|
-
shift: () => t.noPrettier ? !1 : (
|
|
2039
|
+
shift: () => t.noPrettier ? !1 : (T(e, { direct: "prettier" }), !0)
|
|
2207
2040
|
},
|
|
2208
2041
|
{
|
|
2209
|
-
any: (
|
|
2042
|
+
any: (D, E) => (E.ctrlKey || E.metaKey) && E.altKey && E.shiftKey && E.code === "KeyT" ? (T(e, { direct: "table" }), !0) : !1
|
|
2210
2043
|
},
|
|
2211
|
-
...
|
|
2212
|
-
],
|
|
2213
|
-
`(${
|
|
2044
|
+
...ao
|
|
2045
|
+
], ya = /[a-z][a-z0-9.+-]*:\/\/[^\s<>"'`()]+(?:\([^\s<>"'`]*\)[^\s<>"'`]*)*/i, Ca = /\/\/[^\s<>"'`()]+/i, ka = /data:[a-z]+\/[a-z0-9.+-]+(?:;base64)?,[a-z0-9+/=%]+/i, $a = /\/(?!\/)[^\s<>"'`()]+/i, ie = new RegExp(
|
|
2046
|
+
`(${ya.source}|${Ca.source}|${ka.source}|${$a.source})`,
|
|
2214
2047
|
"gi"
|
|
2215
|
-
),
|
|
2048
|
+
), xa = /[a-z0-9.+-]/i, Sa = (e) => {
|
|
2216
2049
|
const t = [];
|
|
2217
|
-
|
|
2050
|
+
ie.lastIndex = 0;
|
|
2218
2051
|
let o;
|
|
2219
|
-
for (; o =
|
|
2052
|
+
for (; o = ie.exec(e); ) {
|
|
2220
2053
|
const n = o.index ?? 0, i = n > 0 ? e[n - 1] : "";
|
|
2221
|
-
if (i &&
|
|
2054
|
+
if (i && xa.test(i) || i === "<" && e[n] === "/")
|
|
2222
2055
|
continue;
|
|
2223
2056
|
const c = n + o[0].length;
|
|
2224
2057
|
t.push([n, c]);
|
|
2225
2058
|
}
|
|
2226
2059
|
return t;
|
|
2227
|
-
},
|
|
2228
|
-
const t = e.shortenText || (() => "..."), o =
|
|
2229
|
-
const m = new
|
|
2060
|
+
}, Ia = (e, t, o) => e.some((n) => n.from === t && n.to === o), Ea = (e) => {
|
|
2061
|
+
const t = e.shortenText || (() => "..."), o = se.define(), n = se.define(), i = (u, v) => {
|
|
2062
|
+
const m = new Ot(), h = [];
|
|
2230
2063
|
for (let g = 1; g <= u.doc.lines; g++) {
|
|
2231
|
-
const p = u.doc.line(g),
|
|
2232
|
-
|
|
2233
|
-
const
|
|
2064
|
+
const p = u.doc.line(g), y = p.text;
|
|
2065
|
+
ie.lastIndex = 0;
|
|
2066
|
+
const I = e.findTexts?.({
|
|
2234
2067
|
state: u,
|
|
2235
|
-
lineText:
|
|
2068
|
+
lineText: y,
|
|
2236
2069
|
lineNumber: p.number,
|
|
2237
2070
|
lineFrom: p.from,
|
|
2238
2071
|
lineTo: p.to,
|
|
2239
|
-
defaultTextRegex:
|
|
2240
|
-
}) ??
|
|
2241
|
-
for (const M of
|
|
2072
|
+
defaultTextRegex: ie
|
|
2073
|
+
}) ?? Sa(y);
|
|
2074
|
+
for (const M of I) {
|
|
2242
2075
|
if (!M) continue;
|
|
2243
|
-
const [
|
|
2244
|
-
if (typeof
|
|
2076
|
+
const [R, x] = M;
|
|
2077
|
+
if (typeof R != "number" || typeof x != "number" || R < 0 || x <= R || R >= y.length || x > y.length)
|
|
2245
2078
|
continue;
|
|
2246
|
-
const
|
|
2247
|
-
if (!
|
|
2079
|
+
const N = y.slice(R, x);
|
|
2080
|
+
if (!N || N.length <= e.maxLength)
|
|
2248
2081
|
continue;
|
|
2249
|
-
const
|
|
2250
|
-
if (
|
|
2251
|
-
|
|
2082
|
+
const D = p.from + R, E = p.from + x;
|
|
2083
|
+
if (Ia(v, D, E)) {
|
|
2084
|
+
h.push({ from: D, to: E });
|
|
2252
2085
|
continue;
|
|
2253
2086
|
}
|
|
2254
|
-
const
|
|
2087
|
+
const $ = t(N);
|
|
2255
2088
|
m.add(
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2089
|
+
D,
|
|
2090
|
+
E,
|
|
2091
|
+
_t.replace({ widget: new s($, N, D, E) })
|
|
2259
2092
|
);
|
|
2260
2093
|
}
|
|
2261
2094
|
}
|
|
2262
|
-
return { deco: m.finish(), expanded:
|
|
2095
|
+
return { deco: m.finish(), expanded: h };
|
|
2263
2096
|
};
|
|
2264
|
-
class s extends
|
|
2265
|
-
constructor(v, m,
|
|
2266
|
-
super(), this.short = v, this.raw = m, this.from =
|
|
2097
|
+
class s extends zt {
|
|
2098
|
+
constructor(v, m, h, g) {
|
|
2099
|
+
super(), this.short = v, this.raw = m, this.from = h, this.to = g;
|
|
2267
2100
|
}
|
|
2268
2101
|
short;
|
|
2269
2102
|
raw;
|
|
@@ -2271,8 +2104,8 @@ const Ze = () => {
|
|
|
2271
2104
|
to;
|
|
2272
2105
|
toDOM(v) {
|
|
2273
2106
|
const m = document.createElement("span");
|
|
2274
|
-
return m.textContent = this.short, m.className = "cm-short-text", m.title = this.raw, m.style.display = "inline", m.style.textDecoration = "underline", m.addEventListener("mousedown", (
|
|
2275
|
-
|
|
2107
|
+
return m.textContent = this.short, m.className = "cm-short-text", m.title = this.raw, m.style.display = "inline", m.style.textDecoration = "underline", m.addEventListener("mousedown", (h) => {
|
|
2108
|
+
h.preventDefault(), h.stopPropagation(), v.dispatch({
|
|
2276
2109
|
selection: U.cursor(this.from),
|
|
2277
2110
|
effects: o.of({
|
|
2278
2111
|
from: this.from,
|
|
@@ -2280,8 +2113,8 @@ const Ze = () => {
|
|
|
2280
2113
|
expand: !0
|
|
2281
2114
|
})
|
|
2282
2115
|
}), v.focus();
|
|
2283
|
-
}), m.addEventListener("click", (
|
|
2284
|
-
|
|
2116
|
+
}), m.addEventListener("click", (h) => {
|
|
2117
|
+
h.preventDefault();
|
|
2285
2118
|
}), m;
|
|
2286
2119
|
}
|
|
2287
2120
|
ignoreEvent() {
|
|
@@ -2301,12 +2134,12 @@ const Ze = () => {
|
|
|
2301
2134
|
from: v.changes.mapPos(g, 1),
|
|
2302
2135
|
to: v.changes.mapPos(p, -1)
|
|
2303
2136
|
})).filter(({ from: g, to: p }) => g < p));
|
|
2304
|
-
let
|
|
2137
|
+
let h = m !== u.expanded;
|
|
2305
2138
|
for (const g of v.effects)
|
|
2306
2139
|
g.is(o) ? g.value.expand ? m = [{ from: g.value.from, to: g.value.to }] : m = m.filter(
|
|
2307
|
-
({ from: p, to:
|
|
2140
|
+
({ from: p, to: y }) => p !== g.value.from || y !== g.value.to
|
|
2308
2141
|
) : g.is(n) && m.length > 0 && (m = []);
|
|
2309
|
-
return !
|
|
2142
|
+
return !h && m !== u.expanded && (h = !0), v.docChanged || h ? i(v.state, m) : u;
|
|
2310
2143
|
},
|
|
2311
2144
|
provide: (u) => B.decorations.compute([u], (v) => v.field(u).deco)
|
|
2312
2145
|
}), d = B.domEventHandlers({
|
|
@@ -2314,11 +2147,11 @@ const Ze = () => {
|
|
|
2314
2147
|
const m = v.state.field(c, !1);
|
|
2315
2148
|
if (!m || m.expanded.length === 0)
|
|
2316
2149
|
return !1;
|
|
2317
|
-
const
|
|
2318
|
-
if (
|
|
2319
|
-
const g = v.posAtDOM(
|
|
2150
|
+
const h = u.target;
|
|
2151
|
+
if (h && v.dom.contains(h)) {
|
|
2152
|
+
const g = v.posAtDOM(h, 0);
|
|
2320
2153
|
if (g != null && g !== -1 && m.expanded.some(
|
|
2321
|
-
({ from:
|
|
2154
|
+
({ from: y, to: I }) => g >= y && g <= I
|
|
2322
2155
|
))
|
|
2323
2156
|
return !1;
|
|
2324
2157
|
}
|
|
@@ -2326,76 +2159,303 @@ const Ze = () => {
|
|
|
2326
2159
|
}
|
|
2327
2160
|
});
|
|
2328
2161
|
return [c, d];
|
|
2162
|
+
}, La = async (e, t, o) => {
|
|
2163
|
+
if (/^h[1-6]$/.test(e))
|
|
2164
|
+
return Da(e, t);
|
|
2165
|
+
if (e === "prettier")
|
|
2166
|
+
return await Na(t, o);
|
|
2167
|
+
switch (e) {
|
|
2168
|
+
case "bold":
|
|
2169
|
+
case "underline":
|
|
2170
|
+
case "italic":
|
|
2171
|
+
case "strikeThrough":
|
|
2172
|
+
case "sub":
|
|
2173
|
+
case "sup":
|
|
2174
|
+
case "codeRow":
|
|
2175
|
+
case "katexInline":
|
|
2176
|
+
case "katexBlock":
|
|
2177
|
+
return Ra(e, t);
|
|
2178
|
+
case "quote":
|
|
2179
|
+
case "orderedList":
|
|
2180
|
+
case "unorderedList":
|
|
2181
|
+
case "task":
|
|
2182
|
+
return Fa(e, t);
|
|
2183
|
+
case "code":
|
|
2184
|
+
return Ba(o, t);
|
|
2185
|
+
case "table":
|
|
2186
|
+
return Oa(o);
|
|
2187
|
+
case "link": {
|
|
2188
|
+
const n = t.getSelectedText(), { desc: i = n, url: s = "" } = o, c = `[${i}](${s})`;
|
|
2189
|
+
return {
|
|
2190
|
+
text: c,
|
|
2191
|
+
options: {
|
|
2192
|
+
select: s === "",
|
|
2193
|
+
deviationStart: c.length - s.length - 1,
|
|
2194
|
+
deviationEnd: -1
|
|
2195
|
+
}
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
case "image":
|
|
2199
|
+
return Ha(o, t);
|
|
2200
|
+
case "flow":
|
|
2201
|
+
case "sequence":
|
|
2202
|
+
case "gantt":
|
|
2203
|
+
case "class":
|
|
2204
|
+
case "state":
|
|
2205
|
+
case "pie":
|
|
2206
|
+
case "relationship":
|
|
2207
|
+
case "journey":
|
|
2208
|
+
return Pa(e);
|
|
2209
|
+
case "universal":
|
|
2210
|
+
return Va(t.getSelectedText(), o);
|
|
2211
|
+
default:
|
|
2212
|
+
return { text: "", options: {} };
|
|
2213
|
+
}
|
|
2214
|
+
}, Da = (e, t) => {
|
|
2215
|
+
const o = e.slice(1), n = "#".repeat(Number(o)), [i, s, c] = Te(t, {
|
|
2216
|
+
wholeLine: !0
|
|
2217
|
+
});
|
|
2218
|
+
return {
|
|
2219
|
+
text: `${n} ${i}`,
|
|
2220
|
+
options: { deviationStart: n.length + 1, replaceStart: s, replaceEnd: c }
|
|
2221
|
+
};
|
|
2222
|
+
}, Na = async (e, t) => {
|
|
2223
|
+
const o = window.prettier || X.editorExtensions.prettier?.prettierInstance, n = [
|
|
2224
|
+
window.prettierPlugins?.markdown || X.editorExtensions.prettier?.parserMarkdownInstance
|
|
2225
|
+
];
|
|
2226
|
+
return !o || !n[0] ? (L.emit(t.editorId, J, {
|
|
2227
|
+
name: "prettier",
|
|
2228
|
+
message: "prettier is undefined"
|
|
2229
|
+
}), {
|
|
2230
|
+
text: e.getValue(),
|
|
2231
|
+
options: { select: !1, replaceAll: !0 }
|
|
2232
|
+
}) : {
|
|
2233
|
+
text: await o.format(e.getValue(), {
|
|
2234
|
+
parser: "markdown",
|
|
2235
|
+
plugins: n
|
|
2236
|
+
}),
|
|
2237
|
+
options: { select: !1, replaceAll: !0 }
|
|
2238
|
+
};
|
|
2239
|
+
}, Aa = {
|
|
2240
|
+
bold: ["**", "**", 2, -2],
|
|
2241
|
+
underline: ["<u>", "</u>", 3, -4],
|
|
2242
|
+
italic: ["*", "*", 1, -1],
|
|
2243
|
+
strikeThrough: ["~~", "~~", 2, -2],
|
|
2244
|
+
sub: ["~", "~", 1, -1],
|
|
2245
|
+
sup: ["^", "^", 1, -1],
|
|
2246
|
+
codeRow: ["`", "`", 1, -1],
|
|
2247
|
+
katexInline: ["$", "$", 1, -1],
|
|
2248
|
+
katexBlock: [`
|
|
2249
|
+
$$
|
|
2250
|
+
`, `
|
|
2251
|
+
$$
|
|
2252
|
+
`, 4, -4]
|
|
2253
|
+
}, Ra = (e, t) => {
|
|
2254
|
+
const o = t.getSelectedText(), [n, i, s, c] = Aa[e];
|
|
2255
|
+
return {
|
|
2256
|
+
text: `${n}${o}${i}`,
|
|
2257
|
+
options: {
|
|
2258
|
+
deviationStart: s,
|
|
2259
|
+
deviationEnd: c
|
|
2260
|
+
// replaceStart, replaceEnd
|
|
2261
|
+
}
|
|
2262
|
+
};
|
|
2263
|
+
}, Ma = {
|
|
2264
|
+
quote: "> ",
|
|
2265
|
+
unorderedList: "- ",
|
|
2266
|
+
orderedList: 1,
|
|
2267
|
+
task: "- [ ] "
|
|
2268
|
+
}, Fa = (e, t) => {
|
|
2269
|
+
const [o, n, i] = Te(t, {
|
|
2270
|
+
wholeLine: !0
|
|
2271
|
+
}), s = o.split(`
|
|
2272
|
+
`), c = Ma[e], d = e === "orderedList" ? s.map((m, h) => `${c + h}. ${m}`) : s.map((m) => `${c}${m}`), u = e === "orderedList" ? "1. " : c.toString(), v = s.length === 1 ? u.length : 0;
|
|
2273
|
+
return {
|
|
2274
|
+
text: d.join(`
|
|
2275
|
+
`),
|
|
2276
|
+
options: { deviationStart: v, replaceStart: n, replaceEnd: i }
|
|
2277
|
+
};
|
|
2278
|
+
}, Ba = (e, t) => {
|
|
2279
|
+
const [o, n, i] = Te(t), s = e.mode || "language", c = `
|
|
2280
|
+
\`\`\`${s}
|
|
2281
|
+
${e.text || o || ""}
|
|
2282
|
+
\`\`\`
|
|
2283
|
+
`;
|
|
2284
|
+
return {
|
|
2285
|
+
text: c,
|
|
2286
|
+
options: {
|
|
2287
|
+
deviationStart: 4,
|
|
2288
|
+
deviationEnd: 4 + s.length - c.length,
|
|
2289
|
+
replaceStart: n,
|
|
2290
|
+
replaceEnd: i
|
|
2291
|
+
}
|
|
2292
|
+
};
|
|
2293
|
+
}, Pa = (e) => ({
|
|
2294
|
+
text: `
|
|
2295
|
+
\`\`\`mermaid
|
|
2296
|
+
${{
|
|
2297
|
+
flow: `flowchart TD
|
|
2298
|
+
Start --> Stop`,
|
|
2299
|
+
sequence: `sequenceDiagram
|
|
2300
|
+
A->>B: hello!
|
|
2301
|
+
B-->>A: hi!`,
|
|
2302
|
+
gantt: `gantt
|
|
2303
|
+
title Gantt Chart
|
|
2304
|
+
dateFormat YYYY-MM-DD`,
|
|
2305
|
+
class: `classDiagram
|
|
2306
|
+
class Animal`,
|
|
2307
|
+
state: `stateDiagram-v2
|
|
2308
|
+
s1 --> s2`,
|
|
2309
|
+
pie: `pie
|
|
2310
|
+
"Dogs" : 386
|
|
2311
|
+
"Cats" : 85
|
|
2312
|
+
"Rats" : 15`,
|
|
2313
|
+
relationship: `erDiagram
|
|
2314
|
+
CAR ||--o{ NAMED-DRIVER : allows`,
|
|
2315
|
+
journey: `journey
|
|
2316
|
+
title My Journey`,
|
|
2317
|
+
...X.editorConfig.mermaidTemplate
|
|
2318
|
+
}[e]}
|
|
2319
|
+
\`\`\`
|
|
2320
|
+
`,
|
|
2321
|
+
options: { deviationStart: 12, deviationEnd: -5 }
|
|
2322
|
+
}), Ha = (e, t) => {
|
|
2323
|
+
const o = t.getSelectedText(), { desc: n = o, url: i = "", urls: s } = e;
|
|
2324
|
+
let c = "";
|
|
2325
|
+
const d = i === "" && (!s || s instanceof Array && s.length === 0);
|
|
2326
|
+
return s instanceof Array ? c = s.reduce((u, v) => {
|
|
2327
|
+
const {
|
|
2328
|
+
url: m = "",
|
|
2329
|
+
alt: h = "",
|
|
2330
|
+
title: g = ""
|
|
2331
|
+
} = typeof v == "object" ? v : { url: v };
|
|
2332
|
+
return u + `
|
|
2333
|
+
`;
|
|
2334
|
+
}, "") : c = `
|
|
2335
|
+
`, {
|
|
2336
|
+
text: c,
|
|
2337
|
+
options: {
|
|
2338
|
+
select: i === "",
|
|
2339
|
+
deviationStart: d ? c.length - i.length - 2 : c.length,
|
|
2340
|
+
deviationEnd: d ? -2 : 0
|
|
2341
|
+
}
|
|
2342
|
+
};
|
|
2343
|
+
}, Oa = (e) => {
|
|
2344
|
+
const { selectedShape: t = { x: 1, y: 1 } } = e, { x: o, y: n } = t;
|
|
2345
|
+
let i = `
|
|
2346
|
+
| Column`;
|
|
2347
|
+
for (let s = 0; s <= n; s++)
|
|
2348
|
+
i += " |";
|
|
2349
|
+
i += `
|
|
2350
|
+
|`;
|
|
2351
|
+
for (let s = 0; s <= n; s++)
|
|
2352
|
+
i += " - |";
|
|
2353
|
+
for (let s = 0; s <= o; s++) {
|
|
2354
|
+
i += `
|
|
2355
|
+
|`;
|
|
2356
|
+
for (let c = 0; c <= n; c++)
|
|
2357
|
+
i += " |";
|
|
2358
|
+
}
|
|
2359
|
+
return i += `
|
|
2360
|
+
`, { text: i, options: { deviationStart: 3, deviationEnd: 10 - i.length } };
|
|
2361
|
+
}, Va = (e, t) => {
|
|
2362
|
+
const { generate: o } = t, n = o(e);
|
|
2363
|
+
return {
|
|
2364
|
+
text: n.targetValue,
|
|
2365
|
+
options: {
|
|
2366
|
+
select: n.select ?? !0,
|
|
2367
|
+
deviationStart: n.deviationStart || 0,
|
|
2368
|
+
deviationEnd: n.deviationEnd || 0
|
|
2369
|
+
}
|
|
2370
|
+
};
|
|
2371
|
+
}, Te = (e, t = { wholeLine: !1 }) => {
|
|
2372
|
+
const o = e.view.state, n = o.selection.main;
|
|
2373
|
+
if (n.empty) {
|
|
2374
|
+
const i = o.doc.lineAt(n.from);
|
|
2375
|
+
return [o.doc.lineAt(n.from).text, i.from, i.to];
|
|
2376
|
+
} else if (t.wholeLine) {
|
|
2377
|
+
const i = o.doc.lineAt(n.from), s = o.doc.lineAt(n.to);
|
|
2378
|
+
return [
|
|
2379
|
+
o.doc.sliceString(i.from, s.to),
|
|
2380
|
+
i.from,
|
|
2381
|
+
s.to
|
|
2382
|
+
];
|
|
2383
|
+
}
|
|
2384
|
+
return [
|
|
2385
|
+
o.doc.sliceString(n.from, n.to),
|
|
2386
|
+
n.from,
|
|
2387
|
+
n.to
|
|
2388
|
+
];
|
|
2329
2389
|
};
|
|
2330
2390
|
B.EDIT_CONTEXT = !1;
|
|
2331
|
-
const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.extension,
|
|
2391
|
+
const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.extension, Wa = (e) => {
|
|
2332
2392
|
const t = Xe(e);
|
|
2333
2393
|
return e.compartment ? e.compartment.of(t) : t;
|
|
2334
|
-
},
|
|
2394
|
+
}, _a = (e) => {
|
|
2335
2395
|
const t = r("tabWidth"), o = r("editorId"), n = r("theme"), i = r("previewTheme"), s = r("language"), c = r(
|
|
2336
2396
|
"usedLanguageText"
|
|
2337
|
-
), d = r("disabled"), u = r("
|
|
2338
|
-
noPrettier:
|
|
2339
|
-
}),
|
|
2397
|
+
), d = r("disabled"), u = r("contentDisabled"), v = r("showToolbarName"), m = r("customIcon"), h = r("noUploadImg"), g = r("tableShape"), p = r("noPrettier"), y = r("codeTheme"), I = r("setting"), M = r("updateSetting"), R = r("catalogVisible"), x = r("defToolbars"), N = r("floatingToolbars"), D = r("rootRef"), E = S(), $ = $t(), V = S(!1), _ = new Y(), C = new Y(), ue = new Y(), we = new Y(), Je = new Y(), Qe = wa(o, {
|
|
2398
|
+
noPrettier: p
|
|
2399
|
+
}), ye = () => [
|
|
2340
2400
|
...Qe,
|
|
2341
|
-
...Rt,
|
|
2342
2401
|
...Mt,
|
|
2343
|
-
Ft
|
|
2402
|
+
...Ft,
|
|
2403
|
+
Bt
|
|
2344
2404
|
], oe = {
|
|
2345
|
-
paste:
|
|
2405
|
+
paste: Ta(e, $),
|
|
2346
2406
|
blur: e.onBlur,
|
|
2347
2407
|
focus: e.onFocus,
|
|
2348
2408
|
drop: e.onDrop,
|
|
2349
2409
|
compositionstart: () => {
|
|
2350
|
-
|
|
2410
|
+
V.value = !0;
|
|
2351
2411
|
},
|
|
2352
|
-
compositionend: (
|
|
2353
|
-
|
|
2412
|
+
compositionend: (f, F) => {
|
|
2413
|
+
V.value = !1, e.updateModelValue(F.state.doc.toString());
|
|
2354
2414
|
},
|
|
2355
|
-
input: (
|
|
2356
|
-
e.onInput && e.onInput(
|
|
2357
|
-
const { data: F } =
|
|
2358
|
-
e.maxlength && e.modelValue.length + F.length > e.maxlength &&
|
|
2415
|
+
input: (f) => {
|
|
2416
|
+
e.onInput && e.onInput(f);
|
|
2417
|
+
const { data: F } = f;
|
|
2418
|
+
e.maxlength && e.modelValue.length + F.length > e.maxlength && L.emit(o, J, {
|
|
2359
2419
|
name: "overlength",
|
|
2360
2420
|
message: "The input text is too long",
|
|
2361
2421
|
data: F
|
|
2362
2422
|
});
|
|
2363
2423
|
}
|
|
2364
|
-
}, et =
|
|
2365
|
-
privide(
|
|
2366
|
-
|
|
2424
|
+
}, et = Zo({
|
|
2425
|
+
privide(f) {
|
|
2426
|
+
f.provide("editorId", o), f.provide("theme", n), f.provide("previewTheme", i), f.provide("language", s), f.provide("disabled", d), f.provide("contentDisabled", u), f.provide("noUploadImg", h), f.provide("tableShape", g), f.provide("noPrettier", p), f.provide("codeTheme", y), f.provide("showToolbarName", v), f.provide("setting", I), f.provide("updateSetting", M), f.provide("usedLanguageText", c), f.provide("catalogVisible", R), f.provide("defToolbars", x), f.provide("tabWidth", t), f.provide("customIcon", m), f.provide("floatingToolbars", N), f.provide("rootRef", D);
|
|
2367
2427
|
}
|
|
2368
2428
|
}), tt = [
|
|
2369
2429
|
{
|
|
2370
2430
|
type: "theme",
|
|
2371
|
-
extension: ({ theme:
|
|
2372
|
-
compartment:
|
|
2431
|
+
extension: ({ theme: f }) => f.value === "light" ? Me : Ve,
|
|
2432
|
+
compartment: _,
|
|
2373
2433
|
options: {
|
|
2374
2434
|
theme: n
|
|
2375
2435
|
}
|
|
2376
2436
|
},
|
|
2377
2437
|
{
|
|
2378
2438
|
type: "updateListener",
|
|
2379
|
-
extension: B.updateListener.of((
|
|
2380
|
-
|
|
2439
|
+
extension: B.updateListener.of((f) => {
|
|
2440
|
+
f.docChanged && (e.onChange(f.state.doc.toString()), V.value || e.updateModelValue(f.state.doc.toString()));
|
|
2381
2441
|
})
|
|
2382
2442
|
},
|
|
2383
2443
|
{
|
|
2384
2444
|
type: "domEventHandlers",
|
|
2385
2445
|
extension: B.domEventHandlers(oe),
|
|
2386
|
-
compartment:
|
|
2446
|
+
compartment: we
|
|
2387
2447
|
},
|
|
2388
2448
|
{
|
|
2389
2449
|
type: "completions",
|
|
2390
2450
|
extension: Ee(e.completions),
|
|
2391
|
-
compartment:
|
|
2451
|
+
compartment: C
|
|
2392
2452
|
},
|
|
2393
2453
|
{
|
|
2394
2454
|
type: "history",
|
|
2395
2455
|
extension: $e(),
|
|
2396
|
-
compartment:
|
|
2456
|
+
compartment: ue
|
|
2397
2457
|
}
|
|
2398
|
-
],
|
|
2458
|
+
], Ce = X.codeMirrorExtensions(
|
|
2399
2459
|
[
|
|
2400
2460
|
// 横向换行
|
|
2401
2461
|
{
|
|
@@ -2404,200 +2464,190 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2404
2464
|
},
|
|
2405
2465
|
{
|
|
2406
2466
|
type: "keymap",
|
|
2407
|
-
extension:
|
|
2467
|
+
extension: qt.of(ye())
|
|
2408
2468
|
},
|
|
2409
2469
|
// 解决多行placeholder时,光标异常的情况
|
|
2410
2470
|
{
|
|
2411
2471
|
type: "drawSelection",
|
|
2412
|
-
extension:
|
|
2472
|
+
extension: Ut()
|
|
2413
2473
|
},
|
|
2414
2474
|
{
|
|
2415
2475
|
type: "markdown",
|
|
2416
|
-
extension:
|
|
2476
|
+
extension: Pt({ codeLanguages: Ht })
|
|
2417
2477
|
},
|
|
2418
2478
|
{
|
|
2419
2479
|
type: "linkShortener",
|
|
2420
|
-
extension: (
|
|
2480
|
+
extension: (f) => Ea(f),
|
|
2421
2481
|
options: {
|
|
2422
2482
|
maxLength: 30
|
|
2423
2483
|
}
|
|
2424
2484
|
},
|
|
2425
2485
|
{
|
|
2426
2486
|
type: "floatingToolbar",
|
|
2427
|
-
extension:
|
|
2487
|
+
extension: N.value.length > 0 ? et : [],
|
|
2428
2488
|
compartment: Je
|
|
2429
2489
|
}
|
|
2430
2490
|
],
|
|
2431
2491
|
{
|
|
2432
2492
|
editorId: o,
|
|
2433
2493
|
theme: n.value,
|
|
2434
|
-
keyBindings:
|
|
2494
|
+
keyBindings: ye()
|
|
2435
2495
|
}
|
|
2436
|
-
), ot = () => [...tt, ...
|
|
2496
|
+
), ot = () => [...tt, ...Ce].map(Wa);
|
|
2437
2497
|
return K(() => {
|
|
2438
|
-
const
|
|
2498
|
+
const f = new B({
|
|
2439
2499
|
doc: e.modelValue,
|
|
2440
|
-
parent:
|
|
2500
|
+
parent: E.value,
|
|
2441
2501
|
extensions: ot()
|
|
2442
|
-
}), F = new
|
|
2443
|
-
|
|
2444
|
-
F.setTabSize(t), F.setDisabled(d.value), F.setReadOnly(e.readonly), e.placeholder && F.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && F.setMaxLength(e.maxlength), e.autofocus &&
|
|
2445
|
-
}, 0),
|
|
2446
|
-
name:
|
|
2502
|
+
}), F = new no(f);
|
|
2503
|
+
$.value = F, setTimeout(() => {
|
|
2504
|
+
F.setTabSize(t), F.setDisabled(d.value), F.setReadOnly(e.readonly), e.placeholder && F.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && F.setMaxLength(e.maxlength), e.autofocus && f.focus();
|
|
2505
|
+
}, 0), L.on(o, {
|
|
2506
|
+
name: je,
|
|
2447
2507
|
callback() {
|
|
2448
|
-
At(
|
|
2508
|
+
At(f);
|
|
2449
2509
|
}
|
|
2450
|
-
}),
|
|
2451
|
-
name:
|
|
2510
|
+
}), L.on(o, {
|
|
2511
|
+
name: Ge,
|
|
2452
2512
|
callback() {
|
|
2453
|
-
|
|
2513
|
+
Rt(f);
|
|
2454
2514
|
}
|
|
2455
|
-
}),
|
|
2456
|
-
name:
|
|
2457
|
-
async callback(
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
{ ...H, url: _ }
|
|
2466
|
-
);
|
|
2467
|
-
T.value?.replaceSelectedText(W, J, o);
|
|
2468
|
-
}).catch((_) => {
|
|
2469
|
-
console.error(_);
|
|
2470
|
-
});
|
|
2471
|
-
else {
|
|
2472
|
-
const { text: _, options: W } = await ue(O, T.value, {
|
|
2473
|
-
...H,
|
|
2474
|
-
url: V
|
|
2475
|
-
});
|
|
2476
|
-
T.value?.replaceSelectedText(_, W, o);
|
|
2477
|
-
}
|
|
2478
|
-
} else {
|
|
2479
|
-
const { text: V, options: _ } = await ue(
|
|
2480
|
-
O,
|
|
2481
|
-
T.value,
|
|
2482
|
-
H
|
|
2515
|
+
}), L.on(o, {
|
|
2516
|
+
name: Yt,
|
|
2517
|
+
async callback({ direct: z, params: H = {}, source: G = "interaction" }) {
|
|
2518
|
+
const ae = () => u.value && G !== "programmatic";
|
|
2519
|
+
if (ae()) return;
|
|
2520
|
+
const O = async (W) => {
|
|
2521
|
+
const { text: q, options: at } = await La(
|
|
2522
|
+
z,
|
|
2523
|
+
$.value,
|
|
2524
|
+
W
|
|
2483
2525
|
);
|
|
2484
|
-
|
|
2485
|
-
}
|
|
2526
|
+
ae() || $.value?.replaceSelectedText(q, at, o);
|
|
2527
|
+
};
|
|
2528
|
+
if (z === "image" && H.transform) {
|
|
2529
|
+
const W = e.transformImgUrl(H.url);
|
|
2530
|
+
W instanceof Promise ? W.then((q) => O({ ...H, url: q })).catch((q) => {
|
|
2531
|
+
console.error(q);
|
|
2532
|
+
}) : await O({ ...H, url: W });
|
|
2533
|
+
} else
|
|
2534
|
+
await O(H);
|
|
2486
2535
|
}
|
|
2487
|
-
}),
|
|
2488
|
-
name:
|
|
2489
|
-
callback:
|
|
2490
|
-
const H = { ...oe },
|
|
2491
|
-
for (const
|
|
2492
|
-
const
|
|
2493
|
-
|
|
2494
|
-
O
|
|
2495
|
-
} : H[
|
|
2536
|
+
}), L.on(o, {
|
|
2537
|
+
name: Zt,
|
|
2538
|
+
callback: Lt((z) => {
|
|
2539
|
+
const H = { ...oe }, G = Object.keys(oe);
|
|
2540
|
+
for (const ae in z) {
|
|
2541
|
+
const O = ae;
|
|
2542
|
+
G.includes(O) ? H[O] = (W, q) => {
|
|
2543
|
+
z[O](W, q), W.defaultPrevented || oe[O](W, q);
|
|
2544
|
+
} : H[O] = z[O];
|
|
2496
2545
|
}
|
|
2497
|
-
|
|
2498
|
-
effects:
|
|
2546
|
+
$.value?.view.dispatch({
|
|
2547
|
+
effects: we.reconfigure(
|
|
2499
2548
|
B.domEventHandlers(H)
|
|
2500
2549
|
)
|
|
2501
2550
|
});
|
|
2502
2551
|
})
|
|
2503
|
-
}),
|
|
2504
|
-
name:
|
|
2505
|
-
callback: (
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2552
|
+
}), L.on(o, {
|
|
2553
|
+
name: Xt,
|
|
2554
|
+
callback: (z, H) => {
|
|
2555
|
+
if (u.value) return;
|
|
2556
|
+
const G = f.state.doc.line(z);
|
|
2557
|
+
f.dispatch(
|
|
2558
|
+
f.state.update({ changes: { from: G.from, to: G.to, insert: H } })
|
|
2509
2559
|
);
|
|
2510
2560
|
}
|
|
2511
|
-
}),
|
|
2512
|
-
name:
|
|
2561
|
+
}), L.on(o, {
|
|
2562
|
+
name: Jt,
|
|
2513
2563
|
callback() {
|
|
2514
|
-
|
|
2564
|
+
L.emit(o, xe, f);
|
|
2515
2565
|
}
|
|
2516
|
-
}),
|
|
2517
|
-
}),
|
|
2566
|
+
}), L.emit(o, xe, f);
|
|
2567
|
+
}), A(
|
|
2518
2568
|
n,
|
|
2519
2569
|
() => {
|
|
2520
|
-
|
|
2521
|
-
effects:
|
|
2570
|
+
$.value?.view.dispatch({
|
|
2571
|
+
effects: _.reconfigure(n.value === "light" ? Me : Ve)
|
|
2522
2572
|
});
|
|
2523
2573
|
},
|
|
2524
2574
|
{ deep: !0 }
|
|
2525
|
-
),
|
|
2575
|
+
), A(
|
|
2526
2576
|
() => e.completions,
|
|
2527
2577
|
() => {
|
|
2528
|
-
|
|
2529
|
-
effects:
|
|
2578
|
+
$.value?.view.dispatch({
|
|
2579
|
+
effects: C.reconfigure(Ee(e.completions))
|
|
2530
2580
|
});
|
|
2531
2581
|
},
|
|
2532
2582
|
{ deep: !0 }
|
|
2533
|
-
),
|
|
2583
|
+
), A(
|
|
2534
2584
|
() => e.modelValue,
|
|
2535
2585
|
() => {
|
|
2536
|
-
|
|
2586
|
+
$.value?.getValue() !== e.modelValue && $.value?.setValue(e.modelValue);
|
|
2537
2587
|
}
|
|
2538
|
-
),
|
|
2588
|
+
), A(
|
|
2539
2589
|
() => e.placeholder,
|
|
2540
2590
|
() => {
|
|
2541
|
-
|
|
2591
|
+
$.value?.setPlaceholder(e.placeholder);
|
|
2542
2592
|
}
|
|
2543
|
-
),
|
|
2544
|
-
|
|
2545
|
-
}),
|
|
2593
|
+
), A([d], () => {
|
|
2594
|
+
$.value?.setDisabled(d.value);
|
|
2595
|
+
}), A(
|
|
2546
2596
|
() => e.readonly,
|
|
2547
2597
|
() => {
|
|
2548
|
-
|
|
2598
|
+
$.value?.setReadOnly(e.readonly);
|
|
2549
2599
|
}
|
|
2550
|
-
),
|
|
2600
|
+
), A(
|
|
2551
2601
|
() => e.maxlength,
|
|
2552
2602
|
() => {
|
|
2553
|
-
e.maxlength &&
|
|
2603
|
+
e.maxlength && $.value?.setMaxLength(e.maxlength);
|
|
2554
2604
|
}
|
|
2555
|
-
),
|
|
2556
|
-
const
|
|
2605
|
+
), so(() => {
|
|
2606
|
+
const f = Ce.find(
|
|
2557
2607
|
(F) => F.type === "floatingToolbar"
|
|
2558
2608
|
);
|
|
2559
|
-
|
|
2560
|
-
effects:
|
|
2561
|
-
Xe(
|
|
2609
|
+
f?.compartment && (N.value.length > 0 ? $.value?.view.dispatch({
|
|
2610
|
+
effects: f.compartment.reconfigure(
|
|
2611
|
+
Xe(f)
|
|
2562
2612
|
)
|
|
2563
|
-
}) :
|
|
2564
|
-
effects:
|
|
2613
|
+
}) : $.value?.view.dispatch({
|
|
2614
|
+
effects: f.compartment.reconfigure([])
|
|
2565
2615
|
}));
|
|
2566
|
-
},
|
|
2567
|
-
inputWrapperRef:
|
|
2568
|
-
codeMirrorUt:
|
|
2616
|
+
}, N), {
|
|
2617
|
+
inputWrapperRef: E,
|
|
2618
|
+
codeMirrorUt: $,
|
|
2569
2619
|
resetHistory() {
|
|
2570
|
-
|
|
2620
|
+
$.value?.view.dispatch({ effects: ue.reconfigure([]) }), $.value?.view.dispatch({ effects: ue.reconfigure($e()) });
|
|
2571
2621
|
}
|
|
2572
2622
|
};
|
|
2573
|
-
},
|
|
2574
|
-
const n = r("setting"), i = P(() => /px$/.test(`${e.inputBoxWidth}`) ? "50%" : e.inputBoxWidth), s =
|
|
2623
|
+
}, za = (e, t, o) => {
|
|
2624
|
+
const n = r("setting"), i = P(() => /px$/.test(`${e.inputBoxWidth}`) ? "50%" : e.inputBoxWidth), s = Z({
|
|
2575
2625
|
resizedWidth: i.value
|
|
2576
|
-
}), c =
|
|
2626
|
+
}), c = Z({
|
|
2577
2627
|
width: i.value
|
|
2578
|
-
}), d =
|
|
2628
|
+
}), d = Z({
|
|
2579
2629
|
insetInlineStart: i.value,
|
|
2580
2630
|
display: "initial"
|
|
2581
|
-
}), u = (
|
|
2631
|
+
}), u = (h) => {
|
|
2582
2632
|
const g = t.value?.offsetWidth || 0, p = t.value?.getBoundingClientRect().x || 0;
|
|
2583
|
-
let
|
|
2584
|
-
|
|
2585
|
-
const
|
|
2586
|
-
c.width =
|
|
2587
|
-
}, v = (
|
|
2588
|
-
|
|
2633
|
+
let y = h.x - p;
|
|
2634
|
+
y / g < le ? y = g * le : y > g - g * le && (y = g - g * le);
|
|
2635
|
+
const I = `${y / g * 100}%`;
|
|
2636
|
+
c.width = I, d.insetInlineStart = I, s.resizedWidth = I, e.oninputBoxWidthChange?.(I);
|
|
2637
|
+
}, v = (h) => {
|
|
2638
|
+
h.target === o.value && document.addEventListener("mousemove", u);
|
|
2589
2639
|
}, m = () => {
|
|
2590
2640
|
document.removeEventListener("mousemove", u);
|
|
2591
2641
|
};
|
|
2592
|
-
return
|
|
2642
|
+
return A([o], () => {
|
|
2593
2643
|
document.removeEventListener("mousedown", v), document.removeEventListener("mouseup", m), document.addEventListener("mousedown", v), document.addEventListener("mouseup", m);
|
|
2594
2644
|
}), K(() => {
|
|
2595
2645
|
document.addEventListener("mousedown", v), document.addEventListener("mouseup", m);
|
|
2596
|
-
}),
|
|
2646
|
+
}), pe(() => {
|
|
2597
2647
|
document.removeEventListener("mousedown", v), document.removeEventListener("mouseup", m);
|
|
2598
|
-
}),
|
|
2599
|
-
s.resizedWidth =
|
|
2600
|
-
}),
|
|
2648
|
+
}), A([i], ([h]) => {
|
|
2649
|
+
s.resizedWidth = h, c.width = h, d.insetInlineStart = h;
|
|
2650
|
+
}), A(
|
|
2601
2651
|
[
|
|
2602
2652
|
() => n.value.htmlPreview,
|
|
2603
2653
|
() => n.value.preview,
|
|
@@ -2613,8 +2663,8 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2613
2663
|
inputWrapperStyle: c,
|
|
2614
2664
|
resizeOperateStyle: d
|
|
2615
2665
|
};
|
|
2616
|
-
},
|
|
2617
|
-
const e = r("editorId"), t =
|
|
2666
|
+
}, qa = () => {
|
|
2667
|
+
const e = r("editorId"), t = S(!0), o = ze();
|
|
2618
2668
|
return {
|
|
2619
2669
|
onCatalogActive: (c, d) => {
|
|
2620
2670
|
const u = document.querySelector(
|
|
@@ -2628,8 +2678,8 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2628
2678
|
onMouseenter: () => t.value = !1,
|
|
2629
2679
|
onMouseleave: () => t.value = !0
|
|
2630
2680
|
};
|
|
2631
|
-
},
|
|
2632
|
-
name: `${
|
|
2681
|
+
}, ve = /* @__PURE__ */ w({
|
|
2682
|
+
name: `${St}CustomScrollbar`,
|
|
2633
2683
|
props: {
|
|
2634
2684
|
id: {
|
|
2635
2685
|
type: String,
|
|
@@ -2667,44 +2717,46 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2667
2717
|
setup(e, {
|
|
2668
2718
|
slots: t
|
|
2669
2719
|
}) {
|
|
2670
|
-
const o =
|
|
2720
|
+
const o = S(null), n = S(null), i = S(null), s = S(null);
|
|
2671
2721
|
let c = null, d = null, u = !1, v = 0, m = 0;
|
|
2672
|
-
const
|
|
2722
|
+
const h = () => {
|
|
2673
2723
|
if (!n.value || !o.value || !i.value || !s.value) return;
|
|
2674
|
-
const
|
|
2675
|
-
if (
|
|
2724
|
+
const x = o.value.clientHeight, N = n.value.scrollHeight, D = n.value.scrollTop;
|
|
2725
|
+
if (N <= x) {
|
|
2676
2726
|
i.value.style.display = "none", e.alwaysShowTrack || (s.value.style.display = "none");
|
|
2677
2727
|
return;
|
|
2678
2728
|
} else
|
|
2679
2729
|
i.value.style.display = "block", s.value.style.display = "block";
|
|
2680
|
-
const
|
|
2681
|
-
i.value.style.height = `${
|
|
2682
|
-
}, g = () =>
|
|
2683
|
-
u = !0, v =
|
|
2684
|
-
},
|
|
2730
|
+
const E = x / N, $ = Math.max(x * E, 20), V = x - $, _ = Math.min(D * E, V);
|
|
2731
|
+
i.value.style.height = `${$}px`, i.value.style.top = `${_}px`;
|
|
2732
|
+
}, g = () => h(), p = (x) => {
|
|
2733
|
+
u = !0, v = x.clientY, m = n.value.scrollTop, document.body.style.userSelect = "none";
|
|
2734
|
+
}, y = (x) => {
|
|
2685
2735
|
if (!u || !n.value || !o.value) return;
|
|
2686
|
-
const
|
|
2687
|
-
n.value.scrollTop = m +
|
|
2688
|
-
},
|
|
2736
|
+
const N = x.clientY - v, D = n.value.scrollHeight / o.value.clientHeight;
|
|
2737
|
+
n.value.scrollTop = m + N * D;
|
|
2738
|
+
}, I = () => {
|
|
2689
2739
|
u = !1, document.body.style.userSelect = "";
|
|
2690
|
-
}, M = (
|
|
2691
|
-
n.value && n.value.removeEventListener("scroll", g), n.value =
|
|
2692
|
-
},
|
|
2740
|
+
}, M = (x) => {
|
|
2741
|
+
n.value && n.value.removeEventListener("scroll", g), n.value = x, n.value ? (n.value.addEventListener("scroll", g), h()) : s.value && !e.alwaysShowTrack && (s.value.style.display = "none");
|
|
2742
|
+
}, R = () => {
|
|
2693
2743
|
if (!o.value) return;
|
|
2694
|
-
const
|
|
2695
|
-
M(
|
|
2744
|
+
const x = e.scrollTarget ? o.value.querySelector(e.scrollTarget) : o.value.firstElementChild;
|
|
2745
|
+
M(x);
|
|
2696
2746
|
};
|
|
2697
2747
|
return K(async () => {
|
|
2698
|
-
await
|
|
2748
|
+
await ce();
|
|
2749
|
+
const x = o.value;
|
|
2750
|
+
x && (R(), c = new MutationObserver(() => {
|
|
2699
2751
|
d && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
|
|
2700
|
-
|
|
2752
|
+
R();
|
|
2701
2753
|
});
|
|
2702
|
-
}), c.observe(
|
|
2754
|
+
}), c.observe(x, {
|
|
2703
2755
|
childList: !0,
|
|
2704
2756
|
subtree: !0
|
|
2705
|
-
}), window.addEventListener("resize",
|
|
2706
|
-
}),
|
|
2707
|
-
c?.disconnect(), n.value && n.value.removeEventListener("scroll", g), window.removeEventListener("resize",
|
|
2757
|
+
}), window.addEventListener("resize", h), i.value?.addEventListener("mousedown", p), document.addEventListener("mousemove", y), document.addEventListener("mouseup", I));
|
|
2758
|
+
}), pe(() => {
|
|
2759
|
+
c?.disconnect(), n.value && n.value.removeEventListener("scroll", g), window.removeEventListener("resize", h), i.value?.removeEventListener("mousedown", p), document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", I);
|
|
2708
2760
|
}), () => a("div", {
|
|
2709
2761
|
id: e.id,
|
|
2710
2762
|
class: [`${l}-custom-scrollbar`, e.class],
|
|
@@ -2719,45 +2771,45 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2719
2771
|
ref: i
|
|
2720
2772
|
}, null)])]);
|
|
2721
2773
|
}
|
|
2722
|
-
}),
|
|
2774
|
+
}), Ua = ze(), Ka = {
|
|
2723
2775
|
flex: 1
|
|
2724
|
-
},
|
|
2776
|
+
}, Ga = /* @__PURE__ */ w({
|
|
2725
2777
|
name: "MDEditorContent",
|
|
2726
|
-
props:
|
|
2778
|
+
props: it,
|
|
2727
2779
|
setup(e, t) {
|
|
2728
|
-
const o = r("editorId"), n = r("catalogVisible"), i = r("theme"), s = r("setting"), c =
|
|
2780
|
+
const o = r("editorId"), n = r("catalogVisible"), i = r("theme"), s = r("setting"), c = S(""), d = S(), u = S(), {
|
|
2729
2781
|
inputWrapperRef: v,
|
|
2730
2782
|
codeMirrorUt: m,
|
|
2731
|
-
resetHistory:
|
|
2732
|
-
} =
|
|
2783
|
+
resetHistory: h
|
|
2784
|
+
} = _a(e), {
|
|
2733
2785
|
inputWrapperStyle: g,
|
|
2734
2786
|
resizeOperateStyle: p
|
|
2735
|
-
} =
|
|
2736
|
-
|
|
2787
|
+
} = za(e, d, u);
|
|
2788
|
+
lo(e, c, m);
|
|
2737
2789
|
const {
|
|
2738
|
-
onCatalogActive:
|
|
2739
|
-
onMouseenter:
|
|
2790
|
+
onCatalogActive: y,
|
|
2791
|
+
onMouseenter: I,
|
|
2740
2792
|
onMouseleave: M
|
|
2741
|
-
} =
|
|
2742
|
-
if (!s.value.preview &&
|
|
2743
|
-
|
|
2744
|
-
const
|
|
2745
|
-
if (
|
|
2746
|
-
const
|
|
2747
|
-
|
|
2793
|
+
} = qa(), R = (D, E) => {
|
|
2794
|
+
if (!s.value.preview && E.line !== void 0) {
|
|
2795
|
+
D.preventDefault();
|
|
2796
|
+
const $ = m.value?.view;
|
|
2797
|
+
if ($) {
|
|
2798
|
+
const V = $.state.doc.line(E.line + 1), _ = $.lineBlockAt(V.from)?.top, C = $.scrollDOM;
|
|
2799
|
+
Ua(C, _);
|
|
2748
2800
|
}
|
|
2749
2801
|
}
|
|
2750
|
-
},
|
|
2751
|
-
c.value =
|
|
2802
|
+
}, x = P(() => s.value.preview ? "preview" : "editor"), N = (D) => {
|
|
2803
|
+
c.value = D, e.onHtmlChanged(D);
|
|
2752
2804
|
};
|
|
2753
2805
|
return t.expose({
|
|
2754
2806
|
getSelectedText() {
|
|
2755
2807
|
return m.value?.getSelectedText();
|
|
2756
2808
|
},
|
|
2757
|
-
focus(
|
|
2758
|
-
m.value?.focus(
|
|
2809
|
+
focus(D) {
|
|
2810
|
+
m.value?.focus(D);
|
|
2759
2811
|
},
|
|
2760
|
-
resetHistory:
|
|
2812
|
+
resetHistory: h,
|
|
2761
2813
|
getEditorView() {
|
|
2762
2814
|
return m.value?.view;
|
|
2763
2815
|
}
|
|
@@ -2766,7 +2818,7 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2766
2818
|
}, [a("div", {
|
|
2767
2819
|
class: `${l}-content-wrapper`,
|
|
2768
2820
|
ref: d
|
|
2769
|
-
}, [a(
|
|
2821
|
+
}, [a(ve, {
|
|
2770
2822
|
alwaysShowTrack: !0,
|
|
2771
2823
|
scrollTarget: `#${o} .cm-scroller`,
|
|
2772
2824
|
style: g
|
|
@@ -2779,13 +2831,13 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2779
2831
|
class: `${l}-resize-operate`,
|
|
2780
2832
|
style: p,
|
|
2781
2833
|
ref: u
|
|
2782
|
-
}, null), a(
|
|
2783
|
-
style:
|
|
2834
|
+
}, null), a(ve, {
|
|
2835
|
+
style: Ka
|
|
2784
2836
|
}, {
|
|
2785
|
-
default: () => [a(
|
|
2837
|
+
default: () => [a(ct, {
|
|
2786
2838
|
modelValue: e.modelValue,
|
|
2787
2839
|
onChange: e.onChange,
|
|
2788
|
-
onHtmlChanged:
|
|
2840
|
+
onHtmlChanged: N,
|
|
2789
2841
|
onGetCatalog: e.onGetCatalog,
|
|
2790
2842
|
mdHeadingId: e.mdHeadingId,
|
|
2791
2843
|
noMermaid: e.noMermaid,
|
|
@@ -2801,9 +2853,9 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2801
2853
|
previewComponent: e.previewComponent,
|
|
2802
2854
|
noEcharts: e.noEcharts
|
|
2803
2855
|
}, null)]
|
|
2804
|
-
})]), n.value && a(
|
|
2856
|
+
})]), n.value && a(ve, {
|
|
2805
2857
|
class: `${l}-catalog-${e.catalogLayout}`,
|
|
2806
|
-
onMouseenter:
|
|
2858
|
+
onMouseenter: I,
|
|
2807
2859
|
onMouseleave: M
|
|
2808
2860
|
}, {
|
|
2809
2861
|
default: () => [a(We, {
|
|
@@ -2813,14 +2865,14 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2813
2865
|
mdHeadingId: e.mdHeadingId,
|
|
2814
2866
|
key: "internal-catalog",
|
|
2815
2867
|
scrollElementOffsetTop: 2,
|
|
2816
|
-
syncWith:
|
|
2817
|
-
onClick:
|
|
2868
|
+
syncWith: x.value,
|
|
2869
|
+
onClick: R,
|
|
2818
2870
|
catalogMaxDepth: e.catalogMaxDepth,
|
|
2819
|
-
onActive:
|
|
2871
|
+
onActive: y
|
|
2820
2872
|
}, null)]
|
|
2821
2873
|
})]);
|
|
2822
2874
|
}
|
|
2823
|
-
}),
|
|
2875
|
+
}), ja = /* @__PURE__ */ w({
|
|
2824
2876
|
props: {
|
|
2825
2877
|
modelValue: {
|
|
2826
2878
|
type: String,
|
|
@@ -2835,7 +2887,7 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2835
2887
|
class: `${l}-footer-label`
|
|
2836
2888
|
}, [`${t.value.footer?.markdownTotal}:`]), a("span", null, [e.modelValue?.length || 0])]);
|
|
2837
2889
|
}
|
|
2838
|
-
}),
|
|
2890
|
+
}), Ya = {
|
|
2839
2891
|
checked: {
|
|
2840
2892
|
type: Boolean,
|
|
2841
2893
|
default: !1
|
|
@@ -2849,9 +2901,9 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2849
2901
|
type: Boolean,
|
|
2850
2902
|
default: void 0
|
|
2851
2903
|
}
|
|
2852
|
-
},
|
|
2904
|
+
}, Za = /* @__PURE__ */ w({
|
|
2853
2905
|
name: `${l}-checkbox`,
|
|
2854
|
-
props:
|
|
2906
|
+
props: Ya,
|
|
2855
2907
|
setup(e) {
|
|
2856
2908
|
return () => a("div", {
|
|
2857
2909
|
class: [`${l}-checkbox`, e.checked && `${l}-checkbox-checked`, e.disabled && `${l}-disabled`],
|
|
@@ -2860,7 +2912,7 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2860
2912
|
}
|
|
2861
2913
|
}, null);
|
|
2862
2914
|
}
|
|
2863
|
-
}),
|
|
2915
|
+
}), Xa = {
|
|
2864
2916
|
scrollAuto: {
|
|
2865
2917
|
type: Boolean
|
|
2866
2918
|
},
|
|
@@ -2869,8 +2921,8 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2869
2921
|
default: () => {
|
|
2870
2922
|
}
|
|
2871
2923
|
}
|
|
2872
|
-
},
|
|
2873
|
-
props:
|
|
2924
|
+
}, Ja = /* @__PURE__ */ w({
|
|
2925
|
+
props: Xa,
|
|
2874
2926
|
setup(e) {
|
|
2875
2927
|
const t = r("usedLanguageText"), o = r("disabled");
|
|
2876
2928
|
return () => a("div", {
|
|
@@ -2880,13 +2932,13 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2880
2932
|
onClick: () => {
|
|
2881
2933
|
o?.value || e.onScrollAutoChange(!e.scrollAuto);
|
|
2882
2934
|
}
|
|
2883
|
-
}, [t?.value.footer?.scrollAuto]), a(
|
|
2935
|
+
}, [t?.value.footer?.scrollAuto]), a(Za, {
|
|
2884
2936
|
checked: e.scrollAuto,
|
|
2885
2937
|
onChange: e.onScrollAutoChange,
|
|
2886
2938
|
disabled: o?.value
|
|
2887
2939
|
}, null)]);
|
|
2888
2940
|
}
|
|
2889
|
-
}),
|
|
2941
|
+
}), Qa = {
|
|
2890
2942
|
modelValue: {
|
|
2891
2943
|
type: String,
|
|
2892
2944
|
default: ""
|
|
@@ -2909,36 +2961,36 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2909
2961
|
defFooters: {
|
|
2910
2962
|
type: Object
|
|
2911
2963
|
}
|
|
2912
|
-
},
|
|
2964
|
+
}, el = /* @__PURE__ */ w({
|
|
2913
2965
|
name: "MDEditorFooter",
|
|
2914
|
-
props:
|
|
2966
|
+
props: Qa,
|
|
2915
2967
|
setup(e) {
|
|
2916
2968
|
const t = r("theme"), o = r("language"), n = r("disabled"), i = P(() => {
|
|
2917
2969
|
const c = e.footers.indexOf("="), d = c === -1 ? e.footers : e.footers.slice(0, c), u = c === -1 ? [] : e.footers.slice(c, Number.MAX_SAFE_INTEGER);
|
|
2918
2970
|
return [d, u];
|
|
2919
2971
|
}), s = (c) => {
|
|
2920
|
-
if (
|
|
2972
|
+
if (It.includes(c))
|
|
2921
2973
|
switch (c) {
|
|
2922
2974
|
case "markdownTotal":
|
|
2923
|
-
return a(
|
|
2975
|
+
return a(ja, {
|
|
2924
2976
|
modelValue: e.modelValue
|
|
2925
2977
|
}, null);
|
|
2926
2978
|
case "scrollSwitch":
|
|
2927
|
-
return !e.noScrollAuto && a(
|
|
2979
|
+
return !e.noScrollAuto && a(Ja, {
|
|
2928
2980
|
scrollAuto: e.scrollAuto,
|
|
2929
2981
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2930
2982
|
}, null);
|
|
2931
2983
|
}
|
|
2932
2984
|
else if (e.defFooters instanceof Array) {
|
|
2933
2985
|
const d = e.defFooters[c];
|
|
2934
|
-
return d ?
|
|
2986
|
+
return d ? re(d, {
|
|
2935
2987
|
theme: d.props?.theme || t.value,
|
|
2936
2988
|
language: d.props?.language || o.value,
|
|
2937
2989
|
disabled: d.props?.disabled || n?.value
|
|
2938
2990
|
}) : "";
|
|
2939
2991
|
} else if (e.defFooters && e.defFooters.children instanceof Array) {
|
|
2940
2992
|
const d = e.defFooters.children[c];
|
|
2941
|
-
return d ?
|
|
2993
|
+
return d ? re(d, {
|
|
2942
2994
|
theme: d.props?.theme || t.value,
|
|
2943
2995
|
language: d.props?.language || o.value,
|
|
2944
2996
|
disabled: d.props?.disabled || n?.value
|
|
@@ -2957,7 +3009,7 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2957
3009
|
}, [d])]);
|
|
2958
3010
|
};
|
|
2959
3011
|
}
|
|
2960
|
-
}),
|
|
3012
|
+
}), tl = {
|
|
2961
3013
|
// 工具栏选择显示
|
|
2962
3014
|
toolbars: {
|
|
2963
3015
|
type: Array,
|
|
@@ -2968,19 +3020,19 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2968
3020
|
type: Array,
|
|
2969
3021
|
default: () => []
|
|
2970
3022
|
}
|
|
2971
|
-
},
|
|
3023
|
+
}, ol = /* @__PURE__ */ w({
|
|
2972
3024
|
name: "MDEditorToolbar",
|
|
2973
|
-
props:
|
|
3025
|
+
props: tl,
|
|
2974
3026
|
setup(e) {
|
|
2975
|
-
const t = r("editorId"), o = r("showToolbarName"), n = `${t}-toolbar-wrapper`, i =
|
|
3027
|
+
const t = r("editorId"), o = r("showToolbarName"), n = `${t}-toolbar-wrapper`, i = S(), s = S(), {
|
|
2976
3028
|
barRender: c
|
|
2977
3029
|
} = Ze(), d = P(() => {
|
|
2978
|
-
const u = e.toolbars.filter((g) => !e.toolbarsExclude.includes(g)), v = u.indexOf("="), m = v === -1 ? u : u.slice(0, v + 1),
|
|
2979
|
-
return [m,
|
|
3030
|
+
const u = e.toolbars.filter((g) => !e.toolbarsExclude.includes(g)), v = u.indexOf("="), m = v === -1 ? u : u.slice(0, v + 1), h = v === -1 ? [] : u.slice(v, Number.MAX_SAFE_INTEGER);
|
|
3031
|
+
return [m, h];
|
|
2980
3032
|
});
|
|
2981
|
-
return
|
|
2982
|
-
|
|
2983
|
-
i.value &&
|
|
3033
|
+
return A(() => e.toolbars, () => {
|
|
3034
|
+
ce(() => {
|
|
3035
|
+
i.value && Dt(i.value);
|
|
2984
3036
|
});
|
|
2985
3037
|
}, {
|
|
2986
3038
|
immediate: !0
|
|
@@ -3000,80 +3052,80 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
3000
3052
|
}, [v])])])]);
|
|
3001
3053
|
};
|
|
3002
3054
|
}
|
|
3003
|
-
}),
|
|
3055
|
+
}), ge = /* @__PURE__ */ w({
|
|
3004
3056
|
name: "MdEditorV3",
|
|
3005
|
-
props:
|
|
3006
|
-
emits:
|
|
3057
|
+
props: dt,
|
|
3058
|
+
emits: ut,
|
|
3007
3059
|
setup(e, t) {
|
|
3008
3060
|
const {
|
|
3009
3061
|
noKatex: o,
|
|
3010
3062
|
noMermaid: n,
|
|
3011
3063
|
noHighlight: i
|
|
3012
|
-
} = e, s =
|
|
3064
|
+
} = e, s = Z({
|
|
3013
3065
|
scrollAuto: e.scrollAuto
|
|
3014
|
-
}), c =
|
|
3066
|
+
}), c = S(), d = S(), u = P(() => Se({
|
|
3015
3067
|
props: e,
|
|
3016
3068
|
ctx: t
|
|
3017
3069
|
}, "defToolbars")), v = P(() => Se({
|
|
3018
3070
|
props: e,
|
|
3019
3071
|
ctx: t
|
|
3020
|
-
}, "defFooters")), m =
|
|
3072
|
+
}, "defFooters")), m = mt(e), [h, g] = bt(e, t, {
|
|
3021
3073
|
editorId: m
|
|
3022
|
-
}), p =
|
|
3074
|
+
}), p = vt(e, {
|
|
3023
3075
|
editorId: m
|
|
3024
3076
|
});
|
|
3025
|
-
|
|
3077
|
+
gt(e, t, {
|
|
3026
3078
|
editorId: m
|
|
3027
|
-
}),
|
|
3079
|
+
}), ht(e), pt(e, t, {
|
|
3028
3080
|
editorId: m
|
|
3029
3081
|
}), ft(e, t, {
|
|
3030
3082
|
editorId: m,
|
|
3031
3083
|
catalogVisible: p,
|
|
3032
|
-
setting:
|
|
3084
|
+
setting: h,
|
|
3033
3085
|
updateSetting: g,
|
|
3034
3086
|
codeRef: d
|
|
3035
|
-
}),
|
|
3087
|
+
}), Tt(e, {
|
|
3036
3088
|
rootRef: c,
|
|
3037
3089
|
editorId: m,
|
|
3038
|
-
setting:
|
|
3090
|
+
setting: h,
|
|
3039
3091
|
updateSetting: g,
|
|
3040
3092
|
catalogVisible: p,
|
|
3041
3093
|
defToolbars: u
|
|
3042
|
-
}),
|
|
3043
|
-
|
|
3094
|
+
}), pe(() => {
|
|
3095
|
+
L.clear(m);
|
|
3044
3096
|
});
|
|
3045
|
-
const
|
|
3046
|
-
t.emit("update:modelValue",
|
|
3047
|
-
},
|
|
3048
|
-
e.onChange?.(
|
|
3049
|
-
}, M = (
|
|
3050
|
-
e.onHtmlChanged?.(
|
|
3051
|
-
},
|
|
3052
|
-
e.onGetCatalog?.(
|
|
3053
|
-
},
|
|
3054
|
-
e.onBlur?.(
|
|
3055
|
-
},
|
|
3056
|
-
e.onFocus?.(
|
|
3057
|
-
},
|
|
3058
|
-
e.onInput?.(
|
|
3059
|
-
},
|
|
3060
|
-
e.onDrop?.(
|
|
3061
|
-
},
|
|
3062
|
-
e.oninputBoxWidthChange?.(
|
|
3063
|
-
},
|
|
3097
|
+
const y = (C) => {
|
|
3098
|
+
t.emit("update:modelValue", C);
|
|
3099
|
+
}, I = (C) => {
|
|
3100
|
+
e.onChange?.(C), t.emit("onChange", C);
|
|
3101
|
+
}, M = (C) => {
|
|
3102
|
+
e.onHtmlChanged?.(C), t.emit("onHtmlChanged", C);
|
|
3103
|
+
}, R = (C) => {
|
|
3104
|
+
e.onGetCatalog?.(C), t.emit("onGetCatalog", C);
|
|
3105
|
+
}, x = (C) => {
|
|
3106
|
+
e.onBlur?.(C), t.emit("onBlur", C);
|
|
3107
|
+
}, N = (C) => {
|
|
3108
|
+
e.onFocus?.(C), t.emit("onFocus", C);
|
|
3109
|
+
}, D = (C) => {
|
|
3110
|
+
e.onInput?.(C), t.emit("onInput", C);
|
|
3111
|
+
}, E = (C) => {
|
|
3112
|
+
e.onDrop?.(C), t.emit("onDrop", C);
|
|
3113
|
+
}, $ = (C) => {
|
|
3114
|
+
e.oninputBoxWidthChange?.(C), t.emit("oninputBoxWidthChange", C);
|
|
3115
|
+
}, V = () => {
|
|
3064
3116
|
e.onRemount?.(), t.emit("onRemount");
|
|
3065
|
-
},
|
|
3066
|
-
s.scrollAuto =
|
|
3117
|
+
}, _ = (C) => {
|
|
3118
|
+
s.scrollAuto = C;
|
|
3067
3119
|
};
|
|
3068
3120
|
return () => a("div", {
|
|
3069
3121
|
id: m,
|
|
3070
|
-
class: [l, e.class, e.theme === "dark" && `${l}-dark`,
|
|
3122
|
+
class: [l, e.class, e.theme === "dark" && `${l}-dark`, h.fullscreen || h.pageFullscreen ? `${l}-fullscreen` : ""],
|
|
3071
3123
|
style: e.style,
|
|
3072
3124
|
ref: c
|
|
3073
|
-
}, [e.toolbars.length > 0 && a(
|
|
3125
|
+
}, [e.toolbars.length > 0 && a(ol, {
|
|
3074
3126
|
toolbars: e.toolbars,
|
|
3075
3127
|
toolbarsExclude: e.toolbarsExclude
|
|
3076
|
-
}, null), a(
|
|
3128
|
+
}, null), a(Ga, {
|
|
3077
3129
|
ref: d,
|
|
3078
3130
|
modelValue: e.modelValue,
|
|
3079
3131
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -3088,38 +3140,38 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
3088
3140
|
maxlength: e.maxLength,
|
|
3089
3141
|
autoDetectCode: e.autoDetectCode,
|
|
3090
3142
|
noHighlight: i,
|
|
3091
|
-
updateModelValue:
|
|
3092
|
-
onChange:
|
|
3143
|
+
updateModelValue: y,
|
|
3144
|
+
onChange: I,
|
|
3093
3145
|
onHtmlChanged: M,
|
|
3094
|
-
onGetCatalog:
|
|
3095
|
-
onBlur:
|
|
3096
|
-
onFocus:
|
|
3097
|
-
onInput:
|
|
3146
|
+
onGetCatalog: R,
|
|
3147
|
+
onBlur: x,
|
|
3148
|
+
onFocus: N,
|
|
3149
|
+
onInput: D,
|
|
3098
3150
|
completions: e.completions,
|
|
3099
3151
|
noImgZoomIn: e.noImgZoomIn,
|
|
3100
|
-
onDrop:
|
|
3152
|
+
onDrop: E,
|
|
3101
3153
|
inputBoxWidth: e.inputBoxWidth,
|
|
3102
|
-
oninputBoxWidthChange:
|
|
3154
|
+
oninputBoxWidthChange: $,
|
|
3103
3155
|
sanitizeMermaid: e.sanitizeMermaid,
|
|
3104
3156
|
transformImgUrl: e.transformImgUrl,
|
|
3105
3157
|
codeFoldable: e.codeFoldable,
|
|
3106
3158
|
autoFoldThreshold: e.autoFoldThreshold,
|
|
3107
|
-
onRemount:
|
|
3159
|
+
onRemount: V,
|
|
3108
3160
|
catalogLayout: e.catalogLayout,
|
|
3109
3161
|
catalogMaxDepth: e.catalogMaxDepth,
|
|
3110
3162
|
noEcharts: e.noEcharts,
|
|
3111
3163
|
previewComponent: e.previewComponent
|
|
3112
|
-
}, null), e.footers.length > 0 && a(
|
|
3164
|
+
}, null), e.footers.length > 0 && a(el, {
|
|
3113
3165
|
modelValue: e.modelValue,
|
|
3114
3166
|
footers: e.footers,
|
|
3115
3167
|
defFooters: v.value,
|
|
3116
|
-
noScrollAuto: !
|
|
3168
|
+
noScrollAuto: !h.preview && !h.htmlPreview || h.previewOnly,
|
|
3117
3169
|
scrollAuto: s.scrollAuto,
|
|
3118
|
-
onScrollAutoChange:
|
|
3170
|
+
onScrollAutoChange: _
|
|
3119
3171
|
}, null)]);
|
|
3120
3172
|
}
|
|
3121
3173
|
});
|
|
3122
|
-
|
|
3174
|
+
ge.install = (e) => (e.component(ge.name, ge), e.use(Ct).use(lt).use(yt).use(We).use(wt), e);
|
|
3123
3175
|
export {
|
|
3124
|
-
|
|
3176
|
+
ge as default
|
|
3125
3177
|
};
|