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