md-editor-v3 6.1.0 → 6.1.1
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 +11 -11
- package/lib/cjs/chunks/index3.cjs +36 -36
- package/lib/cjs/chunks/index4.cjs +1 -1
- package/lib/es/MdEditor.mjs +684 -642
- package/lib/es/chunks/index3.mjs +606 -608
- package/lib/es/chunks/index4.mjs +176 -156
- package/lib/types/MdEditor/layouts/Content/codemirror/textShortener.d.ts +3 -3
- package/package.json +1 -1
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { a as J, D as
|
|
2
|
-
import { s as
|
|
3
|
-
import { C as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { inject as r, watch as
|
|
7
|
-
import { g as G, p as a, a as
|
|
8
|
-
import { linkTo as
|
|
9
|
-
import { deleteLine as
|
|
10
|
-
import { markdown as
|
|
11
|
-
import { languages as
|
|
12
|
-
import { EditorState as
|
|
13
|
-
import { placeholder as
|
|
14
|
-
import { b, E as j, R as
|
|
15
|
-
import { indentUnit as
|
|
16
|
-
import { autocompletion as
|
|
17
|
-
import { a as
|
|
18
|
-
import { I as $, M as
|
|
19
|
-
import { b as
|
|
1
|
+
import { a as J, D as lt } from "./chunks/index.mjs";
|
|
2
|
+
import { s as at, a as nt, M as We } from "./chunks/index4.mjs";
|
|
3
|
+
import { C as rt, c as st, a as it, e as ct, b as ut, u as dt, d as mt, f as bt, g as vt, h as gt, i as ft, j as ht, k as pt, M as Tt } from "./chunks/index3.mjs";
|
|
4
|
+
import wt from "./ModalToolbar.mjs";
|
|
5
|
+
import yt from "./NormalToolbar.mjs";
|
|
6
|
+
import { inject as r, watch as E, nextTick as re, onMounted as _, ref as x, defineComponent as C, createVNode as l, reactive as U, toRef as Ce, Fragment as _e, computed as K, cloneVNode as ae, createApp as Ct, shallowRef as kt, onBeforeUnmount as ge } from "vue";
|
|
7
|
+
import { g as G, p as a, a as $t, M as oe, d as xt, b as St } from "./chunks/config.mjs";
|
|
8
|
+
import { linkTo as It, throttle as Et, createSmoothScroll as ze, draggingScroll as Lt } from "@vavt/util";
|
|
9
|
+
import { deleteLine as Nt, history as ke, defaultKeymap as At, historyKeymap as Dt, indentWithTab as Mt, undo as Rt, redo as Ft } from "@codemirror/commands";
|
|
10
|
+
import { markdown as Bt } from "@codemirror/lang-markdown";
|
|
11
|
+
import { languages as Pt } from "@codemirror/language-data";
|
|
12
|
+
import { EditorState as ie, EditorSelection as W, Compartment as q, StateEffect as ne, StateField as qe, RangeSetBuilder as Ht } from "@codemirror/state";
|
|
13
|
+
import { placeholder as Ot, EditorView as R, showTooltip as Vt, Decoration as Wt, WidgetType as _t, keymap as zt, drawSelection as qt } from "@codemirror/view";
|
|
14
|
+
import { b as g, E as j, R as y, C as Ut, U as fe, a as Ue, c as Ke, O as Ge, d as Kt, e as Gt, T as jt, S as Yt, G as $e } from "./chunks/event-bus.mjs";
|
|
15
|
+
import { indentUnit as Zt, syntaxHighlighting as je, HighlightStyle as Ye } from "@codemirror/language";
|
|
16
|
+
import { autocompletion as Xt } from "@codemirror/autocomplete";
|
|
17
|
+
import { a as Jt } from "./chunks/dom.mjs";
|
|
18
|
+
import { I as $, M as Qt } from "./chunks/index2.mjs";
|
|
19
|
+
import { b as eo } from "./chunks/index5.mjs";
|
|
20
20
|
import { tags as d } from "@lezer/highlight";
|
|
21
|
-
import { searchKeymap as
|
|
22
|
-
import { g as
|
|
23
|
-
const
|
|
21
|
+
import { searchKeymap as to } from "@codemirror/search";
|
|
22
|
+
import { g as xe } from "./chunks/vue-tsx.mjs";
|
|
23
|
+
const oo = (e, t, o) => {
|
|
24
24
|
const n = r("editorId"), i = r("setting");
|
|
25
25
|
let s = () => {
|
|
26
26
|
}, c = () => {
|
|
27
27
|
};
|
|
28
28
|
const u = () => {
|
|
29
29
|
s();
|
|
30
|
-
const m = o.value?.view.contentDOM.getRootNode(),
|
|
30
|
+
const m = o.value?.view.contentDOM.getRootNode(), v = m?.querySelector(
|
|
31
31
|
`#${n} .cm-scroller`
|
|
32
|
-
),
|
|
32
|
+
), b = m?.querySelector(
|
|
33
33
|
`[id="${n}-preview-wrapper"]`
|
|
34
34
|
), h = m?.querySelector(
|
|
35
35
|
`[id="${n}-html-wrapper"]`
|
|
36
36
|
);
|
|
37
|
-
(
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
(b || h) && ([c, s] = (b ? at : nt)(
|
|
38
|
+
v,
|
|
39
|
+
b || h,
|
|
40
40
|
o.value
|
|
41
41
|
), e.scrollAuto && c());
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}),
|
|
43
|
+
E([t, i], () => {
|
|
44
|
+
re(u);
|
|
45
|
+
}), E(
|
|
46
46
|
() => e.scrollAuto,
|
|
47
47
|
(m) => {
|
|
48
48
|
m ? c() : s();
|
|
49
49
|
}
|
|
50
|
-
),
|
|
50
|
+
), E(
|
|
51
51
|
() => i.value.previewOnly,
|
|
52
52
|
(m) => {
|
|
53
53
|
m ? s() : c();
|
|
54
54
|
}
|
|
55
|
-
),
|
|
56
|
-
},
|
|
55
|
+
), _(u);
|
|
56
|
+
}, ce = async (e, t, o) => {
|
|
57
57
|
if (/^h[1-6]$/.test(e))
|
|
58
|
-
return
|
|
58
|
+
return lo(e, t);
|
|
59
59
|
if (e === "prettier")
|
|
60
|
-
return await
|
|
60
|
+
return await ao(t, o);
|
|
61
61
|
switch (e) {
|
|
62
62
|
case "bold":
|
|
63
63
|
case "underline":
|
|
@@ -68,16 +68,16 @@ const to = (e, t, o) => {
|
|
|
68
68
|
case "codeRow":
|
|
69
69
|
case "katexInline":
|
|
70
70
|
case "katexBlock":
|
|
71
|
-
return
|
|
71
|
+
return ro(e, t);
|
|
72
72
|
case "quote":
|
|
73
73
|
case "orderedList":
|
|
74
74
|
case "unorderedList":
|
|
75
75
|
case "task":
|
|
76
|
-
return
|
|
76
|
+
return io(e, t);
|
|
77
77
|
case "code":
|
|
78
|
-
return
|
|
78
|
+
return co(o, t);
|
|
79
79
|
case "table":
|
|
80
|
-
return
|
|
80
|
+
return bo(o);
|
|
81
81
|
case "link": {
|
|
82
82
|
const n = t.getSelectedText(), { desc: i = n, url: s = "" } = o, c = `[${i}](${s})`;
|
|
83
83
|
return {
|
|
@@ -90,7 +90,7 @@ const to = (e, t, o) => {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
case "image":
|
|
93
|
-
return
|
|
93
|
+
return mo(o, t);
|
|
94
94
|
case "flow":
|
|
95
95
|
case "sequence":
|
|
96
96
|
case "gantt":
|
|
@@ -99,13 +99,13 @@ const to = (e, t, o) => {
|
|
|
99
99
|
case "pie":
|
|
100
100
|
case "relationship":
|
|
101
101
|
case "journey":
|
|
102
|
-
return
|
|
102
|
+
return uo(e);
|
|
103
103
|
case "universal":
|
|
104
|
-
return
|
|
104
|
+
return vo(t.getSelectedText(), o);
|
|
105
105
|
default:
|
|
106
106
|
return { text: "", options: {} };
|
|
107
107
|
}
|
|
108
|
-
},
|
|
108
|
+
}, lo = (e, t) => {
|
|
109
109
|
const o = e.slice(1), n = "#".repeat(Number(o)), [i, s, c] = he(t, {
|
|
110
110
|
wholeLine: !0
|
|
111
111
|
});
|
|
@@ -113,11 +113,11 @@ const to = (e, t, o) => {
|
|
|
113
113
|
text: `${n} ${i}`,
|
|
114
114
|
options: { deviationStart: n.length + 1, replaceStart: s, replaceEnd: c }
|
|
115
115
|
};
|
|
116
|
-
},
|
|
116
|
+
}, ao = async (e, t) => {
|
|
117
117
|
const o = window.prettier || G.editorExtensions.prettier?.prettierInstance, n = [
|
|
118
118
|
window.prettierPlugins?.markdown || G.editorExtensions.prettier?.parserMarkdownInstance
|
|
119
119
|
];
|
|
120
|
-
return !o || !n[0] ? (
|
|
120
|
+
return !o || !n[0] ? (g.emit(t.editorId, j, {
|
|
121
121
|
name: "prettier",
|
|
122
122
|
message: "prettier is undefined"
|
|
123
123
|
}), {
|
|
@@ -130,7 +130,7 @@ const to = (e, t, o) => {
|
|
|
130
130
|
}),
|
|
131
131
|
options: { select: !1, replaceAll: !0 }
|
|
132
132
|
};
|
|
133
|
-
},
|
|
133
|
+
}, no = {
|
|
134
134
|
bold: ["**", "**", 2, -2],
|
|
135
135
|
underline: ["<u>", "</u>", 3, -4],
|
|
136
136
|
italic: ["*", "*", 1, -1],
|
|
@@ -144,8 +144,8 @@ $$
|
|
|
144
144
|
`, `
|
|
145
145
|
$$
|
|
146
146
|
`, 4, -4]
|
|
147
|
-
},
|
|
148
|
-
const o = t.getSelectedText(), [n, i, s, c] =
|
|
147
|
+
}, ro = (e, t) => {
|
|
148
|
+
const o = t.getSelectedText(), [n, i, s, c] = no[e];
|
|
149
149
|
return {
|
|
150
150
|
text: `${n}${o}${i}`,
|
|
151
151
|
options: {
|
|
@@ -154,22 +154,22 @@ $$
|
|
|
154
154
|
// replaceStart, replaceEnd
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
},
|
|
157
|
+
}, so = {
|
|
158
158
|
quote: "> ",
|
|
159
159
|
unorderedList: "- ",
|
|
160
160
|
orderedList: 1,
|
|
161
161
|
task: "- [ ] "
|
|
162
|
-
},
|
|
162
|
+
}, io = (e, t) => {
|
|
163
163
|
const [o, n, i] = he(t, {
|
|
164
164
|
wholeLine: !0
|
|
165
165
|
}), s = o.split(`
|
|
166
|
-
`), c =
|
|
166
|
+
`), c = so[e], u = e === "orderedList" ? s.map((b, h) => `${c + h}. ${b}`) : s.map((b) => `${c}${b}`), m = e === "orderedList" ? "1. " : c.toString(), v = s.length === 1 ? m.length : 0;
|
|
167
167
|
return {
|
|
168
168
|
text: u.join(`
|
|
169
169
|
`),
|
|
170
|
-
options: { deviationStart:
|
|
170
|
+
options: { deviationStart: v, replaceStart: n, replaceEnd: i }
|
|
171
171
|
};
|
|
172
|
-
},
|
|
172
|
+
}, co = (e, t) => {
|
|
173
173
|
const [o, n, i] = he(t), s = e.mode || "language", c = `
|
|
174
174
|
\`\`\`${s}
|
|
175
175
|
${e.text || o || ""}
|
|
@@ -184,7 +184,7 @@ ${e.text || o || ""}
|
|
|
184
184
|
replaceEnd: i
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
|
-
},
|
|
187
|
+
}, uo = (e) => ({
|
|
188
188
|
text: `
|
|
189
189
|
\`\`\`mermaid
|
|
190
190
|
${{
|
|
@@ -213,17 +213,17 @@ dateFormat YYYY-MM-DD`,
|
|
|
213
213
|
\`\`\`
|
|
214
214
|
`,
|
|
215
215
|
options: { deviationStart: 12, deviationEnd: -5 }
|
|
216
|
-
}),
|
|
216
|
+
}), mo = (e, t) => {
|
|
217
217
|
const o = t.getSelectedText(), { desc: n = o, url: i = "", urls: s } = e;
|
|
218
218
|
let c = "";
|
|
219
219
|
const u = i === "" && (!s || s instanceof Array && s.length === 0);
|
|
220
|
-
return s instanceof Array ? c = s.reduce((m,
|
|
220
|
+
return s instanceof Array ? c = s.reduce((m, v) => {
|
|
221
221
|
const {
|
|
222
|
-
url:
|
|
222
|
+
url: b = "",
|
|
223
223
|
alt: h = "",
|
|
224
|
-
title:
|
|
225
|
-
} = typeof
|
|
226
|
-
return m + `
|
|
227
227
|
`;
|
|
228
228
|
}, "") : c = `
|
|
229
229
|
`, {
|
|
@@ -234,7 +234,7 @@ dateFormat YYYY-MM-DD`,
|
|
|
234
234
|
deviationEnd: u ? -2 : 0
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
},
|
|
237
|
+
}, bo = (e) => {
|
|
238
238
|
const { selectedShape: t = { x: 1, y: 1 } } = e, { x: o, y: n } = t;
|
|
239
239
|
let i = `
|
|
240
240
|
| Column`;
|
|
@@ -252,7 +252,7 @@ dateFormat YYYY-MM-DD`,
|
|
|
252
252
|
}
|
|
253
253
|
return i += `
|
|
254
254
|
`, { text: i, options: { deviationStart: 3, deviationEnd: 10 - i.length } };
|
|
255
|
-
},
|
|
255
|
+
}, vo = (e, t) => {
|
|
256
256
|
const { generate: o } = t, n = o(e);
|
|
257
257
|
return {
|
|
258
258
|
text: n.targetValue,
|
|
@@ -280,13 +280,13 @@ dateFormat YYYY-MM-DD`,
|
|
|
280
280
|
n.from,
|
|
281
281
|
n.to
|
|
282
282
|
];
|
|
283
|
-
},
|
|
284
|
-
const t = new
|
|
283
|
+
}, z = (e) => {
|
|
284
|
+
const t = new q();
|
|
285
285
|
return (n) => (t.get(e.state) ? e.dispatch({ effects: t.reconfigure(n) }) : e.dispatch({
|
|
286
|
-
effects:
|
|
286
|
+
effects: ne.appendConfig.of(t.of(n))
|
|
287
287
|
}), !0);
|
|
288
288
|
};
|
|
289
|
-
class
|
|
289
|
+
class go {
|
|
290
290
|
view;
|
|
291
291
|
maxLength = Number.MAX_SAFE_INTEGER;
|
|
292
292
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
@@ -370,7 +370,7 @@ class vo {
|
|
|
370
370
|
}), this.view.focus();
|
|
371
371
|
} catch (s) {
|
|
372
372
|
if (s.message === "The input text is too long")
|
|
373
|
-
|
|
373
|
+
g.emit(n, j, {
|
|
374
374
|
name: "overlength",
|
|
375
375
|
message: s.message,
|
|
376
376
|
data: t
|
|
@@ -380,7 +380,7 @@ class vo {
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
constructor(t) {
|
|
383
|
-
this.view = t, this.toggleTabSize =
|
|
383
|
+
this.view = t, this.toggleTabSize = z(this.view), this.togglePlaceholder = z(this.view), this.setExtensions = z(this.view), this.toggleDisabled = z(this.view), this.toggleReadOnly = z(this.view), this.toggleMaxlength = z(this.view);
|
|
384
384
|
}
|
|
385
385
|
/**
|
|
386
386
|
* 设置tabSize
|
|
@@ -389,8 +389,8 @@ class vo {
|
|
|
389
389
|
*/
|
|
390
390
|
setTabSize(t) {
|
|
391
391
|
this.toggleTabSize([
|
|
392
|
-
|
|
393
|
-
|
|
392
|
+
ie.tabSize.of(t),
|
|
393
|
+
Zt.of(" ".repeat(t))
|
|
394
394
|
]);
|
|
395
395
|
}
|
|
396
396
|
/**
|
|
@@ -399,7 +399,7 @@ class vo {
|
|
|
399
399
|
* @param t 目标内容
|
|
400
400
|
*/
|
|
401
401
|
setPlaceholder(t) {
|
|
402
|
-
this.togglePlaceholder(
|
|
402
|
+
this.togglePlaceholder(Ot(t));
|
|
403
403
|
}
|
|
404
404
|
focus(t) {
|
|
405
405
|
if (this.view.focus(), !t)
|
|
@@ -417,8 +417,8 @@ class vo {
|
|
|
417
417
|
}
|
|
418
418
|
this.view.dispatch({
|
|
419
419
|
scrollIntoView: !0,
|
|
420
|
-
selection:
|
|
421
|
-
[
|
|
420
|
+
selection: W.create(
|
|
421
|
+
[W.range(o, n), W.cursor(i)],
|
|
422
422
|
1
|
|
423
423
|
)
|
|
424
424
|
});
|
|
@@ -427,15 +427,15 @@ class vo {
|
|
|
427
427
|
this.toggleDisabled([R.editable.of(!t)]);
|
|
428
428
|
}
|
|
429
429
|
setReadOnly(t) {
|
|
430
|
-
this.toggleReadOnly([
|
|
430
|
+
this.toggleReadOnly([ie.readOnly.of(t)]);
|
|
431
431
|
}
|
|
432
432
|
setMaxLength(t) {
|
|
433
433
|
this.maxLength = t, this.toggleMaxlength([
|
|
434
|
-
|
|
434
|
+
ie.changeFilter.of((o) => o.newDoc.length <= t)
|
|
435
435
|
]);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
const
|
|
438
|
+
const fo = (e, t) => {
|
|
439
439
|
if (e === t) return !0;
|
|
440
440
|
if (e.length !== t.length) return !1;
|
|
441
441
|
for (let o = 0; o < e.length; o++)
|
|
@@ -443,28 +443,28 @@ const go = (e, t) => {
|
|
|
443
443
|
return !0;
|
|
444
444
|
}, ho = (e, t) => {
|
|
445
445
|
const o = x(t.value);
|
|
446
|
-
|
|
447
|
-
(!o.value || !
|
|
446
|
+
E([t], () => {
|
|
447
|
+
(!o.value || !fo(o.value, t.value)) && (o.value = t.value, e());
|
|
448
448
|
});
|
|
449
449
|
}, le = (e, t, o, n, i) => (s, c, u, m) => {
|
|
450
|
-
const
|
|
450
|
+
const v = `${e}${t}${o}${n}`, b = u + c.label.length + (i === "title" ? o.length : 0);
|
|
451
451
|
s.dispatch({
|
|
452
|
-
changes: { from: u, to: m, insert:
|
|
453
|
-
selection:
|
|
452
|
+
changes: { from: u, to: m, insert: v },
|
|
453
|
+
selection: W.create(
|
|
454
454
|
[
|
|
455
|
-
|
|
455
|
+
W.range(
|
|
456
456
|
u + c.label.length + (i === "title" ? 1 : -t.length),
|
|
457
|
-
|
|
457
|
+
b
|
|
458
458
|
),
|
|
459
|
-
|
|
459
|
+
W.cursor(b)
|
|
460
460
|
],
|
|
461
461
|
1
|
|
462
462
|
)
|
|
463
463
|
}), s.focus();
|
|
464
|
-
},
|
|
464
|
+
}, Se = (e) => (t, o, n, i) => {
|
|
465
465
|
const s = e.slice(i - n);
|
|
466
466
|
t.dispatch(t.state.replaceSelection(`${s} `));
|
|
467
|
-
},
|
|
467
|
+
}, Ie = (e) => {
|
|
468
468
|
const t = (o) => {
|
|
469
469
|
const n = o.matchBefore(
|
|
470
470
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|\$\$?|!+\s*\w*/
|
|
@@ -478,7 +478,7 @@ const go = (e, t) => {
|
|
|
478
478
|
return {
|
|
479
479
|
label: c,
|
|
480
480
|
type: "text",
|
|
481
|
-
apply:
|
|
481
|
+
apply: Se(c)
|
|
482
482
|
};
|
|
483
483
|
}),
|
|
484
484
|
// 任务列表
|
|
@@ -487,7 +487,7 @@ const go = (e, t) => {
|
|
|
487
487
|
return {
|
|
488
488
|
label: s,
|
|
489
489
|
type: "text",
|
|
490
|
-
apply:
|
|
490
|
+
apply: Se(s)
|
|
491
491
|
};
|
|
492
492
|
}),
|
|
493
493
|
// 代码
|
|
@@ -561,17 +561,17 @@ $$`, "title")
|
|
|
561
561
|
]
|
|
562
562
|
};
|
|
563
563
|
};
|
|
564
|
-
return
|
|
564
|
+
return Xt({
|
|
565
565
|
override: e ? [t, ...e] : [t]
|
|
566
566
|
});
|
|
567
|
-
},
|
|
567
|
+
}, po = /* @__PURE__ */ C({
|
|
568
568
|
name: `${a}-divider`,
|
|
569
569
|
setup() {
|
|
570
570
|
return () => l("div", {
|
|
571
571
|
class: `${a}-divider`
|
|
572
572
|
}, null);
|
|
573
573
|
}
|
|
574
|
-
}),
|
|
574
|
+
}), To = /* @__PURE__ */ C({
|
|
575
575
|
name: "ToolbarBold",
|
|
576
576
|
setup() {
|
|
577
577
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -580,7 +580,7 @@ $$`, "title")
|
|
|
580
580
|
title: t.value.toolbarTips?.bold,
|
|
581
581
|
disabled: o?.value,
|
|
582
582
|
onClick: () => {
|
|
583
|
-
|
|
583
|
+
g.emit(e, y, "bold");
|
|
584
584
|
},
|
|
585
585
|
type: "button"
|
|
586
586
|
}, [l($, {
|
|
@@ -589,7 +589,7 @@ $$`, "title")
|
|
|
589
589
|
class: `${a}-toolbar-item-name`
|
|
590
590
|
}, [t.value.toolbarTips?.bold])]);
|
|
591
591
|
}
|
|
592
|
-
}),
|
|
592
|
+
}), wo = /* @__PURE__ */ C({
|
|
593
593
|
name: "ToolbarCatalog",
|
|
594
594
|
setup() {
|
|
595
595
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = r("catalogVisible");
|
|
@@ -598,7 +598,7 @@ $$`, "title")
|
|
|
598
598
|
title: t.value.toolbarTips?.catalog,
|
|
599
599
|
disabled: o?.value,
|
|
600
600
|
onClick: () => {
|
|
601
|
-
|
|
601
|
+
g.emit(e, Ut);
|
|
602
602
|
},
|
|
603
603
|
key: "bar-catalog",
|
|
604
604
|
type: "button"
|
|
@@ -608,7 +608,7 @@ $$`, "title")
|
|
|
608
608
|
class: `${a}-toolbar-item-name`
|
|
609
609
|
}, [t.value.toolbarTips?.catalog])]);
|
|
610
610
|
}
|
|
611
|
-
}),
|
|
611
|
+
}), yo = /* @__PURE__ */ C({
|
|
612
612
|
name: "ToolbarCode",
|
|
613
613
|
setup() {
|
|
614
614
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -617,7 +617,7 @@ $$`, "title")
|
|
|
617
617
|
title: t.value.toolbarTips?.code,
|
|
618
618
|
disabled: o?.value,
|
|
619
619
|
onClick: () => {
|
|
620
|
-
|
|
620
|
+
g.emit(e, y, "code");
|
|
621
621
|
},
|
|
622
622
|
type: "button"
|
|
623
623
|
}, [l($, {
|
|
@@ -626,7 +626,7 @@ $$`, "title")
|
|
|
626
626
|
class: `${a}-toolbar-item-name`
|
|
627
627
|
}, [t.value.toolbarTips?.code])]);
|
|
628
628
|
}
|
|
629
|
-
}),
|
|
629
|
+
}), Co = /* @__PURE__ */ C({
|
|
630
630
|
name: "ToolbarCodeRow",
|
|
631
631
|
setup() {
|
|
632
632
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -635,7 +635,7 @@ $$`, "title")
|
|
|
635
635
|
title: t.value.toolbarTips?.codeRow,
|
|
636
636
|
disabled: o?.value,
|
|
637
637
|
onClick: () => {
|
|
638
|
-
|
|
638
|
+
g.emit(e, y, "codeRow");
|
|
639
639
|
},
|
|
640
640
|
type: "button"
|
|
641
641
|
}, [l($, {
|
|
@@ -644,12 +644,12 @@ $$`, "title")
|
|
|
644
644
|
class: `${a}-toolbar-item-name`
|
|
645
645
|
}, [t.value.toolbarTips?.codeRow])]);
|
|
646
646
|
}
|
|
647
|
-
}),
|
|
647
|
+
}), ko = /* @__PURE__ */ C({
|
|
648
648
|
name: "ToolbarFullscreen",
|
|
649
649
|
setup() {
|
|
650
650
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), {
|
|
651
651
|
fullscreenHandler: i
|
|
652
|
-
} =
|
|
652
|
+
} = tl();
|
|
653
653
|
return () => l("button", {
|
|
654
654
|
class: [`${a}-toolbar-item`, n.value.fullscreen && `${a}-toolbar-active`, t?.value && `${a}-disabled`],
|
|
655
655
|
title: e.value.toolbarTips?.fullscreen,
|
|
@@ -664,7 +664,7 @@ $$`, "title")
|
|
|
664
664
|
class: `${a}-toolbar-item-name`
|
|
665
665
|
}, [e.value.toolbarTips?.fullscreen])]);
|
|
666
666
|
}
|
|
667
|
-
}),
|
|
667
|
+
}), $o = /* @__PURE__ */ C({
|
|
668
668
|
name: "ToolbarGithub",
|
|
669
669
|
setup() {
|
|
670
670
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName");
|
|
@@ -673,7 +673,7 @@ $$`, "title")
|
|
|
673
673
|
title: e.value.toolbarTips?.github,
|
|
674
674
|
disabled: t?.value,
|
|
675
675
|
onClick: () => {
|
|
676
|
-
|
|
676
|
+
It("https://github.com/imzbf/md-editor-v3");
|
|
677
677
|
},
|
|
678
678
|
type: "button"
|
|
679
679
|
}, [l($, {
|
|
@@ -682,7 +682,7 @@ $$`, "title")
|
|
|
682
682
|
class: `${a}-toolbar-item-name`
|
|
683
683
|
}, [e.value.toolbarTips?.github])]);
|
|
684
684
|
}
|
|
685
|
-
}),
|
|
685
|
+
}), xo = /* @__PURE__ */ C({
|
|
686
686
|
name: "ToolbarHtmlPreview",
|
|
687
687
|
setup() {
|
|
688
688
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
|
|
@@ -700,7 +700,7 @@ $$`, "title")
|
|
|
700
700
|
class: `${a}-toolbar-item-name`
|
|
701
701
|
}, [e.value.toolbarTips?.htmlPreview])]);
|
|
702
702
|
}
|
|
703
|
-
}),
|
|
703
|
+
}), So = /* @__PURE__ */ C({
|
|
704
704
|
name: "ToolbarImage",
|
|
705
705
|
setup() {
|
|
706
706
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -709,7 +709,7 @@ $$`, "title")
|
|
|
709
709
|
title: t.value.toolbarTips?.image,
|
|
710
710
|
disabled: o?.value,
|
|
711
711
|
onClick: () => {
|
|
712
|
-
|
|
712
|
+
g.emit(e, y, "image");
|
|
713
713
|
},
|
|
714
714
|
type: "button"
|
|
715
715
|
}, [l($, {
|
|
@@ -718,7 +718,7 @@ $$`, "title")
|
|
|
718
718
|
class: `${a}-toolbar-item-name`
|
|
719
719
|
}, [t.value.toolbarTips?.image])]);
|
|
720
720
|
}
|
|
721
|
-
}),
|
|
721
|
+
}), Io = {
|
|
722
722
|
visible: {
|
|
723
723
|
type: Boolean,
|
|
724
724
|
default: !1
|
|
@@ -733,24 +733,24 @@ $$`, "title")
|
|
|
733
733
|
default: () => {
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
},
|
|
736
|
+
}, Eo = /* @__PURE__ */ C({
|
|
737
737
|
name: `${a}-modal-clip`,
|
|
738
|
-
props:
|
|
738
|
+
props: Io,
|
|
739
739
|
setup(e) {
|
|
740
740
|
const t = r("usedLanguageText"), o = r("editorId"), n = r("rootRef");
|
|
741
741
|
let i = G.editorExtensions.cropper.instance;
|
|
742
|
-
const s = x(), c = x(), u = x(), m =
|
|
742
|
+
const s = x(), c = x(), u = x(), m = U({
|
|
743
743
|
cropperInited: !1,
|
|
744
744
|
imgSelected: !1,
|
|
745
745
|
imgSrc: "",
|
|
746
746
|
// 是否全屏
|
|
747
747
|
isFullscreen: !1
|
|
748
748
|
});
|
|
749
|
-
let
|
|
750
|
-
|
|
749
|
+
let v = null;
|
|
750
|
+
E(() => e.visible, () => {
|
|
751
751
|
e.visible && !m.cropperInited && (i = i || window.Cropper, s.value.onchange = () => {
|
|
752
752
|
if (!i) {
|
|
753
|
-
|
|
753
|
+
g.emit(o, j, {
|
|
754
754
|
name: "Cropper",
|
|
755
755
|
message: "Cropper is undefined"
|
|
756
756
|
});
|
|
@@ -758,27 +758,27 @@ $$`, "title")
|
|
|
758
758
|
}
|
|
759
759
|
const h = s.value.files || [];
|
|
760
760
|
if (m.imgSelected = !0, h?.length > 0) {
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
m.imgSrc =
|
|
764
|
-
},
|
|
761
|
+
const f = new FileReader();
|
|
762
|
+
f.onload = (p) => {
|
|
763
|
+
m.imgSrc = p.target.result;
|
|
764
|
+
}, f.readAsDataURL(h[0]);
|
|
765
765
|
}
|
|
766
766
|
});
|
|
767
|
-
}),
|
|
767
|
+
}), E(() => [m.imgSelected], () => {
|
|
768
768
|
u.value.style = "";
|
|
769
|
-
}),
|
|
770
|
-
m.imgSrc &&
|
|
771
|
-
|
|
769
|
+
}), E([Ce(() => m.isFullscreen), Ce(() => m.imgSrc)], () => {
|
|
770
|
+
m.imgSrc && re(() => {
|
|
771
|
+
v?.destroy(), u.value.style = "", c.value && (v = new i(c.value, {
|
|
772
772
|
viewMode: 2,
|
|
773
773
|
preview: n.value.getRootNode().querySelector(`.${a}-clip-preview-target`)
|
|
774
774
|
// aspectRatio: 16 / 9,
|
|
775
775
|
}));
|
|
776
776
|
});
|
|
777
777
|
});
|
|
778
|
-
const
|
|
779
|
-
|
|
778
|
+
const b = () => {
|
|
779
|
+
v.clear(), v.destroy(), v = null, s.value.value = "", m.imgSelected = !1, m.imgSrc = "";
|
|
780
780
|
};
|
|
781
|
-
return () => l(
|
|
781
|
+
return () => l(Qt, {
|
|
782
782
|
class: `${a}-modal-clip`,
|
|
783
783
|
title: t.value.clipModalTips?.title,
|
|
784
784
|
visible: e.visible,
|
|
@@ -806,7 +806,7 @@ $$`, "title")
|
|
|
806
806
|
alt: ""
|
|
807
807
|
}, null), l("div", {
|
|
808
808
|
class: `${a}-clip-delete`,
|
|
809
|
-
onClick:
|
|
809
|
+
onClick: b
|
|
810
810
|
}, [l($, {
|
|
811
811
|
name: "delete"
|
|
812
812
|
}, null)])]) : l("div", {
|
|
@@ -830,9 +830,9 @@ $$`, "title")
|
|
|
830
830
|
class: `${a}-btn`,
|
|
831
831
|
type: "button",
|
|
832
832
|
onClick: () => {
|
|
833
|
-
if (
|
|
834
|
-
const h =
|
|
835
|
-
|
|
833
|
+
if (v) {
|
|
834
|
+
const h = v.getCroppedCanvas();
|
|
835
|
+
g.emit(o, fe, [eo(h.toDataURL("image/png"))], e.onOk), b();
|
|
836
836
|
}
|
|
837
837
|
}
|
|
838
838
|
}, [t.value.clipModalTips?.buttonUpload || t.value.linkModalTips?.buttonOK])]), l("input", {
|
|
@@ -862,27 +862,27 @@ $$`, "title")
|
|
|
862
862
|
default: () => {
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
|
-
},
|
|
865
|
+
}, No = /* @__PURE__ */ C({
|
|
866
866
|
name: `${a}-modals`,
|
|
867
867
|
props: Lo,
|
|
868
868
|
setup(e) {
|
|
869
|
-
return () => l(
|
|
869
|
+
return () => l(Eo, {
|
|
870
870
|
visible: e.clipVisible,
|
|
871
871
|
onOk: e.onOk,
|
|
872
872
|
onCancel: e.onCancel
|
|
873
873
|
}, null);
|
|
874
874
|
}
|
|
875
|
-
}),
|
|
875
|
+
}), Ao = /* @__PURE__ */ C({
|
|
876
876
|
name: "ToolbarImageDropdown",
|
|
877
877
|
setup() {
|
|
878
878
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = x(!1), c = x(!1), u = x(), m = () => {
|
|
879
|
-
|
|
880
|
-
},
|
|
881
|
-
o?.value ||
|
|
879
|
+
g.emit(e, fe, Array.from(u.value.files || [])), u.value.value = "";
|
|
880
|
+
}, v = (b, h) => {
|
|
881
|
+
o?.value || g.emit(e, y, b, h);
|
|
882
882
|
};
|
|
883
|
-
return
|
|
883
|
+
return _(() => {
|
|
884
884
|
u.value.addEventListener("change", m);
|
|
885
|
-
}), () => l(
|
|
885
|
+
}), () => l(_e, null, [l("label", {
|
|
886
886
|
for: `${i}_label`,
|
|
887
887
|
style: {
|
|
888
888
|
display: "none"
|
|
@@ -900,8 +900,8 @@ $$`, "title")
|
|
|
900
900
|
}, null), l(J, {
|
|
901
901
|
relative: `#${i}`,
|
|
902
902
|
visible: s.value,
|
|
903
|
-
onChange: (
|
|
904
|
-
s.value =
|
|
903
|
+
onChange: (b) => {
|
|
904
|
+
s.value = b;
|
|
905
905
|
},
|
|
906
906
|
disabled: o?.value,
|
|
907
907
|
overlay: l("ul", {
|
|
@@ -913,7 +913,7 @@ $$`, "title")
|
|
|
913
913
|
}, [l("li", {
|
|
914
914
|
class: `${a}-menu-item ${a}-menu-item-image`,
|
|
915
915
|
onClick: () => {
|
|
916
|
-
|
|
916
|
+
v("image");
|
|
917
917
|
},
|
|
918
918
|
role: "menuitem",
|
|
919
919
|
tabindex: "0"
|
|
@@ -943,21 +943,21 @@ $$`, "title")
|
|
|
943
943
|
}, null), n?.value && l("div", {
|
|
944
944
|
class: `${a}-toolbar-item-name`
|
|
945
945
|
}, [t.value.toolbarTips?.image])])]
|
|
946
|
-
}), l(
|
|
946
|
+
}), l(No, {
|
|
947
947
|
clipVisible: c.value,
|
|
948
948
|
onCancel: () => {
|
|
949
949
|
c.value = !1;
|
|
950
950
|
},
|
|
951
|
-
onOk: (
|
|
952
|
-
|
|
953
|
-
desc:
|
|
954
|
-
url:
|
|
951
|
+
onOk: (b) => {
|
|
952
|
+
b && v("image", {
|
|
953
|
+
desc: b.desc,
|
|
954
|
+
url: b.url,
|
|
955
955
|
transform: !0
|
|
956
956
|
}), c.value = !1;
|
|
957
957
|
}
|
|
958
958
|
}, null)]);
|
|
959
959
|
}
|
|
960
|
-
}),
|
|
960
|
+
}), Do = /* @__PURE__ */ C({
|
|
961
961
|
name: "ToolbarItalic",
|
|
962
962
|
setup() {
|
|
963
963
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -966,7 +966,7 @@ $$`, "title")
|
|
|
966
966
|
title: t.value.toolbarTips?.italic,
|
|
967
967
|
disabled: o?.value,
|
|
968
968
|
onClick: () => {
|
|
969
|
-
|
|
969
|
+
g.emit(e, y, "italic");
|
|
970
970
|
},
|
|
971
971
|
type: "button"
|
|
972
972
|
}, [l($, {
|
|
@@ -975,11 +975,11 @@ $$`, "title")
|
|
|
975
975
|
class: `${a}-toolbar-item-name`
|
|
976
976
|
}, [t.value.toolbarTips?.italic])]);
|
|
977
977
|
}
|
|
978
|
-
}),
|
|
978
|
+
}), Mo = /* @__PURE__ */ C({
|
|
979
979
|
name: "ToolbarKatex",
|
|
980
980
|
setup() {
|
|
981
981
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = x(!1), c = (u) => {
|
|
982
|
-
o?.value ||
|
|
982
|
+
o?.value || g.emit(e, y, u);
|
|
983
983
|
};
|
|
984
984
|
return () => l(J, {
|
|
985
985
|
relative: `#${i}`,
|
|
@@ -1023,7 +1023,7 @@ $$`, "title")
|
|
|
1023
1023
|
}, [t.value.toolbarTips?.katex])])]
|
|
1024
1024
|
});
|
|
1025
1025
|
}
|
|
1026
|
-
}),
|
|
1026
|
+
}), Ro = /* @__PURE__ */ C({
|
|
1027
1027
|
name: "ToolbarLink",
|
|
1028
1028
|
setup() {
|
|
1029
1029
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1032,7 +1032,7 @@ $$`, "title")
|
|
|
1032
1032
|
title: t.value.toolbarTips?.link,
|
|
1033
1033
|
disabled: o?.value,
|
|
1034
1034
|
onClick: () => {
|
|
1035
|
-
|
|
1035
|
+
g.emit(e, y, "link");
|
|
1036
1036
|
},
|
|
1037
1037
|
type: "button"
|
|
1038
1038
|
}, [l($, {
|
|
@@ -1041,11 +1041,11 @@ $$`, "title")
|
|
|
1041
1041
|
class: `${a}-toolbar-item-name`
|
|
1042
1042
|
}, [t.value.toolbarTips?.link])]);
|
|
1043
1043
|
}
|
|
1044
|
-
}),
|
|
1044
|
+
}), Fo = /* @__PURE__ */ C({
|
|
1045
1045
|
name: "ToolbarMermaid",
|
|
1046
1046
|
setup() {
|
|
1047
1047
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = x(!1), c = (u) => {
|
|
1048
|
-
o?.value ||
|
|
1048
|
+
o?.value || g.emit(e, y, u);
|
|
1049
1049
|
};
|
|
1050
1050
|
return () => l(J, {
|
|
1051
1051
|
relative: `#${i}`,
|
|
@@ -1131,7 +1131,7 @@ $$`, "title")
|
|
|
1131
1131
|
}, [t.value.toolbarTips?.mermaid])])]
|
|
1132
1132
|
});
|
|
1133
1133
|
}
|
|
1134
|
-
}),
|
|
1134
|
+
}), Bo = /* @__PURE__ */ C({
|
|
1135
1135
|
name: "ToolbarNext",
|
|
1136
1136
|
setup() {
|
|
1137
1137
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1140,7 +1140,7 @@ $$`, "title")
|
|
|
1140
1140
|
title: t.value.toolbarTips?.next,
|
|
1141
1141
|
disabled: o?.value,
|
|
1142
1142
|
onClick: () => {
|
|
1143
|
-
|
|
1143
|
+
g.emit(e, Ue);
|
|
1144
1144
|
},
|
|
1145
1145
|
type: "button"
|
|
1146
1146
|
}, [l($, {
|
|
@@ -1149,7 +1149,7 @@ $$`, "title")
|
|
|
1149
1149
|
class: `${a}-toolbar-item-name`
|
|
1150
1150
|
}, [t.value.toolbarTips?.next])]);
|
|
1151
1151
|
}
|
|
1152
|
-
}),
|
|
1152
|
+
}), Po = /* @__PURE__ */ C({
|
|
1153
1153
|
name: "ToolbarOrderedList",
|
|
1154
1154
|
setup() {
|
|
1155
1155
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1158,7 +1158,7 @@ $$`, "title")
|
|
|
1158
1158
|
title: t.value.toolbarTips?.orderedList,
|
|
1159
1159
|
disabled: o?.value,
|
|
1160
1160
|
onClick: () => {
|
|
1161
|
-
|
|
1161
|
+
g.emit(e, y, "orderedList");
|
|
1162
1162
|
},
|
|
1163
1163
|
type: "button"
|
|
1164
1164
|
}, [l($, {
|
|
@@ -1167,7 +1167,7 @@ $$`, "title")
|
|
|
1167
1167
|
class: `${a}-toolbar-item-name`
|
|
1168
1168
|
}, [t.value.toolbarTips?.orderedList])]);
|
|
1169
1169
|
}
|
|
1170
|
-
}), Ho = /* @__PURE__ */
|
|
1170
|
+
}), Ho = /* @__PURE__ */ C({
|
|
1171
1171
|
name: "ToolbarPageFullscreen",
|
|
1172
1172
|
setup() {
|
|
1173
1173
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
|
|
@@ -1185,7 +1185,7 @@ $$`, "title")
|
|
|
1185
1185
|
class: `${a}-toolbar-item-name`
|
|
1186
1186
|
}, [e.value.toolbarTips?.pageFullscreen])]);
|
|
1187
1187
|
}
|
|
1188
|
-
}),
|
|
1188
|
+
}), Oo = /* @__PURE__ */ C({
|
|
1189
1189
|
name: "ToolbarPrettier",
|
|
1190
1190
|
setup() {
|
|
1191
1191
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1194,7 +1194,7 @@ $$`, "title")
|
|
|
1194
1194
|
title: t.value.toolbarTips?.prettier,
|
|
1195
1195
|
disabled: o?.value,
|
|
1196
1196
|
onClick: () => {
|
|
1197
|
-
|
|
1197
|
+
g.emit(e, y, "prettier");
|
|
1198
1198
|
},
|
|
1199
1199
|
type: "button"
|
|
1200
1200
|
}, [l($, {
|
|
@@ -1203,7 +1203,7 @@ $$`, "title")
|
|
|
1203
1203
|
class: `${a}-toolbar-item-name`
|
|
1204
1204
|
}, [t.value.toolbarTips?.prettier])]);
|
|
1205
1205
|
}
|
|
1206
|
-
}),
|
|
1206
|
+
}), Vo = /* @__PURE__ */ C({
|
|
1207
1207
|
name: "ToolbarPreview",
|
|
1208
1208
|
setup() {
|
|
1209
1209
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
|
|
@@ -1221,7 +1221,7 @@ $$`, "title")
|
|
|
1221
1221
|
class: `${a}-toolbar-item-name`
|
|
1222
1222
|
}, [e.value.toolbarTips?.preview])]);
|
|
1223
1223
|
}
|
|
1224
|
-
}),
|
|
1224
|
+
}), Wo = /* @__PURE__ */ C({
|
|
1225
1225
|
name: "ToolbarPreviewOnly",
|
|
1226
1226
|
setup() {
|
|
1227
1227
|
const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
|
|
@@ -1239,7 +1239,7 @@ $$`, "title")
|
|
|
1239
1239
|
class: `${a}-toolbar-item-name`
|
|
1240
1240
|
}, [e.value.toolbarTips?.previewOnly])]);
|
|
1241
1241
|
}
|
|
1242
|
-
}),
|
|
1242
|
+
}), _o = /* @__PURE__ */ C({
|
|
1243
1243
|
name: "ToolbarQuote",
|
|
1244
1244
|
setup() {
|
|
1245
1245
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1248,7 +1248,7 @@ $$`, "title")
|
|
|
1248
1248
|
title: t.value.toolbarTips?.quote,
|
|
1249
1249
|
disabled: o?.value,
|
|
1250
1250
|
onClick: () => {
|
|
1251
|
-
|
|
1251
|
+
g.emit(e, y, "quote");
|
|
1252
1252
|
},
|
|
1253
1253
|
type: "button"
|
|
1254
1254
|
}, [l($, {
|
|
@@ -1257,7 +1257,7 @@ $$`, "title")
|
|
|
1257
1257
|
class: `${a}-toolbar-item-name`
|
|
1258
1258
|
}, [t.value.toolbarTips?.quote])]);
|
|
1259
1259
|
}
|
|
1260
|
-
}),
|
|
1260
|
+
}), zo = /* @__PURE__ */ C({
|
|
1261
1261
|
name: "ToolbarRevoke",
|
|
1262
1262
|
setup() {
|
|
1263
1263
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1266,7 +1266,7 @@ $$`, "title")
|
|
|
1266
1266
|
title: t.value.toolbarTips?.revoke,
|
|
1267
1267
|
disabled: o?.value,
|
|
1268
1268
|
onClick: () => {
|
|
1269
|
-
|
|
1269
|
+
g.emit(e, Ke);
|
|
1270
1270
|
},
|
|
1271
1271
|
type: "button"
|
|
1272
1272
|
}, [l($, {
|
|
@@ -1275,7 +1275,7 @@ $$`, "title")
|
|
|
1275
1275
|
class: `${a}-toolbar-item-name`
|
|
1276
1276
|
}, [t.value.toolbarTips?.revoke])]);
|
|
1277
1277
|
}
|
|
1278
|
-
}),
|
|
1278
|
+
}), qo = /* @__PURE__ */ C({
|
|
1279
1279
|
name: "ToolbarSave",
|
|
1280
1280
|
setup() {
|
|
1281
1281
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1284,7 +1284,7 @@ $$`, "title")
|
|
|
1284
1284
|
title: t.value.toolbarTips?.save,
|
|
1285
1285
|
disabled: o?.value,
|
|
1286
1286
|
onClick: () => {
|
|
1287
|
-
|
|
1287
|
+
g.emit(e, Ge);
|
|
1288
1288
|
},
|
|
1289
1289
|
type: "button"
|
|
1290
1290
|
}, [l($, {
|
|
@@ -1293,7 +1293,7 @@ $$`, "title")
|
|
|
1293
1293
|
class: `${a}-toolbar-item-name`
|
|
1294
1294
|
}, [t.value.toolbarTips?.save])]);
|
|
1295
1295
|
}
|
|
1296
|
-
}),
|
|
1296
|
+
}), Uo = /* @__PURE__ */ C({
|
|
1297
1297
|
name: "ToolbarStrikeThrough",
|
|
1298
1298
|
setup() {
|
|
1299
1299
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1302,7 +1302,7 @@ $$`, "title")
|
|
|
1302
1302
|
title: t.value.toolbarTips?.strikeThrough,
|
|
1303
1303
|
disabled: o?.value,
|
|
1304
1304
|
onClick: () => {
|
|
1305
|
-
|
|
1305
|
+
g.emit(e, y, "strikeThrough");
|
|
1306
1306
|
},
|
|
1307
1307
|
type: "button"
|
|
1308
1308
|
}, [l($, {
|
|
@@ -1311,7 +1311,7 @@ $$`, "title")
|
|
|
1311
1311
|
class: `${a}-toolbar-item-name`
|
|
1312
1312
|
}, [t.value.toolbarTips?.strikeThrough])]);
|
|
1313
1313
|
}
|
|
1314
|
-
}),
|
|
1314
|
+
}), Ko = /* @__PURE__ */ C({
|
|
1315
1315
|
name: "ToolbarSub",
|
|
1316
1316
|
setup() {
|
|
1317
1317
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1320,7 +1320,7 @@ $$`, "title")
|
|
|
1320
1320
|
title: t.value.toolbarTips?.sub,
|
|
1321
1321
|
disabled: o?.value,
|
|
1322
1322
|
onClick: () => {
|
|
1323
|
-
|
|
1323
|
+
g.emit(e, y, "sub");
|
|
1324
1324
|
},
|
|
1325
1325
|
type: "button"
|
|
1326
1326
|
}, [l($, {
|
|
@@ -1329,7 +1329,7 @@ $$`, "title")
|
|
|
1329
1329
|
class: `${a}-toolbar-item-name`
|
|
1330
1330
|
}, [t.value.toolbarTips?.sub])]);
|
|
1331
1331
|
}
|
|
1332
|
-
}),
|
|
1332
|
+
}), Go = /* @__PURE__ */ C({
|
|
1333
1333
|
name: "ToolbarSup",
|
|
1334
1334
|
setup() {
|
|
1335
1335
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1338,7 +1338,7 @@ $$`, "title")
|
|
|
1338
1338
|
title: t.value.toolbarTips?.sup,
|
|
1339
1339
|
disabled: o?.value,
|
|
1340
1340
|
onClick: () => {
|
|
1341
|
-
|
|
1341
|
+
g.emit(e, y, "sup");
|
|
1342
1342
|
},
|
|
1343
1343
|
type: "button"
|
|
1344
1344
|
}, [l($, {
|
|
@@ -1347,7 +1347,7 @@ $$`, "title")
|
|
|
1347
1347
|
class: `${a}-toolbar-item-name`
|
|
1348
1348
|
}, [t.value.toolbarTips?.sup])]);
|
|
1349
1349
|
}
|
|
1350
|
-
}),
|
|
1350
|
+
}), jo = {
|
|
1351
1351
|
tableShape: {
|
|
1352
1352
|
type: Array,
|
|
1353
1353
|
default: () => [6, 4]
|
|
@@ -1357,18 +1357,18 @@ $$`, "title")
|
|
|
1357
1357
|
default: () => {
|
|
1358
1358
|
}
|
|
1359
1359
|
}
|
|
1360
|
-
},
|
|
1360
|
+
}, Yo = /* @__PURE__ */ C({
|
|
1361
1361
|
name: "TableShape",
|
|
1362
|
-
props:
|
|
1362
|
+
props: jo,
|
|
1363
1363
|
setup(e) {
|
|
1364
|
-
const t =
|
|
1364
|
+
const t = U({
|
|
1365
1365
|
x: -1,
|
|
1366
1366
|
y: -1
|
|
1367
1367
|
}), o = K(() => JSON.stringify(e.tableShape)), n = () => {
|
|
1368
1368
|
const s = [...JSON.parse(o.value)];
|
|
1369
1369
|
return (!s[2] || s[2] < s[0]) && (s[2] = s[0]), (!s[3] || s[3] < s[3]) && (s[3] = s[1]), s;
|
|
1370
1370
|
}, i = x(n());
|
|
1371
|
-
return
|
|
1371
|
+
return E([o], () => {
|
|
1372
1372
|
i.value = n();
|
|
1373
1373
|
}), () => l("div", {
|
|
1374
1374
|
class: `${a}-table-shape`,
|
|
@@ -1391,7 +1391,7 @@ $$`, "title")
|
|
|
1391
1391
|
class: [`${a}-table-shape-col-default`, c <= t.x && m <= t.y && `${a}-table-shape-col-include`]
|
|
1392
1392
|
}, null)]))]))]);
|
|
1393
1393
|
}
|
|
1394
|
-
}),
|
|
1394
|
+
}), Zo = /* @__PURE__ */ C({
|
|
1395
1395
|
name: "ToolbarTable",
|
|
1396
1396
|
setup() {
|
|
1397
1397
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = r("tableShape"), s = `${e}-toolbar-wrapper`, c = x(!1);
|
|
@@ -1403,10 +1403,10 @@ $$`, "title")
|
|
|
1403
1403
|
},
|
|
1404
1404
|
disabled: o?.value,
|
|
1405
1405
|
key: "bar-table",
|
|
1406
|
-
overlay: l(
|
|
1406
|
+
overlay: l(Yo, {
|
|
1407
1407
|
tableShape: i.value,
|
|
1408
1408
|
onSelected: (u) => {
|
|
1409
|
-
o?.value ||
|
|
1409
|
+
o?.value || g.emit(e, y, "table", {
|
|
1410
1410
|
selectedShape: u
|
|
1411
1411
|
});
|
|
1412
1412
|
}
|
|
@@ -1424,7 +1424,7 @@ $$`, "title")
|
|
|
1424
1424
|
}, [t.value.toolbarTips?.table])])]
|
|
1425
1425
|
});
|
|
1426
1426
|
}
|
|
1427
|
-
}),
|
|
1427
|
+
}), Xo = /* @__PURE__ */ C({
|
|
1428
1428
|
name: "ToolbarTask",
|
|
1429
1429
|
setup() {
|
|
1430
1430
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1433,7 +1433,7 @@ $$`, "title")
|
|
|
1433
1433
|
title: t.value.toolbarTips?.task,
|
|
1434
1434
|
disabled: o?.value,
|
|
1435
1435
|
onClick: () => {
|
|
1436
|
-
|
|
1436
|
+
g.emit(e, y, "task");
|
|
1437
1437
|
},
|
|
1438
1438
|
type: "button"
|
|
1439
1439
|
}, [l($, {
|
|
@@ -1442,11 +1442,11 @@ $$`, "title")
|
|
|
1442
1442
|
class: `${a}-toolbar-item-name`
|
|
1443
1443
|
}, [t.value.toolbarTips?.task])]);
|
|
1444
1444
|
}
|
|
1445
|
-
}),
|
|
1445
|
+
}), Jo = /* @__PURE__ */ C({
|
|
1446
1446
|
name: "ToolbarTitle",
|
|
1447
1447
|
setup() {
|
|
1448
1448
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = x(!1), c = (u) => {
|
|
1449
|
-
o?.value ||
|
|
1449
|
+
o?.value || g.emit(e, y, u);
|
|
1450
1450
|
};
|
|
1451
1451
|
return () => l(J, {
|
|
1452
1452
|
relative: `#${i}`,
|
|
@@ -1517,7 +1517,7 @@ $$`, "title")
|
|
|
1517
1517
|
}, [t.value.toolbarTips?.title])])]
|
|
1518
1518
|
});
|
|
1519
1519
|
}
|
|
1520
|
-
}),
|
|
1520
|
+
}), Qo = /* @__PURE__ */ C({
|
|
1521
1521
|
name: "ToolbarUnderline",
|
|
1522
1522
|
setup() {
|
|
1523
1523
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1526,7 +1526,7 @@ $$`, "title")
|
|
|
1526
1526
|
title: t.value.toolbarTips?.underline,
|
|
1527
1527
|
disabled: o?.value,
|
|
1528
1528
|
onClick: () => {
|
|
1529
|
-
|
|
1529
|
+
g.emit(e, y, "underline");
|
|
1530
1530
|
},
|
|
1531
1531
|
type: "button"
|
|
1532
1532
|
}, [l($, {
|
|
@@ -1535,7 +1535,7 @@ $$`, "title")
|
|
|
1535
1535
|
class: `${a}-toolbar-item-name`
|
|
1536
1536
|
}, [t.value.toolbarTips?.underline])]);
|
|
1537
1537
|
}
|
|
1538
|
-
}),
|
|
1538
|
+
}), el = /* @__PURE__ */ C({
|
|
1539
1539
|
name: "ToolbarUnorderedList",
|
|
1540
1540
|
setup() {
|
|
1541
1541
|
const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
|
|
@@ -1544,7 +1544,7 @@ $$`, "title")
|
|
|
1544
1544
|
title: t.value.toolbarTips?.unorderedList,
|
|
1545
1545
|
disabled: o?.value,
|
|
1546
1546
|
onClick: () => {
|
|
1547
|
-
|
|
1547
|
+
g.emit(e, y, "unorderedList");
|
|
1548
1548
|
},
|
|
1549
1549
|
type: "button"
|
|
1550
1550
|
}, [l($, {
|
|
@@ -1553,201 +1553,201 @@ $$`, "title")
|
|
|
1553
1553
|
class: `${a}-toolbar-item-name`
|
|
1554
1554
|
}, [t.value.toolbarTips?.unorderedList])]);
|
|
1555
1555
|
}
|
|
1556
|
-
}),
|
|
1556
|
+
}), tl = () => {
|
|
1557
1557
|
const e = r("editorId"), t = r("setting"), o = r("updateSetting"), {
|
|
1558
1558
|
editorExtensions: n,
|
|
1559
1559
|
editorExtensionsAttrs: i
|
|
1560
1560
|
} = G;
|
|
1561
1561
|
let s = n.screenfull.instance;
|
|
1562
|
-
const c = x(!1), u = (
|
|
1562
|
+
const c = x(!1), u = (b) => {
|
|
1563
1563
|
if (!s) {
|
|
1564
|
-
|
|
1564
|
+
g.emit(e, j, {
|
|
1565
1565
|
name: "fullscreen",
|
|
1566
1566
|
message: "fullscreen is undefined"
|
|
1567
1567
|
});
|
|
1568
1568
|
return;
|
|
1569
1569
|
}
|
|
1570
|
-
s.isEnabled ? (c.value = !0, (
|
|
1570
|
+
s.isEnabled ? (c.value = !0, (b === void 0 ? !s.isFullscreen : b) ? s.request() : s.exit()) : console.error("browser does not support screenfull!");
|
|
1571
1571
|
}, m = () => {
|
|
1572
1572
|
s && s.isEnabled && s.on("change", () => {
|
|
1573
1573
|
(c.value || t.value.fullscreen) && (c.value = !1, o("fullscreen"));
|
|
1574
1574
|
});
|
|
1575
|
-
},
|
|
1575
|
+
}, v = () => {
|
|
1576
1576
|
s = window.screenfull, m();
|
|
1577
1577
|
};
|
|
1578
|
-
return
|
|
1579
|
-
m(), s ||
|
|
1578
|
+
return _(() => {
|
|
1579
|
+
m(), s || Jt("script", {
|
|
1580
1580
|
...i.screenfull?.js,
|
|
1581
1581
|
src: n.screenfull.js,
|
|
1582
|
-
id:
|
|
1583
|
-
onload:
|
|
1582
|
+
id: rt.screenfull,
|
|
1583
|
+
onload: v
|
|
1584
1584
|
}, "screenfull");
|
|
1585
|
-
}),
|
|
1586
|
-
|
|
1587
|
-
name:
|
|
1585
|
+
}), _(() => {
|
|
1586
|
+
g.on(e, {
|
|
1587
|
+
name: Kt,
|
|
1588
1588
|
callback: u
|
|
1589
1589
|
});
|
|
1590
1590
|
}), {
|
|
1591
1591
|
fullscreenHandler: u
|
|
1592
1592
|
};
|
|
1593
1593
|
};
|
|
1594
|
-
let
|
|
1595
|
-
const
|
|
1596
|
-
const e = r("editorId"), t = r("theme"), o = r("previewTheme"), n = r("language"), i = r("disabled"), s = r("noUploadImg"), c = r("noPrettier"), u = r("codeTheme"), m = r("showToolbarName"),
|
|
1594
|
+
let ol = 0;
|
|
1595
|
+
const Ze = () => {
|
|
1596
|
+
const e = r("editorId"), t = r("theme"), o = r("previewTheme"), n = r("language"), i = r("disabled"), s = r("noUploadImg"), c = r("noPrettier"), u = r("codeTheme"), m = r("showToolbarName"), v = r("setting"), b = r("defToolbars");
|
|
1597
1597
|
return {
|
|
1598
|
-
barRender: (
|
|
1599
|
-
if (
|
|
1600
|
-
switch (
|
|
1598
|
+
barRender: (f) => {
|
|
1599
|
+
if ($t.includes(f))
|
|
1600
|
+
switch (f) {
|
|
1601
1601
|
case "-":
|
|
1602
|
-
return l(
|
|
1603
|
-
key: `bar-${
|
|
1602
|
+
return l(po, {
|
|
1603
|
+
key: `bar-${ol++}`
|
|
1604
1604
|
}, null);
|
|
1605
1605
|
case "bold":
|
|
1606
|
-
return l(
|
|
1606
|
+
return l(To, {
|
|
1607
1607
|
key: "bar-bold"
|
|
1608
1608
|
}, null);
|
|
1609
1609
|
case "underline":
|
|
1610
|
-
return l(
|
|
1610
|
+
return l(Qo, {
|
|
1611
1611
|
key: "bar-unorderline"
|
|
1612
1612
|
}, null);
|
|
1613
1613
|
case "italic":
|
|
1614
|
-
return l(
|
|
1614
|
+
return l(Do, {
|
|
1615
1615
|
key: "bar-italic"
|
|
1616
1616
|
}, null);
|
|
1617
1617
|
case "strikeThrough":
|
|
1618
|
-
return l(
|
|
1618
|
+
return l(Uo, {
|
|
1619
1619
|
key: "bar-strikeThrough"
|
|
1620
1620
|
}, null);
|
|
1621
1621
|
case "title":
|
|
1622
|
-
return l(
|
|
1622
|
+
return l(Jo, {
|
|
1623
1623
|
key: "bar-title"
|
|
1624
1624
|
}, null);
|
|
1625
1625
|
case "sub":
|
|
1626
|
-
return l(
|
|
1626
|
+
return l(Ko, {
|
|
1627
1627
|
key: "bar-sub"
|
|
1628
1628
|
}, null);
|
|
1629
1629
|
case "sup":
|
|
1630
|
-
return l(
|
|
1630
|
+
return l(Go, {
|
|
1631
1631
|
key: "bar-sup"
|
|
1632
1632
|
}, null);
|
|
1633
1633
|
case "quote":
|
|
1634
|
-
return l(
|
|
1634
|
+
return l(_o, {
|
|
1635
1635
|
key: "bar-quote"
|
|
1636
1636
|
}, null);
|
|
1637
1637
|
case "unorderedList":
|
|
1638
|
-
return l(
|
|
1638
|
+
return l(el, {
|
|
1639
1639
|
key: "bar-unorderedList"
|
|
1640
1640
|
}, null);
|
|
1641
1641
|
case "orderedList":
|
|
1642
|
-
return l(
|
|
1642
|
+
return l(Po, {
|
|
1643
1643
|
key: "bar-orderedList"
|
|
1644
1644
|
}, null);
|
|
1645
1645
|
case "task":
|
|
1646
|
-
return l(
|
|
1646
|
+
return l(Xo, {
|
|
1647
1647
|
key: "bar-task"
|
|
1648
1648
|
}, null);
|
|
1649
1649
|
case "codeRow":
|
|
1650
|
-
return l(
|
|
1650
|
+
return l(Co, {
|
|
1651
1651
|
key: "bar-codeRow"
|
|
1652
1652
|
}, null);
|
|
1653
1653
|
case "code":
|
|
1654
|
-
return l(
|
|
1654
|
+
return l(yo, {
|
|
1655
1655
|
key: "bar-code"
|
|
1656
1656
|
}, null);
|
|
1657
1657
|
case "link":
|
|
1658
|
-
return l(
|
|
1658
|
+
return l(Ro, {
|
|
1659
1659
|
key: "bar-link"
|
|
1660
1660
|
}, null);
|
|
1661
1661
|
case "image":
|
|
1662
|
-
return s ? l(
|
|
1662
|
+
return s ? l(So, {
|
|
1663
1663
|
key: "bar-image"
|
|
1664
|
-
}, null) : l(
|
|
1664
|
+
}, null) : l(Ao, {
|
|
1665
1665
|
key: "bar-imageDropdown"
|
|
1666
1666
|
}, null);
|
|
1667
1667
|
case "table":
|
|
1668
|
-
return l(
|
|
1668
|
+
return l(Zo, {
|
|
1669
1669
|
key: "bar-table"
|
|
1670
1670
|
}, null);
|
|
1671
1671
|
case "revoke":
|
|
1672
|
-
return l(
|
|
1672
|
+
return l(zo, {
|
|
1673
1673
|
key: "bar-revoke"
|
|
1674
1674
|
}, null);
|
|
1675
1675
|
case "next":
|
|
1676
|
-
return l(
|
|
1676
|
+
return l(Bo, {
|
|
1677
1677
|
key: "bar-next"
|
|
1678
1678
|
}, null);
|
|
1679
1679
|
case "save":
|
|
1680
|
-
return l(
|
|
1680
|
+
return l(qo, {
|
|
1681
1681
|
key: "bar-save"
|
|
1682
1682
|
}, null);
|
|
1683
1683
|
case "prettier":
|
|
1684
|
-
return c && l(
|
|
1684
|
+
return !c && l(Oo, {
|
|
1685
1685
|
key: "bar-prettier"
|
|
1686
1686
|
}, null);
|
|
1687
1687
|
case "pageFullscreen":
|
|
1688
|
-
return !
|
|
1688
|
+
return !v.value.fullscreen && l(Ho, {
|
|
1689
1689
|
key: "bar-pageFullscreen"
|
|
1690
1690
|
}, null);
|
|
1691
1691
|
case "fullscreen":
|
|
1692
|
-
return l(
|
|
1692
|
+
return l(ko, {
|
|
1693
1693
|
key: "bar-fullscreen"
|
|
1694
1694
|
}, null);
|
|
1695
1695
|
case "catalog":
|
|
1696
|
-
return l(
|
|
1696
|
+
return l(wo, {
|
|
1697
1697
|
key: "bar-catalog"
|
|
1698
1698
|
}, null);
|
|
1699
1699
|
case "preview":
|
|
1700
|
-
return l(
|
|
1700
|
+
return l(Vo, {
|
|
1701
1701
|
key: "bar-preview"
|
|
1702
1702
|
}, null);
|
|
1703
1703
|
case "previewOnly":
|
|
1704
|
-
return l(
|
|
1704
|
+
return l(Wo, {
|
|
1705
1705
|
key: "bar-previewOnly"
|
|
1706
1706
|
}, null);
|
|
1707
1707
|
case "htmlPreview":
|
|
1708
|
-
return l(
|
|
1708
|
+
return l(xo, {
|
|
1709
1709
|
key: "bar-htmlPreview"
|
|
1710
1710
|
}, null);
|
|
1711
1711
|
case "github":
|
|
1712
|
-
return l(
|
|
1712
|
+
return l($o, {
|
|
1713
1713
|
key: "bar-github"
|
|
1714
1714
|
}, null);
|
|
1715
1715
|
case "mermaid":
|
|
1716
|
-
return l(
|
|
1716
|
+
return l(Fo, {
|
|
1717
1717
|
key: "bar-mermaid"
|
|
1718
1718
|
}, null);
|
|
1719
1719
|
case "katex":
|
|
1720
|
-
return l(
|
|
1720
|
+
return l(Mo, {
|
|
1721
1721
|
key: "bar-katex"
|
|
1722
1722
|
}, null);
|
|
1723
1723
|
}
|
|
1724
|
-
else if (
|
|
1725
|
-
const
|
|
1726
|
-
return
|
|
1727
|
-
theme:
|
|
1728
|
-
previewTheme:
|
|
1729
|
-
language:
|
|
1730
|
-
codeTheme:
|
|
1731
|
-
disabled:
|
|
1732
|
-
showToolbarName:
|
|
1733
|
-
insert(
|
|
1734
|
-
|
|
1735
|
-
generate:
|
|
1724
|
+
else if (b.value instanceof Array) {
|
|
1725
|
+
const p = b.value[f];
|
|
1726
|
+
return p ? ae(p, {
|
|
1727
|
+
theme: p.props?.theme || t.value,
|
|
1728
|
+
previewTheme: p.props?.theme || o.value,
|
|
1729
|
+
language: p.props?.theme || n.value,
|
|
1730
|
+
codeTheme: p.props?.codeTheme || u.value,
|
|
1731
|
+
disabled: p.props?.disabled || i.value,
|
|
1732
|
+
showToolbarName: p.props?.showToolbarName || m.value,
|
|
1733
|
+
insert(I) {
|
|
1734
|
+
g.emit(e, y, "universal", {
|
|
1735
|
+
generate: I
|
|
1736
1736
|
});
|
|
1737
1737
|
}
|
|
1738
1738
|
}) : "";
|
|
1739
|
-
} else if (
|
|
1740
|
-
const
|
|
1741
|
-
return
|
|
1742
|
-
theme:
|
|
1743
|
-
previewTheme:
|
|
1744
|
-
language:
|
|
1745
|
-
codeTheme:
|
|
1746
|
-
disabled:
|
|
1747
|
-
showToolbarName:
|
|
1748
|
-
insert(
|
|
1749
|
-
|
|
1750
|
-
generate:
|
|
1739
|
+
} else if (b.value?.children instanceof Array) {
|
|
1740
|
+
const p = b.value.children[f];
|
|
1741
|
+
return p ? ae(p, {
|
|
1742
|
+
theme: p.props?.theme || t.value,
|
|
1743
|
+
previewTheme: p.props?.theme || o.value,
|
|
1744
|
+
language: p.props?.theme || n.value,
|
|
1745
|
+
codeTheme: p.props?.codeTheme || u.value,
|
|
1746
|
+
disabled: p.props?.disabled || i.value,
|
|
1747
|
+
showToolbarName: p.props?.showToolbarName || m.value,
|
|
1748
|
+
insert(I) {
|
|
1749
|
+
g.emit(e, y, "universal", {
|
|
1750
|
+
generate: I
|
|
1751
1751
|
});
|
|
1752
1752
|
}
|
|
1753
1753
|
}) : "";
|
|
@@ -1755,36 +1755,36 @@ const Ye = () => {
|
|
|
1755
1755
|
return "";
|
|
1756
1756
|
}
|
|
1757
1757
|
};
|
|
1758
|
-
},
|
|
1758
|
+
}, ll = /* @__PURE__ */ C({
|
|
1759
1759
|
name: "FloatingToolbar",
|
|
1760
1760
|
setup() {
|
|
1761
1761
|
const e = r("floatingToolbars"), {
|
|
1762
1762
|
barRender: t
|
|
1763
|
-
} =
|
|
1763
|
+
} = Ze();
|
|
1764
1764
|
return () => l("div", {
|
|
1765
1765
|
class: `${a}-floating-toolbar`
|
|
1766
1766
|
}, [e.value.map((o) => t(o))]);
|
|
1767
1767
|
}
|
|
1768
|
-
}),
|
|
1768
|
+
}), ve = ne.define(), al = qe.define({
|
|
1769
1769
|
create() {
|
|
1770
1770
|
return null;
|
|
1771
1771
|
},
|
|
1772
1772
|
update(e, t) {
|
|
1773
|
-
for (const o of t.effects) o.is(
|
|
1773
|
+
for (const o of t.effects) o.is(ve) && (e = o.value);
|
|
1774
1774
|
return e;
|
|
1775
1775
|
},
|
|
1776
|
-
provide: (e) =>
|
|
1777
|
-
}),
|
|
1776
|
+
provide: (e) => Vt.from(e)
|
|
1777
|
+
}), nl = (e) => {
|
|
1778
1778
|
const t = (n, i) => {
|
|
1779
1779
|
n.dispatch({
|
|
1780
|
-
effects:
|
|
1780
|
+
effects: ve.of({
|
|
1781
1781
|
pos: i,
|
|
1782
1782
|
above: !0,
|
|
1783
1783
|
arrow: !0,
|
|
1784
1784
|
create: () => {
|
|
1785
1785
|
const s = document.createElement("div"), c = document.createElement("div");
|
|
1786
1786
|
s.appendChild(c);
|
|
1787
|
-
const u =
|
|
1787
|
+
const u = Ct(ll);
|
|
1788
1788
|
return e.privide(u), u.mount(s), { dom: s, destroy: () => u.unmount() };
|
|
1789
1789
|
}
|
|
1790
1790
|
})
|
|
@@ -1796,23 +1796,23 @@ const Ye = () => {
|
|
|
1796
1796
|
t(n.view, s.from);
|
|
1797
1797
|
else {
|
|
1798
1798
|
const c = s.head, u = i.doc.lineAt(c);
|
|
1799
|
-
/^\s*$/.test(u.text) ? t(n.view, c) : n.view.dispatch({ effects:
|
|
1799
|
+
/^\s*$/.test(u.text) ? t(n.view, c) : n.view.dispatch({ effects: ve.of(null) });
|
|
1800
1800
|
}
|
|
1801
1801
|
}
|
|
1802
1802
|
});
|
|
1803
|
-
return [
|
|
1804
|
-
},
|
|
1803
|
+
return [al, o];
|
|
1804
|
+
}, rl = "#e5c07b", Ee = "var(--md-color)", sl = "#56b6c2", il = "#fff", Z = "#3f4a54", Le = "#2d8cf0", cl = "#2d8cf0", ul = "#3f4a54", Ne = "#d19a66", dl = "#c678dd", ml = "#f6f6f6", bl = "#ceedfa33", Ae = "var(--md-bk-color)", ue = "var(--md-bk-color)", vl = "#bad5fa", De = "#3f4a54", gl = R.theme(
|
|
1805
1805
|
{
|
|
1806
1806
|
"&": {
|
|
1807
1807
|
color: Z,
|
|
1808
|
-
backgroundColor:
|
|
1808
|
+
backgroundColor: Ae
|
|
1809
1809
|
},
|
|
1810
1810
|
".cm-content": {
|
|
1811
|
-
caretColor:
|
|
1811
|
+
caretColor: De
|
|
1812
1812
|
},
|
|
1813
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor:
|
|
1814
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1815
|
-
".cm-panels": { backgroundColor:
|
|
1813
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: De },
|
|
1814
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: vl },
|
|
1815
|
+
".cm-panels": { backgroundColor: ml, color: Z },
|
|
1816
1816
|
".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
|
|
1817
1817
|
".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
|
|
1818
1818
|
".cm-searchMatch": {
|
|
@@ -1828,13 +1828,13 @@ const Ye = () => {
|
|
|
1828
1828
|
backgroundColor: "#bad0f847"
|
|
1829
1829
|
},
|
|
1830
1830
|
".cm-gutters": {
|
|
1831
|
-
backgroundColor:
|
|
1831
|
+
backgroundColor: Ae,
|
|
1832
1832
|
color: Z,
|
|
1833
1833
|
borderRight: "1px solid",
|
|
1834
1834
|
borderColor: "var(--md-border-color)"
|
|
1835
1835
|
},
|
|
1836
1836
|
".cm-activeLineGutter": {
|
|
1837
|
-
backgroundColor:
|
|
1837
|
+
backgroundColor: bl
|
|
1838
1838
|
},
|
|
1839
1839
|
".cm-foldPlaceholder": {
|
|
1840
1840
|
backgroundColor: "transparent",
|
|
@@ -1843,7 +1843,7 @@ const Ye = () => {
|
|
|
1843
1843
|
},
|
|
1844
1844
|
".cm-tooltip": {
|
|
1845
1845
|
border: "1px solid var(--md-border-color)",
|
|
1846
|
-
backgroundColor:
|
|
1846
|
+
backgroundColor: ue
|
|
1847
1847
|
},
|
|
1848
1848
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1849
1849
|
borderTopColor: "var(--md-border-color)",
|
|
@@ -1851,8 +1851,8 @@ const Ye = () => {
|
|
|
1851
1851
|
borderBottomColor: "var(--md-border-color)"
|
|
1852
1852
|
},
|
|
1853
1853
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1854
|
-
borderTopColor:
|
|
1855
|
-
borderBottomColor:
|
|
1854
|
+
borderTopColor: ue,
|
|
1855
|
+
borderBottomColor: ue
|
|
1856
1856
|
},
|
|
1857
1857
|
".cm-tooltip-autocomplete": {
|
|
1858
1858
|
"& > ul > li[aria-selected]": {
|
|
@@ -1861,11 +1861,11 @@ const Ye = () => {
|
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
1863
|
// { dark: true }
|
|
1864
|
-
),
|
|
1865
|
-
{ tag: d.keyword, color:
|
|
1866
|
-
{ tag: [d.name, d.deleted, d.character, d.propertyName, d.macroName], color:
|
|
1867
|
-
{ tag: [d.function(d.variableName), d.labelName], color:
|
|
1868
|
-
{ tag: [d.color, d.constant(d.name), d.standard(d.name)], color:
|
|
1864
|
+
), fl = Ye.define([
|
|
1865
|
+
{ tag: d.keyword, color: dl },
|
|
1866
|
+
{ tag: [d.name, d.deleted, d.character, d.propertyName, d.macroName], color: Ee },
|
|
1867
|
+
{ tag: [d.function(d.variableName), d.labelName], color: cl },
|
|
1868
|
+
{ tag: [d.color, d.constant(d.name), d.standard(d.name)], color: Ne },
|
|
1869
1869
|
{ tag: [d.definition(d.name), d.separator], color: Z },
|
|
1870
1870
|
{
|
|
1871
1871
|
tag: [
|
|
@@ -1878,7 +1878,7 @@ const Ye = () => {
|
|
|
1878
1878
|
d.self,
|
|
1879
1879
|
d.namespace
|
|
1880
1880
|
],
|
|
1881
|
-
color:
|
|
1881
|
+
color: rl
|
|
1882
1882
|
},
|
|
1883
1883
|
{
|
|
1884
1884
|
tag: [
|
|
@@ -1890,32 +1890,32 @@ const Ye = () => {
|
|
|
1890
1890
|
d.link,
|
|
1891
1891
|
d.special(d.string)
|
|
1892
1892
|
],
|
|
1893
|
-
color:
|
|
1893
|
+
color: sl
|
|
1894
1894
|
},
|
|
1895
1895
|
{ tag: [d.meta, d.comment], color: Le },
|
|
1896
1896
|
{ tag: d.strong, fontWeight: "bold" },
|
|
1897
1897
|
{ tag: d.emphasis, fontStyle: "italic" },
|
|
1898
1898
|
{ tag: d.strikethrough, textDecoration: "line-through" },
|
|
1899
1899
|
{ tag: d.link, color: Le, textDecoration: "underline" },
|
|
1900
|
-
{ tag: d.heading, fontWeight: "bold", color:
|
|
1901
|
-
{ tag: [d.atom, d.bool, d.special(d.variableName)], color:
|
|
1902
|
-
{ tag: [d.processingInstruction, d.string, d.inserted], color:
|
|
1903
|
-
{ tag: d.invalid, color:
|
|
1904
|
-
]),
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
], hl = "#e5c07b",
|
|
1900
|
+
{ tag: d.heading, fontWeight: "bold", color: Ee },
|
|
1901
|
+
{ tag: [d.atom, d.bool, d.special(d.variableName)], color: Ne },
|
|
1902
|
+
{ tag: [d.processingInstruction, d.string, d.inserted], color: ul },
|
|
1903
|
+
{ tag: d.invalid, color: il }
|
|
1904
|
+
]), Me = [
|
|
1905
|
+
gl,
|
|
1906
|
+
je(fl)
|
|
1907
|
+
], hl = "#e5c07b", Re = "var(--md-color)", pl = "#56b6c2", Tl = "#ffffff", X = "var(--md-color)", Fe = "#e5c07b", wl = "#e5c07b", yl = "var(--md-color)", Be = "#d19a66", Cl = "#c678dd", kl = "#21252b", $l = "#2c313a", Pe = "var(--md-bk-color)", de = "var(--md-bk-color)", xl = "#ceedfa33", He = "#528bff", Sl = R.theme(
|
|
1908
1908
|
{
|
|
1909
1909
|
"&": {
|
|
1910
1910
|
color: X,
|
|
1911
|
-
backgroundColor:
|
|
1911
|
+
backgroundColor: Pe
|
|
1912
1912
|
},
|
|
1913
1913
|
".cm-content": {
|
|
1914
1914
|
caretColor: He
|
|
1915
1915
|
},
|
|
1916
1916
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: He },
|
|
1917
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1918
|
-
".cm-panels": { backgroundColor:
|
|
1917
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: xl },
|
|
1918
|
+
".cm-panels": { backgroundColor: kl, color: X },
|
|
1919
1919
|
".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
|
|
1920
1920
|
".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
|
|
1921
1921
|
".cm-searchMatch": {
|
|
@@ -1931,13 +1931,13 @@ const Ye = () => {
|
|
|
1931
1931
|
backgroundColor: "#bad0f847"
|
|
1932
1932
|
},
|
|
1933
1933
|
".cm-gutters": {
|
|
1934
|
-
backgroundColor:
|
|
1934
|
+
backgroundColor: Pe,
|
|
1935
1935
|
color: X,
|
|
1936
1936
|
borderRight: "1px solid",
|
|
1937
1937
|
borderColor: "var(--md-border-color)"
|
|
1938
1938
|
},
|
|
1939
1939
|
".cm-activeLineGutter": {
|
|
1940
|
-
backgroundColor:
|
|
1940
|
+
backgroundColor: $l
|
|
1941
1941
|
},
|
|
1942
1942
|
".cm-foldPlaceholder": {
|
|
1943
1943
|
backgroundColor: "transparent",
|
|
@@ -1946,7 +1946,7 @@ const Ye = () => {
|
|
|
1946
1946
|
},
|
|
1947
1947
|
".cm-tooltip": {
|
|
1948
1948
|
border: "1px solid var(--md-border-color)",
|
|
1949
|
-
backgroundColor:
|
|
1949
|
+
backgroundColor: de
|
|
1950
1950
|
},
|
|
1951
1951
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1952
1952
|
borderTopColor: "var(--md-border-color)",
|
|
@@ -1954,8 +1954,8 @@ const Ye = () => {
|
|
|
1954
1954
|
borderBottomColor: "var(--md-border-color)"
|
|
1955
1955
|
},
|
|
1956
1956
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1957
|
-
borderTopColor:
|
|
1958
|
-
borderBottomColor:
|
|
1957
|
+
borderTopColor: de,
|
|
1958
|
+
borderBottomColor: de
|
|
1959
1959
|
},
|
|
1960
1960
|
".cm-tooltip-autocomplete": {
|
|
1961
1961
|
"& > ul > li[aria-selected]": {
|
|
@@ -1964,11 +1964,11 @@ const Ye = () => {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
},
|
|
1966
1966
|
{ dark: !0 }
|
|
1967
|
-
),
|
|
1968
|
-
{ tag: d.keyword, color:
|
|
1969
|
-
{ tag: [d.name, d.deleted, d.character, d.propertyName, d.macroName], color:
|
|
1970
|
-
{ tag: [d.function(d.variableName), d.labelName], color:
|
|
1971
|
-
{ tag: [d.color, d.constant(d.name), d.standard(d.name)], color:
|
|
1967
|
+
), Il = Ye.define([
|
|
1968
|
+
{ tag: d.keyword, color: Cl },
|
|
1969
|
+
{ tag: [d.name, d.deleted, d.character, d.propertyName, d.macroName], color: Re },
|
|
1970
|
+
{ tag: [d.function(d.variableName), d.labelName], color: wl },
|
|
1971
|
+
{ tag: [d.color, d.constant(d.name), d.standard(d.name)], color: Be },
|
|
1972
1972
|
{ tag: [d.definition(d.name), d.separator], color: X },
|
|
1973
1973
|
{
|
|
1974
1974
|
tag: [
|
|
@@ -1993,24 +1993,24 @@ const Ye = () => {
|
|
|
1993
1993
|
d.link,
|
|
1994
1994
|
d.special(d.string)
|
|
1995
1995
|
],
|
|
1996
|
-
color:
|
|
1996
|
+
color: pl
|
|
1997
1997
|
},
|
|
1998
|
-
{ tag: [d.meta, d.comment], color:
|
|
1998
|
+
{ tag: [d.meta, d.comment], color: Fe },
|
|
1999
1999
|
{ tag: d.strong, fontWeight: "bold" },
|
|
2000
2000
|
{ tag: d.emphasis, fontStyle: "italic" },
|
|
2001
2001
|
{ tag: d.strikethrough, textDecoration: "line-through" },
|
|
2002
|
-
{ tag: d.link, color:
|
|
2003
|
-
{ tag: d.heading, fontWeight: "bold", color:
|
|
2004
|
-
{ tag: [d.atom, d.bool, d.special(d.variableName)], color:
|
|
2005
|
-
{ tag: [d.processingInstruction, d.string, d.inserted], color:
|
|
2006
|
-
{ tag: d.invalid, color:
|
|
2007
|
-
]),
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
],
|
|
2002
|
+
{ tag: d.link, color: Fe, textDecoration: "underline" },
|
|
2003
|
+
{ tag: d.heading, fontWeight: "bold", color: Re },
|
|
2004
|
+
{ tag: [d.atom, d.bool, d.special(d.variableName)], color: Be },
|
|
2005
|
+
{ tag: [d.processingInstruction, d.string, d.inserted], color: yl },
|
|
2006
|
+
{ tag: d.invalid, color: Tl }
|
|
2007
|
+
]), Oe = [
|
|
2008
|
+
Sl,
|
|
2009
|
+
je(Il)
|
|
2010
|
+
], El = (e, t) => {
|
|
2011
2011
|
const o = r("editorId"), n = (s) => {
|
|
2012
2012
|
s instanceof Promise ? s.then((c) => {
|
|
2013
|
-
|
|
2013
|
+
g.emit(o, y, "universal", {
|
|
2014
2014
|
generate() {
|
|
2015
2015
|
return {
|
|
2016
2016
|
targetValue: c
|
|
@@ -2019,7 +2019,7 @@ const Ye = () => {
|
|
|
2019
2019
|
});
|
|
2020
2020
|
}).catch((c) => {
|
|
2021
2021
|
console.error(c);
|
|
2022
|
-
}) :
|
|
2022
|
+
}) : g.emit(o, y, "universal", {
|
|
2023
2023
|
generate() {
|
|
2024
2024
|
return {
|
|
2025
2025
|
targetValue: s
|
|
@@ -2031,41 +2031,41 @@ const Ye = () => {
|
|
|
2031
2031
|
if (!s.clipboardData)
|
|
2032
2032
|
return;
|
|
2033
2033
|
if (s.clipboardData.files.length > 0) {
|
|
2034
|
-
const { files:
|
|
2035
|
-
|
|
2034
|
+
const { files: f } = s.clipboardData;
|
|
2035
|
+
g.emit(
|
|
2036
2036
|
o,
|
|
2037
|
-
|
|
2038
|
-
Array.from(
|
|
2037
|
+
fe,
|
|
2038
|
+
Array.from(f).filter((p) => /image\/.*/.test(p.type))
|
|
2039
2039
|
), s.preventDefault();
|
|
2040
2040
|
return;
|
|
2041
2041
|
}
|
|
2042
|
-
const c = s.clipboardData.getData("text/plain"), u = t.value?.view.state.selection.main.to || 0, m = t.value?.view.state.doc.lineAt(u).from || 0,
|
|
2043
|
-
if (
|
|
2044
|
-
const
|
|
2045
|
-
n(
|
|
2042
|
+
const c = s.clipboardData.getData("text/plain"), u = t.value?.view.state.selection.main.to || 0, m = t.value?.view.state.doc.lineAt(u).from || 0, v = t.value?.view.state.doc.sliceString(m, u) || "", b = /!\[.*\]\(\s*$/.test(v), h = /!\[.*\]\((.*)\s?.*\)/.test(c);
|
|
2043
|
+
if (b) {
|
|
2044
|
+
const f = e.transformImgUrl(c);
|
|
2045
|
+
n(f), s.preventDefault();
|
|
2046
2046
|
return;
|
|
2047
2047
|
} else if (h) {
|
|
2048
|
-
const
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
).then((
|
|
2048
|
+
const f = c.match(new RegExp(`(?<=!\\[.*\\]\\()([^)\\s]+)(?=\\s?["']?.*["']?\\))`, "g"));
|
|
2049
|
+
f ? Promise.all(
|
|
2050
|
+
f.map((p) => e.transformImgUrl(p))
|
|
2051
|
+
).then((p) => {
|
|
2052
2052
|
n(
|
|
2053
|
-
|
|
2053
|
+
p.reduce((T, I, A) => T.replace(f[A], I), c)
|
|
2054
2054
|
);
|
|
2055
|
-
}).catch((
|
|
2056
|
-
console.error(
|
|
2055
|
+
}).catch((p) => {
|
|
2056
|
+
console.error(p);
|
|
2057
2057
|
}) : n(c), s.preventDefault();
|
|
2058
2058
|
return;
|
|
2059
2059
|
}
|
|
2060
2060
|
if (e.autoDetectCode && s.clipboardData.types.includes("vscode-editor-data")) {
|
|
2061
|
-
const
|
|
2062
|
-
|
|
2063
|
-
mode:
|
|
2061
|
+
const f = JSON.parse(s.clipboardData.getData("vscode-editor-data"));
|
|
2062
|
+
g.emit(o, y, "code", {
|
|
2063
|
+
mode: f.mode,
|
|
2064
2064
|
text: s.clipboardData.getData("text/plain")
|
|
2065
2065
|
}), s.preventDefault();
|
|
2066
2066
|
return;
|
|
2067
2067
|
}
|
|
2068
|
-
e.maxlength && c.length + e.modelValue.length > e.maxlength &&
|
|
2068
|
+
e.maxlength && c.length + e.modelValue.length > e.maxlength && g.emit(o, j, {
|
|
2069
2069
|
name: "overlength",
|
|
2070
2070
|
message: "The input text is too long",
|
|
2071
2071
|
data: c
|
|
@@ -2075,192 +2075,234 @@ const Ye = () => {
|
|
|
2075
2075
|
{
|
|
2076
2076
|
key: "Ctrl-b",
|
|
2077
2077
|
mac: "Cmd-b",
|
|
2078
|
-
run: () => (
|
|
2078
|
+
run: () => (g.emit(e, y, "bold"), !0)
|
|
2079
2079
|
},
|
|
2080
2080
|
{
|
|
2081
2081
|
key: "Ctrl-d",
|
|
2082
2082
|
mac: "Cmd-d",
|
|
2083
|
-
run:
|
|
2083
|
+
run: Nt,
|
|
2084
2084
|
preventDefault: !0
|
|
2085
2085
|
},
|
|
2086
2086
|
{
|
|
2087
2087
|
key: "Ctrl-s",
|
|
2088
2088
|
mac: "Cmd-s",
|
|
2089
|
-
run: (
|
|
2090
|
-
shift: () => (
|
|
2089
|
+
run: (M) => (g.emit(e, Ge, M.state.doc.toString()), !0),
|
|
2090
|
+
shift: () => (g.emit(e, y, "strikeThrough"), !0)
|
|
2091
2091
|
},
|
|
2092
2092
|
{
|
|
2093
2093
|
key: "Ctrl-u",
|
|
2094
2094
|
mac: "Cmd-u",
|
|
2095
2095
|
preventDefault: !0,
|
|
2096
|
-
run: () => (
|
|
2097
|
-
shift: () => (
|
|
2096
|
+
run: () => (g.emit(e, y, "underline"), !0),
|
|
2097
|
+
shift: () => (g.emit(e, y, "unorderedList"), !0)
|
|
2098
2098
|
},
|
|
2099
2099
|
{
|
|
2100
2100
|
key: "Ctrl-i",
|
|
2101
2101
|
mac: "Cmd-i",
|
|
2102
2102
|
preventDefault: !0,
|
|
2103
|
-
run: () => (
|
|
2104
|
-
shift: () => (
|
|
2103
|
+
run: () => (g.emit(e, y, "italic"), !0),
|
|
2104
|
+
shift: () => (g.emit(e, y, "image"), !0)
|
|
2105
2105
|
},
|
|
2106
2106
|
{
|
|
2107
2107
|
key: "Ctrl-1",
|
|
2108
2108
|
mac: "Cmd-1",
|
|
2109
|
-
run: () => (
|
|
2109
|
+
run: () => (g.emit(e, y, "h1"), !0)
|
|
2110
2110
|
},
|
|
2111
2111
|
{
|
|
2112
2112
|
key: "Ctrl-2",
|
|
2113
2113
|
mac: "Cmd-2",
|
|
2114
|
-
run: () => (
|
|
2114
|
+
run: () => (g.emit(e, y, "h2"), !0)
|
|
2115
2115
|
},
|
|
2116
2116
|
{
|
|
2117
2117
|
key: "Ctrl-3",
|
|
2118
2118
|
mac: "Cmd-3",
|
|
2119
|
-
run: () => (
|
|
2119
|
+
run: () => (g.emit(e, y, "h3"), !0)
|
|
2120
2120
|
},
|
|
2121
2121
|
{
|
|
2122
2122
|
key: "Ctrl-4",
|
|
2123
2123
|
mac: "Cmd-4",
|
|
2124
|
-
run: () => (
|
|
2124
|
+
run: () => (g.emit(e, y, "h4"), !0)
|
|
2125
2125
|
},
|
|
2126
2126
|
{
|
|
2127
2127
|
key: "Ctrl-5",
|
|
2128
2128
|
mac: "Cmd-5",
|
|
2129
|
-
run: () => (
|
|
2129
|
+
run: () => (g.emit(e, y, "h5"), !0)
|
|
2130
2130
|
},
|
|
2131
2131
|
{
|
|
2132
2132
|
key: "Ctrl-6",
|
|
2133
2133
|
mac: "Cmd-6",
|
|
2134
|
-
run: () => (
|
|
2134
|
+
run: () => (g.emit(e, y, "h6"), !0)
|
|
2135
2135
|
},
|
|
2136
2136
|
{
|
|
2137
2137
|
key: "Ctrl-ArrowUp",
|
|
2138
2138
|
mac: "Cmd-ArrowUp",
|
|
2139
|
-
run: () => (
|
|
2139
|
+
run: () => (g.emit(e, y, "sup"), !0)
|
|
2140
2140
|
},
|
|
2141
2141
|
{
|
|
2142
2142
|
key: "Ctrl-ArrowDown",
|
|
2143
2143
|
mac: "Cmd-ArrowDown",
|
|
2144
|
-
run: () => (
|
|
2144
|
+
run: () => (g.emit(e, y, "sub"), !0)
|
|
2145
2145
|
},
|
|
2146
2146
|
{
|
|
2147
2147
|
key: "Ctrl-o",
|
|
2148
2148
|
mac: "Cmd-o",
|
|
2149
|
-
run: () => (
|
|
2149
|
+
run: () => (g.emit(e, y, "orderedList"), !0)
|
|
2150
2150
|
},
|
|
2151
2151
|
{
|
|
2152
2152
|
key: "Ctrl-c",
|
|
2153
2153
|
mac: "Cmd-c",
|
|
2154
|
-
shift: () => (
|
|
2155
|
-
any(
|
|
2156
|
-
return (k.ctrlKey || k.metaKey) && k.altKey && k.code === "KeyC" ? (
|
|
2154
|
+
shift: () => (g.emit(e, y, "code"), !0),
|
|
2155
|
+
any(M, k) {
|
|
2156
|
+
return (k.ctrlKey || k.metaKey) && k.altKey && k.code === "KeyC" ? (g.emit(e, y, "codeRow"), !0) : !1;
|
|
2157
2157
|
}
|
|
2158
2158
|
},
|
|
2159
2159
|
{
|
|
2160
2160
|
key: "Ctrl-l",
|
|
2161
2161
|
mac: "Cmd-l",
|
|
2162
|
-
run: () => (
|
|
2162
|
+
run: () => (g.emit(e, y, "link"), !0)
|
|
2163
2163
|
},
|
|
2164
2164
|
{
|
|
2165
2165
|
key: "Ctrl-f",
|
|
2166
2166
|
mac: "Cmd-f",
|
|
2167
|
-
shift: () => t.noPrettier ? !1 : (
|
|
2167
|
+
shift: () => t.noPrettier ? !1 : (g.emit(e, y, "prettier"), !0)
|
|
2168
2168
|
},
|
|
2169
2169
|
{
|
|
2170
|
-
any: (
|
|
2170
|
+
any: (M, k) => (k.ctrlKey || k.metaKey) && k.altKey && k.shiftKey && k.code === "KeyT" ? (g.emit(e, y, "table"), !0) : !1
|
|
2171
2171
|
},
|
|
2172
|
-
...
|
|
2173
|
-
],
|
|
2174
|
-
`(?<![a-z0-9.+-])(${
|
|
2172
|
+
...to
|
|
2173
|
+
], Nl = /[a-z][a-z0-9.+-]*:\/\/[^\s<>"'`()]+(?:\([^\s<>"'`]*\)[^\s<>"'`]*)*/i, Al = /\/\/[^\s<>"'`()]+/i, Dl = /data:[a-z]+\/[a-z0-9.+-]+(?:;base64)?,[a-z0-9+/=%]+/i, Ml = /\/(?!\/)[^\s<>"'`()]+/i, Ve = new RegExp(
|
|
2174
|
+
`(?<![a-z0-9.+-])(${Nl.source}|${Al.source}|${Dl.source}|${Ml.source})`,
|
|
2175
2175
|
"gi"
|
|
2176
|
-
), Rl = (e) => {
|
|
2177
|
-
const t = (
|
|
2178
|
-
const
|
|
2179
|
-
let m;
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2176
|
+
), Rl = (e, t, o) => e.some((n) => n.from === t && n.to === o), Fl = (e) => {
|
|
2177
|
+
const t = e.shortenText || (() => "..."), o = ne.define(), n = ne.define(), i = (m, v) => {
|
|
2178
|
+
const b = new Ht(), h = [];
|
|
2179
|
+
for (let f = 1; f <= m.doc.lines; f++) {
|
|
2180
|
+
const p = m.doc.line(f), T = p.text;
|
|
2181
|
+
Ve.lastIndex = 0;
|
|
2182
|
+
let I;
|
|
2183
|
+
for (; I = Ve.exec(T); ) {
|
|
2184
|
+
if (!I[0]) continue;
|
|
2185
|
+
const A = I[0];
|
|
2186
|
+
if (A.length <= e.maxLength) continue;
|
|
2187
|
+
const L = p.from + I.index, S = L + A.length;
|
|
2188
|
+
if (Rl(v, L, S)) {
|
|
2189
|
+
h.push({ from: L, to: S });
|
|
2190
|
+
continue;
|
|
2191
|
+
}
|
|
2192
|
+
const N = t(A);
|
|
2193
|
+
b.add(
|
|
2194
|
+
L,
|
|
2195
|
+
S,
|
|
2196
|
+
Wt.replace({ widget: new s(N, A, L, S) })
|
|
2189
2197
|
);
|
|
2190
2198
|
}
|
|
2191
2199
|
}
|
|
2192
|
-
|
|
2193
|
-
const c = new Ht();
|
|
2194
|
-
for (let u = 1; u <= s.doc.lines; u++) {
|
|
2195
|
-
const m = s.doc.line(u);
|
|
2196
|
-
o(m, c);
|
|
2197
|
-
}
|
|
2198
|
-
return c.finish();
|
|
2200
|
+
return { deco: b.finish(), expanded: h };
|
|
2199
2201
|
};
|
|
2200
|
-
class
|
|
2201
|
-
constructor(
|
|
2202
|
-
super(), this.short =
|
|
2202
|
+
class s extends _t {
|
|
2203
|
+
constructor(v, b, h, f) {
|
|
2204
|
+
super(), this.short = v, this.raw = b, this.from = h, this.to = f;
|
|
2203
2205
|
}
|
|
2204
|
-
toDOM() {
|
|
2205
|
-
const
|
|
2206
|
-
return
|
|
2206
|
+
toDOM(v) {
|
|
2207
|
+
const b = document.createElement("span");
|
|
2208
|
+
return b.textContent = this.short, b.className = "cm-short-text", b.title = this.raw, b.style.display = "inline", b.style.textDecoration = "underline", b.addEventListener("mousedown", (h) => {
|
|
2209
|
+
h.preventDefault(), h.stopPropagation(), v.dispatch({
|
|
2210
|
+
selection: W.cursor(this.from),
|
|
2211
|
+
effects: o.of({
|
|
2212
|
+
from: this.from,
|
|
2213
|
+
to: this.to,
|
|
2214
|
+
expand: !0
|
|
2215
|
+
})
|
|
2216
|
+
}), v.focus();
|
|
2217
|
+
}), b.addEventListener("click", (h) => {
|
|
2218
|
+
h.preventDefault();
|
|
2219
|
+
}), b;
|
|
2207
2220
|
}
|
|
2208
|
-
|
|
2209
|
-
return
|
|
2221
|
+
ignoreEvent() {
|
|
2222
|
+
return !1;
|
|
2223
|
+
}
|
|
2224
|
+
eq(v) {
|
|
2225
|
+
return this.short === v.short && this.raw === v.raw && this.from === v.from && this.to === v.to;
|
|
2210
2226
|
}
|
|
2211
2227
|
}
|
|
2212
|
-
|
|
2213
|
-
create(
|
|
2214
|
-
return
|
|
2228
|
+
const c = qe.define({
|
|
2229
|
+
create(m) {
|
|
2230
|
+
return i(m, []);
|
|
2215
2231
|
},
|
|
2216
|
-
update(
|
|
2217
|
-
|
|
2232
|
+
update(m, v) {
|
|
2233
|
+
let b = m.expanded;
|
|
2234
|
+
v.docChanged && b.length && (b = b.map(({ from: f, to: p }) => ({
|
|
2235
|
+
from: v.changes.mapPos(f, 1),
|
|
2236
|
+
to: v.changes.mapPos(p, -1)
|
|
2237
|
+
})).filter(({ from: f, to: p }) => f < p));
|
|
2238
|
+
let h = b !== m.expanded;
|
|
2239
|
+
for (const f of v.effects)
|
|
2240
|
+
f.is(o) ? f.value.expand ? b = [{ from: f.value.from, to: f.value.to }] : b = b.filter(
|
|
2241
|
+
({ from: p, to: T }) => p !== f.value.from || T !== f.value.to
|
|
2242
|
+
) : f.is(n) && b.length > 0 && (b = []);
|
|
2243
|
+
return !h && b !== m.expanded && (h = !0), v.docChanged || h ? i(v.state, b) : m;
|
|
2218
2244
|
},
|
|
2219
|
-
provide: (
|
|
2245
|
+
provide: (m) => R.decorations.compute([m], (v) => v.field(m).deco)
|
|
2246
|
+
}), u = R.domEventHandlers({
|
|
2247
|
+
mousedown(m, v) {
|
|
2248
|
+
const b = v.state.field(c, !1);
|
|
2249
|
+
if (!b || b.expanded.length === 0)
|
|
2250
|
+
return !1;
|
|
2251
|
+
const h = m.target;
|
|
2252
|
+
if (h && v.dom.contains(h)) {
|
|
2253
|
+
const f = v.posAtDOM(h, 0);
|
|
2254
|
+
if (f != null && f !== -1 && b.expanded.some(
|
|
2255
|
+
({ from: T, to: I }) => f >= T && f <= I
|
|
2256
|
+
))
|
|
2257
|
+
return !1;
|
|
2258
|
+
}
|
|
2259
|
+
return v.dispatch({ effects: n.of(void 0) }), !1;
|
|
2260
|
+
}
|
|
2220
2261
|
});
|
|
2262
|
+
return [c, u];
|
|
2221
2263
|
};
|
|
2222
2264
|
R.EDIT_CONTEXT = !1;
|
|
2223
|
-
const
|
|
2224
|
-
const t =
|
|
2265
|
+
const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.extension, Bl = (e) => {
|
|
2266
|
+
const t = Xe(e);
|
|
2225
2267
|
return e.compartment ? e.compartment.of(t) : t;
|
|
2226
|
-
},
|
|
2268
|
+
}, Pl = (e) => {
|
|
2227
2269
|
const t = r("tabWidth"), o = r("editorId"), n = r("theme"), i = r("previewTheme"), s = r("language"), c = r(
|
|
2228
2270
|
"usedLanguageText"
|
|
2229
|
-
), u = r("disabled"), m = r("showToolbarName"),
|
|
2230
|
-
noPrettier:
|
|
2231
|
-
}),
|
|
2232
|
-
...
|
|
2233
|
-
...Nt,
|
|
2271
|
+
), u = r("disabled"), m = r("showToolbarName"), v = r("customIcon"), b = r("noUploadImg"), h = r("tableShape"), f = r("noPrettier"), p = r("codeTheme"), T = r("setting"), I = r("updateSetting"), A = r("catalogVisible"), L = r("defToolbars"), S = r("floatingToolbars"), N = r("rootRef"), M = x(), k = kt(), V = x(!1), Q = new q(), ee = new q(), se = new q(), pe = new q(), Je = new q(), Qe = Ll(o, {
|
|
2272
|
+
noPrettier: f
|
|
2273
|
+
}), Te = () => [
|
|
2274
|
+
...Qe,
|
|
2234
2275
|
...At,
|
|
2235
|
-
Dt
|
|
2276
|
+
...Dt,
|
|
2277
|
+
Mt
|
|
2236
2278
|
], te = {
|
|
2237
|
-
paste:
|
|
2279
|
+
paste: El(e, k),
|
|
2238
2280
|
blur: e.onBlur,
|
|
2239
2281
|
focus: e.onFocus,
|
|
2240
2282
|
drop: e.onDrop,
|
|
2241
2283
|
compositionstart: () => {
|
|
2242
2284
|
V.value = !0;
|
|
2243
2285
|
},
|
|
2244
|
-
compositionend: (
|
|
2245
|
-
V.value = !1, e.updateModelValue(
|
|
2286
|
+
compositionend: (w, D) => {
|
|
2287
|
+
V.value = !1, e.updateModelValue(D.state.doc.toString());
|
|
2246
2288
|
},
|
|
2247
|
-
input: (
|
|
2248
|
-
e.onInput && e.onInput(
|
|
2249
|
-
const { data:
|
|
2250
|
-
e.maxlength && e.modelValue.length +
|
|
2289
|
+
input: (w) => {
|
|
2290
|
+
e.onInput && e.onInput(w);
|
|
2291
|
+
const { data: D } = w;
|
|
2292
|
+
e.maxlength && e.modelValue.length + D.length > e.maxlength && g.emit(o, j, {
|
|
2251
2293
|
name: "overlength",
|
|
2252
2294
|
message: "The input text is too long",
|
|
2253
|
-
data:
|
|
2295
|
+
data: D
|
|
2254
2296
|
});
|
|
2255
2297
|
}
|
|
2256
|
-
},
|
|
2257
|
-
privide(
|
|
2258
|
-
|
|
2298
|
+
}, et = nl({
|
|
2299
|
+
privide(w) {
|
|
2300
|
+
w.provide("editorId", o), w.provide("theme", n), w.provide("previewTheme", i), w.provide("language", s), w.provide("disabled", u), w.provide("noUploadImg", b), w.provide("tableShape", h), w.provide("noPrettier", f), w.provide("codeTheme", p), w.provide("showToolbarName", m), w.provide("setting", T), w.provide("updateSetting", I), w.provide("usedLanguageText", c), w.provide("catalogVisible", A), w.provide("defToolbars", L), w.provide("tabWidth", t), w.provide("customIcon", v), w.provide("floatingToolbars", S), w.provide("rootRef", N);
|
|
2259
2301
|
}
|
|
2260
|
-
}),
|
|
2302
|
+
}), tt = [
|
|
2261
2303
|
{
|
|
2262
2304
|
type: "theme",
|
|
2263
|
-
extension: ({ theme:
|
|
2305
|
+
extension: ({ theme: w }) => w.value === "light" ? Me : Oe,
|
|
2264
2306
|
compartment: Q,
|
|
2265
2307
|
options: {
|
|
2266
2308
|
theme: n
|
|
@@ -2268,26 +2310,26 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2268
2310
|
},
|
|
2269
2311
|
{
|
|
2270
2312
|
type: "updateListener",
|
|
2271
|
-
extension: R.updateListener.of((
|
|
2272
|
-
|
|
2313
|
+
extension: R.updateListener.of((w) => {
|
|
2314
|
+
w.docChanged && (e.onChange(w.state.doc.toString()), V.value || e.updateModelValue(w.state.doc.toString()));
|
|
2273
2315
|
})
|
|
2274
2316
|
},
|
|
2275
2317
|
{
|
|
2276
2318
|
type: "domEventHandlers",
|
|
2277
2319
|
extension: R.domEventHandlers(te),
|
|
2278
|
-
compartment:
|
|
2320
|
+
compartment: pe
|
|
2279
2321
|
},
|
|
2280
2322
|
{
|
|
2281
2323
|
type: "completions",
|
|
2282
|
-
extension:
|
|
2324
|
+
extension: Ie(e.completions),
|
|
2283
2325
|
compartment: ee
|
|
2284
2326
|
},
|
|
2285
2327
|
{
|
|
2286
2328
|
type: "history",
|
|
2287
|
-
extension:
|
|
2288
|
-
compartment:
|
|
2329
|
+
extension: ke(),
|
|
2330
|
+
compartment: se
|
|
2289
2331
|
}
|
|
2290
|
-
],
|
|
2332
|
+
], we = G.codeMirrorExtensions(
|
|
2291
2333
|
[
|
|
2292
2334
|
// 横向换行
|
|
2293
2335
|
{
|
|
@@ -2296,200 +2338,200 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2296
2338
|
},
|
|
2297
2339
|
{
|
|
2298
2340
|
type: "keymap",
|
|
2299
|
-
extension:
|
|
2341
|
+
extension: zt.of(Te())
|
|
2300
2342
|
},
|
|
2301
2343
|
// 解决多行placeholder时,光标异常的情况
|
|
2302
2344
|
{
|
|
2303
2345
|
type: "drawSelection",
|
|
2304
|
-
extension:
|
|
2346
|
+
extension: qt()
|
|
2305
2347
|
},
|
|
2306
2348
|
{
|
|
2307
2349
|
type: "markdown",
|
|
2308
|
-
extension:
|
|
2350
|
+
extension: Bt({ codeLanguages: Pt })
|
|
2309
2351
|
},
|
|
2310
2352
|
{
|
|
2311
2353
|
type: "linkShortener",
|
|
2312
|
-
extension: (
|
|
2354
|
+
extension: (w) => Fl(w),
|
|
2313
2355
|
options: {
|
|
2314
2356
|
maxLength: 30
|
|
2315
2357
|
}
|
|
2316
2358
|
},
|
|
2317
2359
|
{
|
|
2318
2360
|
type: "floatingToolbar",
|
|
2319
|
-
extension: S.value.length > 0 ?
|
|
2320
|
-
compartment:
|
|
2361
|
+
extension: S.value.length > 0 ? et : [],
|
|
2362
|
+
compartment: Je
|
|
2321
2363
|
}
|
|
2322
2364
|
],
|
|
2323
2365
|
{
|
|
2324
2366
|
editorId: o,
|
|
2325
2367
|
theme: n.value,
|
|
2326
|
-
keyBindings:
|
|
2368
|
+
keyBindings: Te()
|
|
2327
2369
|
}
|
|
2328
|
-
),
|
|
2329
|
-
return
|
|
2330
|
-
const
|
|
2370
|
+
), ot = () => [...tt, ...we].map(Bl);
|
|
2371
|
+
return _(() => {
|
|
2372
|
+
const w = new R({
|
|
2331
2373
|
doc: e.modelValue,
|
|
2332
|
-
parent:
|
|
2333
|
-
extensions:
|
|
2334
|
-
}),
|
|
2335
|
-
k.value =
|
|
2336
|
-
|
|
2337
|
-
}, 0),
|
|
2338
|
-
name:
|
|
2374
|
+
parent: M.value,
|
|
2375
|
+
extensions: ot()
|
|
2376
|
+
}), D = new go(w);
|
|
2377
|
+
k.value = D, setTimeout(() => {
|
|
2378
|
+
D.setTabSize(t), D.setDisabled(u.value), D.setReadOnly(e.readonly), e.placeholder && D.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && D.setMaxLength(e.maxlength), e.autofocus && w.focus();
|
|
2379
|
+
}, 0), g.on(o, {
|
|
2380
|
+
name: Ke,
|
|
2339
2381
|
callback() {
|
|
2340
|
-
|
|
2382
|
+
Rt(w);
|
|
2341
2383
|
}
|
|
2342
|
-
}),
|
|
2343
|
-
name:
|
|
2384
|
+
}), g.on(o, {
|
|
2385
|
+
name: Ue,
|
|
2344
2386
|
callback() {
|
|
2345
|
-
|
|
2387
|
+
Ft(w);
|
|
2346
2388
|
}
|
|
2347
|
-
}),
|
|
2348
|
-
name:
|
|
2349
|
-
async callback(
|
|
2350
|
-
if (
|
|
2351
|
-
const
|
|
2352
|
-
if (
|
|
2353
|
-
|
|
2354
|
-
const { text: H, options: Y } = await
|
|
2355
|
-
|
|
2389
|
+
}), g.on(o, {
|
|
2390
|
+
name: y,
|
|
2391
|
+
async callback(B, F = {}) {
|
|
2392
|
+
if (B === "image" && F.transform) {
|
|
2393
|
+
const P = e.transformImgUrl(F.url);
|
|
2394
|
+
if (P instanceof Promise)
|
|
2395
|
+
P.then(async (O) => {
|
|
2396
|
+
const { text: H, options: Y } = await ce(
|
|
2397
|
+
B,
|
|
2356
2398
|
k.value,
|
|
2357
|
-
{ ...
|
|
2399
|
+
{ ...F, url: O }
|
|
2358
2400
|
);
|
|
2359
2401
|
k.value?.replaceSelectedText(H, Y, o);
|
|
2360
|
-
}).catch((
|
|
2361
|
-
console.error(
|
|
2402
|
+
}).catch((O) => {
|
|
2403
|
+
console.error(O);
|
|
2362
2404
|
});
|
|
2363
2405
|
else {
|
|
2364
|
-
const { text:
|
|
2365
|
-
...
|
|
2366
|
-
url:
|
|
2406
|
+
const { text: O, options: H } = await ce(B, k.value, {
|
|
2407
|
+
...F,
|
|
2408
|
+
url: P
|
|
2367
2409
|
});
|
|
2368
|
-
k.value?.replaceSelectedText(
|
|
2410
|
+
k.value?.replaceSelectedText(O, H, o);
|
|
2369
2411
|
}
|
|
2370
2412
|
} else {
|
|
2371
|
-
const { text:
|
|
2372
|
-
|
|
2413
|
+
const { text: P, options: O } = await ce(
|
|
2414
|
+
B,
|
|
2373
2415
|
k.value,
|
|
2374
|
-
|
|
2416
|
+
F
|
|
2375
2417
|
);
|
|
2376
|
-
k.value?.replaceSelectedText(
|
|
2418
|
+
k.value?.replaceSelectedText(P, O, o);
|
|
2377
2419
|
}
|
|
2378
2420
|
}
|
|
2379
|
-
}),
|
|
2380
|
-
name:
|
|
2381
|
-
callback:
|
|
2382
|
-
const
|
|
2383
|
-
for (const
|
|
2384
|
-
const H =
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
} :
|
|
2421
|
+
}), g.on(o, {
|
|
2422
|
+
name: Gt,
|
|
2423
|
+
callback: Et((B) => {
|
|
2424
|
+
const F = { ...te }, P = Object.keys(te);
|
|
2425
|
+
for (const O in B) {
|
|
2426
|
+
const H = O;
|
|
2427
|
+
P.includes(H) ? F[H] = (Y, ye) => {
|
|
2428
|
+
B[H](Y, ye), Y.defaultPrevented || te[H](Y, ye);
|
|
2429
|
+
} : F[H] = B[H];
|
|
2388
2430
|
}
|
|
2389
2431
|
k.value?.view.dispatch({
|
|
2390
|
-
effects:
|
|
2391
|
-
R.domEventHandlers(
|
|
2432
|
+
effects: pe.reconfigure(
|
|
2433
|
+
R.domEventHandlers(F)
|
|
2392
2434
|
)
|
|
2393
2435
|
});
|
|
2394
2436
|
})
|
|
2395
|
-
}),
|
|
2396
|
-
name:
|
|
2397
|
-
callback: (
|
|
2398
|
-
const
|
|
2399
|
-
|
|
2400
|
-
|
|
2437
|
+
}), g.on(o, {
|
|
2438
|
+
name: jt,
|
|
2439
|
+
callback: (B, F) => {
|
|
2440
|
+
const P = w.state.doc.line(B);
|
|
2441
|
+
w.dispatch(
|
|
2442
|
+
w.state.update({ changes: { from: P.from, to: P.to, insert: F } })
|
|
2401
2443
|
);
|
|
2402
2444
|
}
|
|
2403
|
-
}),
|
|
2404
|
-
name:
|
|
2445
|
+
}), g.on(o, {
|
|
2446
|
+
name: Yt,
|
|
2405
2447
|
callback() {
|
|
2406
|
-
|
|
2448
|
+
g.emit(o, $e, w);
|
|
2407
2449
|
}
|
|
2408
|
-
}),
|
|
2409
|
-
}),
|
|
2450
|
+
}), g.emit(o, $e, w);
|
|
2451
|
+
}), E(
|
|
2410
2452
|
n,
|
|
2411
2453
|
() => {
|
|
2412
2454
|
k.value?.view.dispatch({
|
|
2413
|
-
effects: Q.reconfigure(n.value === "light" ?
|
|
2455
|
+
effects: Q.reconfigure(n.value === "light" ? Me : Oe)
|
|
2414
2456
|
});
|
|
2415
2457
|
},
|
|
2416
2458
|
{ deep: !0 }
|
|
2417
|
-
),
|
|
2459
|
+
), E(
|
|
2418
2460
|
() => e.completions,
|
|
2419
2461
|
() => {
|
|
2420
2462
|
k.value?.view.dispatch({
|
|
2421
|
-
effects: ee.reconfigure(
|
|
2463
|
+
effects: ee.reconfigure(Ie(e.completions))
|
|
2422
2464
|
});
|
|
2423
2465
|
},
|
|
2424
2466
|
{ deep: !0 }
|
|
2425
|
-
),
|
|
2467
|
+
), E(
|
|
2426
2468
|
() => e.modelValue,
|
|
2427
2469
|
() => {
|
|
2428
2470
|
k.value?.getValue() !== e.modelValue && k.value?.setValue(e.modelValue);
|
|
2429
2471
|
}
|
|
2430
|
-
),
|
|
2472
|
+
), E(
|
|
2431
2473
|
() => e.placeholder,
|
|
2432
2474
|
() => {
|
|
2433
2475
|
k.value?.setPlaceholder(e.placeholder);
|
|
2434
2476
|
}
|
|
2435
|
-
),
|
|
2477
|
+
), E([u], () => {
|
|
2436
2478
|
k.value?.setDisabled(u.value);
|
|
2437
|
-
}),
|
|
2479
|
+
}), E(
|
|
2438
2480
|
() => e.readonly,
|
|
2439
2481
|
() => {
|
|
2440
2482
|
k.value?.setDisabled(e.readonly);
|
|
2441
2483
|
}
|
|
2442
|
-
),
|
|
2484
|
+
), E(
|
|
2443
2485
|
() => e.maxlength,
|
|
2444
2486
|
() => {
|
|
2445
2487
|
e.maxlength && k.value?.setMaxLength(e.maxlength);
|
|
2446
2488
|
}
|
|
2447
2489
|
), ho(() => {
|
|
2448
|
-
const
|
|
2449
|
-
(
|
|
2490
|
+
const w = we.find(
|
|
2491
|
+
(D) => D.type === "floatingToolbar"
|
|
2450
2492
|
);
|
|
2451
|
-
|
|
2452
|
-
effects:
|
|
2453
|
-
|
|
2493
|
+
w?.compartment && (S.value.length > 0 ? k.value?.view.dispatch({
|
|
2494
|
+
effects: w.compartment.reconfigure(
|
|
2495
|
+
Xe(w)
|
|
2454
2496
|
)
|
|
2455
2497
|
}) : k.value?.view.dispatch({
|
|
2456
|
-
effects:
|
|
2498
|
+
effects: w.compartment.reconfigure([])
|
|
2457
2499
|
}));
|
|
2458
2500
|
}, S), {
|
|
2459
|
-
inputWrapperRef:
|
|
2501
|
+
inputWrapperRef: M,
|
|
2460
2502
|
codeMirrorUt: k,
|
|
2461
2503
|
resetHistory() {
|
|
2462
|
-
k.value?.view.dispatch({ effects:
|
|
2504
|
+
k.value?.view.dispatch({ effects: se.reconfigure([]) }), k.value?.view.dispatch({ effects: se.reconfigure(ke()) });
|
|
2463
2505
|
}
|
|
2464
2506
|
};
|
|
2465
2507
|
}, Hl = (e, t, o) => {
|
|
2466
|
-
const n = r("setting"), i = K(() => /px$/.test(`${e.inputBoxWidth}`) ? "50%" : e.inputBoxWidth), s =
|
|
2508
|
+
const n = r("setting"), i = K(() => /px$/.test(`${e.inputBoxWidth}`) ? "50%" : e.inputBoxWidth), s = U({
|
|
2467
2509
|
resizedWidth: i.value
|
|
2468
|
-
}), c =
|
|
2510
|
+
}), c = U({
|
|
2469
2511
|
width: i.value
|
|
2470
|
-
}), u =
|
|
2512
|
+
}), u = U({
|
|
2471
2513
|
left: i.value,
|
|
2472
2514
|
display: "initial"
|
|
2473
2515
|
}), m = (h) => {
|
|
2474
|
-
const
|
|
2475
|
-
let T = h.x -
|
|
2476
|
-
T /
|
|
2477
|
-
const
|
|
2478
|
-
c.width =
|
|
2479
|
-
},
|
|
2516
|
+
const f = t.value?.offsetWidth || 0, p = t.value?.getBoundingClientRect().x || 0;
|
|
2517
|
+
let T = h.x - p;
|
|
2518
|
+
T / f < oe ? T = f * oe : T > f - f * oe && (T = f - f * oe);
|
|
2519
|
+
const I = `${T / f * 100}%`;
|
|
2520
|
+
c.width = I, u.left = I, s.resizedWidth = I, e.oninputBoxWidthChange?.(I);
|
|
2521
|
+
}, v = (h) => {
|
|
2480
2522
|
h.target === o.value && document.addEventListener("mousemove", m);
|
|
2481
|
-
},
|
|
2523
|
+
}, b = () => {
|
|
2482
2524
|
document.removeEventListener("mousemove", m);
|
|
2483
2525
|
};
|
|
2484
|
-
return
|
|
2485
|
-
document.removeEventListener("mousedown",
|
|
2486
|
-
}),
|
|
2487
|
-
document.addEventListener("mousedown",
|
|
2488
|
-
}),
|
|
2489
|
-
document.removeEventListener("mousedown",
|
|
2490
|
-
}),
|
|
2526
|
+
return E([o], () => {
|
|
2527
|
+
document.removeEventListener("mousedown", v), document.removeEventListener("mouseup", b), document.addEventListener("mousedown", v), document.addEventListener("mouseup", b);
|
|
2528
|
+
}), _(() => {
|
|
2529
|
+
document.addEventListener("mousedown", v), document.addEventListener("mouseup", b);
|
|
2530
|
+
}), ge(() => {
|
|
2531
|
+
document.removeEventListener("mousedown", v), document.removeEventListener("mouseup", b);
|
|
2532
|
+
}), E([i], ([h]) => {
|
|
2491
2533
|
s.resizedWidth = h, c.width = h, u.left = h;
|
|
2492
|
-
}),
|
|
2534
|
+
}), E(
|
|
2493
2535
|
[
|
|
2494
2536
|
() => n.value.htmlPreview,
|
|
2495
2537
|
() => n.value.preview,
|
|
@@ -2505,8 +2547,8 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2505
2547
|
inputWrapperStyle: c,
|
|
2506
2548
|
resizeOperateStyle: u
|
|
2507
2549
|
};
|
|
2508
|
-
},
|
|
2509
|
-
const e = r("editorId"), t = x(!0), o =
|
|
2550
|
+
}, Ol = () => {
|
|
2551
|
+
const e = r("editorId"), t = x(!0), o = ze();
|
|
2510
2552
|
return {
|
|
2511
2553
|
onCatalogActive: (c, u) => {
|
|
2512
2554
|
const m = document.querySelector(
|
|
@@ -2514,14 +2556,14 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2514
2556
|
);
|
|
2515
2557
|
if (!u || !t.value || !m)
|
|
2516
2558
|
return;
|
|
2517
|
-
const
|
|
2518
|
-
(
|
|
2559
|
+
const v = u.offsetTop - m.scrollTop;
|
|
2560
|
+
(v > 100 || v < 100) && o(m, u.offsetTop - 100);
|
|
2519
2561
|
},
|
|
2520
2562
|
onMouseenter: () => t.value = !1,
|
|
2521
2563
|
onMouseleave: () => t.value = !0
|
|
2522
2564
|
};
|
|
2523
|
-
},
|
|
2524
|
-
name: `${
|
|
2565
|
+
}, me = /* @__PURE__ */ C({
|
|
2566
|
+
name: `${xt}CustomScrollbar`,
|
|
2525
2567
|
props: {
|
|
2526
2568
|
id: {
|
|
2527
2569
|
type: String,
|
|
@@ -2560,43 +2602,43 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2560
2602
|
slots: t
|
|
2561
2603
|
}) {
|
|
2562
2604
|
const o = x(null), n = x(null), i = x(null), s = x(null);
|
|
2563
|
-
let c = null, u = null, m = !1,
|
|
2605
|
+
let c = null, u = null, m = !1, v = 0, b = 0;
|
|
2564
2606
|
const h = () => {
|
|
2565
2607
|
if (!n.value || !o.value || !i.value || !s.value) return;
|
|
2566
|
-
const S = o.value.clientHeight,
|
|
2567
|
-
if (
|
|
2608
|
+
const S = o.value.clientHeight, N = n.value.scrollHeight, M = n.value.scrollTop;
|
|
2609
|
+
if (N <= S) {
|
|
2568
2610
|
i.value.style.display = "none", e.alwaysShowTrack || (s.value.style.display = "none");
|
|
2569
2611
|
return;
|
|
2570
2612
|
} else
|
|
2571
2613
|
i.value.style.display = "block", s.value.style.display = "block";
|
|
2572
|
-
const k = S /
|
|
2614
|
+
const k = S / N, V = Math.max(S * k, 20), Q = S - V, ee = Math.min(M * k, Q);
|
|
2573
2615
|
i.value.style.height = `${V}px`, i.value.style.top = `${ee}px`;
|
|
2574
|
-
},
|
|
2575
|
-
m = !0,
|
|
2616
|
+
}, f = () => h(), p = (S) => {
|
|
2617
|
+
m = !0, v = S.clientY, b = n.value.scrollTop, document.body.style.userSelect = "none";
|
|
2576
2618
|
}, T = (S) => {
|
|
2577
2619
|
if (!m || !n.value || !o.value) return;
|
|
2578
|
-
const
|
|
2579
|
-
n.value.scrollTop =
|
|
2580
|
-
},
|
|
2620
|
+
const N = S.clientY - v, M = n.value.scrollHeight / o.value.clientHeight;
|
|
2621
|
+
n.value.scrollTop = b + N * M;
|
|
2622
|
+
}, I = () => {
|
|
2581
2623
|
m = !1, document.body.style.userSelect = "";
|
|
2582
|
-
},
|
|
2583
|
-
n.value && n.value.removeEventListener("scroll",
|
|
2584
|
-
},
|
|
2624
|
+
}, A = (S) => {
|
|
2625
|
+
n.value && n.value.removeEventListener("scroll", f), n.value = S, n.value ? (n.value.addEventListener("scroll", f), h()) : s.value && !e.alwaysShowTrack && (s.value.style.display = "none");
|
|
2626
|
+
}, L = () => {
|
|
2585
2627
|
if (!o.value) return;
|
|
2586
2628
|
const S = e.scrollTarget ? o.value.querySelector(e.scrollTarget) : o.value.firstElementChild;
|
|
2587
|
-
|
|
2629
|
+
A(S);
|
|
2588
2630
|
};
|
|
2589
|
-
return
|
|
2590
|
-
await
|
|
2631
|
+
return _(async () => {
|
|
2632
|
+
await re(), L(), c = new MutationObserver(() => {
|
|
2591
2633
|
u && cancelAnimationFrame(u), u = requestAnimationFrame(() => {
|
|
2592
|
-
|
|
2634
|
+
L();
|
|
2593
2635
|
});
|
|
2594
2636
|
}), c.observe(o.value, {
|
|
2595
2637
|
childList: !0,
|
|
2596
2638
|
subtree: !0
|
|
2597
|
-
}), window.addEventListener("resize", h), i.value?.addEventListener("mousedown",
|
|
2598
|
-
}),
|
|
2599
|
-
c?.disconnect(), n.value && n.value.removeEventListener("scroll",
|
|
2639
|
+
}), window.addEventListener("resize", h), i.value?.addEventListener("mousedown", p), document.addEventListener("mousemove", T), document.addEventListener("mouseup", I);
|
|
2640
|
+
}), ge(() => {
|
|
2641
|
+
c?.disconnect(), n.value && n.value.removeEventListener("scroll", f), window.removeEventListener("resize", h), i.value?.removeEventListener("mousedown", p), document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", I);
|
|
2600
2642
|
}), () => l("div", {
|
|
2601
2643
|
id: e.id,
|
|
2602
2644
|
class: [`${a}-custom-scrollbar`, e.class],
|
|
@@ -2611,63 +2653,63 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2611
2653
|
ref: i
|
|
2612
2654
|
}, null)])]);
|
|
2613
2655
|
}
|
|
2614
|
-
}),
|
|
2656
|
+
}), Vl = ze(), Wl = /* @__PURE__ */ C({
|
|
2615
2657
|
name: "MDEditorContent",
|
|
2616
|
-
props:
|
|
2658
|
+
props: st,
|
|
2617
2659
|
setup(e, t) {
|
|
2618
2660
|
const o = r("editorId"), n = r("catalogVisible"), i = r("theme"), s = r("setting"), c = x(""), u = x(), m = x(), {
|
|
2619
|
-
inputWrapperRef:
|
|
2620
|
-
codeMirrorUt:
|
|
2661
|
+
inputWrapperRef: v,
|
|
2662
|
+
codeMirrorUt: b,
|
|
2621
2663
|
resetHistory: h
|
|
2622
|
-
} =
|
|
2623
|
-
inputWrapperStyle:
|
|
2624
|
-
resizeOperateStyle:
|
|
2664
|
+
} = Pl(e), {
|
|
2665
|
+
inputWrapperStyle: f,
|
|
2666
|
+
resizeOperateStyle: p
|
|
2625
2667
|
} = Hl(e, u, m);
|
|
2626
|
-
|
|
2668
|
+
oo(e, c, b);
|
|
2627
2669
|
const {
|
|
2628
2670
|
onCatalogActive: T,
|
|
2629
|
-
onMouseenter:
|
|
2630
|
-
onMouseleave:
|
|
2631
|
-
} =
|
|
2671
|
+
onMouseenter: I,
|
|
2672
|
+
onMouseleave: A
|
|
2673
|
+
} = Ol();
|
|
2632
2674
|
return t.expose({
|
|
2633
2675
|
getSelectedText() {
|
|
2634
|
-
return
|
|
2676
|
+
return b.value?.getSelectedText();
|
|
2635
2677
|
},
|
|
2636
|
-
focus(
|
|
2637
|
-
|
|
2678
|
+
focus(L) {
|
|
2679
|
+
b.value?.focus(L);
|
|
2638
2680
|
},
|
|
2639
2681
|
resetHistory: h,
|
|
2640
2682
|
getEditorView() {
|
|
2641
|
-
return
|
|
2683
|
+
return b.value?.view;
|
|
2642
2684
|
}
|
|
2643
2685
|
}), () => l("div", {
|
|
2644
2686
|
class: `${a}-content`
|
|
2645
2687
|
}, [l("div", {
|
|
2646
2688
|
class: `${a}-content-wrapper`,
|
|
2647
2689
|
ref: u
|
|
2648
|
-
}, [l(
|
|
2690
|
+
}, [l(me, {
|
|
2649
2691
|
alwaysShowTrack: !0,
|
|
2650
2692
|
scrollTarget: `#${o} .cm-scroller`,
|
|
2651
|
-
style:
|
|
2693
|
+
style: f
|
|
2652
2694
|
}, {
|
|
2653
2695
|
default: () => [l("div", {
|
|
2654
2696
|
class: `${a}-input-wrapper`,
|
|
2655
|
-
ref:
|
|
2697
|
+
ref: v
|
|
2656
2698
|
}, null)]
|
|
2657
2699
|
}), (s.value.htmlPreview || s.value.preview) && l("div", {
|
|
2658
2700
|
class: `${a}-resize-operate`,
|
|
2659
|
-
style:
|
|
2701
|
+
style: p,
|
|
2660
2702
|
ref: m
|
|
2661
|
-
}, null), l(
|
|
2703
|
+
}, null), l(me, {
|
|
2662
2704
|
style: {
|
|
2663
2705
|
flex: 1
|
|
2664
2706
|
}
|
|
2665
2707
|
}, {
|
|
2666
|
-
default: () => [l(
|
|
2708
|
+
default: () => [l(it, {
|
|
2667
2709
|
modelValue: e.modelValue,
|
|
2668
2710
|
onChange: e.onChange,
|
|
2669
|
-
onHtmlChanged: (
|
|
2670
|
-
c.value =
|
|
2711
|
+
onHtmlChanged: (L) => {
|
|
2712
|
+
c.value = L, e.onHtmlChanged(L);
|
|
2671
2713
|
},
|
|
2672
2714
|
onGetCatalog: e.onGetCatalog,
|
|
2673
2715
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2682,12 +2724,12 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2682
2724
|
autoFoldThreshold: e.autoFoldThreshold,
|
|
2683
2725
|
onRemount: e.onRemount
|
|
2684
2726
|
}, null)]
|
|
2685
|
-
})]), n.value && l(
|
|
2727
|
+
})]), n.value && l(me, {
|
|
2686
2728
|
class: `${a}-catalog-${e.catalogLayout}`,
|
|
2687
|
-
onMouseenter:
|
|
2688
|
-
onMouseleave:
|
|
2729
|
+
onMouseenter: I,
|
|
2730
|
+
onMouseleave: A
|
|
2689
2731
|
}, {
|
|
2690
|
-
default: () => [l(
|
|
2732
|
+
default: () => [l(We, {
|
|
2691
2733
|
theme: i.value,
|
|
2692
2734
|
class: `${a}-catalog-editor`,
|
|
2693
2735
|
editorId: o,
|
|
@@ -2695,13 +2737,13 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2695
2737
|
key: "internal-catalog",
|
|
2696
2738
|
scrollElementOffsetTop: 2,
|
|
2697
2739
|
syncWith: s.value.preview ? "preview" : "editor",
|
|
2698
|
-
onClick: (
|
|
2740
|
+
onClick: (L, S) => {
|
|
2699
2741
|
if (!s.value.preview && S.line !== void 0) {
|
|
2700
|
-
|
|
2701
|
-
const
|
|
2702
|
-
if (
|
|
2703
|
-
const
|
|
2704
|
-
|
|
2742
|
+
L.preventDefault();
|
|
2743
|
+
const N = b.value?.view;
|
|
2744
|
+
if (N) {
|
|
2745
|
+
const M = N.state.doc.line(S.line + 1), k = N.lineBlockAt(M.from)?.top, V = N.scrollDOM;
|
|
2746
|
+
Vl(V, k);
|
|
2705
2747
|
}
|
|
2706
2748
|
}
|
|
2707
2749
|
},
|
|
@@ -2710,7 +2752,7 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2710
2752
|
}, null)]
|
|
2711
2753
|
})]);
|
|
2712
2754
|
}
|
|
2713
|
-
}),
|
|
2755
|
+
}), _l = /* @__PURE__ */ C({
|
|
2714
2756
|
props: {
|
|
2715
2757
|
modelValue: {
|
|
2716
2758
|
type: String,
|
|
@@ -2725,7 +2767,7 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2725
2767
|
class: `${a}-footer-label`
|
|
2726
2768
|
}, [`${t.value.footer?.markdownTotal}:`]), l("span", null, [e.modelValue?.length || 0])]);
|
|
2727
2769
|
}
|
|
2728
|
-
}),
|
|
2770
|
+
}), zl = {
|
|
2729
2771
|
checked: {
|
|
2730
2772
|
type: Boolean,
|
|
2731
2773
|
default: !1
|
|
@@ -2739,9 +2781,9 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2739
2781
|
type: Boolean,
|
|
2740
2782
|
default: void 0
|
|
2741
2783
|
}
|
|
2742
|
-
},
|
|
2784
|
+
}, ql = /* @__PURE__ */ C({
|
|
2743
2785
|
name: `${a}-checkbox`,
|
|
2744
|
-
props:
|
|
2786
|
+
props: zl,
|
|
2745
2787
|
setup(e) {
|
|
2746
2788
|
return () => l("div", {
|
|
2747
2789
|
class: [`${a}-checkbox`, e.checked && `${a}-checkbox-checked`, e.disabled && `${a}-disabled`],
|
|
@@ -2750,7 +2792,7 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2750
2792
|
}
|
|
2751
2793
|
}, null);
|
|
2752
2794
|
}
|
|
2753
|
-
}),
|
|
2795
|
+
}), Ul = {
|
|
2754
2796
|
scrollAuto: {
|
|
2755
2797
|
type: Boolean
|
|
2756
2798
|
},
|
|
@@ -2759,8 +2801,8 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2759
2801
|
default: () => {
|
|
2760
2802
|
}
|
|
2761
2803
|
}
|
|
2762
|
-
},
|
|
2763
|
-
props:
|
|
2804
|
+
}, Kl = /* @__PURE__ */ C({
|
|
2805
|
+
props: Ul,
|
|
2764
2806
|
setup(e) {
|
|
2765
2807
|
const t = r("usedLanguageText"), o = r("disabled");
|
|
2766
2808
|
return () => l("div", {
|
|
@@ -2770,13 +2812,13 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2770
2812
|
onClick: () => {
|
|
2771
2813
|
o?.value || e.onScrollAutoChange(!e.scrollAuto);
|
|
2772
2814
|
}
|
|
2773
|
-
}, [t?.value.footer?.scrollAuto]), l(
|
|
2815
|
+
}, [t?.value.footer?.scrollAuto]), l(ql, {
|
|
2774
2816
|
checked: e.scrollAuto,
|
|
2775
2817
|
onChange: e.onScrollAutoChange,
|
|
2776
2818
|
disabled: o?.value
|
|
2777
2819
|
}, null)]);
|
|
2778
2820
|
}
|
|
2779
|
-
}),
|
|
2821
|
+
}), Gl = {
|
|
2780
2822
|
modelValue: {
|
|
2781
2823
|
type: String,
|
|
2782
2824
|
default: ""
|
|
@@ -2799,22 +2841,22 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2799
2841
|
defFooters: {
|
|
2800
2842
|
type: Object
|
|
2801
2843
|
}
|
|
2802
|
-
},
|
|
2844
|
+
}, jl = /* @__PURE__ */ C({
|
|
2803
2845
|
name: "MDEditorFooter",
|
|
2804
|
-
props:
|
|
2846
|
+
props: Gl,
|
|
2805
2847
|
setup(e) {
|
|
2806
2848
|
const t = r("theme"), o = r("language"), n = r("disabled"), i = K(() => {
|
|
2807
2849
|
const c = e.footers.indexOf("="), u = c === -1 ? e.footers : e.footers.slice(0, c), m = c === -1 ? [] : e.footers.slice(c, Number.MAX_SAFE_INTEGER);
|
|
2808
2850
|
return [u, m];
|
|
2809
2851
|
}), s = (c) => {
|
|
2810
|
-
if (
|
|
2852
|
+
if (St.includes(c))
|
|
2811
2853
|
switch (c) {
|
|
2812
2854
|
case "markdownTotal":
|
|
2813
|
-
return l(
|
|
2855
|
+
return l(_l, {
|
|
2814
2856
|
modelValue: e.modelValue
|
|
2815
2857
|
}, null);
|
|
2816
2858
|
case "scrollSwitch":
|
|
2817
|
-
return !e.noScrollAuto && l(
|
|
2859
|
+
return !e.noScrollAuto && l(Kl, {
|
|
2818
2860
|
scrollAuto: e.scrollAuto,
|
|
2819
2861
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2820
2862
|
}, null);
|
|
@@ -2847,7 +2889,7 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2847
2889
|
}, [u])]);
|
|
2848
2890
|
};
|
|
2849
2891
|
}
|
|
2850
|
-
}),
|
|
2892
|
+
}), Yl = {
|
|
2851
2893
|
// 工具栏选择显示
|
|
2852
2894
|
toolbars: {
|
|
2853
2895
|
type: Array,
|
|
@@ -2858,25 +2900,25 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2858
2900
|
type: Array,
|
|
2859
2901
|
default: () => []
|
|
2860
2902
|
}
|
|
2861
|
-
},
|
|
2903
|
+
}, Zl = /* @__PURE__ */ C({
|
|
2862
2904
|
name: "MDEditorToolbar",
|
|
2863
|
-
props:
|
|
2905
|
+
props: Yl,
|
|
2864
2906
|
setup(e) {
|
|
2865
2907
|
const t = r("editorId"), o = r("showToolbarName"), n = `${t}-toolbar-wrapper`, i = x(), s = x(), {
|
|
2866
2908
|
barRender: c
|
|
2867
|
-
} =
|
|
2868
|
-
const m = e.toolbars.filter((
|
|
2869
|
-
return [
|
|
2909
|
+
} = Ze(), u = K(() => {
|
|
2910
|
+
const m = e.toolbars.filter((f) => !e.toolbarsExclude.includes(f)), v = m.indexOf("="), b = v === -1 ? m : m.slice(0, v + 1), h = v === -1 ? [] : m.slice(v, Number.MAX_SAFE_INTEGER);
|
|
2911
|
+
return [b, h];
|
|
2870
2912
|
});
|
|
2871
|
-
return
|
|
2872
|
-
|
|
2913
|
+
return E(() => e.toolbars, () => {
|
|
2914
|
+
re(() => {
|
|
2873
2915
|
i.value && Lt(i.value);
|
|
2874
2916
|
});
|
|
2875
2917
|
}, {
|
|
2876
2918
|
immediate: !0
|
|
2877
2919
|
}), () => {
|
|
2878
|
-
const m = u.value[0].map((
|
|
2879
|
-
return l(
|
|
2920
|
+
const m = u.value[0].map((b) => c(b)), v = u.value[1].map((b) => c(b));
|
|
2921
|
+
return l(_e, null, [e.toolbars.length > 0 && l("div", {
|
|
2880
2922
|
class: `${a}-toolbar-wrapper`,
|
|
2881
2923
|
ref: i,
|
|
2882
2924
|
id: n
|
|
@@ -2887,59 +2929,59 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2887
2929
|
ref: s
|
|
2888
2930
|
}, [m]), l("div", {
|
|
2889
2931
|
class: `${a}-toolbar-right`
|
|
2890
|
-
}, [
|
|
2932
|
+
}, [v])])])]);
|
|
2891
2933
|
};
|
|
2892
2934
|
}
|
|
2893
|
-
}),
|
|
2935
|
+
}), be = /* @__PURE__ */ C({
|
|
2894
2936
|
name: "MdEditorV3",
|
|
2895
|
-
props:
|
|
2896
|
-
emits:
|
|
2937
|
+
props: ut,
|
|
2938
|
+
emits: ct,
|
|
2897
2939
|
setup(e, t) {
|
|
2898
2940
|
const {
|
|
2899
2941
|
noKatex: o,
|
|
2900
2942
|
noMermaid: n,
|
|
2901
2943
|
noHighlight: i
|
|
2902
|
-
} = e, s =
|
|
2944
|
+
} = e, s = U({
|
|
2903
2945
|
scrollAuto: e.scrollAuto
|
|
2904
|
-
}), c = x(), u = x(), m = K(() =>
|
|
2946
|
+
}), c = x(), u = x(), m = K(() => xe({
|
|
2905
2947
|
props: e,
|
|
2906
2948
|
ctx: t
|
|
2907
|
-
}, "defToolbars")),
|
|
2949
|
+
}, "defToolbars")), v = K(() => xe({
|
|
2908
2950
|
props: e,
|
|
2909
2951
|
ctx: t
|
|
2910
|
-
}, "defFooters")),
|
|
2911
|
-
editorId:
|
|
2912
|
-
}),
|
|
2913
|
-
editorId:
|
|
2952
|
+
}, "defFooters")), b = dt(e), [h, f] = mt(e, t, {
|
|
2953
|
+
editorId: b
|
|
2954
|
+
}), p = bt(e, {
|
|
2955
|
+
editorId: b
|
|
2914
2956
|
});
|
|
2915
|
-
return
|
|
2916
|
-
editorId:
|
|
2917
|
-
}),
|
|
2918
|
-
editorId:
|
|
2957
|
+
return vt(e, t, {
|
|
2958
|
+
editorId: b
|
|
2959
|
+
}), gt(e), ft(e, t, {
|
|
2960
|
+
editorId: b
|
|
2919
2961
|
}), ht(e, t, {
|
|
2920
|
-
editorId:
|
|
2921
|
-
catalogVisible:
|
|
2962
|
+
editorId: b,
|
|
2963
|
+
catalogVisible: p,
|
|
2922
2964
|
setting: h,
|
|
2923
|
-
updateSetting:
|
|
2965
|
+
updateSetting: f,
|
|
2924
2966
|
codeRef: u
|
|
2925
|
-
}),
|
|
2967
|
+
}), pt(e, {
|
|
2926
2968
|
rootRef: c,
|
|
2927
|
-
editorId:
|
|
2969
|
+
editorId: b,
|
|
2928
2970
|
setting: h,
|
|
2929
|
-
updateSetting:
|
|
2930
|
-
catalogVisible:
|
|
2971
|
+
updateSetting: f,
|
|
2972
|
+
catalogVisible: p,
|
|
2931
2973
|
defToolbars: m
|
|
2932
|
-
}),
|
|
2933
|
-
|
|
2974
|
+
}), ge(() => {
|
|
2975
|
+
g.clear(b);
|
|
2934
2976
|
}), () => l("div", {
|
|
2935
|
-
id:
|
|
2977
|
+
id: b,
|
|
2936
2978
|
class: [a, e.class, e.theme === "dark" && `${a}-dark`, h.fullscreen || h.pageFullscreen ? `${a}-fullscreen` : ""],
|
|
2937
2979
|
style: e.style,
|
|
2938
2980
|
ref: c
|
|
2939
|
-
}, [e.toolbars.length > 0 && l(
|
|
2981
|
+
}, [e.toolbars.length > 0 && l(Zl, {
|
|
2940
2982
|
toolbars: e.toolbars,
|
|
2941
2983
|
toolbarsExclude: e.toolbarsExclude
|
|
2942
|
-
}, null), l(
|
|
2984
|
+
}, null), l(Wl, {
|
|
2943
2985
|
ref: u,
|
|
2944
2986
|
modelValue: e.modelValue,
|
|
2945
2987
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2994,17 +3036,17 @@ const Ze = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
|
|
|
2994
3036
|
catalogLayout: e.catalogLayout,
|
|
2995
3037
|
catalogMaxDepth: e.catalogMaxDepth,
|
|
2996
3038
|
noEcharts: e.noEcharts
|
|
2997
|
-
}, null), e.footers.length > 0 && l(
|
|
3039
|
+
}, null), e.footers.length > 0 && l(jl, {
|
|
2998
3040
|
modelValue: e.modelValue,
|
|
2999
3041
|
footers: e.footers,
|
|
3000
|
-
defFooters:
|
|
3042
|
+
defFooters: v.value,
|
|
3001
3043
|
noScrollAuto: !h.preview && !h.htmlPreview || h.previewOnly,
|
|
3002
3044
|
scrollAuto: s.scrollAuto,
|
|
3003
3045
|
onScrollAutoChange: (T) => s.scrollAuto = T
|
|
3004
3046
|
}, null)]);
|
|
3005
3047
|
}
|
|
3006
3048
|
});
|
|
3007
|
-
|
|
3049
|
+
be.install = (e) => (e.component(be.name, be), e.use(yt).use(lt).use(wt).use(We).use(Tt), e);
|
|
3008
3050
|
export {
|
|
3009
|
-
|
|
3051
|
+
be as default
|
|
3010
3052
|
};
|