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