md-editor-v3 4.3.0-beta.4 → 4.3.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/MdEditor.cjs +24 -24
- package/lib/cjs/chunks/index.cjs +7 -7
- package/lib/es/MdEditor.mjs +457 -429
- package/lib/es/chunks/index.mjs +171 -160
- package/lib/types/MdEditor/layouts/Content/codemirror/index.d.ts +3 -3
- package/lib/types/MdEditor/type.d.ts +2 -1
- package/lib/umd/index.js +6 -6
- package/package.json +1 -1
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
var wt = Object.defineProperty;
|
|
2
|
-
var xt = (e,
|
|
3
|
-
var K = (e,
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { p as o, a as z, s as Mt, b as Lt, d as
|
|
6
|
-
import { draggingScroll as
|
|
2
|
+
var xt = (e, a, l) => a in e ? wt(e, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[a] = l;
|
|
3
|
+
var K = (e, a, l) => (xt(e, typeof a != "symbol" ? a + "" : a, l), l);
|
|
4
|
+
import { defineComponent as V, createVNode as t, inject as A, ref as q, onMounted as Y, reactive as J, computed as he, watch as H, nextTick as ce, Fragment as kt, cloneVNode as at, toRef as le, shallowRef as St, onBeforeUnmount as At } from "vue";
|
|
5
|
+
import { p as o, a as z, s as Mt, b as Lt, d as Dt } from "./chunks/config.mjs";
|
|
6
|
+
import { draggingScroll as It, linkTo as Nt, debounce as Et, throttle as Ht, smoothScroll as rt } from "@vavt/util";
|
|
7
7
|
import { a as te, D as Bt } from "./chunks/index2.mjs";
|
|
8
8
|
import { b as h, a as Ft } from "./chunks/index3.mjs";
|
|
9
|
-
import { C as
|
|
10
|
-
import { a as
|
|
9
|
+
import { C as Vt, a as Ot, O as pt, T as Rt, b as Pt, e as qt, c as Ut, u as Gt, d as Kt, f as jt, g as _t, h as Wt, i as zt, j as Yt, M as Zt } from "./chunks/index.mjs";
|
|
10
|
+
import { a as Jt } from "./chunks/dom.mjs";
|
|
11
11
|
import Ct from "./MdModal.mjs";
|
|
12
|
-
import { minimalSetup as
|
|
13
|
-
import { EditorView as be, placeholder as
|
|
14
|
-
import { languages as
|
|
15
|
-
import { markdown as
|
|
16
|
-
import { htmlCompletionSource as
|
|
17
|
-
import { deleteLine as
|
|
18
|
-
import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as
|
|
12
|
+
import { minimalSetup as Xt, EditorView as ie } from "codemirror";
|
|
13
|
+
import { EditorView as be, placeholder as Qt, keymap as el } from "@codemirror/view";
|
|
14
|
+
import { languages as tl } from "@codemirror/language-data";
|
|
15
|
+
import { markdown as ll } from "@codemirror/lang-markdown";
|
|
16
|
+
import { htmlCompletionSource as ol, html as al } from "@codemirror/lang-html";
|
|
17
|
+
import { deleteLine as rl, indentWithTab as nl, undo as il, redo as sl } from "@codemirror/commands";
|
|
18
|
+
import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as cl } from "@codemirror/language";
|
|
19
19
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as P, EditorState as ue, Compartment as
|
|
21
|
-
import { autocompletion as
|
|
20
|
+
import { EditorSelection as P, EditorState as ue, Compartment as dl, StateEffect as ul } from "@codemirror/state";
|
|
21
|
+
import { autocompletion as ml } from "@codemirror/autocomplete";
|
|
22
22
|
import Tt from "./MdCatalog.mjs";
|
|
23
23
|
import { g as nt } from "./chunks/vue-tsx.mjs";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
24
|
+
import fl from "./NormalToolbar.mjs";
|
|
25
|
+
import gl from "./ModalToolbar.mjs";
|
|
26
26
|
import "medium-zoom";
|
|
27
27
|
import "copy-to-clipboard";
|
|
28
28
|
import "markdown-it";
|
|
29
29
|
import "markdown-it-image-figures";
|
|
30
30
|
import "markdown-it-task-lists";
|
|
31
31
|
import "lru-cache";
|
|
32
|
-
const
|
|
32
|
+
const hl = /* @__PURE__ */ V({
|
|
33
33
|
setup() {
|
|
34
34
|
return () => t("div", {
|
|
35
35
|
class: `${o}-divider`
|
|
36
36
|
}, null);
|
|
37
37
|
}
|
|
38
|
-
}),
|
|
38
|
+
}), bl = {
|
|
39
39
|
noPrettier: {
|
|
40
40
|
type: Boolean
|
|
41
41
|
},
|
|
@@ -84,13 +84,13 @@ const gl = /* @__PURE__ */ O({
|
|
|
84
84
|
showToolbarName: {
|
|
85
85
|
type: Boolean
|
|
86
86
|
}
|
|
87
|
-
},
|
|
88
|
-
var c,
|
|
89
|
-
const
|
|
90
|
-
let l = (
|
|
91
|
-
const
|
|
87
|
+
}, vl = (e) => {
|
|
88
|
+
var c, f, m, b;
|
|
89
|
+
const a = A("editorId");
|
|
90
|
+
let l = (f = (c = z.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : f.instance;
|
|
91
|
+
const r = (b = (m = z.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : b.js, n = q(!1), i = ($) => {
|
|
92
92
|
if (!l) {
|
|
93
|
-
h.emit(
|
|
93
|
+
h.emit(a, "errorCatcher", {
|
|
94
94
|
name: "fullscreen",
|
|
95
95
|
message: "fullscreen is undefined"
|
|
96
96
|
});
|
|
@@ -107,15 +107,15 @@ const gl = /* @__PURE__ */ O({
|
|
|
107
107
|
return Y(() => {
|
|
108
108
|
if (u(), !l) {
|
|
109
109
|
const $ = document.createElement("script");
|
|
110
|
-
$.src =
|
|
110
|
+
$.src = r || Mt, $.onload = d, $.id = `${o}-screenfull`, Jt($, "screenfull");
|
|
111
111
|
}
|
|
112
112
|
}), Y(() => {
|
|
113
|
-
h.on(
|
|
114
|
-
name:
|
|
113
|
+
h.on(a, {
|
|
114
|
+
name: Vt,
|
|
115
115
|
callback: i
|
|
116
116
|
});
|
|
117
117
|
}), { fullscreenHandler: i };
|
|
118
|
-
},
|
|
118
|
+
}, kl = {
|
|
119
119
|
tableShape: {
|
|
120
120
|
type: Array,
|
|
121
121
|
default: () => [6, 4]
|
|
@@ -125,36 +125,36 @@ const gl = /* @__PURE__ */ O({
|
|
|
125
125
|
default: () => {
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
},
|
|
128
|
+
}, pl = /* @__PURE__ */ V({
|
|
129
129
|
name: "TableShape",
|
|
130
|
-
props:
|
|
130
|
+
props: kl,
|
|
131
131
|
setup(e) {
|
|
132
|
-
const
|
|
132
|
+
const a = J({
|
|
133
133
|
x: -1,
|
|
134
134
|
y: -1
|
|
135
135
|
});
|
|
136
136
|
return () => t("div", {
|
|
137
137
|
class: `${o}-table-shape`,
|
|
138
138
|
onMouseleave: () => {
|
|
139
|
-
|
|
139
|
+
a.x = -1, a.y = -1;
|
|
140
140
|
}
|
|
141
|
-
}, [new Array(e.tableShape[1]).fill("").map((l,
|
|
141
|
+
}, [new Array(e.tableShape[1]).fill("").map((l, r) => t("div", {
|
|
142
142
|
class: `${o}-table-shape-row`,
|
|
143
|
-
key: `table-shape-row-${
|
|
143
|
+
key: `table-shape-row-${r}`
|
|
144
144
|
}, [new Array(e.tableShape[0]).fill("").map((n, i) => t("div", {
|
|
145
145
|
class: `${o}-table-shape-col`,
|
|
146
146
|
key: `table-shape-col-${i}`,
|
|
147
147
|
onMouseenter: () => {
|
|
148
|
-
|
|
148
|
+
a.x = r, a.y = i;
|
|
149
149
|
},
|
|
150
150
|
onClick: () => {
|
|
151
|
-
e.onSelected(
|
|
151
|
+
e.onSelected(a);
|
|
152
152
|
}
|
|
153
153
|
}, [t("div", {
|
|
154
|
-
class: [`${o}-table-shape-col-default`,
|
|
154
|
+
class: [`${o}-table-shape-col-default`, r <= a.x && i <= a.y && `${o}-table-shape-col-include`]
|
|
155
155
|
}, null)]))]))]);
|
|
156
156
|
}
|
|
157
|
-
}),
|
|
157
|
+
}), Cl = pl, $l = {
|
|
158
158
|
type: {
|
|
159
159
|
type: String,
|
|
160
160
|
default: "link"
|
|
@@ -173,16 +173,16 @@ const gl = /* @__PURE__ */ O({
|
|
|
173
173
|
default: () => {
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
},
|
|
177
|
-
props:
|
|
176
|
+
}, yl = /* @__PURE__ */ V({
|
|
177
|
+
props: $l,
|
|
178
178
|
setup(e) {
|
|
179
|
-
const
|
|
179
|
+
const a = A("usedLanguageText"), l = A("editorId"), r = he(() => {
|
|
180
180
|
var i, u;
|
|
181
181
|
switch (e.type) {
|
|
182
182
|
case "link":
|
|
183
|
-
return (i =
|
|
183
|
+
return (i = a.value.linkModalTips) == null ? void 0 : i.linkTitle;
|
|
184
184
|
case "image":
|
|
185
|
-
return (u =
|
|
185
|
+
return (u = a.value.linkModalTips) == null ? void 0 : u.imageTitle;
|
|
186
186
|
default:
|
|
187
187
|
return "";
|
|
188
188
|
}
|
|
@@ -195,25 +195,25 @@ const gl = /* @__PURE__ */ O({
|
|
|
195
195
|
n.desc = "", n.url = "";
|
|
196
196
|
}, 200);
|
|
197
197
|
}), () => t(Ct, {
|
|
198
|
-
title:
|
|
198
|
+
title: r.value,
|
|
199
199
|
visible: e.visible,
|
|
200
200
|
onClose: e.onCancel
|
|
201
201
|
}, {
|
|
202
202
|
default: () => {
|
|
203
|
-
var i, u, d, c,
|
|
203
|
+
var i, u, d, c, f;
|
|
204
204
|
return [t("div", {
|
|
205
205
|
class: `${o}-form-item`
|
|
206
206
|
}, [t("label", {
|
|
207
207
|
class: `${o}-label`,
|
|
208
208
|
for: `link-desc-${l}`
|
|
209
|
-
}, [(i =
|
|
210
|
-
placeholder: (u =
|
|
209
|
+
}, [(i = a.value.linkModalTips) == null ? void 0 : i.descLabel]), t("input", {
|
|
210
|
+
placeholder: (u = a.value.linkModalTips) == null ? void 0 : u.descLabelPlaceHolder,
|
|
211
211
|
class: `${o}-input`,
|
|
212
212
|
id: `link-desc-${l}`,
|
|
213
213
|
type: "text",
|
|
214
214
|
value: n.desc,
|
|
215
|
-
onChange: (
|
|
216
|
-
n.desc =
|
|
215
|
+
onChange: (m) => {
|
|
216
|
+
n.desc = m.target.value;
|
|
217
217
|
},
|
|
218
218
|
autocomplete: "off"
|
|
219
219
|
}, null)]), t("div", {
|
|
@@ -221,14 +221,14 @@ const gl = /* @__PURE__ */ O({
|
|
|
221
221
|
}, [t("label", {
|
|
222
222
|
class: `${o}-label`,
|
|
223
223
|
for: `link-url-${l}`
|
|
224
|
-
}, [(d =
|
|
225
|
-
placeholder: (c =
|
|
224
|
+
}, [(d = a.value.linkModalTips) == null ? void 0 : d.urlLabel]), t("input", {
|
|
225
|
+
placeholder: (c = a.value.linkModalTips) == null ? void 0 : c.urlLabelPlaceHolder,
|
|
226
226
|
class: `${o}-input`,
|
|
227
227
|
id: `link-url-${l}`,
|
|
228
228
|
type: "text",
|
|
229
229
|
value: n.url,
|
|
230
|
-
onChange: (
|
|
231
|
-
n.url =
|
|
230
|
+
onChange: (m) => {
|
|
231
|
+
n.url = m.target.value;
|
|
232
232
|
},
|
|
233
233
|
autocomplete: "off"
|
|
234
234
|
}, null)]), t("div", {
|
|
@@ -239,11 +239,11 @@ const gl = /* @__PURE__ */ O({
|
|
|
239
239
|
onClick: () => {
|
|
240
240
|
e.onOk(n), n.desc = "", n.url = "";
|
|
241
241
|
}
|
|
242
|
-
}, [(
|
|
242
|
+
}, [(f = a.value.linkModalTips) == null ? void 0 : f.buttonOK])])];
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
}),
|
|
246
|
+
}), Tl = {
|
|
247
247
|
visible: {
|
|
248
248
|
type: Boolean,
|
|
249
249
|
default: !1
|
|
@@ -258,12 +258,12 @@ const gl = /* @__PURE__ */ O({
|
|
|
258
258
|
default: () => {
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
},
|
|
262
|
-
props:
|
|
261
|
+
}, wl = /* @__PURE__ */ V({
|
|
262
|
+
props: Tl,
|
|
263
263
|
setup(e) {
|
|
264
|
-
var
|
|
265
|
-
const
|
|
266
|
-
let
|
|
264
|
+
var m, b, $;
|
|
265
|
+
const a = A("usedLanguageText"), l = A("editorId");
|
|
266
|
+
let r = ($ = (b = (m = z) == null ? void 0 : m.editorExtensions) == null ? void 0 : b.cropper) == null ? void 0 : $.instance;
|
|
267
267
|
const n = q(), i = q(), u = q(), d = J({
|
|
268
268
|
cropperInited: !1,
|
|
269
269
|
imgSelected: !1,
|
|
@@ -273,8 +273,8 @@ const gl = /* @__PURE__ */ O({
|
|
|
273
273
|
});
|
|
274
274
|
let c = null;
|
|
275
275
|
H(() => e.visible, () => {
|
|
276
|
-
e.visible && !d.cropperInited && (
|
|
277
|
-
if (!
|
|
276
|
+
e.visible && !d.cropperInited && (r = r || window.Cropper, n.value.onchange = () => {
|
|
277
|
+
if (!r) {
|
|
278
278
|
h.emit(l, "errorCatcher", {
|
|
279
279
|
name: "Cropper",
|
|
280
280
|
message: "Cropper is undefined"
|
|
@@ -286,7 +286,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
286
286
|
const v = new FileReader();
|
|
287
287
|
v.onload = (g) => {
|
|
288
288
|
d.imgSrc = g.target.result, ce(() => {
|
|
289
|
-
c = new
|
|
289
|
+
c = new r(i.value, {
|
|
290
290
|
viewMode: 2,
|
|
291
291
|
preview: `.${o}-clip-preview-target`
|
|
292
292
|
// aspectRatio: 16 / 9,
|
|
@@ -299,21 +299,21 @@ const gl = /* @__PURE__ */ O({
|
|
|
299
299
|
u.value.style = "";
|
|
300
300
|
}), H(() => d.isFullscreen, () => {
|
|
301
301
|
ce(() => {
|
|
302
|
-
c == null || c.destroy(), u.value.style = "", i.value && (c = new
|
|
302
|
+
c == null || c.destroy(), u.value.style = "", i.value && (c = new r(i.value, {
|
|
303
303
|
viewMode: 2,
|
|
304
304
|
preview: `.${o}-clip-preview-target`
|
|
305
305
|
// aspectRatio: 16 / 9,
|
|
306
306
|
}));
|
|
307
307
|
});
|
|
308
308
|
});
|
|
309
|
-
const
|
|
309
|
+
const f = () => {
|
|
310
310
|
c.clear(), c.destroy(), c = null, n.value.value = "", d.imgSelected = !1;
|
|
311
311
|
};
|
|
312
312
|
return () => {
|
|
313
313
|
var T;
|
|
314
314
|
return t(Ct, {
|
|
315
315
|
class: `${o}-modal-clip`,
|
|
316
|
-
title: (T =
|
|
316
|
+
title: (T = a.value.clipModalTips) == null ? void 0 : T.title,
|
|
317
317
|
visible: e.visible,
|
|
318
318
|
onClose: e.onCancel,
|
|
319
319
|
showAdjust: !0,
|
|
@@ -341,7 +341,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
341
341
|
alt: ""
|
|
342
342
|
}, null), t("div", {
|
|
343
343
|
class: `${o}-clip-delete`,
|
|
344
|
-
onClick:
|
|
344
|
+
onClick: f
|
|
345
345
|
}, [t("svg", {
|
|
346
346
|
class: `${o}-icon`,
|
|
347
347
|
"aria-hidden": "true"
|
|
@@ -370,10 +370,10 @@ const gl = /* @__PURE__ */ O({
|
|
|
370
370
|
onClick: () => {
|
|
371
371
|
if (c) {
|
|
372
372
|
const k = c.getCroppedCanvas();
|
|
373
|
-
h.emit(l, "uploadImage", [Ft(k.toDataURL("image/png"))], e.onOk),
|
|
373
|
+
h.emit(l, "uploadImage", [Ft(k.toDataURL("image/png"))], e.onOk), f();
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
}, [((v =
|
|
376
|
+
}, [((v = a.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((g = a.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
|
|
377
377
|
ref: n,
|
|
378
378
|
accept: "image/*",
|
|
379
379
|
type: "file",
|
|
@@ -386,7 +386,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
386
386
|
});
|
|
387
387
|
};
|
|
388
388
|
}
|
|
389
|
-
}),
|
|
389
|
+
}), xl = {
|
|
390
390
|
type: {
|
|
391
391
|
type: String,
|
|
392
392
|
default: "link"
|
|
@@ -409,27 +409,27 @@ const gl = /* @__PURE__ */ O({
|
|
|
409
409
|
default: () => {
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
},
|
|
413
|
-
props:
|
|
412
|
+
}, Sl = /* @__PURE__ */ V({
|
|
413
|
+
props: xl,
|
|
414
414
|
setup(e) {
|
|
415
|
-
return () => t(kt, null, [t(
|
|
415
|
+
return () => t(kt, null, [t(yl, {
|
|
416
416
|
type: e.type,
|
|
417
417
|
visible: e.linkVisible,
|
|
418
418
|
onOk: e.onOk,
|
|
419
419
|
onCancel: e.onCancel
|
|
420
|
-
}, null), t(
|
|
420
|
+
}, null), t(wl, {
|
|
421
421
|
visible: e.clipVisible,
|
|
422
422
|
onOk: e.onOk,
|
|
423
423
|
onCancel: e.onCancel
|
|
424
424
|
}, null)]);
|
|
425
425
|
}
|
|
426
|
-
}),
|
|
426
|
+
}), Al = /* @__PURE__ */ V({
|
|
427
427
|
name: "MDEditorToolbar",
|
|
428
|
-
props:
|
|
428
|
+
props: bl,
|
|
429
429
|
setup(e) {
|
|
430
|
-
const
|
|
431
|
-
fullscreenHandler:
|
|
432
|
-
} =
|
|
430
|
+
const a = A("editorId"), l = A("usedLanguageText"), {
|
|
431
|
+
fullscreenHandler: r
|
|
432
|
+
} = vl(e), n = `${a}-toolbar-wrapper`, i = q(), u = J({
|
|
433
433
|
title: !1,
|
|
434
434
|
catalog: !1,
|
|
435
435
|
// 图片上传下拉
|
|
@@ -440,35 +440,35 @@ const gl = /* @__PURE__ */ O({
|
|
|
440
440
|
mermaid: !1,
|
|
441
441
|
katex: !1
|
|
442
442
|
}), d = (v, g) => {
|
|
443
|
-
h.emit(
|
|
443
|
+
h.emit(a, "replace", v, g);
|
|
444
444
|
}, c = J({
|
|
445
445
|
type: "link",
|
|
446
446
|
linkVisible: !1,
|
|
447
447
|
clipVisible: !1
|
|
448
|
-
}),
|
|
448
|
+
}), f = q();
|
|
449
449
|
Y(() => {
|
|
450
|
-
h.on(
|
|
450
|
+
h.on(a, {
|
|
451
451
|
name: "openModals",
|
|
452
452
|
callback(v) {
|
|
453
453
|
c.type = v, c.linkVisible = !0;
|
|
454
454
|
}
|
|
455
455
|
});
|
|
456
456
|
});
|
|
457
|
-
const
|
|
457
|
+
const m = he(() => {
|
|
458
458
|
const v = e.toolbars.filter((w) => !e.toolbarsExclude.includes(w)), g = v.indexOf("="), k = g === -1 ? v : v.slice(0, g + 1), y = g === -1 ? [] : v.slice(g, Number.MAX_SAFE_INTEGER);
|
|
459
459
|
return [k, y];
|
|
460
460
|
}), b = q(), $ = () => {
|
|
461
|
-
h.emit(
|
|
461
|
+
h.emit(a, "uploadImage", Array.from(b.value.files || [])), b.value.value = "";
|
|
462
462
|
};
|
|
463
463
|
Y(() => {
|
|
464
464
|
b.value.addEventListener("change", $);
|
|
465
465
|
});
|
|
466
466
|
const T = (v) => {
|
|
467
|
-
var g, k, y, w, x, L, C, M, R,
|
|
467
|
+
var g, k, y, w, x, L, C, M, R, D, I, O, B, N, j, U, re, X, _, G, Q, W, E, F, ee, ne, ve, ke, pe, Ce, $e, ye, Te, we, xe, Se, Ae, Me, Le, De, Ie, Ne, Ee, He, Be, Fe, Ve, Oe, Re, Pe, qe, Ue, Ge, Ke, je, _e, We, ze, Ye, Ze, Je, Xe, Qe, et, tt, lt, ot;
|
|
468
468
|
if (Lt.includes(v))
|
|
469
469
|
switch (v) {
|
|
470
470
|
case "-":
|
|
471
|
-
return t(
|
|
471
|
+
return t(hl, null, null);
|
|
472
472
|
case "bold":
|
|
473
473
|
return t("div", {
|
|
474
474
|
class: `${o}-toolbar-item`,
|
|
@@ -551,17 +551,17 @@ const gl = /* @__PURE__ */ O({
|
|
|
551
551
|
onClick: () => {
|
|
552
552
|
d("h2");
|
|
553
553
|
}
|
|
554
|
-
}, [(
|
|
554
|
+
}, [(D = l.value.titleItem) == null ? void 0 : D.h2]), t("li", {
|
|
555
555
|
class: `${o}-menu-item`,
|
|
556
556
|
onClick: () => {
|
|
557
557
|
d("h3");
|
|
558
558
|
}
|
|
559
|
-
}, [(
|
|
559
|
+
}, [(I = l.value.titleItem) == null ? void 0 : I.h3]), t("li", {
|
|
560
560
|
class: `${o}-menu-item`,
|
|
561
561
|
onClick: () => {
|
|
562
562
|
d("h4");
|
|
563
563
|
}
|
|
564
|
-
}, [(
|
|
564
|
+
}, [(O = l.value.titleItem) == null ? void 0 : O.h4]), t("li", {
|
|
565
565
|
class: `${o}-menu-item`,
|
|
566
566
|
onClick: () => {
|
|
567
567
|
d("h5");
|
|
@@ -788,7 +788,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
788
788
|
u.table = p;
|
|
789
789
|
},
|
|
790
790
|
key: "bar-table",
|
|
791
|
-
overlay: t(
|
|
791
|
+
overlay: t(Cl, {
|
|
792
792
|
tableShape: e.tableShape,
|
|
793
793
|
onSelected: (p) => {
|
|
794
794
|
d("table", {
|
|
@@ -817,7 +817,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
817
817
|
class: `${o}-toolbar-item`,
|
|
818
818
|
title: (Me = l.value.toolbarTips) == null ? void 0 : Me.revoke,
|
|
819
819
|
onClick: () => {
|
|
820
|
-
h.emit(
|
|
820
|
+
h.emit(a, "ctrlZ");
|
|
821
821
|
}
|
|
822
822
|
}, [t("svg", {
|
|
823
823
|
class: `${o}-icon`,
|
|
@@ -830,9 +830,9 @@ const gl = /* @__PURE__ */ O({
|
|
|
830
830
|
case "next":
|
|
831
831
|
return t("div", {
|
|
832
832
|
class: `${o}-toolbar-item`,
|
|
833
|
-
title: (
|
|
833
|
+
title: (De = l.value.toolbarTips) == null ? void 0 : De.next,
|
|
834
834
|
onClick: () => {
|
|
835
|
-
h.emit(
|
|
835
|
+
h.emit(a, "ctrlShiftZ");
|
|
836
836
|
}
|
|
837
837
|
}, [t("svg", {
|
|
838
838
|
class: `${o}-icon`,
|
|
@@ -841,13 +841,13 @@ const gl = /* @__PURE__ */ O({
|
|
|
841
841
|
"xlink:href": "#md-editor-icon-next"
|
|
842
842
|
}, null)]), e.showToolbarName && t("div", {
|
|
843
843
|
class: `${o}-toolbar-item-name`
|
|
844
|
-
}, [(
|
|
844
|
+
}, [(Ie = l.value.toolbarTips) == null ? void 0 : Ie.next])]);
|
|
845
845
|
case "save":
|
|
846
846
|
return t("div", {
|
|
847
847
|
class: `${o}-toolbar-item`,
|
|
848
848
|
title: (Ne = l.value.toolbarTips) == null ? void 0 : Ne.save,
|
|
849
849
|
onClick: () => {
|
|
850
|
-
h.emit(
|
|
850
|
+
h.emit(a, pt);
|
|
851
851
|
}
|
|
852
852
|
}, [t("svg", {
|
|
853
853
|
class: `${o}-icon`,
|
|
@@ -886,13 +886,13 @@ const gl = /* @__PURE__ */ O({
|
|
|
886
886
|
"xlink:href": `#md-editor-icon-${e.setting.pageFullscreen ? "suoxiao" : "fangda"}`
|
|
887
887
|
}, null)]), e.showToolbarName && t("div", {
|
|
888
888
|
class: `${o}-toolbar-item-name`
|
|
889
|
-
}, [(
|
|
889
|
+
}, [(Ve = l.value.toolbarTips) == null ? void 0 : Ve.pageFullscreen])]);
|
|
890
890
|
case "fullscreen":
|
|
891
891
|
return t("div", {
|
|
892
892
|
class: `${o}-toolbar-item`,
|
|
893
|
-
title: (
|
|
893
|
+
title: (Oe = l.value.toolbarTips) == null ? void 0 : Oe.fullscreen,
|
|
894
894
|
onClick: () => {
|
|
895
|
-
|
|
895
|
+
r();
|
|
896
896
|
}
|
|
897
897
|
}, [t("svg", {
|
|
898
898
|
class: `${o}-icon`,
|
|
@@ -937,7 +937,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
937
937
|
class: `${o}-toolbar-item`,
|
|
938
938
|
title: (Ke = l.value.toolbarTips) == null ? void 0 : Ke.catalog,
|
|
939
939
|
onClick: () => {
|
|
940
|
-
h.emit(
|
|
940
|
+
h.emit(a, Ot);
|
|
941
941
|
},
|
|
942
942
|
key: "bar-catalog"
|
|
943
943
|
}, [t("svg", {
|
|
@@ -1076,7 +1076,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
1076
1076
|
const p = e.defToolbars[v];
|
|
1077
1077
|
return p ? at(p, {
|
|
1078
1078
|
insert(de) {
|
|
1079
|
-
h.emit(
|
|
1079
|
+
h.emit(a, "replace", "universal", {
|
|
1080
1080
|
generate: de
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
@@ -1085,7 +1085,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
1085
1085
|
const p = e.defToolbars.children[v];
|
|
1086
1086
|
return p ? at(p, {
|
|
1087
1087
|
insert(de) {
|
|
1088
|
-
h.emit(
|
|
1088
|
+
h.emit(a, "replace", "universal", {
|
|
1089
1089
|
generate: de
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
@@ -1095,12 +1095,12 @@ const gl = /* @__PURE__ */ O({
|
|
|
1095
1095
|
};
|
|
1096
1096
|
return H(() => e.toolbars, () => {
|
|
1097
1097
|
ce(() => {
|
|
1098
|
-
i.value &&
|
|
1098
|
+
i.value && It(i.value);
|
|
1099
1099
|
});
|
|
1100
1100
|
}, {
|
|
1101
1101
|
immediate: !0
|
|
1102
1102
|
}), () => {
|
|
1103
|
-
const v =
|
|
1103
|
+
const v = m.value[0].map((k) => T(k)), g = m.value[1].map((k) => T(k));
|
|
1104
1104
|
return t(kt, null, [e.toolbars.length > 0 && t("div", {
|
|
1105
1105
|
class: `${o}-toolbar-wrapper`,
|
|
1106
1106
|
ref: i,
|
|
@@ -1109,7 +1109,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
1109
1109
|
class: [`${o}-toolbar`, e.showToolbarName && `${o}-stn`]
|
|
1110
1110
|
}, [t("div", {
|
|
1111
1111
|
class: `${o}-toolbar-left`,
|
|
1112
|
-
ref:
|
|
1112
|
+
ref: f
|
|
1113
1113
|
}, [v]), t("div", {
|
|
1114
1114
|
class: `${o}-toolbar-right`
|
|
1115
1115
|
}, [g])])]), t("input", {
|
|
@@ -1120,7 +1120,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
1120
1120
|
style: {
|
|
1121
1121
|
display: "none"
|
|
1122
1122
|
}
|
|
1123
|
-
}, null), t(
|
|
1123
|
+
}, null), t(Sl, {
|
|
1124
1124
|
linkVisible: c.linkVisible,
|
|
1125
1125
|
clipVisible: c.clipVisible,
|
|
1126
1126
|
type: c.type,
|
|
@@ -1136,16 +1136,16 @@ const gl = /* @__PURE__ */ O({
|
|
|
1136
1136
|
}, null)]);
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
|
-
}),
|
|
1139
|
+
}), Ml = (e, a) => {
|
|
1140
1140
|
const l = Et(() => {
|
|
1141
|
-
e.removeEventListener("scroll",
|
|
1142
|
-
}, 50),
|
|
1143
|
-
const i = e.clientHeight, u =
|
|
1144
|
-
n.target === e ? (
|
|
1145
|
-
top: e.scrollTop /
|
|
1141
|
+
e.removeEventListener("scroll", r), e.addEventListener("scroll", r), a.removeEventListener("scroll", r), a.addEventListener("scroll", r);
|
|
1142
|
+
}, 50), r = (n) => {
|
|
1143
|
+
const i = e.clientHeight, u = a.clientHeight, d = e.scrollHeight, c = a.scrollHeight, f = (d - i) / (c - u);
|
|
1144
|
+
n.target === e ? (a.removeEventListener("scroll", r), a.scrollTo({
|
|
1145
|
+
top: e.scrollTop / f
|
|
1146
1146
|
// behavior: 'smooth'
|
|
1147
|
-
}), l()) : (e.removeEventListener("scroll",
|
|
1148
|
-
top:
|
|
1147
|
+
}), l()) : (e.removeEventListener("scroll", r), e.scrollTo({
|
|
1148
|
+
top: a.scrollTop * f
|
|
1149
1149
|
// behavior: 'smooth'
|
|
1150
1150
|
}), l());
|
|
1151
1151
|
};
|
|
@@ -1156,17 +1156,17 @@ const gl = /* @__PURE__ */ O({
|
|
|
1156
1156
|
});
|
|
1157
1157
|
},
|
|
1158
1158
|
() => {
|
|
1159
|
-
e.removeEventListener("scroll",
|
|
1159
|
+
e.removeEventListener("scroll", r), a.removeEventListener("scroll", r);
|
|
1160
1160
|
}
|
|
1161
1161
|
];
|
|
1162
|
-
},
|
|
1163
|
-
const { view:
|
|
1162
|
+
}, Ll = (e, a, l) => {
|
|
1163
|
+
const { view: r } = l, n = (b) => r.lineBlockAt(r.state.doc.line(b).from).top, i = (b) => r.lineBlockAt(r.state.doc.line(b).from).height;
|
|
1164
1164
|
let u = [];
|
|
1165
1165
|
const d = () => {
|
|
1166
1166
|
u = [];
|
|
1167
|
-
const b = Array.from(
|
|
1167
|
+
const b = Array.from(a.querySelectorAll("[data-line]")).map(
|
|
1168
1168
|
(g) => Number(g.dataset.line) + 1
|
|
1169
|
-
), { lines: $ } =
|
|
1169
|
+
), { lines: $ } = r.state.doc;
|
|
1170
1170
|
let T = 1, v = b.shift() ?? $;
|
|
1171
1171
|
for (let g = 1; g <= $; g++)
|
|
1172
1172
|
g === v && (T = g, v = b.shift() || $ + 1), u.push({
|
|
@@ -1174,46 +1174,46 @@ const gl = /* @__PURE__ */ O({
|
|
|
1174
1174
|
end: v - 1
|
|
1175
1175
|
});
|
|
1176
1176
|
};
|
|
1177
|
-
let c = 0,
|
|
1178
|
-
const
|
|
1177
|
+
let c = 0, f = 0;
|
|
1178
|
+
const m = Ht((b) => {
|
|
1179
1179
|
var v, g, k, y, w, x, L;
|
|
1180
|
-
if (!((v =
|
|
1180
|
+
if (!((v = a.firstElementChild) != null && v.firstElementChild))
|
|
1181
1181
|
return;
|
|
1182
|
-
const $ =
|
|
1183
|
-
if (!(T > u.length) && !(
|
|
1182
|
+
const $ = r.lineBlockAtHeight(r.scrollDOM.scrollTop), { number: T } = r.state.doc.lineAt($.from);
|
|
1183
|
+
if (!(T > u.length) && !(r.state.doc.lines < u[u.length - 1].end))
|
|
1184
1184
|
if (b.target === e) {
|
|
1185
|
-
if (
|
|
1185
|
+
if (f !== 0)
|
|
1186
1186
|
return;
|
|
1187
1187
|
c++;
|
|
1188
1188
|
const C = u[T - 1], M = n(C.end) + i(C.end);
|
|
1189
1189
|
let R = 0;
|
|
1190
|
-
const
|
|
1190
|
+
const D = n(C.start), I = a.querySelector(`[data-line="${C.start - 1}"]`) || ((g = a.firstElementChild) == null ? void 0 : g.firstElementChild), O = a.querySelector(`[data-line="${C.end}"]`) || ((k = a.lastElementChild) == null ? void 0 : k.lastElementChild);
|
|
1191
1191
|
let B = 0, N = 0;
|
|
1192
|
-
|
|
1192
|
+
D === 0 ? (R = (r.scrollDOM.scrollTop - D) / (M - D), B = O.offsetTop) : M > r.scrollDOM.scrollHeight - r.scrollDOM.clientHeight ? (R = (r.scrollDOM.scrollTop - D) / (r.scrollDOM.scrollHeight - r.scrollDOM.clientHeight - D), N = I.offsetTop, B = a.scrollHeight - a.clientHeight - N + 10) : (R = (r.scrollDOM.scrollTop - D) / (M - D), N = I.offsetTop, B = O.offsetTop - N);
|
|
1193
1193
|
const j = N - 10 + B * R;
|
|
1194
|
-
rt(
|
|
1194
|
+
rt(a, j, () => {
|
|
1195
1195
|
c--;
|
|
1196
1196
|
});
|
|
1197
1197
|
} else {
|
|
1198
1198
|
if (c !== 0)
|
|
1199
1199
|
return;
|
|
1200
|
-
|
|
1200
|
+
f++;
|
|
1201
1201
|
const C = Array.from(
|
|
1202
|
-
|
|
1203
|
-
), M =
|
|
1204
|
-
let
|
|
1202
|
+
a.querySelectorAll("[data-line]")
|
|
1203
|
+
), M = a.scrollTop, R = a.scrollHeight;
|
|
1204
|
+
let D = C.length === 0 ? 1 : Math.ceil(
|
|
1205
1205
|
Number(C[C.length - 1].dataset.line) * (M / R)
|
|
1206
|
-
),
|
|
1207
|
-
for (let E =
|
|
1208
|
-
const F =
|
|
1206
|
+
), I = (y = a.firstElementChild) == null ? void 0 : y.firstElementChild;
|
|
1207
|
+
for (let E = D; E >= 0; E--) {
|
|
1208
|
+
const F = a.querySelector(`[data-line="${E}"]`);
|
|
1209
1209
|
if (F && F.offsetTop <= M) {
|
|
1210
|
-
|
|
1210
|
+
I = F, D = E;
|
|
1211
1211
|
break;
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
|
-
let
|
|
1214
|
+
let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild, B = (x = a.firstElementChild) == null ? void 0 : x.lastElementChild;
|
|
1215
1215
|
for (; C.length > 0; ) {
|
|
1216
|
-
const E = C.indexOf(
|
|
1216
|
+
const E = C.indexOf(I);
|
|
1217
1217
|
if (E + 1 >= C.length)
|
|
1218
1218
|
break;
|
|
1219
1219
|
const F = C[E + 1];
|
|
@@ -1221,68 +1221,68 @@ const gl = /* @__PURE__ */ O({
|
|
|
1221
1221
|
B = F;
|
|
1222
1222
|
break;
|
|
1223
1223
|
}
|
|
1224
|
-
const ee =
|
|
1224
|
+
const ee = I.offsetTop;
|
|
1225
1225
|
if (ee > M) {
|
|
1226
1226
|
if (E === 0) {
|
|
1227
|
-
|
|
1227
|
+
O = I, B = F;
|
|
1228
1228
|
break;
|
|
1229
1229
|
}
|
|
1230
|
-
|
|
1230
|
+
I = C[E - 1];
|
|
1231
1231
|
continue;
|
|
1232
1232
|
}
|
|
1233
1233
|
const ne = F.offsetTop;
|
|
1234
1234
|
if (ee <= M && ne > M) {
|
|
1235
|
-
|
|
1235
|
+
O = I, B = F;
|
|
1236
1236
|
break;
|
|
1237
1237
|
}
|
|
1238
|
-
|
|
1238
|
+
I = F;
|
|
1239
1239
|
}
|
|
1240
|
-
const N =
|
|
1240
|
+
const N = O.offsetTop, j = B.offsetTop;
|
|
1241
1241
|
let U = 0;
|
|
1242
|
-
const { start: re, end: X } = u[Number(
|
|
1242
|
+
const { start: re, end: X } = u[Number(O.dataset.line || 0)], _ = n(re);
|
|
1243
1243
|
let G = n(X);
|
|
1244
1244
|
const Q = i(X);
|
|
1245
1245
|
let W = 0;
|
|
1246
|
-
|
|
1247
|
-
(M - N) / (
|
|
1246
|
+
O === ((L = a.firstElementChild) == null ? void 0 : L.firstElementChild) ? (U = Math.max(M / j, 0), W = G + Q - _) : G > r.scrollDOM.scrollHeight - r.scrollDOM.clientHeight ? (U = Math.max(
|
|
1247
|
+
(M - N) / (a.scrollHeight - N - a.clientHeight),
|
|
1248
1248
|
0
|
|
1249
|
-
), G = n(
|
|
1249
|
+
), G = n(r.state.doc.lines) + i(r.state.doc.lines), W = 8 + G - _ - e.clientHeight) : (U = Math.max(
|
|
1250
1250
|
(M - N) / (j - N),
|
|
1251
1251
|
0
|
|
1252
1252
|
), W = G + Q - _), rt(e, _ + W * U, () => {
|
|
1253
|
-
|
|
1253
|
+
f--;
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
1256
|
}, 10);
|
|
1257
1257
|
return [
|
|
1258
1258
|
() => {
|
|
1259
|
-
d(), e.addEventListener("scroll",
|
|
1259
|
+
d(), e.addEventListener("scroll", m), a.addEventListener("scroll", m), e.dispatchEvent(new Event("scroll"));
|
|
1260
1260
|
},
|
|
1261
1261
|
() => {
|
|
1262
|
-
u = [], e.removeEventListener("scroll",
|
|
1262
|
+
u = [], e.removeEventListener("scroll", m), a.removeEventListener("scroll", m);
|
|
1263
1263
|
}
|
|
1264
1264
|
];
|
|
1265
|
-
},
|
|
1266
|
-
const
|
|
1265
|
+
}, Dl = (e, a, l) => {
|
|
1266
|
+
const r = A("editorId");
|
|
1267
1267
|
let n = () => {
|
|
1268
1268
|
}, i = () => {
|
|
1269
1269
|
};
|
|
1270
1270
|
const u = () => {
|
|
1271
1271
|
n();
|
|
1272
1272
|
const d = document.querySelector(".cm-scroller"), c = document.querySelector(
|
|
1273
|
-
`[id="${
|
|
1274
|
-
),
|
|
1275
|
-
`[id="${
|
|
1273
|
+
`[id="${r}-preview-wrapper"][data-show="true"]`
|
|
1274
|
+
), f = document.querySelector(
|
|
1275
|
+
`[id="${r}-html-wrapper"][data-show="true"]`
|
|
1276
1276
|
);
|
|
1277
|
-
(c ||
|
|
1277
|
+
(c || f) && ([i, n] = (c ? Ll : Ml)(
|
|
1278
1278
|
d,
|
|
1279
|
-
c ||
|
|
1279
|
+
c || f,
|
|
1280
1280
|
l.value
|
|
1281
1281
|
)), e.scrollAuto && i();
|
|
1282
1282
|
};
|
|
1283
1283
|
H(
|
|
1284
1284
|
[
|
|
1285
|
-
|
|
1285
|
+
a,
|
|
1286
1286
|
le(e.setting, "preview"),
|
|
1287
1287
|
le(e.setting, "htmlPreview"),
|
|
1288
1288
|
le(e.setting, "fullscreen"),
|
|
@@ -1297,13 +1297,13 @@ const gl = /* @__PURE__ */ O({
|
|
|
1297
1297
|
d ? i() : n();
|
|
1298
1298
|
}
|
|
1299
1299
|
), Y(u);
|
|
1300
|
-
}, Il =
|
|
1301
|
-
var
|
|
1302
|
-
let
|
|
1303
|
-
const c =
|
|
1300
|
+
}, Il = Dl, Nl = (e, a, l) => {
|
|
1301
|
+
var m, b, $, T, v, g;
|
|
1302
|
+
let r = "", n = 0, i = 0, u = !0, d = !1;
|
|
1303
|
+
const c = a.getSelectedText(), f = (m = z.editorConfig) == null ? void 0 : m.mermaidTemplate;
|
|
1304
1304
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
1305
1305
|
const k = e.replace(/^h(\d)/, (y, w) => new Array(Number(w)).fill("#", 0, w).join(""));
|
|
1306
|
-
|
|
1306
|
+
r = `${k} ${c}`, n = k.length + 1;
|
|
1307
1307
|
} else if (e === "prettier") {
|
|
1308
1308
|
const k = window.prettier || (($ = (b = z.editorExtensions) == null ? void 0 : b.prettier) == null ? void 0 : $.prettierInstance), y = [
|
|
1309
1309
|
((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((g = (v = z.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : g.parserMarkdownInstance)
|
|
@@ -1311,163 +1311,163 @@ const gl = /* @__PURE__ */ O({
|
|
|
1311
1311
|
!k || y[0] === void 0 ? (h.emit(l.editorId, "errorCatcher", {
|
|
1312
1312
|
name: "prettier",
|
|
1313
1313
|
message: "prettier is undefined"
|
|
1314
|
-
}),
|
|
1314
|
+
}), r = a.getValue()) : r = k.format(a.getValue(), {
|
|
1315
1315
|
parser: "markdown",
|
|
1316
1316
|
plugins: y
|
|
1317
1317
|
}), u = !1, d = !0;
|
|
1318
1318
|
} else
|
|
1319
1319
|
switch (e) {
|
|
1320
1320
|
case "bold": {
|
|
1321
|
-
|
|
1321
|
+
r = `**${c}**`, n = 2, i = -2;
|
|
1322
1322
|
break;
|
|
1323
1323
|
}
|
|
1324
1324
|
case "underline": {
|
|
1325
|
-
|
|
1325
|
+
r = `<u>${c}</u>`, n = 3, i = -4;
|
|
1326
1326
|
break;
|
|
1327
1327
|
}
|
|
1328
1328
|
case "italic": {
|
|
1329
|
-
|
|
1329
|
+
r = `*${c}*`, n = 1, i = -1;
|
|
1330
1330
|
break;
|
|
1331
1331
|
}
|
|
1332
1332
|
case "strikeThrough": {
|
|
1333
|
-
|
|
1333
|
+
r = `~~${c}~~`, n = 2, i = -2;
|
|
1334
1334
|
break;
|
|
1335
1335
|
}
|
|
1336
1336
|
case "sub": {
|
|
1337
|
-
|
|
1337
|
+
r = `<sub>${c}</sub>`, n = 5, i = -6;
|
|
1338
1338
|
break;
|
|
1339
1339
|
}
|
|
1340
1340
|
case "sup": {
|
|
1341
|
-
|
|
1341
|
+
r = `<sup>${c}</sup>`, n = 5, i = -6;
|
|
1342
1342
|
break;
|
|
1343
1343
|
}
|
|
1344
1344
|
case "codeRow": {
|
|
1345
|
-
|
|
1345
|
+
r = "`" + c + "`", n = 1, i = -1;
|
|
1346
1346
|
break;
|
|
1347
1347
|
}
|
|
1348
1348
|
case "quote": {
|
|
1349
|
-
|
|
1349
|
+
r = `> ${c}`, n = 2;
|
|
1350
1350
|
break;
|
|
1351
1351
|
}
|
|
1352
1352
|
case "orderedList": {
|
|
1353
|
-
|
|
1353
|
+
r = `1. ${c}`, n = 3;
|
|
1354
1354
|
break;
|
|
1355
1355
|
}
|
|
1356
1356
|
case "unorderedList": {
|
|
1357
|
-
|
|
1357
|
+
r = `- ${c}`, n = 2;
|
|
1358
1358
|
break;
|
|
1359
1359
|
}
|
|
1360
1360
|
case "task": {
|
|
1361
|
-
|
|
1361
|
+
r = `- [ ] ${c}`, n = 6;
|
|
1362
1362
|
break;
|
|
1363
1363
|
}
|
|
1364
1364
|
case "code": {
|
|
1365
1365
|
const k = l.text || c || "", y = l.mode || "language";
|
|
1366
|
-
|
|
1366
|
+
r = `\`\`\`${y}
|
|
1367
1367
|
${k}
|
|
1368
1368
|
\`\`\`
|
|
1369
|
-
`, n = 3, i = 3 + y.length -
|
|
1369
|
+
`, n = 3, i = 3 + y.length - r.length;
|
|
1370
1370
|
break;
|
|
1371
1371
|
}
|
|
1372
1372
|
case "table": {
|
|
1373
|
-
|
|
1373
|
+
r = "|";
|
|
1374
1374
|
const { selectedShape: k = { x: 1, y: 1 } } = l, { x: y, y: w } = k;
|
|
1375
1375
|
for (let x = 0; x <= w; x++)
|
|
1376
|
-
|
|
1377
|
-
|
|
1376
|
+
r += " col |";
|
|
1377
|
+
r += `
|
|
1378
1378
|
|`;
|
|
1379
1379
|
for (let x = 0; x <= w; x++)
|
|
1380
|
-
|
|
1380
|
+
r += " - |";
|
|
1381
1381
|
for (let x = 0; x <= y; x++) {
|
|
1382
|
-
|
|
1382
|
+
r += `
|
|
1383
1383
|
|`;
|
|
1384
1384
|
for (let L = 0; L <= w; L++)
|
|
1385
|
-
|
|
1385
|
+
r += " content |";
|
|
1386
1386
|
}
|
|
1387
|
-
n = 2, i = 5 -
|
|
1387
|
+
n = 2, i = 5 - r.length;
|
|
1388
1388
|
break;
|
|
1389
1389
|
}
|
|
1390
1390
|
case "link": {
|
|
1391
1391
|
const { desc: k, url: y } = l;
|
|
1392
|
-
|
|
1392
|
+
r = `[${k}](${y})`, u = !1;
|
|
1393
1393
|
break;
|
|
1394
1394
|
}
|
|
1395
1395
|
case "image": {
|
|
1396
1396
|
const { desc: k, url: y, urls: w } = l;
|
|
1397
|
-
w instanceof Array ?
|
|
1398
|
-
`, "") :
|
|
1397
|
+
w instanceof Array ? r = w.reduce((x, L) => x + `
|
|
1398
|
+
`, "") : r = `
|
|
1399
1399
|
`, u = !1;
|
|
1400
1400
|
break;
|
|
1401
1401
|
}
|
|
1402
1402
|
case "flow": {
|
|
1403
|
-
|
|
1404
|
-
${(
|
|
1403
|
+
r = `\`\`\`mermaid
|
|
1404
|
+
${(f == null ? void 0 : f.flow) || `flowchart TD
|
|
1405
1405
|
Start --> Stop`}
|
|
1406
1406
|
\`\`\`
|
|
1407
|
-
`, n = 3, i = 10 -
|
|
1407
|
+
`, n = 3, i = 10 - r.length;
|
|
1408
1408
|
break;
|
|
1409
1409
|
}
|
|
1410
1410
|
case "sequence": {
|
|
1411
|
-
|
|
1412
|
-
${(
|
|
1411
|
+
r = `\`\`\`mermaid
|
|
1412
|
+
${(f == null ? void 0 : f.sequence) || `sequenceDiagram
|
|
1413
1413
|
A->>B: hello!
|
|
1414
1414
|
B-->>A: hi!
|
|
1415
1415
|
A-)B: bye!`}
|
|
1416
1416
|
\`\`\`
|
|
1417
|
-
`, n = 3, i = 10 -
|
|
1417
|
+
`, n = 3, i = 10 - r.length;
|
|
1418
1418
|
break;
|
|
1419
1419
|
}
|
|
1420
1420
|
case "gantt": {
|
|
1421
|
-
|
|
1422
|
-
${(
|
|
1421
|
+
r = `\`\`\`mermaid
|
|
1422
|
+
${(f == null ? void 0 : f.gantt) || `gantt
|
|
1423
1423
|
title A Gantt Diagram
|
|
1424
1424
|
dateFormat YYYY-MM-DD
|
|
1425
1425
|
section Section
|
|
1426
1426
|
A task :a1, 2014-01-01, 30d
|
|
1427
1427
|
Another task :after a1, 20d`}
|
|
1428
1428
|
\`\`\`
|
|
1429
|
-
`, n = 3, i = 10 -
|
|
1429
|
+
`, n = 3, i = 10 - r.length;
|
|
1430
1430
|
break;
|
|
1431
1431
|
}
|
|
1432
1432
|
case "class": {
|
|
1433
|
-
|
|
1434
|
-
${(
|
|
1433
|
+
r = `\`\`\`mermaid
|
|
1434
|
+
${(f == null ? void 0 : f.class) || `classDiagram
|
|
1435
1435
|
class Animal
|
|
1436
1436
|
Vehicle <|-- Car`}
|
|
1437
1437
|
\`\`\`
|
|
1438
|
-
`, n = 3, i = 10 -
|
|
1438
|
+
`, n = 3, i = 10 - r.length;
|
|
1439
1439
|
break;
|
|
1440
1440
|
}
|
|
1441
1441
|
case "state": {
|
|
1442
|
-
|
|
1443
|
-
${(
|
|
1442
|
+
r = `\`\`\`mermaid
|
|
1443
|
+
${(f == null ? void 0 : f.state) || `stateDiagram-v2
|
|
1444
1444
|
s1 --> s2`}
|
|
1445
1445
|
\`\`\`
|
|
1446
|
-
`, n = 3, i = 10 -
|
|
1446
|
+
`, n = 3, i = 10 - r.length;
|
|
1447
1447
|
break;
|
|
1448
1448
|
}
|
|
1449
1449
|
case "pie": {
|
|
1450
|
-
|
|
1451
|
-
${(
|
|
1450
|
+
r = `\`\`\`mermaid
|
|
1451
|
+
${(f == null ? void 0 : f.pie) || `pie title Pets adopted by volunteers
|
|
1452
1452
|
"Dogs" : 386
|
|
1453
1453
|
"Cats" : 85
|
|
1454
1454
|
"Rats" : 15`}
|
|
1455
1455
|
\`\`\`
|
|
1456
|
-
`, n = 3, i = 10 -
|
|
1456
|
+
`, n = 3, i = 10 - r.length;
|
|
1457
1457
|
break;
|
|
1458
1458
|
}
|
|
1459
1459
|
case "relationship": {
|
|
1460
|
-
|
|
1461
|
-
${(
|
|
1460
|
+
r = `\`\`\`mermaid
|
|
1461
|
+
${(f == null ? void 0 : f.relationship) || `erDiagram
|
|
1462
1462
|
CAR ||--o{ NAMED-DRIVER : allows
|
|
1463
1463
|
PERSON ||--o{ NAMED-DRIVER : is`}
|
|
1464
1464
|
\`\`\`
|
|
1465
|
-
`, n = 3, i = 10 -
|
|
1465
|
+
`, n = 3, i = 10 - r.length;
|
|
1466
1466
|
break;
|
|
1467
1467
|
}
|
|
1468
1468
|
case "journey": {
|
|
1469
|
-
|
|
1470
|
-
${(
|
|
1469
|
+
r = `\`\`\`mermaid
|
|
1470
|
+
${(f == null ? void 0 : f.journey) || `journey
|
|
1471
1471
|
title My working day
|
|
1472
1472
|
section Go to work
|
|
1473
1473
|
Make tea: 5: Me
|
|
@@ -1477,15 +1477,15 @@ ${(m == null ? void 0 : m.journey) || `journey
|
|
|
1477
1477
|
Go downstairs: 5: Me
|
|
1478
1478
|
Sit down: 5: Me`}
|
|
1479
1479
|
\`\`\`
|
|
1480
|
-
`, n = 3, i = 10 -
|
|
1480
|
+
`, n = 3, i = 10 - r.length;
|
|
1481
1481
|
break;
|
|
1482
1482
|
}
|
|
1483
1483
|
case "katexInline": {
|
|
1484
|
-
|
|
1484
|
+
r = "$$", n = 1, i = -1;
|
|
1485
1485
|
break;
|
|
1486
1486
|
}
|
|
1487
1487
|
case "katexBlock": {
|
|
1488
|
-
|
|
1488
|
+
r = `$$
|
|
1489
1489
|
|
|
1490
1490
|
$$
|
|
1491
1491
|
`, n = 3, i = -4;
|
|
@@ -1493,11 +1493,11 @@ $$
|
|
|
1493
1493
|
}
|
|
1494
1494
|
case "universal": {
|
|
1495
1495
|
const { generate: k } = l, y = k(c);
|
|
1496
|
-
|
|
1496
|
+
r = y.targetValue, u = y.select, n = y.deviationStart, i = y.deviationEnd;
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
1499
|
return {
|
|
1500
|
-
text:
|
|
1500
|
+
text: r,
|
|
1501
1501
|
options: {
|
|
1502
1502
|
// 是否选中
|
|
1503
1503
|
select: u,
|
|
@@ -1509,7 +1509,7 @@ $$
|
|
|
1509
1509
|
replaceAll: d
|
|
1510
1510
|
}
|
|
1511
1511
|
};
|
|
1512
|
-
},
|
|
1512
|
+
}, El = "#e5c07b", it = "var(--md-color)", Hl = "#56b6c2", Bl = "#ffffff", oe = "var(--md-color)", st = "#e5c07b", Fl = "#e5c07b", Vl = "var(--md-color)", ct = "#d19a66", Ol = "#c678dd", Rl = "#21252b", Pl = "#2c313a", dt = "var(--md-bk-color)", me = "var(--md-bk-color)", ql = "#ceedfa33", ut = "#528bff", Ul = be.theme(
|
|
1513
1513
|
{
|
|
1514
1514
|
"&": {
|
|
1515
1515
|
color: oe,
|
|
@@ -1519,8 +1519,8 @@ $$
|
|
|
1519
1519
|
caretColor: ut
|
|
1520
1520
|
},
|
|
1521
1521
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: ut },
|
|
1522
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1523
|
-
".cm-panels": { backgroundColor:
|
|
1522
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ql },
|
|
1523
|
+
".cm-panels": { backgroundColor: Rl, color: oe },
|
|
1524
1524
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1525
1525
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1526
1526
|
".cm-searchMatch": {
|
|
@@ -1542,7 +1542,7 @@ $$
|
|
|
1542
1542
|
borderColor: "var(--md-border-color)"
|
|
1543
1543
|
},
|
|
1544
1544
|
".cm-activeLineGutter": {
|
|
1545
|
-
backgroundColor:
|
|
1545
|
+
backgroundColor: Pl
|
|
1546
1546
|
},
|
|
1547
1547
|
".cm-foldPlaceholder": {
|
|
1548
1548
|
backgroundColor: "transparent",
|
|
@@ -1568,10 +1568,10 @@ $$
|
|
|
1568
1568
|
}
|
|
1569
1569
|
},
|
|
1570
1570
|
{ dark: !0 }
|
|
1571
|
-
),
|
|
1571
|
+
), Gl = $t.define([
|
|
1572
1572
|
{ tag: s.keyword, color: Ol },
|
|
1573
1573
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: it },
|
|
1574
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1574
|
+
{ tag: [s.function(s.variableName), s.labelName], color: Fl },
|
|
1575
1575
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ct },
|
|
1576
1576
|
{ tag: [s.definition(s.name), s.separator], color: oe },
|
|
1577
1577
|
{
|
|
@@ -1585,7 +1585,7 @@ $$
|
|
|
1585
1585
|
s.self,
|
|
1586
1586
|
s.namespace
|
|
1587
1587
|
],
|
|
1588
|
-
color:
|
|
1588
|
+
color: El
|
|
1589
1589
|
},
|
|
1590
1590
|
{
|
|
1591
1591
|
tag: [
|
|
@@ -1597,7 +1597,7 @@ $$
|
|
|
1597
1597
|
s.link,
|
|
1598
1598
|
s.special(s.string)
|
|
1599
1599
|
],
|
|
1600
|
-
color:
|
|
1600
|
+
color: Hl
|
|
1601
1601
|
},
|
|
1602
1602
|
{ tag: [s.meta, s.comment], color: st },
|
|
1603
1603
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1606,12 +1606,12 @@ $$
|
|
|
1606
1606
|
{ tag: s.link, color: st, textDecoration: "underline" },
|
|
1607
1607
|
{ tag: s.heading, fontWeight: "bold", color: it },
|
|
1608
1608
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ct },
|
|
1609
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1610
|
-
{ tag: s.invalid, color:
|
|
1611
|
-
]),
|
|
1612
|
-
|
|
1613
|
-
yt(
|
|
1614
|
-
],
|
|
1609
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Vl },
|
|
1610
|
+
{ tag: s.invalid, color: Bl }
|
|
1611
|
+
]), Kl = [
|
|
1612
|
+
Ul,
|
|
1613
|
+
yt(Gl)
|
|
1614
|
+
], jl = "#e5c07b", mt = "#3f4a54", _l = "#56b6c2", Wl = "#fff", ae = "#3f4a54", ft = "#2d8cf0", zl = "#2d8cf0", Yl = "#3f4a54", gt = "#d19a66", Zl = "#c678dd", Jl = "#21252b", Xl = "#ceedfa33", ht = "var(--md-bk-color)", fe = "var(--md-bk-color)", Ql = "#bad5fa", bt = "#3f4a54", eo = be.theme(
|
|
1615
1615
|
{
|
|
1616
1616
|
"&": {
|
|
1617
1617
|
color: ae,
|
|
@@ -1621,8 +1621,8 @@ $$
|
|
|
1621
1621
|
caretColor: bt
|
|
1622
1622
|
},
|
|
1623
1623
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: bt },
|
|
1624
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1625
|
-
".cm-panels": { backgroundColor:
|
|
1624
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ql },
|
|
1625
|
+
".cm-panels": { backgroundColor: Jl, color: ae },
|
|
1626
1626
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1627
1627
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1628
1628
|
".cm-searchMatch": {
|
|
@@ -1644,7 +1644,7 @@ $$
|
|
|
1644
1644
|
borderColor: "var(--md-border-color)"
|
|
1645
1645
|
},
|
|
1646
1646
|
".cm-activeLineGutter": {
|
|
1647
|
-
backgroundColor:
|
|
1647
|
+
backgroundColor: Xl
|
|
1648
1648
|
},
|
|
1649
1649
|
".cm-foldPlaceholder": {
|
|
1650
1650
|
backgroundColor: "transparent",
|
|
@@ -1670,10 +1670,10 @@ $$
|
|
|
1670
1670
|
}
|
|
1671
1671
|
}
|
|
1672
1672
|
// { dark: true }
|
|
1673
|
-
),
|
|
1674
|
-
{ tag: s.keyword, color:
|
|
1673
|
+
), to = $t.define([
|
|
1674
|
+
{ tag: s.keyword, color: Zl },
|
|
1675
1675
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: mt },
|
|
1676
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1676
|
+
{ tag: [s.function(s.variableName), s.labelName], color: zl },
|
|
1677
1677
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: gt },
|
|
1678
1678
|
{ tag: [s.definition(s.name), s.separator], color: ae },
|
|
1679
1679
|
{
|
|
@@ -1687,7 +1687,7 @@ $$
|
|
|
1687
1687
|
s.self,
|
|
1688
1688
|
s.namespace
|
|
1689
1689
|
],
|
|
1690
|
-
color:
|
|
1690
|
+
color: jl
|
|
1691
1691
|
},
|
|
1692
1692
|
{
|
|
1693
1693
|
tag: [
|
|
@@ -1699,7 +1699,7 @@ $$
|
|
|
1699
1699
|
s.link,
|
|
1700
1700
|
s.special(s.string)
|
|
1701
1701
|
],
|
|
1702
|
-
color:
|
|
1702
|
+
color: _l
|
|
1703
1703
|
},
|
|
1704
1704
|
{ tag: [s.meta, s.comment], color: ft },
|
|
1705
1705
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1708,37 +1708,37 @@ $$
|
|
|
1708
1708
|
{ tag: s.link, color: ft, textDecoration: "underline" },
|
|
1709
1709
|
{ tag: s.heading, fontWeight: "bold", color: mt },
|
|
1710
1710
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: gt },
|
|
1711
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1712
|
-
{ tag: s.invalid, color:
|
|
1713
|
-
]),
|
|
1714
|
-
|
|
1715
|
-
yt(
|
|
1716
|
-
], se = (e,
|
|
1717
|
-
const
|
|
1718
|
-
i.dispatch(i.state.replaceSelection(`${
|
|
1719
|
-
const
|
|
1711
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Yl },
|
|
1712
|
+
{ tag: s.invalid, color: Wl }
|
|
1713
|
+
]), lo = [
|
|
1714
|
+
eo,
|
|
1715
|
+
yt(to)
|
|
1716
|
+
], se = (e, a, l, r, n) => (i, u, d, c) => {
|
|
1717
|
+
const f = `${e}${a}`.slice(c - d);
|
|
1718
|
+
i.dispatch(i.state.replaceSelection(`${f}${l}${r}`));
|
|
1719
|
+
const m = d + u.label.length + (n === "title" ? l.length : 0);
|
|
1720
1720
|
i.dispatch({
|
|
1721
1721
|
selection: P.create(
|
|
1722
1722
|
[
|
|
1723
1723
|
P.range(
|
|
1724
|
-
d + u.label.length + (n === "title" ? 1 : -
|
|
1725
|
-
|
|
1724
|
+
d + u.label.length + (n === "title" ? 1 : -a.length),
|
|
1725
|
+
m
|
|
1726
1726
|
),
|
|
1727
|
-
P.cursor(
|
|
1727
|
+
P.cursor(m)
|
|
1728
1728
|
],
|
|
1729
1729
|
1
|
|
1730
1730
|
)
|
|
1731
1731
|
}), i.focus();
|
|
1732
|
-
}, vt = (e) => (
|
|
1733
|
-
const i = e.slice(n -
|
|
1734
|
-
|
|
1735
|
-
},
|
|
1736
|
-
const
|
|
1737
|
-
const
|
|
1732
|
+
}, vt = (e) => (a, l, r, n) => {
|
|
1733
|
+
const i = e.slice(n - r);
|
|
1734
|
+
a.dispatch(a.state.replaceSelection(`${i} `));
|
|
1735
|
+
}, oo = (e) => {
|
|
1736
|
+
const a = (l) => {
|
|
1737
|
+
const r = l.matchBefore(
|
|
1738
1738
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
1739
1739
|
);
|
|
1740
|
-
return
|
|
1741
|
-
from:
|
|
1740
|
+
return r === null || r.from == r.to && l.explicit ? null : {
|
|
1741
|
+
from: r.from,
|
|
1742
1742
|
options: [
|
|
1743
1743
|
// 标题
|
|
1744
1744
|
...["h1", "h2", "h3", "h4", "h5", "h6"].map((n, i) => {
|
|
@@ -1828,17 +1828,17 @@ $$`, "title")
|
|
|
1828
1828
|
]
|
|
1829
1829
|
};
|
|
1830
1830
|
};
|
|
1831
|
-
return
|
|
1832
|
-
override: e ? [
|
|
1831
|
+
return ml({
|
|
1832
|
+
override: e ? [a, ol, ...e] : [a]
|
|
1833
1833
|
});
|
|
1834
|
-
},
|
|
1835
|
-
const
|
|
1836
|
-
return (
|
|
1837
|
-
effects:
|
|
1834
|
+
}, ao = oo, Z = (e) => {
|
|
1835
|
+
const a = new dl();
|
|
1836
|
+
return (r) => (a.get(e.state) ? e.dispatch({ effects: a.reconfigure(r) }) : e.dispatch({
|
|
1837
|
+
effects: ul.appendConfig.of(a.of(r))
|
|
1838
1838
|
}), !0);
|
|
1839
1839
|
};
|
|
1840
|
-
class
|
|
1841
|
-
constructor(
|
|
1840
|
+
class ro {
|
|
1841
|
+
constructor(a) {
|
|
1842
1842
|
K(this, "view");
|
|
1843
1843
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
1844
1844
|
K(this, "toggleTabSize");
|
|
@@ -1850,7 +1850,7 @@ class ao {
|
|
|
1850
1850
|
K(this, "toggleDisabled");
|
|
1851
1851
|
K(this, "toggleReadOnly");
|
|
1852
1852
|
K(this, "toggleMaxlength");
|
|
1853
|
-
this.view =
|
|
1853
|
+
this.view = a, 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);
|
|
1854
1854
|
}
|
|
1855
1855
|
getValue() {
|
|
1856
1856
|
return this.view.state.doc.toString();
|
|
@@ -1862,12 +1862,12 @@ class ao {
|
|
|
1862
1862
|
* @param from 插入开始位置
|
|
1863
1863
|
* @param to 插入结束位置
|
|
1864
1864
|
*/
|
|
1865
|
-
setValue(
|
|
1865
|
+
setValue(a, l = 0, r = this.view.state.doc.length) {
|
|
1866
1866
|
this.view.dispatch({
|
|
1867
1867
|
changes: {
|
|
1868
1868
|
from: l,
|
|
1869
|
-
to:
|
|
1870
|
-
insert:
|
|
1869
|
+
to: r,
|
|
1870
|
+
insert: a
|
|
1871
1871
|
}
|
|
1872
1872
|
});
|
|
1873
1873
|
}
|
|
@@ -1875,8 +1875,8 @@ class ao {
|
|
|
1875
1875
|
* 获取选中的文本
|
|
1876
1876
|
*/
|
|
1877
1877
|
getSelectedText() {
|
|
1878
|
-
const { from:
|
|
1879
|
-
return this.view.state.sliceDoc(
|
|
1878
|
+
const { from: a, to: l } = this.view.state.selection.main;
|
|
1879
|
+
return this.view.state.sliceDoc(a, l);
|
|
1880
1880
|
}
|
|
1881
1881
|
/**
|
|
1882
1882
|
* 使用新的内容替换选中的内容
|
|
@@ -1884,7 +1884,7 @@ class ao {
|
|
|
1884
1884
|
* @param text 待替换内容
|
|
1885
1885
|
* @param options 替换后是否选中
|
|
1886
1886
|
*/
|
|
1887
|
-
replaceSelectedText(
|
|
1887
|
+
replaceSelectedText(a, l = {
|
|
1888
1888
|
// 是否选中
|
|
1889
1889
|
select: !0,
|
|
1890
1890
|
// 选中时,开始位置的偏移量
|
|
@@ -1893,35 +1893,47 @@ class ao {
|
|
|
1893
1893
|
deviationEnd: 0,
|
|
1894
1894
|
// 直接替换所有文本
|
|
1895
1895
|
replaceAll: !1
|
|
1896
|
-
}) {
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
const
|
|
1904
|
-
this.view.dispatch({
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1896
|
+
}, r) {
|
|
1897
|
+
var n;
|
|
1898
|
+
try {
|
|
1899
|
+
if (l.replaceAll) {
|
|
1900
|
+
this.setValue(a);
|
|
1901
|
+
return;
|
|
1902
|
+
}
|
|
1903
|
+
const { from: i } = this.view.state.selection.main;
|
|
1904
|
+
if (this.view.dispatch(this.view.state.replaceSelection(a)), l.select) {
|
|
1905
|
+
const u = i + a.length + l.deviationEnd;
|
|
1906
|
+
this.view.dispatch({
|
|
1907
|
+
selection: P.create(
|
|
1908
|
+
[
|
|
1909
|
+
P.range(i + l.deviationStart, u),
|
|
1910
|
+
P.cursor(u)
|
|
1911
|
+
],
|
|
1912
|
+
1
|
|
1913
|
+
)
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
this.view.focus();
|
|
1917
|
+
} catch (i) {
|
|
1918
|
+
if ((n = i.message) != null && n.includes("Selection points outside of document"))
|
|
1919
|
+
h.emit(r, "errorCatcher", {
|
|
1920
|
+
name: "overlength",
|
|
1921
|
+
message: "The input text is too long",
|
|
1922
|
+
data: a
|
|
1923
|
+
});
|
|
1924
|
+
else
|
|
1925
|
+
throw i;
|
|
1913
1926
|
}
|
|
1914
|
-
this.view.focus();
|
|
1915
1927
|
}
|
|
1916
1928
|
/**
|
|
1917
1929
|
* 设置tabSize
|
|
1918
1930
|
*
|
|
1919
1931
|
* @param tabSize 需要切换的大小
|
|
1920
1932
|
*/
|
|
1921
|
-
setTabSize(
|
|
1933
|
+
setTabSize(a) {
|
|
1922
1934
|
this.toggleTabSize([
|
|
1923
|
-
ue.tabSize.of(
|
|
1924
|
-
|
|
1935
|
+
ue.tabSize.of(a),
|
|
1936
|
+
cl.of(" ".repeat(a))
|
|
1925
1937
|
]);
|
|
1926
1938
|
}
|
|
1927
1939
|
/**
|
|
@@ -1929,76 +1941,84 @@ class ao {
|
|
|
1929
1941
|
*
|
|
1930
1942
|
* @param t 目标内容
|
|
1931
1943
|
*/
|
|
1932
|
-
setPlaceholder(
|
|
1933
|
-
this.togglePlaceholder(
|
|
1944
|
+
setPlaceholder(a) {
|
|
1945
|
+
this.togglePlaceholder(Qt(a));
|
|
1934
1946
|
}
|
|
1935
|
-
focus(
|
|
1936
|
-
if (this.view.focus(), !
|
|
1947
|
+
focus(a) {
|
|
1948
|
+
if (this.view.focus(), !a)
|
|
1937
1949
|
return;
|
|
1938
|
-
let l = 0,
|
|
1939
|
-
switch (
|
|
1950
|
+
let l = 0, r = 0, n = 0;
|
|
1951
|
+
switch (a) {
|
|
1940
1952
|
case "start":
|
|
1941
1953
|
break;
|
|
1942
1954
|
case "end": {
|
|
1943
|
-
l =
|
|
1955
|
+
l = r = n = this.getValue().length;
|
|
1944
1956
|
break;
|
|
1945
1957
|
}
|
|
1946
1958
|
default:
|
|
1947
|
-
l =
|
|
1959
|
+
l = a.rangeAnchor || a.cursorPos, r = a.rangeHead || a.cursorPos, n = a.cursorPos;
|
|
1948
1960
|
}
|
|
1949
1961
|
this.view.dispatch({
|
|
1950
1962
|
scrollIntoView: !0,
|
|
1951
1963
|
selection: P.create(
|
|
1952
|
-
[P.range(l,
|
|
1964
|
+
[P.range(l, r), P.cursor(n)],
|
|
1953
1965
|
1
|
|
1954
1966
|
)
|
|
1955
1967
|
});
|
|
1956
1968
|
}
|
|
1957
|
-
setDisabled(
|
|
1958
|
-
this.toggleDisabled([be.editable.of(!
|
|
1969
|
+
setDisabled(a) {
|
|
1970
|
+
this.toggleDisabled([be.editable.of(!a)]);
|
|
1959
1971
|
}
|
|
1960
|
-
setReadOnly(
|
|
1961
|
-
this.toggleReadOnly([ue.readOnly.of(
|
|
1972
|
+
setReadOnly(a) {
|
|
1973
|
+
this.toggleReadOnly([ue.readOnly.of(a)]);
|
|
1962
1974
|
}
|
|
1963
|
-
setMaxLength(
|
|
1975
|
+
setMaxLength(a) {
|
|
1964
1976
|
this.toggleMaxlength([
|
|
1965
|
-
ue.changeFilter.of((l) => l.newDoc.length <=
|
|
1977
|
+
ue.changeFilter.of((l) => l.newDoc.length <= a)
|
|
1966
1978
|
]);
|
|
1967
1979
|
}
|
|
1968
1980
|
}
|
|
1969
|
-
const
|
|
1970
|
-
const
|
|
1971
|
-
return (
|
|
1972
|
-
if (
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
)
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
const n = JSON.parse(a.clipboardData.getData("vscode-editor-data"));
|
|
1983
|
-
h.emit(r, "replace", "code", {
|
|
1984
|
-
mode: n.mode,
|
|
1985
|
-
text: a.clipboardData.getData("text/plain")
|
|
1986
|
-
}), a.preventDefault();
|
|
1987
|
-
}
|
|
1981
|
+
const no = (e) => {
|
|
1982
|
+
const a = A("editorId");
|
|
1983
|
+
return (r) => {
|
|
1984
|
+
if (!r.clipboardData)
|
|
1985
|
+
return;
|
|
1986
|
+
if (r.clipboardData.files.length > 0) {
|
|
1987
|
+
const { files: i } = r.clipboardData;
|
|
1988
|
+
h.emit(
|
|
1989
|
+
a,
|
|
1990
|
+
"uploadImage",
|
|
1991
|
+
Array.from(i).filter((u) => /image\/.*/.test(u.type))
|
|
1992
|
+
), r.preventDefault();
|
|
1993
|
+
return;
|
|
1988
1994
|
}
|
|
1995
|
+
if (e.autoDetectCode && r.clipboardData.types.includes("vscode-editor-data")) {
|
|
1996
|
+
const i = JSON.parse(r.clipboardData.getData("vscode-editor-data"));
|
|
1997
|
+
h.emit(a, "replace", "code", {
|
|
1998
|
+
mode: i.mode,
|
|
1999
|
+
text: r.clipboardData.getData("text/plain")
|
|
2000
|
+
}), r.preventDefault();
|
|
2001
|
+
return;
|
|
2002
|
+
}
|
|
2003
|
+
const n = r.clipboardData.getData("text/plain");
|
|
2004
|
+
e.maxlength && n.length + e.value.length > e.maxlength && h.emit(a, "errorCatcher", {
|
|
2005
|
+
name: "overlength",
|
|
2006
|
+
message: "The input text is too long",
|
|
2007
|
+
data: n
|
|
2008
|
+
});
|
|
1989
2009
|
};
|
|
1990
|
-
},
|
|
1991
|
-
const
|
|
2010
|
+
}, io = no, so = (e) => {
|
|
2011
|
+
const a = A("editorId");
|
|
1992
2012
|
Y(() => {
|
|
1993
|
-
h.on(
|
|
2013
|
+
h.on(a, {
|
|
1994
2014
|
name: Rt,
|
|
1995
2015
|
callback(l) {
|
|
1996
|
-
var
|
|
1997
|
-
(
|
|
2016
|
+
var r;
|
|
2017
|
+
(r = e.value) == null || r.focus(l);
|
|
1998
2018
|
}
|
|
1999
2019
|
});
|
|
2000
2020
|
});
|
|
2001
|
-
},
|
|
2021
|
+
}, co = so, uo = (e, a) => [
|
|
2002
2022
|
{
|
|
2003
2023
|
key: "Ctrl-b",
|
|
2004
2024
|
mac: "Cmd-b",
|
|
@@ -2007,7 +2027,7 @@ const ro = (e) => {
|
|
|
2007
2027
|
{
|
|
2008
2028
|
key: "Ctrl-d",
|
|
2009
2029
|
mac: "Cmd-d",
|
|
2010
|
-
run:
|
|
2030
|
+
run: rl,
|
|
2011
2031
|
preventDefault: !0
|
|
2012
2032
|
},
|
|
2013
2033
|
{
|
|
@@ -2089,68 +2109,76 @@ const ro = (e) => {
|
|
|
2089
2109
|
{
|
|
2090
2110
|
key: "Ctrl-f",
|
|
2091
2111
|
mac: "Cmd-f",
|
|
2092
|
-
shift: () =>
|
|
2112
|
+
shift: () => a.noPrettier ? !1 : (h.emit(e, "replace", "prettier"), !0)
|
|
2093
2113
|
},
|
|
2094
2114
|
{
|
|
2095
2115
|
any: (L, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
|
|
2096
2116
|
}
|
|
2097
|
-
],
|
|
2098
|
-
const
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2117
|
+
], mo = uo, fo = (e) => {
|
|
2118
|
+
const a = A("tabWidth"), l = A("editorId"), r = A("theme"), n = q(), i = St(), u = mo(l, e), d = io(e), c = [
|
|
2119
|
+
el.of([...u, nl]),
|
|
2120
|
+
Xt,
|
|
2121
|
+
al(),
|
|
2122
|
+
ll({ codeLanguages: tl }),
|
|
2103
2123
|
// 横向换行
|
|
2104
2124
|
ie.lineWrapping,
|
|
2105
|
-
ie.updateListener.of((
|
|
2106
|
-
|
|
2125
|
+
ie.updateListener.of((m) => {
|
|
2126
|
+
m.docChanged && e.onChange(m.state.doc.toString());
|
|
2107
2127
|
}),
|
|
2108
2128
|
ie.domEventHandlers({
|
|
2109
2129
|
paste: d,
|
|
2110
2130
|
blur: e.onBlur,
|
|
2111
2131
|
focus: e.onFocus,
|
|
2112
|
-
input:
|
|
2132
|
+
input: (m) => {
|
|
2133
|
+
e.onInput && e.onInput(m);
|
|
2134
|
+
const { data: b } = m;
|
|
2135
|
+
e.value.length + b.length && h.emit(l, "errorCatcher", {
|
|
2136
|
+
name: "overlength",
|
|
2137
|
+
message: "The input text is too long",
|
|
2138
|
+
data: b
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2113
2141
|
})
|
|
2114
|
-
],
|
|
2115
|
-
const
|
|
2142
|
+
], f = () => {
|
|
2143
|
+
const m = [
|
|
2116
2144
|
...c,
|
|
2117
|
-
|
|
2118
|
-
|
|
2145
|
+
r.value === "light" ? lo : Kl,
|
|
2146
|
+
ao(e.completions)
|
|
2119
2147
|
];
|
|
2120
|
-
return z.codeMirrorExtensions(
|
|
2148
|
+
return z.codeMirrorExtensions(r.value, m, [
|
|
2121
2149
|
...u
|
|
2122
2150
|
]);
|
|
2123
2151
|
};
|
|
2124
2152
|
return Y(() => {
|
|
2125
|
-
const
|
|
2153
|
+
const m = new ie({
|
|
2126
2154
|
doc: e.value,
|
|
2127
2155
|
parent: n.value
|
|
2128
|
-
}), b = new
|
|
2156
|
+
}), b = new ro(m);
|
|
2129
2157
|
i.value = b, setTimeout(() => {
|
|
2130
|
-
b.setTabSize(
|
|
2158
|
+
b.setTabSize(a), b.setDisabled(e.disabled), b.setReadOnly(e.readonly), b.setExtensions(f()), e.placeholder && b.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && b.setMaxLength(e.maxlength), e.autofocus && m.focus();
|
|
2131
2159
|
}, 0), h.on(l, {
|
|
2132
2160
|
name: "ctrlZ",
|
|
2133
2161
|
callback() {
|
|
2134
|
-
|
|
2162
|
+
il(m);
|
|
2135
2163
|
}
|
|
2136
2164
|
}), h.on(l, {
|
|
2137
2165
|
name: "ctrlShiftZ",
|
|
2138
2166
|
callback() {
|
|
2139
|
-
|
|
2167
|
+
sl(m);
|
|
2140
2168
|
}
|
|
2141
2169
|
}), h.on(l, {
|
|
2142
2170
|
name: "replace",
|
|
2143
2171
|
callback($, T = {}) {
|
|
2144
2172
|
var k;
|
|
2145
|
-
const { text: v, options: g } =
|
|
2146
|
-
(k = i.value) == null || k.replaceSelectedText(v, g);
|
|
2173
|
+
const { text: v, options: g } = Nl($, i.value, T);
|
|
2174
|
+
(k = i.value) == null || k.replaceSelectedText(v, g, l);
|
|
2147
2175
|
}
|
|
2148
2176
|
});
|
|
2149
2177
|
}), H(
|
|
2150
|
-
[
|
|
2178
|
+
[r, le(e, "completions")],
|
|
2151
2179
|
() => {
|
|
2152
|
-
var
|
|
2153
|
-
(
|
|
2180
|
+
var m;
|
|
2181
|
+
(m = i.value) == null || m.setExtensions(f());
|
|
2154
2182
|
},
|
|
2155
2183
|
{
|
|
2156
2184
|
deep: !0
|
|
@@ -2158,38 +2186,38 @@ const ro = (e) => {
|
|
|
2158
2186
|
), H(
|
|
2159
2187
|
() => e.value,
|
|
2160
2188
|
() => {
|
|
2161
|
-
var
|
|
2162
|
-
((
|
|
2189
|
+
var m, b;
|
|
2190
|
+
((m = i.value) == null ? void 0 : m.getValue()) !== e.value && ((b = i.value) == null || b.setValue(e.value));
|
|
2163
2191
|
}
|
|
2164
2192
|
), H(
|
|
2165
2193
|
() => e.placeholder,
|
|
2166
2194
|
() => {
|
|
2167
|
-
var
|
|
2168
|
-
(
|
|
2195
|
+
var m;
|
|
2196
|
+
(m = i.value) == null || m.setPlaceholder(e.placeholder);
|
|
2169
2197
|
}
|
|
2170
2198
|
), H(
|
|
2171
2199
|
() => e.disabled,
|
|
2172
2200
|
() => {
|
|
2173
|
-
var
|
|
2174
|
-
(
|
|
2201
|
+
var m;
|
|
2202
|
+
(m = i.value) == null || m.setDisabled(e.disabled);
|
|
2175
2203
|
}
|
|
2176
2204
|
), H(
|
|
2177
2205
|
() => e.readonly,
|
|
2178
2206
|
() => {
|
|
2179
|
-
var
|
|
2180
|
-
(
|
|
2207
|
+
var m;
|
|
2208
|
+
(m = i.value) == null || m.setDisabled(e.readonly);
|
|
2181
2209
|
}
|
|
2182
2210
|
), H(
|
|
2183
2211
|
() => e.maxlength,
|
|
2184
2212
|
() => {
|
|
2185
|
-
var
|
|
2186
|
-
e.maxlength && ((
|
|
2213
|
+
var m;
|
|
2214
|
+
e.maxlength && ((m = i.value) == null || m.setMaxLength(e.maxlength));
|
|
2187
2215
|
}
|
|
2188
|
-
),
|
|
2216
|
+
), co(i), {
|
|
2189
2217
|
inputWrapperRef: n,
|
|
2190
2218
|
codeMirrorUt: i
|
|
2191
2219
|
};
|
|
2192
|
-
},
|
|
2220
|
+
}, go = fo, ho = {
|
|
2193
2221
|
value: {
|
|
2194
2222
|
type: String,
|
|
2195
2223
|
default: ""
|
|
@@ -2292,19 +2320,19 @@ const ro = (e) => {
|
|
|
2292
2320
|
onInput: {
|
|
2293
2321
|
type: Function
|
|
2294
2322
|
}
|
|
2295
|
-
},
|
|
2323
|
+
}, bo = /* @__PURE__ */ V({
|
|
2296
2324
|
name: "MDEditorContent",
|
|
2297
|
-
props:
|
|
2325
|
+
props: ho,
|
|
2298
2326
|
setup(e) {
|
|
2299
|
-
const
|
|
2300
|
-
inputWrapperRef:
|
|
2327
|
+
const a = A("editorId"), l = q(""), {
|
|
2328
|
+
inputWrapperRef: r,
|
|
2301
2329
|
codeMirrorUt: n
|
|
2302
|
-
} =
|
|
2330
|
+
} = go(e);
|
|
2303
2331
|
return Il(e, l, n), () => t("div", {
|
|
2304
2332
|
class: `${o}-content`
|
|
2305
2333
|
}, [t("div", {
|
|
2306
2334
|
class: `${o}-input-wrapper`,
|
|
2307
|
-
ref:
|
|
2335
|
+
ref: r
|
|
2308
2336
|
}, null), t(Pt, {
|
|
2309
2337
|
modelValue: e.value,
|
|
2310
2338
|
setting: e.setting,
|
|
@@ -2321,12 +2349,12 @@ const ro = (e) => {
|
|
|
2321
2349
|
}, null), e.catalogVisible && t(Tt, {
|
|
2322
2350
|
theme: e.theme,
|
|
2323
2351
|
class: `${o}-catalog-editor`,
|
|
2324
|
-
editorId:
|
|
2352
|
+
editorId: a,
|
|
2325
2353
|
mdHeadingId: e.mdHeadingId,
|
|
2326
2354
|
key: "internal-catalog"
|
|
2327
2355
|
}, null)]);
|
|
2328
2356
|
}
|
|
2329
|
-
}),
|
|
2357
|
+
}), vo = /* @__PURE__ */ V({
|
|
2330
2358
|
props: {
|
|
2331
2359
|
modelValue: {
|
|
2332
2360
|
type: String,
|
|
@@ -2334,17 +2362,17 @@ const ro = (e) => {
|
|
|
2334
2362
|
}
|
|
2335
2363
|
},
|
|
2336
2364
|
setup(e) {
|
|
2337
|
-
const
|
|
2365
|
+
const a = A("usedLanguageText");
|
|
2338
2366
|
return () => {
|
|
2339
|
-
var l,
|
|
2367
|
+
var l, r;
|
|
2340
2368
|
return t("div", {
|
|
2341
2369
|
class: `${o}-footer-item`
|
|
2342
2370
|
}, [t("label", {
|
|
2343
2371
|
class: `${o}-footer-label`
|
|
2344
|
-
}, [`${(l =
|
|
2372
|
+
}, [`${(l = a.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((r = e.modelValue) == null ? void 0 : r.length) || 0])]);
|
|
2345
2373
|
};
|
|
2346
2374
|
}
|
|
2347
|
-
}),
|
|
2375
|
+
}), ko = {
|
|
2348
2376
|
checked: {
|
|
2349
2377
|
type: Boolean,
|
|
2350
2378
|
default: !1
|
|
@@ -2354,8 +2382,8 @@ const ro = (e) => {
|
|
|
2354
2382
|
default: () => {
|
|
2355
2383
|
}
|
|
2356
2384
|
}
|
|
2357
|
-
},
|
|
2358
|
-
props:
|
|
2385
|
+
}, po = /* @__PURE__ */ V({
|
|
2386
|
+
props: ko,
|
|
2359
2387
|
setup(e) {
|
|
2360
2388
|
return () => t("div", {
|
|
2361
2389
|
class: [`${o}-checkbox`, e.checked && `${o}-checkbox-checked`],
|
|
@@ -2364,7 +2392,7 @@ const ro = (e) => {
|
|
|
2364
2392
|
}
|
|
2365
2393
|
}, null);
|
|
2366
2394
|
}
|
|
2367
|
-
}),
|
|
2395
|
+
}), Co = {
|
|
2368
2396
|
scrollAuto: {
|
|
2369
2397
|
type: Boolean
|
|
2370
2398
|
},
|
|
@@ -2373,10 +2401,10 @@ const ro = (e) => {
|
|
|
2373
2401
|
default: () => {
|
|
2374
2402
|
}
|
|
2375
2403
|
}
|
|
2376
|
-
},
|
|
2377
|
-
props:
|
|
2404
|
+
}, $o = /* @__PURE__ */ V({
|
|
2405
|
+
props: Co,
|
|
2378
2406
|
setup(e) {
|
|
2379
|
-
const
|
|
2407
|
+
const a = A("usedLanguageText");
|
|
2380
2408
|
return () => {
|
|
2381
2409
|
var l;
|
|
2382
2410
|
return t("div", {
|
|
@@ -2386,13 +2414,13 @@ const ro = (e) => {
|
|
|
2386
2414
|
onClick: () => {
|
|
2387
2415
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2388
2416
|
}
|
|
2389
|
-
}, [(l =
|
|
2417
|
+
}, [(l = a.value.footer) == null ? void 0 : l.scrollAuto]), t(po, {
|
|
2390
2418
|
checked: e.scrollAuto,
|
|
2391
2419
|
onChange: e.onScrollAutoChange
|
|
2392
2420
|
}, null)]);
|
|
2393
2421
|
};
|
|
2394
2422
|
}
|
|
2395
|
-
}),
|
|
2423
|
+
}), yo = {
|
|
2396
2424
|
modelValue: {
|
|
2397
2425
|
type: String,
|
|
2398
2426
|
default: ""
|
|
@@ -2412,48 +2440,48 @@ const ro = (e) => {
|
|
|
2412
2440
|
defFooters: {
|
|
2413
2441
|
type: Object
|
|
2414
2442
|
}
|
|
2415
|
-
},
|
|
2443
|
+
}, To = /* @__PURE__ */ V({
|
|
2416
2444
|
name: "MDEditorFooter",
|
|
2417
|
-
props:
|
|
2445
|
+
props: yo,
|
|
2418
2446
|
setup(e) {
|
|
2419
|
-
const
|
|
2420
|
-
const
|
|
2447
|
+
const a = he(() => {
|
|
2448
|
+
const r = e.footers.indexOf("="), n = r === -1 ? e.footers : e.footers.slice(0, r), i = r === -1 ? [] : e.footers.slice(r, Number.MAX_SAFE_INTEGER);
|
|
2421
2449
|
return [n, i];
|
|
2422
|
-
}), l = (
|
|
2423
|
-
if (
|
|
2424
|
-
switch (
|
|
2450
|
+
}), l = (r) => {
|
|
2451
|
+
if (Dt.includes(r))
|
|
2452
|
+
switch (r) {
|
|
2425
2453
|
case "markdownTotal":
|
|
2426
|
-
return t(
|
|
2454
|
+
return t(vo, {
|
|
2427
2455
|
modelValue: e.modelValue
|
|
2428
2456
|
}, null);
|
|
2429
2457
|
case "scrollSwitch":
|
|
2430
|
-
return t(
|
|
2458
|
+
return t($o, {
|
|
2431
2459
|
scrollAuto: e.scrollAuto,
|
|
2432
2460
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2433
2461
|
}, null);
|
|
2434
2462
|
}
|
|
2435
2463
|
else
|
|
2436
|
-
return e.defFooters instanceof Array ? e.defFooters[
|
|
2464
|
+
return e.defFooters instanceof Array ? e.defFooters[r] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[r] || "";
|
|
2437
2465
|
};
|
|
2438
2466
|
return () => {
|
|
2439
|
-
const
|
|
2467
|
+
const r = a.value[0].map((i) => l(i)), n = a.value[1].map((i) => l(i));
|
|
2440
2468
|
return t("div", {
|
|
2441
2469
|
class: `${o}-footer`
|
|
2442
2470
|
}, [t("div", {
|
|
2443
2471
|
class: `${o}-footer-left`
|
|
2444
|
-
}, [
|
|
2472
|
+
}, [r]), t("div", {
|
|
2445
2473
|
class: `${o}-footer-right`
|
|
2446
2474
|
}, [n])]);
|
|
2447
2475
|
};
|
|
2448
2476
|
}
|
|
2449
|
-
}),
|
|
2477
|
+
}), wo = /* @__PURE__ */ V({
|
|
2450
2478
|
name: "MdEditorV3",
|
|
2451
2479
|
props: qt,
|
|
2452
2480
|
emits: Ut,
|
|
2453
|
-
setup(e,
|
|
2481
|
+
setup(e, a) {
|
|
2454
2482
|
const {
|
|
2455
2483
|
editorId: l,
|
|
2456
|
-
noKatex:
|
|
2484
|
+
noKatex: r,
|
|
2457
2485
|
noMermaid: n,
|
|
2458
2486
|
noPrettier: i,
|
|
2459
2487
|
noUploadImg: u,
|
|
@@ -2461,42 +2489,42 @@ const ro = (e) => {
|
|
|
2461
2489
|
} = e, c = J({
|
|
2462
2490
|
scrollAuto: e.scrollAuto
|
|
2463
2491
|
});
|
|
2464
|
-
Gt(e,
|
|
2465
|
-
const [
|
|
2492
|
+
Gt(e, a), Kt(e), jt(e), _t(e, a);
|
|
2493
|
+
const [f, m] = Wt(e, a), b = zt(e);
|
|
2466
2494
|
return At(() => {
|
|
2467
2495
|
h.clear(l);
|
|
2468
|
-
}),
|
|
2496
|
+
}), Yt(e, a, b, f, m), () => {
|
|
2469
2497
|
var v;
|
|
2470
2498
|
const $ = nt({
|
|
2471
2499
|
props: e,
|
|
2472
|
-
ctx:
|
|
2500
|
+
ctx: a
|
|
2473
2501
|
}, "defToolbars"), T = nt({
|
|
2474
2502
|
props: e,
|
|
2475
|
-
ctx:
|
|
2503
|
+
ctx: a
|
|
2476
2504
|
}, "defFooters");
|
|
2477
2505
|
return t("div", {
|
|
2478
2506
|
id: l,
|
|
2479
|
-
class: [o, e.class, e.theme === "dark" && `${o}-dark`,
|
|
2507
|
+
class: [o, e.class, e.theme === "dark" && `${o}-dark`, f.fullscreen || f.pageFullscreen ? `${o}-fullscreen` : ""],
|
|
2480
2508
|
style: e.style
|
|
2481
|
-
}, [t(
|
|
2509
|
+
}, [t(Al, {
|
|
2482
2510
|
noPrettier: i,
|
|
2483
2511
|
toolbars: e.toolbars,
|
|
2484
2512
|
toolbarsExclude: e.toolbarsExclude,
|
|
2485
|
-
setting:
|
|
2486
|
-
updateSetting:
|
|
2513
|
+
setting: f,
|
|
2514
|
+
updateSetting: m,
|
|
2487
2515
|
tableShape: e.tableShape,
|
|
2488
2516
|
defToolbars: $,
|
|
2489
2517
|
noUploadImg: u,
|
|
2490
2518
|
showToolbarName: e.showToolbarName
|
|
2491
|
-
}, null), t(
|
|
2519
|
+
}, null), t(bo, {
|
|
2492
2520
|
value: e.modelValue,
|
|
2493
|
-
setting:
|
|
2521
|
+
setting: f,
|
|
2494
2522
|
mdHeadingId: e.mdHeadingId,
|
|
2495
2523
|
noMermaid: n,
|
|
2496
2524
|
noPrettier: i,
|
|
2497
2525
|
sanitize: e.sanitize,
|
|
2498
2526
|
placeholder: e.placeholder,
|
|
2499
|
-
noKatex:
|
|
2527
|
+
noKatex: r,
|
|
2500
2528
|
scrollAuto: c.scrollAuto,
|
|
2501
2529
|
formatCopiedText: e.formatCopiedText,
|
|
2502
2530
|
autofocus: e.autoFocus,
|
|
@@ -2506,27 +2534,27 @@ const ro = (e) => {
|
|
|
2506
2534
|
autoDetectCode: e.autoDetectCode,
|
|
2507
2535
|
noHighlight: d,
|
|
2508
2536
|
onChange: (g) => {
|
|
2509
|
-
e.onChange ? e.onChange(g) : (
|
|
2537
|
+
e.onChange ? e.onChange(g) : (a.emit("update:modelValue", g), a.emit("onChange", g));
|
|
2510
2538
|
},
|
|
2511
2539
|
onHtmlChanged: (g) => {
|
|
2512
|
-
e.onHtmlChanged ? e.onHtmlChanged(g) :
|
|
2540
|
+
e.onHtmlChanged ? e.onHtmlChanged(g) : a.emit("onHtmlChanged", g);
|
|
2513
2541
|
},
|
|
2514
2542
|
onGetCatalog: (g) => {
|
|
2515
|
-
e.onGetCatalog ? e.onGetCatalog(g) :
|
|
2543
|
+
e.onGetCatalog ? e.onGetCatalog(g) : a.emit("onGetCatalog", g);
|
|
2516
2544
|
},
|
|
2517
2545
|
onBlur: (g) => {
|
|
2518
|
-
e.onBlur ? e.onBlur(g) :
|
|
2546
|
+
e.onBlur ? e.onBlur(g) : a.emit("onBlur", g);
|
|
2519
2547
|
},
|
|
2520
2548
|
onFocus: (g) => {
|
|
2521
|
-
e.onFocus ? e.onFocus(g) :
|
|
2549
|
+
e.onFocus ? e.onFocus(g) : a.emit("onFocus", g);
|
|
2522
2550
|
},
|
|
2523
2551
|
onInput: (g) => {
|
|
2524
|
-
e.onInput ? e.onInput(g) :
|
|
2552
|
+
e.onInput ? e.onInput(g) : a.emit("onInput", g);
|
|
2525
2553
|
},
|
|
2526
2554
|
completions: e.completions,
|
|
2527
2555
|
catalogVisible: b.value,
|
|
2528
2556
|
theme: e.theme
|
|
2529
|
-
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(
|
|
2557
|
+
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(To, {
|
|
2530
2558
|
modelValue: e.modelValue,
|
|
2531
2559
|
footers: e.footers,
|
|
2532
2560
|
defFooters: T,
|
|
@@ -2535,8 +2563,8 @@ const ro = (e) => {
|
|
|
2535
2563
|
}, null)]);
|
|
2536
2564
|
};
|
|
2537
2565
|
}
|
|
2538
|
-
}), ge =
|
|
2539
|
-
ge.install = (e) => (e.component(ge.name, ge), e.use(
|
|
2566
|
+
}), ge = wo;
|
|
2567
|
+
ge.install = (e) => (e.component(ge.name, ge), e.use(fl).use(Bt).use(gl).use(Tt).use(Zt), e);
|
|
2540
2568
|
export {
|
|
2541
2569
|
ge as default
|
|
2542
2570
|
};
|