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