md-editor-v3 4.0.4-beta.0 → 4.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/cjs/MdEditor.cjs +30 -23
- package/lib/cjs/chunks/index.cjs +4 -4
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +811 -686
- package/lib/es/chunks/index.mjs +67 -49
- package/lib/es/index.mjs +15 -14
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/Editor.d.ts +6 -0
- package/lib/types/MdEditor/index.d.ts +12 -0
- package/lib/types/MdEditor/layouts/Content/codemirror/autocompletion.d.ts +3 -0
- package/lib/types/MdEditor/layouts/Content/index.d.ts +6 -0
- package/lib/types/MdEditor/layouts/Content/props.d.ts +4 -0
- package/lib/types/MdEditor/props.d.ts +14 -0
- package/lib/umd/index.js +62 -55
- package/package.json +1 -1
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
var Ze = Object.defineProperty;
|
|
2
|
-
var Je = (e, o,
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { p as
|
|
6
|
-
import { a as
|
|
2
|
+
var Je = (e, o, a) => o in e ? Ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[o] = a;
|
|
3
|
+
var q = (e, o, a) => (Je(e, typeof o != "symbol" ? o + "" : o, a), a);
|
|
4
|
+
import { defineComponent as O, createVNode as t, inject as A, ref as U, onMounted as W, reactive as Z, computed as fe, watch as I, nextTick as me, Fragment as Ke, toRef as ne, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
|
|
5
|
+
import { p as n, a as _, s as et, b as tt, d as lt } from "./chunks/config.mjs";
|
|
6
|
+
import { a as ee, D as ot } from "./chunks/index2.mjs";
|
|
7
7
|
import { b as h, a as at } from "./chunks/index4.mjs";
|
|
8
|
-
import { linkTo as nt, debounce as rt, throttle as it, smoothScroll as
|
|
9
|
-
import { C as st, a as ct, O as je, T as dt, b as ut, e as mt, c as ft, u as gt, d as ht, f as bt, g as vt, h as
|
|
8
|
+
import { linkTo as nt, debounce as rt, throttle as it, smoothScroll as Ee } from "@vavt/util";
|
|
9
|
+
import { C as st, a as ct, O as je, T as dt, b as ut, e as mt, c as ft, u as gt, d as ht, f as bt, g as vt, h as pt, i as kt, M as Ct } from "./chunks/index.mjs";
|
|
10
10
|
import { a as $t } from "./chunks/dom.mjs";
|
|
11
11
|
import { a as _e, M as yt } from "./chunks/index3.mjs";
|
|
12
|
-
import { minimalSetup as xt, EditorView as
|
|
13
|
-
import { EditorView as
|
|
12
|
+
import { minimalSetup as xt, EditorView as re } from "codemirror";
|
|
13
|
+
import { EditorView as ge, placeholder as wt, keymap as Tt } from "@codemirror/view";
|
|
14
14
|
import { languages as St } from "@codemirror/language-data";
|
|
15
15
|
import { markdown as At } from "@codemirror/lang-markdown";
|
|
16
16
|
import { deleteLine as Mt, indentWithTab as Lt, undo as Dt, redo as Et } from "@codemirror/commands";
|
|
17
17
|
import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Ht } from "@codemirror/language";
|
|
18
|
-
import { tags as
|
|
19
|
-
import { EditorSelection as
|
|
20
|
-
import {
|
|
18
|
+
import { tags as s } from "@lezer/highlight";
|
|
19
|
+
import { EditorSelection as Y, EditorState as se, Compartment as Bt, StateEffect as Ft } from "@codemirror/state";
|
|
20
|
+
import { autocompletion as It } from "@codemirror/autocomplete";
|
|
21
|
+
import { g as He } from "./chunks/vue-tsx.mjs";
|
|
21
22
|
import Ye from "./MdCatalog.mjs";
|
|
22
|
-
import
|
|
23
|
+
import Ot from "./NormalToolbar.mjs";
|
|
23
24
|
import "medium-zoom";
|
|
24
25
|
import "copy-to-clipboard";
|
|
25
26
|
import "markdown-it";
|
|
26
27
|
import "markdown-it-image-figures";
|
|
27
28
|
import "markdown-it-task-lists";
|
|
28
29
|
import "lru-cache";
|
|
29
|
-
const
|
|
30
|
+
const Vt = /* @__PURE__ */ O({
|
|
30
31
|
setup() {
|
|
31
32
|
return () => t("div", {
|
|
32
|
-
class: `${
|
|
33
|
+
class: `${n}-divider`
|
|
33
34
|
}, null);
|
|
34
35
|
}
|
|
35
|
-
}),
|
|
36
|
+
}), Rt = {
|
|
36
37
|
noPrettier: {
|
|
37
38
|
type: Boolean
|
|
38
39
|
},
|
|
@@ -73,30 +74,30 @@ const Ot = /* @__PURE__ */ B({
|
|
|
73
74
|
noUploadImg: {
|
|
74
75
|
type: Boolean
|
|
75
76
|
}
|
|
76
|
-
},
|
|
77
|
-
var f,
|
|
78
|
-
const o =
|
|
79
|
-
let
|
|
80
|
-
const l = (
|
|
81
|
-
if (!
|
|
77
|
+
}, Nt = (e) => {
|
|
78
|
+
var f, u, d, p;
|
|
79
|
+
const o = A("editorId");
|
|
80
|
+
let a = (u = (f = _.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : u.instance;
|
|
81
|
+
const l = (p = (d = _.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : p.js, i = U(!1), r = ($) => {
|
|
82
|
+
if (!a) {
|
|
82
83
|
h.emit(o, "errorCatcher", {
|
|
83
84
|
name: "fullscreen",
|
|
84
85
|
message: "fullscreen is undefined"
|
|
85
86
|
});
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
+
a.isEnabled ? (i.value = !0, ($ === void 0 ? !a.isFullscreen : $) ? a.request() : a.exit()) : console.error("browser does not support screenfull!");
|
|
89
90
|
}, c = () => {
|
|
90
|
-
|
|
91
|
-
(
|
|
91
|
+
a && a.isEnabled && a.on("change", () => {
|
|
92
|
+
(i.value || e.setting.fullscreen) && (i.value = !1, e.updateSetting("fullscreen"));
|
|
92
93
|
});
|
|
93
|
-
},
|
|
94
|
-
|
|
94
|
+
}, m = () => {
|
|
95
|
+
a = window.screenfull, c();
|
|
95
96
|
};
|
|
96
97
|
return W(() => {
|
|
97
|
-
if (c(), !
|
|
98
|
+
if (c(), !a) {
|
|
98
99
|
const $ = document.createElement("script");
|
|
99
|
-
$.src = l || et, $.onload =
|
|
100
|
+
$.src = l || et, $.onload = m, $.id = `${n}-screenfull`, $t($, "screenfull");
|
|
100
101
|
}
|
|
101
102
|
}), W(() => {
|
|
102
103
|
h.on(o, {
|
|
@@ -104,7 +105,7 @@ const Ot = /* @__PURE__ */ B({
|
|
|
104
105
|
callback: r
|
|
105
106
|
});
|
|
106
107
|
}), { fullscreenHandler: r };
|
|
107
|
-
},
|
|
108
|
+
}, Pt = {
|
|
108
109
|
tableShape: {
|
|
109
110
|
type: Array,
|
|
110
111
|
default: () => [6, 4]
|
|
@@ -114,24 +115,24 @@ const Ot = /* @__PURE__ */ B({
|
|
|
114
115
|
default: () => {
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
},
|
|
118
|
+
}, qt = /* @__PURE__ */ O({
|
|
118
119
|
name: "TableShape",
|
|
119
|
-
props:
|
|
120
|
+
props: Pt,
|
|
120
121
|
setup(e) {
|
|
121
|
-
const o =
|
|
122
|
+
const o = Z({
|
|
122
123
|
x: -1,
|
|
123
124
|
y: -1
|
|
124
125
|
});
|
|
125
126
|
return () => t("div", {
|
|
126
|
-
class: `${
|
|
127
|
+
class: `${n}-table-shape`,
|
|
127
128
|
onMouseleave: () => {
|
|
128
129
|
o.x = -1, o.y = -1;
|
|
129
130
|
}
|
|
130
|
-
}, [new Array(e.tableShape[1]).fill("").map((
|
|
131
|
-
class: `${
|
|
131
|
+
}, [new Array(e.tableShape[1]).fill("").map((a, l) => t("div", {
|
|
132
|
+
class: `${n}-table-shape-row`,
|
|
132
133
|
key: `table-shape-row-${l}`
|
|
133
|
-
}, [new Array(e.tableShape[0]).fill("").map((
|
|
134
|
-
class: `${
|
|
134
|
+
}, [new Array(e.tableShape[0]).fill("").map((i, r) => t("div", {
|
|
135
|
+
class: `${n}-table-shape-col`,
|
|
135
136
|
key: `table-shape-col-${r}`,
|
|
136
137
|
onMouseenter: () => {
|
|
137
138
|
o.x = l, o.y = r;
|
|
@@ -140,10 +141,10 @@ const Ot = /* @__PURE__ */ B({
|
|
|
140
141
|
e.onSelected(o);
|
|
141
142
|
}
|
|
142
143
|
}, [t("div", {
|
|
143
|
-
class: [`${
|
|
144
|
+
class: [`${n}-table-shape-col-default`, l <= o.x && r <= o.y && `${n}-table-shape-col-include`]
|
|
144
145
|
}, null)]))]))]);
|
|
145
146
|
}
|
|
146
|
-
}), Ut =
|
|
147
|
+
}), Ut = qt, Gt = {
|
|
147
148
|
type: {
|
|
148
149
|
type: String,
|
|
149
150
|
default: "link"
|
|
@@ -162,10 +163,10 @@ const Ot = /* @__PURE__ */ B({
|
|
|
162
163
|
default: () => {
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
|
-
},
|
|
166
|
-
props:
|
|
166
|
+
}, Kt = /* @__PURE__ */ O({
|
|
167
|
+
props: Gt,
|
|
167
168
|
setup(e) {
|
|
168
|
-
const o =
|
|
169
|
+
const o = A("usedLanguageText"), a = A("editorId"), l = fe(() => {
|
|
169
170
|
var r, c;
|
|
170
171
|
switch (e.type) {
|
|
171
172
|
case "link":
|
|
@@ -175,13 +176,13 @@ const Ot = /* @__PURE__ */ B({
|
|
|
175
176
|
default:
|
|
176
177
|
return "";
|
|
177
178
|
}
|
|
178
|
-
}),
|
|
179
|
+
}), i = Z({
|
|
179
180
|
desc: "",
|
|
180
181
|
url: ""
|
|
181
182
|
});
|
|
182
183
|
return I(() => e.visible, (r) => {
|
|
183
184
|
r || setTimeout(() => {
|
|
184
|
-
|
|
185
|
+
i.desc = "", i.url = "";
|
|
185
186
|
}, 200);
|
|
186
187
|
}), () => t(_e, {
|
|
187
188
|
title: l.value,
|
|
@@ -189,50 +190,50 @@ const Ot = /* @__PURE__ */ B({
|
|
|
189
190
|
onClose: e.onCancel
|
|
190
191
|
}, {
|
|
191
192
|
default: () => {
|
|
192
|
-
var r, c,
|
|
193
|
+
var r, c, m, f, u;
|
|
193
194
|
return [t("div", {
|
|
194
|
-
class: `${
|
|
195
|
+
class: `${n}-form-item`
|
|
195
196
|
}, [t("label", {
|
|
196
|
-
class: `${
|
|
197
|
-
for: `link-desc-${
|
|
197
|
+
class: `${n}-label`,
|
|
198
|
+
for: `link-desc-${a}`
|
|
198
199
|
}, [(r = o.value.linkModalTips) == null ? void 0 : r.descLabel]), t("input", {
|
|
199
200
|
placeholder: (c = o.value.linkModalTips) == null ? void 0 : c.descLabelPlaceHolder,
|
|
200
|
-
class: `${
|
|
201
|
-
id: `link-desc-${
|
|
201
|
+
class: `${n}-input`,
|
|
202
|
+
id: `link-desc-${a}`,
|
|
202
203
|
type: "text",
|
|
203
|
-
value:
|
|
204
|
-
onChange: (
|
|
205
|
-
|
|
204
|
+
value: i.desc,
|
|
205
|
+
onChange: (d) => {
|
|
206
|
+
i.desc = d.target.value;
|
|
206
207
|
},
|
|
207
208
|
autocomplete: "off"
|
|
208
209
|
}, null)]), t("div", {
|
|
209
|
-
class: `${
|
|
210
|
+
class: `${n}-form-item`
|
|
210
211
|
}, [t("label", {
|
|
211
|
-
class: `${
|
|
212
|
-
for: `link-url-${
|
|
213
|
-
}, [(
|
|
212
|
+
class: `${n}-label`,
|
|
213
|
+
for: `link-url-${a}`
|
|
214
|
+
}, [(m = o.value.linkModalTips) == null ? void 0 : m.urlLabel]), t("input", {
|
|
214
215
|
placeholder: (f = o.value.linkModalTips) == null ? void 0 : f.urlLabelPlaceHolder,
|
|
215
|
-
class: `${
|
|
216
|
-
id: `link-url-${
|
|
216
|
+
class: `${n}-input`,
|
|
217
|
+
id: `link-url-${a}`,
|
|
217
218
|
type: "text",
|
|
218
|
-
value:
|
|
219
|
-
onChange: (
|
|
220
|
-
|
|
219
|
+
value: i.url,
|
|
220
|
+
onChange: (d) => {
|
|
221
|
+
i.url = d.target.value;
|
|
221
222
|
},
|
|
222
223
|
autocomplete: "off"
|
|
223
224
|
}, null)]), t("div", {
|
|
224
|
-
class: `${
|
|
225
|
+
class: `${n}-form-item`
|
|
225
226
|
}, [t("button", {
|
|
226
|
-
class: [`${
|
|
227
|
+
class: [`${n}-btn`, `${n}-btn-row`],
|
|
227
228
|
type: "button",
|
|
228
229
|
onClick: () => {
|
|
229
|
-
e.onOk(
|
|
230
|
+
e.onOk(i), i.desc = "", i.url = "";
|
|
230
231
|
}
|
|
231
|
-
}, [(
|
|
232
|
+
}, [(u = o.value.linkModalTips) == null ? void 0 : u.buttonOK])])];
|
|
232
233
|
}
|
|
233
234
|
});
|
|
234
235
|
}
|
|
235
|
-
}),
|
|
236
|
+
}), jt = {
|
|
236
237
|
visible: {
|
|
237
238
|
type: Boolean,
|
|
238
239
|
default: !1
|
|
@@ -247,13 +248,13 @@ const Ot = /* @__PURE__ */ B({
|
|
|
247
248
|
default: () => {
|
|
248
249
|
}
|
|
249
250
|
}
|
|
250
|
-
},
|
|
251
|
-
props:
|
|
251
|
+
}, _t = /* @__PURE__ */ O({
|
|
252
|
+
props: jt,
|
|
252
253
|
setup(e) {
|
|
253
|
-
var
|
|
254
|
-
const o =
|
|
255
|
-
let l = ($ = (
|
|
256
|
-
const
|
|
254
|
+
var d, p, $;
|
|
255
|
+
const o = A("usedLanguageText"), a = A("editorId");
|
|
256
|
+
let l = ($ = (p = (d = _) == null ? void 0 : d.editorExtensions) == null ? void 0 : p.cropper) == null ? void 0 : $.instance;
|
|
257
|
+
const i = U(), r = U(), c = U(), m = Z({
|
|
257
258
|
cropperInited: !1,
|
|
258
259
|
imgSelected: !1,
|
|
259
260
|
imgSrc: "",
|
|
@@ -262,108 +263,108 @@ const Ot = /* @__PURE__ */ B({
|
|
|
262
263
|
});
|
|
263
264
|
let f = null;
|
|
264
265
|
I(() => e.visible, () => {
|
|
265
|
-
e.visible && !
|
|
266
|
+
e.visible && !m.cropperInited && (l = l || window.Cropper, i.value.onchange = () => {
|
|
266
267
|
if (!l) {
|
|
267
|
-
h.emit(
|
|
268
|
+
h.emit(a, "errorCatcher", {
|
|
268
269
|
name: "Cropper",
|
|
269
270
|
message: "Cropper is undefined"
|
|
270
271
|
});
|
|
271
272
|
return;
|
|
272
273
|
}
|
|
273
|
-
const b =
|
|
274
|
-
if (
|
|
274
|
+
const b = i.value.files || [];
|
|
275
|
+
if (m.imgSelected = !0, (b == null ? void 0 : b.length) > 0) {
|
|
275
276
|
const v = new FileReader();
|
|
276
|
-
v.onload = (
|
|
277
|
-
|
|
277
|
+
v.onload = (g) => {
|
|
278
|
+
m.imgSrc = g.target.result, me(() => {
|
|
278
279
|
f = new l(r.value, {
|
|
279
280
|
viewMode: 2,
|
|
280
|
-
preview: `.${
|
|
281
|
+
preview: `.${n}-clip-preview-target`
|
|
281
282
|
// aspectRatio: 16 / 9,
|
|
282
283
|
});
|
|
283
284
|
});
|
|
284
285
|
}, v.readAsDataURL(b[0]);
|
|
285
286
|
}
|
|
286
287
|
});
|
|
287
|
-
}), I(() => [
|
|
288
|
+
}), I(() => [m.imgSelected], () => {
|
|
288
289
|
c.value.style = "";
|
|
289
|
-
}), I(() =>
|
|
290
|
-
|
|
290
|
+
}), I(() => m.isFullscreen, () => {
|
|
291
|
+
me(() => {
|
|
291
292
|
f == null || f.destroy(), c.value.style = "", r.value && (f = new l(r.value, {
|
|
292
293
|
viewMode: 2,
|
|
293
|
-
preview: `.${
|
|
294
|
+
preview: `.${n}-clip-preview-target`
|
|
294
295
|
// aspectRatio: 16 / 9,
|
|
295
296
|
}));
|
|
296
297
|
});
|
|
297
298
|
});
|
|
298
|
-
const
|
|
299
|
-
f.clear(), f.destroy(), f = null,
|
|
299
|
+
const u = () => {
|
|
300
|
+
f.clear(), f.destroy(), f = null, i.value.value = "", m.imgSelected = !1;
|
|
300
301
|
};
|
|
301
302
|
return () => {
|
|
302
303
|
var b;
|
|
303
304
|
return t(_e, {
|
|
304
|
-
class: `${
|
|
305
|
+
class: `${n}-modal-clip`,
|
|
305
306
|
title: (b = o.value.clipModalTips) == null ? void 0 : b.title,
|
|
306
307
|
visible: e.visible,
|
|
307
308
|
onClose: e.onCancel,
|
|
308
309
|
showAdjust: !0,
|
|
309
|
-
isFullscreen:
|
|
310
|
+
isFullscreen: m.isFullscreen,
|
|
310
311
|
onAdjust: (v) => {
|
|
311
|
-
|
|
312
|
+
m.isFullscreen = v;
|
|
312
313
|
},
|
|
313
314
|
width: "668px",
|
|
314
315
|
height: "421px"
|
|
315
316
|
}, {
|
|
316
317
|
default: () => {
|
|
317
|
-
var v,
|
|
318
|
+
var v, g;
|
|
318
319
|
return [t("div", {
|
|
319
|
-
class: `${
|
|
320
|
+
class: `${n}-form-item ${n}-clip`
|
|
320
321
|
}, [t("div", {
|
|
321
|
-
class: `${
|
|
322
|
-
}, [
|
|
323
|
-
class: `${
|
|
322
|
+
class: `${n}-clip-main`
|
|
323
|
+
}, [m.imgSelected ? t("div", {
|
|
324
|
+
class: `${n}-clip-cropper`
|
|
324
325
|
}, [t("img", {
|
|
325
|
-
src:
|
|
326
|
+
src: m.imgSrc,
|
|
326
327
|
ref: r,
|
|
327
328
|
style: {
|
|
328
329
|
display: "none"
|
|
329
330
|
},
|
|
330
331
|
alt: ""
|
|
331
332
|
}, null), t("div", {
|
|
332
|
-
class: `${
|
|
333
|
-
onClick:
|
|
333
|
+
class: `${n}-clip-delete`,
|
|
334
|
+
onClick: u
|
|
334
335
|
}, [t("svg", {
|
|
335
|
-
class: `${
|
|
336
|
+
class: `${n}-icon`,
|
|
336
337
|
"aria-hidden": "true"
|
|
337
338
|
}, [t("use", {
|
|
338
339
|
"xlink:href": "#md-editor-icon-delete"
|
|
339
340
|
}, null)])])]) : t("div", {
|
|
340
|
-
class: `${
|
|
341
|
+
class: `${n}-clip-upload`,
|
|
341
342
|
onClick: () => {
|
|
342
|
-
|
|
343
|
+
i.value.click();
|
|
343
344
|
}
|
|
344
345
|
}, [t("svg", {
|
|
345
|
-
class: `${
|
|
346
|
+
class: `${n}-icon`,
|
|
346
347
|
"aria-hidden": "true"
|
|
347
348
|
}, [t("use", {
|
|
348
349
|
"xlink:href": "#md-editor-icon-upload"
|
|
349
350
|
}, null)])])]), t("div", {
|
|
350
|
-
class: `${
|
|
351
|
+
class: `${n}-clip-preview`
|
|
351
352
|
}, [t("div", {
|
|
352
|
-
class: `${
|
|
353
|
+
class: `${n}-clip-preview-target`,
|
|
353
354
|
ref: c
|
|
354
355
|
}, null)])]), t("div", {
|
|
355
|
-
class: `${
|
|
356
|
+
class: `${n}-form-item`
|
|
356
357
|
}, [t("button", {
|
|
357
|
-
class: `${
|
|
358
|
+
class: `${n}-btn`,
|
|
358
359
|
type: "button",
|
|
359
360
|
onClick: () => {
|
|
360
361
|
if (f) {
|
|
361
362
|
const y = f.getCroppedCanvas();
|
|
362
|
-
h.emit(
|
|
363
|
+
h.emit(a, "uploadImage", [at(y.toDataURL("image/png"))], e.onOk), u();
|
|
363
364
|
}
|
|
364
365
|
}
|
|
365
|
-
}, [((v = o.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((
|
|
366
|
-
ref:
|
|
366
|
+
}, [((v = o.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((g = o.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
|
|
367
|
+
ref: i,
|
|
367
368
|
accept: "image/*",
|
|
368
369
|
type: "file",
|
|
369
370
|
multiple: !1,
|
|
@@ -375,7 +376,7 @@ const Ot = /* @__PURE__ */ B({
|
|
|
375
376
|
});
|
|
376
377
|
};
|
|
377
378
|
}
|
|
378
|
-
}),
|
|
379
|
+
}), Wt = {
|
|
379
380
|
type: {
|
|
380
381
|
type: String,
|
|
381
382
|
default: "link"
|
|
@@ -398,27 +399,27 @@ const Ot = /* @__PURE__ */ B({
|
|
|
398
399
|
default: () => {
|
|
399
400
|
}
|
|
400
401
|
}
|
|
401
|
-
},
|
|
402
|
-
props:
|
|
402
|
+
}, zt = /* @__PURE__ */ O({
|
|
403
|
+
props: Wt,
|
|
403
404
|
setup(e) {
|
|
404
|
-
return () => t(Ke, null, [t(
|
|
405
|
+
return () => t(Ke, null, [t(Kt, {
|
|
405
406
|
type: e.type,
|
|
406
407
|
visible: e.linkVisible,
|
|
407
408
|
onOk: e.onOk,
|
|
408
409
|
onCancel: e.onCancel
|
|
409
|
-
}, null), t(
|
|
410
|
+
}, null), t(_t, {
|
|
410
411
|
visible: e.clipVisible,
|
|
411
412
|
onOk: e.onOk,
|
|
412
413
|
onCancel: e.onCancel
|
|
413
414
|
}, null)]);
|
|
414
415
|
}
|
|
415
|
-
}),
|
|
416
|
+
}), Yt = /* @__PURE__ */ O({
|
|
416
417
|
name: "MDEditorToolbar",
|
|
417
|
-
props:
|
|
418
|
+
props: Rt,
|
|
418
419
|
setup(e) {
|
|
419
|
-
const o =
|
|
420
|
+
const o = A("editorId"), a = A("usedLanguageText"), {
|
|
420
421
|
fullscreenHandler: l
|
|
421
|
-
} =
|
|
422
|
+
} = Nt(e), i = `${o}-toolbar-wrapper`, r = Z({
|
|
422
423
|
title: !1,
|
|
423
424
|
catalog: !1,
|
|
424
425
|
// 图片上传下拉
|
|
@@ -430,137 +431,137 @@ const Ot = /* @__PURE__ */ B({
|
|
|
430
431
|
katex: !1
|
|
431
432
|
}), c = (b, v) => {
|
|
432
433
|
h.emit(o, "replace", b, v);
|
|
433
|
-
},
|
|
434
|
+
}, m = Z({
|
|
434
435
|
type: "link",
|
|
435
436
|
linkVisible: !1,
|
|
436
437
|
clipVisible: !1
|
|
437
|
-
}), f =
|
|
438
|
+
}), f = U();
|
|
438
439
|
W(() => {
|
|
439
440
|
h.on(o, {
|
|
440
441
|
name: "openModals",
|
|
441
442
|
callback(b) {
|
|
442
|
-
|
|
443
|
+
m.type = b, m.linkVisible = !0;
|
|
443
444
|
}
|
|
444
445
|
});
|
|
445
446
|
});
|
|
446
|
-
const
|
|
447
|
-
const b = e.toolbars.filter((x) => !e.toolbarsExclude.includes(x)), v = b.indexOf("="),
|
|
448
|
-
return [
|
|
449
|
-
}),
|
|
450
|
-
h.emit(o, "uploadImage", Array.from(
|
|
447
|
+
const u = fe(() => {
|
|
448
|
+
const b = e.toolbars.filter((x) => !e.toolbarsExclude.includes(x)), v = b.indexOf("="), g = v === -1 ? b : b.slice(0, v + 1), y = v === -1 ? [] : b.slice(v, Number.MAX_SAFE_INTEGER);
|
|
449
|
+
return [g, y];
|
|
450
|
+
}), d = U(), p = () => {
|
|
451
|
+
h.emit(o, "uploadImage", Array.from(d.value.files || [])), d.value.value = "";
|
|
451
452
|
};
|
|
452
453
|
W(() => {
|
|
453
|
-
|
|
454
|
+
d.value.addEventListener("change", p);
|
|
454
455
|
});
|
|
455
456
|
const $ = (b) => {
|
|
456
|
-
var v,
|
|
457
|
+
var v, g, y, x, T, w, M, k, S, R, L, D, V, B, E, G, N, oe, J, K, P, X, j, H, F, Q, ae, he, be, ve, pe, ke, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le, De;
|
|
457
458
|
if (tt.includes(b))
|
|
458
459
|
switch (b) {
|
|
459
460
|
case "-":
|
|
460
|
-
return t(
|
|
461
|
+
return t(Vt, null, null);
|
|
461
462
|
case "bold":
|
|
462
463
|
return t("div", {
|
|
463
|
-
class: `${
|
|
464
|
-
title: (v =
|
|
464
|
+
class: `${n}-toolbar-item`,
|
|
465
|
+
title: (v = a.value.toolbarTips) == null ? void 0 : v.bold,
|
|
465
466
|
onClick: () => {
|
|
466
467
|
c("bold");
|
|
467
468
|
}
|
|
468
469
|
}, [t("svg", {
|
|
469
|
-
class: `${
|
|
470
|
+
class: `${n}-icon`,
|
|
470
471
|
"aria-hidden": "true"
|
|
471
472
|
}, [t("use", {
|
|
472
473
|
"xlink:href": "#md-editor-icon-bold"
|
|
473
474
|
}, null)])]);
|
|
474
475
|
case "underline":
|
|
475
476
|
return t("div", {
|
|
476
|
-
class: `${
|
|
477
|
-
title: (
|
|
477
|
+
class: `${n}-toolbar-item`,
|
|
478
|
+
title: (g = a.value.toolbarTips) == null ? void 0 : g.underline,
|
|
478
479
|
onClick: () => {
|
|
479
480
|
c("underline");
|
|
480
481
|
}
|
|
481
482
|
}, [t("svg", {
|
|
482
|
-
class: `${
|
|
483
|
+
class: `${n}-icon`,
|
|
483
484
|
"aria-hidden": "true"
|
|
484
485
|
}, [t("use", {
|
|
485
486
|
"xlink:href": "#md-editor-icon-underline"
|
|
486
487
|
}, null)])]);
|
|
487
488
|
case "italic":
|
|
488
489
|
return t("div", {
|
|
489
|
-
class: `${
|
|
490
|
-
title: (y =
|
|
490
|
+
class: `${n}-toolbar-item`,
|
|
491
|
+
title: (y = a.value.toolbarTips) == null ? void 0 : y.italic,
|
|
491
492
|
onClick: () => {
|
|
492
493
|
c("italic");
|
|
493
494
|
}
|
|
494
495
|
}, [t("svg", {
|
|
495
|
-
class: `${
|
|
496
|
+
class: `${n}-icon`,
|
|
496
497
|
"aria-hidden": "true"
|
|
497
498
|
}, [t("use", {
|
|
498
499
|
"xlink:href": "#md-editor-icon-italic"
|
|
499
500
|
}, null)])]);
|
|
500
501
|
case "strikeThrough":
|
|
501
502
|
return t("div", {
|
|
502
|
-
class: `${
|
|
503
|
-
title: (x =
|
|
503
|
+
class: `${n}-toolbar-item`,
|
|
504
|
+
title: (x = a.value.toolbarTips) == null ? void 0 : x.strikeThrough,
|
|
504
505
|
onClick: () => {
|
|
505
506
|
c("strikeThrough");
|
|
506
507
|
}
|
|
507
508
|
}, [t("svg", {
|
|
508
|
-
class: `${
|
|
509
|
+
class: `${n}-icon`,
|
|
509
510
|
"aria-hidden": "true"
|
|
510
511
|
}, [t("use", {
|
|
511
512
|
"xlink:href": "#md-editor-icon-strike-through"
|
|
512
513
|
}, null)])]);
|
|
513
514
|
case "title":
|
|
514
|
-
return t(
|
|
515
|
-
relative: `#${
|
|
515
|
+
return t(ee, {
|
|
516
|
+
relative: `#${i}`,
|
|
516
517
|
visible: r.title,
|
|
517
518
|
onChange: (C) => {
|
|
518
519
|
r.title = C;
|
|
519
520
|
},
|
|
520
521
|
overlay: t("ul", {
|
|
521
|
-
class: `${
|
|
522
|
+
class: `${n}-menu`,
|
|
522
523
|
onClick: () => {
|
|
523
524
|
r.title = !1;
|
|
524
525
|
}
|
|
525
526
|
}, [t("li", {
|
|
526
|
-
class: `${
|
|
527
|
+
class: `${n}-menu-item`,
|
|
527
528
|
onClick: () => {
|
|
528
529
|
c("h1");
|
|
529
530
|
}
|
|
530
|
-
}, [(T =
|
|
531
|
-
class: `${
|
|
531
|
+
}, [(T = a.value.titleItem) == null ? void 0 : T.h1]), t("li", {
|
|
532
|
+
class: `${n}-menu-item`,
|
|
532
533
|
onClick: () => {
|
|
533
534
|
c("h2");
|
|
534
535
|
}
|
|
535
|
-
}, [(w =
|
|
536
|
-
class: `${
|
|
536
|
+
}, [(w = a.value.titleItem) == null ? void 0 : w.h2]), t("li", {
|
|
537
|
+
class: `${n}-menu-item`,
|
|
537
538
|
onClick: () => {
|
|
538
539
|
c("h3");
|
|
539
540
|
}
|
|
540
|
-
}, [(
|
|
541
|
-
class: `${
|
|
541
|
+
}, [(M = a.value.titleItem) == null ? void 0 : M.h3]), t("li", {
|
|
542
|
+
class: `${n}-menu-item`,
|
|
542
543
|
onClick: () => {
|
|
543
544
|
c("h4");
|
|
544
545
|
}
|
|
545
|
-
}, [(
|
|
546
|
-
class: `${
|
|
546
|
+
}, [(k = a.value.titleItem) == null ? void 0 : k.h4]), t("li", {
|
|
547
|
+
class: `${n}-menu-item`,
|
|
547
548
|
onClick: () => {
|
|
548
549
|
c("h5");
|
|
549
550
|
}
|
|
550
|
-
}, [(
|
|
551
|
-
class: `${
|
|
551
|
+
}, [(S = a.value.titleItem) == null ? void 0 : S.h5]), t("li", {
|
|
552
|
+
class: `${n}-menu-item`,
|
|
552
553
|
onClick: () => {
|
|
553
554
|
c("h6");
|
|
554
555
|
}
|
|
555
|
-
}, [(R =
|
|
556
|
+
}, [(R = a.value.titleItem) == null ? void 0 : R.h6])])
|
|
556
557
|
}, {
|
|
557
558
|
default: () => {
|
|
558
559
|
var C;
|
|
559
560
|
return [t("div", {
|
|
560
|
-
class: `${
|
|
561
|
-
title: (C =
|
|
561
|
+
class: `${n}-toolbar-item`,
|
|
562
|
+
title: (C = a.value.toolbarTips) == null ? void 0 : C.title
|
|
562
563
|
}, [t("svg", {
|
|
563
|
-
class: `${
|
|
564
|
+
class: `${n}-icon`,
|
|
564
565
|
"aria-hidden": "true"
|
|
565
566
|
}, [t("use", {
|
|
566
567
|
"xlink:href": "#md-editor-icon-title"
|
|
@@ -569,168 +570,168 @@ const Ot = /* @__PURE__ */ B({
|
|
|
569
570
|
});
|
|
570
571
|
case "sub":
|
|
571
572
|
return t("div", {
|
|
572
|
-
class: `${
|
|
573
|
-
title: (L =
|
|
573
|
+
class: `${n}-toolbar-item`,
|
|
574
|
+
title: (L = a.value.toolbarTips) == null ? void 0 : L.sub,
|
|
574
575
|
onClick: () => {
|
|
575
576
|
c("sub");
|
|
576
577
|
}
|
|
577
578
|
}, [t("svg", {
|
|
578
|
-
class: `${
|
|
579
|
+
class: `${n}-icon`,
|
|
579
580
|
"aria-hidden": "true"
|
|
580
581
|
}, [t("use", {
|
|
581
582
|
"xlink:href": "#md-editor-icon-sub"
|
|
582
583
|
}, null)])]);
|
|
583
584
|
case "sup":
|
|
584
585
|
return t("div", {
|
|
585
|
-
class: `${
|
|
586
|
-
title: (D =
|
|
586
|
+
class: `${n}-toolbar-item`,
|
|
587
|
+
title: (D = a.value.toolbarTips) == null ? void 0 : D.sup,
|
|
587
588
|
onClick: () => {
|
|
588
589
|
c("sup");
|
|
589
590
|
}
|
|
590
591
|
}, [t("svg", {
|
|
591
|
-
class: `${
|
|
592
|
+
class: `${n}-icon`,
|
|
592
593
|
"aria-hidden": "true"
|
|
593
594
|
}, [t("use", {
|
|
594
595
|
"xlink:href": "#md-editor-icon-sup"
|
|
595
596
|
}, null)])]);
|
|
596
597
|
case "quote":
|
|
597
598
|
return t("div", {
|
|
598
|
-
class: `${
|
|
599
|
-
title: (
|
|
599
|
+
class: `${n}-toolbar-item`,
|
|
600
|
+
title: (V = a.value.toolbarTips) == null ? void 0 : V.quote,
|
|
600
601
|
onClick: () => {
|
|
601
602
|
c("quote");
|
|
602
603
|
}
|
|
603
604
|
}, [t("svg", {
|
|
604
|
-
class: `${
|
|
605
|
+
class: `${n}-icon`,
|
|
605
606
|
"aria-hidden": "true"
|
|
606
607
|
}, [t("use", {
|
|
607
608
|
"xlink:href": "#md-editor-icon-quote"
|
|
608
609
|
}, null)])]);
|
|
609
610
|
case "unorderedList":
|
|
610
611
|
return t("div", {
|
|
611
|
-
class: `${
|
|
612
|
-
title: (
|
|
612
|
+
class: `${n}-toolbar-item`,
|
|
613
|
+
title: (B = a.value.toolbarTips) == null ? void 0 : B.unorderedList,
|
|
613
614
|
onClick: () => {
|
|
614
615
|
c("unorderedList");
|
|
615
616
|
}
|
|
616
617
|
}, [t("svg", {
|
|
617
|
-
class: `${
|
|
618
|
+
class: `${n}-icon`,
|
|
618
619
|
"aria-hidden": "true"
|
|
619
620
|
}, [t("use", {
|
|
620
621
|
"xlink:href": "#md-editor-icon-unordered-list"
|
|
621
622
|
}, null)])]);
|
|
622
623
|
case "orderedList":
|
|
623
624
|
return t("div", {
|
|
624
|
-
class: `${
|
|
625
|
-
title: (E =
|
|
625
|
+
class: `${n}-toolbar-item`,
|
|
626
|
+
title: (E = a.value.toolbarTips) == null ? void 0 : E.orderedList,
|
|
626
627
|
onClick: () => {
|
|
627
628
|
c("orderedList");
|
|
628
629
|
}
|
|
629
630
|
}, [t("svg", {
|
|
630
|
-
class: `${
|
|
631
|
+
class: `${n}-icon`,
|
|
631
632
|
"aria-hidden": "true"
|
|
632
633
|
}, [t("use", {
|
|
633
634
|
"xlink:href": "#md-editor-icon-ordered-list"
|
|
634
635
|
}, null)])]);
|
|
635
636
|
case "task":
|
|
636
637
|
return t("div", {
|
|
637
|
-
class: `${
|
|
638
|
-
title: (
|
|
638
|
+
class: `${n}-toolbar-item`,
|
|
639
|
+
title: (G = a.value.toolbarTips) == null ? void 0 : G.task,
|
|
639
640
|
onClick: () => {
|
|
640
641
|
c("task");
|
|
641
642
|
}
|
|
642
643
|
}, [t("svg", {
|
|
643
|
-
class: `${
|
|
644
|
+
class: `${n}-icon`,
|
|
644
645
|
"aria-hidden": "true"
|
|
645
646
|
}, [t("use", {
|
|
646
647
|
"xlink:href": "#md-editor-icon-task"
|
|
647
648
|
}, null)])]);
|
|
648
649
|
case "codeRow":
|
|
649
650
|
return t("div", {
|
|
650
|
-
class: `${
|
|
651
|
-
title: (N =
|
|
651
|
+
class: `${n}-toolbar-item`,
|
|
652
|
+
title: (N = a.value.toolbarTips) == null ? void 0 : N.codeRow,
|
|
652
653
|
onClick: () => {
|
|
653
654
|
c("codeRow");
|
|
654
655
|
}
|
|
655
656
|
}, [t("svg", {
|
|
656
|
-
class: `${
|
|
657
|
+
class: `${n}-icon`,
|
|
657
658
|
"aria-hidden": "true"
|
|
658
659
|
}, [t("use", {
|
|
659
660
|
"xlink:href": "#md-editor-icon-code-row"
|
|
660
661
|
}, null)])]);
|
|
661
662
|
case "code":
|
|
662
663
|
return t("div", {
|
|
663
|
-
class: `${
|
|
664
|
-
title: (
|
|
664
|
+
class: `${n}-toolbar-item`,
|
|
665
|
+
title: (oe = a.value.toolbarTips) == null ? void 0 : oe.code,
|
|
665
666
|
onClick: () => {
|
|
666
667
|
c("code");
|
|
667
668
|
}
|
|
668
669
|
}, [t("svg", {
|
|
669
|
-
class: `${
|
|
670
|
+
class: `${n}-icon`,
|
|
670
671
|
"aria-hidden": "true"
|
|
671
672
|
}, [t("use", {
|
|
672
673
|
"xlink:href": "#md-editor-icon-code"
|
|
673
674
|
}, null)])]);
|
|
674
675
|
case "link":
|
|
675
676
|
return t("div", {
|
|
676
|
-
class: `${
|
|
677
|
-
title: (
|
|
677
|
+
class: `${n}-toolbar-item`,
|
|
678
|
+
title: (J = a.value.toolbarTips) == null ? void 0 : J.link,
|
|
678
679
|
onClick: () => {
|
|
679
|
-
|
|
680
|
+
m.type = "link", m.linkVisible = !0;
|
|
680
681
|
}
|
|
681
682
|
}, [t("svg", {
|
|
682
|
-
class: `${
|
|
683
|
+
class: `${n}-icon`,
|
|
683
684
|
"aria-hidden": "true"
|
|
684
685
|
}, [t("use", {
|
|
685
686
|
"xlink:href": "#md-editor-icon-link"
|
|
686
687
|
}, null)])]);
|
|
687
688
|
case "image":
|
|
688
689
|
return e.noUploadImg ? t("div", {
|
|
689
|
-
class: `${
|
|
690
|
-
title: (
|
|
690
|
+
class: `${n}-toolbar-item`,
|
|
691
|
+
title: (K = a.value.toolbarTips) == null ? void 0 : K.image,
|
|
691
692
|
onClick: () => {
|
|
692
|
-
|
|
693
|
+
m.type = "image", m.linkVisible = !0;
|
|
693
694
|
}
|
|
694
695
|
}, [t("svg", {
|
|
695
|
-
class: `${
|
|
696
|
+
class: `${n}-icon`,
|
|
696
697
|
"aria-hidden": "true"
|
|
697
698
|
}, [t("use", {
|
|
698
699
|
"xlink:href": "#md-editor-icon-image"
|
|
699
|
-
}, null)])]) : t(
|
|
700
|
-
relative: `#${
|
|
700
|
+
}, null)])]) : t(ee, {
|
|
701
|
+
relative: `#${i}`,
|
|
701
702
|
visible: r.image,
|
|
702
703
|
onChange: (C) => {
|
|
703
704
|
r.image = C;
|
|
704
705
|
},
|
|
705
706
|
overlay: t("ul", {
|
|
706
|
-
class: `${
|
|
707
|
+
class: `${n}-menu`,
|
|
707
708
|
onClick: () => {
|
|
708
709
|
r.title = !1;
|
|
709
710
|
}
|
|
710
711
|
}, [t("li", {
|
|
711
|
-
class: `${
|
|
712
|
+
class: `${n}-menu-item`,
|
|
712
713
|
onClick: () => {
|
|
713
|
-
|
|
714
|
+
m.type = "image", m.linkVisible = !0;
|
|
714
715
|
}
|
|
715
|
-
}, [(P =
|
|
716
|
-
class: `${
|
|
716
|
+
}, [(P = a.value.imgTitleItem) == null ? void 0 : P.link]), t("li", {
|
|
717
|
+
class: `${n}-menu-item`,
|
|
717
718
|
onClick: () => {
|
|
718
|
-
|
|
719
|
+
d.value.click();
|
|
719
720
|
}
|
|
720
|
-
}, [(
|
|
721
|
-
class: `${
|
|
721
|
+
}, [(X = a.value.imgTitleItem) == null ? void 0 : X.upload]), t("li", {
|
|
722
|
+
class: `${n}-menu-item`,
|
|
722
723
|
onClick: () => {
|
|
723
|
-
|
|
724
|
+
m.clipVisible = !0;
|
|
724
725
|
}
|
|
725
|
-
}, [(
|
|
726
|
+
}, [(j = a.value.imgTitleItem) == null ? void 0 : j.clip2upload])])
|
|
726
727
|
}, {
|
|
727
728
|
default: () => {
|
|
728
729
|
var C;
|
|
729
730
|
return [t("div", {
|
|
730
|
-
class: `${
|
|
731
|
-
title: (C =
|
|
731
|
+
class: `${n}-toolbar-item`,
|
|
732
|
+
title: (C = a.value.toolbarTips) == null ? void 0 : C.image
|
|
732
733
|
}, [t("svg", {
|
|
733
|
-
class: `${
|
|
734
|
+
class: `${n}-icon`,
|
|
734
735
|
"aria-hidden": "true"
|
|
735
736
|
}, [t("use", {
|
|
736
737
|
"xlink:href": "#md-editor-icon-image"
|
|
@@ -738,8 +739,8 @@ const Ot = /* @__PURE__ */ B({
|
|
|
738
739
|
}
|
|
739
740
|
});
|
|
740
741
|
case "table":
|
|
741
|
-
return t(
|
|
742
|
-
relative: `#${
|
|
742
|
+
return t(ee, {
|
|
743
|
+
relative: `#${i}`,
|
|
743
744
|
visible: r.table,
|
|
744
745
|
onChange: (C) => {
|
|
745
746
|
r.table = C;
|
|
@@ -757,10 +758,10 @@ const Ot = /* @__PURE__ */ B({
|
|
|
757
758
|
default: () => {
|
|
758
759
|
var C;
|
|
759
760
|
return [t("div", {
|
|
760
|
-
class: `${
|
|
761
|
-
title: (C =
|
|
761
|
+
class: `${n}-toolbar-item`,
|
|
762
|
+
title: (C = a.value.toolbarTips) == null ? void 0 : C.table
|
|
762
763
|
}, [t("svg", {
|
|
763
|
-
class: `${
|
|
764
|
+
class: `${n}-icon`,
|
|
764
765
|
"aria-hidden": "true"
|
|
765
766
|
}, [t("use", {
|
|
766
767
|
"xlink:href": "#md-editor-icon-table"
|
|
@@ -769,195 +770,195 @@ const Ot = /* @__PURE__ */ B({
|
|
|
769
770
|
});
|
|
770
771
|
case "revoke":
|
|
771
772
|
return t("div", {
|
|
772
|
-
class: `${
|
|
773
|
-
title: (H =
|
|
773
|
+
class: `${n}-toolbar-item`,
|
|
774
|
+
title: (H = a.value.toolbarTips) == null ? void 0 : H.revoke,
|
|
774
775
|
onClick: () => {
|
|
775
776
|
h.emit(o, "ctrlZ");
|
|
776
777
|
}
|
|
777
778
|
}, [t("svg", {
|
|
778
|
-
class: `${
|
|
779
|
+
class: `${n}-icon`,
|
|
779
780
|
"aria-hidden": "true"
|
|
780
781
|
}, [t("use", {
|
|
781
782
|
"xlink:href": "#md-editor-icon-revoke"
|
|
782
783
|
}, null)])]);
|
|
783
784
|
case "next":
|
|
784
785
|
return t("div", {
|
|
785
|
-
class: `${
|
|
786
|
-
title: (
|
|
786
|
+
class: `${n}-toolbar-item`,
|
|
787
|
+
title: (F = a.value.toolbarTips) == null ? void 0 : F.next,
|
|
787
788
|
onClick: () => {
|
|
788
789
|
h.emit(o, "ctrlShiftZ");
|
|
789
790
|
}
|
|
790
791
|
}, [t("svg", {
|
|
791
|
-
class: `${
|
|
792
|
+
class: `${n}-icon`,
|
|
792
793
|
"aria-hidden": "true"
|
|
793
794
|
}, [t("use", {
|
|
794
795
|
"xlink:href": "#md-editor-icon-next"
|
|
795
796
|
}, null)])]);
|
|
796
797
|
case "save":
|
|
797
798
|
return t("div", {
|
|
798
|
-
class: `${
|
|
799
|
-
title: (
|
|
799
|
+
class: `${n}-toolbar-item`,
|
|
800
|
+
title: (Q = a.value.toolbarTips) == null ? void 0 : Q.save,
|
|
800
801
|
onClick: () => {
|
|
801
802
|
h.emit(o, je);
|
|
802
803
|
}
|
|
803
804
|
}, [t("svg", {
|
|
804
|
-
class: `${
|
|
805
|
+
class: `${n}-icon`,
|
|
805
806
|
"aria-hidden": "true"
|
|
806
807
|
}, [t("use", {
|
|
807
808
|
"xlink:href": "#md-editor-icon-baocun"
|
|
808
809
|
}, null)])]);
|
|
809
810
|
case "prettier":
|
|
810
811
|
return e.noPrettier ? "" : t("div", {
|
|
811
|
-
class: `${
|
|
812
|
-
title: (
|
|
812
|
+
class: `${n}-toolbar-item`,
|
|
813
|
+
title: (ae = a.value.toolbarTips) == null ? void 0 : ae.prettier,
|
|
813
814
|
onClick: () => {
|
|
814
815
|
c("prettier");
|
|
815
816
|
}
|
|
816
817
|
}, [t("svg", {
|
|
817
|
-
class: `${
|
|
818
|
+
class: `${n}-icon`,
|
|
818
819
|
"aria-hidden": "true"
|
|
819
820
|
}, [t("use", {
|
|
820
821
|
"xlink:href": "#md-editor-icon-prettier"
|
|
821
822
|
}, null)])]);
|
|
822
823
|
case "pageFullscreen":
|
|
823
824
|
return !e.setting.fullscreen && t("div", {
|
|
824
|
-
class: `${
|
|
825
|
-
title: (
|
|
825
|
+
class: `${n}-toolbar-item`,
|
|
826
|
+
title: (he = a.value.toolbarTips) == null ? void 0 : he.pageFullscreen,
|
|
826
827
|
onClick: () => {
|
|
827
828
|
e.updateSetting("pageFullscreen");
|
|
828
829
|
}
|
|
829
830
|
}, [t("svg", {
|
|
830
|
-
class: `${
|
|
831
|
+
class: `${n}-icon`,
|
|
831
832
|
"aria-hidden": "true"
|
|
832
833
|
}, [t("use", {
|
|
833
834
|
"xlink:href": `#md-editor-icon-${e.setting.pageFullscreen ? "suoxiao" : "fangda"}`
|
|
834
835
|
}, null)])]);
|
|
835
836
|
case "fullscreen":
|
|
836
837
|
return t("div", {
|
|
837
|
-
class: `${
|
|
838
|
-
title: (
|
|
838
|
+
class: `${n}-toolbar-item`,
|
|
839
|
+
title: (be = a.value.toolbarTips) == null ? void 0 : be.fullscreen,
|
|
839
840
|
onClick: () => {
|
|
840
841
|
l();
|
|
841
842
|
}
|
|
842
843
|
}, [t("svg", {
|
|
843
|
-
class: `${
|
|
844
|
+
class: `${n}-icon`,
|
|
844
845
|
"aria-hidden": "true"
|
|
845
846
|
}, [t("use", {
|
|
846
847
|
"xlink:href": `#md-editor-icon-${e.setting.fullscreen ? "fullscreen-exit" : "fullscreen"}`
|
|
847
848
|
}, null)])]);
|
|
848
849
|
case "preview":
|
|
849
850
|
return t("div", {
|
|
850
|
-
class: `${
|
|
851
|
-
title: (
|
|
851
|
+
class: `${n}-toolbar-item`,
|
|
852
|
+
title: (ve = a.value.toolbarTips) == null ? void 0 : ve.preview,
|
|
852
853
|
onClick: () => {
|
|
853
854
|
e.updateSetting("preview");
|
|
854
855
|
}
|
|
855
856
|
}, [t("svg", {
|
|
856
|
-
class: `${
|
|
857
|
+
class: `${n}-icon`,
|
|
857
858
|
"aria-hidden": "true"
|
|
858
859
|
}, [t("use", {
|
|
859
860
|
"xlink:href": "#md-editor-icon-preview"
|
|
860
861
|
}, null)])]);
|
|
861
862
|
case "htmlPreview":
|
|
862
863
|
return t("div", {
|
|
863
|
-
class: `${
|
|
864
|
-
title: (
|
|
864
|
+
class: `${n}-toolbar-item`,
|
|
865
|
+
title: (pe = a.value.toolbarTips) == null ? void 0 : pe.htmlPreview,
|
|
865
866
|
onClick: () => {
|
|
866
867
|
e.updateSetting("htmlPreview");
|
|
867
868
|
}
|
|
868
869
|
}, [t("svg", {
|
|
869
|
-
class: `${
|
|
870
|
+
class: `${n}-icon`,
|
|
870
871
|
"aria-hidden": "true"
|
|
871
872
|
}, [t("use", {
|
|
872
873
|
"xlink:href": "#md-editor-icon-coding"
|
|
873
874
|
}, null)])]);
|
|
874
875
|
case "catalog":
|
|
875
876
|
return t("div", {
|
|
876
|
-
class: `${
|
|
877
|
-
title: (ke =
|
|
877
|
+
class: `${n}-toolbar-item`,
|
|
878
|
+
title: (ke = a.value.toolbarTips) == null ? void 0 : ke.catalog,
|
|
878
879
|
onClick: () => {
|
|
879
880
|
h.emit(o, ct);
|
|
880
881
|
},
|
|
881
882
|
key: "bar-catalog"
|
|
882
883
|
}, [t("svg", {
|
|
883
|
-
class: `${
|
|
884
|
+
class: `${n}-icon`,
|
|
884
885
|
"aria-hidden": "true"
|
|
885
886
|
}, [t("use", {
|
|
886
887
|
"xlink:href": "#md-editor-icon-catalog"
|
|
887
888
|
}, null)])]);
|
|
888
889
|
case "github":
|
|
889
890
|
return t("div", {
|
|
890
|
-
class: `${
|
|
891
|
-
title: (
|
|
891
|
+
class: `${n}-toolbar-item`,
|
|
892
|
+
title: (Ce = a.value.toolbarTips) == null ? void 0 : Ce.github,
|
|
892
893
|
onClick: () => nt("https://github.com/imzbf/md-editor-v3")
|
|
893
894
|
}, [t("svg", {
|
|
894
|
-
class: `${
|
|
895
|
+
class: `${n}-icon`,
|
|
895
896
|
"aria-hidden": "true"
|
|
896
897
|
}, [t("use", {
|
|
897
898
|
"xlink:href": "#md-editor-icon-github"
|
|
898
899
|
}, null)])]);
|
|
899
900
|
case "mermaid":
|
|
900
|
-
return t(
|
|
901
|
-
relative: `#${
|
|
901
|
+
return t(ee, {
|
|
902
|
+
relative: `#${i}`,
|
|
902
903
|
visible: r.mermaid,
|
|
903
904
|
onChange: (C) => {
|
|
904
905
|
r.mermaid = C;
|
|
905
906
|
},
|
|
906
907
|
overlay: t("ul", {
|
|
907
|
-
class: `${
|
|
908
|
+
class: `${n}-menu`,
|
|
908
909
|
onClick: () => {
|
|
909
910
|
r.mermaid = !1;
|
|
910
911
|
}
|
|
911
912
|
}, [t("li", {
|
|
912
|
-
class: `${
|
|
913
|
+
class: `${n}-menu-item`,
|
|
913
914
|
onClick: () => {
|
|
914
915
|
c("flow");
|
|
915
916
|
}
|
|
916
|
-
}, [(
|
|
917
|
-
class: `${
|
|
917
|
+
}, [($e = a.value.mermaid) == null ? void 0 : $e.flow]), t("li", {
|
|
918
|
+
class: `${n}-menu-item`,
|
|
918
919
|
onClick: () => {
|
|
919
920
|
c("sequence");
|
|
920
921
|
}
|
|
921
|
-
}, [(
|
|
922
|
-
class: `${
|
|
922
|
+
}, [(ye = a.value.mermaid) == null ? void 0 : ye.sequence]), t("li", {
|
|
923
|
+
class: `${n}-menu-item`,
|
|
923
924
|
onClick: () => {
|
|
924
925
|
c("gantt");
|
|
925
926
|
}
|
|
926
|
-
}, [(
|
|
927
|
-
class: `${
|
|
927
|
+
}, [(xe = a.value.mermaid) == null ? void 0 : xe.gantt]), t("li", {
|
|
928
|
+
class: `${n}-menu-item`,
|
|
928
929
|
onClick: () => {
|
|
929
930
|
c("class");
|
|
930
931
|
}
|
|
931
|
-
}, [(
|
|
932
|
-
class: `${
|
|
932
|
+
}, [(we = a.value.mermaid) == null ? void 0 : we.class]), t("li", {
|
|
933
|
+
class: `${n}-menu-item`,
|
|
933
934
|
onClick: () => {
|
|
934
935
|
c("state");
|
|
935
936
|
}
|
|
936
|
-
}, [(
|
|
937
|
-
class: `${
|
|
937
|
+
}, [(Te = a.value.mermaid) == null ? void 0 : Te.state]), t("li", {
|
|
938
|
+
class: `${n}-menu-item`,
|
|
938
939
|
onClick: () => {
|
|
939
940
|
c("pie");
|
|
940
941
|
}
|
|
941
|
-
}, [(
|
|
942
|
-
class: `${
|
|
942
|
+
}, [(Se = a.value.mermaid) == null ? void 0 : Se.pie]), t("li", {
|
|
943
|
+
class: `${n}-menu-item`,
|
|
943
944
|
onClick: () => {
|
|
944
945
|
c("relationship");
|
|
945
946
|
}
|
|
946
|
-
}, [(
|
|
947
|
-
class: `${
|
|
947
|
+
}, [(Ae = a.value.mermaid) == null ? void 0 : Ae.relationship]), t("li", {
|
|
948
|
+
class: `${n}-menu-item`,
|
|
948
949
|
onClick: () => {
|
|
949
950
|
c("journey");
|
|
950
951
|
}
|
|
951
|
-
}, [(
|
|
952
|
+
}, [(Me = a.value.mermaid) == null ? void 0 : Me.journey])]),
|
|
952
953
|
key: "bar-mermaid"
|
|
953
954
|
}, {
|
|
954
955
|
default: () => {
|
|
955
956
|
var C;
|
|
956
957
|
return [t("div", {
|
|
957
|
-
class: `${
|
|
958
|
-
title: (C =
|
|
958
|
+
class: `${n}-toolbar-item`,
|
|
959
|
+
title: (C = a.value.toolbarTips) == null ? void 0 : C.mermaid
|
|
959
960
|
}, [t("svg", {
|
|
960
|
-
class: `${
|
|
961
|
+
class: `${n}-icon`,
|
|
961
962
|
"aria-hidden": "true"
|
|
962
963
|
}, [t("use", {
|
|
963
964
|
"xlink:href": "#md-editor-icon-mermaid"
|
|
@@ -965,37 +966,37 @@ const Ot = /* @__PURE__ */ B({
|
|
|
965
966
|
}
|
|
966
967
|
});
|
|
967
968
|
case "katex":
|
|
968
|
-
return t(
|
|
969
|
-
relative: `#${
|
|
969
|
+
return t(ee, {
|
|
970
|
+
relative: `#${i}`,
|
|
970
971
|
visible: r.katex,
|
|
971
972
|
onChange: (C) => {
|
|
972
973
|
r.katex = C;
|
|
973
974
|
},
|
|
974
975
|
overlay: t("ul", {
|
|
975
|
-
class: `${
|
|
976
|
+
class: `${n}-menu`,
|
|
976
977
|
onClick: () => {
|
|
977
978
|
r.katex = !1;
|
|
978
979
|
}
|
|
979
980
|
}, [t("li", {
|
|
980
|
-
class: `${
|
|
981
|
+
class: `${n}-menu-item`,
|
|
981
982
|
onClick: () => {
|
|
982
983
|
c("katexInline");
|
|
983
984
|
}
|
|
984
|
-
}, [(
|
|
985
|
-
class: `${
|
|
985
|
+
}, [(Le = a.value.katex) == null ? void 0 : Le.inline]), t("li", {
|
|
986
|
+
class: `${n}-menu-item`,
|
|
986
987
|
onClick: () => {
|
|
987
988
|
c("katexBlock");
|
|
988
989
|
}
|
|
989
|
-
}, [(
|
|
990
|
+
}, [(De = a.value.katex) == null ? void 0 : De.block])]),
|
|
990
991
|
key: "bar-katex"
|
|
991
992
|
}, {
|
|
992
993
|
default: () => {
|
|
993
994
|
var C;
|
|
994
995
|
return [t("div", {
|
|
995
|
-
class: `${
|
|
996
|
-
title: (C =
|
|
996
|
+
class: `${n}-toolbar-item`,
|
|
997
|
+
title: (C = a.value.toolbarTips) == null ? void 0 : C.katex
|
|
997
998
|
}, [t("svg", {
|
|
998
|
-
class: `${
|
|
999
|
+
class: `${n}-icon`,
|
|
999
1000
|
"aria-hidden": "true"
|
|
1000
1001
|
}, [t("use", {
|
|
1001
1002
|
"xlink:href": "#md-editor-icon-formula"
|
|
@@ -1007,57 +1008,57 @@ const Ot = /* @__PURE__ */ B({
|
|
|
1007
1008
|
return e.defToolbars instanceof Array ? e.defToolbars[b] || "" : e.defToolbars && e.defToolbars.children instanceof Array && e.defToolbars.children[b] || "";
|
|
1008
1009
|
};
|
|
1009
1010
|
return () => {
|
|
1010
|
-
const b =
|
|
1011
|
+
const b = u.value[0].map((g) => $(g)), v = u.value[1].map((g) => $(g));
|
|
1011
1012
|
return t(Ke, null, [e.toolbars.length > 0 && t("div", {
|
|
1012
|
-
class: `${
|
|
1013
|
-
id:
|
|
1013
|
+
class: `${n}-toolbar-wrapper`,
|
|
1014
|
+
id: i
|
|
1014
1015
|
}, [t("div", {
|
|
1015
|
-
class: `${
|
|
1016
|
+
class: `${n}-toolbar`
|
|
1016
1017
|
}, [t("div", {
|
|
1017
|
-
class: `${
|
|
1018
|
+
class: `${n}-toolbar-left`,
|
|
1018
1019
|
ref: f
|
|
1019
1020
|
}, [b]), t("div", {
|
|
1020
|
-
class: `${
|
|
1021
|
+
class: `${n}-toolbar-right`
|
|
1021
1022
|
}, [v])])]), t("input", {
|
|
1022
|
-
ref:
|
|
1023
|
+
ref: d,
|
|
1023
1024
|
accept: "image/*",
|
|
1024
1025
|
type: "file",
|
|
1025
1026
|
multiple: !0,
|
|
1026
1027
|
style: {
|
|
1027
1028
|
display: "none"
|
|
1028
1029
|
}
|
|
1029
|
-
}, null), t(
|
|
1030
|
-
linkVisible:
|
|
1031
|
-
clipVisible:
|
|
1032
|
-
type:
|
|
1030
|
+
}, null), t(zt, {
|
|
1031
|
+
linkVisible: m.linkVisible,
|
|
1032
|
+
clipVisible: m.clipVisible,
|
|
1033
|
+
type: m.type,
|
|
1033
1034
|
onCancel: () => {
|
|
1034
|
-
|
|
1035
|
+
m.linkVisible = !1, m.clipVisible = !1;
|
|
1035
1036
|
},
|
|
1036
|
-
onOk: (
|
|
1037
|
-
|
|
1038
|
-
desc:
|
|
1039
|
-
url:
|
|
1040
|
-
}),
|
|
1037
|
+
onOk: (g) => {
|
|
1038
|
+
g && c(m.type, {
|
|
1039
|
+
desc: g.desc,
|
|
1040
|
+
url: g.url
|
|
1041
|
+
}), m.linkVisible = !1, m.clipVisible = !1;
|
|
1041
1042
|
}
|
|
1042
1043
|
}, null)]);
|
|
1043
1044
|
};
|
|
1044
1045
|
}
|
|
1045
|
-
}),
|
|
1046
|
-
const
|
|
1046
|
+
}), Zt = (e, o) => {
|
|
1047
|
+
const a = rt(() => {
|
|
1047
1048
|
e.removeEventListener("scroll", l), e.addEventListener("scroll", l), o.removeEventListener("scroll", l), o.addEventListener("scroll", l);
|
|
1048
|
-
}, 50), l = (
|
|
1049
|
-
const r = e.clientHeight, c = o.clientHeight,
|
|
1050
|
-
|
|
1051
|
-
top: e.scrollTop /
|
|
1049
|
+
}, 50), l = (i) => {
|
|
1050
|
+
const r = e.clientHeight, c = o.clientHeight, m = e.scrollHeight, f = o.scrollHeight, u = (m - r) / (f - c);
|
|
1051
|
+
i.target === e ? (o.removeEventListener("scroll", l), o.scrollTo({
|
|
1052
|
+
top: e.scrollTop / u
|
|
1052
1053
|
// behavior: 'smooth'
|
|
1053
|
-
}),
|
|
1054
|
-
top: o.scrollTop *
|
|
1054
|
+
}), a()) : (e.removeEventListener("scroll", l), e.scrollTo({
|
|
1055
|
+
top: o.scrollTop * u
|
|
1055
1056
|
// behavior: 'smooth'
|
|
1056
|
-
}),
|
|
1057
|
+
}), a());
|
|
1057
1058
|
};
|
|
1058
1059
|
return [
|
|
1059
1060
|
() => {
|
|
1060
|
-
|
|
1061
|
+
a().finally(() => {
|
|
1061
1062
|
e.dispatchEvent(new Event("scroll"));
|
|
1062
1063
|
});
|
|
1063
1064
|
},
|
|
@@ -1065,219 +1066,219 @@ const Ot = /* @__PURE__ */ B({
|
|
|
1065
1066
|
e.removeEventListener("scroll", l), o.removeEventListener("scroll", l);
|
|
1066
1067
|
}
|
|
1067
1068
|
];
|
|
1068
|
-
},
|
|
1069
|
-
const { view: l } =
|
|
1069
|
+
}, Jt = (e, o, a) => {
|
|
1070
|
+
const { view: l } = a, i = (p) => l.lineBlockAt(l.state.doc.line(p).from).top, r = (p) => l.lineBlockAt(l.state.doc.line(p).from).height;
|
|
1070
1071
|
let c = [];
|
|
1071
|
-
const
|
|
1072
|
+
const m = () => {
|
|
1072
1073
|
c = [];
|
|
1073
|
-
const
|
|
1074
|
-
(
|
|
1074
|
+
const p = Array.from(o.querySelectorAll("[data-line]")).map(
|
|
1075
|
+
(g) => Number(g.dataset.line) + 1
|
|
1075
1076
|
), { lines: $ } = l.state.doc;
|
|
1076
|
-
let b = 1, v =
|
|
1077
|
-
for (let
|
|
1078
|
-
|
|
1077
|
+
let b = 1, v = p.shift() ?? $;
|
|
1078
|
+
for (let g = 1; g <= $; g++)
|
|
1079
|
+
g === v && (b = g, v = p.shift() || $ + 1), c.push({
|
|
1079
1080
|
start: b,
|
|
1080
1081
|
end: v - 1
|
|
1081
1082
|
});
|
|
1082
1083
|
};
|
|
1083
|
-
let f = 0,
|
|
1084
|
-
const
|
|
1085
|
-
var v,
|
|
1084
|
+
let f = 0, u = 0;
|
|
1085
|
+
const d = it((p) => {
|
|
1086
|
+
var v, g, y, x, T, w, M;
|
|
1086
1087
|
if (!((v = o.firstElementChild) != null && v.firstElementChild))
|
|
1087
1088
|
return;
|
|
1088
1089
|
const $ = l.lineBlockAtHeight(l.scrollDOM.scrollTop), { number: b } = l.state.doc.lineAt($.from);
|
|
1089
1090
|
if (!(b > c.length) && !(l.state.doc.lines < c[c.length - 1].end))
|
|
1090
|
-
if (
|
|
1091
|
-
if (
|
|
1091
|
+
if (p.target === e) {
|
|
1092
|
+
if (u !== 0)
|
|
1092
1093
|
return;
|
|
1093
1094
|
f++;
|
|
1094
|
-
const
|
|
1095
|
+
const k = c[b - 1], S = i(k.end) + r(k.end);
|
|
1095
1096
|
let R = 0;
|
|
1096
|
-
const L =
|
|
1097
|
-
let
|
|
1098
|
-
L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1097
|
+
const L = i(k.start), D = o.querySelector(`[data-line="${k.start - 1}"]`) || ((g = o.firstElementChild) == null ? void 0 : g.firstElementChild), V = o.querySelector(`[data-line="${k.end}"]`) || ((y = o.lastElementChild) == null ? void 0 : y.lastElementChild);
|
|
1098
|
+
let B = 0, E = 0;
|
|
1099
|
+
L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (S - L), B = V.offsetTop) : S > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, B = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (S - L), E = D.offsetTop, B = V.offsetTop - E);
|
|
1100
|
+
const G = E - 10 + B * R;
|
|
1101
|
+
Ee(o, G, () => {
|
|
1101
1102
|
f--;
|
|
1102
1103
|
});
|
|
1103
1104
|
} else {
|
|
1104
1105
|
if (f !== 0)
|
|
1105
1106
|
return;
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1107
|
+
u++;
|
|
1108
|
+
const k = Array.from(
|
|
1108
1109
|
o.querySelectorAll("[data-line]")
|
|
1109
|
-
),
|
|
1110
|
-
let L =
|
|
1111
|
-
Number(
|
|
1110
|
+
), S = o.scrollTop, R = o.scrollHeight;
|
|
1111
|
+
let L = k.length === 0 ? 1 : Math.ceil(
|
|
1112
|
+
Number(k[k.length - 1].dataset.line) * (S / R)
|
|
1112
1113
|
), D = (x = o.firstElementChild) == null ? void 0 : x.firstElementChild;
|
|
1113
1114
|
for (let H = L; H >= 0; H--) {
|
|
1114
|
-
const
|
|
1115
|
-
if (
|
|
1116
|
-
D =
|
|
1115
|
+
const F = o.querySelector(`[data-line="${H}"]`);
|
|
1116
|
+
if (F && F.offsetTop <= S) {
|
|
1117
|
+
D = F, L = H;
|
|
1117
1118
|
break;
|
|
1118
1119
|
}
|
|
1119
1120
|
}
|
|
1120
|
-
let
|
|
1121
|
-
for (;
|
|
1122
|
-
const H =
|
|
1123
|
-
if (H + 1 >=
|
|
1121
|
+
let V = (T = o.firstElementChild) == null ? void 0 : T.firstElementChild, B = (w = o.firstElementChild) == null ? void 0 : w.lastElementChild;
|
|
1122
|
+
for (; k.length > 0; ) {
|
|
1123
|
+
const H = k.indexOf(D);
|
|
1124
|
+
if (H + 1 >= k.length)
|
|
1124
1125
|
break;
|
|
1125
|
-
const
|
|
1126
|
+
const F = k[H + 1];
|
|
1126
1127
|
if (H === -1) {
|
|
1127
|
-
|
|
1128
|
+
B = F;
|
|
1128
1129
|
break;
|
|
1129
1130
|
}
|
|
1130
|
-
const
|
|
1131
|
-
if (
|
|
1131
|
+
const Q = D.offsetTop;
|
|
1132
|
+
if (Q > S) {
|
|
1132
1133
|
if (H === 0) {
|
|
1133
|
-
|
|
1134
|
+
V = D, B = F;
|
|
1134
1135
|
break;
|
|
1135
1136
|
}
|
|
1136
|
-
D =
|
|
1137
|
+
D = k[H - 1];
|
|
1137
1138
|
continue;
|
|
1138
1139
|
}
|
|
1139
|
-
const
|
|
1140
|
-
if (
|
|
1141
|
-
|
|
1140
|
+
const ae = F.offsetTop;
|
|
1141
|
+
if (Q <= S && ae > S) {
|
|
1142
|
+
V = D, B = F;
|
|
1142
1143
|
break;
|
|
1143
1144
|
}
|
|
1144
|
-
D =
|
|
1145
|
+
D = F;
|
|
1145
1146
|
}
|
|
1146
|
-
const E =
|
|
1147
|
+
const E = V.offsetTop, G = B.offsetTop;
|
|
1147
1148
|
let N = 0;
|
|
1148
|
-
const { start:
|
|
1149
|
-
let P =
|
|
1150
|
-
const
|
|
1151
|
-
let
|
|
1152
|
-
|
|
1153
|
-
(
|
|
1149
|
+
const { start: oe, end: J } = c[Number(V.dataset.line || 0)], K = i(oe);
|
|
1150
|
+
let P = i(J);
|
|
1151
|
+
const X = r(J);
|
|
1152
|
+
let j = 0;
|
|
1153
|
+
V === ((M = o.firstElementChild) == null ? void 0 : M.firstElementChild) ? (N = Math.max(S / G, 0), j = P + X - K) : P > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (N = Math.max(
|
|
1154
|
+
(S - E) / (o.scrollHeight - E - o.clientHeight),
|
|
1154
1155
|
0
|
|
1155
|
-
), P =
|
|
1156
|
-
(
|
|
1156
|
+
), P = i(l.state.doc.lines) + r(l.state.doc.lines), j = 8 + P - K - e.clientHeight) : (N = Math.max(
|
|
1157
|
+
(S - E) / (G - E),
|
|
1157
1158
|
0
|
|
1158
|
-
),
|
|
1159
|
-
|
|
1159
|
+
), j = P + X - K), Ee(e, K + j * N, () => {
|
|
1160
|
+
u--;
|
|
1160
1161
|
});
|
|
1161
1162
|
}
|
|
1162
1163
|
}, 10);
|
|
1163
1164
|
return [
|
|
1164
1165
|
() => {
|
|
1165
|
-
|
|
1166
|
+
m(), e.addEventListener("scroll", d), o.addEventListener("scroll", d), e.dispatchEvent(new Event("scroll"));
|
|
1166
1167
|
},
|
|
1167
1168
|
() => {
|
|
1168
|
-
c = [], e.removeEventListener("scroll",
|
|
1169
|
+
c = [], e.removeEventListener("scroll", d), o.removeEventListener("scroll", d);
|
|
1169
1170
|
}
|
|
1170
1171
|
];
|
|
1171
|
-
},
|
|
1172
|
-
const l =
|
|
1173
|
-
let
|
|
1172
|
+
}, Xt = (e, o, a) => {
|
|
1173
|
+
const l = A("editorId");
|
|
1174
|
+
let i = () => {
|
|
1174
1175
|
}, r = () => {
|
|
1175
1176
|
};
|
|
1176
1177
|
const c = () => {
|
|
1177
|
-
|
|
1178
|
-
const
|
|
1178
|
+
i();
|
|
1179
|
+
const m = document.querySelector(".cm-scroller"), f = document.querySelector(
|
|
1179
1180
|
`[id="${l}-preview-wrapper"][data-show="true"]`
|
|
1180
|
-
),
|
|
1181
|
+
), u = document.querySelector(
|
|
1181
1182
|
`[id="${l}-html-wrapper"][data-show="true"]`
|
|
1182
1183
|
);
|
|
1183
|
-
(f ||
|
|
1184
|
-
|
|
1185
|
-
f ||
|
|
1186
|
-
|
|
1184
|
+
(f || u) && ([r, i] = (f ? Jt : Zt)(
|
|
1185
|
+
m,
|
|
1186
|
+
f || u,
|
|
1187
|
+
a.value
|
|
1187
1188
|
)), e.scrollAuto && r();
|
|
1188
1189
|
};
|
|
1189
1190
|
I(
|
|
1190
1191
|
[
|
|
1191
1192
|
o,
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1193
|
+
ne(e.setting, "preview"),
|
|
1194
|
+
ne(e.setting, "htmlPreview"),
|
|
1195
|
+
ne(e.setting, "fullscreen"),
|
|
1196
|
+
ne(e.setting, "pageFullscreen")
|
|
1196
1197
|
],
|
|
1197
1198
|
() => {
|
|
1198
|
-
|
|
1199
|
+
me(c);
|
|
1199
1200
|
}
|
|
1200
1201
|
), I(
|
|
1201
1202
|
() => e.scrollAuto,
|
|
1202
|
-
(
|
|
1203
|
-
|
|
1203
|
+
(m) => {
|
|
1204
|
+
m ? r() : i();
|
|
1204
1205
|
}
|
|
1205
1206
|
), W(c);
|
|
1206
|
-
},
|
|
1207
|
-
var
|
|
1208
|
-
let l = "",
|
|
1209
|
-
const f = o.getSelectedText(),
|
|
1207
|
+
}, Qt = Xt, el = (e, o, a) => {
|
|
1208
|
+
var d, p, $, b, v, g;
|
|
1209
|
+
let l = "", i = 0, r = 0, c = !0, m = !1;
|
|
1210
|
+
const f = o.getSelectedText(), u = (d = _.editorConfig) == null ? void 0 : d.mermaidTemplate;
|
|
1210
1211
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
1211
1212
|
const y = e.replace(/^h(\d)/, (x, T) => new Array(Number(T)).fill("#", 0, T).join(""));
|
|
1212
|
-
l = `${y} ${f}`,
|
|
1213
|
+
l = `${y} ${f}`, i = y.length + 1;
|
|
1213
1214
|
} else if (e === "prettier") {
|
|
1214
|
-
const y = window.prettier || (($ = (
|
|
1215
|
-
((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((
|
|
1215
|
+
const y = window.prettier || (($ = (p = _.editorExtensions) == null ? void 0 : p.prettier) == null ? void 0 : $.prettierInstance), x = [
|
|
1216
|
+
((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((g = (v = _.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : g.parserMarkdownInstance)
|
|
1216
1217
|
];
|
|
1217
|
-
!y || x[0] === void 0 ? (h.emit(
|
|
1218
|
+
!y || x[0] === void 0 ? (h.emit(a.editorId, "errorCatcher", {
|
|
1218
1219
|
name: "prettier",
|
|
1219
1220
|
message: "prettier is undefined"
|
|
1220
1221
|
}), l = o.getValue()) : l = y.format(o.getValue(), {
|
|
1221
1222
|
parser: "markdown",
|
|
1222
1223
|
plugins: x
|
|
1223
|
-
}), c = !1,
|
|
1224
|
+
}), c = !1, m = !0;
|
|
1224
1225
|
} else
|
|
1225
1226
|
switch (e) {
|
|
1226
1227
|
case "bold": {
|
|
1227
|
-
l = `**${f}**`,
|
|
1228
|
+
l = `**${f}**`, i = 2, r = -2;
|
|
1228
1229
|
break;
|
|
1229
1230
|
}
|
|
1230
1231
|
case "underline": {
|
|
1231
|
-
l = `<u>${f}</u>`,
|
|
1232
|
+
l = `<u>${f}</u>`, i = 3, r = -4;
|
|
1232
1233
|
break;
|
|
1233
1234
|
}
|
|
1234
1235
|
case "italic": {
|
|
1235
|
-
l = `*${f}*`,
|
|
1236
|
+
l = `*${f}*`, i = 1, r = -1;
|
|
1236
1237
|
break;
|
|
1237
1238
|
}
|
|
1238
1239
|
case "strikeThrough": {
|
|
1239
|
-
l = `~~${f}~~`,
|
|
1240
|
+
l = `~~${f}~~`, i = 2, r = -2;
|
|
1240
1241
|
break;
|
|
1241
1242
|
}
|
|
1242
1243
|
case "sub": {
|
|
1243
|
-
l = `<sub>${f}</sub>`,
|
|
1244
|
+
l = `<sub>${f}</sub>`, i = 5, r = -6;
|
|
1244
1245
|
break;
|
|
1245
1246
|
}
|
|
1246
1247
|
case "sup": {
|
|
1247
|
-
l = `<sup>${f}</sup>`,
|
|
1248
|
+
l = `<sup>${f}</sup>`, i = 5, r = -6;
|
|
1248
1249
|
break;
|
|
1249
1250
|
}
|
|
1250
1251
|
case "codeRow": {
|
|
1251
|
-
l = "`" + f + "`",
|
|
1252
|
+
l = "`" + f + "`", i = 1, r = -1;
|
|
1252
1253
|
break;
|
|
1253
1254
|
}
|
|
1254
1255
|
case "quote": {
|
|
1255
|
-
l = `> ${f}`,
|
|
1256
|
+
l = `> ${f}`, i = 2;
|
|
1256
1257
|
break;
|
|
1257
1258
|
}
|
|
1258
1259
|
case "orderedList": {
|
|
1259
|
-
l = `1. ${f}`,
|
|
1260
|
+
l = `1. ${f}`, i = 3;
|
|
1260
1261
|
break;
|
|
1261
1262
|
}
|
|
1262
1263
|
case "unorderedList": {
|
|
1263
|
-
l = `- ${f}`,
|
|
1264
|
+
l = `- ${f}`, i = 2;
|
|
1264
1265
|
break;
|
|
1265
1266
|
}
|
|
1266
1267
|
case "task": {
|
|
1267
|
-
l = `- [ ] ${f}`,
|
|
1268
|
+
l = `- [ ] ${f}`, i = 6;
|
|
1268
1269
|
break;
|
|
1269
1270
|
}
|
|
1270
1271
|
case "code": {
|
|
1271
|
-
const y =
|
|
1272
|
+
const y = a.text || f || "", x = a.mode || "language";
|
|
1272
1273
|
l = `\`\`\`${x}
|
|
1273
1274
|
${y}
|
|
1274
1275
|
\`\`\`
|
|
1275
|
-
`,
|
|
1276
|
+
`, i = 3, r = 3 + x.length - l.length;
|
|
1276
1277
|
break;
|
|
1277
1278
|
}
|
|
1278
1279
|
case "table": {
|
|
1279
1280
|
l = "|";
|
|
1280
|
-
const { selectedShape: y = { x: 1, y: 1 } } =
|
|
1281
|
+
const { selectedShape: y = { x: 1, y: 1 } } = a, { x, y: T } = y;
|
|
1281
1282
|
for (let w = 0; w <= T; w++)
|
|
1282
1283
|
l += " col |";
|
|
1283
1284
|
l += `
|
|
@@ -1287,93 +1288,93 @@ ${y}
|
|
|
1287
1288
|
for (let w = 0; w <= x; w++) {
|
|
1288
1289
|
l += `
|
|
1289
1290
|
|`;
|
|
1290
|
-
for (let
|
|
1291
|
+
for (let M = 0; M <= T; M++)
|
|
1291
1292
|
l += " content |";
|
|
1292
1293
|
}
|
|
1293
|
-
|
|
1294
|
+
i = 2, r = 5 - l.length;
|
|
1294
1295
|
break;
|
|
1295
1296
|
}
|
|
1296
1297
|
case "link": {
|
|
1297
|
-
const { desc: y, url: x } =
|
|
1298
|
+
const { desc: y, url: x } = a;
|
|
1298
1299
|
l = `[${y}](${x})`, c = !1;
|
|
1299
1300
|
break;
|
|
1300
1301
|
}
|
|
1301
1302
|
case "image": {
|
|
1302
|
-
const { desc: y, url: x, urls: T } =
|
|
1303
|
-
T instanceof Array ? l = T.reduce((w,
|
|
1303
|
+
const { desc: y, url: x, urls: T } = a;
|
|
1304
|
+
T instanceof Array ? l = T.reduce((w, M) => w + `
|
|
1304
1305
|
`, "") : l = `
|
|
1305
1306
|
`, c = !1;
|
|
1306
1307
|
break;
|
|
1307
1308
|
}
|
|
1308
1309
|
case "flow": {
|
|
1309
1310
|
l = `\`\`\`mermaid
|
|
1310
|
-
${(
|
|
1311
|
+
${(u == null ? void 0 : u.flow) || `flowchart TD
|
|
1311
1312
|
Start --> Stop`}
|
|
1312
1313
|
\`\`\`
|
|
1313
|
-
`,
|
|
1314
|
+
`, i = 3, r = 10 - l.length;
|
|
1314
1315
|
break;
|
|
1315
1316
|
}
|
|
1316
1317
|
case "sequence": {
|
|
1317
1318
|
l = `\`\`\`mermaid
|
|
1318
|
-
${(
|
|
1319
|
+
${(u == null ? void 0 : u.sequence) || `sequenceDiagram
|
|
1319
1320
|
A->>B: hello!
|
|
1320
1321
|
B-->>A: hi!
|
|
1321
1322
|
A-)B: bye!`}
|
|
1322
1323
|
\`\`\`
|
|
1323
|
-
`,
|
|
1324
|
+
`, i = 3, r = 10 - l.length;
|
|
1324
1325
|
break;
|
|
1325
1326
|
}
|
|
1326
1327
|
case "gantt": {
|
|
1327
1328
|
l = `\`\`\`mermaid
|
|
1328
|
-
${(
|
|
1329
|
+
${(u == null ? void 0 : u.gantt) || `gantt
|
|
1329
1330
|
title A Gantt Diagram
|
|
1330
1331
|
dateFormat YYYY-MM-DD
|
|
1331
1332
|
section Section
|
|
1332
1333
|
A task :a1, 2014-01-01, 30d
|
|
1333
1334
|
Another task :after a1, 20d`}
|
|
1334
1335
|
\`\`\`
|
|
1335
|
-
`,
|
|
1336
|
+
`, i = 3, r = 10 - l.length;
|
|
1336
1337
|
break;
|
|
1337
1338
|
}
|
|
1338
1339
|
case "class": {
|
|
1339
1340
|
l = `\`\`\`mermaid
|
|
1340
|
-
${(
|
|
1341
|
+
${(u == null ? void 0 : u.class) || `classDiagram
|
|
1341
1342
|
class Animal
|
|
1342
1343
|
Vehicle <|-- Car`}
|
|
1343
1344
|
\`\`\`
|
|
1344
|
-
`,
|
|
1345
|
+
`, i = 3, r = 10 - l.length;
|
|
1345
1346
|
break;
|
|
1346
1347
|
}
|
|
1347
1348
|
case "state": {
|
|
1348
1349
|
l = `\`\`\`mermaid
|
|
1349
|
-
${(
|
|
1350
|
+
${(u == null ? void 0 : u.state) || `stateDiagram-v2
|
|
1350
1351
|
s1 --> s2`}
|
|
1351
1352
|
\`\`\`
|
|
1352
|
-
`,
|
|
1353
|
+
`, i = 3, r = 10 - l.length;
|
|
1353
1354
|
break;
|
|
1354
1355
|
}
|
|
1355
1356
|
case "pie": {
|
|
1356
1357
|
l = `\`\`\`mermaid
|
|
1357
|
-
${(
|
|
1358
|
+
${(u == null ? void 0 : u.pie) || `pie title Pets adopted by volunteers
|
|
1358
1359
|
"Dogs" : 386
|
|
1359
1360
|
"Cats" : 85
|
|
1360
1361
|
"Rats" : 15`}
|
|
1361
1362
|
\`\`\`
|
|
1362
|
-
`,
|
|
1363
|
+
`, i = 3, r = 10 - l.length;
|
|
1363
1364
|
break;
|
|
1364
1365
|
}
|
|
1365
1366
|
case "relationship": {
|
|
1366
1367
|
l = `\`\`\`mermaid
|
|
1367
|
-
${(
|
|
1368
|
+
${(u == null ? void 0 : u.relationship) || `erDiagram
|
|
1368
1369
|
CAR ||--o{ NAMED-DRIVER : allows
|
|
1369
1370
|
PERSON ||--o{ NAMED-DRIVER : is`}
|
|
1370
1371
|
\`\`\`
|
|
1371
|
-
`,
|
|
1372
|
+
`, i = 3, r = 10 - l.length;
|
|
1372
1373
|
break;
|
|
1373
1374
|
}
|
|
1374
1375
|
case "journey": {
|
|
1375
1376
|
l = `\`\`\`mermaid
|
|
1376
|
-
${(
|
|
1377
|
+
${(u == null ? void 0 : u.journey) || `journey
|
|
1377
1378
|
title My working day
|
|
1378
1379
|
section Go to work
|
|
1379
1380
|
Make tea: 5: Me
|
|
@@ -1383,23 +1384,23 @@ ${(d == null ? void 0 : d.journey) || `journey
|
|
|
1383
1384
|
Go downstairs: 5: Me
|
|
1384
1385
|
Sit down: 5: Me`}
|
|
1385
1386
|
\`\`\`
|
|
1386
|
-
`,
|
|
1387
|
+
`, i = 3, r = 10 - l.length;
|
|
1387
1388
|
break;
|
|
1388
1389
|
}
|
|
1389
1390
|
case "katexInline": {
|
|
1390
|
-
l = "$$",
|
|
1391
|
+
l = "$$", i = 1, r = -1;
|
|
1391
1392
|
break;
|
|
1392
1393
|
}
|
|
1393
1394
|
case "katexBlock": {
|
|
1394
1395
|
l = `$$
|
|
1395
1396
|
|
|
1396
1397
|
$$
|
|
1397
|
-
`,
|
|
1398
|
+
`, i = 3, r = -4;
|
|
1398
1399
|
break;
|
|
1399
1400
|
}
|
|
1400
1401
|
case "universal": {
|
|
1401
|
-
const { generate: y } =
|
|
1402
|
-
l = x.targetValue, c = x.select,
|
|
1402
|
+
const { generate: y } = a, x = y(f);
|
|
1403
|
+
l = x.targetValue, c = x.select, i = x.deviationStart, r = x.deviationEnd;
|
|
1403
1404
|
}
|
|
1404
1405
|
}
|
|
1405
1406
|
return {
|
|
@@ -1408,25 +1409,25 @@ $$
|
|
|
1408
1409
|
// 是否选中
|
|
1409
1410
|
select: c,
|
|
1410
1411
|
// 选中时,开始位置的偏移量
|
|
1411
|
-
deviationStart:
|
|
1412
|
+
deviationStart: i,
|
|
1412
1413
|
// 结束的偏移量
|
|
1413
1414
|
deviationEnd: r,
|
|
1414
1415
|
// 是否整个替换
|
|
1415
|
-
replaceAll:
|
|
1416
|
+
replaceAll: m
|
|
1416
1417
|
}
|
|
1417
1418
|
};
|
|
1418
|
-
},
|
|
1419
|
+
}, tl = "#e5c07b", Be = "var(--md-color)", ll = "#56b6c2", ol = "#ffffff", te = "var(--md-color)", Fe = "#e5c07b", al = "#e5c07b", nl = "var(--md-color)", Ie = "#d19a66", rl = "#c678dd", il = "#21252b", sl = "#2c313a", Oe = "var(--md-bk-color)", ce = "var(--md-bk-color)", cl = "#ceedfa33", Ve = "#528bff", dl = ge.theme(
|
|
1419
1420
|
{
|
|
1420
1421
|
"&": {
|
|
1421
|
-
color:
|
|
1422
|
+
color: te,
|
|
1422
1423
|
backgroundColor: Oe
|
|
1423
1424
|
},
|
|
1424
1425
|
".cm-content": {
|
|
1425
1426
|
caretColor: Ve
|
|
1426
1427
|
},
|
|
1427
1428
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: Ve },
|
|
1428
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1429
|
-
".cm-panels": { backgroundColor:
|
|
1429
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: cl },
|
|
1430
|
+
".cm-panels": { backgroundColor: il, color: te },
|
|
1430
1431
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1431
1432
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1432
1433
|
".cm-searchMatch": {
|
|
@@ -1443,12 +1444,12 @@ $$
|
|
|
1443
1444
|
},
|
|
1444
1445
|
".cm-gutters": {
|
|
1445
1446
|
backgroundColor: Oe,
|
|
1446
|
-
color:
|
|
1447
|
+
color: te,
|
|
1447
1448
|
borderRight: "1px solid",
|
|
1448
1449
|
borderColor: "var(--md-border-color)"
|
|
1449
1450
|
},
|
|
1450
1451
|
".cm-activeLineGutter": {
|
|
1451
|
-
backgroundColor:
|
|
1452
|
+
backgroundColor: sl
|
|
1452
1453
|
},
|
|
1453
1454
|
".cm-foldPlaceholder": {
|
|
1454
1455
|
backgroundColor: "transparent",
|
|
@@ -1456,80 +1457,79 @@ $$
|
|
|
1456
1457
|
color: "#ddd"
|
|
1457
1458
|
},
|
|
1458
1459
|
".cm-tooltip": {
|
|
1459
|
-
border: "
|
|
1460
|
-
backgroundColor:
|
|
1460
|
+
border: "1px solid var(--md-border-color)",
|
|
1461
|
+
backgroundColor: ce
|
|
1461
1462
|
},
|
|
1462
1463
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1463
1464
|
borderTopColor: "transparent",
|
|
1464
1465
|
borderBottomColor: "transparent"
|
|
1465
1466
|
},
|
|
1466
1467
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1467
|
-
borderTopColor:
|
|
1468
|
-
borderBottomColor:
|
|
1468
|
+
borderTopColor: ce,
|
|
1469
|
+
borderBottomColor: ce
|
|
1469
1470
|
},
|
|
1470
1471
|
".cm-tooltip-autocomplete": {
|
|
1471
1472
|
"& > ul > li[aria-selected]": {
|
|
1472
|
-
|
|
1473
|
-
color: ee
|
|
1473
|
+
color: te
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
1476
|
},
|
|
1477
1477
|
{ dark: !0 }
|
|
1478
|
-
),
|
|
1479
|
-
{ tag:
|
|
1480
|
-
{ tag: [
|
|
1481
|
-
{ tag: [
|
|
1482
|
-
{ tag: [
|
|
1483
|
-
{ tag: [
|
|
1478
|
+
), ul = We.define([
|
|
1479
|
+
{ tag: s.keyword, color: rl },
|
|
1480
|
+
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Be },
|
|
1481
|
+
{ tag: [s.function(s.variableName), s.labelName], color: al },
|
|
1482
|
+
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Ie },
|
|
1483
|
+
{ tag: [s.definition(s.name), s.separator], color: te },
|
|
1484
1484
|
{
|
|
1485
1485
|
tag: [
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1486
|
+
s.typeName,
|
|
1487
|
+
s.className,
|
|
1488
|
+
s.number,
|
|
1489
|
+
s.changed,
|
|
1490
|
+
s.annotation,
|
|
1491
|
+
s.modifier,
|
|
1492
|
+
s.self,
|
|
1493
|
+
s.namespace
|
|
1494
1494
|
],
|
|
1495
|
-
color:
|
|
1495
|
+
color: tl
|
|
1496
1496
|
},
|
|
1497
1497
|
{
|
|
1498
1498
|
tag: [
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1499
|
+
s.operator,
|
|
1500
|
+
s.operatorKeyword,
|
|
1501
|
+
s.url,
|
|
1502
|
+
s.escape,
|
|
1503
|
+
s.regexp,
|
|
1504
|
+
s.link,
|
|
1505
|
+
s.special(s.string)
|
|
1506
1506
|
],
|
|
1507
|
-
color:
|
|
1508
|
-
},
|
|
1509
|
-
{ tag: [
|
|
1510
|
-
{ tag:
|
|
1511
|
-
{ tag:
|
|
1512
|
-
{ tag:
|
|
1513
|
-
{ tag:
|
|
1514
|
-
{ tag:
|
|
1515
|
-
{ tag: [
|
|
1516
|
-
{ tag: [
|
|
1517
|
-
{ tag:
|
|
1518
|
-
]),
|
|
1519
|
-
|
|
1520
|
-
ze(
|
|
1521
|
-
],
|
|
1507
|
+
color: ll
|
|
1508
|
+
},
|
|
1509
|
+
{ tag: [s.meta, s.comment], color: Fe },
|
|
1510
|
+
{ tag: s.strong, fontWeight: "bold" },
|
|
1511
|
+
{ tag: s.emphasis, fontStyle: "italic" },
|
|
1512
|
+
{ tag: s.strikethrough, textDecoration: "line-through" },
|
|
1513
|
+
{ tag: s.link, color: Fe, textDecoration: "underline" },
|
|
1514
|
+
{ tag: s.heading, fontWeight: "bold", color: Be },
|
|
1515
|
+
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: Ie },
|
|
1516
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: nl },
|
|
1517
|
+
{ tag: s.invalid, color: ol }
|
|
1518
|
+
]), ml = [
|
|
1519
|
+
dl,
|
|
1520
|
+
ze(ul)
|
|
1521
|
+
], fl = "#e5c07b", Re = "#3f4a54", gl = "#56b6c2", hl = "#fff", le = "#3f4a54", Ne = "#2d8cf0", bl = "#2d8cf0", vl = "#3f4a54", Pe = "#d19a66", pl = "#c678dd", kl = "#21252b", Cl = "#ceedfa33", qe = "var(--md-bk-color)", de = "var(--md-bk-color)", $l = "#bad5fa", Ue = "#3f4a54", yl = ge.theme(
|
|
1522
1522
|
{
|
|
1523
1523
|
"&": {
|
|
1524
|
-
color:
|
|
1524
|
+
color: le,
|
|
1525
1525
|
backgroundColor: qe
|
|
1526
1526
|
},
|
|
1527
1527
|
".cm-content": {
|
|
1528
|
-
caretColor:
|
|
1528
|
+
caretColor: Ue
|
|
1529
1529
|
},
|
|
1530
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor:
|
|
1531
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1532
|
-
".cm-panels": { backgroundColor:
|
|
1530
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: Ue },
|
|
1531
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: $l },
|
|
1532
|
+
".cm-panels": { backgroundColor: kl, color: le },
|
|
1533
1533
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1534
1534
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1535
1535
|
".cm-searchMatch": {
|
|
@@ -1546,12 +1546,12 @@ $$
|
|
|
1546
1546
|
},
|
|
1547
1547
|
".cm-gutters": {
|
|
1548
1548
|
backgroundColor: qe,
|
|
1549
|
-
color:
|
|
1549
|
+
color: le,
|
|
1550
1550
|
borderRight: "1px solid",
|
|
1551
1551
|
borderColor: "var(--md-border-color)"
|
|
1552
1552
|
},
|
|
1553
1553
|
".cm-activeLineGutter": {
|
|
1554
|
-
backgroundColor:
|
|
1554
|
+
backgroundColor: Cl
|
|
1555
1555
|
},
|
|
1556
1556
|
".cm-foldPlaceholder": {
|
|
1557
1557
|
backgroundColor: "transparent",
|
|
@@ -1559,87 +1559,204 @@ $$
|
|
|
1559
1559
|
color: "#ddd"
|
|
1560
1560
|
},
|
|
1561
1561
|
".cm-tooltip": {
|
|
1562
|
-
border: "
|
|
1563
|
-
backgroundColor:
|
|
1562
|
+
border: "1px solid var(--md-border-color)",
|
|
1563
|
+
backgroundColor: de
|
|
1564
1564
|
},
|
|
1565
1565
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1566
1566
|
borderTopColor: "transparent",
|
|
1567
1567
|
borderBottomColor: "transparent"
|
|
1568
1568
|
},
|
|
1569
1569
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1570
|
-
borderTopColor:
|
|
1571
|
-
borderBottomColor:
|
|
1570
|
+
borderTopColor: de,
|
|
1571
|
+
borderBottomColor: de
|
|
1572
1572
|
},
|
|
1573
1573
|
".cm-tooltip-autocomplete": {
|
|
1574
1574
|
"& > ul > li[aria-selected]": {
|
|
1575
|
-
|
|
1576
|
-
color: te
|
|
1575
|
+
color: le
|
|
1577
1576
|
}
|
|
1578
1577
|
}
|
|
1579
|
-
}
|
|
1580
|
-
{ dark:
|
|
1581
|
-
),
|
|
1582
|
-
{ tag:
|
|
1583
|
-
{ tag: [
|
|
1584
|
-
{ tag: [
|
|
1585
|
-
{ tag: [
|
|
1586
|
-
{ tag: [
|
|
1578
|
+
}
|
|
1579
|
+
// { dark: true }
|
|
1580
|
+
), xl = We.define([
|
|
1581
|
+
{ tag: s.keyword, color: pl },
|
|
1582
|
+
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Re },
|
|
1583
|
+
{ tag: [s.function(s.variableName), s.labelName], color: bl },
|
|
1584
|
+
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Pe },
|
|
1585
|
+
{ tag: [s.definition(s.name), s.separator], color: le },
|
|
1587
1586
|
{
|
|
1588
1587
|
tag: [
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1588
|
+
s.typeName,
|
|
1589
|
+
s.className,
|
|
1590
|
+
s.number,
|
|
1591
|
+
s.changed,
|
|
1592
|
+
s.annotation,
|
|
1593
|
+
s.modifier,
|
|
1594
|
+
s.self,
|
|
1595
|
+
s.namespace
|
|
1597
1596
|
],
|
|
1598
|
-
color:
|
|
1597
|
+
color: fl
|
|
1599
1598
|
},
|
|
1600
1599
|
{
|
|
1601
1600
|
tag: [
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1601
|
+
s.operator,
|
|
1602
|
+
s.operatorKeyword,
|
|
1603
|
+
s.url,
|
|
1604
|
+
s.escape,
|
|
1605
|
+
s.regexp,
|
|
1606
|
+
s.link,
|
|
1607
|
+
s.special(s.string)
|
|
1609
1608
|
],
|
|
1610
|
-
color:
|
|
1611
|
-
},
|
|
1612
|
-
{ tag: [
|
|
1613
|
-
{ tag:
|
|
1614
|
-
{ tag:
|
|
1615
|
-
{ tag:
|
|
1616
|
-
{ tag:
|
|
1617
|
-
{ tag:
|
|
1618
|
-
{ tag: [
|
|
1619
|
-
{ tag: [
|
|
1620
|
-
{ tag:
|
|
1621
|
-
]),
|
|
1622
|
-
|
|
1623
|
-
ze(
|
|
1624
|
-
],
|
|
1625
|
-
const
|
|
1609
|
+
color: gl
|
|
1610
|
+
},
|
|
1611
|
+
{ tag: [s.meta, s.comment], color: Ne },
|
|
1612
|
+
{ tag: s.strong, fontWeight: "bold" },
|
|
1613
|
+
{ tag: s.emphasis, fontStyle: "italic" },
|
|
1614
|
+
{ tag: s.strikethrough, textDecoration: "line-through" },
|
|
1615
|
+
{ tag: s.link, color: Ne, textDecoration: "underline" },
|
|
1616
|
+
{ tag: s.heading, fontWeight: "bold", color: Re },
|
|
1617
|
+
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: Pe },
|
|
1618
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: vl },
|
|
1619
|
+
{ tag: s.invalid, color: hl }
|
|
1620
|
+
]), wl = [
|
|
1621
|
+
yl,
|
|
1622
|
+
ze(xl)
|
|
1623
|
+
], ie = (e, o, a, l, i) => (r, c, m, f) => {
|
|
1624
|
+
const u = `${e}${o}`.slice(f - m);
|
|
1625
|
+
r.dispatch(r.state.replaceSelection(`${u}${a}${l}`));
|
|
1626
|
+
const d = m + c.label.length + (i === "title" ? a.length : 0);
|
|
1627
|
+
r.dispatch({
|
|
1628
|
+
selection: Y.create(
|
|
1629
|
+
[
|
|
1630
|
+
Y.range(
|
|
1631
|
+
m + c.label.length + (i === "title" ? 1 : -o.length),
|
|
1632
|
+
d
|
|
1633
|
+
),
|
|
1634
|
+
Y.cursor(d)
|
|
1635
|
+
],
|
|
1636
|
+
1
|
|
1637
|
+
)
|
|
1638
|
+
}), r.focus();
|
|
1639
|
+
}, Ge = (e) => (o, a, l, i) => {
|
|
1640
|
+
const r = e.slice(i - l);
|
|
1641
|
+
o.dispatch(o.state.replaceSelection(`${r} `));
|
|
1642
|
+
}, Tl = (e) => {
|
|
1643
|
+
const o = (a) => {
|
|
1644
|
+
const l = a.matchBefore(
|
|
1645
|
+
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
1646
|
+
);
|
|
1647
|
+
return l === null || l.from == l.to && a.explicit ? null : {
|
|
1648
|
+
from: l.from,
|
|
1649
|
+
options: [
|
|
1650
|
+
// 标题
|
|
1651
|
+
...["h1", "h2", "h3", "h4", "h5", "h6"].map((i, r) => {
|
|
1652
|
+
const c = new Array(r + 1).fill("#").join("");
|
|
1653
|
+
return {
|
|
1654
|
+
label: c,
|
|
1655
|
+
type: "text",
|
|
1656
|
+
apply: Ge(c)
|
|
1657
|
+
};
|
|
1658
|
+
}),
|
|
1659
|
+
// 任务列表
|
|
1660
|
+
...["unchecked", "checked"].map((i) => {
|
|
1661
|
+
const r = i === "checked" ? "- [x]" : "- [ ]";
|
|
1662
|
+
return {
|
|
1663
|
+
label: r,
|
|
1664
|
+
type: "text",
|
|
1665
|
+
apply: Ge(r)
|
|
1666
|
+
};
|
|
1667
|
+
}),
|
|
1668
|
+
// 代码
|
|
1669
|
+
...[
|
|
1670
|
+
["`", ""],
|
|
1671
|
+
["```", "language"],
|
|
1672
|
+
["```mermaid\n", ""]
|
|
1673
|
+
].map((i) => ({
|
|
1674
|
+
label: `${i[0]}${i[1]}`,
|
|
1675
|
+
type: "text",
|
|
1676
|
+
apply: ie(i[0], i[1], "", i[0] === "`" ? "`" : "\n```", "type")
|
|
1677
|
+
})),
|
|
1678
|
+
// 链接
|
|
1679
|
+
{
|
|
1680
|
+
label: "[]()",
|
|
1681
|
+
type: "text"
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
label: "![]()",
|
|
1685
|
+
type: "text"
|
|
1686
|
+
},
|
|
1687
|
+
// 表格
|
|
1688
|
+
{
|
|
1689
|
+
label: "| |",
|
|
1690
|
+
type: "text",
|
|
1691
|
+
detail: "table",
|
|
1692
|
+
apply: `| col | col | col |
|
|
1693
|
+
| - | - | - |
|
|
1694
|
+
| content | content | content |
|
|
1695
|
+
| content | content | content |`
|
|
1696
|
+
},
|
|
1697
|
+
// 公式
|
|
1698
|
+
{
|
|
1699
|
+
label: "$",
|
|
1700
|
+
type: "text",
|
|
1701
|
+
apply: ie("$", "", "", "$", "type")
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
label: "$$",
|
|
1705
|
+
type: "text",
|
|
1706
|
+
apply: ie("$$", "", `
|
|
1707
|
+
`, `
|
|
1708
|
+
$$`, "title")
|
|
1709
|
+
},
|
|
1710
|
+
// 那啥?
|
|
1711
|
+
...[
|
|
1712
|
+
"note",
|
|
1713
|
+
"abstract",
|
|
1714
|
+
"info",
|
|
1715
|
+
"tip",
|
|
1716
|
+
"success",
|
|
1717
|
+
"question",
|
|
1718
|
+
"warning",
|
|
1719
|
+
"failure",
|
|
1720
|
+
"danger",
|
|
1721
|
+
"bug",
|
|
1722
|
+
"example",
|
|
1723
|
+
"quote",
|
|
1724
|
+
"hint",
|
|
1725
|
+
"caution",
|
|
1726
|
+
"error",
|
|
1727
|
+
"attention"
|
|
1728
|
+
].map((i) => ({
|
|
1729
|
+
label: `!!! ${i}`,
|
|
1730
|
+
type: "text",
|
|
1731
|
+
apply: ie("!!!", ` ${i}`, " Title", `
|
|
1732
|
+
|
|
1733
|
+
!!!`, "title")
|
|
1734
|
+
}))
|
|
1735
|
+
]
|
|
1736
|
+
};
|
|
1737
|
+
};
|
|
1738
|
+
return It({
|
|
1739
|
+
override: e ? [o, ...e] : [o]
|
|
1740
|
+
});
|
|
1741
|
+
}, Sl = Tl, z = (e) => {
|
|
1742
|
+
const o = new Bt();
|
|
1626
1743
|
return (l) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(l) }) : e.dispatch({
|
|
1627
|
-
effects:
|
|
1744
|
+
effects: Ft.appendConfig.of(o.of(l))
|
|
1628
1745
|
}), !0);
|
|
1629
1746
|
};
|
|
1630
|
-
class
|
|
1747
|
+
class Al {
|
|
1631
1748
|
constructor(o) {
|
|
1632
|
-
|
|
1749
|
+
q(this, "view");
|
|
1633
1750
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
1634
|
-
|
|
1635
|
-
|
|
1751
|
+
q(this, "toggleTabSize");
|
|
1752
|
+
q(this, "togglePlaceholder");
|
|
1636
1753
|
/**
|
|
1637
1754
|
* 设置全部的扩展
|
|
1638
1755
|
*/
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1756
|
+
q(this, "setExtensions");
|
|
1757
|
+
q(this, "toggleDisabled");
|
|
1758
|
+
q(this, "toggleReadOnly");
|
|
1759
|
+
q(this, "toggleMaxlength");
|
|
1643
1760
|
this.view = o, 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);
|
|
1644
1761
|
}
|
|
1645
1762
|
getValue() {
|
|
@@ -1652,10 +1769,10 @@ class yl {
|
|
|
1652
1769
|
* @param from 插入开始位置
|
|
1653
1770
|
* @param to 插入结束位置
|
|
1654
1771
|
*/
|
|
1655
|
-
setValue(o,
|
|
1772
|
+
setValue(o, a = 0, l = this.view.state.doc.length) {
|
|
1656
1773
|
this.view.dispatch({
|
|
1657
1774
|
changes: {
|
|
1658
|
-
from:
|
|
1775
|
+
from: a,
|
|
1659
1776
|
to: l,
|
|
1660
1777
|
insert: o
|
|
1661
1778
|
}
|
|
@@ -1665,8 +1782,8 @@ class yl {
|
|
|
1665
1782
|
* 获取选中的文本
|
|
1666
1783
|
*/
|
|
1667
1784
|
getSelectedText() {
|
|
1668
|
-
const { from: o, to:
|
|
1669
|
-
return this.view.state.sliceDoc(o,
|
|
1785
|
+
const { from: o, to: a } = this.view.state.selection.main;
|
|
1786
|
+
return this.view.state.sliceDoc(o, a);
|
|
1670
1787
|
}
|
|
1671
1788
|
/**
|
|
1672
1789
|
* 使用新的内容替换选中的内容
|
|
@@ -1674,7 +1791,7 @@ class yl {
|
|
|
1674
1791
|
* @param text 待替换内容
|
|
1675
1792
|
* @param options 替换后是否选中
|
|
1676
1793
|
*/
|
|
1677
|
-
replaceSelectedText(o,
|
|
1794
|
+
replaceSelectedText(o, a = {
|
|
1678
1795
|
// 是否选中
|
|
1679
1796
|
select: !0,
|
|
1680
1797
|
// 选中时,开始位置的偏移量
|
|
@@ -1684,18 +1801,18 @@ class yl {
|
|
|
1684
1801
|
// 直接替换所有文本
|
|
1685
1802
|
replaceAll: !1
|
|
1686
1803
|
}) {
|
|
1687
|
-
if (
|
|
1804
|
+
if (a.replaceAll) {
|
|
1688
1805
|
this.setValue(o);
|
|
1689
1806
|
return;
|
|
1690
1807
|
}
|
|
1691
1808
|
const { from: l } = this.view.state.selection.main;
|
|
1692
|
-
if (this.view.dispatch(this.view.state.replaceSelection(o)),
|
|
1693
|
-
const
|
|
1809
|
+
if (this.view.dispatch(this.view.state.replaceSelection(o)), a.select) {
|
|
1810
|
+
const i = l + o.length + a.deviationEnd;
|
|
1694
1811
|
this.view.dispatch({
|
|
1695
|
-
selection:
|
|
1812
|
+
selection: Y.create(
|
|
1696
1813
|
[
|
|
1697
|
-
|
|
1698
|
-
|
|
1814
|
+
Y.range(l + a.deviationStart, i),
|
|
1815
|
+
Y.cursor(i)
|
|
1699
1816
|
],
|
|
1700
1817
|
1
|
|
1701
1818
|
)
|
|
@@ -1709,7 +1826,7 @@ class yl {
|
|
|
1709
1826
|
*/
|
|
1710
1827
|
setTabSize(o) {
|
|
1711
1828
|
this.toggleTabSize([
|
|
1712
|
-
|
|
1829
|
+
se.tabSize.of(o),
|
|
1713
1830
|
Ht.of(" ".repeat(o))
|
|
1714
1831
|
]);
|
|
1715
1832
|
}
|
|
@@ -1725,50 +1842,50 @@ class yl {
|
|
|
1725
1842
|
this.view.focus();
|
|
1726
1843
|
}
|
|
1727
1844
|
setDisabled(o) {
|
|
1728
|
-
this.toggleDisabled([
|
|
1845
|
+
this.toggleDisabled([ge.editable.of(!o)]);
|
|
1729
1846
|
}
|
|
1730
1847
|
setReadOnly(o) {
|
|
1731
|
-
this.toggleReadOnly([
|
|
1848
|
+
this.toggleReadOnly([se.readOnly.of(o)]);
|
|
1732
1849
|
}
|
|
1733
1850
|
setMaxLength(o) {
|
|
1734
1851
|
this.toggleMaxlength([
|
|
1735
|
-
|
|
1852
|
+
se.changeFilter.of((a) => a.newDoc.length <= o)
|
|
1736
1853
|
]);
|
|
1737
1854
|
}
|
|
1738
1855
|
}
|
|
1739
|
-
const
|
|
1740
|
-
const o =
|
|
1856
|
+
const Ml = (e) => {
|
|
1857
|
+
const o = A("editorId");
|
|
1741
1858
|
return (l) => {
|
|
1742
1859
|
if (l.clipboardData) {
|
|
1743
1860
|
if (l.clipboardData.files.length > 0) {
|
|
1744
|
-
const { files:
|
|
1861
|
+
const { files: i } = l.clipboardData;
|
|
1745
1862
|
h.emit(
|
|
1746
1863
|
o,
|
|
1747
1864
|
"uploadImage",
|
|
1748
|
-
Array.from(
|
|
1865
|
+
Array.from(i).filter((r) => /image\/.*/.test(r.type))
|
|
1749
1866
|
), l.preventDefault();
|
|
1750
1867
|
}
|
|
1751
1868
|
if (e.autoDetectCode && l.clipboardData.types.includes("vscode-editor-data")) {
|
|
1752
|
-
const
|
|
1869
|
+
const i = JSON.parse(l.clipboardData.getData("vscode-editor-data"));
|
|
1753
1870
|
h.emit(o, "replace", "code", {
|
|
1754
|
-
mode:
|
|
1871
|
+
mode: i.mode,
|
|
1755
1872
|
text: l.clipboardData.getData("text/plain")
|
|
1756
1873
|
}), l.preventDefault();
|
|
1757
1874
|
}
|
|
1758
1875
|
}
|
|
1759
1876
|
};
|
|
1760
|
-
},
|
|
1761
|
-
const o =
|
|
1877
|
+
}, Ll = Ml, Dl = (e) => {
|
|
1878
|
+
const o = A("editorId");
|
|
1762
1879
|
W(() => {
|
|
1763
1880
|
h.on(o, {
|
|
1764
1881
|
name: dt,
|
|
1765
1882
|
callback() {
|
|
1766
|
-
var
|
|
1767
|
-
(
|
|
1883
|
+
var a;
|
|
1884
|
+
(a = e.value) == null || a.focus();
|
|
1768
1885
|
}
|
|
1769
1886
|
});
|
|
1770
1887
|
});
|
|
1771
|
-
},
|
|
1888
|
+
}, El = Dl, Hl = (e, o) => [
|
|
1772
1889
|
{
|
|
1773
1890
|
key: "Ctrl-b",
|
|
1774
1891
|
mac: "Cmd-b",
|
|
@@ -1783,7 +1900,7 @@ const xl = (e) => {
|
|
|
1783
1900
|
{
|
|
1784
1901
|
key: "Ctrl-s",
|
|
1785
1902
|
mac: "Cmd-s",
|
|
1786
|
-
run: (
|
|
1903
|
+
run: (M) => (h.emit(e, je, M.state.doc.toString()), !0),
|
|
1787
1904
|
shift: () => (h.emit(e, "replace", "strikeThrough"), !0)
|
|
1788
1905
|
},
|
|
1789
1906
|
{
|
|
@@ -1847,8 +1964,8 @@ const xl = (e) => {
|
|
|
1847
1964
|
key: "Ctrl-c",
|
|
1848
1965
|
mac: "Cmd-c",
|
|
1849
1966
|
shift: () => (h.emit(e, "replace", "code"), !0),
|
|
1850
|
-
any(
|
|
1851
|
-
return (
|
|
1967
|
+
any(M, k) {
|
|
1968
|
+
return (k.ctrlKey || k.metaKey) && k.altKey && k.code === "KeyC" ? (h.emit(e, "replace", "codeRow"), !0) : !1;
|
|
1852
1969
|
}
|
|
1853
1970
|
},
|
|
1854
1971
|
{
|
|
@@ -1862,96 +1979,100 @@ const xl = (e) => {
|
|
|
1862
1979
|
shift: () => o.noPrettier ? !1 : (h.emit(e, "replace", "prettier"), !0)
|
|
1863
1980
|
},
|
|
1864
1981
|
{
|
|
1865
|
-
any: (
|
|
1982
|
+
any: (M, k) => (k.ctrlKey || k.metaKey) && k.altKey && k.shiftKey && k.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
|
|
1866
1983
|
}
|
|
1867
|
-
],
|
|
1868
|
-
const o =
|
|
1984
|
+
], Bl = Hl, Fl = (e) => {
|
|
1985
|
+
const o = A("tabWidth"), a = A("editorId"), l = A("theme"), i = U(), r = Xe(), c = Bl(a, e), m = Ll(e), f = [
|
|
1869
1986
|
Tt.of([...c, Lt]),
|
|
1870
1987
|
xt,
|
|
1871
1988
|
At({ codeLanguages: St }),
|
|
1872
1989
|
// 横向换行
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1990
|
+
re.lineWrapping,
|
|
1991
|
+
re.updateListener.of((d) => {
|
|
1992
|
+
d.docChanged && e.onChange(d.state.doc.toString());
|
|
1876
1993
|
}),
|
|
1877
|
-
|
|
1878
|
-
paste:
|
|
1994
|
+
re.domEventHandlers({
|
|
1995
|
+
paste: m,
|
|
1879
1996
|
blur: e.onBlur,
|
|
1880
1997
|
focus: e.onFocus
|
|
1881
1998
|
})
|
|
1882
|
-
],
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1999
|
+
], u = () => {
|
|
2000
|
+
const d = [
|
|
2001
|
+
...f,
|
|
2002
|
+
l.value === "light" ? wl : ml,
|
|
2003
|
+
Sl(e.completions)
|
|
2004
|
+
];
|
|
2005
|
+
return _.codeMirrorExtensions(l.value, d, [
|
|
2006
|
+
...c
|
|
2007
|
+
]);
|
|
2008
|
+
};
|
|
1891
2009
|
return W(() => {
|
|
1892
|
-
const
|
|
2010
|
+
const d = new re({
|
|
1893
2011
|
doc: e.value,
|
|
1894
|
-
parent:
|
|
2012
|
+
parent: i.value
|
|
1895
2013
|
});
|
|
1896
|
-
r.value = new
|
|
2014
|
+
r.value = new Al(d), r.value.setTabSize(o), r.value.setExtensions(u()), r.value.setDisabled(e.disabled), r.value.setReadOnly(e.readonly), e.placeholder && r.value.setPlaceholder(e.placeholder), e.autofocus && d.focus(), e.maxlength && r.value.setMaxLength(e.maxlength), h.on(a, {
|
|
1897
2015
|
name: "ctrlZ",
|
|
1898
2016
|
callback() {
|
|
1899
|
-
Dt(
|
|
2017
|
+
Dt(d);
|
|
1900
2018
|
}
|
|
1901
|
-
}), h.on(
|
|
2019
|
+
}), h.on(a, {
|
|
1902
2020
|
name: "ctrlShiftZ",
|
|
1903
2021
|
callback() {
|
|
1904
|
-
Et(
|
|
2022
|
+
Et(d);
|
|
1905
2023
|
}
|
|
1906
|
-
}), h.on(
|
|
2024
|
+
}), h.on(a, {
|
|
1907
2025
|
name: "replace",
|
|
1908
|
-
callback(
|
|
1909
|
-
var
|
|
1910
|
-
const { text: b, options: v } =
|
|
1911
|
-
(
|
|
2026
|
+
callback(p, $ = {}) {
|
|
2027
|
+
var g;
|
|
2028
|
+
const { text: b, options: v } = el(p, r.value, $);
|
|
2029
|
+
(g = r.value) == null || g.replaceSelectedText(b, v);
|
|
1912
2030
|
}
|
|
1913
2031
|
});
|
|
1914
2032
|
}), I(
|
|
1915
|
-
() => l.value,
|
|
2033
|
+
[() => l.value, e.completions],
|
|
1916
2034
|
() => {
|
|
1917
|
-
var
|
|
1918
|
-
|
|
2035
|
+
var d;
|
|
2036
|
+
(d = r.value) == null || d.setExtensions(u());
|
|
2037
|
+
},
|
|
2038
|
+
{
|
|
2039
|
+
deep: !0
|
|
1919
2040
|
}
|
|
1920
2041
|
), I(
|
|
1921
2042
|
() => e.value,
|
|
1922
2043
|
() => {
|
|
1923
|
-
var
|
|
1924
|
-
((
|
|
2044
|
+
var d, p;
|
|
2045
|
+
((d = r.value) == null ? void 0 : d.getValue()) !== e.value && ((p = r.value) == null || p.setValue(e.value));
|
|
1925
2046
|
}
|
|
1926
2047
|
), I(
|
|
1927
2048
|
() => e.placeholder,
|
|
1928
2049
|
() => {
|
|
1929
|
-
var
|
|
1930
|
-
(
|
|
2050
|
+
var d;
|
|
2051
|
+
(d = r.value) == null || d.setPlaceholder(e.placeholder);
|
|
1931
2052
|
}
|
|
1932
2053
|
), I(
|
|
1933
2054
|
() => e.disabled,
|
|
1934
2055
|
() => {
|
|
1935
|
-
var
|
|
1936
|
-
(
|
|
2056
|
+
var d;
|
|
2057
|
+
(d = r.value) == null || d.setDisabled(e.disabled);
|
|
1937
2058
|
}
|
|
1938
2059
|
), I(
|
|
1939
2060
|
() => e.readonly,
|
|
1940
2061
|
() => {
|
|
1941
|
-
var
|
|
1942
|
-
(
|
|
2062
|
+
var d;
|
|
2063
|
+
(d = r.value) == null || d.setDisabled(e.readonly);
|
|
1943
2064
|
}
|
|
1944
2065
|
), I(
|
|
1945
2066
|
() => e.maxlength,
|
|
1946
2067
|
() => {
|
|
1947
|
-
var
|
|
1948
|
-
e.maxlength && ((
|
|
2068
|
+
var d;
|
|
2069
|
+
e.maxlength && ((d = r.value) == null || d.setMaxLength(e.maxlength));
|
|
1949
2070
|
}
|
|
1950
|
-
),
|
|
1951
|
-
inputWrapperRef:
|
|
2071
|
+
), El(r), {
|
|
2072
|
+
inputWrapperRef: i,
|
|
1952
2073
|
codeMirrorUt: r
|
|
1953
2074
|
};
|
|
1954
|
-
},
|
|
2075
|
+
}, Il = Fl, Ol = {
|
|
1955
2076
|
value: {
|
|
1956
2077
|
type: String,
|
|
1957
2078
|
default: ""
|
|
@@ -2040,25 +2161,28 @@ const xl = (e) => {
|
|
|
2040
2161
|
noHighlight: {
|
|
2041
2162
|
type: Boolean,
|
|
2042
2163
|
default: !1
|
|
2164
|
+
},
|
|
2165
|
+
completions: {
|
|
2166
|
+
type: Array
|
|
2043
2167
|
}
|
|
2044
|
-
},
|
|
2168
|
+
}, Vl = /* @__PURE__ */ O({
|
|
2045
2169
|
name: "MDEditorContent",
|
|
2046
|
-
props:
|
|
2170
|
+
props: Ol,
|
|
2047
2171
|
setup(e) {
|
|
2048
|
-
const o =
|
|
2049
|
-
inputWrapperRef:
|
|
2172
|
+
const o = U(""), {
|
|
2173
|
+
inputWrapperRef: a,
|
|
2050
2174
|
codeMirrorUt: l
|
|
2051
|
-
} =
|
|
2052
|
-
return
|
|
2053
|
-
class: `${
|
|
2175
|
+
} = Il(e);
|
|
2176
|
+
return Qt(e, o, l), () => t("div", {
|
|
2177
|
+
class: `${n}-content`
|
|
2054
2178
|
}, [t("div", {
|
|
2055
|
-
class: `${
|
|
2056
|
-
ref:
|
|
2179
|
+
class: `${n}-input-wrapper`,
|
|
2180
|
+
ref: a
|
|
2057
2181
|
}, null), t(ut, {
|
|
2058
2182
|
modelValue: e.value,
|
|
2059
2183
|
setting: e.setting,
|
|
2060
|
-
onHtmlChanged: (
|
|
2061
|
-
o.value =
|
|
2184
|
+
onHtmlChanged: (i) => {
|
|
2185
|
+
o.value = i, e.onHtmlChanged(i);
|
|
2062
2186
|
},
|
|
2063
2187
|
onGetCatalog: e.onGetCatalog,
|
|
2064
2188
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2069,7 +2193,7 @@ const xl = (e) => {
|
|
|
2069
2193
|
noHighlight: e.noHighlight
|
|
2070
2194
|
}, null)]);
|
|
2071
2195
|
}
|
|
2072
|
-
}),
|
|
2196
|
+
}), Rl = /* @__PURE__ */ O({
|
|
2073
2197
|
props: {
|
|
2074
2198
|
modelValue: {
|
|
2075
2199
|
type: String,
|
|
@@ -2077,17 +2201,17 @@ const xl = (e) => {
|
|
|
2077
2201
|
}
|
|
2078
2202
|
},
|
|
2079
2203
|
setup(e) {
|
|
2080
|
-
const o =
|
|
2204
|
+
const o = A("usedLanguageText");
|
|
2081
2205
|
return () => {
|
|
2082
|
-
var
|
|
2206
|
+
var a, l;
|
|
2083
2207
|
return t("div", {
|
|
2084
|
-
class: `${
|
|
2208
|
+
class: `${n}-footer-item`
|
|
2085
2209
|
}, [t("label", {
|
|
2086
|
-
class: `${
|
|
2087
|
-
}, [`${(
|
|
2210
|
+
class: `${n}-footer-label`
|
|
2211
|
+
}, [`${(a = o.value.footer) == null ? void 0 : a.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
|
|
2088
2212
|
};
|
|
2089
2213
|
}
|
|
2090
|
-
}),
|
|
2214
|
+
}), Nl = {
|
|
2091
2215
|
checked: {
|
|
2092
2216
|
type: Boolean,
|
|
2093
2217
|
default: !1
|
|
@@ -2097,17 +2221,17 @@ const xl = (e) => {
|
|
|
2097
2221
|
default: () => {
|
|
2098
2222
|
}
|
|
2099
2223
|
}
|
|
2100
|
-
},
|
|
2101
|
-
props:
|
|
2224
|
+
}, Pl = /* @__PURE__ */ O({
|
|
2225
|
+
props: Nl,
|
|
2102
2226
|
setup(e) {
|
|
2103
2227
|
return () => t("div", {
|
|
2104
|
-
class: [`${
|
|
2228
|
+
class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
|
|
2105
2229
|
onClick: () => {
|
|
2106
2230
|
e.onChange(!e.checked);
|
|
2107
2231
|
}
|
|
2108
2232
|
}, null);
|
|
2109
2233
|
}
|
|
2110
|
-
}),
|
|
2234
|
+
}), ql = {
|
|
2111
2235
|
scrollAuto: {
|
|
2112
2236
|
type: Boolean
|
|
2113
2237
|
},
|
|
@@ -2116,26 +2240,26 @@ const xl = (e) => {
|
|
|
2116
2240
|
default: () => {
|
|
2117
2241
|
}
|
|
2118
2242
|
}
|
|
2119
|
-
},
|
|
2120
|
-
props:
|
|
2243
|
+
}, Ul = /* @__PURE__ */ O({
|
|
2244
|
+
props: ql,
|
|
2121
2245
|
setup(e) {
|
|
2122
|
-
const o =
|
|
2246
|
+
const o = A("usedLanguageText");
|
|
2123
2247
|
return () => {
|
|
2124
|
-
var
|
|
2248
|
+
var a;
|
|
2125
2249
|
return t("div", {
|
|
2126
|
-
class: `${
|
|
2250
|
+
class: `${n}-footer-item`
|
|
2127
2251
|
}, [t("label", {
|
|
2128
|
-
class: `${
|
|
2252
|
+
class: `${n}-footer-label`,
|
|
2129
2253
|
onClick: () => {
|
|
2130
2254
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2131
2255
|
}
|
|
2132
|
-
}, [(
|
|
2256
|
+
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Pl, {
|
|
2133
2257
|
checked: e.scrollAuto,
|
|
2134
2258
|
onChange: e.onScrollAutoChange
|
|
2135
2259
|
}, null)]);
|
|
2136
2260
|
};
|
|
2137
2261
|
}
|
|
2138
|
-
}),
|
|
2262
|
+
}), Gl = {
|
|
2139
2263
|
modelValue: {
|
|
2140
2264
|
type: String,
|
|
2141
2265
|
default: ""
|
|
@@ -2155,22 +2279,22 @@ const xl = (e) => {
|
|
|
2155
2279
|
defFooters: {
|
|
2156
2280
|
type: Object
|
|
2157
2281
|
}
|
|
2158
|
-
},
|
|
2282
|
+
}, Kl = /* @__PURE__ */ O({
|
|
2159
2283
|
name: "MDEditorFooter",
|
|
2160
|
-
props:
|
|
2284
|
+
props: Gl,
|
|
2161
2285
|
setup(e) {
|
|
2162
|
-
const o =
|
|
2163
|
-
const l = e.footers.indexOf("="),
|
|
2164
|
-
return [
|
|
2165
|
-
}),
|
|
2286
|
+
const o = fe(() => {
|
|
2287
|
+
const l = e.footers.indexOf("="), i = l === -1 ? e.footers : e.footers.slice(0, l), r = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
|
|
2288
|
+
return [i, r];
|
|
2289
|
+
}), a = (l) => {
|
|
2166
2290
|
if (lt.includes(l))
|
|
2167
2291
|
switch (l) {
|
|
2168
2292
|
case "markdownTotal":
|
|
2169
|
-
return t(
|
|
2293
|
+
return t(Rl, {
|
|
2170
2294
|
modelValue: e.modelValue
|
|
2171
2295
|
}, null);
|
|
2172
2296
|
case "scrollSwitch":
|
|
2173
|
-
return t(
|
|
2297
|
+
return t(Ul, {
|
|
2174
2298
|
scrollAuto: e.scrollAuto,
|
|
2175
2299
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2176
2300
|
}, null);
|
|
@@ -2179,62 +2303,62 @@ const xl = (e) => {
|
|
|
2179
2303
|
return e.defFooters instanceof Array ? e.defFooters[l] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[l] || "";
|
|
2180
2304
|
};
|
|
2181
2305
|
return () => {
|
|
2182
|
-
const l = o.value[0].map((r) =>
|
|
2306
|
+
const l = o.value[0].map((r) => a(r)), i = o.value[1].map((r) => a(r));
|
|
2183
2307
|
return t("div", {
|
|
2184
|
-
class: `${
|
|
2308
|
+
class: `${n}-footer`
|
|
2185
2309
|
}, [t("div", {
|
|
2186
|
-
class: `${
|
|
2310
|
+
class: `${n}-footer-left`
|
|
2187
2311
|
}, [l]), t("div", {
|
|
2188
|
-
class: `${
|
|
2189
|
-
}, [
|
|
2312
|
+
class: `${n}-footer-right`
|
|
2313
|
+
}, [i])]);
|
|
2190
2314
|
};
|
|
2191
2315
|
}
|
|
2192
|
-
}),
|
|
2316
|
+
}), jl = /* @__PURE__ */ O({
|
|
2193
2317
|
name: "MdEditorV3",
|
|
2194
2318
|
props: mt,
|
|
2195
2319
|
emits: ft,
|
|
2196
2320
|
setup(e, o) {
|
|
2197
2321
|
const {
|
|
2198
|
-
editorId:
|
|
2322
|
+
editorId: a,
|
|
2199
2323
|
noKatex: l,
|
|
2200
|
-
noMermaid:
|
|
2324
|
+
noMermaid: i,
|
|
2201
2325
|
noPrettier: r,
|
|
2202
2326
|
noUploadImg: c,
|
|
2203
|
-
noHighlight:
|
|
2204
|
-
} = e, f =
|
|
2327
|
+
noHighlight: m
|
|
2328
|
+
} = e, f = Z({
|
|
2205
2329
|
scrollAuto: e.scrollAuto
|
|
2206
2330
|
});
|
|
2207
2331
|
gt(e, o), ht(e), bt(e);
|
|
2208
|
-
const [
|
|
2332
|
+
const [u, d] = vt(e, o), p = pt(e);
|
|
2209
2333
|
return Qe(() => {
|
|
2210
|
-
h.clear(
|
|
2211
|
-
}),
|
|
2334
|
+
h.clear(a);
|
|
2335
|
+
}), kt(e, o, p, u, d), () => {
|
|
2212
2336
|
var v;
|
|
2213
|
-
const $ =
|
|
2337
|
+
const $ = He({
|
|
2214
2338
|
props: e,
|
|
2215
2339
|
ctx: o
|
|
2216
|
-
}, "defToolbars"), b =
|
|
2340
|
+
}, "defToolbars"), b = He({
|
|
2217
2341
|
props: e,
|
|
2218
2342
|
ctx: o
|
|
2219
2343
|
}, "defFooters");
|
|
2220
2344
|
return t("div", {
|
|
2221
|
-
id:
|
|
2222
|
-
class: [
|
|
2345
|
+
id: a,
|
|
2346
|
+
class: [n, e.class, e.theme === "dark" && `${n}-dark`, u.fullscreen || u.pageFullscreen ? `${n}-fullscreen` : ""],
|
|
2223
2347
|
style: e.style
|
|
2224
|
-
}, [t(
|
|
2348
|
+
}, [t(Yt, {
|
|
2225
2349
|
noPrettier: r,
|
|
2226
2350
|
toolbars: e.toolbars,
|
|
2227
2351
|
toolbarsExclude: e.toolbarsExclude,
|
|
2228
|
-
setting:
|
|
2229
|
-
updateSetting:
|
|
2352
|
+
setting: u,
|
|
2353
|
+
updateSetting: d,
|
|
2230
2354
|
tableShape: e.tableShape,
|
|
2231
2355
|
defToolbars: $,
|
|
2232
2356
|
noUploadImg: c
|
|
2233
|
-
}, null), t(
|
|
2357
|
+
}, null), t(Vl, {
|
|
2234
2358
|
value: e.modelValue,
|
|
2235
|
-
setting:
|
|
2359
|
+
setting: u,
|
|
2236
2360
|
mdHeadingId: e.mdHeadingId,
|
|
2237
|
-
noMermaid:
|
|
2361
|
+
noMermaid: i,
|
|
2238
2362
|
noPrettier: r,
|
|
2239
2363
|
sanitize: e.sanitize,
|
|
2240
2364
|
placeholder: e.placeholder,
|
|
@@ -2246,39 +2370,40 @@ const xl = (e) => {
|
|
|
2246
2370
|
readonly: e.readOnly,
|
|
2247
2371
|
maxlength: e.maxLength,
|
|
2248
2372
|
autoDetectCode: e.autoDetectCode,
|
|
2249
|
-
noHighlight:
|
|
2250
|
-
onChange: (
|
|
2251
|
-
e.onChange ? e.onChange(
|
|
2373
|
+
noHighlight: m,
|
|
2374
|
+
onChange: (g) => {
|
|
2375
|
+
e.onChange ? e.onChange(g) : (o.emit("update:modelValue", g), o.emit("onChange", g));
|
|
2252
2376
|
},
|
|
2253
|
-
onHtmlChanged: (
|
|
2254
|
-
e.onHtmlChanged ? e.onHtmlChanged(
|
|
2377
|
+
onHtmlChanged: (g) => {
|
|
2378
|
+
e.onHtmlChanged ? e.onHtmlChanged(g) : o.emit("onHtmlChanged", g);
|
|
2255
2379
|
},
|
|
2256
|
-
onGetCatalog: (
|
|
2257
|
-
e.onGetCatalog ? e.onGetCatalog(
|
|
2380
|
+
onGetCatalog: (g) => {
|
|
2381
|
+
e.onGetCatalog ? e.onGetCatalog(g) : o.emit("onGetCatalog", g);
|
|
2258
2382
|
},
|
|
2259
|
-
onBlur: (
|
|
2260
|
-
e.onBlur ? e.onBlur(
|
|
2383
|
+
onBlur: (g) => {
|
|
2384
|
+
e.onBlur ? e.onBlur(g) : o.emit("onBlur", g);
|
|
2261
2385
|
},
|
|
2262
|
-
onFocus: (
|
|
2263
|
-
e.onFocus ? e.onFocus(
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2386
|
+
onFocus: (g) => {
|
|
2387
|
+
e.onFocus ? e.onFocus(g) : o.emit("onFocus", g);
|
|
2388
|
+
},
|
|
2389
|
+
completions: e.completions
|
|
2390
|
+
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(Kl, {
|
|
2266
2391
|
modelValue: e.modelValue,
|
|
2267
2392
|
footers: e.footers,
|
|
2268
2393
|
defFooters: b,
|
|
2269
2394
|
scrollAuto: f.scrollAuto,
|
|
2270
|
-
onScrollAutoChange: (
|
|
2271
|
-
}, null),
|
|
2395
|
+
onScrollAutoChange: (g) => f.scrollAuto = g
|
|
2396
|
+
}, null), p.value && t(Ye, {
|
|
2272
2397
|
theme: e.theme,
|
|
2273
|
-
class: `${
|
|
2274
|
-
editorId:
|
|
2398
|
+
class: `${n}-catalog-editor`,
|
|
2399
|
+
editorId: a,
|
|
2275
2400
|
mdHeadingId: e.mdHeadingId,
|
|
2276
2401
|
key: "internal-catalog"
|
|
2277
2402
|
}, null)]);
|
|
2278
2403
|
};
|
|
2279
2404
|
}
|
|
2280
|
-
}),
|
|
2281
|
-
|
|
2405
|
+
}), ue = jl;
|
|
2406
|
+
ue.install = (e) => (e.component(ue.name, ue), e.use(Ot).use(ot).use(yt).use(Ye).use(Ct), e);
|
|
2282
2407
|
export {
|
|
2283
|
-
|
|
2408
|
+
ue as default
|
|
2284
2409
|
};
|