md-editor-v3 3.0.0-beta.2 → 3.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/md-editor-v3.cjs +20 -21
- package/lib/md-editor-v3.mjs +1119 -1127
- package/lib/md-editor-v3.umd.js +50 -46
- package/lib/style.css +1 -1
- package/package.json +5 -4
package/lib/md-editor-v3.mjs
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as M, createVNode as i, reactive as
|
|
5
|
-
import { minimalSetup as
|
|
6
|
-
import { EditorSelection as
|
|
7
|
-
import { EditorView as
|
|
8
|
-
import { languages as
|
|
9
|
-
import { markdown as
|
|
10
|
-
import { deleteLine as
|
|
11
|
-
import { HighlightStyle as
|
|
1
|
+
var wt = Object.defineProperty;
|
|
2
|
+
var Tt = (e, l, o) => l in e ? wt(e, l, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[l] = o;
|
|
3
|
+
var K = (e, l, o) => (Tt(e, typeof l != "symbol" ? l + "" : l, o), o);
|
|
4
|
+
import { defineComponent as M, createVNode as i, reactive as q, ref as B, watch as S, onMounted as H, onBeforeUnmount as Se, cloneVNode as St, inject as x, computed as U, nextTick as Y, Fragment as xe, toRef as ne, shallowRef as de, provide as Z, isVNode as xt } from "vue";
|
|
5
|
+
import { minimalSetup as Et, EditorView as fe } from "codemirror";
|
|
6
|
+
import { EditorSelection as be, EditorState as ge, Compartment as Lt, StateEffect as At } from "@codemirror/state";
|
|
7
|
+
import { EditorView as Ee, placeholder as It, keymap as Ht } from "@codemirror/view";
|
|
8
|
+
import { languages as Ft } from "@codemirror/language-data";
|
|
9
|
+
import { markdown as Mt } from "@codemirror/lang-markdown";
|
|
10
|
+
import { deleteLine as Bt, indentWithTab as Rt, undo as jt, redo as Pt } from "@codemirror/commands";
|
|
11
|
+
import { HighlightStyle as vt, syntaxHighlighting as pt, indentUnit as Dt } from "@codemirror/language";
|
|
12
12
|
import { tags as g } from "@lezer/highlight";
|
|
13
|
-
import
|
|
13
|
+
import Ot from "medium-zoom";
|
|
14
14
|
import _t from "copy-to-clipboard";
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
15
|
+
import Nt from "markdown-it";
|
|
16
|
+
import Vt from "markdown-it-image-figures";
|
|
17
|
+
import Ut from "markdown-it-task-lists";
|
|
18
|
+
import qt from "markdown-it-codetabs";
|
|
18
19
|
import Wt from "lru-cache";
|
|
19
|
-
const s = "md-editor", Gt = "md-editor-v3",
|
|
20
|
-
main: `${
|
|
21
|
-
markdown: `${
|
|
20
|
+
const s = "md-editor", Gt = "md-editor-v3", Kt = "https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js", L = "https://cdnjs.cloudflare.com/ajax/libs", zt = `${L}/highlight.js/11.7.0/highlight.min.js`, Ge = {
|
|
21
|
+
main: `${L}/prettier/2.8.0/standalone.js`,
|
|
22
|
+
markdown: `${L}/prettier/2.8.0/parser-markdown.js`
|
|
22
23
|
}, Ke = {
|
|
23
|
-
css: `${
|
|
24
|
-
js: `${
|
|
25
|
-
}, Xt = `${
|
|
24
|
+
css: `${L}/cropperjs/1.5.13/cropper.min.css`,
|
|
25
|
+
js: `${L}/cropperjs/1.5.13/cropper.min.js`
|
|
26
|
+
}, Xt = `${L}/screenfull.js/5.2.0/screenfull.min.js`, bt = [
|
|
26
27
|
"bold",
|
|
27
28
|
"underline",
|
|
28
29
|
"italic",
|
|
@@ -55,7 +56,7 @@ const s = "md-editor", Gt = "md-editor-v3", zt = "https://at.alicdn.com/t/c/font
|
|
|
55
56
|
"htmlPreview",
|
|
56
57
|
"catalog",
|
|
57
58
|
"github"
|
|
58
|
-
],
|
|
59
|
+
], kt = ["markdownTotal", "=", "scrollSwitch"], ze = {
|
|
59
60
|
"zh-CN": {
|
|
60
61
|
toolbarTips: {
|
|
61
62
|
bold: "加粗",
|
|
@@ -218,56 +219,56 @@ const s = "md-editor", Gt = "md-editor-v3", zt = "https://at.alicdn.com/t/c/font
|
|
|
218
219
|
scrollAuto: "Scroll Auto"
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
|
-
}, Zt = `${
|
|
222
|
-
js: `${
|
|
223
|
-
css: `${
|
|
224
|
-
},
|
|
222
|
+
}, Zt = `${L}/mermaid/9.4.0/mermaid.min.js`, Xe = {
|
|
223
|
+
js: `${L}/KaTeX/0.16.3/katex.min.js`,
|
|
224
|
+
css: `${L}/KaTeX/0.16.3/katex.min.css`
|
|
225
|
+
}, Ze = {
|
|
225
226
|
a11y: {
|
|
226
|
-
light: `${
|
|
227
|
-
dark: `${
|
|
227
|
+
light: `${L}/highlight.js/11.7.0/styles/a11y-light.min.css`,
|
|
228
|
+
dark: `${L}/highlight.js/11.7.0/styles/a11y-dark.min.css`
|
|
228
229
|
},
|
|
229
230
|
atom: {
|
|
230
|
-
light: `${
|
|
231
|
-
dark: `${
|
|
231
|
+
light: `${L}/highlight.js/11.7.0/styles/atom-one-light.min.css`,
|
|
232
|
+
dark: `${L}/highlight.js/11.7.0/styles/atom-one-dark.min.css`
|
|
232
233
|
},
|
|
233
234
|
github: {
|
|
234
|
-
light: `${
|
|
235
|
-
dark: `${
|
|
235
|
+
light: `${L}/highlight.js/11.7.0/styles/github.min.css`,
|
|
236
|
+
dark: `${L}/highlight.js/11.7.0/styles/github-dark.min.css`
|
|
236
237
|
},
|
|
237
238
|
gradient: {
|
|
238
|
-
light: `${
|
|
239
|
-
dark: `${
|
|
239
|
+
light: `${L}/highlight.js/11.7.0/styles/gradient-light.min.css`,
|
|
240
|
+
dark: `${L}/highlight.js/11.7.0/styles/gradient-dark.min.css`
|
|
240
241
|
},
|
|
241
242
|
kimbie: {
|
|
242
|
-
light: `${
|
|
243
|
-
dark: `${
|
|
243
|
+
light: `${L}/highlight.js/11.7.0/styles/kimbie-light.min.css`,
|
|
244
|
+
dark: `${L}/highlight.js/11.7.0/styles/kimbie-dark.min.css`
|
|
244
245
|
},
|
|
245
246
|
paraiso: {
|
|
246
|
-
light: `${
|
|
247
|
-
dark: `${
|
|
247
|
+
light: `${L}/highlight.js/11.7.0/styles/paraiso-light.min.css`,
|
|
248
|
+
dark: `${L}/highlight.js/11.7.0/styles/paraiso-dark.min.css`
|
|
248
249
|
},
|
|
249
250
|
qtcreator: {
|
|
250
|
-
light: `${
|
|
251
|
-
dark: `${
|
|
251
|
+
light: `${L}/highlight.js/11.7.0/styles/qtcreator-light.min.css`,
|
|
252
|
+
dark: `${L}/highlight.js/11.7.0/styles/qtcreator-dark.min.css`
|
|
252
253
|
},
|
|
253
254
|
stackoverflow: {
|
|
254
|
-
light: `${
|
|
255
|
-
dark: `${
|
|
255
|
+
light: `${L}/highlight.js/11.7.0/styles/stackoverflow-light.min.css`,
|
|
256
|
+
dark: `${L}/highlight.js/11.7.0/styles/stackoverflow-dark.min.css`
|
|
256
257
|
}
|
|
257
|
-
},
|
|
258
|
+
}, A = {
|
|
258
259
|
// markedRenderer: (r) => r,
|
|
259
260
|
// markedExtensions: [],
|
|
260
261
|
// markedOptions: {},
|
|
261
262
|
editorExtensions: {},
|
|
262
263
|
editorConfig: {},
|
|
263
|
-
codeMirrorExtensions: (e,
|
|
264
|
+
codeMirrorExtensions: (e, l) => l,
|
|
264
265
|
markdownItConfig: () => {
|
|
265
266
|
}
|
|
266
267
|
}, Jt = (e) => {
|
|
267
268
|
if (e)
|
|
268
|
-
for (const
|
|
269
|
-
const o = e[
|
|
270
|
-
o && (
|
|
269
|
+
for (const l in e) {
|
|
270
|
+
const o = e[l];
|
|
271
|
+
o && (A[l] = o);
|
|
271
272
|
}
|
|
272
273
|
};
|
|
273
274
|
const Yt = /* @__PURE__ */ M({
|
|
@@ -276,13 +277,13 @@ const Yt = /* @__PURE__ */ M({
|
|
|
276
277
|
class: `${s}-divider`
|
|
277
278
|
}, null);
|
|
278
279
|
}
|
|
279
|
-
}),
|
|
280
|
+
}), W = ({
|
|
280
281
|
instance: e,
|
|
281
|
-
ctx:
|
|
282
|
+
ctx: l,
|
|
282
283
|
props: o = {}
|
|
283
|
-
},
|
|
284
|
-
const r = (e == null ? void 0 : e.$slots[
|
|
285
|
-
return (r ? r(e) : "") || o[
|
|
284
|
+
}, t = "default") => {
|
|
285
|
+
const r = (e == null ? void 0 : e.$slots[t]) || (l == null ? void 0 : l.slots[t]);
|
|
286
|
+
return (r ? r(e) : "") || o[t];
|
|
286
287
|
};
|
|
287
288
|
const Qt = {
|
|
288
289
|
trigger: {
|
|
@@ -307,140 +308,140 @@ const Qt = {
|
|
|
307
308
|
type: String,
|
|
308
309
|
default: "html"
|
|
309
310
|
}
|
|
310
|
-
},
|
|
311
|
+
}, oe = /* @__PURE__ */ M({
|
|
311
312
|
props: Qt,
|
|
312
|
-
setup(e,
|
|
313
|
-
const o = `${s}-dropdown-hidden`,
|
|
313
|
+
setup(e, l) {
|
|
314
|
+
const o = `${s}-dropdown-hidden`, t = q({
|
|
314
315
|
overlayClass: [o],
|
|
315
316
|
overlayStyle: {},
|
|
316
317
|
triggerHover: !1,
|
|
317
318
|
overlayHover: !1
|
|
318
|
-
}), r =
|
|
319
|
-
var
|
|
320
|
-
e.trigger === "hover" && (
|
|
321
|
-
const f = r.value, h = n.value,
|
|
322
|
-
|
|
323
|
-
...
|
|
324
|
-
top:
|
|
325
|
-
left:
|
|
319
|
+
}), r = B(), n = B(), a = () => {
|
|
320
|
+
var T;
|
|
321
|
+
e.trigger === "hover" && (t.triggerHover = !0);
|
|
322
|
+
const f = r.value, h = n.value, p = f.getBoundingClientRect(), v = f.offsetTop, b = f.offsetLeft, y = p.height, C = p.width, $ = ((T = document.querySelector(e.relative)) == null ? void 0 : T.scrollLeft) || 0;
|
|
323
|
+
t.overlayStyle = {
|
|
324
|
+
...t.overlayStyle,
|
|
325
|
+
top: v + y + "px",
|
|
326
|
+
left: b - h.offsetWidth / 2 + C / 2 - $ + "px"
|
|
326
327
|
}, e.onChange(!0);
|
|
327
|
-
},
|
|
328
|
-
|
|
328
|
+
}, d = () => {
|
|
329
|
+
t.overlayHover = !0;
|
|
329
330
|
};
|
|
330
|
-
|
|
331
|
-
f ?
|
|
331
|
+
S(() => e.visible, (f) => {
|
|
332
|
+
f ? t.overlayClass = t.overlayClass.filter((h) => h !== o) : t.overlayClass.push(o);
|
|
332
333
|
});
|
|
333
334
|
const m = (f) => {
|
|
334
|
-
const h = r.value,
|
|
335
|
-
!h.contains(f.target) && !
|
|
335
|
+
const h = r.value, p = n.value;
|
|
336
|
+
!h.contains(f.target) && !p.contains(f.target) && e.onChange(!1);
|
|
336
337
|
};
|
|
337
338
|
let u = -1;
|
|
338
|
-
const
|
|
339
|
-
r.value === f.target ?
|
|
340
|
-
!
|
|
339
|
+
const c = (f) => {
|
|
340
|
+
r.value === f.target ? t.triggerHover = !1 : t.overlayHover = !1, clearTimeout(u), u = window.setTimeout(() => {
|
|
341
|
+
!t.overlayHover && !t.triggerHover && e.onChange(!1);
|
|
341
342
|
}, 10);
|
|
342
343
|
};
|
|
343
|
-
return
|
|
344
|
-
e.trigger === "click" ? (r.value.addEventListener("click", a), document.addEventListener("click", m)) : (r.value.addEventListener("mouseenter", a), r.value.addEventListener("mouseleave",
|
|
345
|
-
}),
|
|
346
|
-
e.trigger === "click" ? (r.value.removeEventListener("click", a), document.removeEventListener("click", m)) : (r.value.removeEventListener("mouseenter", a), r.value.removeEventListener("mouseleave",
|
|
344
|
+
return H(() => {
|
|
345
|
+
e.trigger === "click" ? (r.value.addEventListener("click", a), document.addEventListener("click", m)) : (r.value.addEventListener("mouseenter", a), r.value.addEventListener("mouseleave", c), n.value.addEventListener("mouseenter", d), n.value.addEventListener("mouseleave", c));
|
|
346
|
+
}), Se(() => {
|
|
347
|
+
e.trigger === "click" ? (r.value.removeEventListener("click", a), document.removeEventListener("click", m)) : (r.value.removeEventListener("mouseenter", a), r.value.removeEventListener("mouseleave", c), n.value.removeEventListener("mouseenter", d), n.value.removeEventListener("mouseleave", c));
|
|
347
348
|
}), () => {
|
|
348
|
-
const f =
|
|
349
|
-
ctx:
|
|
350
|
-
}), h =
|
|
349
|
+
const f = W({
|
|
350
|
+
ctx: l
|
|
351
|
+
}), h = W({
|
|
351
352
|
props: e,
|
|
352
|
-
ctx:
|
|
353
|
-
}, "overlay"),
|
|
353
|
+
ctx: l
|
|
354
|
+
}, "overlay"), p = St(f instanceof Array ? f[0] : f, {
|
|
354
355
|
ref: r
|
|
355
|
-
}),
|
|
356
|
-
class: [`${s}-dropdown`,
|
|
357
|
-
style:
|
|
356
|
+
}), v = i("div", {
|
|
357
|
+
class: [`${s}-dropdown`, t.overlayClass],
|
|
358
|
+
style: t.overlayStyle,
|
|
358
359
|
ref: n
|
|
359
360
|
}, [i("div", {
|
|
360
361
|
class: `${s}-dropdown-overlay`
|
|
361
362
|
}, [h instanceof Array ? h[0] : h])]);
|
|
362
|
-
return [
|
|
363
|
+
return [p, v];
|
|
363
364
|
};
|
|
364
365
|
}
|
|
365
366
|
});
|
|
366
367
|
class el {
|
|
367
368
|
constructor() {
|
|
368
369
|
// 事件池
|
|
369
|
-
|
|
370
|
+
K(this, "pools", {});
|
|
370
371
|
}
|
|
371
372
|
// 移除事件监听
|
|
372
|
-
remove(
|
|
373
|
-
const n = this.pools[
|
|
374
|
-
n && (this.pools[
|
|
373
|
+
remove(l, o, t) {
|
|
374
|
+
const n = this.pools[l] && this.pools[l][o];
|
|
375
|
+
n && (this.pools[l][o] = n.filter((a) => a !== t));
|
|
375
376
|
}
|
|
376
377
|
// 清空全部事件,由于单一实例,多次注册会被共享内容
|
|
377
|
-
clear(
|
|
378
|
-
this.pools[
|
|
378
|
+
clear(l) {
|
|
379
|
+
this.pools[l] = {};
|
|
379
380
|
}
|
|
380
381
|
// 注册事件监听
|
|
381
|
-
on(
|
|
382
|
-
return this.pools[
|
|
382
|
+
on(l, o) {
|
|
383
|
+
return this.pools[l] || (this.pools[l] = {}), this.pools[l][o.name] || (this.pools[l][o.name] = []), this.pools[l][o.name].push(o.callback), this.pools[l][o.name].includes(o.callback);
|
|
383
384
|
}
|
|
384
385
|
// 触发事件
|
|
385
|
-
emit(
|
|
386
|
-
this.pools[
|
|
387
|
-
const n = this.pools[
|
|
386
|
+
emit(l, o, ...t) {
|
|
387
|
+
this.pools[l] || (this.pools[l] = {});
|
|
388
|
+
const n = this.pools[l][o];
|
|
388
389
|
n && n.forEach((a) => {
|
|
389
390
|
try {
|
|
390
|
-
a(...
|
|
391
|
-
} catch (
|
|
392
|
-
console.error(`${o} monitor event exception!`,
|
|
391
|
+
a(...t);
|
|
392
|
+
} catch (d) {
|
|
393
|
+
console.error(`${o} monitor event exception!`, d);
|
|
393
394
|
}
|
|
394
395
|
});
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
const
|
|
398
|
+
const k = new el(), tl = (e, l = {
|
|
398
399
|
newWindow: !0,
|
|
399
400
|
nofollow: !0
|
|
400
401
|
}) => {
|
|
401
402
|
e || console.error("error link!");
|
|
402
403
|
const o = document.createElement("a");
|
|
403
|
-
o.href = e, o.style.display = "none",
|
|
404
|
-
}, ll = (e,
|
|
405
|
-
const o = e.split(","),
|
|
406
|
-
if (
|
|
407
|
-
const r =
|
|
404
|
+
o.href = e, o.style.display = "none", l.newWindow && (o.target = "_blank"), l.nofollow && (o.rel = "noopener noreferrer"), document.body.appendChild(o), o.click(), document.body.removeChild(o);
|
|
405
|
+
}, ll = (e, l = "image.png") => {
|
|
406
|
+
const o = e.split(","), t = o[0].match(/:(.*?);/);
|
|
407
|
+
if (t) {
|
|
408
|
+
const r = t[1], n = atob(o[1]);
|
|
408
409
|
let a = n.length;
|
|
409
|
-
const
|
|
410
|
+
const d = new Uint8Array(a);
|
|
410
411
|
for (; a--; )
|
|
411
|
-
|
|
412
|
-
return new File([
|
|
412
|
+
d[a] = n.charCodeAt(a);
|
|
413
|
+
return new File([d], l, { type: r });
|
|
413
414
|
}
|
|
414
415
|
return null;
|
|
415
416
|
}, ol = (e) => {
|
|
416
417
|
if (!e)
|
|
417
418
|
return e;
|
|
418
|
-
const
|
|
419
|
+
const l = e.split(`
|
|
419
420
|
`), o = ['<span rn-wrapper aria-hidden="true">'];
|
|
420
|
-
return
|
|
421
|
+
return l.forEach(() => {
|
|
421
422
|
o.push("<span></span>");
|
|
422
423
|
}), o.push("</span>"), `<span class="code-block">${e}</span>${o.join("")}`;
|
|
423
|
-
},
|
|
424
|
+
}, ve = (e, l = 200) => {
|
|
424
425
|
let o = 0;
|
|
425
|
-
return (...
|
|
426
|
+
return (...t) => new Promise((r) => {
|
|
426
427
|
o && (clearTimeout(o), r("cancel")), o = window.setTimeout(() => {
|
|
427
|
-
e.apply(void 0,
|
|
428
|
-
},
|
|
428
|
+
e.apply(void 0, t), o = 0, r("done");
|
|
429
|
+
}, l);
|
|
429
430
|
});
|
|
430
|
-
}, nl = (e,
|
|
431
|
-
let o = 0,
|
|
431
|
+
}, nl = (e, l = 200) => {
|
|
432
|
+
let o = 0, t = null;
|
|
432
433
|
return (...r) => {
|
|
433
434
|
const n = (a) => {
|
|
434
|
-
o === 0 && (o = a), a - o >=
|
|
435
|
+
o === 0 && (o = a), a - o >= l ? (e.apply(void 0, t), t = null, o = 0) : window.requestAnimationFrame(n);
|
|
435
436
|
};
|
|
436
|
-
|
|
437
|
+
t === null && window.requestAnimationFrame(n), t = r;
|
|
437
438
|
};
|
|
438
|
-
}, rl = (e,
|
|
439
|
+
}, rl = (e, l) => {
|
|
439
440
|
const o = e == null ? void 0 : e.getBoundingClientRect();
|
|
440
|
-
if (
|
|
441
|
-
return o.top -
|
|
442
|
-
const
|
|
443
|
-
return o.top -
|
|
441
|
+
if (l === document.documentElement)
|
|
442
|
+
return o.top - l.clientTop;
|
|
443
|
+
const t = l == null ? void 0 : l.getBoundingClientRect();
|
|
444
|
+
return o.top - t.top;
|
|
444
445
|
}, il = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`, al = {
|
|
445
446
|
noPrettier: {
|
|
446
447
|
type: Boolean
|
|
@@ -482,11 +483,11 @@ const C = new el(), tl = (e, t = {
|
|
|
482
483
|
noUploadImg: {
|
|
483
484
|
type: Boolean
|
|
484
485
|
}
|
|
485
|
-
},
|
|
486
|
-
const o = (
|
|
487
|
-
const r = e.parentElement || document.body, n = r.offsetWidth, a = r.offsetHeight, { clientWidth:
|
|
488
|
-
let
|
|
489
|
-
|
|
486
|
+
}, pe = "onSave", Le = "changeCatalogVisible", yt = "changeFullscreen", Je = "pageFullscreenChanged", Ye = "fullscreenChanged", Ce = "previewChanged", Qe = "htmlPreviewChanged", et = "catalogVisibleChanged", Ct = "textareaFocus", tt = (e, l) => {
|
|
487
|
+
const o = (t) => {
|
|
488
|
+
const r = e.parentElement || document.body, n = r.offsetWidth, a = r.offsetHeight, { clientWidth: d } = document.documentElement, { clientHeight: m } = document.documentElement, u = t.offsetX, c = t.offsetY, f = (p) => {
|
|
489
|
+
let v = p.x + document.body.scrollLeft - document.body.clientLeft - u, b = p.y + document.body.scrollTop - document.body.clientTop - c;
|
|
490
|
+
v = v < 1 ? 1 : v < d - n - 1 ? v : d - n - 1, b = b < 1 ? 1 : b < m - a - 1 ? b : m - a - 1, l ? l(v, b) : (r.style.left = `${v}px`, r.style.top = `${b}px`);
|
|
490
491
|
};
|
|
491
492
|
document.addEventListener("mousemove", f);
|
|
492
493
|
const h = () => {
|
|
@@ -497,23 +498,23 @@ const C = new el(), tl = (e, t = {
|
|
|
497
498
|
return e.addEventListener("mousedown", o), () => {
|
|
498
499
|
e.removeEventListener("mousedown", o);
|
|
499
500
|
};
|
|
500
|
-
},
|
|
501
|
-
const o = document.getElementById(e.id),
|
|
501
|
+
}, V = (e, l = "") => {
|
|
502
|
+
const o = document.getElementById(e.id), t = e.onload;
|
|
502
503
|
e.onload = null;
|
|
503
504
|
const r = function(n) {
|
|
504
|
-
typeof
|
|
505
|
+
typeof t == "function" && t.bind(this)(n), e.removeEventListener("load", r);
|
|
505
506
|
};
|
|
506
|
-
o ?
|
|
507
|
-
}, sl =
|
|
508
|
-
const
|
|
509
|
-
|
|
507
|
+
o ? l !== "" && (o.addEventListener("load", r), Reflect.get(window, l) && o.dispatchEvent(new Event("load"))) : (e.addEventListener("load", r), document.head.appendChild(e));
|
|
508
|
+
}, sl = ve((e, l, o) => {
|
|
509
|
+
const t = document.getElementById(e);
|
|
510
|
+
t && t.setAttribute(l, o);
|
|
510
511
|
}, 10), cl = (e) => {
|
|
511
|
-
var m, u,
|
|
512
|
-
const
|
|
513
|
-
let o = (u = (m =
|
|
514
|
-
const
|
|
512
|
+
var m, u, c, f;
|
|
513
|
+
const l = x("editorId");
|
|
514
|
+
let o = (u = (m = A.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : u.instance;
|
|
515
|
+
const t = (f = (c = A.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : f.js, r = B(!1), n = (h) => {
|
|
515
516
|
if (!o) {
|
|
516
|
-
|
|
517
|
+
k.emit(l, "errorCatcher", {
|
|
517
518
|
name: "fullscreen",
|
|
518
519
|
message: "fullscreen is undefined"
|
|
519
520
|
});
|
|
@@ -524,17 +525,17 @@ const C = new el(), tl = (e, t = {
|
|
|
524
525
|
o && o.isEnabled && o.on("change", () => {
|
|
525
526
|
(r.value || e.setting.fullscreen) && (r.value = !1, e.updateSetting("fullscreen"));
|
|
526
527
|
});
|
|
527
|
-
},
|
|
528
|
+
}, d = () => {
|
|
528
529
|
o = window.screenfull, a();
|
|
529
530
|
};
|
|
530
|
-
return
|
|
531
|
+
return H(() => {
|
|
531
532
|
if (a(), !o) {
|
|
532
533
|
const h = document.createElement("script");
|
|
533
|
-
h.src =
|
|
534
|
+
h.src = t || Xt, h.onload = d, h.id = `${s}-screenfull`, V(h, "screenfull");
|
|
534
535
|
}
|
|
535
|
-
}),
|
|
536
|
-
|
|
537
|
-
name:
|
|
536
|
+
}), H(() => {
|
|
537
|
+
k.on(l, {
|
|
538
|
+
name: yt,
|
|
538
539
|
callback: n
|
|
539
540
|
});
|
|
540
541
|
}), { fullscreenHandler: n };
|
|
@@ -552,29 +553,29 @@ const C = new el(), tl = (e, t = {
|
|
|
552
553
|
name: "TableShape",
|
|
553
554
|
props: dl,
|
|
554
555
|
setup(e) {
|
|
555
|
-
const
|
|
556
|
+
const l = q({
|
|
556
557
|
x: -1,
|
|
557
558
|
y: -1
|
|
558
559
|
});
|
|
559
560
|
return () => i("div", {
|
|
560
561
|
class: `${s}-table-shape`,
|
|
561
562
|
onMouseleave: () => {
|
|
562
|
-
|
|
563
|
+
l.x = -1, l.y = -1;
|
|
563
564
|
}
|
|
564
|
-
}, [new Array(e.tableShape[1]).fill("").map((o,
|
|
565
|
+
}, [new Array(e.tableShape[1]).fill("").map((o, t) => i("div", {
|
|
565
566
|
class: `${s}-table-shape-row`,
|
|
566
|
-
key: `table-shape-row-${
|
|
567
|
+
key: `table-shape-row-${t}`
|
|
567
568
|
}, [new Array(e.tableShape[0]).fill("").map((r, n) => i("div", {
|
|
568
569
|
class: `${s}-table-shape-col`,
|
|
569
570
|
key: `table-shape-col-${n}`,
|
|
570
571
|
onMouseenter: () => {
|
|
571
|
-
|
|
572
|
+
l.x = t, l.y = n;
|
|
572
573
|
},
|
|
573
574
|
onClick: () => {
|
|
574
|
-
e.onSelected(
|
|
575
|
+
e.onSelected(l);
|
|
575
576
|
}
|
|
576
577
|
}, [i("div", {
|
|
577
|
-
class: [`${s}-table-shape-col-default`,
|
|
578
|
+
class: [`${s}-table-shape-col-default`, t <= l.x && n <= l.y && `${s}-table-shape-col-include`]
|
|
578
579
|
}, null)]))]))]);
|
|
579
580
|
}
|
|
580
581
|
});
|
|
@@ -616,13 +617,13 @@ const ml = {
|
|
|
616
617
|
class: {
|
|
617
618
|
type: String
|
|
618
619
|
}
|
|
619
|
-
},
|
|
620
|
+
}, Ae = /* @__PURE__ */ M({
|
|
620
621
|
props: ml,
|
|
621
|
-
setup(e,
|
|
622
|
-
const o =
|
|
622
|
+
setup(e, l) {
|
|
623
|
+
const o = B(e.visible), t = B([`${s}-modal`]), r = B(), n = B();
|
|
623
624
|
let a = () => {
|
|
624
625
|
};
|
|
625
|
-
const
|
|
626
|
+
const d = q({
|
|
626
627
|
initPos: {
|
|
627
628
|
left: "0px",
|
|
628
629
|
top: "0px"
|
|
@@ -631,38 +632,38 @@ const ml = {
|
|
|
631
632
|
left: "0px",
|
|
632
633
|
top: "0px"
|
|
633
634
|
}
|
|
634
|
-
}), m =
|
|
635
|
+
}), m = U(() => e.isFullscreen ? {
|
|
635
636
|
width: "100%",
|
|
636
637
|
height: "100%"
|
|
637
638
|
} : {
|
|
638
639
|
width: e.width,
|
|
639
640
|
height: e.height
|
|
640
641
|
});
|
|
641
|
-
return
|
|
642
|
-
a =
|
|
643
|
-
|
|
642
|
+
return H(() => {
|
|
643
|
+
a = tt(n.value, (u, c) => {
|
|
644
|
+
d.initPos.left = u + "px", d.initPos.top = c + "px";
|
|
644
645
|
});
|
|
645
|
-
}),
|
|
646
|
+
}), Se(() => {
|
|
646
647
|
a();
|
|
647
|
-
}),
|
|
648
|
-
u ? a() : a =
|
|
649
|
-
|
|
648
|
+
}), S(() => e.isFullscreen, (u) => {
|
|
649
|
+
u ? a() : a = tt(n.value, (c, f) => {
|
|
650
|
+
d.initPos.left = c + "px", d.initPos.top = f + "px";
|
|
650
651
|
});
|
|
651
|
-
}),
|
|
652
|
-
u ? (
|
|
653
|
-
const
|
|
654
|
-
|
|
652
|
+
}), S(() => e.visible, (u) => {
|
|
653
|
+
u ? (t.value.push("zoom-in"), o.value = u, Y(() => {
|
|
654
|
+
const c = r.value.offsetWidth / 2, f = r.value.offsetHeight / 2, h = document.documentElement.clientWidth / 2, p = document.documentElement.clientHeight / 2;
|
|
655
|
+
d.initPos.left = h - c + "px", d.initPos.top = p - f + "px";
|
|
655
656
|
}), setTimeout(() => {
|
|
656
|
-
|
|
657
|
-
}, 140)) : (
|
|
658
|
-
|
|
657
|
+
t.value = t.value.filter((c) => c !== "zoom-in");
|
|
658
|
+
}, 140)) : (t.value.push("zoom-out"), setTimeout(() => {
|
|
659
|
+
t.value = t.value.filter((c) => c !== "zoom-out"), o.value = u;
|
|
659
660
|
}, 130));
|
|
660
661
|
}), () => {
|
|
661
|
-
const u =
|
|
662
|
-
ctx:
|
|
663
|
-
}),
|
|
662
|
+
const u = W({
|
|
663
|
+
ctx: l
|
|
664
|
+
}), c = W({
|
|
664
665
|
props: e,
|
|
665
|
-
ctx:
|
|
666
|
+
ctx: l
|
|
666
667
|
}, "title");
|
|
667
668
|
return i("div", {
|
|
668
669
|
class: [e.class],
|
|
@@ -673,23 +674,23 @@ const ml = {
|
|
|
673
674
|
class: `${s}-modal-mask`,
|
|
674
675
|
onClick: e.onClose
|
|
675
676
|
}, null), i("div", {
|
|
676
|
-
class:
|
|
677
|
+
class: t.value,
|
|
677
678
|
style: {
|
|
678
|
-
...
|
|
679
|
+
...d.initPos,
|
|
679
680
|
...m.value
|
|
680
681
|
},
|
|
681
682
|
ref: r
|
|
682
683
|
}, [i("div", {
|
|
683
684
|
class: `${s}-modal-header`,
|
|
684
685
|
ref: n
|
|
685
|
-
}, [
|
|
686
|
+
}, [c || ""]), i("div", {
|
|
686
687
|
class: `${s}-modal-body`
|
|
687
688
|
}, [u]), i("div", {
|
|
688
689
|
class: `${s}-modal-func`
|
|
689
690
|
}, [e.showAdjust && i("div", {
|
|
690
691
|
class: `${s}-modal-adjust`,
|
|
691
692
|
onClick: (f) => {
|
|
692
|
-
f.stopPropagation(), e.isFullscreen ?
|
|
693
|
+
f.stopPropagation(), e.isFullscreen ? d.initPos = d.historyPos : (d.historyPos = d.initPos, d.initPos = {
|
|
693
694
|
left: "0",
|
|
694
695
|
top: "0"
|
|
695
696
|
}), e.onAdjust(!e.isFullscreen);
|
|
@@ -734,44 +735,44 @@ const ml = {
|
|
|
734
735
|
}, gl = /* @__PURE__ */ M({
|
|
735
736
|
props: fl,
|
|
736
737
|
setup(e) {
|
|
737
|
-
const
|
|
738
|
+
const l = x("usedLanguageText"), o = x("editorId"), t = U(() => {
|
|
738
739
|
var n, a;
|
|
739
740
|
switch (e.type) {
|
|
740
741
|
case "link":
|
|
741
|
-
return (n =
|
|
742
|
+
return (n = l.value.linkModalTips) == null ? void 0 : n.linkTitle;
|
|
742
743
|
case "image":
|
|
743
|
-
return (a =
|
|
744
|
+
return (a = l.value.linkModalTips) == null ? void 0 : a.imageTitle;
|
|
744
745
|
default:
|
|
745
746
|
return "";
|
|
746
747
|
}
|
|
747
|
-
}), r =
|
|
748
|
+
}), r = q({
|
|
748
749
|
desc: "",
|
|
749
750
|
url: ""
|
|
750
751
|
});
|
|
751
|
-
return
|
|
752
|
+
return S(() => e.visible, (n) => {
|
|
752
753
|
n || setTimeout(() => {
|
|
753
754
|
r.desc = "", r.url = "";
|
|
754
755
|
}, 200);
|
|
755
|
-
}), () => i(
|
|
756
|
-
title:
|
|
756
|
+
}), () => i(Ae, {
|
|
757
|
+
title: t.value,
|
|
757
758
|
visible: e.visible,
|
|
758
759
|
onClose: e.onCancel
|
|
759
760
|
}, {
|
|
760
761
|
default: () => {
|
|
761
|
-
var n, a,
|
|
762
|
+
var n, a, d, m, u;
|
|
762
763
|
return [i("div", {
|
|
763
764
|
class: `${s}-form-item`
|
|
764
765
|
}, [i("label", {
|
|
765
766
|
class: `${s}-label`,
|
|
766
767
|
for: `link-desc-${o}`
|
|
767
|
-
}, [(n =
|
|
768
|
-
placeholder: (a =
|
|
768
|
+
}, [(n = l.value.linkModalTips) == null ? void 0 : n.descLabel]), i("input", {
|
|
769
|
+
placeholder: (a = l.value.linkModalTips) == null ? void 0 : a.descLabelPlaceHolder,
|
|
769
770
|
class: `${s}-input`,
|
|
770
771
|
id: `link-desc-${o}`,
|
|
771
772
|
type: "text",
|
|
772
773
|
value: r.desc,
|
|
773
|
-
onChange: (
|
|
774
|
-
r.desc =
|
|
774
|
+
onChange: (c) => {
|
|
775
|
+
r.desc = c.target.value;
|
|
775
776
|
},
|
|
776
777
|
autocomplete: "off"
|
|
777
778
|
}, null)]), i("div", {
|
|
@@ -779,14 +780,14 @@ const ml = {
|
|
|
779
780
|
}, [i("label", {
|
|
780
781
|
class: `${s}-label`,
|
|
781
782
|
for: `link-url-${o}`
|
|
782
|
-
}, [(
|
|
783
|
-
placeholder: (m =
|
|
783
|
+
}, [(d = l.value.linkModalTips) == null ? void 0 : d.urlLabel]), i("input", {
|
|
784
|
+
placeholder: (m = l.value.linkModalTips) == null ? void 0 : m.urlLabelPlaceHolder,
|
|
784
785
|
class: `${s}-input`,
|
|
785
786
|
id: `link-url-${o}`,
|
|
786
787
|
type: "text",
|
|
787
788
|
value: r.url,
|
|
788
|
-
onChange: (
|
|
789
|
-
r.url =
|
|
789
|
+
onChange: (c) => {
|
|
790
|
+
r.url = c.target.value;
|
|
790
791
|
},
|
|
791
792
|
autocomplete: "off"
|
|
792
793
|
}, null)]), i("div", {
|
|
@@ -797,7 +798,7 @@ const ml = {
|
|
|
797
798
|
onClick: () => {
|
|
798
799
|
e.onOk(r), r.desc = "", r.url = "";
|
|
799
800
|
}
|
|
800
|
-
}, [(u =
|
|
801
|
+
}, [(u = l.value.linkModalTips) == null ? void 0 : u.buttonOK])])];
|
|
801
802
|
}
|
|
802
803
|
});
|
|
803
804
|
}
|
|
@@ -820,10 +821,10 @@ const hl = {
|
|
|
820
821
|
}, vl = /* @__PURE__ */ M({
|
|
821
822
|
props: hl,
|
|
822
823
|
setup(e) {
|
|
823
|
-
var
|
|
824
|
-
const
|
|
825
|
-
let
|
|
826
|
-
const r =
|
|
824
|
+
var c, f;
|
|
825
|
+
const l = x("usedLanguageText"), o = x("editorId");
|
|
826
|
+
let t = (f = (c = A == null ? void 0 : A.editorExtensions) == null ? void 0 : c.cropper) == null ? void 0 : f.instance;
|
|
827
|
+
const r = B(), n = B(), a = B(), d = q({
|
|
827
828
|
cropperInited: !1,
|
|
828
829
|
imgSelected: !1,
|
|
829
830
|
imgSrc: "",
|
|
@@ -831,34 +832,34 @@ const hl = {
|
|
|
831
832
|
isFullscreen: !1
|
|
832
833
|
});
|
|
833
834
|
let m = null;
|
|
834
|
-
|
|
835
|
-
e.visible && !
|
|
836
|
-
if (!
|
|
837
|
-
|
|
835
|
+
S(() => e.visible, () => {
|
|
836
|
+
e.visible && !d.cropperInited && (t = t || window.Cropper, r.value.onchange = () => {
|
|
837
|
+
if (!t) {
|
|
838
|
+
k.emit(o, "errorCatcher", {
|
|
838
839
|
name: "Cropper",
|
|
839
840
|
message: "Cropper is undefined"
|
|
840
841
|
});
|
|
841
842
|
return;
|
|
842
843
|
}
|
|
843
844
|
const h = r.value.files || [];
|
|
844
|
-
if (
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
m = new
|
|
845
|
+
if (d.imgSelected = !0, (h == null ? void 0 : h.length) > 0) {
|
|
846
|
+
const p = new FileReader();
|
|
847
|
+
p.onload = (v) => {
|
|
848
|
+
d.imgSrc = v.target.result, Y(() => {
|
|
849
|
+
m = new t(n.value, {
|
|
849
850
|
viewMode: 2,
|
|
850
851
|
preview: `.${s}-clip-preview-target`
|
|
851
852
|
// aspectRatio: 16 / 9,
|
|
852
853
|
});
|
|
853
854
|
});
|
|
854
|
-
},
|
|
855
|
+
}, p.readAsDataURL(h[0]);
|
|
855
856
|
}
|
|
856
857
|
});
|
|
857
|
-
}),
|
|
858
|
+
}), S(() => [d.imgSelected], () => {
|
|
858
859
|
a.value.style = "";
|
|
859
|
-
}),
|
|
860
|
-
|
|
861
|
-
m == null || m.destroy(), a.value.style = "", n.value && (m = new
|
|
860
|
+
}), S(() => d.isFullscreen, () => {
|
|
861
|
+
Y(() => {
|
|
862
|
+
m == null || m.destroy(), a.value.style = "", n.value && (m = new t(n.value, {
|
|
862
863
|
viewMode: 2,
|
|
863
864
|
preview: `.${s}-clip-preview-target`
|
|
864
865
|
// aspectRatio: 16 / 9,
|
|
@@ -866,33 +867,33 @@ const hl = {
|
|
|
866
867
|
});
|
|
867
868
|
});
|
|
868
869
|
const u = () => {
|
|
869
|
-
m.clear(), m.destroy(), m = null, r.value.value = "",
|
|
870
|
+
m.clear(), m.destroy(), m = null, r.value.value = "", d.imgSelected = !1;
|
|
870
871
|
};
|
|
871
872
|
return () => {
|
|
872
873
|
var h;
|
|
873
|
-
return i(
|
|
874
|
+
return i(Ae, {
|
|
874
875
|
class: `${s}-modal-clip`,
|
|
875
|
-
title: (h =
|
|
876
|
+
title: (h = l.value.clipModalTips) == null ? void 0 : h.title,
|
|
876
877
|
visible: e.visible,
|
|
877
878
|
onClose: e.onCancel,
|
|
878
879
|
showAdjust: !0,
|
|
879
|
-
isFullscreen:
|
|
880
|
-
onAdjust: (
|
|
881
|
-
|
|
880
|
+
isFullscreen: d.isFullscreen,
|
|
881
|
+
onAdjust: (p) => {
|
|
882
|
+
d.isFullscreen = p;
|
|
882
883
|
},
|
|
883
884
|
width: "668px",
|
|
884
885
|
height: "421px"
|
|
885
886
|
}, {
|
|
886
887
|
default: () => {
|
|
887
|
-
var
|
|
888
|
+
var p, v;
|
|
888
889
|
return [i("div", {
|
|
889
890
|
class: `${s}-form-item ${s}-clip`
|
|
890
891
|
}, [i("div", {
|
|
891
892
|
class: `${s}-clip-main`
|
|
892
|
-
}, [
|
|
893
|
+
}, [d.imgSelected ? i("div", {
|
|
893
894
|
class: `${s}-clip-cropper`
|
|
894
895
|
}, [i("img", {
|
|
895
|
-
src:
|
|
896
|
+
src: d.imgSrc,
|
|
896
897
|
ref: n,
|
|
897
898
|
style: {
|
|
898
899
|
display: "none"
|
|
@@ -928,11 +929,11 @@ const hl = {
|
|
|
928
929
|
type: "button",
|
|
929
930
|
onClick: () => {
|
|
930
931
|
if (m) {
|
|
931
|
-
const
|
|
932
|
-
|
|
932
|
+
const b = m.getCroppedCanvas();
|
|
933
|
+
k.emit(o, "uploadImage", [ll(b.toDataURL("image/png"))], e.onOk), u();
|
|
933
934
|
}
|
|
934
935
|
}
|
|
935
|
-
}, [((
|
|
936
|
+
}, [((p = l.value.clipModalTips) == null ? void 0 : p.buttonUpload) || ((v = l.value.linkModalTips) == null ? void 0 : v.buttonOK)])]), i("input", {
|
|
936
937
|
ref: r,
|
|
937
938
|
accept: "image/*",
|
|
938
939
|
type: "file",
|
|
@@ -971,7 +972,7 @@ const hl = {
|
|
|
971
972
|
}, bl = /* @__PURE__ */ M({
|
|
972
973
|
props: pl,
|
|
973
974
|
setup(e) {
|
|
974
|
-
return () => i(
|
|
975
|
+
return () => i(xe, null, [i(gl, {
|
|
975
976
|
type: e.type,
|
|
976
977
|
visible: e.linkVisible,
|
|
977
978
|
onOk: e.onOk,
|
|
@@ -986,9 +987,9 @@ const hl = {
|
|
|
986
987
|
name: "MDEditorToolbar",
|
|
987
988
|
props: al,
|
|
988
989
|
setup(e) {
|
|
989
|
-
const
|
|
990
|
-
fullscreenHandler:
|
|
991
|
-
} = cl(e), r = `${
|
|
990
|
+
const l = x("editorId"), o = x("usedLanguageText"), {
|
|
991
|
+
fullscreenHandler: t
|
|
992
|
+
} = cl(e), r = `${l}-toolbar-wrapper`, n = q({
|
|
992
993
|
title: !1,
|
|
993
994
|
catalog: !1,
|
|
994
995
|
// 图片上传下拉
|
|
@@ -998,40 +999,40 @@ const hl = {
|
|
|
998
999
|
// mermaid
|
|
999
1000
|
mermaid: !1,
|
|
1000
1001
|
katex: !1
|
|
1001
|
-
}), a = (
|
|
1002
|
-
|
|
1003
|
-
},
|
|
1002
|
+
}), a = (p, v) => {
|
|
1003
|
+
k.emit(l, "replace", p, v);
|
|
1004
|
+
}, d = q({
|
|
1004
1005
|
type: "link",
|
|
1005
1006
|
linkVisible: !1,
|
|
1006
1007
|
clipVisible: !1
|
|
1007
|
-
}), m =
|
|
1008
|
-
|
|
1009
|
-
|
|
1008
|
+
}), m = B();
|
|
1009
|
+
H(() => {
|
|
1010
|
+
k.on(l, {
|
|
1010
1011
|
name: "openModals",
|
|
1011
|
-
callback(
|
|
1012
|
-
|
|
1012
|
+
callback(p) {
|
|
1013
|
+
d.type = p, d.linkVisible = !0;
|
|
1013
1014
|
}
|
|
1014
1015
|
});
|
|
1015
1016
|
});
|
|
1016
|
-
const u =
|
|
1017
|
-
const
|
|
1018
|
-
return [
|
|
1019
|
-
}),
|
|
1020
|
-
|
|
1017
|
+
const u = U(() => {
|
|
1018
|
+
const p = e.toolbars.filter((C) => !e.toolbarsExclude.includes(C)), v = p.indexOf("="), b = v === -1 ? p : p.slice(0, v + 1), y = v === -1 ? [] : p.slice(v, Number.MAX_SAFE_INTEGER);
|
|
1019
|
+
return [b, y];
|
|
1020
|
+
}), c = B(), f = () => {
|
|
1021
|
+
k.emit(l, "uploadImage", Array.from(c.value.files || [])), c.value.value = "";
|
|
1021
1022
|
};
|
|
1022
|
-
|
|
1023
|
-
|
|
1023
|
+
H(() => {
|
|
1024
|
+
c.value.addEventListener("change", f);
|
|
1024
1025
|
});
|
|
1025
|
-
const h = (
|
|
1026
|
-
var
|
|
1027
|
-
if (
|
|
1028
|
-
switch (
|
|
1026
|
+
const h = (p) => {
|
|
1027
|
+
var v, b, y, C, $, T, I, w, F, j, R, P, _, N, D, Q, z, ue, re, ee, X, ie, te, O, G, ae, me, Ie, He, Fe, Me, Be, Re, je, Pe, De, Oe, _e, Ne, Ve, Ue, qe, We;
|
|
1028
|
+
if (bt.includes(p))
|
|
1029
|
+
switch (p) {
|
|
1029
1030
|
case "-":
|
|
1030
1031
|
return i(Yt, null, null);
|
|
1031
1032
|
case "bold":
|
|
1032
1033
|
return i("div", {
|
|
1033
1034
|
class: `${s}-toolbar-item`,
|
|
1034
|
-
title: (
|
|
1035
|
+
title: (v = o.value.toolbarTips) == null ? void 0 : v.bold,
|
|
1035
1036
|
onClick: () => {
|
|
1036
1037
|
a("bold");
|
|
1037
1038
|
}
|
|
@@ -1044,7 +1045,7 @@ const hl = {
|
|
|
1044
1045
|
case "underline":
|
|
1045
1046
|
return i("div", {
|
|
1046
1047
|
class: `${s}-toolbar-item`,
|
|
1047
|
-
title: (
|
|
1048
|
+
title: (b = o.value.toolbarTips) == null ? void 0 : b.underline,
|
|
1048
1049
|
onClick: () => {
|
|
1049
1050
|
a("underline");
|
|
1050
1051
|
}
|
|
@@ -1057,7 +1058,7 @@ const hl = {
|
|
|
1057
1058
|
case "italic":
|
|
1058
1059
|
return i("div", {
|
|
1059
1060
|
class: `${s}-toolbar-item`,
|
|
1060
|
-
title: (
|
|
1061
|
+
title: (y = o.value.toolbarTips) == null ? void 0 : y.italic,
|
|
1061
1062
|
onClick: () => {
|
|
1062
1063
|
a("italic");
|
|
1063
1064
|
}
|
|
@@ -1070,7 +1071,7 @@ const hl = {
|
|
|
1070
1071
|
case "strikeThrough":
|
|
1071
1072
|
return i("div", {
|
|
1072
1073
|
class: `${s}-toolbar-item`,
|
|
1073
|
-
title: (
|
|
1074
|
+
title: (C = o.value.toolbarTips) == null ? void 0 : C.strikeThrough,
|
|
1074
1075
|
onClick: () => {
|
|
1075
1076
|
a("strikeThrough");
|
|
1076
1077
|
}
|
|
@@ -1081,7 +1082,7 @@ const hl = {
|
|
|
1081
1082
|
"xlink:href": "#md-editor-icon-strike-through"
|
|
1082
1083
|
}, null)])]);
|
|
1083
1084
|
case "title":
|
|
1084
|
-
return i(
|
|
1085
|
+
return i(oe, {
|
|
1085
1086
|
relative: `#${r}`,
|
|
1086
1087
|
visible: n.title,
|
|
1087
1088
|
onChange: (E) => {
|
|
@@ -1102,27 +1103,27 @@ const hl = {
|
|
|
1102
1103
|
onClick: () => {
|
|
1103
1104
|
a("h2");
|
|
1104
1105
|
}
|
|
1105
|
-
}, [(
|
|
1106
|
+
}, [(T = o.value.titleItem) == null ? void 0 : T.h2]), i("li", {
|
|
1106
1107
|
class: `${s}-menu-item`,
|
|
1107
1108
|
onClick: () => {
|
|
1108
1109
|
a("h3");
|
|
1109
1110
|
}
|
|
1110
|
-
}, [(
|
|
1111
|
+
}, [(I = o.value.titleItem) == null ? void 0 : I.h3]), i("li", {
|
|
1111
1112
|
class: `${s}-menu-item`,
|
|
1112
1113
|
onClick: () => {
|
|
1113
1114
|
a("h4");
|
|
1114
1115
|
}
|
|
1115
|
-
}, [(
|
|
1116
|
+
}, [(w = o.value.titleItem) == null ? void 0 : w.h4]), i("li", {
|
|
1116
1117
|
class: `${s}-menu-item`,
|
|
1117
1118
|
onClick: () => {
|
|
1118
1119
|
a("h5");
|
|
1119
1120
|
}
|
|
1120
|
-
}, [(
|
|
1121
|
+
}, [(F = o.value.titleItem) == null ? void 0 : F.h5]), i("li", {
|
|
1121
1122
|
class: `${s}-menu-item`,
|
|
1122
1123
|
onClick: () => {
|
|
1123
1124
|
a("h6");
|
|
1124
1125
|
}
|
|
1125
|
-
}, [(
|
|
1126
|
+
}, [(j = o.value.titleItem) == null ? void 0 : j.h6])])
|
|
1126
1127
|
}, {
|
|
1127
1128
|
default: () => {
|
|
1128
1129
|
var E;
|
|
@@ -1140,7 +1141,7 @@ const hl = {
|
|
|
1140
1141
|
case "sub":
|
|
1141
1142
|
return i("div", {
|
|
1142
1143
|
class: `${s}-toolbar-item`,
|
|
1143
|
-
title: (
|
|
1144
|
+
title: (R = o.value.toolbarTips) == null ? void 0 : R.sub,
|
|
1144
1145
|
onClick: () => {
|
|
1145
1146
|
a("sub");
|
|
1146
1147
|
}
|
|
@@ -1153,7 +1154,7 @@ const hl = {
|
|
|
1153
1154
|
case "sup":
|
|
1154
1155
|
return i("div", {
|
|
1155
1156
|
class: `${s}-toolbar-item`,
|
|
1156
|
-
title: (
|
|
1157
|
+
title: (P = o.value.toolbarTips) == null ? void 0 : P.sup,
|
|
1157
1158
|
onClick: () => {
|
|
1158
1159
|
a("sup");
|
|
1159
1160
|
}
|
|
@@ -1166,7 +1167,7 @@ const hl = {
|
|
|
1166
1167
|
case "quote":
|
|
1167
1168
|
return i("div", {
|
|
1168
1169
|
class: `${s}-toolbar-item`,
|
|
1169
|
-
title: (
|
|
1170
|
+
title: (_ = o.value.toolbarTips) == null ? void 0 : _.quote,
|
|
1170
1171
|
onClick: () => {
|
|
1171
1172
|
a("quote");
|
|
1172
1173
|
}
|
|
@@ -1179,7 +1180,7 @@ const hl = {
|
|
|
1179
1180
|
case "unorderedList":
|
|
1180
1181
|
return i("div", {
|
|
1181
1182
|
class: `${s}-toolbar-item`,
|
|
1182
|
-
title: (
|
|
1183
|
+
title: (N = o.value.toolbarTips) == null ? void 0 : N.unorderedList,
|
|
1183
1184
|
onClick: () => {
|
|
1184
1185
|
a("unorderedList");
|
|
1185
1186
|
}
|
|
@@ -1192,7 +1193,7 @@ const hl = {
|
|
|
1192
1193
|
case "orderedList":
|
|
1193
1194
|
return i("div", {
|
|
1194
1195
|
class: `${s}-toolbar-item`,
|
|
1195
|
-
title: (
|
|
1196
|
+
title: (D = o.value.toolbarTips) == null ? void 0 : D.orderedList,
|
|
1196
1197
|
onClick: () => {
|
|
1197
1198
|
a("orderedList");
|
|
1198
1199
|
}
|
|
@@ -1205,7 +1206,7 @@ const hl = {
|
|
|
1205
1206
|
case "task":
|
|
1206
1207
|
return i("div", {
|
|
1207
1208
|
class: `${s}-toolbar-item`,
|
|
1208
|
-
title: (
|
|
1209
|
+
title: (Q = o.value.toolbarTips) == null ? void 0 : Q.task,
|
|
1209
1210
|
onClick: () => {
|
|
1210
1211
|
a("task");
|
|
1211
1212
|
}
|
|
@@ -1218,7 +1219,7 @@ const hl = {
|
|
|
1218
1219
|
case "codeRow":
|
|
1219
1220
|
return i("div", {
|
|
1220
1221
|
class: `${s}-toolbar-item`,
|
|
1221
|
-
title: (
|
|
1222
|
+
title: (z = o.value.toolbarTips) == null ? void 0 : z.codeRow,
|
|
1222
1223
|
onClick: () => {
|
|
1223
1224
|
a("codeRow");
|
|
1224
1225
|
}
|
|
@@ -1231,7 +1232,7 @@ const hl = {
|
|
|
1231
1232
|
case "code":
|
|
1232
1233
|
return i("div", {
|
|
1233
1234
|
class: `${s}-toolbar-item`,
|
|
1234
|
-
title: (
|
|
1235
|
+
title: (ue = o.value.toolbarTips) == null ? void 0 : ue.code,
|
|
1235
1236
|
onClick: () => {
|
|
1236
1237
|
a("code");
|
|
1237
1238
|
}
|
|
@@ -1244,9 +1245,9 @@ const hl = {
|
|
|
1244
1245
|
case "link":
|
|
1245
1246
|
return i("div", {
|
|
1246
1247
|
class: `${s}-toolbar-item`,
|
|
1247
|
-
title: (
|
|
1248
|
+
title: (re = o.value.toolbarTips) == null ? void 0 : re.link,
|
|
1248
1249
|
onClick: () => {
|
|
1249
|
-
|
|
1250
|
+
d.type = "link", d.linkVisible = !0;
|
|
1250
1251
|
}
|
|
1251
1252
|
}, [i("svg", {
|
|
1252
1253
|
class: `${s}-icon`,
|
|
@@ -1257,16 +1258,16 @@ const hl = {
|
|
|
1257
1258
|
case "image":
|
|
1258
1259
|
return e.noUploadImg ? i("div", {
|
|
1259
1260
|
class: `${s}-toolbar-item`,
|
|
1260
|
-
title: (
|
|
1261
|
+
title: (ee = o.value.toolbarTips) == null ? void 0 : ee.image,
|
|
1261
1262
|
onClick: () => {
|
|
1262
|
-
|
|
1263
|
+
d.type = "image", d.linkVisible = !0;
|
|
1263
1264
|
}
|
|
1264
1265
|
}, [i("svg", {
|
|
1265
1266
|
class: `${s}-icon`,
|
|
1266
1267
|
"aria-hidden": "true"
|
|
1267
1268
|
}, [i("use", {
|
|
1268
1269
|
"xlink:href": "#md-editor-icon-image"
|
|
1269
|
-
}, null)])]) : i(
|
|
1270
|
+
}, null)])]) : i(oe, {
|
|
1270
1271
|
relative: `#${r}`,
|
|
1271
1272
|
visible: n.image,
|
|
1272
1273
|
onChange: (E) => {
|
|
@@ -1280,19 +1281,19 @@ const hl = {
|
|
|
1280
1281
|
}, [i("li", {
|
|
1281
1282
|
class: `${s}-menu-item`,
|
|
1282
1283
|
onClick: () => {
|
|
1283
|
-
|
|
1284
|
+
d.type = "image", d.linkVisible = !0;
|
|
1284
1285
|
}
|
|
1285
|
-
}, [(
|
|
1286
|
+
}, [(X = o.value.imgTitleItem) == null ? void 0 : X.link]), i("li", {
|
|
1286
1287
|
class: `${s}-menu-item`,
|
|
1287
1288
|
onClick: () => {
|
|
1288
|
-
|
|
1289
|
+
c.value.click();
|
|
1289
1290
|
}
|
|
1290
|
-
}, [(
|
|
1291
|
+
}, [(ie = o.value.imgTitleItem) == null ? void 0 : ie.upload]), i("li", {
|
|
1291
1292
|
class: `${s}-menu-item`,
|
|
1292
1293
|
onClick: () => {
|
|
1293
|
-
|
|
1294
|
+
d.clipVisible = !0;
|
|
1294
1295
|
}
|
|
1295
|
-
}, [(
|
|
1296
|
+
}, [(te = o.value.imgTitleItem) == null ? void 0 : te.clip2upload])])
|
|
1296
1297
|
}, {
|
|
1297
1298
|
default: () => {
|
|
1298
1299
|
var E;
|
|
@@ -1308,7 +1309,7 @@ const hl = {
|
|
|
1308
1309
|
}
|
|
1309
1310
|
});
|
|
1310
1311
|
case "table":
|
|
1311
|
-
return i(
|
|
1312
|
+
return i(oe, {
|
|
1312
1313
|
relative: `#${r}`,
|
|
1313
1314
|
visible: n.table,
|
|
1314
1315
|
onChange: (E) => {
|
|
@@ -1340,9 +1341,9 @@ const hl = {
|
|
|
1340
1341
|
case "revoke":
|
|
1341
1342
|
return i("div", {
|
|
1342
1343
|
class: `${s}-toolbar-item`,
|
|
1343
|
-
title: (
|
|
1344
|
+
title: (O = o.value.toolbarTips) == null ? void 0 : O.revoke,
|
|
1344
1345
|
onClick: () => {
|
|
1345
|
-
|
|
1346
|
+
k.emit(l, "ctrlZ");
|
|
1346
1347
|
}
|
|
1347
1348
|
}, [i("svg", {
|
|
1348
1349
|
class: `${s}-icon`,
|
|
@@ -1353,9 +1354,9 @@ const hl = {
|
|
|
1353
1354
|
case "next":
|
|
1354
1355
|
return i("div", {
|
|
1355
1356
|
class: `${s}-toolbar-item`,
|
|
1356
|
-
title: (
|
|
1357
|
+
title: (G = o.value.toolbarTips) == null ? void 0 : G.next,
|
|
1357
1358
|
onClick: () => {
|
|
1358
|
-
|
|
1359
|
+
k.emit(l, "ctrlShiftZ");
|
|
1359
1360
|
}
|
|
1360
1361
|
}, [i("svg", {
|
|
1361
1362
|
class: `${s}-icon`,
|
|
@@ -1366,9 +1367,9 @@ const hl = {
|
|
|
1366
1367
|
case "save":
|
|
1367
1368
|
return i("div", {
|
|
1368
1369
|
class: `${s}-toolbar-item`,
|
|
1369
|
-
title: (
|
|
1370
|
+
title: (ae = o.value.toolbarTips) == null ? void 0 : ae.save,
|
|
1370
1371
|
onClick: () => {
|
|
1371
|
-
|
|
1372
|
+
k.emit(l, pe);
|
|
1372
1373
|
}
|
|
1373
1374
|
}, [i("svg", {
|
|
1374
1375
|
class: `${s}-icon`,
|
|
@@ -1379,7 +1380,7 @@ const hl = {
|
|
|
1379
1380
|
case "prettier":
|
|
1380
1381
|
return e.noPrettier ? "" : i("div", {
|
|
1381
1382
|
class: `${s}-toolbar-item`,
|
|
1382
|
-
title: (
|
|
1383
|
+
title: (me = o.value.toolbarTips) == null ? void 0 : me.prettier,
|
|
1383
1384
|
onClick: () => {
|
|
1384
1385
|
a("prettier");
|
|
1385
1386
|
}
|
|
@@ -1392,7 +1393,7 @@ const hl = {
|
|
|
1392
1393
|
case "pageFullscreen":
|
|
1393
1394
|
return !e.setting.fullscreen && i("div", {
|
|
1394
1395
|
class: `${s}-toolbar-item`,
|
|
1395
|
-
title: (
|
|
1396
|
+
title: (Ie = o.value.toolbarTips) == null ? void 0 : Ie.pageFullscreen,
|
|
1396
1397
|
onClick: () => {
|
|
1397
1398
|
e.updateSetting("pageFullscreen");
|
|
1398
1399
|
}
|
|
@@ -1405,9 +1406,9 @@ const hl = {
|
|
|
1405
1406
|
case "fullscreen":
|
|
1406
1407
|
return i("div", {
|
|
1407
1408
|
class: `${s}-toolbar-item`,
|
|
1408
|
-
title: (
|
|
1409
|
+
title: (He = o.value.toolbarTips) == null ? void 0 : He.fullscreen,
|
|
1409
1410
|
onClick: () => {
|
|
1410
|
-
|
|
1411
|
+
t();
|
|
1411
1412
|
}
|
|
1412
1413
|
}, [i("svg", {
|
|
1413
1414
|
class: `${s}-icon`,
|
|
@@ -1418,7 +1419,7 @@ const hl = {
|
|
|
1418
1419
|
case "preview":
|
|
1419
1420
|
return i("div", {
|
|
1420
1421
|
class: `${s}-toolbar-item`,
|
|
1421
|
-
title: (
|
|
1422
|
+
title: (Fe = o.value.toolbarTips) == null ? void 0 : Fe.preview,
|
|
1422
1423
|
onClick: () => {
|
|
1423
1424
|
e.updateSetting("preview");
|
|
1424
1425
|
}
|
|
@@ -1431,7 +1432,7 @@ const hl = {
|
|
|
1431
1432
|
case "htmlPreview":
|
|
1432
1433
|
return i("div", {
|
|
1433
1434
|
class: `${s}-toolbar-item`,
|
|
1434
|
-
title: (
|
|
1435
|
+
title: (Me = o.value.toolbarTips) == null ? void 0 : Me.htmlPreview,
|
|
1435
1436
|
onClick: () => {
|
|
1436
1437
|
e.updateSetting("htmlPreview");
|
|
1437
1438
|
}
|
|
@@ -1444,9 +1445,9 @@ const hl = {
|
|
|
1444
1445
|
case "catalog":
|
|
1445
1446
|
return i("div", {
|
|
1446
1447
|
class: `${s}-toolbar-item`,
|
|
1447
|
-
title: (
|
|
1448
|
+
title: (Be = o.value.toolbarTips) == null ? void 0 : Be.catalog,
|
|
1448
1449
|
onClick: () => {
|
|
1449
|
-
|
|
1450
|
+
k.emit(l, Le);
|
|
1450
1451
|
},
|
|
1451
1452
|
key: "bar-catalog"
|
|
1452
1453
|
}, [i("svg", {
|
|
@@ -1458,7 +1459,7 @@ const hl = {
|
|
|
1458
1459
|
case "github":
|
|
1459
1460
|
return i("div", {
|
|
1460
1461
|
class: `${s}-toolbar-item`,
|
|
1461
|
-
title: (
|
|
1462
|
+
title: (Re = o.value.toolbarTips) == null ? void 0 : Re.github,
|
|
1462
1463
|
onClick: () => tl("https://github.com/imzbf/md-editor-v3")
|
|
1463
1464
|
}, [i("svg", {
|
|
1464
1465
|
class: `${s}-icon`,
|
|
@@ -1467,7 +1468,7 @@ const hl = {
|
|
|
1467
1468
|
"xlink:href": "#md-editor-icon-github"
|
|
1468
1469
|
}, null)])]);
|
|
1469
1470
|
case "mermaid":
|
|
1470
|
-
return i(
|
|
1471
|
+
return i(oe, {
|
|
1471
1472
|
relative: `#${r}`,
|
|
1472
1473
|
visible: n.mermaid,
|
|
1473
1474
|
onChange: (E) => {
|
|
@@ -1483,12 +1484,12 @@ const hl = {
|
|
|
1483
1484
|
onClick: () => {
|
|
1484
1485
|
a("flow");
|
|
1485
1486
|
}
|
|
1486
|
-
}, [(
|
|
1487
|
+
}, [(je = o.value.mermaid) == null ? void 0 : je.flow]), i("li", {
|
|
1487
1488
|
class: `${s}-menu-item`,
|
|
1488
1489
|
onClick: () => {
|
|
1489
1490
|
a("sequence");
|
|
1490
1491
|
}
|
|
1491
|
-
}, [(
|
|
1492
|
+
}, [(Pe = o.value.mermaid) == null ? void 0 : Pe.sequence]), i("li", {
|
|
1492
1493
|
class: `${s}-menu-item`,
|
|
1493
1494
|
onClick: () => {
|
|
1494
1495
|
a("gantt");
|
|
@@ -1498,7 +1499,7 @@ const hl = {
|
|
|
1498
1499
|
onClick: () => {
|
|
1499
1500
|
a("class");
|
|
1500
1501
|
}
|
|
1501
|
-
}, [(
|
|
1502
|
+
}, [(Oe = o.value.mermaid) == null ? void 0 : Oe.class]), i("li", {
|
|
1502
1503
|
class: `${s}-menu-item`,
|
|
1503
1504
|
onClick: () => {
|
|
1504
1505
|
a("state");
|
|
@@ -1508,17 +1509,17 @@ const hl = {
|
|
|
1508
1509
|
onClick: () => {
|
|
1509
1510
|
a("pie");
|
|
1510
1511
|
}
|
|
1511
|
-
}, [(
|
|
1512
|
+
}, [(Ne = o.value.mermaid) == null ? void 0 : Ne.pie]), i("li", {
|
|
1512
1513
|
class: `${s}-menu-item`,
|
|
1513
1514
|
onClick: () => {
|
|
1514
1515
|
a("relationship");
|
|
1515
1516
|
}
|
|
1516
|
-
}, [(
|
|
1517
|
+
}, [(Ve = o.value.mermaid) == null ? void 0 : Ve.relationship]), i("li", {
|
|
1517
1518
|
class: `${s}-menu-item`,
|
|
1518
1519
|
onClick: () => {
|
|
1519
1520
|
a("journey");
|
|
1520
1521
|
}
|
|
1521
|
-
}, [(
|
|
1522
|
+
}, [(Ue = o.value.mermaid) == null ? void 0 : Ue.journey])]),
|
|
1522
1523
|
key: "bar-mermaid"
|
|
1523
1524
|
}, {
|
|
1524
1525
|
default: () => {
|
|
@@ -1535,7 +1536,7 @@ const hl = {
|
|
|
1535
1536
|
}
|
|
1536
1537
|
});
|
|
1537
1538
|
case "katex":
|
|
1538
|
-
return i(
|
|
1539
|
+
return i(oe, {
|
|
1539
1540
|
relative: `#${r}`,
|
|
1540
1541
|
visible: n.katex,
|
|
1541
1542
|
onChange: (E) => {
|
|
@@ -1551,12 +1552,12 @@ const hl = {
|
|
|
1551
1552
|
onClick: () => {
|
|
1552
1553
|
a("katexInline");
|
|
1553
1554
|
}
|
|
1554
|
-
}, [(
|
|
1555
|
+
}, [(qe = o.value.katex) == null ? void 0 : qe.inline]), i("li", {
|
|
1555
1556
|
class: `${s}-menu-item`,
|
|
1556
1557
|
onClick: () => {
|
|
1557
1558
|
a("katexBlock");
|
|
1558
1559
|
}
|
|
1559
|
-
}, [(
|
|
1560
|
+
}, [(We = o.value.katex) == null ? void 0 : We.block])]),
|
|
1560
1561
|
key: "bar-katex"
|
|
1561
1562
|
}, {
|
|
1562
1563
|
default: () => {
|
|
@@ -1574,11 +1575,11 @@ const hl = {
|
|
|
1574
1575
|
});
|
|
1575
1576
|
}
|
|
1576
1577
|
else
|
|
1577
|
-
return e.defToolbars instanceof Array ? e.defToolbars[
|
|
1578
|
+
return e.defToolbars instanceof Array ? e.defToolbars[p] || "" : e.defToolbars && e.defToolbars.children instanceof Array && e.defToolbars.children[p] || "";
|
|
1578
1579
|
};
|
|
1579
1580
|
return () => {
|
|
1580
|
-
const
|
|
1581
|
-
return i(
|
|
1581
|
+
const p = u.value[0].map((b) => h(b)), v = u.value[1].map((b) => h(b));
|
|
1582
|
+
return i(xe, null, [e.toolbars.length > 0 && i("div", {
|
|
1582
1583
|
class: `${s}-toolbar-wrapper`,
|
|
1583
1584
|
id: r
|
|
1584
1585
|
}, [i("div", {
|
|
@@ -1586,10 +1587,10 @@ const hl = {
|
|
|
1586
1587
|
}, [i("div", {
|
|
1587
1588
|
class: `${s}-toolbar-left`,
|
|
1588
1589
|
ref: m
|
|
1589
|
-
}, [
|
|
1590
|
+
}, [p]), i("div", {
|
|
1590
1591
|
class: `${s}-toolbar-right`
|
|
1591
|
-
}, [
|
|
1592
|
-
ref:
|
|
1592
|
+
}, [v])])]), i("input", {
|
|
1593
|
+
ref: c,
|
|
1593
1594
|
accept: "image/*",
|
|
1594
1595
|
type: "file",
|
|
1595
1596
|
multiple: !0,
|
|
@@ -1597,329 +1598,302 @@ const hl = {
|
|
|
1597
1598
|
display: "none"
|
|
1598
1599
|
}
|
|
1599
1600
|
}, null), i(bl, {
|
|
1600
|
-
linkVisible:
|
|
1601
|
-
clipVisible:
|
|
1602
|
-
type:
|
|
1601
|
+
linkVisible: d.linkVisible,
|
|
1602
|
+
clipVisible: d.clipVisible,
|
|
1603
|
+
type: d.type,
|
|
1603
1604
|
onCancel: () => {
|
|
1604
|
-
|
|
1605
|
+
d.linkVisible = !1, d.clipVisible = !1;
|
|
1605
1606
|
},
|
|
1606
|
-
onOk: (
|
|
1607
|
-
|
|
1608
|
-
desc:
|
|
1609
|
-
url:
|
|
1610
|
-
}),
|
|
1607
|
+
onOk: (b) => {
|
|
1608
|
+
b && a(d.type, {
|
|
1609
|
+
desc: b.desc,
|
|
1610
|
+
url: b.url
|
|
1611
|
+
}), d.linkVisible = !1, d.clipVisible = !1;
|
|
1611
1612
|
}
|
|
1612
1613
|
}, null)]);
|
|
1613
1614
|
};
|
|
1614
1615
|
}
|
|
1615
|
-
}),
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
// behavior: 'smooth'
|
|
1635
|
-
});
|
|
1636
|
-
}
|
|
1616
|
+
}), lt = (e, l, o) => {
|
|
1617
|
+
let t = e.scrollTop;
|
|
1618
|
+
const r = () => {
|
|
1619
|
+
const n = l - t;
|
|
1620
|
+
t = t + n / 5, Math.abs(n) < 1 ? (e.scrollTo(0, l), o && setTimeout(o, 100)) : (e.scrollTo(0, t), requestAnimationFrame(r));
|
|
1621
|
+
};
|
|
1622
|
+
r();
|
|
1623
|
+
}, yl = (e, l) => {
|
|
1624
|
+
const o = ve(() => {
|
|
1625
|
+
e.removeEventListener("scroll", t), e.addEventListener("scroll", t), l.removeEventListener("scroll", t), l.addEventListener("scroll", t);
|
|
1626
|
+
}, 50), t = (r) => {
|
|
1627
|
+
const n = e.clientHeight, a = l.clientHeight, d = e.scrollHeight, m = l.scrollHeight, u = (d - n) / (m - a);
|
|
1628
|
+
r.target === e ? (l.removeEventListener("scroll", t), l.scrollTo({
|
|
1629
|
+
top: e.scrollTop / u
|
|
1630
|
+
// behavior: 'smooth'
|
|
1631
|
+
}), o()) : (e.removeEventListener("scroll", t), e.scrollTo({
|
|
1632
|
+
top: l.scrollTop * u
|
|
1633
|
+
// behavior: 'smooth'
|
|
1634
|
+
}), o());
|
|
1637
1635
|
};
|
|
1638
1636
|
return [
|
|
1639
1637
|
() => {
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
})
|
|
1643
|
-
passive: !0
|
|
1644
|
-
}), e.dispatchEvent(new Event("scroll"));
|
|
1638
|
+
o().finally(() => {
|
|
1639
|
+
e.dispatchEvent(new Event("scroll"));
|
|
1640
|
+
});
|
|
1645
1641
|
},
|
|
1646
1642
|
() => {
|
|
1647
|
-
e.removeEventListener("scroll",
|
|
1643
|
+
e.removeEventListener("scroll", t), l.removeEventListener("scroll", t);
|
|
1648
1644
|
}
|
|
1649
1645
|
];
|
|
1650
|
-
}, Cl = (e,
|
|
1651
|
-
const { view:
|
|
1652
|
-
let
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
),
|
|
1658
|
-
|
|
1659
|
-
let
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
const $ = {
|
|
1664
|
-
lineHeight: k.offsetHeight,
|
|
1665
|
-
scrollHeight: p
|
|
1666
|
-
};
|
|
1667
|
-
n.push($);
|
|
1668
|
-
}), k.remove();
|
|
1669
|
-
};
|
|
1670
|
-
let c = !1, m = !1;
|
|
1671
|
-
const u = de((d) => {
|
|
1672
|
-
var b, k;
|
|
1673
|
-
const f = r.lineBlockAtHeight(r.scrollDOM.scrollTop), h = r.state.doc.lineAt(f.from), v = Array.from(t.children[0].children).filter(
|
|
1674
|
-
(p) => p.hasAttribute("data-line")
|
|
1675
|
-
);
|
|
1676
|
-
if (d.target === e) {
|
|
1677
|
-
if (m) {
|
|
1678
|
-
m = !1;
|
|
1679
|
-
return;
|
|
1680
|
-
}
|
|
1681
|
-
if (e.scrollTop + e.clientHeight >= e.scrollHeight) {
|
|
1682
|
-
c = !0, t.scrollTo({
|
|
1683
|
-
top: t.scrollHeight - t.clientHeight
|
|
1684
|
-
});
|
|
1685
|
-
return;
|
|
1686
|
-
}
|
|
1687
|
-
const { number: p } = h;
|
|
1688
|
-
let y = (b = t.firstElementChild) == null ? void 0 : b.firstElementChild, $ = 1, w = v.length === 0 ? (k = t.firstElementChild) == null ? void 0 : k.lastElementChild : v[0], L = v.length === 0 ? 0 : Number(v[0].dataset.line);
|
|
1689
|
-
for (let R = 0; R < v.length; R++) {
|
|
1690
|
-
const Z = Number(v[R].dataset.line) + 1, K = Number(
|
|
1691
|
-
R + 1 >= v.length ? -2 : v[R + 1].dataset.line
|
|
1692
|
-
);
|
|
1693
|
-
if (p >= Z && p <= K) {
|
|
1694
|
-
y = v[R], w = v[R + 1], $ = Z, L = K;
|
|
1695
|
-
break;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
if (!y)
|
|
1699
|
-
return;
|
|
1700
|
-
const S = (r.scrollDOM.scrollTop - n[$ - 1].scrollHeight + n[$ - 1].lineHeight) / (n[L - 1].scrollHeight - n[$ - 1].scrollHeight + n[$ - 1].lineHeight), { marginTop: j } = getComputedStyle(y), B = y.offsetTop - parseFloat(j), { marginTop: q } = getComputedStyle(w), X = w.offsetTop - parseFloat(q) - B;
|
|
1701
|
-
c = !0, t.scrollTo({
|
|
1702
|
-
top: B + X * S
|
|
1646
|
+
}, Cl = (e, l, o) => {
|
|
1647
|
+
const { view: t } = o, r = (f) => t.lineBlockAt(t.state.doc.line(f).from).top, n = (f) => t.lineBlockAt(t.state.doc.line(f).from).height;
|
|
1648
|
+
let a = [];
|
|
1649
|
+
const d = () => {
|
|
1650
|
+
a = [];
|
|
1651
|
+
const f = Array.from(l.querySelectorAll("[data-line]")).map(
|
|
1652
|
+
(b) => Number(b.dataset.line) + 1
|
|
1653
|
+
), { lines: h } = t.state.doc;
|
|
1654
|
+
let p = 1, v = f.shift() ?? h;
|
|
1655
|
+
for (let b = 1; b <= h; b++)
|
|
1656
|
+
b === v && (p = b, v = f.shift() || h + 1), a.push({
|
|
1657
|
+
start: p,
|
|
1658
|
+
end: v - 1
|
|
1703
1659
|
});
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
m
|
|
1716
|
-
|
|
1660
|
+
};
|
|
1661
|
+
let m = 0, u = 0;
|
|
1662
|
+
const c = (f) => {
|
|
1663
|
+
var v, b, y, C, $, T, I;
|
|
1664
|
+
if (!((v = l.firstElementChild) != null && v.firstElementChild))
|
|
1665
|
+
return;
|
|
1666
|
+
const h = t.lineBlockAtHeight(t.scrollDOM.scrollTop), { number: p } = t.state.doc.lineAt(h.from);
|
|
1667
|
+
if (!(p > a.length) && !(t.state.doc.lines < a[a.length - 1].end))
|
|
1668
|
+
if (f.target === e) {
|
|
1669
|
+
if (u !== 0)
|
|
1670
|
+
return;
|
|
1671
|
+
m++;
|
|
1672
|
+
const w = a[p - 1], F = r(w.end) + n(w.end);
|
|
1673
|
+
let j = 0;
|
|
1674
|
+
const R = r(w.start), P = l.querySelector(`[data-line="${w.start - 1}"]`) || ((b = l.firstElementChild) == null ? void 0 : b.firstElementChild), _ = l.querySelector(`[data-line="${w.end}"]`) || ((y = l.lastElementChild) == null ? void 0 : y.lastElementChild);
|
|
1675
|
+
let N = 0, D = 0;
|
|
1676
|
+
R === 0 ? (j = (t.scrollDOM.scrollTop - R) / (F - R), N = _.offsetTop) : F > t.scrollDOM.scrollHeight - t.scrollDOM.clientHeight ? (j = (t.scrollDOM.scrollTop - R) / (t.scrollDOM.scrollHeight - t.scrollDOM.clientHeight - R), D = P.offsetTop, N = l.scrollHeight - l.clientHeight - D + 10) : (j = (t.scrollDOM.scrollTop - R) / (F - R), D = P.offsetTop, N = _.offsetTop - D);
|
|
1677
|
+
const Q = D - 10 + N * j;
|
|
1678
|
+
lt(l, Q, () => {
|
|
1679
|
+
m--;
|
|
1717
1680
|
});
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
return;
|
|
1733
|
-
let L, S;
|
|
1734
|
-
for (; ; ) {
|
|
1735
|
-
const P = v.indexOf(w), V = v[P + 1], te = ie(w);
|
|
1736
|
-
if (te > p) {
|
|
1737
|
-
if (P === 0) {
|
|
1738
|
-
L = w, S = V;
|
|
1681
|
+
} else {
|
|
1682
|
+
if (m !== 0)
|
|
1683
|
+
return;
|
|
1684
|
+
u++;
|
|
1685
|
+
const w = Array.from(
|
|
1686
|
+
l.querySelectorAll("[data-line]")
|
|
1687
|
+
), F = l.scrollTop, j = l.scrollHeight;
|
|
1688
|
+
let R = w.length === 0 ? 1 : Math.ceil(
|
|
1689
|
+
Number(w[w.length - 1].dataset.line) * (F / j)
|
|
1690
|
+
), P = (C = l.firstElementChild) == null ? void 0 : C.firstElementChild;
|
|
1691
|
+
for (let O = R; O >= 0; O--) {
|
|
1692
|
+
const G = l.querySelector(`[data-line="${O}"]`);
|
|
1693
|
+
if (G) {
|
|
1694
|
+
P = G, R = O;
|
|
1739
1695
|
break;
|
|
1740
1696
|
}
|
|
1741
|
-
w = v[P - 1];
|
|
1742
|
-
continue;
|
|
1743
1697
|
}
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1698
|
+
let _ = ($ = l.firstElementChild) == null ? void 0 : $.firstElementChild, N = (T = l.firstElementChild) == null ? void 0 : T.lastElementChild;
|
|
1699
|
+
for (; w.length > 0; ) {
|
|
1700
|
+
const O = w.indexOf(P);
|
|
1701
|
+
if (O + 1 >= w.length)
|
|
1702
|
+
break;
|
|
1703
|
+
const G = w[O + 1], ae = P.offsetTop;
|
|
1704
|
+
if (ae > F) {
|
|
1705
|
+
if (O === 0) {
|
|
1706
|
+
_ = P, N = G;
|
|
1707
|
+
break;
|
|
1708
|
+
}
|
|
1709
|
+
P = w[O - 1];
|
|
1710
|
+
continue;
|
|
1711
|
+
}
|
|
1712
|
+
const me = G.offsetTop;
|
|
1713
|
+
if (ae <= F && me > F) {
|
|
1714
|
+
_ = P, N = G;
|
|
1715
|
+
break;
|
|
1716
|
+
}
|
|
1717
|
+
P = G;
|
|
1748
1718
|
}
|
|
1749
|
-
|
|
1719
|
+
const D = _.offsetTop, Q = N.offsetTop;
|
|
1720
|
+
let z = 0;
|
|
1721
|
+
const { start: ue, end: re } = a[Number(_.dataset.line || 0)], ee = r(ue);
|
|
1722
|
+
let X = r(re);
|
|
1723
|
+
const ie = n(re);
|
|
1724
|
+
let te = 0;
|
|
1725
|
+
_ === ((I = l.firstElementChild) == null ? void 0 : I.firstElementChild) ? (z = Math.max(F / Q, 0), te = X + ie - ee) : X > t.scrollDOM.scrollHeight - t.scrollDOM.clientHeight ? (z = Math.max(
|
|
1726
|
+
(F - D) / (l.scrollHeight - D - l.clientHeight),
|
|
1727
|
+
0
|
|
1728
|
+
), X = r(t.state.doc.lines) + n(t.state.doc.lines), te = 8 + X - ee - e.clientHeight) : (z = Math.max(
|
|
1729
|
+
(F - D) / (Q - D),
|
|
1730
|
+
0
|
|
1731
|
+
), te = X + ie - ee), lt(e, ee + te * z, () => {
|
|
1732
|
+
u--;
|
|
1733
|
+
});
|
|
1750
1734
|
}
|
|
1751
|
-
|
|
1752
|
-
m = !0, e.scrollTo({
|
|
1753
|
-
top: R + K * q
|
|
1754
|
-
});
|
|
1755
|
-
}
|
|
1756
|
-
}, 6);
|
|
1735
|
+
};
|
|
1757
1736
|
return [
|
|
1758
1737
|
() => {
|
|
1759
|
-
|
|
1760
|
-
passive: !0
|
|
1761
|
-
}), t.addEventListener("scroll", u, {
|
|
1762
|
-
passive: !0
|
|
1763
|
-
}), e.dispatchEvent(new Event("scroll"));
|
|
1738
|
+
d(), e.addEventListener("scroll", c), l.addEventListener("scroll", c), e.dispatchEvent(new Event("scroll"));
|
|
1764
1739
|
},
|
|
1765
1740
|
() => {
|
|
1766
|
-
e.removeEventListener("scroll",
|
|
1741
|
+
a = [], e.removeEventListener("scroll", c), l.removeEventListener("scroll", c);
|
|
1767
1742
|
}
|
|
1768
1743
|
];
|
|
1769
|
-
}, $l = (e,
|
|
1744
|
+
}, $l = (e, l, o, t, r) => {
|
|
1770
1745
|
const n = x("previewOnly");
|
|
1771
1746
|
let a = () => {
|
|
1772
|
-
},
|
|
1747
|
+
}, d = () => {
|
|
1773
1748
|
};
|
|
1774
1749
|
const m = () => {
|
|
1775
1750
|
a();
|
|
1776
1751
|
const u = document.querySelector(".cm-scroller");
|
|
1777
|
-
!n && (o.value ||
|
|
1752
|
+
!n && (o.value || t.value) && ([d, a] = (o.value ? Cl : yl)(
|
|
1778
1753
|
u,
|
|
1779
|
-
o.value ||
|
|
1780
|
-
r.value
|
|
1781
|
-
|
|
1782
|
-
)), e.scrollAuto && c();
|
|
1754
|
+
o.value || t.value,
|
|
1755
|
+
r.value
|
|
1756
|
+
)), e.scrollAuto && d();
|
|
1783
1757
|
};
|
|
1784
|
-
|
|
1758
|
+
S(
|
|
1785
1759
|
[
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1760
|
+
l,
|
|
1761
|
+
ne(e.setting, "preview"),
|
|
1762
|
+
ne(e.setting, "htmlPreview"),
|
|
1763
|
+
ne(e.setting, "fullscreen"),
|
|
1764
|
+
ne(e.setting, "pageFullscreen")
|
|
1791
1765
|
],
|
|
1792
1766
|
() => {
|
|
1793
|
-
|
|
1767
|
+
Y(m);
|
|
1794
1768
|
}
|
|
1795
|
-
),
|
|
1769
|
+
), S(
|
|
1796
1770
|
() => e.scrollAuto,
|
|
1797
1771
|
(u) => {
|
|
1798
|
-
u ?
|
|
1772
|
+
u ? d() : a();
|
|
1799
1773
|
}
|
|
1800
|
-
),
|
|
1801
|
-
}, wl = (e,
|
|
1802
|
-
var
|
|
1803
|
-
let
|
|
1804
|
-
const m =
|
|
1774
|
+
), H(m);
|
|
1775
|
+
}, wl = (e, l, o) => {
|
|
1776
|
+
var c, f, h, p, v, b;
|
|
1777
|
+
let t = "", r = 0, n = 0, a = !0, d = !1;
|
|
1778
|
+
const m = l.getSelectedText(), u = (c = A.editorConfig) == null ? void 0 : c.mermaidTemplate;
|
|
1805
1779
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
1806
|
-
const
|
|
1807
|
-
|
|
1780
|
+
const y = e.replace(/^h(\d)/, (C, $) => new Array(Number($)).fill("#", 0, $).join(""));
|
|
1781
|
+
t = `${y} ${m}`, r = y.length + 1;
|
|
1808
1782
|
} else if (e === "prettier") {
|
|
1809
|
-
const
|
|
1810
|
-
((
|
|
1783
|
+
const y = window.prettier || ((h = (f = A.editorExtensions) == null ? void 0 : f.prettier) == null ? void 0 : h.prettierInstance), C = [
|
|
1784
|
+
((p = window.prettierPlugins) == null ? void 0 : p.markdown) || ((b = (v = A.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : b.parserMarkdownInstance)
|
|
1811
1785
|
];
|
|
1812
|
-
!
|
|
1786
|
+
!y || C[0] === void 0 ? (k.emit(o.editorId, "errorCatcher", {
|
|
1813
1787
|
name: "prettier",
|
|
1814
1788
|
message: "prettier is undefined"
|
|
1815
|
-
}),
|
|
1789
|
+
}), t = l.getValue()) : t = y.format(l.getValue(), {
|
|
1816
1790
|
parser: "markdown",
|
|
1817
|
-
plugins:
|
|
1818
|
-
}), a = !1,
|
|
1791
|
+
plugins: C
|
|
1792
|
+
}), a = !1, d = !0;
|
|
1819
1793
|
} else
|
|
1820
1794
|
switch (e) {
|
|
1821
1795
|
case "bold": {
|
|
1822
|
-
|
|
1796
|
+
t = `**${m}**`, r = 2, n = -2;
|
|
1823
1797
|
break;
|
|
1824
1798
|
}
|
|
1825
1799
|
case "underline": {
|
|
1826
|
-
|
|
1800
|
+
t = `<u>${m}</u>`, r = 3, n = -4;
|
|
1827
1801
|
break;
|
|
1828
1802
|
}
|
|
1829
1803
|
case "italic": {
|
|
1830
|
-
|
|
1804
|
+
t = `*${m}*`, r = 1, n = -1;
|
|
1831
1805
|
break;
|
|
1832
1806
|
}
|
|
1833
1807
|
case "strikeThrough": {
|
|
1834
|
-
|
|
1808
|
+
t = `~~${m}~~`, r = 1, n = -1;
|
|
1835
1809
|
break;
|
|
1836
1810
|
}
|
|
1837
1811
|
case "sub": {
|
|
1838
|
-
|
|
1812
|
+
t = `<sub>${m}</sub>`, r = 5, n = -6;
|
|
1839
1813
|
break;
|
|
1840
1814
|
}
|
|
1841
1815
|
case "sup": {
|
|
1842
|
-
|
|
1816
|
+
t = `<sup>${m}</sup>`, r = 5, n = -6;
|
|
1843
1817
|
break;
|
|
1844
1818
|
}
|
|
1845
1819
|
case "codeRow": {
|
|
1846
|
-
|
|
1820
|
+
t = "`" + m + "`", r = 1, n = -1;
|
|
1847
1821
|
break;
|
|
1848
1822
|
}
|
|
1849
1823
|
case "quote": {
|
|
1850
|
-
|
|
1824
|
+
t = `> ${m}`, r = 2;
|
|
1851
1825
|
break;
|
|
1852
1826
|
}
|
|
1853
1827
|
case "orderedList": {
|
|
1854
|
-
|
|
1828
|
+
t = `1. ${m}`, r = 3;
|
|
1855
1829
|
break;
|
|
1856
1830
|
}
|
|
1857
1831
|
case "unorderedList": {
|
|
1858
|
-
|
|
1832
|
+
t = `- ${m}`, r = 2;
|
|
1859
1833
|
break;
|
|
1860
1834
|
}
|
|
1861
1835
|
case "task": {
|
|
1862
|
-
|
|
1836
|
+
t = `- [ ] ${m}`, r = 6;
|
|
1863
1837
|
break;
|
|
1864
1838
|
}
|
|
1865
1839
|
case "code": {
|
|
1866
|
-
const
|
|
1867
|
-
|
|
1868
|
-
${
|
|
1840
|
+
const y = o.text || m || "", C = o.mode || "language";
|
|
1841
|
+
t = `\`\`\`${C}
|
|
1842
|
+
${y}
|
|
1869
1843
|
\`\`\`
|
|
1870
|
-
`, r = 3, n = 3 +
|
|
1844
|
+
`, r = 3, n = 3 + C.length - t.length;
|
|
1871
1845
|
break;
|
|
1872
1846
|
}
|
|
1873
1847
|
case "table": {
|
|
1874
|
-
|
|
1875
|
-
const { selectedShape:
|
|
1876
|
-
for (let
|
|
1877
|
-
|
|
1878
|
-
|
|
1848
|
+
t = "|";
|
|
1849
|
+
const { selectedShape: y = { x: 1, y: 1 } } = o, { x: C, y: $ } = y;
|
|
1850
|
+
for (let T = 0; T <= $; T++)
|
|
1851
|
+
t += " col |";
|
|
1852
|
+
t += `
|
|
1879
1853
|
|`;
|
|
1880
|
-
for (let
|
|
1881
|
-
|
|
1882
|
-
for (let
|
|
1883
|
-
|
|
1854
|
+
for (let T = 0; T <= $; T++)
|
|
1855
|
+
t += " - |";
|
|
1856
|
+
for (let T = 0; T <= C; T++) {
|
|
1857
|
+
t += `
|
|
1884
1858
|
|`;
|
|
1885
|
-
for (let
|
|
1886
|
-
|
|
1859
|
+
for (let I = 0; I <= $; I++)
|
|
1860
|
+
t += " content |";
|
|
1887
1861
|
}
|
|
1888
|
-
r = 2, n = 5 -
|
|
1862
|
+
r = 2, n = 5 - t.length;
|
|
1889
1863
|
break;
|
|
1890
1864
|
}
|
|
1891
1865
|
case "link": {
|
|
1892
|
-
const { desc:
|
|
1893
|
-
|
|
1866
|
+
const { desc: y, url: C } = o;
|
|
1867
|
+
t = `[${y}](${C})`, a = !1;
|
|
1894
1868
|
break;
|
|
1895
1869
|
}
|
|
1896
1870
|
case "image": {
|
|
1897
|
-
const { desc:
|
|
1898
|
-
$ instanceof Array ?
|
|
1899
|
-
`, "") :
|
|
1871
|
+
const { desc: y, url: C, urls: $ } = o;
|
|
1872
|
+
$ instanceof Array ? t = $.reduce((T, I) => T + `
|
|
1873
|
+
`, "") : t = `
|
|
1900
1874
|
`, a = !1;
|
|
1901
1875
|
break;
|
|
1902
1876
|
}
|
|
1903
1877
|
case "flow": {
|
|
1904
|
-
|
|
1878
|
+
t = `\`\`\`mermaid
|
|
1905
1879
|
${(u == null ? void 0 : u.flow) || `flowchart TD
|
|
1906
1880
|
Start --> Stop`}
|
|
1907
1881
|
\`\`\`
|
|
1908
|
-
`, r = 3, n = 10 -
|
|
1882
|
+
`, r = 3, n = 10 - t.length;
|
|
1909
1883
|
break;
|
|
1910
1884
|
}
|
|
1911
1885
|
case "sequence": {
|
|
1912
|
-
|
|
1886
|
+
t = `\`\`\`mermaid
|
|
1913
1887
|
${(u == null ? void 0 : u.sequence) || `sequenceDiagram
|
|
1914
1888
|
A->>B: hello!
|
|
1915
1889
|
B-->>A: hi!
|
|
1916
1890
|
A-)B: bye!`}
|
|
1917
1891
|
\`\`\`
|
|
1918
|
-
`, r = 3, n = 10 -
|
|
1892
|
+
`, r = 3, n = 10 - t.length;
|
|
1919
1893
|
break;
|
|
1920
1894
|
}
|
|
1921
1895
|
case "gantt": {
|
|
1922
|
-
|
|
1896
|
+
t = `\`\`\`mermaid
|
|
1923
1897
|
${(u == null ? void 0 : u.gantt) || `gantt
|
|
1924
1898
|
title A Gantt Diagram
|
|
1925
1899
|
dateFormat YYYY-MM-DD
|
|
@@ -1927,47 +1901,47 @@ section Section
|
|
|
1927
1901
|
A task :a1, 2014-01-01, 30d
|
|
1928
1902
|
Another task :after a1, 20d`}
|
|
1929
1903
|
\`\`\`
|
|
1930
|
-
`, r = 3, n = 10 -
|
|
1904
|
+
`, r = 3, n = 10 - t.length;
|
|
1931
1905
|
break;
|
|
1932
1906
|
}
|
|
1933
1907
|
case "class": {
|
|
1934
|
-
|
|
1908
|
+
t = `\`\`\`mermaid
|
|
1935
1909
|
${(u == null ? void 0 : u.class) || `classDiagram
|
|
1936
1910
|
class Animal
|
|
1937
1911
|
Vehicle <|-- Car`}
|
|
1938
1912
|
\`\`\`
|
|
1939
|
-
`, r = 3, n = 10 -
|
|
1913
|
+
`, r = 3, n = 10 - t.length;
|
|
1940
1914
|
break;
|
|
1941
1915
|
}
|
|
1942
1916
|
case "state": {
|
|
1943
|
-
|
|
1917
|
+
t = `\`\`\`mermaid
|
|
1944
1918
|
${(u == null ? void 0 : u.state) || `stateDiagram-v2
|
|
1945
1919
|
s1 --> s2`}
|
|
1946
1920
|
\`\`\`
|
|
1947
|
-
`, r = 3, n = 10 -
|
|
1921
|
+
`, r = 3, n = 10 - t.length;
|
|
1948
1922
|
break;
|
|
1949
1923
|
}
|
|
1950
1924
|
case "pie": {
|
|
1951
|
-
|
|
1925
|
+
t = `\`\`\`mermaid
|
|
1952
1926
|
${(u == null ? void 0 : u.pie) || `pie title Pets adopted by volunteers
|
|
1953
1927
|
"Dogs" : 386
|
|
1954
1928
|
"Cats" : 85
|
|
1955
1929
|
"Rats" : 15`}
|
|
1956
1930
|
\`\`\`
|
|
1957
|
-
`, r = 3, n = 10 -
|
|
1931
|
+
`, r = 3, n = 10 - t.length;
|
|
1958
1932
|
break;
|
|
1959
1933
|
}
|
|
1960
1934
|
case "relationship": {
|
|
1961
|
-
|
|
1935
|
+
t = `\`\`\`mermaid
|
|
1962
1936
|
${(u == null ? void 0 : u.relationship) || `erDiagram
|
|
1963
1937
|
CAR ||--o{ NAMED-DRIVER : allows
|
|
1964
1938
|
PERSON ||--o{ NAMED-DRIVER : is`}
|
|
1965
1939
|
\`\`\`
|
|
1966
|
-
`, r = 3, n = 10 -
|
|
1940
|
+
`, r = 3, n = 10 - t.length;
|
|
1967
1941
|
break;
|
|
1968
1942
|
}
|
|
1969
1943
|
case "journey": {
|
|
1970
|
-
|
|
1944
|
+
t = `\`\`\`mermaid
|
|
1971
1945
|
${(u == null ? void 0 : u.journey) || `journey
|
|
1972
1946
|
title My working day
|
|
1973
1947
|
section Go to work
|
|
@@ -1978,27 +1952,27 @@ ${(u == null ? void 0 : u.journey) || `journey
|
|
|
1978
1952
|
Go downstairs: 5: Me
|
|
1979
1953
|
Sit down: 5: Me`}
|
|
1980
1954
|
\`\`\`
|
|
1981
|
-
`, r = 3, n = 10 -
|
|
1955
|
+
`, r = 3, n = 10 - t.length;
|
|
1982
1956
|
break;
|
|
1983
1957
|
}
|
|
1984
1958
|
case "katexInline": {
|
|
1985
|
-
|
|
1959
|
+
t = "$$", r = 1, n = -1;
|
|
1986
1960
|
break;
|
|
1987
1961
|
}
|
|
1988
1962
|
case "katexBlock": {
|
|
1989
|
-
|
|
1963
|
+
t = `$$
|
|
1990
1964
|
|
|
1991
1965
|
$$
|
|
1992
1966
|
`, r = 3, n = -4;
|
|
1993
1967
|
break;
|
|
1994
1968
|
}
|
|
1995
1969
|
case "universal": {
|
|
1996
|
-
const { generate:
|
|
1997
|
-
|
|
1970
|
+
const { generate: y } = o, C = y(m);
|
|
1971
|
+
t = C.targetValue, a = C.select, r = C.deviationStart, n = C.deviationEnd;
|
|
1998
1972
|
}
|
|
1999
1973
|
}
|
|
2000
1974
|
return {
|
|
2001
|
-
text:
|
|
1975
|
+
text: t,
|
|
2002
1976
|
options: {
|
|
2003
1977
|
// 是否选中
|
|
2004
1978
|
select: a,
|
|
@@ -2007,21 +1981,21 @@ $$
|
|
|
2007
1981
|
// 结束的偏移量
|
|
2008
1982
|
deviationEnd: n,
|
|
2009
1983
|
// 是否整个替换
|
|
2010
|
-
replaceAll:
|
|
1984
|
+
replaceAll: d
|
|
2011
1985
|
}
|
|
2012
1986
|
};
|
|
2013
|
-
}, Tl = "#e5c07b", ot = "var(--md-color)", Sl = "#56b6c2", xl = "#ffffff",
|
|
1987
|
+
}, Tl = "#e5c07b", ot = "var(--md-color)", Sl = "#56b6c2", xl = "#ffffff", se = "var(--md-color)", nt = "#e5c07b", El = "#e5c07b", Ll = "var(--md-color)", rt = "#d19a66", Al = "#c678dd", Il = "#21252b", it = "#2c313a", at = "#000", ke = "#353a42", Hl = "#ceedfa33", st = "#528bff", Fl = Ee.theme(
|
|
2014
1988
|
{
|
|
2015
1989
|
"&": {
|
|
2016
|
-
color:
|
|
1990
|
+
color: se,
|
|
2017
1991
|
backgroundColor: at
|
|
2018
1992
|
},
|
|
2019
1993
|
".cm-content": {
|
|
2020
1994
|
caretColor: st
|
|
2021
1995
|
},
|
|
2022
1996
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: st },
|
|
2023
|
-
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
2024
|
-
".cm-panels": { backgroundColor: Il, color:
|
|
1997
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Hl },
|
|
1998
|
+
".cm-panels": { backgroundColor: Il, color: se },
|
|
2025
1999
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
2026
2000
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2027
2001
|
".cm-searchMatch": {
|
|
@@ -2038,7 +2012,7 @@ $$
|
|
|
2038
2012
|
},
|
|
2039
2013
|
".cm-gutters": {
|
|
2040
2014
|
backgroundColor: at,
|
|
2041
|
-
color:
|
|
2015
|
+
color: se,
|
|
2042
2016
|
borderRight: "1px solid",
|
|
2043
2017
|
borderColor: "var(--md-border-color)"
|
|
2044
2018
|
},
|
|
@@ -2052,30 +2026,30 @@ $$
|
|
|
2052
2026
|
},
|
|
2053
2027
|
".cm-tooltip": {
|
|
2054
2028
|
border: "none",
|
|
2055
|
-
backgroundColor:
|
|
2029
|
+
backgroundColor: ke
|
|
2056
2030
|
},
|
|
2057
2031
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
2058
2032
|
borderTopColor: "transparent",
|
|
2059
2033
|
borderBottomColor: "transparent"
|
|
2060
2034
|
},
|
|
2061
2035
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
2062
|
-
borderTopColor:
|
|
2063
|
-
borderBottomColor:
|
|
2036
|
+
borderTopColor: ke,
|
|
2037
|
+
borderBottomColor: ke
|
|
2064
2038
|
},
|
|
2065
2039
|
".cm-tooltip-autocomplete": {
|
|
2066
2040
|
"& > ul > li[aria-selected]": {
|
|
2067
2041
|
backgroundColor: it,
|
|
2068
|
-
color:
|
|
2042
|
+
color: se
|
|
2069
2043
|
}
|
|
2070
2044
|
}
|
|
2071
2045
|
},
|
|
2072
2046
|
{ dark: !0 }
|
|
2073
|
-
), Ml =
|
|
2074
|
-
{ tag: g.keyword, color:
|
|
2047
|
+
), Ml = vt.define([
|
|
2048
|
+
{ tag: g.keyword, color: Al },
|
|
2075
2049
|
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: ot },
|
|
2076
2050
|
{ tag: [g.function(g.variableName), g.labelName], color: El },
|
|
2077
2051
|
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color: rt },
|
|
2078
|
-
{ tag: [g.definition(g.name), g.separator], color:
|
|
2052
|
+
{ tag: [g.definition(g.name), g.separator], color: se },
|
|
2079
2053
|
{
|
|
2080
2054
|
tag: [
|
|
2081
2055
|
g.typeName,
|
|
@@ -2110,21 +2084,21 @@ $$
|
|
|
2110
2084
|
{ tag: [g.atom, g.bool, g.special(g.variableName)], color: rt },
|
|
2111
2085
|
{ tag: [g.processingInstruction, g.string, g.inserted], color: Ll },
|
|
2112
2086
|
{ tag: g.invalid, color: xl }
|
|
2113
|
-
]),
|
|
2087
|
+
]), Bl = [
|
|
2114
2088
|
Fl,
|
|
2115
|
-
|
|
2116
|
-
],
|
|
2089
|
+
pt(Ml)
|
|
2090
|
+
], Rl = "#e5c07b", ct = "#3f4a54", jl = "#56b6c2", Pl = "#fff", ce = "#3f4a54", dt = "#2d8cf0", Dl = "#2d8cf0", Ol = "#3f4a54", ut = "#d19a66", _l = "#c678dd", Nl = "#21252b", mt = "#ceedfa33", ft = "#fff", ye = "#353a42", Vl = "#bad5fa", gt = "#3f4a54", Ul = Ee.theme(
|
|
2117
2091
|
{
|
|
2118
2092
|
"&": {
|
|
2119
|
-
color:
|
|
2093
|
+
color: ce,
|
|
2120
2094
|
backgroundColor: ft
|
|
2121
2095
|
},
|
|
2122
2096
|
".cm-content": {
|
|
2123
2097
|
caretColor: gt
|
|
2124
2098
|
},
|
|
2125
2099
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: gt },
|
|
2126
|
-
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Vl },
|
|
2127
|
-
".cm-panels": { backgroundColor:
|
|
2100
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Vl },
|
|
2101
|
+
".cm-panels": { backgroundColor: Nl, color: ce },
|
|
2128
2102
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
2129
2103
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2130
2104
|
".cm-searchMatch": {
|
|
@@ -2141,7 +2115,7 @@ $$
|
|
|
2141
2115
|
},
|
|
2142
2116
|
".cm-gutters": {
|
|
2143
2117
|
backgroundColor: ft,
|
|
2144
|
-
color:
|
|
2118
|
+
color: ce,
|
|
2145
2119
|
borderRight: "1px solid",
|
|
2146
2120
|
borderColor: "var(--md-border-color)"
|
|
2147
2121
|
},
|
|
@@ -2155,30 +2129,30 @@ $$
|
|
|
2155
2129
|
},
|
|
2156
2130
|
".cm-tooltip": {
|
|
2157
2131
|
border: "none",
|
|
2158
|
-
backgroundColor:
|
|
2132
|
+
backgroundColor: ye
|
|
2159
2133
|
},
|
|
2160
2134
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
2161
2135
|
borderTopColor: "transparent",
|
|
2162
2136
|
borderBottomColor: "transparent"
|
|
2163
2137
|
},
|
|
2164
2138
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
2165
|
-
borderTopColor:
|
|
2166
|
-
borderBottomColor:
|
|
2139
|
+
borderTopColor: ye,
|
|
2140
|
+
borderBottomColor: ye
|
|
2167
2141
|
},
|
|
2168
2142
|
".cm-tooltip-autocomplete": {
|
|
2169
2143
|
"& > ul > li[aria-selected]": {
|
|
2170
2144
|
backgroundColor: mt,
|
|
2171
|
-
color:
|
|
2145
|
+
color: ce
|
|
2172
2146
|
}
|
|
2173
2147
|
}
|
|
2174
2148
|
},
|
|
2175
2149
|
{ dark: !0 }
|
|
2176
|
-
), ql =
|
|
2177
|
-
{ tag: g.keyword, color:
|
|
2150
|
+
), ql = vt.define([
|
|
2151
|
+
{ tag: g.keyword, color: _l },
|
|
2178
2152
|
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: ct },
|
|
2179
|
-
{ tag: [g.function(g.variableName), g.labelName], color:
|
|
2153
|
+
{ tag: [g.function(g.variableName), g.labelName], color: Dl },
|
|
2180
2154
|
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color: ut },
|
|
2181
|
-
{ tag: [g.definition(g.name), g.separator], color:
|
|
2155
|
+
{ tag: [g.definition(g.name), g.separator], color: ce },
|
|
2182
2156
|
{
|
|
2183
2157
|
tag: [
|
|
2184
2158
|
g.typeName,
|
|
@@ -2190,7 +2164,7 @@ $$
|
|
|
2190
2164
|
g.self,
|
|
2191
2165
|
g.namespace
|
|
2192
2166
|
],
|
|
2193
|
-
color:
|
|
2167
|
+
color: Rl
|
|
2194
2168
|
},
|
|
2195
2169
|
{
|
|
2196
2170
|
tag: [
|
|
@@ -2202,7 +2176,7 @@ $$
|
|
|
2202
2176
|
g.link,
|
|
2203
2177
|
g.special(g.string)
|
|
2204
2178
|
],
|
|
2205
|
-
color:
|
|
2179
|
+
color: jl
|
|
2206
2180
|
},
|
|
2207
2181
|
{ tag: [g.meta, g.comment], color: dt },
|
|
2208
2182
|
{ tag: g.strong, fontWeight: "bold" },
|
|
@@ -2211,31 +2185,31 @@ $$
|
|
|
2211
2185
|
{ tag: g.link, color: dt, textDecoration: "underline" },
|
|
2212
2186
|
{ tag: g.heading, fontWeight: "bold", color: ct },
|
|
2213
2187
|
{ tag: [g.atom, g.bool, g.special(g.variableName)], color: ut },
|
|
2214
|
-
{ tag: [g.processingInstruction, g.string, g.inserted], color:
|
|
2188
|
+
{ tag: [g.processingInstruction, g.string, g.inserted], color: Ol },
|
|
2215
2189
|
{ tag: g.invalid, color: Pl }
|
|
2216
2190
|
]), Wl = [
|
|
2217
2191
|
Ul,
|
|
2218
|
-
|
|
2219
|
-
],
|
|
2220
|
-
const
|
|
2221
|
-
return (
|
|
2222
|
-
effects:
|
|
2192
|
+
pt(ql)
|
|
2193
|
+
], le = (e) => {
|
|
2194
|
+
const l = new Lt();
|
|
2195
|
+
return (t) => (l.get(e.state) ? e.dispatch({ effects: l.reconfigure(t) }) : e.dispatch({
|
|
2196
|
+
effects: At.appendConfig.of(l.of(t))
|
|
2223
2197
|
}), !0);
|
|
2224
2198
|
};
|
|
2225
2199
|
class Gl {
|
|
2226
|
-
constructor(
|
|
2227
|
-
|
|
2200
|
+
constructor(l) {
|
|
2201
|
+
K(this, "view");
|
|
2228
2202
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
2229
|
-
|
|
2230
|
-
|
|
2203
|
+
K(this, "toggleTabSize");
|
|
2204
|
+
K(this, "togglePlaceholder");
|
|
2231
2205
|
/**
|
|
2232
2206
|
* 设置全部的扩展
|
|
2233
2207
|
*/
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
this.view =
|
|
2208
|
+
K(this, "setExtensions");
|
|
2209
|
+
K(this, "toggleDisabled");
|
|
2210
|
+
K(this, "toggleReadOnly");
|
|
2211
|
+
K(this, "toggleMaxlength");
|
|
2212
|
+
this.view = l, this.toggleTabSize = le(this.view), this.togglePlaceholder = le(this.view), this.setExtensions = le(this.view), this.toggleDisabled = le(this.view), this.toggleReadOnly = le(this.view), this.toggleMaxlength = le(this.view);
|
|
2239
2213
|
}
|
|
2240
2214
|
getValue() {
|
|
2241
2215
|
return this.view.state.doc.toString();
|
|
@@ -2247,12 +2221,12 @@ class Gl {
|
|
|
2247
2221
|
* @param from 插入开始位置
|
|
2248
2222
|
* @param to 插入结束位置
|
|
2249
2223
|
*/
|
|
2250
|
-
setValue(
|
|
2224
|
+
setValue(l, o = 0, t = this.view.state.doc.length) {
|
|
2251
2225
|
this.view.dispatch({
|
|
2252
2226
|
changes: {
|
|
2253
2227
|
from: o,
|
|
2254
|
-
to:
|
|
2255
|
-
insert:
|
|
2228
|
+
to: t,
|
|
2229
|
+
insert: l
|
|
2256
2230
|
}
|
|
2257
2231
|
});
|
|
2258
2232
|
}
|
|
@@ -2260,8 +2234,8 @@ class Gl {
|
|
|
2260
2234
|
* 获取选中的文本
|
|
2261
2235
|
*/
|
|
2262
2236
|
getSelectedText() {
|
|
2263
|
-
const { from:
|
|
2264
|
-
return this.view.state.sliceDoc(
|
|
2237
|
+
const { from: l, to: o } = this.view.state.selection.main;
|
|
2238
|
+
return this.view.state.sliceDoc(l, o);
|
|
2265
2239
|
}
|
|
2266
2240
|
/**
|
|
2267
2241
|
* 使用新的内容替换选中的内容
|
|
@@ -2269,7 +2243,7 @@ class Gl {
|
|
|
2269
2243
|
* @param text 待替换内容
|
|
2270
2244
|
* @param options 替换后是否选中
|
|
2271
2245
|
*/
|
|
2272
|
-
replaceSelectedText(
|
|
2246
|
+
replaceSelectedText(l, o = {
|
|
2273
2247
|
// 是否选中
|
|
2274
2248
|
select: !0,
|
|
2275
2249
|
// 选中时,开始位置的偏移量
|
|
@@ -2280,17 +2254,17 @@ class Gl {
|
|
|
2280
2254
|
replaceAll: !1
|
|
2281
2255
|
}) {
|
|
2282
2256
|
if (o.replaceAll) {
|
|
2283
|
-
this.setValue(
|
|
2257
|
+
this.setValue(l);
|
|
2284
2258
|
return;
|
|
2285
2259
|
}
|
|
2286
|
-
const { from:
|
|
2287
|
-
if (this.view.dispatch(this.view.state.replaceSelection(
|
|
2288
|
-
const r =
|
|
2260
|
+
const { from: t } = this.view.state.selection.main;
|
|
2261
|
+
if (this.view.dispatch(this.view.state.replaceSelection(l)), o.select) {
|
|
2262
|
+
const r = t + l.length + o.deviationEnd;
|
|
2289
2263
|
this.view.dispatch({
|
|
2290
|
-
selection:
|
|
2264
|
+
selection: be.create(
|
|
2291
2265
|
[
|
|
2292
|
-
|
|
2293
|
-
|
|
2266
|
+
be.range(t + o.deviationStart, r),
|
|
2267
|
+
be.cursor(r)
|
|
2294
2268
|
],
|
|
2295
2269
|
1
|
|
2296
2270
|
)
|
|
@@ -2302,10 +2276,10 @@ class Gl {
|
|
|
2302
2276
|
*
|
|
2303
2277
|
* @param tabSize 需要切换的大小
|
|
2304
2278
|
*/
|
|
2305
|
-
setTabSize(
|
|
2279
|
+
setTabSize(l) {
|
|
2306
2280
|
this.toggleTabSize([
|
|
2307
|
-
|
|
2308
|
-
Dt.of(" ".repeat(
|
|
2281
|
+
ge.tabSize.of(l),
|
|
2282
|
+
Dt.of(" ".repeat(l))
|
|
2309
2283
|
]);
|
|
2310
2284
|
}
|
|
2311
2285
|
/**
|
|
@@ -2313,364 +2287,368 @@ class Gl {
|
|
|
2313
2287
|
*
|
|
2314
2288
|
* @param t 目标内容
|
|
2315
2289
|
*/
|
|
2316
|
-
setPlaceholder(
|
|
2317
|
-
this.togglePlaceholder(
|
|
2290
|
+
setPlaceholder(l) {
|
|
2291
|
+
this.togglePlaceholder(It(l));
|
|
2318
2292
|
}
|
|
2319
2293
|
focus() {
|
|
2320
2294
|
this.view.focus();
|
|
2321
2295
|
}
|
|
2322
|
-
setDisabled(
|
|
2323
|
-
this.toggleDisabled([
|
|
2296
|
+
setDisabled(l) {
|
|
2297
|
+
this.toggleDisabled([Ee.editable.of(!l)]);
|
|
2324
2298
|
}
|
|
2325
|
-
setReadOnly(
|
|
2326
|
-
this.toggleReadOnly([
|
|
2299
|
+
setReadOnly(l) {
|
|
2300
|
+
this.toggleReadOnly([ge.readOnly.of(l)]);
|
|
2327
2301
|
}
|
|
2328
|
-
setMaxLength(
|
|
2302
|
+
setMaxLength(l) {
|
|
2329
2303
|
this.toggleMaxlength([
|
|
2330
|
-
|
|
2304
|
+
ge.changeFilter.of((o) => o.newDoc.length <= l)
|
|
2331
2305
|
]);
|
|
2332
2306
|
}
|
|
2333
2307
|
}
|
|
2334
|
-
const
|
|
2335
|
-
const
|
|
2336
|
-
return (
|
|
2337
|
-
if (
|
|
2338
|
-
if (
|
|
2339
|
-
const { files: r } =
|
|
2340
|
-
|
|
2341
|
-
|
|
2308
|
+
const Kl = (e) => {
|
|
2309
|
+
const l = x("editorId");
|
|
2310
|
+
return (t) => {
|
|
2311
|
+
if (t.clipboardData) {
|
|
2312
|
+
if (t.clipboardData.files.length > 0) {
|
|
2313
|
+
const { files: r } = t.clipboardData;
|
|
2314
|
+
k.emit(
|
|
2315
|
+
l,
|
|
2342
2316
|
"uploadImage",
|
|
2343
2317
|
Array.from(r).filter((n) => /image\/.*/.test(n.type))
|
|
2344
|
-
),
|
|
2318
|
+
), t.preventDefault();
|
|
2345
2319
|
}
|
|
2346
|
-
if (e.autoDetectCode &&
|
|
2347
|
-
const r = JSON.parse(
|
|
2348
|
-
|
|
2320
|
+
if (e.autoDetectCode && t.clipboardData.types.includes("vscode-editor-data")) {
|
|
2321
|
+
const r = JSON.parse(t.clipboardData.getData("vscode-editor-data"));
|
|
2322
|
+
k.emit(l, "replace", "code", {
|
|
2349
2323
|
mode: r.mode,
|
|
2350
|
-
text:
|
|
2351
|
-
}),
|
|
2324
|
+
text: t.clipboardData.getData("text/plain")
|
|
2325
|
+
}), t.preventDefault();
|
|
2352
2326
|
}
|
|
2353
2327
|
}
|
|
2354
2328
|
};
|
|
2355
|
-
},
|
|
2356
|
-
const
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
name:
|
|
2329
|
+
}, zl = (e) => {
|
|
2330
|
+
const l = x("editorId");
|
|
2331
|
+
H(() => {
|
|
2332
|
+
k.on(l, {
|
|
2333
|
+
name: Ct,
|
|
2360
2334
|
callback() {
|
|
2361
2335
|
var o;
|
|
2362
2336
|
(o = e.value) == null || o.focus();
|
|
2363
2337
|
}
|
|
2364
2338
|
});
|
|
2365
2339
|
});
|
|
2366
|
-
}, Xl = (e,
|
|
2340
|
+
}, Xl = (e, l) => [
|
|
2367
2341
|
{
|
|
2368
2342
|
key: "Ctrl-b",
|
|
2369
2343
|
mac: "Cmd-b",
|
|
2370
|
-
run: () => (
|
|
2344
|
+
run: () => (k.emit(e, "replace", "bold"), !0)
|
|
2371
2345
|
},
|
|
2372
2346
|
{
|
|
2373
2347
|
key: "Ctrl-d",
|
|
2374
2348
|
mac: "Cmd-d",
|
|
2375
|
-
run:
|
|
2349
|
+
run: Bt,
|
|
2376
2350
|
preventDefault: !0
|
|
2377
2351
|
},
|
|
2378
2352
|
{
|
|
2379
2353
|
key: "Ctrl-s",
|
|
2380
2354
|
mac: "Cmd-s",
|
|
2381
|
-
run: (
|
|
2382
|
-
shift: () => (
|
|
2355
|
+
run: (I) => (k.emit(e, pe, I.state.doc.toString()), !0),
|
|
2356
|
+
shift: () => (k.emit(e, "replace", "strikeThrough"), !0)
|
|
2383
2357
|
},
|
|
2384
2358
|
{
|
|
2385
2359
|
key: "Ctrl-u",
|
|
2386
2360
|
mac: "Cmd-u",
|
|
2387
|
-
run: () => (
|
|
2388
|
-
shift: () => (
|
|
2361
|
+
run: () => (k.emit(e, "replace", "underline"), !0),
|
|
2362
|
+
shift: () => (k.emit(e, "replace", "unorderedList"), !0)
|
|
2389
2363
|
},
|
|
2390
2364
|
{
|
|
2391
2365
|
key: "Ctrl-i",
|
|
2392
2366
|
mac: "Cmd-i",
|
|
2393
|
-
run: () => (
|
|
2394
|
-
shift: () => (
|
|
2367
|
+
run: () => (k.emit(e, "replace", "italic"), !0),
|
|
2368
|
+
shift: () => (k.emit(e, "openModals", "image"), !0)
|
|
2395
2369
|
},
|
|
2396
2370
|
{
|
|
2397
2371
|
key: "Ctrl-1",
|
|
2398
2372
|
mac: "Cmd-1",
|
|
2399
|
-
run: () => (
|
|
2373
|
+
run: () => (k.emit(e, "replace", "h1"), !0)
|
|
2400
2374
|
},
|
|
2401
2375
|
{
|
|
2402
2376
|
key: "Ctrl-2",
|
|
2403
2377
|
mac: "Cmd-2",
|
|
2404
|
-
run: () => (
|
|
2378
|
+
run: () => (k.emit(e, "replace", "h2"), !0)
|
|
2405
2379
|
},
|
|
2406
2380
|
{
|
|
2407
2381
|
key: "Ctrl-3",
|
|
2408
2382
|
mac: "Cmd-3",
|
|
2409
|
-
run: () => (
|
|
2383
|
+
run: () => (k.emit(e, "replace", "h3"), !0)
|
|
2410
2384
|
},
|
|
2411
2385
|
{
|
|
2412
2386
|
key: "Ctrl-4",
|
|
2413
2387
|
mac: "Cmd-4",
|
|
2414
|
-
run: () => (
|
|
2388
|
+
run: () => (k.emit(e, "replace", "h4"), !0)
|
|
2415
2389
|
},
|
|
2416
2390
|
{
|
|
2417
2391
|
key: "Ctrl-5",
|
|
2418
2392
|
mac: "Cmd-5",
|
|
2419
|
-
run: () => (
|
|
2393
|
+
run: () => (k.emit(e, "replace", "h5"), !0)
|
|
2420
2394
|
},
|
|
2421
2395
|
{
|
|
2422
2396
|
key: "Ctrl-6",
|
|
2423
2397
|
mac: "Cmd-6",
|
|
2424
|
-
run: () => (
|
|
2398
|
+
run: () => (k.emit(e, "replace", "h6"), !0)
|
|
2425
2399
|
},
|
|
2426
2400
|
{
|
|
2427
2401
|
key: "Ctrl-ArrowUp",
|
|
2428
2402
|
mac: "Cmd-ArrowUp",
|
|
2429
|
-
run: () => (
|
|
2403
|
+
run: () => (k.emit(e, "replace", "sup"), !0)
|
|
2430
2404
|
},
|
|
2431
2405
|
{
|
|
2432
2406
|
key: "Ctrl-ArrowDown",
|
|
2433
2407
|
mac: "Cmd-ArrowDown",
|
|
2434
|
-
run: () => (
|
|
2408
|
+
run: () => (k.emit(e, "replace", "sub"), !0)
|
|
2435
2409
|
},
|
|
2436
2410
|
{
|
|
2437
2411
|
key: "Ctrl-o",
|
|
2438
2412
|
mac: "Cmd-o",
|
|
2439
|
-
run: () => (
|
|
2413
|
+
run: () => (k.emit(e, "replace", "orderedList"), !0)
|
|
2440
2414
|
},
|
|
2441
2415
|
{
|
|
2442
2416
|
key: "Ctrl-c",
|
|
2443
2417
|
mac: "Cmd-c",
|
|
2444
|
-
shift: () => (
|
|
2445
|
-
any(
|
|
2446
|
-
return (
|
|
2418
|
+
shift: () => (k.emit(e, "replace", "code"), !0),
|
|
2419
|
+
any(I, w) {
|
|
2420
|
+
return (w.ctrlKey || w.metaKey) && w.altKey && w.code === "KeyC" ? (k.emit(e, "replace", "codeRow"), !0) : !1;
|
|
2447
2421
|
}
|
|
2448
2422
|
},
|
|
2449
2423
|
{
|
|
2450
2424
|
key: "Ctrl-l",
|
|
2451
2425
|
mac: "Cmd-l",
|
|
2452
|
-
run: () => (
|
|
2426
|
+
run: () => (k.emit(e, "openModals", "link"), !0)
|
|
2453
2427
|
},
|
|
2454
2428
|
{
|
|
2455
2429
|
key: "Ctrl-f",
|
|
2456
2430
|
mac: "Cmd-f",
|
|
2457
|
-
shift: () =>
|
|
2431
|
+
shift: () => l.noPrettier ? !1 : (k.emit(e, "replace", "prettier"), !0)
|
|
2458
2432
|
},
|
|
2459
2433
|
{
|
|
2460
|
-
any: (
|
|
2434
|
+
any: (I, w) => (w.ctrlKey || w.metaKey) && w.altKey && w.shiftKey && w.code === "KeyT" ? (k.emit(e, "replace", "table"), !0) : !1
|
|
2461
2435
|
}
|
|
2462
2436
|
], Zl = (e) => {
|
|
2463
|
-
const
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2437
|
+
const l = x("tabWidth"), o = x("editorId"), t = x("theme"), r = B(), n = de(), a = Xl(o, e), d = Kl(e), m = [
|
|
2438
|
+
Ht.of([...a, Rt]),
|
|
2439
|
+
Et,
|
|
2440
|
+
Mt({ codeLanguages: Ft }),
|
|
2467
2441
|
// 横向换行
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
e.onChange(
|
|
2442
|
+
fe.lineWrapping,
|
|
2443
|
+
fe.updateListener.of((c) => {
|
|
2444
|
+
c.docChanged && e.onChange(c.state.doc.toString());
|
|
2471
2445
|
}),
|
|
2472
|
-
|
|
2473
|
-
paste:
|
|
2446
|
+
fe.domEventHandlers({
|
|
2447
|
+
paste: d,
|
|
2474
2448
|
blur: e.onBlur,
|
|
2475
2449
|
focus: e.onFocus
|
|
2476
2450
|
})
|
|
2477
|
-
], u = () =>
|
|
2478
|
-
|
|
2451
|
+
], u = () => t.value === "light" ? A.codeMirrorExtensions(
|
|
2452
|
+
t.value,
|
|
2479
2453
|
[...m, Wl],
|
|
2480
2454
|
a
|
|
2481
|
-
) :
|
|
2482
|
-
|
|
2483
|
-
[...m,
|
|
2455
|
+
) : A.codeMirrorExtensions(
|
|
2456
|
+
t.value,
|
|
2457
|
+
[...m, Bl],
|
|
2484
2458
|
a
|
|
2485
2459
|
);
|
|
2486
|
-
return
|
|
2487
|
-
const
|
|
2460
|
+
return H(() => {
|
|
2461
|
+
const c = ge.create({
|
|
2488
2462
|
doc: e.value
|
|
2489
|
-
}), f = new
|
|
2490
|
-
state:
|
|
2463
|
+
}), f = new fe({
|
|
2464
|
+
state: c,
|
|
2491
2465
|
parent: r.value
|
|
2492
2466
|
});
|
|
2493
|
-
n.value = new Gl(f), n.value.setTabSize(
|
|
2467
|
+
n.value = new Gl(f), n.value.setTabSize(l), n.value.setExtensions(u()), n.value.setPlaceholder(e.placeholder), n.value.setDisabled(e.disabled), n.value.setReadOnly(e.readonly), e.autofocus && f.focus(), e.maxlength && n.value.setMaxLength(e.maxlength), k.on(o, {
|
|
2494
2468
|
name: "ctrlZ",
|
|
2495
2469
|
callback() {
|
|
2496
|
-
|
|
2470
|
+
jt(f);
|
|
2497
2471
|
}
|
|
2498
|
-
}),
|
|
2472
|
+
}), k.on(o, {
|
|
2499
2473
|
name: "ctrlShiftZ",
|
|
2500
2474
|
callback() {
|
|
2501
|
-
|
|
2475
|
+
Pt(f);
|
|
2502
2476
|
}
|
|
2503
|
-
}),
|
|
2477
|
+
}), k.on(o, {
|
|
2504
2478
|
name: "replace",
|
|
2505
|
-
callback(h,
|
|
2506
|
-
var
|
|
2507
|
-
const { text:
|
|
2508
|
-
(
|
|
2479
|
+
callback(h, p = {}) {
|
|
2480
|
+
var y;
|
|
2481
|
+
const { text: v, options: b } = wl(h, n.value, p);
|
|
2482
|
+
(y = n.value) == null || y.replaceSelectedText(v, b);
|
|
2509
2483
|
}
|
|
2510
2484
|
});
|
|
2511
|
-
}),
|
|
2512
|
-
() =>
|
|
2485
|
+
}), S(
|
|
2486
|
+
() => t.value,
|
|
2513
2487
|
() => {
|
|
2514
|
-
var
|
|
2515
|
-
|
|
2488
|
+
var c, f;
|
|
2489
|
+
t.value === "dark" ? (c = n.value) == null || c.setExtensions(u()) : (f = n.value) == null || f.setExtensions(u());
|
|
2516
2490
|
}
|
|
2517
|
-
),
|
|
2491
|
+
), S(
|
|
2518
2492
|
() => e.value,
|
|
2519
2493
|
() => {
|
|
2520
|
-
var
|
|
2521
|
-
((
|
|
2494
|
+
var c, f;
|
|
2495
|
+
((c = n.value) == null ? void 0 : c.getValue()) !== e.value && ((f = n.value) == null || f.setValue(e.value));
|
|
2522
2496
|
}
|
|
2523
|
-
),
|
|
2497
|
+
), S(
|
|
2524
2498
|
() => e.value,
|
|
2525
2499
|
() => {
|
|
2526
|
-
var
|
|
2527
|
-
(
|
|
2500
|
+
var c;
|
|
2501
|
+
(c = n.value) == null || c.setPlaceholder(e.placeholder);
|
|
2528
2502
|
}
|
|
2529
|
-
),
|
|
2503
|
+
), S(
|
|
2530
2504
|
() => e.disabled,
|
|
2531
2505
|
() => {
|
|
2532
|
-
var
|
|
2533
|
-
(
|
|
2506
|
+
var c;
|
|
2507
|
+
(c = n.value) == null || c.setDisabled(e.disabled);
|
|
2534
2508
|
}
|
|
2535
|
-
),
|
|
2509
|
+
), S(
|
|
2536
2510
|
() => e.readonly,
|
|
2537
2511
|
() => {
|
|
2538
|
-
var
|
|
2539
|
-
(
|
|
2512
|
+
var c;
|
|
2513
|
+
(c = n.value) == null || c.setDisabled(e.readonly);
|
|
2540
2514
|
}
|
|
2541
|
-
),
|
|
2515
|
+
), S(
|
|
2542
2516
|
() => e.maxlength,
|
|
2543
2517
|
() => {
|
|
2544
|
-
var
|
|
2545
|
-
e.maxlength && ((
|
|
2518
|
+
var c;
|
|
2519
|
+
e.maxlength && ((c = n.value) == null || c.setMaxLength(e.maxlength));
|
|
2546
2520
|
}
|
|
2547
|
-
),
|
|
2521
|
+
), zl(n), {
|
|
2548
2522
|
inputWrapperRef: r,
|
|
2549
2523
|
codeMirrorUt: n
|
|
2550
2524
|
};
|
|
2551
|
-
}, Jl = (e,
|
|
2552
|
-
const o = x("editorId"),
|
|
2525
|
+
}, Jl = (e, l) => {
|
|
2526
|
+
const o = x("editorId"), t = ve(() => {
|
|
2553
2527
|
const r = document.querySelectorAll(`#${o}-preview img`);
|
|
2554
|
-
r.length !== 0 &&
|
|
2528
|
+
r.length !== 0 && Ot(r, {
|
|
2555
2529
|
background: "#00000073"
|
|
2556
2530
|
});
|
|
2557
2531
|
});
|
|
2558
|
-
|
|
2559
|
-
}, Yl = (e,
|
|
2560
|
-
const o = x("editorId"),
|
|
2561
|
-
document.querySelectorAll(`#${o}-preview pre`).forEach((
|
|
2532
|
+
H(t), S([l, ne(e.setting, "preview")], t);
|
|
2533
|
+
}, Yl = (e, l) => {
|
|
2534
|
+
const o = x("editorId"), t = x("usedLanguageText"), r = () => {
|
|
2535
|
+
document.querySelectorAll(`#${o}-preview pre`).forEach((d) => {
|
|
2562
2536
|
var f, h;
|
|
2563
2537
|
let m = -1;
|
|
2564
|
-
(f =
|
|
2565
|
-
const u = ((h =
|
|
2566
|
-
|
|
2567
|
-
var
|
|
2538
|
+
(f = d.querySelector(".copy-button")) == null || f.remove();
|
|
2539
|
+
const u = ((h = t.value.copyCode) == null ? void 0 : h.text) || "复制代码", c = document.createElement("span");
|
|
2540
|
+
c.setAttribute("class", "copy-button"), c.dataset.tips = u, c.innerHTML = `<svg class="${s}-icon" aria-hidden="true"><use xlink:href="#${s}-icon-copy"></use></svg>`, c.addEventListener("click", () => {
|
|
2541
|
+
var C, $;
|
|
2568
2542
|
clearTimeout(m);
|
|
2569
|
-
const
|
|
2570
|
-
|
|
2571
|
-
|
|
2543
|
+
const p = d.querySelector("code").innerText, v = _t(e.formatCopiedText(p)), b = ((C = t.value.copyCode) == null ? void 0 : C.successTips) || "已复制!", y = (($ = t.value.copyCode) == null ? void 0 : $.failTips) || "已复制!";
|
|
2544
|
+
c.dataset.tips = v ? b : y, m = window.setTimeout(() => {
|
|
2545
|
+
c.dataset.tips = u;
|
|
2572
2546
|
}, 1500);
|
|
2573
|
-
}),
|
|
2547
|
+
}), d.appendChild(c);
|
|
2574
2548
|
});
|
|
2575
2549
|
}, n = () => {
|
|
2576
|
-
|
|
2577
|
-
}, a = (
|
|
2578
|
-
|
|
2550
|
+
Y(r);
|
|
2551
|
+
}, a = (d) => {
|
|
2552
|
+
d && Y(r);
|
|
2579
2553
|
};
|
|
2580
|
-
|
|
2554
|
+
S(() => l.value, n), S(() => e.setting.preview, a), S(() => e.setting.htmlPreview, a), S(() => t.value, r), H(r);
|
|
2581
2555
|
}, Ql = (e) => {
|
|
2582
2556
|
var n;
|
|
2583
|
-
const
|
|
2584
|
-
return
|
|
2557
|
+
const l = (n = A.editorExtensions) == null ? void 0 : n.highlight, o = l == null ? void 0 : l.instance, t = x("highlight"), r = de(o);
|
|
2558
|
+
return H(() => {
|
|
2585
2559
|
if (e.noHighlight)
|
|
2586
2560
|
return;
|
|
2587
2561
|
if (!r.value) {
|
|
2588
|
-
const
|
|
2589
|
-
|
|
2562
|
+
const d = document.createElement("script");
|
|
2563
|
+
d.src = t.value.js, d.onload = () => {
|
|
2590
2564
|
r.value = window.hljs;
|
|
2591
|
-
},
|
|
2565
|
+
}, d.id = `${s}-hljs`, V(d, "hljs");
|
|
2592
2566
|
}
|
|
2593
2567
|
const a = document.createElement("link");
|
|
2594
|
-
a.rel = "stylesheet", a.href =
|
|
2595
|
-
}),
|
|
2596
|
-
() =>
|
|
2568
|
+
a.rel = "stylesheet", a.href = t.value.css, a.id = `${s}-hlCss`, V(a);
|
|
2569
|
+
}), S(
|
|
2570
|
+
() => t.value.css,
|
|
2597
2571
|
(a) => {
|
|
2598
2572
|
sl(`${s}-hlCss`, "href", a);
|
|
2599
2573
|
}
|
|
2600
2574
|
), r;
|
|
2601
2575
|
}, eo = (e) => {
|
|
2602
|
-
const
|
|
2576
|
+
const l = x("theme"), { editorExtensions: o } = A, t = o == null ? void 0 : o.mermaid, r = de(t == null ? void 0 : t.instance), n = de(!1), a = new Wt({
|
|
2603
2577
|
max: 1e3,
|
|
2604
2578
|
// 缓存10分钟
|
|
2605
2579
|
ttl: 6e5
|
|
2606
|
-
}),
|
|
2607
|
-
const u = (
|
|
2580
|
+
}), d = () => {
|
|
2581
|
+
const u = (t == null ? void 0 : t.instance) || window.mermaid;
|
|
2608
2582
|
!e.noMermaid && u && (u.initialize({
|
|
2609
2583
|
startOnLoad: !1,
|
|
2610
|
-
theme:
|
|
2584
|
+
theme: l.value === "dark" ? "dark" : "default"
|
|
2611
2585
|
}), n.value = !n.value);
|
|
2612
2586
|
};
|
|
2613
|
-
return
|
|
2614
|
-
() =>
|
|
2587
|
+
return S(
|
|
2588
|
+
() => l.value,
|
|
2615
2589
|
() => {
|
|
2616
|
-
a.clear(),
|
|
2590
|
+
a.clear(), d();
|
|
2617
2591
|
}
|
|
2618
|
-
),
|
|
2619
|
-
if (!e.noMermaid && !(
|
|
2592
|
+
), H(() => {
|
|
2593
|
+
if (!e.noMermaid && !(t != null && t.instance)) {
|
|
2620
2594
|
const u = document.createElement("script");
|
|
2621
2595
|
u.id = `${s}-mermaid`;
|
|
2622
|
-
const
|
|
2623
|
-
/\.mjs/.test(
|
|
2624
|
-
r.value = window.mermaid,
|
|
2625
|
-
},
|
|
2596
|
+
const c = (t == null ? void 0 : t.js) || Zt;
|
|
2597
|
+
/\.mjs/.test(c) ? (u.setAttribute("type", "module"), u.innerHTML = `import mermaid from "${c}";window.mermaid=mermaid;document.getElementById('${s}-mermaid').dispatchEvent(new Event('load'));`) : u.src = c, u.onload = () => {
|
|
2598
|
+
r.value = window.mermaid, d();
|
|
2599
|
+
}, V(u, "mermaid");
|
|
2626
2600
|
}
|
|
2627
2601
|
}), { mermaidRef: r, reRenderRef: n, replaceMermaid: () => {
|
|
2628
|
-
|
|
2602
|
+
Y(() => {
|
|
2629
2603
|
!e.noMermaid && r.value && document.querySelectorAll(
|
|
2630
2604
|
`div.${s}-mermaid`
|
|
2631
|
-
).forEach(async (
|
|
2632
|
-
let f = a.get(
|
|
2605
|
+
).forEach(async (c) => {
|
|
2606
|
+
let f = a.get(c.innerText);
|
|
2633
2607
|
if (!f) {
|
|
2634
|
-
const
|
|
2635
|
-
f = typeof
|
|
2608
|
+
const p = il(), b = await (r.value.renderAsync || r.value.render)(p, c.innerText);
|
|
2609
|
+
f = typeof b == "string" ? b : b.svg, a.set(c.innerText, f);
|
|
2636
2610
|
}
|
|
2637
2611
|
const h = document.createElement("p");
|
|
2638
|
-
h.className = `${s}-mermaid`, h.setAttribute("data-processed", ""), h.innerHTML = f,
|
|
2612
|
+
h.className = `${s}-mermaid`, h.setAttribute("data-processed", ""), h.innerHTML = f, c.dataset.line !== void 0 && (h.dataset.line = c.dataset.line), c.replaceWith(h);
|
|
2639
2613
|
});
|
|
2640
2614
|
});
|
|
2641
2615
|
} };
|
|
2642
2616
|
}, to = (e) => {
|
|
2643
2617
|
var r;
|
|
2644
|
-
const
|
|
2645
|
-
return
|
|
2646
|
-
if (!e.noKatex && !
|
|
2618
|
+
const l = (r = A.editorExtensions) == null ? void 0 : r.katex, o = l == null ? void 0 : l.instance, t = de(o);
|
|
2619
|
+
return H(() => {
|
|
2620
|
+
if (!e.noKatex && !t.value) {
|
|
2647
2621
|
const n = document.createElement("script");
|
|
2648
|
-
n.src = (
|
|
2649
|
-
|
|
2622
|
+
n.src = (l == null ? void 0 : l.js) || Xe.js, n.onload = () => {
|
|
2623
|
+
t.value = window.katex;
|
|
2650
2624
|
}, n.id = `${s}-katex`;
|
|
2651
2625
|
const a = document.createElement("link");
|
|
2652
|
-
a.rel = "stylesheet", a.href = (
|
|
2626
|
+
a.rel = "stylesheet", a.href = (l == null ? void 0 : l.css) || Xe.css, a.id = `${s}-katexCss`, V(n, "katex"), V(a);
|
|
2653
2627
|
}
|
|
2654
|
-
}),
|
|
2655
|
-
}, lo = (e,
|
|
2628
|
+
}), t;
|
|
2629
|
+
}, lo = (e, l) => {
|
|
2656
2630
|
const o = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
2657
|
-
e.renderer.rules.fence = (
|
|
2658
|
-
const m =
|
|
2659
|
-
|
|
2631
|
+
e.renderer.rules.fence = (t, r, n, a, d) => {
|
|
2632
|
+
const m = t[r], u = m.content.trim();
|
|
2633
|
+
if (m.info === "mermaid") {
|
|
2634
|
+
let c;
|
|
2635
|
+
return t[r].map && t[r].level === 0 && (c = t[r].map[0], t[r].attrSet("data-line", String(c))), `<div class="${s}-mermaid" ${c !== void 0 ? "data-line=" + c : ""} data-mermaid-theme=${l.themeRef.value}>${u}</div>`;
|
|
2636
|
+
}
|
|
2637
|
+
return o(t, r, n, a, d);
|
|
2660
2638
|
};
|
|
2661
|
-
}, ht = (e,
|
|
2662
|
-
let o = !0,
|
|
2663
|
-
const r = e.posMax, n =
|
|
2664
|
-
return (n === 32 || n === 9 || a >= 48 && a <= 57) && (
|
|
2639
|
+
}, ht = (e, l) => {
|
|
2640
|
+
let o = !0, t = !0;
|
|
2641
|
+
const r = e.posMax, n = l > 0 ? e.src.charCodeAt(l - 1) : -1, a = l + 1 <= r ? e.src.charCodeAt(l + 1) : -1;
|
|
2642
|
+
return (n === 32 || n === 9 || a >= 48 && a <= 57) && (t = !1), (a === 32 || a === 9) && (o = !1), {
|
|
2665
2643
|
can_open: o,
|
|
2666
|
-
can_close:
|
|
2644
|
+
can_close: t
|
|
2667
2645
|
};
|
|
2668
|
-
}, oo = (e,
|
|
2669
|
-
let o,
|
|
2646
|
+
}, oo = (e, l) => {
|
|
2647
|
+
let o, t, r, n;
|
|
2670
2648
|
if (e.src[e.pos] !== "$")
|
|
2671
2649
|
return !1;
|
|
2672
2650
|
if (r = ht(e, e.pos), !r.can_open)
|
|
2673
|
-
return
|
|
2651
|
+
return l || (e.pending += "$"), e.pos += 1, !0;
|
|
2674
2652
|
const a = e.pos + 1;
|
|
2675
2653
|
for (o = a; (o = e.src.indexOf("$", o)) !== -1; ) {
|
|
2676
2654
|
for (n = o - 1; e.src[n] === "\\"; )
|
|
@@ -2679,31 +2657,31 @@ const zl = (e) => {
|
|
|
2679
2657
|
break;
|
|
2680
2658
|
o += 1;
|
|
2681
2659
|
}
|
|
2682
|
-
return o === -1 ? (
|
|
2683
|
-
}, no = (e,
|
|
2684
|
-
let r, n, a,
|
|
2685
|
-
if (u + 2 >
|
|
2660
|
+
return o === -1 ? (l || (e.pending += "$"), e.pos = a, !0) : o - a === 0 ? (l || (e.pending += "$$"), e.pos = a + 1, !0) : (r = ht(e, o), r.can_close ? (l || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(a, o)), e.pos = o + 1, !0) : (l || (e.pending += "$"), e.pos = a, !0));
|
|
2661
|
+
}, no = (e, l, o, t) => {
|
|
2662
|
+
let r, n, a, d, m = !1, u = e.bMarks[l] + e.tShift[l], c = e.eMarks[l];
|
|
2663
|
+
if (u + 2 > c || e.src.slice(u, u + 2) !== "$$")
|
|
2686
2664
|
return !1;
|
|
2687
|
-
if (u += 2, r = e.src.slice(u,
|
|
2665
|
+
if (u += 2, r = e.src.slice(u, c), t)
|
|
2688
2666
|
return !0;
|
|
2689
|
-
for (r.trim().slice(-2) === "$$" && (r = r.trim().slice(0, -2), m = !0), a =
|
|
2690
|
-
e.src.slice(u,
|
|
2667
|
+
for (r.trim().slice(-2) === "$$" && (r = r.trim().slice(0, -2), m = !0), a = l; !m && (a++, !(a >= o || (u = e.bMarks[a] + e.tShift[a], c = e.eMarks[a], u < c && e.tShift[a] < e.blkIndent))); )
|
|
2668
|
+
e.src.slice(u, c).trim().slice(-2) === "$$" && (d = e.src.slice(0, c).lastIndexOf("$$"), n = e.src.slice(u, d), m = !0);
|
|
2691
2669
|
e.line = a + 1;
|
|
2692
2670
|
const f = e.push("math_block", "math", 0);
|
|
2693
2671
|
return f.block = !0, f.content = (r && r.trim() ? r + `
|
|
2694
|
-
` : "") + e.getLines(
|
|
2695
|
-
}, ro = (e,
|
|
2672
|
+
` : "") + e.getLines(l + 1, a, e.tShift[l], !0) + (n && n.trim() ? n : ""), f.map = [l, e.line], f.markup = "$$", !0;
|
|
2673
|
+
}, ro = (e, l) => {
|
|
2696
2674
|
const o = (r) => {
|
|
2697
|
-
if (
|
|
2698
|
-
const n =
|
|
2675
|
+
if (l.katexRef.value) {
|
|
2676
|
+
const n = l.katexRef.value.renderToString(r, {
|
|
2699
2677
|
throwOnError: !1
|
|
2700
2678
|
});
|
|
2701
2679
|
return `<span class="${s}-katex-inline" data-processed>${n}</span>`;
|
|
2702
2680
|
} else
|
|
2703
2681
|
return `<span class="${s}-katex-inline">${r}</span>`;
|
|
2704
|
-
},
|
|
2705
|
-
if (
|
|
2706
|
-
const a =
|
|
2682
|
+
}, t = (r, n) => {
|
|
2683
|
+
if (l.katexRef.value) {
|
|
2684
|
+
const a = l.katexRef.value.renderToString(r, {
|
|
2707
2685
|
throwOnError: !1,
|
|
2708
2686
|
displayMode: !0
|
|
2709
2687
|
});
|
|
@@ -2713,111 +2691,125 @@ const zl = (e) => {
|
|
|
2713
2691
|
};
|
|
2714
2692
|
e.inline.ruler.after("escape", "math_inline", oo), e.block.ruler.after("blockquote", "math_block", no, {
|
|
2715
2693
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
2716
|
-
}), e.renderer.rules.math_inline = (r, n) => o(r[n].content), e.renderer.rules.math_block = (r, n) =>
|
|
2694
|
+
}), e.renderer.rules.math_inline = (r, n) => o(r[n].content), e.renderer.rules.math_block = (r, n) => t(r[n].content, r[n].map[0]) + `
|
|
2717
2695
|
`;
|
|
2718
|
-
}, io = (e,
|
|
2719
|
-
|
|
2720
|
-
const o = 3,
|
|
2721
|
-
let a = "",
|
|
2722
|
-
const m = (
|
|
2723
|
-
const
|
|
2724
|
-
return
|
|
2696
|
+
}, io = (e, l) => {
|
|
2697
|
+
l = l || {};
|
|
2698
|
+
const o = 3, t = l.marker || "!", r = t.charCodeAt(0), n = t.length;
|
|
2699
|
+
let a = "", d = "";
|
|
2700
|
+
const m = (c, f, h, p, v) => {
|
|
2701
|
+
const b = c[f];
|
|
2702
|
+
return b.type === "admonition_open" ? (c[f].attrPush([
|
|
2725
2703
|
"class",
|
|
2726
|
-
`${s}-admonition ${s}-admonition-${
|
|
2727
|
-
]),
|
|
2728
|
-
}, u = (
|
|
2729
|
-
const f =
|
|
2730
|
-
|
|
2704
|
+
`${s}-admonition ${s}-admonition-${b.info}`
|
|
2705
|
+
]), c[f].attrSet("data-line", String(c[f].map[0]))) : b.type === "admonition_title_open" && c[f].attrPush(["class", `${s}-admonition-title`]), v.renderToken(c, f, h);
|
|
2706
|
+
}, u = (c) => {
|
|
2707
|
+
const f = c.trim().split(" ", 2);
|
|
2708
|
+
d = "", a = f[0], f.length > 1 && (d = c.substring(a.length + 2)), (d === "" || !d) && (d = a);
|
|
2731
2709
|
};
|
|
2732
2710
|
e.block.ruler.before(
|
|
2733
2711
|
"code",
|
|
2734
2712
|
"admonition",
|
|
2735
|
-
(
|
|
2736
|
-
let
|
|
2737
|
-
if (r !==
|
|
2713
|
+
(c, f, h, p) => {
|
|
2714
|
+
let v, b, y, C = !1, $ = c.bMarks[f] + c.tShift[f], T = c.eMarks[f];
|
|
2715
|
+
if (r !== c.src.charCodeAt($))
|
|
2738
2716
|
return !1;
|
|
2739
|
-
for (
|
|
2717
|
+
for (v = $ + 1; v <= T && t[(v - $) % n] === c.src[v]; v++)
|
|
2740
2718
|
;
|
|
2741
|
-
const
|
|
2742
|
-
if (
|
|
2719
|
+
const I = Math.floor((v - $) / n);
|
|
2720
|
+
if (I !== o)
|
|
2743
2721
|
return !1;
|
|
2744
|
-
|
|
2745
|
-
const
|
|
2746
|
-
if (u(
|
|
2722
|
+
v -= (v - $) % n;
|
|
2723
|
+
const w = c.src.slice($, v), F = c.src.slice(v, T);
|
|
2724
|
+
if (u(F), p)
|
|
2747
2725
|
return !0;
|
|
2748
|
-
for (
|
|
2749
|
-
if (r ===
|
|
2750
|
-
for (
|
|
2726
|
+
for (b = f; b++, !(b >= h || ($ = c.bMarks[b] + c.tShift[b], T = c.eMarks[b], $ < T && c.sCount[b] < c.blkIndent)); )
|
|
2727
|
+
if (r === c.src.charCodeAt($) && !(c.sCount[b] - c.blkIndent >= 4)) {
|
|
2728
|
+
for (v = $ + 1; v <= T && t[(v - $) % n] === c.src[v]; v++)
|
|
2751
2729
|
;
|
|
2752
|
-
if (!(Math.floor((
|
|
2753
|
-
|
|
2730
|
+
if (!(Math.floor((v - $) / n) < I) && (v -= (v - $) % n, v = c.skipSpaces(v), !(v < T))) {
|
|
2731
|
+
C = !0;
|
|
2754
2732
|
break;
|
|
2755
2733
|
}
|
|
2756
2734
|
}
|
|
2757
|
-
const
|
|
2758
|
-
return
|
|
2735
|
+
const j = c.parentType, R = c.lineMax;
|
|
2736
|
+
return c.parentType = "root", c.lineMax = b, y = c.push("admonition_open", "div", 1), y.markup = w, y.block = !0, y.info = a, y.map = [f, b], y = c.push("admonition_title_open", "p", 1), y.markup = w + " " + a, y.map = [f, b], y = c.push("inline", "", 0), y.content = d, y.map = [f, c.line - 1], y.children = [], y = c.push("admonition_title_close", "p", -1), y.markup = w + " " + a, c.md.block.tokenize(c, f + 1, b), y = c.push("admonition_close", "div", -1), y.markup = c.src.slice($, v), y.block = !0, c.parentType = j, c.lineMax = R, c.line = b + (C ? 1 : 0), !0;
|
|
2759
2737
|
},
|
|
2760
2738
|
{
|
|
2761
2739
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
2762
2740
|
}
|
|
2763
2741
|
), e.renderer.rules.admonition_open = m, e.renderer.rules.admonition_title_open = m, e.renderer.rules.admonition_title_close = m, e.renderer.rules.admonition_close = m;
|
|
2764
|
-
}, ao = (e,
|
|
2742
|
+
}, ao = (e, l) => {
|
|
2765
2743
|
let o;
|
|
2766
|
-
e.core.ruler.push("headingLinks", (
|
|
2767
|
-
o || (o =
|
|
2768
|
-
}), e.renderer.rules.heading_open = (
|
|
2769
|
-
const n =
|
|
2770
|
-
return
|
|
2744
|
+
e.core.ruler.push("headingLinks", (t) => {
|
|
2745
|
+
o || (o = t.Token);
|
|
2746
|
+
}), e.renderer.rules.heading_open = (t, r) => {
|
|
2747
|
+
const n = t[r], a = t[r + 1].content, d = n.markup.length;
|
|
2748
|
+
return l.headsRef.value.push({
|
|
2771
2749
|
text: a,
|
|
2772
|
-
level:
|
|
2750
|
+
level: d
|
|
2773
2751
|
}), n.map && n.level === 0 && (n.attrSet("data-line", String(n.map[0])), n.attrSet(
|
|
2774
2752
|
"id",
|
|
2775
|
-
|
|
2776
|
-
)), e.renderer.renderToken(
|
|
2777
|
-
}, e.renderer.rules.heading_close = (
|
|
2778
|
-
},
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2753
|
+
l.mdHeadingId(a, d, l.headsRef.value.length)
|
|
2754
|
+
)), e.renderer.renderToken(t, r, l);
|
|
2755
|
+
}, e.renderer.rules.heading_close = (t, r, n, a, d) => d.renderToken(t, r, n);
|
|
2756
|
+
}, so = (e) => {
|
|
2757
|
+
[
|
|
2758
|
+
"paragraph_open",
|
|
2759
|
+
"table_open",
|
|
2760
|
+
"ordered_list_open",
|
|
2761
|
+
"bullet_list_open",
|
|
2762
|
+
"blockquote_open",
|
|
2763
|
+
"hr"
|
|
2764
|
+
].forEach((l) => {
|
|
2765
|
+
e.renderer.rules[l] = (o, t, r, n, a) => {
|
|
2766
|
+
let d;
|
|
2767
|
+
return o[t].map && o[t].level === 0 && (d = o[t].map[0], o[t].attrSet("data-line", String(d))), a.renderToken(o, t, r);
|
|
2768
|
+
};
|
|
2769
|
+
}), ["html_block", "fence"].forEach((l) => {
|
|
2770
|
+
const o = e.renderer.rules[l];
|
|
2771
|
+
e.renderer.rules[l] = (t, r, n, a, d) => {
|
|
2772
|
+
let m;
|
|
2773
|
+
const u = o(t, r, n, a, d);
|
|
2774
|
+
return t[r].map && t[r].level === 0 ? (m = t[r].map[0], u.replace(/^(<[^>]*)/, `$1 data-line="${m}"`)) : u;
|
|
2775
|
+
};
|
|
2776
|
+
});
|
|
2777
|
+
}, co = (e) => {
|
|
2778
|
+
const { editorConfig: l, markdownItConfig: o } = A, t = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), d = B([]), m = Ql(e), u = to(e), { reRenderRef: c, replaceMermaid: f } = eo(e), h = Nt({
|
|
2783
2779
|
html: !0,
|
|
2784
2780
|
breaks: !0
|
|
2785
2781
|
});
|
|
2786
|
-
h.use(
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
if (e.noHighlight || !m.value)
|
|
2792
|
-
return p;
|
|
2793
|
-
const $ = m.value.getLanguage(y);
|
|
2794
|
-
let w;
|
|
2795
|
-
return $ ? w = m.value.highlight(p, {
|
|
2796
|
-
language: y,
|
|
2782
|
+
h.use(ro, { katexRef: u }), h.use(Vt, { figcaption: !0 }), h.use(io), h.use(Ut), h.use(ao, { mdHeadingId: e.mdHeadingId, headsRef: d }), h.use(qt), e.noMermaid || h.use(lo, { themeRef: a }), h.set({
|
|
2783
|
+
highlight: (y, C) => {
|
|
2784
|
+
let $;
|
|
2785
|
+
!e.noHighlight && m.value ? m.value.getLanguage(C) ? $ = m.value.highlight(y, {
|
|
2786
|
+
language: C,
|
|
2797
2787
|
ignoreIllegals: !0
|
|
2798
|
-
}).value :
|
|
2788
|
+
}).value : $ = m.value.highlightAuto(y).value : $ = h.utils.escapeHtml(y);
|
|
2789
|
+
const T = r ? ol($.trim()) : `<span class="code-block">${$.trim()}</span>`;
|
|
2790
|
+
return `<pre><code class="language-${C}" language=${C}>${T}</code></pre>`;
|
|
2799
2791
|
}
|
|
2800
|
-
}), o(h);
|
|
2801
|
-
const
|
|
2792
|
+
}), so(h), o(h);
|
|
2793
|
+
const p = B(e.sanitize(h.render(e.value))), v = ve(
|
|
2802
2794
|
async () => {
|
|
2803
|
-
|
|
2795
|
+
d.value = [], p.value = e.sanitize(h.render(e.value)), k.emit(t, "buildFinished", p.value), e.onHtmlChanged(p.value), f();
|
|
2804
2796
|
},
|
|
2805
|
-
(
|
|
2806
|
-
),
|
|
2807
|
-
return
|
|
2808
|
-
() =>
|
|
2809
|
-
(
|
|
2810
|
-
e.onGetCatalog(
|
|
2797
|
+
(l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : n ? 0 : 500
|
|
2798
|
+
), b = U(() => e.noHighlight || m.value);
|
|
2799
|
+
return S([ne(e, "value"), b, c], v), S(
|
|
2800
|
+
() => d.value,
|
|
2801
|
+
(y) => {
|
|
2802
|
+
e.onGetCatalog(y), k.emit(t, "catalogChanged", y);
|
|
2811
2803
|
}
|
|
2812
|
-
),
|
|
2813
|
-
|
|
2804
|
+
), H(() => {
|
|
2805
|
+
k.on(t, {
|
|
2814
2806
|
name: "pushCatalog",
|
|
2815
2807
|
callback() {
|
|
2816
|
-
|
|
2808
|
+
k.emit(t, "catalogChanged", d.value);
|
|
2817
2809
|
}
|
|
2818
2810
|
});
|
|
2819
|
-
}), { html:
|
|
2820
|
-
},
|
|
2811
|
+
}), { html: p };
|
|
2812
|
+
}, uo = {
|
|
2821
2813
|
value: {
|
|
2822
2814
|
type: String,
|
|
2823
2815
|
default: ""
|
|
@@ -2907,21 +2899,21 @@ const zl = (e) => {
|
|
|
2907
2899
|
type: Boolean,
|
|
2908
2900
|
default: !1
|
|
2909
2901
|
}
|
|
2910
|
-
},
|
|
2902
|
+
}, mo = /* @__PURE__ */ M({
|
|
2911
2903
|
name: "MDEditorContent",
|
|
2912
|
-
props:
|
|
2904
|
+
props: uo,
|
|
2913
2905
|
setup(e) {
|
|
2914
|
-
const
|
|
2915
|
-
inputWrapperRef:
|
|
2906
|
+
const l = x("previewOnly"), o = x("showCodeRowNumber"), t = x("previewTheme"), r = x("editorId"), n = B(), a = B(), {
|
|
2907
|
+
inputWrapperRef: d,
|
|
2916
2908
|
codeMirrorUt: m
|
|
2917
2909
|
} = Zl(e), {
|
|
2918
2910
|
html: u
|
|
2919
|
-
} =
|
|
2911
|
+
} = co(e);
|
|
2920
2912
|
return $l(e, u, n, a, m), Yl(e, u), Jl(e, u), () => i("div", {
|
|
2921
2913
|
class: `${s}-content`
|
|
2922
|
-
}, [!
|
|
2914
|
+
}, [!l && i("div", {
|
|
2923
2915
|
class: `${s}-input-wrapper`,
|
|
2924
|
-
ref:
|
|
2916
|
+
ref: d
|
|
2925
2917
|
}, null), e.setting.preview && i("div", {
|
|
2926
2918
|
id: `${r}-preview-wrapper`,
|
|
2927
2919
|
class: `${s}-preview-wrapper`,
|
|
@@ -2929,7 +2921,7 @@ const zl = (e) => {
|
|
|
2929
2921
|
key: "content-preview-wrapper"
|
|
2930
2922
|
}, [i("article", {
|
|
2931
2923
|
id: `${r}-preview`,
|
|
2932
|
-
class: [`${s}-preview`, `${
|
|
2924
|
+
class: [`${s}-preview`, `${t == null ? void 0 : t.value}-theme`, o && `${s}-scrn`],
|
|
2933
2925
|
innerHTML: u.value
|
|
2934
2926
|
}, null)]), e.setting.htmlPreview && i("div", {
|
|
2935
2927
|
class: `${s}-preview-wrapper`,
|
|
@@ -2939,7 +2931,7 @@ const zl = (e) => {
|
|
|
2939
2931
|
class: `${s}-html`
|
|
2940
2932
|
}, [u.value])])]);
|
|
2941
2933
|
}
|
|
2942
|
-
}),
|
|
2934
|
+
}), fo = /* @__PURE__ */ M({
|
|
2943
2935
|
props: {
|
|
2944
2936
|
modelValue: {
|
|
2945
2937
|
type: String,
|
|
@@ -2947,18 +2939,18 @@ const zl = (e) => {
|
|
|
2947
2939
|
}
|
|
2948
2940
|
},
|
|
2949
2941
|
setup(e) {
|
|
2950
|
-
const
|
|
2942
|
+
const l = x("usedLanguageText");
|
|
2951
2943
|
return () => {
|
|
2952
|
-
var o,
|
|
2944
|
+
var o, t;
|
|
2953
2945
|
return i("div", {
|
|
2954
2946
|
class: `${s}-footer-item`
|
|
2955
2947
|
}, [i("label", {
|
|
2956
2948
|
class: `${s}-footer-label`
|
|
2957
|
-
}, [`${(o =
|
|
2949
|
+
}, [`${(o = l.value.footer) == null ? void 0 : o.markdownTotal}:`]), i("span", null, [((t = e.modelValue) == null ? void 0 : t.length) || 0])]);
|
|
2958
2950
|
};
|
|
2959
2951
|
}
|
|
2960
2952
|
});
|
|
2961
|
-
const
|
|
2953
|
+
const go = {
|
|
2962
2954
|
checked: {
|
|
2963
2955
|
type: Boolean,
|
|
2964
2956
|
default: !1
|
|
@@ -2968,8 +2960,8 @@ const fo = {
|
|
|
2968
2960
|
default: () => {
|
|
2969
2961
|
}
|
|
2970
2962
|
}
|
|
2971
|
-
},
|
|
2972
|
-
props:
|
|
2963
|
+
}, ho = /* @__PURE__ */ M({
|
|
2964
|
+
props: go,
|
|
2973
2965
|
setup(e) {
|
|
2974
2966
|
return () => i("div", {
|
|
2975
2967
|
class: [`${s}-checkbox`, e.checked && `${s}-checkbox-checked`],
|
|
@@ -2978,7 +2970,7 @@ const fo = {
|
|
|
2978
2970
|
}
|
|
2979
2971
|
}, null);
|
|
2980
2972
|
}
|
|
2981
|
-
}),
|
|
2973
|
+
}), vo = {
|
|
2982
2974
|
scrollAuto: {
|
|
2983
2975
|
type: Boolean
|
|
2984
2976
|
},
|
|
@@ -2987,10 +2979,10 @@ const fo = {
|
|
|
2987
2979
|
default: () => {
|
|
2988
2980
|
}
|
|
2989
2981
|
}
|
|
2990
|
-
},
|
|
2991
|
-
props:
|
|
2982
|
+
}, po = /* @__PURE__ */ M({
|
|
2983
|
+
props: vo,
|
|
2992
2984
|
setup(e) {
|
|
2993
|
-
const
|
|
2985
|
+
const l = x("usedLanguageText");
|
|
2994
2986
|
return () => {
|
|
2995
2987
|
var o;
|
|
2996
2988
|
return i("div", {
|
|
@@ -3000,13 +2992,13 @@ const fo = {
|
|
|
3000
2992
|
onClick: () => {
|
|
3001
2993
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
3002
2994
|
}
|
|
3003
|
-
}, [(o =
|
|
2995
|
+
}, [(o = l.value.footer) == null ? void 0 : o.scrollAuto]), i(ho, {
|
|
3004
2996
|
checked: e.scrollAuto,
|
|
3005
2997
|
onChange: e.onScrollAutoChange
|
|
3006
2998
|
}, null)]);
|
|
3007
2999
|
};
|
|
3008
3000
|
}
|
|
3009
|
-
}),
|
|
3001
|
+
}), bo = {
|
|
3010
3002
|
modelValue: {
|
|
3011
3003
|
type: String,
|
|
3012
3004
|
default: ""
|
|
@@ -3026,41 +3018,41 @@ const fo = {
|
|
|
3026
3018
|
defFooters: {
|
|
3027
3019
|
type: Object
|
|
3028
3020
|
}
|
|
3029
|
-
},
|
|
3021
|
+
}, ko = /* @__PURE__ */ M({
|
|
3030
3022
|
name: "MDEditorFooter",
|
|
3031
|
-
props:
|
|
3023
|
+
props: bo,
|
|
3032
3024
|
setup(e) {
|
|
3033
|
-
const
|
|
3034
|
-
const
|
|
3025
|
+
const l = U(() => {
|
|
3026
|
+
const t = e.footers.indexOf("="), r = t === -1 ? e.footers : e.footers.slice(0, t), n = t === -1 ? [] : e.footers.slice(t, Number.MAX_SAFE_INTEGER);
|
|
3035
3027
|
return [r, n];
|
|
3036
|
-
}), o = (
|
|
3037
|
-
if (
|
|
3038
|
-
switch (
|
|
3028
|
+
}), o = (t) => {
|
|
3029
|
+
if (kt.includes(t))
|
|
3030
|
+
switch (t) {
|
|
3039
3031
|
case "markdownTotal":
|
|
3040
|
-
return i(
|
|
3032
|
+
return i(fo, {
|
|
3041
3033
|
modelValue: e.modelValue
|
|
3042
3034
|
}, null);
|
|
3043
3035
|
case "scrollSwitch":
|
|
3044
|
-
return i(
|
|
3036
|
+
return i(po, {
|
|
3045
3037
|
scrollAuto: e.scrollAuto,
|
|
3046
3038
|
onScrollAutoChange: e.onScrollAutoChange
|
|
3047
3039
|
}, null);
|
|
3048
3040
|
}
|
|
3049
3041
|
else
|
|
3050
|
-
return e.defFooters instanceof Array ? e.defFooters[
|
|
3042
|
+
return e.defFooters instanceof Array ? e.defFooters[t] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[t] || "";
|
|
3051
3043
|
};
|
|
3052
3044
|
return () => {
|
|
3053
|
-
const
|
|
3045
|
+
const t = l.value[0].map((n) => o(n)), r = l.value[1].map((n) => o(n));
|
|
3054
3046
|
return i("div", {
|
|
3055
3047
|
class: `${s}-footer`
|
|
3056
3048
|
}, [i("div", {
|
|
3057
3049
|
class: `${s}-footer-left`
|
|
3058
|
-
}, [
|
|
3050
|
+
}, [t]), i("div", {
|
|
3059
3051
|
class: `${s}-footer-right`
|
|
3060
3052
|
}, [r])]);
|
|
3061
3053
|
};
|
|
3062
3054
|
}
|
|
3063
|
-
}),
|
|
3055
|
+
}), yo = {
|
|
3064
3056
|
tocItem: {
|
|
3065
3057
|
type: Object,
|
|
3066
3058
|
default: () => ({})
|
|
@@ -3083,27 +3075,27 @@ const fo = {
|
|
|
3083
3075
|
type: Number,
|
|
3084
3076
|
default: 0
|
|
3085
3077
|
}
|
|
3086
|
-
},
|
|
3087
|
-
props:
|
|
3078
|
+
}, $t = /* @__PURE__ */ M({
|
|
3079
|
+
props: yo,
|
|
3088
3080
|
setup(e) {
|
|
3089
3081
|
return () => {
|
|
3090
3082
|
const {
|
|
3091
|
-
tocItem:
|
|
3083
|
+
tocItem: l,
|
|
3092
3084
|
mdHeadingId: o,
|
|
3093
|
-
scrollElement:
|
|
3085
|
+
scrollElement: t,
|
|
3094
3086
|
onClick: r,
|
|
3095
3087
|
scrollElementOffsetTop: n
|
|
3096
3088
|
} = e;
|
|
3097
3089
|
return i("div", {
|
|
3098
|
-
class: [`${s}-catalog-link`,
|
|
3090
|
+
class: [`${s}-catalog-link`, l.active && `${s}-catalog-active`],
|
|
3099
3091
|
onClick: (a) => {
|
|
3100
|
-
r(a,
|
|
3101
|
-
const
|
|
3092
|
+
r(a, l), a.stopPropagation();
|
|
3093
|
+
const d = o(l.text, l.level, l.index), m = document.getElementById(d), u = t instanceof Element ? t : document.querySelector(t);
|
|
3102
3094
|
if (m && u) {
|
|
3103
|
-
let
|
|
3104
|
-
if (u.contains(
|
|
3105
|
-
for (;
|
|
3106
|
-
f +=
|
|
3095
|
+
let c = m.offsetParent, f = m.offsetTop;
|
|
3096
|
+
if (u.contains(c))
|
|
3097
|
+
for (; c && u != c; )
|
|
3098
|
+
f += c == null ? void 0 : c.offsetTop, c = c == null ? void 0 : c.offsetParent;
|
|
3107
3099
|
u == null || u.scrollTo({
|
|
3108
3100
|
top: f - n,
|
|
3109
3101
|
behavior: "smooth"
|
|
@@ -3111,21 +3103,21 @@ const fo = {
|
|
|
3111
3103
|
}
|
|
3112
3104
|
}
|
|
3113
3105
|
}, [i("span", {
|
|
3114
|
-
title:
|
|
3115
|
-
}, [
|
|
3106
|
+
title: l.text
|
|
3107
|
+
}, [l.text]), i("div", {
|
|
3116
3108
|
class: `${s}-catalog-wrapper`
|
|
3117
|
-
}, [
|
|
3109
|
+
}, [l.children && l.children.map((a) => i($t, {
|
|
3118
3110
|
mdHeadingId: o,
|
|
3119
|
-
key: `${
|
|
3111
|
+
key: `${l.text}-link-${a.level}-${a.text}`,
|
|
3120
3112
|
tocItem: a,
|
|
3121
|
-
scrollElement:
|
|
3113
|
+
scrollElement: t,
|
|
3122
3114
|
onClick: r,
|
|
3123
3115
|
scrollElementOffsetTop: n
|
|
3124
3116
|
}, null))])]);
|
|
3125
3117
|
};
|
|
3126
3118
|
}
|
|
3127
3119
|
});
|
|
3128
|
-
const
|
|
3120
|
+
const Co = {
|
|
3129
3121
|
/**
|
|
3130
3122
|
* 编辑器的Id,务必与需要绑定的编辑器Id相同
|
|
3131
3123
|
*/
|
|
@@ -3174,26 +3166,26 @@ const yo = {
|
|
|
3174
3166
|
onClick: {
|
|
3175
3167
|
type: Function
|
|
3176
3168
|
}
|
|
3177
|
-
},
|
|
3169
|
+
}, he = /* @__PURE__ */ M({
|
|
3178
3170
|
name: "MdCatalog",
|
|
3179
|
-
props:
|
|
3171
|
+
props: Co,
|
|
3180
3172
|
emits: ["onClick"],
|
|
3181
|
-
setup(e,
|
|
3182
|
-
const o = e.editorId,
|
|
3173
|
+
setup(e, l) {
|
|
3174
|
+
const o = e.editorId, t = q({
|
|
3183
3175
|
list: [],
|
|
3184
3176
|
show: !1,
|
|
3185
3177
|
scrollElement: e.scrollElement || `#${o}-preview-wrapper`
|
|
3186
|
-
}), r =
|
|
3178
|
+
}), r = U(() => {
|
|
3187
3179
|
const a = [];
|
|
3188
|
-
return
|
|
3189
|
-
text:
|
|
3180
|
+
return t.list.forEach(({
|
|
3181
|
+
text: d,
|
|
3190
3182
|
level: m,
|
|
3191
3183
|
active: u
|
|
3192
|
-
},
|
|
3184
|
+
}, c) => {
|
|
3193
3185
|
const f = {
|
|
3194
3186
|
level: m,
|
|
3195
|
-
text:
|
|
3196
|
-
index:
|
|
3187
|
+
text: d,
|
|
3188
|
+
index: c + 1,
|
|
3197
3189
|
active: !!u
|
|
3198
3190
|
};
|
|
3199
3191
|
if (a.length === 0)
|
|
@@ -3201,16 +3193,16 @@ const yo = {
|
|
|
3201
3193
|
else {
|
|
3202
3194
|
let h = a[a.length - 1];
|
|
3203
3195
|
if (f.level > h.level)
|
|
3204
|
-
for (let
|
|
3196
|
+
for (let p = h.level + 1; p <= 6; p++) {
|
|
3205
3197
|
const {
|
|
3206
|
-
children:
|
|
3198
|
+
children: v
|
|
3207
3199
|
} = h;
|
|
3208
|
-
if (!
|
|
3200
|
+
if (!v) {
|
|
3209
3201
|
h.children = [f];
|
|
3210
3202
|
break;
|
|
3211
3203
|
}
|
|
3212
|
-
if (h =
|
|
3213
|
-
|
|
3204
|
+
if (h = v[v.length - 1], f.level <= h.level) {
|
|
3205
|
+
v.push(f);
|
|
3214
3206
|
break;
|
|
3215
3207
|
}
|
|
3216
3208
|
}
|
|
@@ -3219,43 +3211,43 @@ const yo = {
|
|
|
3219
3211
|
}
|
|
3220
3212
|
}), a;
|
|
3221
3213
|
});
|
|
3222
|
-
|
|
3223
|
-
|
|
3214
|
+
H(() => {
|
|
3215
|
+
k.on(o, {
|
|
3224
3216
|
name: "catalogChanged",
|
|
3225
3217
|
callback: (a) => {
|
|
3226
|
-
|
|
3227
|
-
...
|
|
3218
|
+
t.list = a.map((d, m) => m === 0 ? {
|
|
3219
|
+
...d,
|
|
3228
3220
|
active: !0
|
|
3229
3221
|
} : {
|
|
3230
|
-
...
|
|
3222
|
+
...d
|
|
3231
3223
|
});
|
|
3232
3224
|
}
|
|
3233
|
-
}),
|
|
3225
|
+
}), k.emit(o, "pushCatalog");
|
|
3234
3226
|
});
|
|
3235
3227
|
const n = () => {
|
|
3236
|
-
var
|
|
3237
|
-
const a =
|
|
3238
|
-
(
|
|
3239
|
-
if (
|
|
3228
|
+
var d;
|
|
3229
|
+
const a = t.scrollElement instanceof HTMLElement ? t.scrollElement : document.querySelector(t.scrollElement);
|
|
3230
|
+
(d = a === document.documentElement ? window : a) == null || d.addEventListener("scroll", nl(() => {
|
|
3231
|
+
if (t.list.length === 0)
|
|
3240
3232
|
return !1;
|
|
3241
3233
|
const {
|
|
3242
3234
|
activeHead: m
|
|
3243
|
-
} =
|
|
3244
|
-
const h = document.getElementById(e.mdHeadingId(
|
|
3235
|
+
} = t.list.reduce((u, c, f) => {
|
|
3236
|
+
const h = document.getElementById(e.mdHeadingId(c.text, c.level, f + 1));
|
|
3245
3237
|
if (h instanceof HTMLElement) {
|
|
3246
|
-
const
|
|
3247
|
-
if (
|
|
3238
|
+
const p = rl(h, a);
|
|
3239
|
+
if (p < e.offsetTop && p > u.minTop)
|
|
3248
3240
|
return {
|
|
3249
|
-
activeHead:
|
|
3250
|
-
minTop:
|
|
3241
|
+
activeHead: c,
|
|
3242
|
+
minTop: p
|
|
3251
3243
|
};
|
|
3252
3244
|
}
|
|
3253
3245
|
return u;
|
|
3254
3246
|
}, {
|
|
3255
|
-
activeHead:
|
|
3247
|
+
activeHead: t.list[0],
|
|
3256
3248
|
minTop: Number.MIN_SAFE_INTEGER
|
|
3257
3249
|
});
|
|
3258
|
-
|
|
3250
|
+
t.list = t.list.map((u) => u === m ? {
|
|
3259
3251
|
...u,
|
|
3260
3252
|
active: !0
|
|
3261
3253
|
} : {
|
|
@@ -3264,111 +3256,111 @@ const yo = {
|
|
|
3264
3256
|
});
|
|
3265
3257
|
}));
|
|
3266
3258
|
};
|
|
3267
|
-
return
|
|
3268
|
-
n(),
|
|
3269
|
-
name:
|
|
3259
|
+
return H(() => {
|
|
3260
|
+
n(), k.on(o, {
|
|
3261
|
+
name: Ce,
|
|
3270
3262
|
callback(a) {
|
|
3271
|
-
a &&
|
|
3263
|
+
a && Y(n);
|
|
3272
3264
|
}
|
|
3273
3265
|
});
|
|
3274
3266
|
}), () => i("div", {
|
|
3275
3267
|
class: `${s}-catalog${e.theme === "dark" ? "-dark" : ""} ${e.class}`
|
|
3276
|
-
}, [r.value.map((a) => i(
|
|
3268
|
+
}, [r.value.map((a) => i($t, {
|
|
3277
3269
|
mdHeadingId: e.mdHeadingId,
|
|
3278
3270
|
tocItem: a,
|
|
3279
3271
|
key: `link-${a.level}-${a.text}`,
|
|
3280
|
-
scrollElement:
|
|
3281
|
-
onClick: (
|
|
3282
|
-
e.onClick ? e.onClick(
|
|
3272
|
+
scrollElement: t.scrollElement,
|
|
3273
|
+
onClick: (d, m) => {
|
|
3274
|
+
e.onClick ? e.onClick(d, m) : l.emit("onClick", d, m);
|
|
3283
3275
|
},
|
|
3284
3276
|
scrollElementOffsetTop: e.scrollElementOffsetTop
|
|
3285
3277
|
}, null))]);
|
|
3286
3278
|
}
|
|
3287
|
-
}),
|
|
3288
|
-
const { editorId: o, previewOnly:
|
|
3279
|
+
}), $o = (e, l) => {
|
|
3280
|
+
const { editorId: o, previewOnly: t } = e, r = q({
|
|
3289
3281
|
// 是否已编译成html
|
|
3290
3282
|
buildFinished: !1,
|
|
3291
3283
|
// 存储当前最新的html
|
|
3292
3284
|
html: ""
|
|
3293
3285
|
});
|
|
3294
|
-
|
|
3286
|
+
S(
|
|
3295
3287
|
() => e.modelValue,
|
|
3296
3288
|
() => {
|
|
3297
3289
|
r.buildFinished = !1;
|
|
3298
3290
|
}
|
|
3299
|
-
),
|
|
3300
|
-
|
|
3291
|
+
), H(() => {
|
|
3292
|
+
t || (k.on(o, {
|
|
3301
3293
|
name: "buildFinished",
|
|
3302
3294
|
callback(n) {
|
|
3303
3295
|
r.buildFinished = !0, r.html = n;
|
|
3304
3296
|
}
|
|
3305
|
-
}),
|
|
3306
|
-
name:
|
|
3297
|
+
}), k.on(o, {
|
|
3298
|
+
name: pe,
|
|
3307
3299
|
callback() {
|
|
3308
3300
|
const n = new Promise((a) => {
|
|
3309
3301
|
if (r.buildFinished)
|
|
3310
3302
|
a(r.html);
|
|
3311
3303
|
else {
|
|
3312
|
-
const
|
|
3313
|
-
a(m),
|
|
3304
|
+
const d = (m) => {
|
|
3305
|
+
a(m), k.remove(o, "buildFinished", d);
|
|
3314
3306
|
};
|
|
3315
|
-
|
|
3307
|
+
k.on(o, {
|
|
3316
3308
|
name: "buildFinished",
|
|
3317
|
-
callback:
|
|
3309
|
+
callback: d
|
|
3318
3310
|
});
|
|
3319
3311
|
}
|
|
3320
3312
|
});
|
|
3321
|
-
e.onSave ? e.onSave(e.modelValue, n) :
|
|
3313
|
+
e.onSave ? e.onSave(e.modelValue, n) : l.emit("onSave", e.modelValue, n);
|
|
3322
3314
|
}
|
|
3323
3315
|
}));
|
|
3324
3316
|
});
|
|
3325
|
-
},
|
|
3317
|
+
}, wo = (e) => {
|
|
3326
3318
|
var n;
|
|
3327
|
-
const { editorId:
|
|
3328
|
-
|
|
3319
|
+
const { editorId: l, previewOnly: o } = e, t = (n = A == null ? void 0 : A.editorExtensions) == null ? void 0 : n.highlight;
|
|
3320
|
+
Z("editorId", l), Z("tabWidth", e.tabWidth), Z(
|
|
3329
3321
|
"theme",
|
|
3330
|
-
|
|
3331
|
-
),
|
|
3322
|
+
U(() => e.theme)
|
|
3323
|
+
), Z(
|
|
3332
3324
|
"highlight",
|
|
3333
|
-
|
|
3325
|
+
U(() => {
|
|
3334
3326
|
const a = {
|
|
3335
|
-
...
|
|
3336
|
-
...
|
|
3337
|
-
},
|
|
3327
|
+
...Ze,
|
|
3328
|
+
...t == null ? void 0 : t.css
|
|
3329
|
+
}, d = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
|
|
3338
3330
|
return {
|
|
3339
|
-
js: (
|
|
3340
|
-
css: a[e.codeTheme] ? a[e.codeTheme][
|
|
3331
|
+
js: (t == null ? void 0 : t.js) || zt,
|
|
3332
|
+
css: a[e.codeTheme] ? a[e.codeTheme][d] : Ze.atom[d]
|
|
3341
3333
|
};
|
|
3342
3334
|
})
|
|
3343
|
-
),
|
|
3344
|
-
const r =
|
|
3345
|
-
var
|
|
3335
|
+
), Z("previewOnly", o), Z("showCodeRowNumber", e.showCodeRowNumber);
|
|
3336
|
+
const r = U(() => {
|
|
3337
|
+
var d;
|
|
3346
3338
|
const a = {
|
|
3347
|
-
...
|
|
3348
|
-
...(
|
|
3339
|
+
...ze,
|
|
3340
|
+
...(d = A == null ? void 0 : A.editorConfig) == null ? void 0 : d.languageUserDefined
|
|
3349
3341
|
};
|
|
3350
|
-
return a[e.language] ? a[e.language] :
|
|
3342
|
+
return a[e.language] ? a[e.language] : ze["zh-CN"];
|
|
3351
3343
|
});
|
|
3352
|
-
|
|
3344
|
+
Z("usedLanguageText", r), Z(
|
|
3353
3345
|
"previewTheme",
|
|
3354
|
-
|
|
3346
|
+
U(() => e.previewTheme)
|
|
3355
3347
|
);
|
|
3356
|
-
},
|
|
3357
|
-
var u,
|
|
3358
|
-
const { noPrettier:
|
|
3359
|
-
|
|
3360
|
-
var
|
|
3361
|
-
const
|
|
3362
|
-
|
|
3363
|
-
const
|
|
3364
|
-
|
|
3348
|
+
}, To = (e) => {
|
|
3349
|
+
var u, c, f, h, p, v;
|
|
3350
|
+
const { noPrettier: l, previewOnly: o, noIconfont: t, noUploadImg: r } = e, { editorExtensions: n } = A, a = l || !!((c = (u = A.editorExtensions) == null ? void 0 : u.prettier) != null && c.prettierInstance), d = l || !!((h = (f = A.editorExtensions) == null ? void 0 : f.prettier) != null && h.parserMarkdownInstance), m = r || !!((v = (p = A.editorExtensions) == null ? void 0 : p.cropper) != null && v.instance);
|
|
3351
|
+
H(() => {
|
|
3352
|
+
var I, w, F, j;
|
|
3353
|
+
const b = document.createElement("script");
|
|
3354
|
+
b.src = (n == null ? void 0 : n.iconfont) || Kt, b.id = `${s}-icon`;
|
|
3355
|
+
const y = document.createElement("script"), C = document.createElement("script");
|
|
3356
|
+
y.src = ((I = n == null ? void 0 : n.prettier) == null ? void 0 : I.standaloneJs) || Ge.main, y.id = `${s}-prettier`, C.src = ((w = n == null ? void 0 : n.prettier) == null ? void 0 : w.parserMarkdownJs) || Ge.markdown, C.id = `${s}-prettierMD`;
|
|
3365
3357
|
const $ = document.createElement("link");
|
|
3366
|
-
$.rel = "stylesheet", $.href = ((
|
|
3367
|
-
const
|
|
3368
|
-
|
|
3358
|
+
$.rel = "stylesheet", $.href = ((F = n == null ? void 0 : n.cropper) == null ? void 0 : F.css) || Ke.css, $.id = `${s}-cropperCss`;
|
|
3359
|
+
const T = document.createElement("script");
|
|
3360
|
+
T.src = ((j = n == null ? void 0 : n.cropper) == null ? void 0 : j.js) || Ke.js, T.id = `${s}-cropper`, t || V(b), o || (m || (V($), V(T)), a || V(y), d || V(C));
|
|
3369
3361
|
});
|
|
3370
|
-
},
|
|
3371
|
-
const { editorId: o, previewOnly:
|
|
3362
|
+
}, So = (e, l) => {
|
|
3363
|
+
const { editorId: o, previewOnly: t } = e, r = q({
|
|
3372
3364
|
pageFullscreen: e.pageFullscreen,
|
|
3373
3365
|
fullscreen: !1,
|
|
3374
3366
|
preview: e.preview,
|
|
@@ -3377,66 +3369,66 @@ const yo = {
|
|
|
3377
3369
|
r[m] = u === void 0 ? !r[m] : u, m === "preview" && r.preview ? r.htmlPreview = !1 : m === "htmlPreview" && r.htmlPreview && (r.preview = !1);
|
|
3378
3370
|
};
|
|
3379
3371
|
let a = "";
|
|
3380
|
-
const
|
|
3372
|
+
const d = () => {
|
|
3381
3373
|
r.pageFullscreen || r.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = a;
|
|
3382
3374
|
};
|
|
3383
|
-
return
|
|
3384
|
-
|
|
3375
|
+
return S(() => [r.pageFullscreen, r.fullscreen], d), H(() => {
|
|
3376
|
+
t || k.on(o, {
|
|
3385
3377
|
name: "uploadImage",
|
|
3386
3378
|
callback(m, u) {
|
|
3387
|
-
const
|
|
3388
|
-
|
|
3379
|
+
const c = (f) => {
|
|
3380
|
+
k.emit(o, "replace", "image", {
|
|
3389
3381
|
desc: "",
|
|
3390
3382
|
urls: f
|
|
3391
3383
|
}), u && u();
|
|
3392
3384
|
};
|
|
3393
|
-
e.onUploadImg ? e.onUploadImg(m,
|
|
3385
|
+
e.onUploadImg ? e.onUploadImg(m, c) : l.emit("onUploadImg", m, c);
|
|
3394
3386
|
}
|
|
3395
|
-
}), a = document.body.style.overflow,
|
|
3387
|
+
}), a = document.body.style.overflow, d();
|
|
3396
3388
|
}), [r, n];
|
|
3397
|
-
},
|
|
3398
|
-
const { editorId:
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
name:
|
|
3389
|
+
}, xo = (e) => {
|
|
3390
|
+
const { editorId: l } = e, o = B(!1);
|
|
3391
|
+
H(() => {
|
|
3392
|
+
k.on(l, {
|
|
3393
|
+
name: Le,
|
|
3402
3394
|
callback: (r) => {
|
|
3403
3395
|
r === void 0 ? o.value = !o.value : o.value = r;
|
|
3404
3396
|
}
|
|
3405
3397
|
});
|
|
3406
3398
|
});
|
|
3407
|
-
const
|
|
3408
|
-
return [o,
|
|
3409
|
-
},
|
|
3399
|
+
const t = U(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog"));
|
|
3400
|
+
return [o, t];
|
|
3401
|
+
}, Eo = (e, l, o, t, r) => {
|
|
3410
3402
|
const { editorId: n } = e;
|
|
3411
|
-
|
|
3412
|
-
() =>
|
|
3413
|
-
(
|
|
3414
|
-
|
|
3403
|
+
S(
|
|
3404
|
+
() => t.pageFullscreen,
|
|
3405
|
+
(d) => {
|
|
3406
|
+
k.emit(n, Je, d);
|
|
3415
3407
|
}
|
|
3416
|
-
),
|
|
3417
|
-
() =>
|
|
3418
|
-
(
|
|
3419
|
-
|
|
3408
|
+
), S(
|
|
3409
|
+
() => t.fullscreen,
|
|
3410
|
+
(d) => {
|
|
3411
|
+
k.emit(n, Ye, d);
|
|
3420
3412
|
}
|
|
3421
|
-
),
|
|
3422
|
-
() =>
|
|
3423
|
-
(
|
|
3424
|
-
|
|
3413
|
+
), S(
|
|
3414
|
+
() => t.preview,
|
|
3415
|
+
(d) => {
|
|
3416
|
+
k.emit(n, Ce, d);
|
|
3425
3417
|
}
|
|
3426
|
-
),
|
|
3427
|
-
() =>
|
|
3428
|
-
(
|
|
3429
|
-
|
|
3418
|
+
), S(
|
|
3419
|
+
() => t.htmlPreview,
|
|
3420
|
+
(d) => {
|
|
3421
|
+
k.emit(n, Qe, d);
|
|
3430
3422
|
}
|
|
3431
|
-
),
|
|
3432
|
-
|
|
3423
|
+
), S(o, (d) => {
|
|
3424
|
+
k.emit(n, et, d);
|
|
3433
3425
|
});
|
|
3434
3426
|
const a = {
|
|
3435
|
-
on(
|
|
3436
|
-
switch (
|
|
3427
|
+
on(d, m) {
|
|
3428
|
+
switch (d) {
|
|
3437
3429
|
case "pageFullscreen": {
|
|
3438
|
-
|
|
3439
|
-
name:
|
|
3430
|
+
k.on(n, {
|
|
3431
|
+
name: Je,
|
|
3440
3432
|
callback(u) {
|
|
3441
3433
|
m(u);
|
|
3442
3434
|
}
|
|
@@ -3444,8 +3436,8 @@ const yo = {
|
|
|
3444
3436
|
break;
|
|
3445
3437
|
}
|
|
3446
3438
|
case "fullscreen": {
|
|
3447
|
-
|
|
3448
|
-
name:
|
|
3439
|
+
k.on(n, {
|
|
3440
|
+
name: Ye,
|
|
3449
3441
|
callback(u) {
|
|
3450
3442
|
m(u);
|
|
3451
3443
|
}
|
|
@@ -3453,8 +3445,8 @@ const yo = {
|
|
|
3453
3445
|
break;
|
|
3454
3446
|
}
|
|
3455
3447
|
case "preview": {
|
|
3456
|
-
|
|
3457
|
-
name:
|
|
3448
|
+
k.on(n, {
|
|
3449
|
+
name: Ce,
|
|
3458
3450
|
callback(u) {
|
|
3459
3451
|
m(u);
|
|
3460
3452
|
}
|
|
@@ -3462,8 +3454,8 @@ const yo = {
|
|
|
3462
3454
|
break;
|
|
3463
3455
|
}
|
|
3464
3456
|
case "htmlPreview": {
|
|
3465
|
-
|
|
3466
|
-
name:
|
|
3457
|
+
k.on(n, {
|
|
3458
|
+
name: Qe,
|
|
3467
3459
|
callback(u) {
|
|
3468
3460
|
m(u);
|
|
3469
3461
|
}
|
|
@@ -3471,8 +3463,8 @@ const yo = {
|
|
|
3471
3463
|
break;
|
|
3472
3464
|
}
|
|
3473
3465
|
case "catalog": {
|
|
3474
|
-
|
|
3475
|
-
name:
|
|
3466
|
+
k.on(n, {
|
|
3467
|
+
name: et,
|
|
3476
3468
|
callback(u) {
|
|
3477
3469
|
m(u);
|
|
3478
3470
|
}
|
|
@@ -3481,33 +3473,33 @@ const yo = {
|
|
|
3481
3473
|
}
|
|
3482
3474
|
}
|
|
3483
3475
|
},
|
|
3484
|
-
togglePageFullscreen(
|
|
3485
|
-
r("pageFullscreen",
|
|
3476
|
+
togglePageFullscreen(d) {
|
|
3477
|
+
r("pageFullscreen", d);
|
|
3486
3478
|
},
|
|
3487
|
-
toggleFullscreen(
|
|
3488
|
-
|
|
3479
|
+
toggleFullscreen(d) {
|
|
3480
|
+
k.emit(n, yt, d);
|
|
3489
3481
|
},
|
|
3490
|
-
togglePreview(
|
|
3491
|
-
r("preview",
|
|
3482
|
+
togglePreview(d) {
|
|
3483
|
+
r("preview", d);
|
|
3492
3484
|
},
|
|
3493
|
-
toggleHtmlPreview(
|
|
3494
|
-
r("htmlPreview",
|
|
3485
|
+
toggleHtmlPreview(d) {
|
|
3486
|
+
r("htmlPreview", d);
|
|
3495
3487
|
},
|
|
3496
|
-
toggleCatalog(
|
|
3497
|
-
|
|
3488
|
+
toggleCatalog(d) {
|
|
3489
|
+
k.emit(n, Le, d);
|
|
3498
3490
|
},
|
|
3499
3491
|
triggerSave() {
|
|
3500
|
-
|
|
3492
|
+
k.emit(n, pe);
|
|
3501
3493
|
},
|
|
3502
|
-
insert(
|
|
3503
|
-
|
|
3494
|
+
insert(d) {
|
|
3495
|
+
k.emit(n, "replace", "universal", { generate: d });
|
|
3504
3496
|
},
|
|
3505
3497
|
focus() {
|
|
3506
|
-
|
|
3498
|
+
k.emit(n, Ct);
|
|
3507
3499
|
}
|
|
3508
3500
|
};
|
|
3509
|
-
|
|
3510
|
-
},
|
|
3501
|
+
l.expose(a);
|
|
3502
|
+
}, Lo = (e) => e, Ao = {
|
|
3511
3503
|
/**
|
|
3512
3504
|
* 主题
|
|
3513
3505
|
*
|
|
@@ -3605,7 +3597,7 @@ const yo = {
|
|
|
3605
3597
|
*/
|
|
3606
3598
|
toolbars: {
|
|
3607
3599
|
type: Array,
|
|
3608
|
-
default:
|
|
3600
|
+
default: bt
|
|
3609
3601
|
},
|
|
3610
3602
|
/**
|
|
3611
3603
|
* 工具栏选择不显示
|
|
@@ -3687,7 +3679,7 @@ const yo = {
|
|
|
3687
3679
|
*/
|
|
3688
3680
|
mdHeadingId: {
|
|
3689
3681
|
type: Function,
|
|
3690
|
-
default:
|
|
3682
|
+
default: Lo
|
|
3691
3683
|
},
|
|
3692
3684
|
/**
|
|
3693
3685
|
* 表格预设格子数
|
|
@@ -3762,7 +3754,7 @@ const yo = {
|
|
|
3762
3754
|
*/
|
|
3763
3755
|
footers: {
|
|
3764
3756
|
type: Array,
|
|
3765
|
-
default:
|
|
3757
|
+
default: kt
|
|
3766
3758
|
},
|
|
3767
3759
|
/**
|
|
3768
3760
|
* 是否默认激活输入框和预览框同步滚动
|
|
@@ -3878,7 +3870,7 @@ const yo = {
|
|
|
3878
3870
|
type: Boolean,
|
|
3879
3871
|
default: !1
|
|
3880
3872
|
}
|
|
3881
|
-
},
|
|
3873
|
+
}, Io = [
|
|
3882
3874
|
"onChange",
|
|
3883
3875
|
"onSave",
|
|
3884
3876
|
"onUploadImg",
|
|
@@ -3889,51 +3881,51 @@ const yo = {
|
|
|
3889
3881
|
"onBlur",
|
|
3890
3882
|
"onFocus"
|
|
3891
3883
|
];
|
|
3892
|
-
const
|
|
3884
|
+
const J = /* @__PURE__ */ M({
|
|
3893
3885
|
name: "MdEditorV3",
|
|
3894
|
-
props:
|
|
3895
|
-
emits:
|
|
3896
|
-
setup(e,
|
|
3886
|
+
props: Ao,
|
|
3887
|
+
emits: Io,
|
|
3888
|
+
setup(e, l) {
|
|
3897
3889
|
const {
|
|
3898
3890
|
editorId: o,
|
|
3899
|
-
previewOnly:
|
|
3891
|
+
previewOnly: t,
|
|
3900
3892
|
noKatex: r,
|
|
3901
3893
|
noMermaid: n,
|
|
3902
3894
|
noPrettier: a,
|
|
3903
|
-
noUploadImg:
|
|
3895
|
+
noUploadImg: d,
|
|
3904
3896
|
noHighlight: m
|
|
3905
|
-
} = e, u =
|
|
3897
|
+
} = e, u = q({
|
|
3906
3898
|
scrollAuto: e.scrollAuto
|
|
3907
3899
|
});
|
|
3908
|
-
|
|
3909
|
-
const [
|
|
3910
|
-
return
|
|
3911
|
-
|
|
3912
|
-
}),
|
|
3913
|
-
var
|
|
3914
|
-
const
|
|
3900
|
+
$o(e, l), wo(e), To(e);
|
|
3901
|
+
const [c, f] = So(e, l), [h, p] = xo(e);
|
|
3902
|
+
return Se(() => {
|
|
3903
|
+
k.clear(o);
|
|
3904
|
+
}), Eo(e, l, h, c, f), () => {
|
|
3905
|
+
var y;
|
|
3906
|
+
const v = W({
|
|
3915
3907
|
props: e,
|
|
3916
|
-
ctx:
|
|
3917
|
-
}, "defToolbars"),
|
|
3908
|
+
ctx: l
|
|
3909
|
+
}, "defToolbars"), b = W({
|
|
3918
3910
|
props: e,
|
|
3919
|
-
ctx:
|
|
3911
|
+
ctx: l
|
|
3920
3912
|
}, "defFooters");
|
|
3921
3913
|
return i("div", {
|
|
3922
3914
|
id: o,
|
|
3923
|
-
class: [s, e.class, e.theme === "dark" && `${s}-dark`,
|
|
3915
|
+
class: [s, e.class, e.theme === "dark" && `${s}-dark`, c.fullscreen || c.pageFullscreen ? `${s}-fullscreen` : "", t && `${s}-previewOnly`],
|
|
3924
3916
|
style: e.style
|
|
3925
|
-
}, [!
|
|
3917
|
+
}, [!t && i(kl, {
|
|
3926
3918
|
noPrettier: a,
|
|
3927
3919
|
toolbars: e.toolbars,
|
|
3928
3920
|
toolbarsExclude: e.toolbarsExclude,
|
|
3929
|
-
setting:
|
|
3921
|
+
setting: c,
|
|
3930
3922
|
updateSetting: f,
|
|
3931
3923
|
tableShape: e.tableShape,
|
|
3932
|
-
defToolbars:
|
|
3933
|
-
noUploadImg:
|
|
3934
|
-
}, null), i(
|
|
3924
|
+
defToolbars: v,
|
|
3925
|
+
noUploadImg: d
|
|
3926
|
+
}, null), i(mo, {
|
|
3935
3927
|
value: e.modelValue,
|
|
3936
|
-
setting:
|
|
3928
|
+
setting: c,
|
|
3937
3929
|
mdHeadingId: e.mdHeadingId,
|
|
3938
3930
|
noMermaid: n,
|
|
3939
3931
|
noPrettier: a,
|
|
@@ -3948,28 +3940,28 @@ const G = /* @__PURE__ */ M({
|
|
|
3948
3940
|
maxlength: e.maxLength,
|
|
3949
3941
|
autoDetectCode: e.autoDetectCode,
|
|
3950
3942
|
noHighlight: m,
|
|
3951
|
-
onChange: (
|
|
3952
|
-
e.onChange ? e.onChange(
|
|
3943
|
+
onChange: (C) => {
|
|
3944
|
+
e.onChange ? e.onChange(C) : (l.emit("update:modelValue", C), l.emit("onChange", C));
|
|
3953
3945
|
},
|
|
3954
|
-
onHtmlChanged: (
|
|
3955
|
-
e.onHtmlChanged ? e.onHtmlChanged(
|
|
3946
|
+
onHtmlChanged: (C) => {
|
|
3947
|
+
e.onHtmlChanged ? e.onHtmlChanged(C) : l.emit("onHtmlChanged", C);
|
|
3956
3948
|
},
|
|
3957
|
-
onGetCatalog: (
|
|
3958
|
-
e.onGetCatalog ? e.onGetCatalog(
|
|
3949
|
+
onGetCatalog: (C) => {
|
|
3950
|
+
e.onGetCatalog ? e.onGetCatalog(C) : l.emit("onGetCatalog", C);
|
|
3959
3951
|
},
|
|
3960
|
-
onBlur: (
|
|
3961
|
-
e.onBlur ? e.onBlur(
|
|
3952
|
+
onBlur: (C) => {
|
|
3953
|
+
e.onBlur ? e.onBlur(C) : l.emit("onBlur", C);
|
|
3962
3954
|
},
|
|
3963
|
-
onFocus: (
|
|
3964
|
-
e.onFocus ? e.onFocus(
|
|
3955
|
+
onFocus: (C) => {
|
|
3956
|
+
e.onFocus ? e.onFocus(C) : l.emit("onFocus", C);
|
|
3965
3957
|
}
|
|
3966
|
-
}, null), !
|
|
3958
|
+
}, null), !t && ((y = e.footers) == null ? void 0 : y.length) > 0 && i(ko, {
|
|
3967
3959
|
modelValue: e.modelValue,
|
|
3968
3960
|
footers: e.footers,
|
|
3969
|
-
defFooters:
|
|
3961
|
+
defFooters: b,
|
|
3970
3962
|
scrollAuto: u.scrollAuto,
|
|
3971
|
-
onScrollAutoChange: (
|
|
3972
|
-
}, null),
|
|
3963
|
+
onScrollAutoChange: (C) => u.scrollAuto = C
|
|
3964
|
+
}, null), p.value && !t && i(he, {
|
|
3973
3965
|
theme: e.theme,
|
|
3974
3966
|
style: {
|
|
3975
3967
|
display: h.value ? "block" : "none"
|
|
@@ -3980,7 +3972,7 @@ const G = /* @__PURE__ */ M({
|
|
|
3980
3972
|
}, null)]);
|
|
3981
3973
|
};
|
|
3982
3974
|
}
|
|
3983
|
-
}),
|
|
3975
|
+
}), Ho = {
|
|
3984
3976
|
title: {
|
|
3985
3977
|
type: String,
|
|
3986
3978
|
default: ""
|
|
@@ -3992,26 +3984,26 @@ const G = /* @__PURE__ */ M({
|
|
|
3992
3984
|
onClick: {
|
|
3993
3985
|
type: Function
|
|
3994
3986
|
}
|
|
3995
|
-
},
|
|
3987
|
+
}, $e = /* @__PURE__ */ M({
|
|
3996
3988
|
name: "NormalToolbar",
|
|
3997
|
-
props:
|
|
3989
|
+
props: Ho,
|
|
3998
3990
|
emits: ["onClick"],
|
|
3999
|
-
setup(e,
|
|
3991
|
+
setup(e, l) {
|
|
4000
3992
|
return () => {
|
|
4001
|
-
const o =
|
|
3993
|
+
const o = W({
|
|
4002
3994
|
props: e,
|
|
4003
|
-
ctx:
|
|
3995
|
+
ctx: l
|
|
4004
3996
|
}, "trigger");
|
|
4005
3997
|
return i("div", {
|
|
4006
3998
|
class: `${s}-toolbar-item`,
|
|
4007
3999
|
title: e.title,
|
|
4008
|
-
onClick: (
|
|
4009
|
-
e.onClick instanceof Function ? e.onClick(
|
|
4000
|
+
onClick: (t) => {
|
|
4001
|
+
e.onClick instanceof Function ? e.onClick(t) : l.emit("onClick", t);
|
|
4010
4002
|
}
|
|
4011
4003
|
}, [o]);
|
|
4012
4004
|
};
|
|
4013
4005
|
}
|
|
4014
|
-
}),
|
|
4006
|
+
}), Fo = {
|
|
4015
4007
|
title: {
|
|
4016
4008
|
type: String,
|
|
4017
4009
|
default: ""
|
|
@@ -4030,40 +4022,40 @@ const G = /* @__PURE__ */ M({
|
|
|
4030
4022
|
overlay: {
|
|
4031
4023
|
type: [String, Object]
|
|
4032
4024
|
}
|
|
4033
|
-
},
|
|
4025
|
+
}, we = /* @__PURE__ */ M({
|
|
4034
4026
|
name: "DropdownToolbar",
|
|
4035
|
-
props:
|
|
4027
|
+
props: Fo,
|
|
4036
4028
|
emits: ["onChange"],
|
|
4037
|
-
setup(e,
|
|
4029
|
+
setup(e, l) {
|
|
4038
4030
|
const o = x("editorId");
|
|
4039
4031
|
return () => {
|
|
4040
|
-
const
|
|
4032
|
+
const t = W({
|
|
4041
4033
|
props: e,
|
|
4042
|
-
ctx:
|
|
4043
|
-
}, "trigger"), r =
|
|
4034
|
+
ctx: l
|
|
4035
|
+
}, "trigger"), r = W({
|
|
4044
4036
|
props: e,
|
|
4045
|
-
ctx:
|
|
4037
|
+
ctx: l
|
|
4046
4038
|
}, "overlay");
|
|
4047
|
-
return i(
|
|
4039
|
+
return i(oe, {
|
|
4048
4040
|
relative: `#${o}-toolbar-wrapper`,
|
|
4049
4041
|
visible: e.visible,
|
|
4050
4042
|
onChange: (n) => {
|
|
4051
|
-
e.onChange instanceof Function ? e.onChange(n) :
|
|
4043
|
+
e.onChange instanceof Function ? e.onChange(n) : l.emit("onChange", n);
|
|
4052
4044
|
},
|
|
4053
4045
|
overlay: r
|
|
4054
4046
|
}, {
|
|
4055
4047
|
default: () => [i("div", {
|
|
4056
4048
|
class: `${s}-toolbar-item`,
|
|
4057
4049
|
title: e.title || ""
|
|
4058
|
-
}, [
|
|
4050
|
+
}, [t])]
|
|
4059
4051
|
});
|
|
4060
4052
|
};
|
|
4061
4053
|
}
|
|
4062
4054
|
});
|
|
4063
|
-
function
|
|
4064
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
4055
|
+
function Mo(e) {
|
|
4056
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !xt(e);
|
|
4065
4057
|
}
|
|
4066
|
-
const
|
|
4058
|
+
const Bo = {
|
|
4067
4059
|
title: {
|
|
4068
4060
|
type: String,
|
|
4069
4061
|
default: ""
|
|
@@ -4107,50 +4099,50 @@ const Mo = {
|
|
|
4107
4099
|
onAdjust: {
|
|
4108
4100
|
type: Function
|
|
4109
4101
|
}
|
|
4110
|
-
},
|
|
4102
|
+
}, Te = /* @__PURE__ */ M({
|
|
4111
4103
|
name: "ModalToolbar",
|
|
4112
|
-
props:
|
|
4104
|
+
props: Bo,
|
|
4113
4105
|
emits: ["onClick", "onClose", "onAdjust"],
|
|
4114
|
-
setup(e,
|
|
4106
|
+
setup(e, l) {
|
|
4115
4107
|
return () => {
|
|
4116
|
-
const o =
|
|
4108
|
+
const o = W({
|
|
4117
4109
|
props: e,
|
|
4118
|
-
ctx:
|
|
4119
|
-
}, "trigger"),
|
|
4110
|
+
ctx: l
|
|
4111
|
+
}, "trigger"), t = W({
|
|
4120
4112
|
props: e,
|
|
4121
|
-
ctx:
|
|
4113
|
+
ctx: l
|
|
4122
4114
|
}, "default");
|
|
4123
|
-
return i(
|
|
4115
|
+
return i(xe, null, [i("div", {
|
|
4124
4116
|
class: `${s}-toolbar-item`,
|
|
4125
4117
|
title: e.title,
|
|
4126
4118
|
onClick: () => {
|
|
4127
|
-
e.onClick instanceof Function ? e.onClick() :
|
|
4119
|
+
e.onClick instanceof Function ? e.onClick() : l.emit("onClick");
|
|
4128
4120
|
}
|
|
4129
|
-
}, [o]), i(
|
|
4121
|
+
}, [o]), i(Ae, {
|
|
4130
4122
|
width: e.width,
|
|
4131
4123
|
height: e.height,
|
|
4132
4124
|
title: e.modalTitle,
|
|
4133
4125
|
visible: e.visible,
|
|
4134
4126
|
onClose: () => {
|
|
4135
|
-
e.onClose instanceof Function ? e.onClose() :
|
|
4127
|
+
e.onClose instanceof Function ? e.onClose() : l.emit("onClose");
|
|
4136
4128
|
},
|
|
4137
4129
|
showAdjust: e.showAdjust,
|
|
4138
4130
|
isFullscreen: e.isFullscreen,
|
|
4139
4131
|
onAdjust: (r) => {
|
|
4140
|
-
e.onAdjust instanceof Function ? e.onAdjust(r) :
|
|
4132
|
+
e.onAdjust instanceof Function ? e.onAdjust(r) : l.emit("onAdjust", r);
|
|
4141
4133
|
}
|
|
4142
|
-
},
|
|
4143
|
-
default: () => [
|
|
4134
|
+
}, Mo(t) ? t : {
|
|
4135
|
+
default: () => [t]
|
|
4144
4136
|
})]);
|
|
4145
4137
|
};
|
|
4146
4138
|
}
|
|
4147
4139
|
});
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4140
|
+
J.install = (e) => (e.component(J.name, J), e.component($e.name, $e), e.component(we.name, we), e.component(he.name, he), e.component(Te.name, Te), e);
|
|
4141
|
+
J.NormalToolbar = $e;
|
|
4142
|
+
J.DropdownToolbar = we;
|
|
4143
|
+
J.MdCatalog = he;
|
|
4144
|
+
J.ModalToolbar = Te;
|
|
4145
|
+
J.config = Jt;
|
|
4154
4146
|
export {
|
|
4155
|
-
|
|
4147
|
+
J as default
|
|
4156
4148
|
};
|