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