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