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