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