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