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