md-editor-v3 6.5.4 → 6.5.6

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.
@@ -1,26 +1,26 @@
1
- import { a as te, D as at } from "./chunks/index.mjs";
2
- import { s as lt, a as nt, M as We } from "./chunks/index3.mjs";
3
- import { C as rt, c as st, a as it, e as ct, b as ut, u as dt, d as mt, f as bt, g as vt, h as gt, i as ht, j as ft, k as pt, M as Tt } from "./chunks/index4.mjs";
4
- import wt from "./ModalToolbar.mjs";
5
- import yt from "./NormalToolbar.mjs";
6
- import { inject as r, watch as N, nextTick as ie, onMounted as K, ref as I, defineComponent as C, createVNode as a, reactive as Y, toRef as ke, computed as P, Fragment as _e, cloneVNode as ne, createApp as Ct, shallowRef as kt, onBeforeUnmount as he } from "vue";
7
- import { g as Z, p as l, b as $t, M as ae, d as xt, a as St } from "./chunks/config.mjs";
8
- import { linkTo as It, throttle as Et, createSmoothScroll as ze, draggingScroll as Lt } from "@vavt/util";
9
- import { deleteLine as Nt, history as $e, undo as At, redo as Dt, defaultKeymap as Rt, historyKeymap as Mt, indentWithTab as Ft } from "@codemirror/commands";
10
- import { markdown as Bt } from "@codemirror/lang-markdown";
11
- import { languages as Pt } from "@codemirror/language-data";
12
- import { EditorState as ce, EditorSelection as U, Compartment as j, StateEffect as re, StateField as qe, RangeSetBuilder as Ht } from "@codemirror/state";
13
- import { placeholder as Ot, EditorView as B, showTooltip as Vt, Decoration as Wt, WidgetType as _t, keymap as zt, drawSelection as qt } from "@codemirror/view";
14
- import { b as h, E as X, R as y, C as Ut, U as fe, a as Ue, c as Ke, O as Ge, d as Kt, e as Gt, T as jt, S as Yt, G as xe } from "./chunks/event-bus.mjs";
15
- import { indentUnit as Zt, syntaxHighlighting as je, HighlightStyle as Ye } from "@codemirror/language";
16
- import { autocompletion as Xt } from "@codemirror/autocomplete";
17
- import { a as Jt } from "./chunks/dom.mjs";
18
- import { I as x, M as Qt } from "./chunks/index2.mjs";
19
- import { b as eo } from "./chunks/index5.mjs";
1
+ import { a as te, D as lt } from "./chunks/index.mjs";
2
+ import { s as nt, a as rt, M as We } from "./chunks/index3.mjs";
3
+ import { e as T, C as st, c as it, a as ct, b as ut, d as dt, u as mt, f as bt, g as vt, h as gt, i as ht, j as pt, k as ft, l as Tt, M as wt } from "./chunks/index4.mjs";
4
+ import yt from "./ModalToolbar.mjs";
5
+ import Ct from "./NormalToolbar.mjs";
6
+ import { inject as r, watch as A, nextTick as ce, onMounted as K, ref as S, defineComponent as w, createVNode as a, reactive as Z, toRef as ke, computed as P, Fragment as _e, cloneVNode as re, createApp as kt, shallowRef as $t, onBeforeUnmount as pe } from "vue";
7
+ import { p as l, g as X, b as xt, M as le, d as St, a as It } from "./chunks/config.mjs";
8
+ import { linkTo as Et, throttle as Lt, createSmoothScroll as ze, draggingScroll as Dt } from "@vavt/util";
9
+ import { deleteLine as Nt, history as $e, undo as At, redo as Rt, defaultKeymap as Mt, historyKeymap as Ft, indentWithTab as Bt } from "@codemirror/commands";
10
+ import { markdown as Pt } from "@codemirror/lang-markdown";
11
+ import { languages as Ht } from "@codemirror/language-data";
12
+ import { EditorState as de, EditorSelection as U, Compartment as Y, StateEffect as se, StateField as qe, RangeSetBuilder as Ot } from "@codemirror/state";
13
+ import { placeholder as Vt, EditorView as B, showTooltip as Wt, Decoration as _t, WidgetType as zt, keymap as qt, drawSelection as Ut } from "@codemirror/view";
14
+ import { indentUnit as Kt, syntaxHighlighting as Ue, HighlightStyle as Ke } from "@codemirror/language";
15
+ import { b as L, E as J, C as Gt, U as fe, a as Ge, c as je, O as Ye, d as jt, R as Yt, e as Zt, T as Xt, S as Jt, G as xe } from "./chunks/event-bus.mjs";
16
+ import { autocompletion as Qt } from "@codemirror/autocomplete";
17
+ import { I as k, M as eo } from "./chunks/index2.mjs";
18
+ import { b as to } from "./chunks/index5.mjs";
19
+ import { a as oo } from "./chunks/dom.mjs";
20
20
  import { tags as b } from "@lezer/highlight";
21
- import { searchKeymap as to } from "@codemirror/search";
21
+ import { searchKeymap as ao } from "@codemirror/search";
22
22
  import { g as Se } from "./chunks/vue-tsx.mjs";
23
- const oo = (e, t, o) => {
23
+ const lo = (e, t, o) => {
24
24
  const n = r("editorId"), i = r("setting");
25
25
  let s = () => {
26
26
  }, c = () => {
@@ -31,262 +31,35 @@ const oo = (e, t, o) => {
31
31
  `#${n} .cm-scroller`
32
32
  ), m = u?.querySelector(
33
33
  `[id="${n}-preview-wrapper"]`
34
- ), f = u?.querySelector(
34
+ ), h = u?.querySelector(
35
35
  `[id="${n}-html-wrapper"]`
36
36
  );
37
- (m || f) && ([c, s] = (m ? lt : nt)(
37
+ (m || h) && ([c, s] = (m ? nt : rt)(
38
38
  v,
39
- m || f,
39
+ m || h,
40
40
  o.value
41
41
  ), e.scrollAuto && c());
42
42
  };
43
- N([t, i], () => {
44
- ie(d);
45
- }), N(
43
+ A([t, i], () => {
44
+ ce(d);
45
+ }), A(
46
46
  () => e.scrollAuto,
47
47
  (u) => {
48
48
  u ? c() : s();
49
49
  }
50
- ), N(
50
+ ), A(
51
51
  () => i.value.previewOnly,
52
52
  (u) => {
53
53
  u ? s() : c();
54
54
  }
55
55
  ), K(d);
56
- }, ue = async (e, t, o) => {
57
- if (/^h[1-6]$/.test(e))
58
- return ao(e, t);
59
- if (e === "prettier")
60
- return await lo(t, o);
61
- switch (e) {
62
- case "bold":
63
- case "underline":
64
- case "italic":
65
- case "strikeThrough":
66
- case "sub":
67
- case "sup":
68
- case "codeRow":
69
- case "katexInline":
70
- case "katexBlock":
71
- return ro(e, t);
72
- case "quote":
73
- case "orderedList":
74
- case "unorderedList":
75
- case "task":
76
- return io(e, t);
77
- case "code":
78
- return co(o, t);
79
- case "table":
80
- return bo(o);
81
- case "link": {
82
- const n = t.getSelectedText(), { desc: i = n, url: s = "" } = o, c = `[${i}](${s})`;
83
- return {
84
- text: c,
85
- options: {
86
- select: s === "",
87
- deviationStart: c.length - s.length - 1,
88
- deviationEnd: -1
89
- }
90
- };
91
- }
92
- case "image":
93
- return mo(o, t);
94
- case "flow":
95
- case "sequence":
96
- case "gantt":
97
- case "class":
98
- case "state":
99
- case "pie":
100
- case "relationship":
101
- case "journey":
102
- return uo(e);
103
- case "universal":
104
- return vo(t.getSelectedText(), o);
105
- default:
106
- return { text: "", options: {} };
107
- }
108
- }, ao = (e, t) => {
109
- const o = e.slice(1), n = "#".repeat(Number(o)), [i, s, c] = pe(t, {
110
- wholeLine: !0
111
- });
112
- return {
113
- text: `${n} ${i}`,
114
- options: { deviationStart: n.length + 1, replaceStart: s, replaceEnd: c }
115
- };
116
- }, lo = async (e, t) => {
117
- const o = window.prettier || Z.editorExtensions.prettier?.prettierInstance, n = [
118
- window.prettierPlugins?.markdown || Z.editorExtensions.prettier?.parserMarkdownInstance
119
- ];
120
- return !o || !n[0] ? (h.emit(t.editorId, X, {
121
- name: "prettier",
122
- message: "prettier is undefined"
123
- }), {
124
- text: e.getValue(),
125
- options: { select: !1, replaceAll: !0 }
126
- }) : {
127
- text: await o.format(e.getValue(), {
128
- parser: "markdown",
129
- plugins: n
130
- }),
131
- options: { select: !1, replaceAll: !0 }
132
- };
133
- }, no = {
134
- bold: ["**", "**", 2, -2],
135
- underline: ["<u>", "</u>", 3, -4],
136
- italic: ["*", "*", 1, -1],
137
- strikeThrough: ["~~", "~~", 2, -2],
138
- sub: ["~", "~", 1, -1],
139
- sup: ["^", "^", 1, -1],
140
- codeRow: ["`", "`", 1, -1],
141
- katexInline: ["$", "$", 1, -1],
142
- katexBlock: [`
143
- $$
144
- `, `
145
- $$
146
- `, 4, -4]
147
- }, ro = (e, t) => {
148
- const o = t.getSelectedText(), [n, i, s, c] = no[e];
149
- return {
150
- text: `${n}${o}${i}`,
151
- options: {
152
- deviationStart: s,
153
- deviationEnd: c
154
- // replaceStart, replaceEnd
155
- }
156
- };
157
- }, so = {
158
- quote: "> ",
159
- unorderedList: "- ",
160
- orderedList: 1,
161
- task: "- [ ] "
162
- }, io = (e, t) => {
163
- const [o, n, i] = pe(t, {
164
- wholeLine: !0
165
- }), s = o.split(`
166
- `), c = so[e], d = e === "orderedList" ? s.map((m, f) => `${c + f}. ${m}`) : s.map((m) => `${c}${m}`), u = e === "orderedList" ? "1. " : c.toString(), v = s.length === 1 ? u.length : 0;
167
- return {
168
- text: d.join(`
169
- `),
170
- options: { deviationStart: v, replaceStart: n, replaceEnd: i }
171
- };
172
- }, co = (e, t) => {
173
- const [o, n, i] = pe(t), s = e.mode || "language", c = `
174
- \`\`\`${s}
175
- ${e.text || o || ""}
176
- \`\`\`
177
- `;
178
- return {
179
- text: c,
180
- options: {
181
- deviationStart: 4,
182
- deviationEnd: 4 + s.length - c.length,
183
- replaceStart: n,
184
- replaceEnd: i
185
- }
186
- };
187
- }, uo = (e) => ({
188
- text: `
189
- \`\`\`mermaid
190
- ${{
191
- flow: `flowchart TD
192
- Start --> Stop`,
193
- sequence: `sequenceDiagram
194
- A->>B: hello!
195
- B-->>A: hi!`,
196
- gantt: `gantt
197
- title Gantt Chart
198
- dateFormat YYYY-MM-DD`,
199
- class: `classDiagram
200
- class Animal`,
201
- state: `stateDiagram-v2
202
- s1 --> s2`,
203
- pie: `pie
204
- "Dogs" : 386
205
- "Cats" : 85
206
- "Rats" : 15`,
207
- relationship: `erDiagram
208
- CAR ||--o{ NAMED-DRIVER : allows`,
209
- journey: `journey
210
- title My Journey`,
211
- ...Z.editorConfig.mermaidTemplate
212
- }[e]}
213
- \`\`\`
214
- `,
215
- options: { deviationStart: 12, deviationEnd: -5 }
216
- }), mo = (e, t) => {
217
- const o = t.getSelectedText(), { desc: n = o, url: i = "", urls: s } = e;
218
- let c = "";
219
- const d = i === "" && (!s || s instanceof Array && s.length === 0);
220
- return s instanceof Array ? c = s.reduce((u, v) => {
221
- const {
222
- url: m = "",
223
- alt: f = "",
224
- title: g = ""
225
- } = typeof v == "object" ? v : { url: v };
226
- return u + `![${f}](${m}${g ? " '" + g + "'" : ""})
227
- `;
228
- }, "") : c = `![${n}](${i})
229
- `, {
230
- text: c,
231
- options: {
232
- select: i === "",
233
- deviationStart: d ? c.length - i.length - 2 : c.length,
234
- deviationEnd: d ? -2 : 0
235
- }
236
- };
237
- }, bo = (e) => {
238
- const { selectedShape: t = { x: 1, y: 1 } } = e, { x: o, y: n } = t;
239
- let i = `
240
- | Column`;
241
- for (let s = 0; s <= n; s++)
242
- i += " |";
243
- i += `
244
- |`;
245
- for (let s = 0; s <= n; s++)
246
- i += " - |";
247
- for (let s = 0; s <= o; s++) {
248
- i += `
249
- |`;
250
- for (let c = 0; c <= n; c++)
251
- i += " |";
252
- }
253
- return i += `
254
- `, { text: i, options: { deviationStart: 3, deviationEnd: 10 - i.length } };
255
- }, vo = (e, t) => {
256
- const { generate: o } = t, n = o(e);
257
- return {
258
- text: n.targetValue,
259
- options: {
260
- select: n.select ?? !0,
261
- deviationStart: n.deviationStart || 0,
262
- deviationEnd: n.deviationEnd || 0
263
- }
264
- };
265
- }, pe = (e, t = { wholeLine: !1 }) => {
266
- const o = e.view.state, n = o.selection.main;
267
- if (n.empty) {
268
- const i = o.doc.lineAt(n.from);
269
- return [o.doc.lineAt(n.from).text, i.from, i.to];
270
- } else if (t.wholeLine) {
271
- const i = o.doc.lineAt(n.from), s = o.doc.lineAt(n.to);
272
- return [
273
- o.doc.sliceString(i.from, s.to),
274
- i.from,
275
- s.to
276
- ];
277
- }
278
- return [
279
- o.doc.sliceString(n.from, n.to),
280
- n.from,
281
- n.to
282
- ];
283
- }, G = (e) => {
284
- const t = new j();
56
+ }, j = (e) => {
57
+ const t = new Y();
285
58
  return (n) => (t.get(e.state) ? e.dispatch({ effects: t.reconfigure(n) }) : e.dispatch({
286
- effects: re.appendConfig.of(t.of(n))
59
+ effects: se.appendConfig.of(t.of(n))
287
60
  }), !0);
288
61
  };
289
- class go {
62
+ class no {
290
63
  view;
291
64
  maxLength = Number.MAX_SAFE_INTEGER;
292
65
  // 切换tabSize的执行方法。切换时,Compartment实例需要相同
@@ -370,7 +143,7 @@ class go {
370
143
  }), this.view.focus();
371
144
  } catch (s) {
372
145
  if (s.message === "The input text is too long")
373
- h.emit(n, X, {
146
+ L.emit(n, J, {
374
147
  name: "overlength",
375
148
  message: s.message,
376
149
  data: t
@@ -380,7 +153,7 @@ class go {
380
153
  }
381
154
  }
382
155
  constructor(t) {
383
- this.view = t, this.toggleTabSize = G(this.view), this.togglePlaceholder = G(this.view), this.setExtensions = G(this.view), this.toggleDisabled = G(this.view), this.toggleReadOnly = G(this.view), this.toggleMaxlength = G(this.view);
156
+ this.view = t, this.toggleTabSize = j(this.view), this.togglePlaceholder = j(this.view), this.setExtensions = j(this.view), this.toggleDisabled = j(this.view), this.toggleReadOnly = j(this.view), this.toggleMaxlength = j(this.view);
384
157
  }
385
158
  /**
386
159
  * 设置tabSize
@@ -389,8 +162,8 @@ class go {
389
162
  */
390
163
  setTabSize(t) {
391
164
  this.toggleTabSize([
392
- ce.tabSize.of(t),
393
- Zt.of(" ".repeat(t))
165
+ de.tabSize.of(t),
166
+ Kt.of(" ".repeat(t))
394
167
  ]);
395
168
  }
396
169
  /**
@@ -399,7 +172,7 @@ class go {
399
172
  * @param t 目标内容
400
173
  */
401
174
  setPlaceholder(t) {
402
- this.togglePlaceholder(Ot(t));
175
+ this.togglePlaceholder(Vt(t));
403
176
  }
404
177
  focus(t) {
405
178
  if (this.view.focus(), !t)
@@ -427,26 +200,26 @@ class go {
427
200
  this.toggleDisabled([B.editable.of(!t)]);
428
201
  }
429
202
  setReadOnly(t) {
430
- this.toggleReadOnly([ce.readOnly.of(t)]);
203
+ this.toggleReadOnly([de.readOnly.of(t)]);
431
204
  }
432
205
  setMaxLength(t) {
433
206
  this.maxLength = t, this.toggleMaxlength([
434
- ce.changeFilter.of((o) => o.newDoc.length <= t)
207
+ de.changeFilter.of((o) => o.newDoc.length <= t)
435
208
  ]);
436
209
  }
437
210
  }
438
- const ho = (e, t) => {
211
+ const ro = (e, t) => {
439
212
  if (e === t) return !0;
440
213
  if (e.length !== t.length) return !1;
441
214
  for (let o = 0; o < e.length; o++)
442
215
  if (e[o] !== t[o]) return !1;
443
216
  return !0;
444
- }, fo = (e, t) => {
445
- const o = I(t.value);
446
- N([t], () => {
447
- (!o.value || !ho(o.value, t.value)) && (o.value = t.value, e());
217
+ }, so = (e, t) => {
218
+ const o = S(t.value);
219
+ A([t], () => {
220
+ (!o.value || !ro(o.value, t.value)) && (o.value = t.value, e());
448
221
  });
449
- }, le = (e, t, o, n, i) => (s, c, d, u) => {
222
+ }, ne = (e, t, o, n, i) => (s, c, d, u) => {
450
223
  const v = `${e}${t}${o}${n}`, m = d + c.label.length + (i === "title" ? o.length : 0);
451
224
  s.dispatch({
452
225
  changes: { from: d, to: u, insert: v },
@@ -499,7 +272,7 @@ const ho = (e, t) => {
499
272
  ].map((i) => ({
500
273
  label: `${i[0]}${i[1]}`,
501
274
  type: "text",
502
- apply: le(i[0], i[1], "", i[0] === "`" ? "`" : "\n```", "type")
275
+ apply: ne(i[0], i[1], "", i[0] === "`" ? "`" : "\n```", "type")
503
276
  })),
504
277
  // 链接
505
278
  {
@@ -524,12 +297,12 @@ const ho = (e, t) => {
524
297
  {
525
298
  label: "$",
526
299
  type: "text",
527
- apply: le("$", "", "", "$", "type")
300
+ apply: ne("$", "", "", "$", "type")
528
301
  },
529
302
  {
530
303
  label: "$$",
531
304
  type: "text",
532
- apply: le("$$", "", `
305
+ apply: ne("$$", "", `
533
306
  `, `
534
307
  $$`, "title")
535
308
  },
@@ -554,43 +327,38 @@ $$`, "title")
554
327
  ].map((i) => ({
555
328
  label: `!!! ${i}`,
556
329
  type: "text",
557
- apply: le("!!!", ` ${i}`, " Title", `
330
+ apply: ne("!!!", ` ${i}`, " Title", `
558
331
 
559
332
  !!!`, "title")
560
333
  }))
561
334
  ]
562
335
  };
563
336
  };
564
- return Xt({
337
+ return Qt({
565
338
  override: e ? [t, ...e] : [t]
566
339
  });
567
- }, po = /* @__PURE__ */ C({
568
- name: `${l}-divider`,
569
- setup() {
570
- return () => a("div", {
571
- class: `${l}-divider`
572
- }, null);
573
- }
574
- }), To = /* @__PURE__ */ C({
340
+ }, io = /* @__PURE__ */ w({
575
341
  name: "ToolbarBold",
576
342
  setup() {
577
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
343
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
578
344
  return () => a("button", {
579
345
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
580
346
  title: t.value.toolbarTips?.bold,
581
347
  "aria-label": t.value.toolbarTips?.bold,
582
348
  disabled: o?.value,
583
349
  onClick: () => {
584
- h.emit(e, y, "bold");
350
+ T(e, {
351
+ direct: "bold"
352
+ });
585
353
  },
586
354
  type: "button"
587
- }, [a(x, {
355
+ }, [a(k, {
588
356
  name: "bold"
589
357
  }, null), n?.value && a("div", {
590
358
  class: `${l}-toolbar-item-name`
591
359
  }, [t.value.toolbarTips?.bold])]);
592
360
  }
593
- }), wo = /* @__PURE__ */ C({
361
+ }), co = /* @__PURE__ */ w({
594
362
  name: "ToolbarCatalog",
595
363
  setup() {
596
364
  const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = r("catalogVisible");
@@ -600,60 +368,64 @@ $$`, "title")
600
368
  "aria-label": t.value.toolbarTips?.catalog,
601
369
  disabled: o?.value,
602
370
  onClick: () => {
603
- h.emit(e, Ut);
371
+ L.emit(e, Gt);
604
372
  },
605
373
  key: "bar-catalog",
606
374
  type: "button"
607
- }, [a(x, {
375
+ }, [a(k, {
608
376
  name: "catalog"
609
377
  }, null), n?.value && a("div", {
610
378
  class: `${l}-toolbar-item-name`
611
379
  }, [t.value.toolbarTips?.catalog])]);
612
380
  }
613
- }), yo = /* @__PURE__ */ C({
381
+ }), uo = /* @__PURE__ */ w({
614
382
  name: "ToolbarCode",
615
383
  setup() {
616
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
384
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
617
385
  return () => a("button", {
618
386
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
619
387
  title: t.value.toolbarTips?.code,
620
388
  "aria-label": t.value.toolbarTips?.code,
621
389
  disabled: o?.value,
622
390
  onClick: () => {
623
- h.emit(e, y, "code");
391
+ T(e, {
392
+ direct: "code"
393
+ });
624
394
  },
625
395
  type: "button"
626
- }, [a(x, {
396
+ }, [a(k, {
627
397
  name: "code"
628
398
  }, null), n?.value && a("div", {
629
399
  class: `${l}-toolbar-item-name`
630
400
  }, [t.value.toolbarTips?.code])]);
631
401
  }
632
- }), Co = /* @__PURE__ */ C({
402
+ }), mo = /* @__PURE__ */ w({
633
403
  name: "ToolbarCodeRow",
634
404
  setup() {
635
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
405
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
636
406
  return () => a("button", {
637
407
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
638
408
  title: t.value.toolbarTips?.codeRow,
639
409
  "aria-label": t.value.toolbarTips?.codeRow,
640
410
  disabled: o?.value,
641
411
  onClick: () => {
642
- h.emit(e, y, "codeRow");
412
+ T(e, {
413
+ direct: "codeRow"
414
+ });
643
415
  },
644
416
  type: "button"
645
- }, [a(x, {
417
+ }, [a(k, {
646
418
  name: "code-row"
647
419
  }, null), n?.value && a("div", {
648
420
  class: `${l}-toolbar-item-name`
649
421
  }, [t.value.toolbarTips?.codeRow])]);
650
422
  }
651
- }), ko = /* @__PURE__ */ C({
423
+ }), bo = /* @__PURE__ */ w({
652
424
  name: "ToolbarFullscreen",
653
425
  setup() {
654
426
  const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), {
655
427
  fullscreenHandler: i
656
- } = ta();
428
+ } = Ko();
657
429
  return () => a("button", {
658
430
  class: [`${l}-toolbar-item`, n.value.fullscreen && `${l}-toolbar-active`, t?.value && `${l}-disabled`],
659
431
  title: e.value.toolbarTips?.fullscreen,
@@ -663,13 +435,13 @@ $$`, "title")
663
435
  i();
664
436
  },
665
437
  type: "button"
666
- }, [a(x, {
438
+ }, [a(k, {
667
439
  name: n.value.fullscreen ? "fullscreen-exit" : "fullscreen"
668
440
  }, null), o?.value && a("div", {
669
441
  class: `${l}-toolbar-item-name`
670
442
  }, [e.value.toolbarTips?.fullscreen])]);
671
443
  }
672
- }), $o = /* @__PURE__ */ C({
444
+ }), vo = /* @__PURE__ */ w({
673
445
  name: "ToolbarGithub",
674
446
  setup() {
675
447
  const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName");
@@ -679,16 +451,16 @@ $$`, "title")
679
451
  "aria-label": e.value.toolbarTips?.github,
680
452
  disabled: t?.value,
681
453
  onClick: () => {
682
- It("https://github.com/imzbf/md-editor-v3");
454
+ Et("https://github.com/imzbf/md-editor-v3");
683
455
  },
684
456
  type: "button"
685
- }, [a(x, {
457
+ }, [a(k, {
686
458
  name: "github"
687
459
  }, null), o?.value && a("div", {
688
460
  class: `${l}-toolbar-item-name`
689
461
  }, [e.value.toolbarTips?.github])]);
690
462
  }
691
- }), xo = /* @__PURE__ */ C({
463
+ }), go = /* @__PURE__ */ w({
692
464
  name: "ToolbarHtmlPreview",
693
465
  setup() {
694
466
  const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
@@ -701,32 +473,34 @@ $$`, "title")
701
473
  i("htmlPreview");
702
474
  },
703
475
  type: "button"
704
- }, [a(x, {
476
+ }, [a(k, {
705
477
  name: "preview-html"
706
478
  }, null), o?.value && a("div", {
707
479
  class: `${l}-toolbar-item-name`
708
480
  }, [e.value.toolbarTips?.htmlPreview])]);
709
481
  }
710
- }), So = /* @__PURE__ */ C({
482
+ }), ho = /* @__PURE__ */ w({
711
483
  name: "ToolbarImage",
712
484
  setup() {
713
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
485
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
714
486
  return () => a("button", {
715
487
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
716
488
  title: t.value.toolbarTips?.image,
717
489
  "aria-label": t.value.toolbarTips?.image,
718
490
  disabled: o?.value,
719
491
  onClick: () => {
720
- h.emit(e, y, "image");
492
+ T(e, {
493
+ direct: "image"
494
+ });
721
495
  },
722
496
  type: "button"
723
- }, [a(x, {
497
+ }, [a(k, {
724
498
  name: "image"
725
499
  }, null), n?.value && a("div", {
726
500
  class: `${l}-toolbar-item-name`
727
501
  }, [t.value.toolbarTips?.image])]);
728
502
  }
729
- }), Io = {
503
+ }), po = {
730
504
  visible: {
731
505
  type: Boolean,
732
506
  default: !1
@@ -741,13 +515,13 @@ $$`, "title")
741
515
  default: () => {
742
516
  }
743
517
  }
744
- }, Eo = /* @__PURE__ */ C({
518
+ }, fo = /* @__PURE__ */ w({
745
519
  name: `${l}-modal-clip`,
746
- props: Io,
520
+ props: po,
747
521
  setup(e) {
748
522
  const t = r("usedLanguageText"), o = r("editorId"), n = r("rootRef");
749
- let i = Z.editorExtensions.cropper.instance;
750
- const s = I(), c = I(), d = I(), u = Y({
523
+ let i = X.editorExtensions.cropper.instance;
524
+ const s = S(), c = S(), d = S(), u = Z({
751
525
  cropperInited: !1,
752
526
  imgSelected: !1,
753
527
  imgSrc: "",
@@ -755,10 +529,10 @@ $$`, "title")
755
529
  isFullscreen: !1
756
530
  });
757
531
  let v = null;
758
- N(() => e.visible, () => {
532
+ A(() => e.visible, () => {
759
533
  e.visible && !u.cropperInited && (i = i || window.Cropper, s.value.onchange = () => {
760
534
  if (!i) {
761
- h.emit(o, X, {
535
+ L.emit(o, J, {
762
536
  name: "Cropper",
763
537
  message: "Cropper is undefined"
764
538
  });
@@ -767,15 +541,15 @@ $$`, "title")
767
541
  const g = s.value.files || [];
768
542
  if (u.imgSelected = !0, g?.length > 0) {
769
543
  const p = new FileReader();
770
- p.onload = (k) => {
771
- u.imgSrc = k.target.result;
544
+ p.onload = (y) => {
545
+ u.imgSrc = y.target.result;
772
546
  }, p.readAsDataURL(g[0]);
773
547
  }
774
548
  });
775
- }), N(() => [u.imgSelected], () => {
549
+ }), A(() => [u.imgSelected], () => {
776
550
  d.value.style = "";
777
- }), N([ke(() => u.isFullscreen), ke(() => u.imgSrc)], () => {
778
- u.imgSrc && ie(() => {
551
+ }), A([ke(() => u.isFullscreen), ke(() => u.imgSrc)], () => {
552
+ u.imgSrc && ce(() => {
779
553
  v?.destroy(), d.value.style = "", c.value && (v = new i(c.value, {
780
554
  viewMode: 2,
781
555
  preview: n.value.getRootNode().querySelector(`.${l}-clip-preview-target`)
@@ -785,17 +559,17 @@ $$`, "title")
785
559
  });
786
560
  const m = () => {
787
561
  v.clear(), v.destroy(), v = null, s.value.value = "", u.imgSelected = !1, u.imgSrc = "";
788
- }, f = (g) => {
562
+ }, h = (g) => {
789
563
  u.isFullscreen = g;
790
564
  };
791
- return () => a(Qt, {
565
+ return () => a(eo, {
792
566
  class: `${l}-modal-clip`,
793
567
  title: t.value.clipModalTips?.title,
794
568
  visible: e.visible,
795
569
  onClose: e.onCancel,
796
570
  showAdjust: !0,
797
571
  isFullscreen: u.isFullscreen,
798
- onAdjust: f,
572
+ onAdjust: h,
799
573
  width: "668px",
800
574
  height: "421px"
801
575
  }, {
@@ -815,7 +589,7 @@ $$`, "title")
815
589
  }, null), a("div", {
816
590
  class: `${l}-clip-delete`,
817
591
  onClick: m
818
- }, [a(x, {
592
+ }, [a(k, {
819
593
  name: "delete"
820
594
  }, null)])]) : a("div", {
821
595
  class: `${l}-clip-upload`,
@@ -825,7 +599,7 @@ $$`, "title")
825
599
  role: "button",
826
600
  tabindex: "0",
827
601
  "aria-label": t.value.imgTitleItem?.upload
828
- }, [a(x, {
602
+ }, [a(k, {
829
603
  name: "upload"
830
604
  }, null)])]), a("div", {
831
605
  class: `${l}-clip-preview`
@@ -840,7 +614,7 @@ $$`, "title")
840
614
  onClick: () => {
841
615
  if (v) {
842
616
  const g = v.getCroppedCanvas();
843
- h.emit(o, fe, [eo(g.toDataURL("image/png"))], e.onOk), m();
617
+ L.emit(o, fe, [to(g.toDataURL("image/png"))], e.onOk), m();
844
618
  }
845
619
  }
846
620
  }, [t.value.clipModalTips?.buttonUpload || t.value.linkModalTips?.buttonOK])]), a("input", {
@@ -855,7 +629,7 @@ $$`, "title")
855
629
  }, null)]
856
630
  });
857
631
  }
858
- }), Lo = {
632
+ }), To = {
859
633
  clipVisible: {
860
634
  type: Boolean,
861
635
  default: !1
@@ -870,35 +644,38 @@ $$`, "title")
870
644
  default: () => {
871
645
  }
872
646
  }
873
- }, No = /* @__PURE__ */ C({
647
+ }, wo = /* @__PURE__ */ w({
874
648
  name: `${l}-modals`,
875
- props: Lo,
649
+ props: To,
876
650
  setup(e) {
877
- return () => a(Eo, {
651
+ return () => a(fo, {
878
652
  visible: e.clipVisible,
879
653
  onOk: e.onOk,
880
654
  onCancel: e.onCancel
881
655
  }, null);
882
656
  }
883
- }), Ao = /* @__PURE__ */ C({
657
+ }), yo = /* @__PURE__ */ w({
884
658
  name: "ToolbarImageDropdown",
885
659
  setup() {
886
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = I(!1), c = I(!1), d = I(), u = () => {
887
- h.emit(e, fe, Array.from(d.value.files || [])), d.value.value = "";
888
- }, v = (k, E) => {
889
- o?.value || h.emit(e, y, k, E);
660
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = S(!1), c = S(!1), d = S(), u = () => {
661
+ L.emit(e, fe, Array.from(d.value.files || [])), d.value.value = "";
662
+ }, v = (y, I) => {
663
+ o?.value || T(e, {
664
+ direct: y,
665
+ params: I
666
+ });
890
667
  };
891
668
  K(() => {
892
669
  d.value.addEventListener("change", u);
893
670
  });
894
- const m = (k) => {
895
- s.value = k;
896
- }, f = () => {
671
+ const m = (y) => {
672
+ s.value = y;
673
+ }, h = () => {
897
674
  c.value = !1;
898
- }, g = (k) => {
899
- k && v("image", {
900
- desc: k.desc,
901
- url: k.url,
675
+ }, g = (y) => {
676
+ y && v("image", {
677
+ desc: y.desc,
678
+ url: y.url,
902
679
  transform: !0
903
680
  }), c.value = !1;
904
681
  }, p = P(() => a("ul", {
@@ -957,41 +734,45 @@ $$`, "title")
957
734
  "aria-label": t.value.toolbarTips?.image,
958
735
  disabled: o?.value,
959
736
  type: "button"
960
- }, [a(x, {
737
+ }, [a(k, {
961
738
  name: "image"
962
739
  }, null), n?.value && a("div", {
963
740
  class: `${l}-toolbar-item-name`
964
741
  }, [t.value.toolbarTips?.image])])]
965
- }), a(No, {
742
+ }), a(wo, {
966
743
  clipVisible: c.value,
967
- onCancel: f,
744
+ onCancel: h,
968
745
  onOk: g
969
746
  }, null)]);
970
747
  }
971
- }), Do = /* @__PURE__ */ C({
748
+ }), Co = /* @__PURE__ */ w({
972
749
  name: "ToolbarItalic",
973
750
  setup() {
974
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
751
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
975
752
  return () => a("button", {
976
753
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
977
754
  title: t.value.toolbarTips?.italic,
978
755
  "aria-label": t.value.toolbarTips?.italic,
979
756
  disabled: o?.value,
980
757
  onClick: () => {
981
- h.emit(e, y, "italic");
758
+ T(e, {
759
+ direct: "italic"
760
+ });
982
761
  },
983
762
  type: "button"
984
- }, [a(x, {
763
+ }, [a(k, {
985
764
  name: "italic"
986
765
  }, null), n?.value && a("div", {
987
766
  class: `${l}-toolbar-item-name`
988
767
  }, [t.value.toolbarTips?.italic])]);
989
768
  }
990
- }), Ro = /* @__PURE__ */ C({
769
+ }), ko = /* @__PURE__ */ w({
991
770
  name: "ToolbarKatex",
992
771
  setup() {
993
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = I(!1), c = (v) => {
994
- o?.value || h.emit(e, y, v);
772
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = S(!1), c = (v) => {
773
+ o?.value || T(e, {
774
+ direct: v
775
+ });
995
776
  }, d = (v) => {
996
777
  s.value = v;
997
778
  }, u = P(() => a("ul", {
@@ -1029,37 +810,41 @@ $$`, "title")
1029
810
  "aria-label": t.value.toolbarTips?.katex,
1030
811
  disabled: o?.value,
1031
812
  type: "button"
1032
- }, [a(x, {
813
+ }, [a(k, {
1033
814
  name: "formula"
1034
815
  }, null), n?.value && a("div", {
1035
816
  class: `${l}-toolbar-item-name`
1036
817
  }, [t.value.toolbarTips?.katex])])]
1037
818
  });
1038
819
  }
1039
- }), Mo = /* @__PURE__ */ C({
820
+ }), $o = /* @__PURE__ */ w({
1040
821
  name: "ToolbarLink",
1041
822
  setup() {
1042
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
823
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1043
824
  return () => a("button", {
1044
825
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1045
826
  title: t.value.toolbarTips?.link,
1046
827
  "aria-label": t.value.toolbarTips?.link,
1047
828
  disabled: o?.value,
1048
829
  onClick: () => {
1049
- h.emit(e, y, "link");
830
+ T(e, {
831
+ direct: "link"
832
+ });
1050
833
  },
1051
834
  type: "button"
1052
- }, [a(x, {
835
+ }, [a(k, {
1053
836
  name: "link"
1054
837
  }, null), n?.value && a("div", {
1055
838
  class: `${l}-toolbar-item-name`
1056
839
  }, [t.value.toolbarTips?.link])]);
1057
840
  }
1058
- }), Fo = /* @__PURE__ */ C({
841
+ }), xo = /* @__PURE__ */ w({
1059
842
  name: "ToolbarMermaid",
1060
843
  setup() {
1061
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = I(!1), c = (v) => {
1062
- o?.value || h.emit(e, y, v);
844
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = S(!1), c = (v) => {
845
+ o?.value || T(e, {
846
+ direct: v
847
+ });
1063
848
  }, d = (v) => {
1064
849
  s.value = v;
1065
850
  }, u = P(() => a("ul", {
@@ -1139,52 +924,54 @@ $$`, "title")
1139
924
  "aria-label": t.value.toolbarTips?.mermaid,
1140
925
  disabled: o?.value,
1141
926
  type: "button"
1142
- }, [a(x, {
927
+ }, [a(k, {
1143
928
  name: "mermaid"
1144
929
  }, null), n?.value && a("div", {
1145
930
  class: `${l}-toolbar-item-name`
1146
931
  }, [t.value.toolbarTips?.mermaid])])]
1147
932
  });
1148
933
  }
1149
- }), Bo = /* @__PURE__ */ C({
934
+ }), So = /* @__PURE__ */ w({
1150
935
  name: "ToolbarNext",
1151
936
  setup() {
1152
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
937
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1153
938
  return () => a("button", {
1154
939
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1155
940
  title: t.value.toolbarTips?.next,
1156
941
  "aria-label": t.value.toolbarTips?.next,
1157
942
  disabled: o?.value,
1158
943
  onClick: () => {
1159
- h.emit(e, Ue);
944
+ L.emit(e, Ge);
1160
945
  },
1161
946
  type: "button"
1162
- }, [a(x, {
947
+ }, [a(k, {
1163
948
  name: "next"
1164
949
  }, null), n?.value && a("div", {
1165
950
  class: `${l}-toolbar-item-name`
1166
951
  }, [t.value.toolbarTips?.next])]);
1167
952
  }
1168
- }), Po = /* @__PURE__ */ C({
953
+ }), Io = /* @__PURE__ */ w({
1169
954
  name: "ToolbarOrderedList",
1170
955
  setup() {
1171
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
956
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1172
957
  return () => a("button", {
1173
958
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1174
959
  title: t.value.toolbarTips?.orderedList,
1175
960
  "aria-label": t.value.toolbarTips?.orderedList,
1176
961
  disabled: o?.value,
1177
962
  onClick: () => {
1178
- h.emit(e, y, "orderedList");
963
+ T(e, {
964
+ direct: "orderedList"
965
+ });
1179
966
  },
1180
967
  type: "button"
1181
- }, [a(x, {
968
+ }, [a(k, {
1182
969
  name: "ordered-list"
1183
970
  }, null), n?.value && a("div", {
1184
971
  class: `${l}-toolbar-item-name`
1185
972
  }, [t.value.toolbarTips?.orderedList])]);
1186
973
  }
1187
- }), Ho = /* @__PURE__ */ C({
974
+ }), Eo = /* @__PURE__ */ w({
1188
975
  name: "ToolbarPageFullscreen",
1189
976
  setup() {
1190
977
  const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
@@ -1197,32 +984,34 @@ $$`, "title")
1197
984
  i("pageFullscreen");
1198
985
  },
1199
986
  type: "button"
1200
- }, [a(x, {
987
+ }, [a(k, {
1201
988
  name: n.value.pageFullscreen ? "minimize" : "maximize"
1202
989
  }, null), o?.value && a("div", {
1203
990
  class: `${l}-toolbar-item-name`
1204
991
  }, [e.value.toolbarTips?.pageFullscreen])]);
1205
992
  }
1206
- }), Oo = /* @__PURE__ */ C({
993
+ }), Lo = /* @__PURE__ */ w({
1207
994
  name: "ToolbarPrettier",
1208
995
  setup() {
1209
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
996
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1210
997
  return () => a("button", {
1211
998
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1212
999
  title: t.value.toolbarTips?.prettier,
1213
1000
  "aria-label": t.value.toolbarTips?.prettier,
1214
1001
  disabled: o?.value,
1215
1002
  onClick: () => {
1216
- h.emit(e, y, "prettier");
1003
+ T(e, {
1004
+ direct: "prettier"
1005
+ });
1217
1006
  },
1218
1007
  type: "button"
1219
- }, [a(x, {
1008
+ }, [a(k, {
1220
1009
  name: "prettier"
1221
1010
  }, null), n?.value && a("div", {
1222
1011
  class: `${l}-toolbar-item-name`
1223
1012
  }, [t.value.toolbarTips?.prettier])]);
1224
1013
  }
1225
- }), Vo = /* @__PURE__ */ C({
1014
+ }), Do = /* @__PURE__ */ w({
1226
1015
  name: "ToolbarPreview",
1227
1016
  setup() {
1228
1017
  const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
@@ -1235,13 +1024,13 @@ $$`, "title")
1235
1024
  i("preview");
1236
1025
  },
1237
1026
  type: "button"
1238
- }, [a(x, {
1027
+ }, [a(k, {
1239
1028
  name: "preview"
1240
1029
  }, null), o?.value && a("div", {
1241
1030
  class: `${l}-toolbar-item-name`
1242
1031
  }, [e.value.toolbarTips?.preview])]);
1243
1032
  }
1244
- }), Wo = /* @__PURE__ */ C({
1033
+ }), No = /* @__PURE__ */ w({
1245
1034
  name: "ToolbarPreviewOnly",
1246
1035
  setup() {
1247
1036
  const e = r("usedLanguageText"), t = r("disabled"), o = r("showToolbarName"), n = r("setting"), i = r("updateSetting");
@@ -1254,51 +1043,53 @@ $$`, "title")
1254
1043
  i("previewOnly");
1255
1044
  },
1256
1045
  type: "button"
1257
- }, [a(x, {
1046
+ }, [a(k, {
1258
1047
  name: "preview-only"
1259
1048
  }, null), o?.value && a("div", {
1260
1049
  class: `${l}-toolbar-item-name`
1261
1050
  }, [e.value.toolbarTips?.previewOnly])]);
1262
1051
  }
1263
- }), _o = /* @__PURE__ */ C({
1052
+ }), Ao = /* @__PURE__ */ w({
1264
1053
  name: "ToolbarQuote",
1265
1054
  setup() {
1266
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
1055
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1267
1056
  return () => a("button", {
1268
1057
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1269
1058
  title: t.value.toolbarTips?.quote,
1270
1059
  "aria-label": t.value.toolbarTips?.quote,
1271
1060
  disabled: o?.value,
1272
1061
  onClick: () => {
1273
- h.emit(e, y, "quote");
1062
+ T(e, {
1063
+ direct: "quote"
1064
+ });
1274
1065
  },
1275
1066
  type: "button"
1276
- }, [a(x, {
1067
+ }, [a(k, {
1277
1068
  name: "quote"
1278
1069
  }, null), n?.value && a("div", {
1279
1070
  class: `${l}-toolbar-item-name`
1280
1071
  }, [t.value.toolbarTips?.quote])]);
1281
1072
  }
1282
- }), zo = /* @__PURE__ */ C({
1073
+ }), Ro = /* @__PURE__ */ w({
1283
1074
  name: "ToolbarRevoke",
1284
1075
  setup() {
1285
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
1076
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1286
1077
  return () => a("button", {
1287
1078
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1288
1079
  title: t.value.toolbarTips?.revoke,
1289
1080
  "aria-label": t.value.toolbarTips?.revoke,
1290
1081
  disabled: o?.value,
1291
1082
  onClick: () => {
1292
- h.emit(e, Ke);
1083
+ L.emit(e, je);
1293
1084
  },
1294
1085
  type: "button"
1295
- }, [a(x, {
1086
+ }, [a(k, {
1296
1087
  name: "revoke"
1297
1088
  }, null), n?.value && a("div", {
1298
1089
  class: `${l}-toolbar-item-name`
1299
1090
  }, [t.value.toolbarTips?.revoke])]);
1300
1091
  }
1301
- }), qo = /* @__PURE__ */ C({
1092
+ }), Mo = /* @__PURE__ */ w({
1302
1093
  name: "ToolbarSave",
1303
1094
  setup() {
1304
1095
  const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
@@ -1308,73 +1099,79 @@ $$`, "title")
1308
1099
  "aria-label": t.value.toolbarTips?.save,
1309
1100
  disabled: o?.value,
1310
1101
  onClick: () => {
1311
- h.emit(e, Ge);
1102
+ L.emit(e, Ye);
1312
1103
  },
1313
1104
  type: "button"
1314
- }, [a(x, {
1105
+ }, [a(k, {
1315
1106
  name: "save"
1316
1107
  }, null), n?.value && a("div", {
1317
1108
  class: `${l}-toolbar-item-name`
1318
1109
  }, [t.value.toolbarTips?.save])]);
1319
1110
  }
1320
- }), Uo = /* @__PURE__ */ C({
1111
+ }), Fo = /* @__PURE__ */ w({
1321
1112
  name: "ToolbarStrikeThrough",
1322
1113
  setup() {
1323
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
1114
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1324
1115
  return () => a("button", {
1325
1116
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1326
1117
  title: t.value.toolbarTips?.strikeThrough,
1327
1118
  "aria-label": t.value.toolbarTips?.strikeThrough,
1328
1119
  disabled: o?.value,
1329
1120
  onClick: () => {
1330
- h.emit(e, y, "strikeThrough");
1121
+ T(e, {
1122
+ direct: "strikeThrough"
1123
+ });
1331
1124
  },
1332
1125
  type: "button"
1333
- }, [a(x, {
1126
+ }, [a(k, {
1334
1127
  name: "strike-through"
1335
1128
  }, null), n?.value && a("div", {
1336
1129
  class: `${l}-toolbar-item-name`
1337
1130
  }, [t.value.toolbarTips?.strikeThrough])]);
1338
1131
  }
1339
- }), Ko = /* @__PURE__ */ C({
1132
+ }), Bo = /* @__PURE__ */ w({
1340
1133
  name: "ToolbarSub",
1341
1134
  setup() {
1342
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
1135
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1343
1136
  return () => a("button", {
1344
1137
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1345
1138
  title: t.value.toolbarTips?.sub,
1346
1139
  "aria-label": t.value.toolbarTips?.sub,
1347
1140
  disabled: o?.value,
1348
1141
  onClick: () => {
1349
- h.emit(e, y, "sub");
1142
+ T(e, {
1143
+ direct: "sub"
1144
+ });
1350
1145
  },
1351
1146
  type: "button"
1352
- }, [a(x, {
1147
+ }, [a(k, {
1353
1148
  name: "sub"
1354
1149
  }, null), n?.value && a("div", {
1355
1150
  class: `${l}-toolbar-item-name`
1356
1151
  }, [t.value.toolbarTips?.sub])]);
1357
1152
  }
1358
- }), Go = /* @__PURE__ */ C({
1153
+ }), Po = /* @__PURE__ */ w({
1359
1154
  name: "ToolbarSup",
1360
1155
  setup() {
1361
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
1156
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1362
1157
  return () => a("button", {
1363
1158
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1364
1159
  title: t.value.toolbarTips?.sup,
1365
1160
  "aria-label": t.value.toolbarTips?.sup,
1366
1161
  disabled: o?.value,
1367
1162
  onClick: () => {
1368
- h.emit(e, y, "sup");
1163
+ T(e, {
1164
+ direct: "sup"
1165
+ });
1369
1166
  },
1370
1167
  type: "button"
1371
- }, [a(x, {
1168
+ }, [a(k, {
1372
1169
  name: "sup"
1373
1170
  }, null), n?.value && a("div", {
1374
1171
  class: `${l}-toolbar-item-name`
1375
1172
  }, [t.value.toolbarTips?.sup])]);
1376
1173
  }
1377
- }), jo = {
1174
+ }), Ho = {
1378
1175
  tableShape: {
1379
1176
  type: Array,
1380
1177
  default: () => [6, 4]
@@ -1384,18 +1181,18 @@ $$`, "title")
1384
1181
  default: () => {
1385
1182
  }
1386
1183
  }
1387
- }, Yo = /* @__PURE__ */ C({
1184
+ }, Oo = /* @__PURE__ */ w({
1388
1185
  name: "TableShape",
1389
- props: jo,
1186
+ props: Ho,
1390
1187
  setup(e) {
1391
- const t = Y({
1188
+ const t = Z({
1392
1189
  x: -1,
1393
1190
  y: -1
1394
1191
  }), o = P(() => JSON.stringify(e.tableShape)), n = () => {
1395
1192
  const s = [...JSON.parse(o.value)];
1396
1193
  return (!s[2] || s[2] < s[0]) && (s[2] = s[0]), (!s[3] || s[3] < s[3]) && (s[3] = s[1]), s;
1397
- }, i = I(n());
1398
- return N([o], () => {
1194
+ }, i = S(n());
1195
+ return A([o], () => {
1399
1196
  i.value = n();
1400
1197
  }), () => a("div", {
1401
1198
  class: `${l}-table-shape`,
@@ -1418,16 +1215,19 @@ $$`, "title")
1418
1215
  class: [`${l}-table-shape-col-default`, c <= t.x && u <= t.y && `${l}-table-shape-col-include`]
1419
1216
  }, null)]))]))]);
1420
1217
  }
1421
- }), Zo = /* @__PURE__ */ C({
1218
+ }), Vo = /* @__PURE__ */ w({
1422
1219
  name: "ToolbarTable",
1423
1220
  setup() {
1424
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = r("tableShape"), s = `${e}-toolbar-wrapper`, c = I(!1), d = (m) => {
1221
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = r("tableShape"), s = `${e}-toolbar-wrapper`, c = S(!1), d = (m) => {
1425
1222
  c.value = m;
1426
1223
  }, u = (m) => {
1427
- o?.value || h.emit(e, y, "table", {
1428
- selectedShape: m
1224
+ o?.value || T(e, {
1225
+ direct: "table",
1226
+ params: {
1227
+ selectedShape: m
1228
+ }
1429
1229
  });
1430
- }, v = P(() => a(Yo, {
1230
+ }, v = P(() => a(Oo, {
1431
1231
  tableShape: i.value,
1432
1232
  onSelected: u
1433
1233
  }, null));
@@ -1445,37 +1245,41 @@ $$`, "title")
1445
1245
  "aria-label": t.value.toolbarTips?.table,
1446
1246
  disabled: o?.value,
1447
1247
  type: "button"
1448
- }, [a(x, {
1248
+ }, [a(k, {
1449
1249
  name: "table"
1450
1250
  }, null), n?.value && a("div", {
1451
1251
  class: `${l}-toolbar-item-name`
1452
1252
  }, [t.value.toolbarTips?.table])])]
1453
1253
  });
1454
1254
  }
1455
- }), Xo = /* @__PURE__ */ C({
1255
+ }), Wo = /* @__PURE__ */ w({
1456
1256
  name: "ToolbarTask",
1457
1257
  setup() {
1458
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
1258
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1459
1259
  return () => a("button", {
1460
1260
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1461
1261
  title: t.value.toolbarTips?.task,
1462
1262
  "aria-label": t.value.toolbarTips?.task,
1463
1263
  disabled: o?.value,
1464
1264
  onClick: () => {
1465
- h.emit(e, y, "task");
1265
+ T(e, {
1266
+ direct: "task"
1267
+ });
1466
1268
  },
1467
1269
  type: "button"
1468
- }, [a(x, {
1270
+ }, [a(k, {
1469
1271
  name: "task"
1470
1272
  }, null), n?.value && a("div", {
1471
1273
  class: `${l}-toolbar-item-name`
1472
1274
  }, [t.value.toolbarTips?.task])]);
1473
1275
  }
1474
- }), Jo = /* @__PURE__ */ C({
1276
+ }), _o = /* @__PURE__ */ w({
1475
1277
  name: "ToolbarTitle",
1476
1278
  setup() {
1477
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = I(!1), c = (v) => {
1478
- o?.value || h.emit(e, y, v);
1279
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName"), i = `${e}-toolbar-wrapper`, s = S(!1), c = (v) => {
1280
+ o?.value || T(e, {
1281
+ direct: v
1282
+ });
1479
1283
  }, d = (v) => {
1480
1284
  s.value = v;
1481
1285
  }, u = P(() => a("ul", {
@@ -1540,60 +1344,71 @@ $$`, "title")
1540
1344
  title: t.value.toolbarTips?.title,
1541
1345
  "aria-label": t.value.toolbarTips?.title,
1542
1346
  type: "button"
1543
- }, [a(x, {
1347
+ }, [a(k, {
1544
1348
  name: "title"
1545
1349
  }, null), n?.value && a("div", {
1546
1350
  class: `${l}-toolbar-item-name`
1547
1351
  }, [t.value.toolbarTips?.title])])]
1548
1352
  });
1549
1353
  }
1550
- }), Qo = /* @__PURE__ */ C({
1354
+ }), zo = /* @__PURE__ */ w({
1551
1355
  name: "ToolbarUnderline",
1552
1356
  setup() {
1553
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
1357
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1554
1358
  return () => a("button", {
1555
1359
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1556
1360
  title: t.value.toolbarTips?.underline,
1557
1361
  "aria-label": t.value.toolbarTips?.underline,
1558
1362
  disabled: o?.value,
1559
1363
  onClick: () => {
1560
- h.emit(e, y, "underline");
1364
+ T(e, {
1365
+ direct: "underline"
1366
+ });
1561
1367
  },
1562
1368
  type: "button"
1563
- }, [a(x, {
1369
+ }, [a(k, {
1564
1370
  name: "underline"
1565
1371
  }, null), n?.value && a("div", {
1566
1372
  class: `${l}-toolbar-item-name`
1567
1373
  }, [t.value.toolbarTips?.underline])]);
1568
1374
  }
1569
- }), ea = /* @__PURE__ */ C({
1375
+ }), qo = /* @__PURE__ */ w({
1570
1376
  name: "ToolbarUnorderedList",
1571
1377
  setup() {
1572
- const e = r("editorId"), t = r("usedLanguageText"), o = r("disabled"), n = r("showToolbarName");
1378
+ const e = r("editorId"), t = r("usedLanguageText"), o = r("contentDisabled"), n = r("showToolbarName");
1573
1379
  return () => a("button", {
1574
1380
  class: [`${l}-toolbar-item`, o?.value && `${l}-disabled`],
1575
1381
  title: t.value.toolbarTips?.unorderedList,
1576
1382
  "aria-label": t.value.toolbarTips?.unorderedList,
1577
1383
  disabled: o?.value,
1578
1384
  onClick: () => {
1579
- h.emit(e, y, "unorderedList");
1385
+ T(e, {
1386
+ direct: "unorderedList"
1387
+ });
1580
1388
  },
1581
1389
  type: "button"
1582
- }, [a(x, {
1390
+ }, [a(k, {
1583
1391
  name: "unordered-list"
1584
1392
  }, null), n?.value && a("div", {
1585
1393
  class: `${l}-toolbar-item-name`
1586
1394
  }, [t.value.toolbarTips?.unorderedList])]);
1587
1395
  }
1588
- }), ta = () => {
1396
+ }), Uo = /* @__PURE__ */ w({
1397
+ name: `${l}-divider`,
1398
+ setup() {
1399
+ return () => a("div", {
1400
+ class: `${l}-divider`
1401
+ }, null);
1402
+ }
1403
+ }), Ko = () => {
1589
1404
  const e = r("editorId"), t = r("setting"), o = r("updateSetting"), {
1590
1405
  editorExtensions: n,
1591
1406
  editorExtensionsAttrs: i
1592
- } = Z;
1407
+ } = X;
1593
1408
  let s = n.screenfull.instance;
1594
- const c = I(!1), d = (m) => {
1409
+ const c = S(!1), d = (m) => {
1595
1410
  if (!s) {
1596
- h.emit(e, X, {
1411
+ L.emit(e, J, {
1597
1412
  name: "fullscreen",
1598
1413
  message: "fullscreen is undefined"
1599
1414
  });
@@ -1608,178 +1423,187 @@ $$`, "title")
1608
1423
  s = window.screenfull, u();
1609
1424
  };
1610
1425
  return K(() => {
1611
- u(), s || Jt("script", {
1426
+ u(), s || oo("script", {
1612
1427
  ...i.screenfull?.js,
1613
1428
  src: n.screenfull.js,
1614
- id: rt.screenfull,
1429
+ id: st.screenfull,
1615
1430
  onload: v
1616
1431
  }, "screenfull");
1617
1432
  }), K(() => {
1618
- h.on(e, {
1619
- name: Kt,
1433
+ L.on(e, {
1434
+ name: jt,
1620
1435
  callback: d
1621
1436
  });
1622
1437
  }), {
1623
1438
  fullscreenHandler: d
1624
1439
  };
1625
1440
  };
1626
- let oa = 0;
1441
+ let Go = 0;
1627
1442
  const Ze = () => {
1628
1443
  const e = r("editorId"), t = r("theme"), o = r("previewTheme"), n = r("language"), i = r("disabled"), s = r("noUploadImg"), c = r("noPrettier"), d = r("codeTheme"), u = r("showToolbarName"), v = r("setting"), m = r("defToolbars");
1629
1444
  return {
1630
1445
  barRender: (g) => {
1631
- if ($t.includes(g))
1446
+ if (xt.includes(g))
1632
1447
  switch (g) {
1633
1448
  case "-":
1634
- return a(po, {
1635
- key: `bar-${oa++}`
1449
+ return a(Uo, {
1450
+ key: `bar-${Go++}`
1636
1451
  }, null);
1637
1452
  case "bold":
1638
- return a(To, {
1453
+ return a(io, {
1639
1454
  key: "bar-bold"
1640
1455
  }, null);
1641
1456
  case "underline":
1642
- return a(Qo, {
1457
+ return a(zo, {
1643
1458
  key: "bar-unorderline"
1644
1459
  }, null);
1645
1460
  case "italic":
1646
- return a(Do, {
1461
+ return a(Co, {
1647
1462
  key: "bar-italic"
1648
1463
  }, null);
1649
1464
  case "strikeThrough":
1650
- return a(Uo, {
1465
+ return a(Fo, {
1651
1466
  key: "bar-strikeThrough"
1652
1467
  }, null);
1653
1468
  case "title":
1654
- return a(Jo, {
1469
+ return a(_o, {
1655
1470
  key: "bar-title"
1656
1471
  }, null);
1657
1472
  case "sub":
1658
- return a(Ko, {
1473
+ return a(Bo, {
1659
1474
  key: "bar-sub"
1660
1475
  }, null);
1661
1476
  case "sup":
1662
- return a(Go, {
1477
+ return a(Po, {
1663
1478
  key: "bar-sup"
1664
1479
  }, null);
1665
1480
  case "quote":
1666
- return a(_o, {
1481
+ return a(Ao, {
1667
1482
  key: "bar-quote"
1668
1483
  }, null);
1669
1484
  case "unorderedList":
1670
- return a(ea, {
1485
+ return a(qo, {
1671
1486
  key: "bar-unorderedList"
1672
1487
  }, null);
1673
1488
  case "orderedList":
1674
- return a(Po, {
1489
+ return a(Io, {
1675
1490
  key: "bar-orderedList"
1676
1491
  }, null);
1677
1492
  case "task":
1678
- return a(Xo, {
1493
+ return a(Wo, {
1679
1494
  key: "bar-task"
1680
1495
  }, null);
1681
1496
  case "codeRow":
1682
- return a(Co, {
1497
+ return a(mo, {
1683
1498
  key: "bar-codeRow"
1684
1499
  }, null);
1685
1500
  case "code":
1686
- return a(yo, {
1501
+ return a(uo, {
1687
1502
  key: "bar-code"
1688
1503
  }, null);
1689
1504
  case "link":
1690
- return a(Mo, {
1505
+ return a($o, {
1691
1506
  key: "bar-link"
1692
1507
  }, null);
1693
1508
  case "image":
1694
- return s ? a(So, {
1509
+ return s ? a(ho, {
1695
1510
  key: "bar-image"
1696
- }, null) : a(Ao, {
1511
+ }, null) : a(yo, {
1697
1512
  key: "bar-imageDropdown"
1698
1513
  }, null);
1699
1514
  case "table":
1700
- return a(Zo, {
1515
+ return a(Vo, {
1701
1516
  key: "bar-table"
1702
1517
  }, null);
1703
1518
  case "revoke":
1704
- return a(zo, {
1519
+ return a(Ro, {
1705
1520
  key: "bar-revoke"
1706
1521
  }, null);
1707
1522
  case "next":
1708
- return a(Bo, {
1523
+ return a(So, {
1709
1524
  key: "bar-next"
1710
1525
  }, null);
1711
1526
  case "save":
1712
- return a(qo, {
1527
+ return a(Mo, {
1713
1528
  key: "bar-save"
1714
1529
  }, null);
1715
1530
  case "prettier":
1716
- return !c && a(Oo, {
1531
+ return !c && a(Lo, {
1717
1532
  key: "bar-prettier"
1718
1533
  }, null);
1719
1534
  case "pageFullscreen":
1720
- return !v.value.fullscreen && a(Ho, {
1535
+ return !v.value.fullscreen && a(Eo, {
1721
1536
  key: "bar-pageFullscreen"
1722
1537
  }, null);
1723
1538
  case "fullscreen":
1724
- return a(ko, {
1539
+ return a(bo, {
1725
1540
  key: "bar-fullscreen"
1726
1541
  }, null);
1727
1542
  case "catalog":
1728
- return a(wo, {
1543
+ return a(co, {
1729
1544
  key: "bar-catalog"
1730
1545
  }, null);
1731
1546
  case "preview":
1732
- return a(Vo, {
1547
+ return a(Do, {
1733
1548
  key: "bar-preview"
1734
1549
  }, null);
1735
1550
  case "previewOnly":
1736
- return a(Wo, {
1551
+ return a(No, {
1737
1552
  key: "bar-previewOnly"
1738
1553
  }, null);
1739
1554
  case "htmlPreview":
1740
- return a(xo, {
1555
+ return a(go, {
1741
1556
  key: "bar-htmlPreview"
1742
1557
  }, null);
1743
1558
  case "github":
1744
- return a($o, {
1559
+ return a(vo, {
1745
1560
  key: "bar-github"
1746
1561
  }, null);
1747
1562
  case "mermaid":
1748
- return a(Fo, {
1563
+ return a(xo, {
1749
1564
  key: "bar-mermaid"
1750
1565
  }, null);
1751
1566
  case "katex":
1752
- return a(Ro, {
1567
+ return a(ko, {
1753
1568
  key: "bar-katex"
1754
1569
  }, null);
1755
1570
  }
1756
1571
  else if (m.value instanceof Array) {
1757
1572
  const p = m.value[g];
1758
- return p ? ne(p, {
1573
+ return p ? re(p, {
1759
1574
  theme: p.props?.theme || t.value,
1760
1575
  previewTheme: p.props?.theme || o.value,
1761
1576
  language: p.props?.theme || n.value,
1762
1577
  codeTheme: p.props?.codeTheme || d.value,
1578
+ // `disabled` 是自定义工具栏的公开属性,只绑定真正的 disabled 状态;
1579
+ // 只读下的正文写入由统一替换入口拦截。
1763
1580
  disabled: p.props?.disabled || i.value,
1764
1581
  showToolbarName: p.props?.showToolbarName || u.value,
1765
- insert(E) {
1766
- h.emit(e, y, "universal", {
1767
- generate: E
1582
+ insert(I) {
1583
+ T(e, {
1584
+ direct: "universal",
1585
+ params: {
1586
+ generate: I
1587
+ }
1768
1588
  });
1769
1589
  }
1770
1590
  }) : "";
1771
1591
  } else if (m.value?.children instanceof Array) {
1772
1592
  const p = m.value.children[g];
1773
- return p ? ne(p, {
1593
+ return p ? re(p, {
1774
1594
  theme: p.props?.theme || t.value,
1775
1595
  previewTheme: p.props?.theme || o.value,
1776
1596
  language: p.props?.theme || n.value,
1777
1597
  codeTheme: p.props?.codeTheme || d.value,
1598
+ // 只读时仍保留非编辑型自定义操作的可用性。
1778
1599
  disabled: p.props?.disabled || i.value,
1779
1600
  showToolbarName: p.props?.showToolbarName || u.value,
1780
- insert(E) {
1781
- h.emit(e, y, "universal", {
1782
- generate: E
1601
+ insert(I) {
1602
+ T(e, {
1603
+ direct: "universal",
1604
+ params: {
1605
+ generate: I
1606
+ }
1783
1607
  });
1784
1608
  }
1785
1609
  }) : "";
@@ -1787,7 +1611,7 @@ const Ze = () => {
1787
1611
  return "";
1788
1612
  }
1789
1613
  };
1790
- }, aa = /* @__PURE__ */ C({
1614
+ }, jo = /* @__PURE__ */ w({
1791
1615
  name: "FloatingToolbar",
1792
1616
  setup() {
1793
1617
  const e = r("floatingToolbars"), {
@@ -1797,20 +1621,20 @@ const Ze = () => {
1797
1621
  class: `${l}-floating-toolbar`
1798
1622
  }, [e.value.map((o) => t(o))]);
1799
1623
  }
1800
- }), ge = re.define(), la = qe.define({
1624
+ }), he = se.define(), Yo = qe.define({
1801
1625
  create() {
1802
1626
  return null;
1803
1627
  },
1804
1628
  update(e, t) {
1805
- for (const o of t.effects) o.is(ge) && (e = o.value);
1629
+ for (const o of t.effects) o.is(he) && (e = o.value);
1806
1630
  return e;
1807
1631
  },
1808
- provide: (e) => Vt.from(e)
1809
- }), na = (e) => {
1632
+ provide: (e) => Wt.from(e)
1633
+ }), Zo = (e) => {
1810
1634
  let t = null;
1811
1635
  const o = (s, c) => {
1812
1636
  t && t.kind === c.kind && t.pos === c.pos || (t = c, s.dispatch({
1813
- effects: ge.of({
1637
+ effects: he.of({
1814
1638
  pos: c.pos,
1815
1639
  above: !0,
1816
1640
  arrow: !0,
@@ -1821,13 +1645,13 @@ const Ze = () => {
1821
1645
  });
1822
1646
  const v = document.createElement("div");
1823
1647
  d.appendChild(v);
1824
- const m = Ct(aa);
1648
+ const m = kt(jo);
1825
1649
  return e.privide(m), m.mount(d), { dom: d, destroy: () => m.unmount() };
1826
1650
  }
1827
1651
  })
1828
1652
  }));
1829
1653
  }, n = (s) => {
1830
- t && (t = null, s.dispatch({ effects: ge.of(null) }));
1654
+ t && (t = null, s.dispatch({ effects: he.of(null) }));
1831
1655
  }, i = B.updateListener.of((s) => {
1832
1656
  if (s.selectionSet || s.docChanged) {
1833
1657
  const c = s.state, d = c.selection.main;
@@ -1839,19 +1663,19 @@ const Ze = () => {
1839
1663
  }
1840
1664
  }
1841
1665
  });
1842
- return [la, i];
1843
- }, ra = "#e5c07b", Le = "var(--md-color)", sa = "#56b6c2", ia = "#fff", Q = "#3f4a54", Ne = "#2d8cf0", ca = "#2d8cf0", ua = "#3f4a54", Ae = "#d19a66", da = "#c678dd", ma = "#f6f6f6", ba = "#ceedfa33", De = "var(--md-bk-color)", de = "var(--md-bk-color)", va = "#bad5fa", Re = "#3f4a54", ga = B.theme(
1666
+ return [Yo, i];
1667
+ }, Xo = "#e5c07b", Le = "var(--md-color)", Jo = "#56b6c2", Qo = "#fff", Q = "#3f4a54", De = "#2d8cf0", ea = "#2d8cf0", ta = "#3f4a54", Ne = "#d19a66", oa = "#c678dd", aa = "#f6f6f6", la = "#ceedfa33", Ae = "var(--md-bk-color)", me = "var(--md-bk-color)", na = "#bad5fa", Re = "#3f4a54", ra = B.theme(
1844
1668
  {
1845
1669
  "&": {
1846
1670
  color: Q,
1847
- backgroundColor: De
1671
+ backgroundColor: Ae
1848
1672
  },
1849
1673
  ".cm-content": {
1850
1674
  caretColor: Re
1851
1675
  },
1852
1676
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: Re },
1853
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: va },
1854
- ".cm-panels": { backgroundColor: ma, color: Q },
1677
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: na },
1678
+ ".cm-panels": { backgroundColor: aa, color: Q },
1855
1679
  ".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
1856
1680
  ".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
1857
1681
  ".cm-searchMatch": {
@@ -1867,13 +1691,13 @@ const Ze = () => {
1867
1691
  backgroundColor: "#bad0f847"
1868
1692
  },
1869
1693
  ".cm-gutters": {
1870
- backgroundColor: De,
1694
+ backgroundColor: Ae,
1871
1695
  color: Q,
1872
1696
  borderRight: "1px solid",
1873
1697
  borderColor: "var(--md-border-color)"
1874
1698
  },
1875
1699
  ".cm-activeLineGutter": {
1876
- backgroundColor: ba
1700
+ backgroundColor: la
1877
1701
  },
1878
1702
  ".cm-foldPlaceholder": {
1879
1703
  backgroundColor: "transparent",
@@ -1882,7 +1706,7 @@ const Ze = () => {
1882
1706
  },
1883
1707
  ".cm-tooltip": {
1884
1708
  border: "1px solid var(--md-border-color)",
1885
- backgroundColor: de
1709
+ backgroundColor: me
1886
1710
  },
1887
1711
  ".cm-tooltip .cm-tooltip-arrow:before": {
1888
1712
  borderTopColor: "var(--md-border-color)",
@@ -1890,8 +1714,8 @@ const Ze = () => {
1890
1714
  borderBottomColor: "var(--md-border-color)"
1891
1715
  },
1892
1716
  ".cm-tooltip .cm-tooltip-arrow:after": {
1893
- borderTopColor: de,
1894
- borderBottomColor: de
1717
+ borderTopColor: me,
1718
+ borderBottomColor: me
1895
1719
  },
1896
1720
  ".cm-tooltip-autocomplete": {
1897
1721
  "& > ul > li[aria-selected]": {
@@ -1900,11 +1724,11 @@ const Ze = () => {
1900
1724
  }
1901
1725
  }
1902
1726
  // { dark: true }
1903
- ), ha = Ye.define([
1904
- { tag: b.keyword, color: da },
1727
+ ), sa = Ke.define([
1728
+ { tag: b.keyword, color: oa },
1905
1729
  { tag: [b.name, b.deleted, b.character, b.propertyName, b.macroName], color: Le },
1906
- { tag: [b.function(b.variableName), b.labelName], color: ca },
1907
- { tag: [b.color, b.constant(b.name), b.standard(b.name)], color: Ae },
1730
+ { tag: [b.function(b.variableName), b.labelName], color: ea },
1731
+ { tag: [b.color, b.constant(b.name), b.standard(b.name)], color: Ne },
1908
1732
  { tag: [b.definition(b.name), b.separator], color: Q },
1909
1733
  {
1910
1734
  tag: [
@@ -1917,7 +1741,7 @@ const Ze = () => {
1917
1741
  b.self,
1918
1742
  b.namespace
1919
1743
  ],
1920
- color: ra
1744
+ color: Xo
1921
1745
  },
1922
1746
  {
1923
1747
  tag: [
@@ -1929,21 +1753,21 @@ const Ze = () => {
1929
1753
  b.link,
1930
1754
  b.special(b.string)
1931
1755
  ],
1932
- color: sa
1756
+ color: Jo
1933
1757
  },
1934
- { tag: [b.meta, b.comment], color: Ne },
1758
+ { tag: [b.meta, b.comment], color: De },
1935
1759
  { tag: b.strong, fontWeight: "bold" },
1936
1760
  { tag: b.emphasis, fontStyle: "italic" },
1937
1761
  { tag: b.strikethrough, textDecoration: "line-through" },
1938
- { tag: b.link, color: Ne, textDecoration: "underline" },
1762
+ { tag: b.link, color: De, textDecoration: "underline" },
1939
1763
  { tag: b.heading, fontWeight: "bold", color: Le },
1940
- { tag: [b.atom, b.bool, b.special(b.variableName)], color: Ae },
1941
- { tag: [b.processingInstruction, b.string, b.inserted], color: ua },
1942
- { tag: b.invalid, color: ia }
1764
+ { tag: [b.atom, b.bool, b.special(b.variableName)], color: Ne },
1765
+ { tag: [b.processingInstruction, b.string, b.inserted], color: ta },
1766
+ { tag: b.invalid, color: Qo }
1943
1767
  ]), Me = [
1944
- ga,
1945
- je(ha)
1946
- ], fa = "#e5c07b", Fe = "var(--md-color)", pa = "#56b6c2", Ta = "#ffffff", ee = "var(--md-color)", Be = "#e5c07b", wa = "#e5c07b", ya = "var(--md-color)", Pe = "#d19a66", Ca = "#c678dd", ka = "#21252b", $a = "#2c313a", He = "var(--md-bk-color)", me = "var(--md-bk-color)", xa = "#ceedfa33", Oe = "#528bff", Sa = B.theme(
1768
+ ra,
1769
+ Ue(sa)
1770
+ ], ia = "#e5c07b", Fe = "var(--md-color)", ca = "#56b6c2", ua = "#ffffff", ee = "var(--md-color)", Be = "#e5c07b", da = "#e5c07b", ma = "var(--md-color)", Pe = "#d19a66", ba = "#c678dd", va = "#21252b", ga = "#2c313a", He = "var(--md-bk-color)", be = "var(--md-bk-color)", ha = "#ceedfa33", Oe = "#528bff", pa = B.theme(
1947
1771
  {
1948
1772
  "&": {
1949
1773
  color: ee,
@@ -1953,8 +1777,8 @@ const Ze = () => {
1953
1777
  caretColor: Oe
1954
1778
  },
1955
1779
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: Oe },
1956
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: xa },
1957
- ".cm-panels": { backgroundColor: ka, color: ee },
1780
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ha },
1781
+ ".cm-panels": { backgroundColor: va, color: ee },
1958
1782
  ".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
1959
1783
  ".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
1960
1784
  ".cm-searchMatch": {
@@ -1976,7 +1800,7 @@ const Ze = () => {
1976
1800
  borderColor: "var(--md-border-color)"
1977
1801
  },
1978
1802
  ".cm-activeLineGutter": {
1979
- backgroundColor: $a
1803
+ backgroundColor: ga
1980
1804
  },
1981
1805
  ".cm-foldPlaceholder": {
1982
1806
  backgroundColor: "transparent",
@@ -1985,7 +1809,7 @@ const Ze = () => {
1985
1809
  },
1986
1810
  ".cm-tooltip": {
1987
1811
  border: "1px solid var(--md-border-color)",
1988
- backgroundColor: me
1812
+ backgroundColor: be
1989
1813
  },
1990
1814
  ".cm-tooltip .cm-tooltip-arrow:before": {
1991
1815
  borderTopColor: "var(--md-border-color)",
@@ -1993,8 +1817,8 @@ const Ze = () => {
1993
1817
  borderBottomColor: "var(--md-border-color)"
1994
1818
  },
1995
1819
  ".cm-tooltip .cm-tooltip-arrow:after": {
1996
- borderTopColor: me,
1997
- borderBottomColor: me
1820
+ borderTopColor: be,
1821
+ borderBottomColor: be
1998
1822
  },
1999
1823
  ".cm-tooltip-autocomplete": {
2000
1824
  "& > ul > li[aria-selected]": {
@@ -2003,10 +1827,10 @@ const Ze = () => {
2003
1827
  }
2004
1828
  },
2005
1829
  { dark: !0 }
2006
- ), Ia = Ye.define([
2007
- { tag: b.keyword, color: Ca },
1830
+ ), fa = Ke.define([
1831
+ { tag: b.keyword, color: ba },
2008
1832
  { tag: [b.name, b.deleted, b.character, b.propertyName, b.macroName], color: Fe },
2009
- { tag: [b.function(b.variableName), b.labelName], color: wa },
1833
+ { tag: [b.function(b.variableName), b.labelName], color: da },
2010
1834
  { tag: [b.color, b.constant(b.name), b.standard(b.name)], color: Pe },
2011
1835
  { tag: [b.definition(b.name), b.separator], color: ee },
2012
1836
  {
@@ -2020,7 +1844,7 @@ const Ze = () => {
2020
1844
  b.self,
2021
1845
  b.namespace
2022
1846
  ],
2023
- color: fa
1847
+ color: ia
2024
1848
  },
2025
1849
  {
2026
1850
  tag: [
@@ -2032,7 +1856,7 @@ const Ze = () => {
2032
1856
  b.link,
2033
1857
  b.special(b.string)
2034
1858
  ],
2035
- color: pa
1859
+ color: ca
2036
1860
  },
2037
1861
  { tag: [b.meta, b.comment], color: Be },
2038
1862
  { tag: b.strong, fontWeight: "bold" },
@@ -2041,28 +1865,34 @@ const Ze = () => {
2041
1865
  { tag: b.link, color: Be, textDecoration: "underline" },
2042
1866
  { tag: b.heading, fontWeight: "bold", color: Fe },
2043
1867
  { tag: [b.atom, b.bool, b.special(b.variableName)], color: Pe },
2044
- { tag: [b.processingInstruction, b.string, b.inserted], color: ya },
2045
- { tag: b.invalid, color: Ta }
1868
+ { tag: [b.processingInstruction, b.string, b.inserted], color: ma },
1869
+ { tag: b.invalid, color: ua }
2046
1870
  ]), Ve = [
2047
- Sa,
2048
- je(Ia)
2049
- ], Ea = (e, t) => {
1871
+ pa,
1872
+ Ue(fa)
1873
+ ], Ta = (e, t) => {
2050
1874
  const o = r("editorId"), n = (s) => {
2051
1875
  s instanceof Promise ? s.then((c) => {
2052
- h.emit(o, y, "universal", {
2053
- generate() {
2054
- return {
2055
- targetValue: c
2056
- };
1876
+ T(o, {
1877
+ direct: "universal",
1878
+ params: {
1879
+ generate() {
1880
+ return {
1881
+ targetValue: c
1882
+ };
1883
+ }
2057
1884
  }
2058
1885
  });
2059
1886
  }).catch((c) => {
2060
1887
  console.error(c);
2061
- }) : h.emit(o, y, "universal", {
2062
- generate() {
2063
- return {
2064
- targetValue: s
2065
- };
1888
+ }) : T(o, {
1889
+ direct: "universal",
1890
+ params: {
1891
+ generate() {
1892
+ return {
1893
+ targetValue: s
1894
+ };
1895
+ }
2066
1896
  }
2067
1897
  });
2068
1898
  };
@@ -2071,25 +1901,25 @@ const Ze = () => {
2071
1901
  return;
2072
1902
  if (s.clipboardData.files.length > 0) {
2073
1903
  const { files: g } = s.clipboardData;
2074
- h.emit(
1904
+ L.emit(
2075
1905
  o,
2076
1906
  fe,
2077
1907
  Array.from(g).filter((p) => /image\/.*/.test(p.type))
2078
1908
  ), s.preventDefault();
2079
1909
  return;
2080
1910
  }
2081
- const c = s.clipboardData.getData("text/plain"), d = t.value?.view.state.selection.main.to || 0, u = t.value?.view.state.doc.lineAt(d).from || 0, v = t.value?.view.state.doc.sliceString(u, d) || "", m = /!\[.*\]\(\s*$/.test(v), f = /!\[.*\]\((.*)\s?.*\)/.test(c);
1911
+ const c = s.clipboardData.getData("text/plain"), d = t.value?.view.state.selection.main.to || 0, u = t.value?.view.state.doc.lineAt(d).from || 0, v = t.value?.view.state.doc.sliceString(u, d) || "", m = /!\[.*\]\(\s*$/.test(v), h = /!\[.*\]\((.*)\s?.*\)/.test(c);
2082
1912
  if (m) {
2083
1913
  const g = e.transformImgUrl(c);
2084
1914
  n(g), s.preventDefault();
2085
1915
  return;
2086
- } else if (f) {
1916
+ } else if (h) {
2087
1917
  const g = c.match(new RegExp(`(?<=!\\[.*\\]\\()([^)\\s]+)(?=\\s?["']?.*["']?\\))`, "g"));
2088
1918
  g ? Promise.all(
2089
- g.map((p) => e.transformImgUrl(p))
1919
+ g.map((p) => Promise.resolve(e.transformImgUrl(p)))
2090
1920
  ).then((p) => {
2091
1921
  n(
2092
- p.reduce((k, E, M) => k.replace(g[M], E), c)
1922
+ p.reduce((y, I, M) => y.replace(g[M], I), c)
2093
1923
  );
2094
1924
  }).catch((p) => {
2095
1925
  console.error(p);
@@ -2098,23 +1928,26 @@ const Ze = () => {
2098
1928
  }
2099
1929
  if (e.autoDetectCode && s.clipboardData.types.includes("vscode-editor-data")) {
2100
1930
  const g = JSON.parse(s.clipboardData.getData("vscode-editor-data"));
2101
- h.emit(o, y, "code", {
2102
- mode: g.mode,
2103
- text: s.clipboardData.getData("text/plain")
1931
+ T(o, {
1932
+ direct: "code",
1933
+ params: {
1934
+ mode: g.mode,
1935
+ text: s.clipboardData.getData("text/plain")
1936
+ }
2104
1937
  }), s.preventDefault();
2105
1938
  return;
2106
1939
  }
2107
- e.maxlength && c.length + e.modelValue.length > e.maxlength && h.emit(o, X, {
1940
+ e.maxlength && c.length + e.modelValue.length > e.maxlength && L.emit(o, J, {
2108
1941
  name: "overlength",
2109
1942
  message: "The input text is too long",
2110
1943
  data: c
2111
1944
  });
2112
1945
  };
2113
- }, La = (e, t) => [
1946
+ }, wa = (e, t) => [
2114
1947
  {
2115
1948
  key: "Ctrl-b",
2116
1949
  mac: "Cmd-b",
2117
- run: () => (h.emit(e, y, "bold"), !0)
1950
+ run: () => (T(e, { direct: "bold" }), !0)
2118
1951
  },
2119
1952
  {
2120
1953
  key: "Ctrl-d",
@@ -2125,145 +1958,145 @@ const Ze = () => {
2125
1958
  {
2126
1959
  key: "Ctrl-s",
2127
1960
  mac: "Cmd-s",
2128
- run: (L) => (h.emit(e, Ge, L.state.doc.toString()), !0),
2129
- shift: () => (h.emit(e, y, "strikeThrough"), !0)
1961
+ run: (D) => (L.emit(e, Ye, D.state.doc.toString()), !0),
1962
+ shift: () => (T(e, { direct: "strikeThrough" }), !0)
2130
1963
  },
2131
1964
  {
2132
1965
  key: "Ctrl-u",
2133
1966
  mac: "Cmd-u",
2134
1967
  preventDefault: !0,
2135
- run: () => (h.emit(e, y, "underline"), !0),
2136
- shift: () => (h.emit(e, y, "unorderedList"), !0)
1968
+ run: () => (T(e, { direct: "underline" }), !0),
1969
+ shift: () => (T(e, { direct: "unorderedList" }), !0)
2137
1970
  },
2138
1971
  {
2139
1972
  key: "Ctrl-i",
2140
1973
  mac: "Cmd-i",
2141
1974
  preventDefault: !0,
2142
- run: () => (h.emit(e, y, "italic"), !0),
2143
- shift: () => (h.emit(e, y, "image"), !0)
1975
+ run: () => (T(e, { direct: "italic" }), !0),
1976
+ shift: () => (T(e, { direct: "image" }), !0)
2144
1977
  },
2145
1978
  {
2146
1979
  key: "Ctrl-1",
2147
1980
  mac: "Cmd-1",
2148
- run: () => (h.emit(e, y, "h1"), !0)
1981
+ run: () => (T(e, { direct: "h1" }), !0)
2149
1982
  },
2150
1983
  {
2151
1984
  key: "Ctrl-2",
2152
1985
  mac: "Cmd-2",
2153
- run: () => (h.emit(e, y, "h2"), !0)
1986
+ run: () => (T(e, { direct: "h2" }), !0)
2154
1987
  },
2155
1988
  {
2156
1989
  key: "Ctrl-3",
2157
1990
  mac: "Cmd-3",
2158
- run: () => (h.emit(e, y, "h3"), !0)
1991
+ run: () => (T(e, { direct: "h3" }), !0)
2159
1992
  },
2160
1993
  {
2161
1994
  key: "Ctrl-4",
2162
1995
  mac: "Cmd-4",
2163
- run: () => (h.emit(e, y, "h4"), !0)
1996
+ run: () => (T(e, { direct: "h4" }), !0)
2164
1997
  },
2165
1998
  {
2166
1999
  key: "Ctrl-5",
2167
2000
  mac: "Cmd-5",
2168
- run: () => (h.emit(e, y, "h5"), !0)
2001
+ run: () => (T(e, { direct: "h5" }), !0)
2169
2002
  },
2170
2003
  {
2171
2004
  key: "Ctrl-6",
2172
2005
  mac: "Cmd-6",
2173
- run: () => (h.emit(e, y, "h6"), !0)
2006
+ run: () => (T(e, { direct: "h6" }), !0)
2174
2007
  },
2175
2008
  {
2176
2009
  key: "Ctrl-ArrowUp",
2177
2010
  mac: "Cmd-ArrowUp",
2178
- run: () => (h.emit(e, y, "sup"), !0)
2011
+ run: () => (T(e, { direct: "sup" }), !0)
2179
2012
  },
2180
2013
  {
2181
2014
  key: "Ctrl-ArrowDown",
2182
2015
  mac: "Cmd-ArrowDown",
2183
- run: () => (h.emit(e, y, "sub"), !0)
2016
+ run: () => (T(e, { direct: "sub" }), !0)
2184
2017
  },
2185
2018
  {
2186
2019
  key: "Ctrl-o",
2187
2020
  mac: "Cmd-o",
2188
- run: () => (h.emit(e, y, "orderedList"), !0)
2021
+ run: () => (T(e, { direct: "orderedList" }), !0)
2189
2022
  },
2190
2023
  {
2191
2024
  key: "Ctrl-c",
2192
2025
  mac: "Cmd-c",
2193
- shift: () => (h.emit(e, y, "code"), !0),
2194
- any(L, T) {
2195
- return (T.ctrlKey || T.metaKey) && T.altKey && T.code === "KeyC" ? (h.emit(e, y, "codeRow"), !0) : !1;
2026
+ shift: () => (T(e, { direct: "code" }), !0),
2027
+ any(D, E) {
2028
+ return (E.ctrlKey || E.metaKey) && E.altKey && E.code === "KeyC" ? (T(e, { direct: "codeRow" }), !0) : !1;
2196
2029
  }
2197
2030
  },
2198
2031
  {
2199
2032
  key: "Ctrl-l",
2200
2033
  mac: "Cmd-l",
2201
- run: () => (h.emit(e, y, "link"), !0)
2034
+ run: () => (T(e, { direct: "link" }), !0)
2202
2035
  },
2203
2036
  {
2204
2037
  key: "Ctrl-f",
2205
2038
  mac: "Cmd-f",
2206
- shift: () => t.noPrettier ? !1 : (h.emit(e, y, "prettier"), !0)
2039
+ shift: () => t.noPrettier ? !1 : (T(e, { direct: "prettier" }), !0)
2207
2040
  },
2208
2041
  {
2209
- any: (L, T) => (T.ctrlKey || T.metaKey) && T.altKey && T.shiftKey && T.code === "KeyT" ? (h.emit(e, y, "table"), !0) : !1
2042
+ any: (D, E) => (E.ctrlKey || E.metaKey) && E.altKey && E.shiftKey && E.code === "KeyT" ? (T(e, { direct: "table" }), !0) : !1
2210
2043
  },
2211
- ...to
2212
- ], Na = /[a-z][a-z0-9.+-]*:\/\/[^\s<>"'`()]+(?:\([^\s<>"'`]*\)[^\s<>"'`]*)*/i, Aa = /\/\/[^\s<>"'`()]+/i, Da = /data:[a-z]+\/[a-z0-9.+-]+(?:;base64)?,[a-z0-9+/=%]+/i, Ra = /\/(?!\/)[^\s<>"'`()]+/i, se = new RegExp(
2213
- `(${Na.source}|${Aa.source}|${Da.source}|${Ra.source})`,
2044
+ ...ao
2045
+ ], ya = /[a-z][a-z0-9.+-]*:\/\/[^\s<>"'`()]+(?:\([^\s<>"'`]*\)[^\s<>"'`]*)*/i, Ca = /\/\/[^\s<>"'`()]+/i, ka = /data:[a-z]+\/[a-z0-9.+-]+(?:;base64)?,[a-z0-9+/=%]+/i, $a = /\/(?!\/)[^\s<>"'`()]+/i, ie = new RegExp(
2046
+ `(${ya.source}|${Ca.source}|${ka.source}|${$a.source})`,
2214
2047
  "gi"
2215
- ), Ma = /[a-z0-9.+-]/i, Fa = (e) => {
2048
+ ), xa = /[a-z0-9.+-]/i, Sa = (e) => {
2216
2049
  const t = [];
2217
- se.lastIndex = 0;
2050
+ ie.lastIndex = 0;
2218
2051
  let o;
2219
- for (; o = se.exec(e); ) {
2052
+ for (; o = ie.exec(e); ) {
2220
2053
  const n = o.index ?? 0, i = n > 0 ? e[n - 1] : "";
2221
- if (i && Ma.test(i) || i === "<" && e[n] === "/")
2054
+ if (i && xa.test(i) || i === "<" && e[n] === "/")
2222
2055
  continue;
2223
2056
  const c = n + o[0].length;
2224
2057
  t.push([n, c]);
2225
2058
  }
2226
2059
  return t;
2227
- }, Ba = (e, t, o) => e.some((n) => n.from === t && n.to === o), Pa = (e) => {
2228
- const t = e.shortenText || (() => "..."), o = re.define(), n = re.define(), i = (u, v) => {
2229
- const m = new Ht(), f = [];
2060
+ }, Ia = (e, t, o) => e.some((n) => n.from === t && n.to === o), Ea = (e) => {
2061
+ const t = e.shortenText || (() => "..."), o = se.define(), n = se.define(), i = (u, v) => {
2062
+ const m = new Ot(), h = [];
2230
2063
  for (let g = 1; g <= u.doc.lines; g++) {
2231
- const p = u.doc.line(g), k = p.text;
2232
- se.lastIndex = 0;
2233
- const E = e.findTexts?.({
2064
+ const p = u.doc.line(g), y = p.text;
2065
+ ie.lastIndex = 0;
2066
+ const I = e.findTexts?.({
2234
2067
  state: u,
2235
- lineText: k,
2068
+ lineText: y,
2236
2069
  lineNumber: p.number,
2237
2070
  lineFrom: p.from,
2238
2071
  lineTo: p.to,
2239
- defaultTextRegex: se
2240
- }) ?? Fa(k);
2241
- for (const M of E) {
2072
+ defaultTextRegex: ie
2073
+ }) ?? Sa(y);
2074
+ for (const M of I) {
2242
2075
  if (!M) continue;
2243
- const [A, S] = M;
2244
- if (typeof A != "number" || typeof S != "number" || A < 0 || S <= A || A >= k.length || S > k.length)
2076
+ const [R, x] = M;
2077
+ if (typeof R != "number" || typeof x != "number" || R < 0 || x <= R || R >= y.length || x > y.length)
2245
2078
  continue;
2246
- const D = k.slice(A, S);
2247
- if (!D || D.length <= e.maxLength)
2079
+ const N = y.slice(R, x);
2080
+ if (!N || N.length <= e.maxLength)
2248
2081
  continue;
2249
- const L = p.from + A, T = p.from + S;
2250
- if (Ba(v, L, T)) {
2251
- f.push({ from: L, to: T });
2082
+ const D = p.from + R, E = p.from + x;
2083
+ if (Ia(v, D, E)) {
2084
+ h.push({ from: D, to: E });
2252
2085
  continue;
2253
2086
  }
2254
- const R = t(D);
2087
+ const $ = t(N);
2255
2088
  m.add(
2256
- L,
2257
- T,
2258
- Wt.replace({ widget: new s(R, D, L, T) })
2089
+ D,
2090
+ E,
2091
+ _t.replace({ widget: new s($, N, D, E) })
2259
2092
  );
2260
2093
  }
2261
2094
  }
2262
- return { deco: m.finish(), expanded: f };
2095
+ return { deco: m.finish(), expanded: h };
2263
2096
  };
2264
- class s extends _t {
2265
- constructor(v, m, f, g) {
2266
- super(), this.short = v, this.raw = m, this.from = f, this.to = g;
2097
+ class s extends zt {
2098
+ constructor(v, m, h, g) {
2099
+ super(), this.short = v, this.raw = m, this.from = h, this.to = g;
2267
2100
  }
2268
2101
  short;
2269
2102
  raw;
@@ -2271,8 +2104,8 @@ const Ze = () => {
2271
2104
  to;
2272
2105
  toDOM(v) {
2273
2106
  const m = document.createElement("span");
2274
- return m.textContent = this.short, m.className = "cm-short-text", m.title = this.raw, m.style.display = "inline", m.style.textDecoration = "underline", m.addEventListener("mousedown", (f) => {
2275
- f.preventDefault(), f.stopPropagation(), v.dispatch({
2107
+ return m.textContent = this.short, m.className = "cm-short-text", m.title = this.raw, m.style.display = "inline", m.style.textDecoration = "underline", m.addEventListener("mousedown", (h) => {
2108
+ h.preventDefault(), h.stopPropagation(), v.dispatch({
2276
2109
  selection: U.cursor(this.from),
2277
2110
  effects: o.of({
2278
2111
  from: this.from,
@@ -2280,8 +2113,8 @@ const Ze = () => {
2280
2113
  expand: !0
2281
2114
  })
2282
2115
  }), v.focus();
2283
- }), m.addEventListener("click", (f) => {
2284
- f.preventDefault();
2116
+ }), m.addEventListener("click", (h) => {
2117
+ h.preventDefault();
2285
2118
  }), m;
2286
2119
  }
2287
2120
  ignoreEvent() {
@@ -2301,12 +2134,12 @@ const Ze = () => {
2301
2134
  from: v.changes.mapPos(g, 1),
2302
2135
  to: v.changes.mapPos(p, -1)
2303
2136
  })).filter(({ from: g, to: p }) => g < p));
2304
- let f = m !== u.expanded;
2137
+ let h = m !== u.expanded;
2305
2138
  for (const g of v.effects)
2306
2139
  g.is(o) ? g.value.expand ? m = [{ from: g.value.from, to: g.value.to }] : m = m.filter(
2307
- ({ from: p, to: k }) => p !== g.value.from || k !== g.value.to
2140
+ ({ from: p, to: y }) => p !== g.value.from || y !== g.value.to
2308
2141
  ) : g.is(n) && m.length > 0 && (m = []);
2309
- return !f && m !== u.expanded && (f = !0), v.docChanged || f ? i(v.state, m) : u;
2142
+ return !h && m !== u.expanded && (h = !0), v.docChanged || h ? i(v.state, m) : u;
2310
2143
  },
2311
2144
  provide: (u) => B.decorations.compute([u], (v) => v.field(u).deco)
2312
2145
  }), d = B.domEventHandlers({
@@ -2314,11 +2147,11 @@ const Ze = () => {
2314
2147
  const m = v.state.field(c, !1);
2315
2148
  if (!m || m.expanded.length === 0)
2316
2149
  return !1;
2317
- const f = u.target;
2318
- if (f && v.dom.contains(f)) {
2319
- const g = v.posAtDOM(f, 0);
2150
+ const h = u.target;
2151
+ if (h && v.dom.contains(h)) {
2152
+ const g = v.posAtDOM(h, 0);
2320
2153
  if (g != null && g !== -1 && m.expanded.some(
2321
- ({ from: k, to: E }) => g >= k && g <= E
2154
+ ({ from: y, to: I }) => g >= y && g <= I
2322
2155
  ))
2323
2156
  return !1;
2324
2157
  }
@@ -2326,76 +2159,303 @@ const Ze = () => {
2326
2159
  }
2327
2160
  });
2328
2161
  return [c, d];
2162
+ }, La = async (e, t, o) => {
2163
+ if (/^h[1-6]$/.test(e))
2164
+ return Da(e, t);
2165
+ if (e === "prettier")
2166
+ return await Na(t, o);
2167
+ switch (e) {
2168
+ case "bold":
2169
+ case "underline":
2170
+ case "italic":
2171
+ case "strikeThrough":
2172
+ case "sub":
2173
+ case "sup":
2174
+ case "codeRow":
2175
+ case "katexInline":
2176
+ case "katexBlock":
2177
+ return Ra(e, t);
2178
+ case "quote":
2179
+ case "orderedList":
2180
+ case "unorderedList":
2181
+ case "task":
2182
+ return Fa(e, t);
2183
+ case "code":
2184
+ return Ba(o, t);
2185
+ case "table":
2186
+ return Oa(o);
2187
+ case "link": {
2188
+ const n = t.getSelectedText(), { desc: i = n, url: s = "" } = o, c = `[${i}](${s})`;
2189
+ return {
2190
+ text: c,
2191
+ options: {
2192
+ select: s === "",
2193
+ deviationStart: c.length - s.length - 1,
2194
+ deviationEnd: -1
2195
+ }
2196
+ };
2197
+ }
2198
+ case "image":
2199
+ return Ha(o, t);
2200
+ case "flow":
2201
+ case "sequence":
2202
+ case "gantt":
2203
+ case "class":
2204
+ case "state":
2205
+ case "pie":
2206
+ case "relationship":
2207
+ case "journey":
2208
+ return Pa(e);
2209
+ case "universal":
2210
+ return Va(t.getSelectedText(), o);
2211
+ default:
2212
+ return { text: "", options: {} };
2213
+ }
2214
+ }, Da = (e, t) => {
2215
+ const o = e.slice(1), n = "#".repeat(Number(o)), [i, s, c] = Te(t, {
2216
+ wholeLine: !0
2217
+ });
2218
+ return {
2219
+ text: `${n} ${i}`,
2220
+ options: { deviationStart: n.length + 1, replaceStart: s, replaceEnd: c }
2221
+ };
2222
+ }, Na = async (e, t) => {
2223
+ const o = window.prettier || X.editorExtensions.prettier?.prettierInstance, n = [
2224
+ window.prettierPlugins?.markdown || X.editorExtensions.prettier?.parserMarkdownInstance
2225
+ ];
2226
+ return !o || !n[0] ? (L.emit(t.editorId, J, {
2227
+ name: "prettier",
2228
+ message: "prettier is undefined"
2229
+ }), {
2230
+ text: e.getValue(),
2231
+ options: { select: !1, replaceAll: !0 }
2232
+ }) : {
2233
+ text: await o.format(e.getValue(), {
2234
+ parser: "markdown",
2235
+ plugins: n
2236
+ }),
2237
+ options: { select: !1, replaceAll: !0 }
2238
+ };
2239
+ }, Aa = {
2240
+ bold: ["**", "**", 2, -2],
2241
+ underline: ["<u>", "</u>", 3, -4],
2242
+ italic: ["*", "*", 1, -1],
2243
+ strikeThrough: ["~~", "~~", 2, -2],
2244
+ sub: ["~", "~", 1, -1],
2245
+ sup: ["^", "^", 1, -1],
2246
+ codeRow: ["`", "`", 1, -1],
2247
+ katexInline: ["$", "$", 1, -1],
2248
+ katexBlock: [`
2249
+ $$
2250
+ `, `
2251
+ $$
2252
+ `, 4, -4]
2253
+ }, Ra = (e, t) => {
2254
+ const o = t.getSelectedText(), [n, i, s, c] = Aa[e];
2255
+ return {
2256
+ text: `${n}${o}${i}`,
2257
+ options: {
2258
+ deviationStart: s,
2259
+ deviationEnd: c
2260
+ // replaceStart, replaceEnd
2261
+ }
2262
+ };
2263
+ }, Ma = {
2264
+ quote: "> ",
2265
+ unorderedList: "- ",
2266
+ orderedList: 1,
2267
+ task: "- [ ] "
2268
+ }, Fa = (e, t) => {
2269
+ const [o, n, i] = Te(t, {
2270
+ wholeLine: !0
2271
+ }), s = o.split(`
2272
+ `), c = Ma[e], d = e === "orderedList" ? s.map((m, h) => `${c + h}. ${m}`) : s.map((m) => `${c}${m}`), u = e === "orderedList" ? "1. " : c.toString(), v = s.length === 1 ? u.length : 0;
2273
+ return {
2274
+ text: d.join(`
2275
+ `),
2276
+ options: { deviationStart: v, replaceStart: n, replaceEnd: i }
2277
+ };
2278
+ }, Ba = (e, t) => {
2279
+ const [o, n, i] = Te(t), s = e.mode || "language", c = `
2280
+ \`\`\`${s}
2281
+ ${e.text || o || ""}
2282
+ \`\`\`
2283
+ `;
2284
+ return {
2285
+ text: c,
2286
+ options: {
2287
+ deviationStart: 4,
2288
+ deviationEnd: 4 + s.length - c.length,
2289
+ replaceStart: n,
2290
+ replaceEnd: i
2291
+ }
2292
+ };
2293
+ }, Pa = (e) => ({
2294
+ text: `
2295
+ \`\`\`mermaid
2296
+ ${{
2297
+ flow: `flowchart TD
2298
+ Start --> Stop`,
2299
+ sequence: `sequenceDiagram
2300
+ A->>B: hello!
2301
+ B-->>A: hi!`,
2302
+ gantt: `gantt
2303
+ title Gantt Chart
2304
+ dateFormat YYYY-MM-DD`,
2305
+ class: `classDiagram
2306
+ class Animal`,
2307
+ state: `stateDiagram-v2
2308
+ s1 --> s2`,
2309
+ pie: `pie
2310
+ "Dogs" : 386
2311
+ "Cats" : 85
2312
+ "Rats" : 15`,
2313
+ relationship: `erDiagram
2314
+ CAR ||--o{ NAMED-DRIVER : allows`,
2315
+ journey: `journey
2316
+ title My Journey`,
2317
+ ...X.editorConfig.mermaidTemplate
2318
+ }[e]}
2319
+ \`\`\`
2320
+ `,
2321
+ options: { deviationStart: 12, deviationEnd: -5 }
2322
+ }), Ha = (e, t) => {
2323
+ const o = t.getSelectedText(), { desc: n = o, url: i = "", urls: s } = e;
2324
+ let c = "";
2325
+ const d = i === "" && (!s || s instanceof Array && s.length === 0);
2326
+ return s instanceof Array ? c = s.reduce((u, v) => {
2327
+ const {
2328
+ url: m = "",
2329
+ alt: h = "",
2330
+ title: g = ""
2331
+ } = typeof v == "object" ? v : { url: v };
2332
+ return u + `![${h}](${m}${g ? " '" + g + "'" : ""})
2333
+ `;
2334
+ }, "") : c = `![${n}](${i})
2335
+ `, {
2336
+ text: c,
2337
+ options: {
2338
+ select: i === "",
2339
+ deviationStart: d ? c.length - i.length - 2 : c.length,
2340
+ deviationEnd: d ? -2 : 0
2341
+ }
2342
+ };
2343
+ }, Oa = (e) => {
2344
+ const { selectedShape: t = { x: 1, y: 1 } } = e, { x: o, y: n } = t;
2345
+ let i = `
2346
+ | Column`;
2347
+ for (let s = 0; s <= n; s++)
2348
+ i += " |";
2349
+ i += `
2350
+ |`;
2351
+ for (let s = 0; s <= n; s++)
2352
+ i += " - |";
2353
+ for (let s = 0; s <= o; s++) {
2354
+ i += `
2355
+ |`;
2356
+ for (let c = 0; c <= n; c++)
2357
+ i += " |";
2358
+ }
2359
+ return i += `
2360
+ `, { text: i, options: { deviationStart: 3, deviationEnd: 10 - i.length } };
2361
+ }, Va = (e, t) => {
2362
+ const { generate: o } = t, n = o(e);
2363
+ return {
2364
+ text: n.targetValue,
2365
+ options: {
2366
+ select: n.select ?? !0,
2367
+ deviationStart: n.deviationStart || 0,
2368
+ deviationEnd: n.deviationEnd || 0
2369
+ }
2370
+ };
2371
+ }, Te = (e, t = { wholeLine: !1 }) => {
2372
+ const o = e.view.state, n = o.selection.main;
2373
+ if (n.empty) {
2374
+ const i = o.doc.lineAt(n.from);
2375
+ return [o.doc.lineAt(n.from).text, i.from, i.to];
2376
+ } else if (t.wholeLine) {
2377
+ const i = o.doc.lineAt(n.from), s = o.doc.lineAt(n.to);
2378
+ return [
2379
+ o.doc.sliceString(i.from, s.to),
2380
+ i.from,
2381
+ s.to
2382
+ ];
2383
+ }
2384
+ return [
2385
+ o.doc.sliceString(n.from, n.to),
2386
+ n.from,
2387
+ n.to
2388
+ ];
2329
2389
  };
2330
2390
  B.EDIT_CONTEXT = !1;
2331
- const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.extension, Ha = (e) => {
2391
+ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.extension, Wa = (e) => {
2332
2392
  const t = Xe(e);
2333
2393
  return e.compartment ? e.compartment.of(t) : t;
2334
- }, Oa = (e) => {
2394
+ }, _a = (e) => {
2335
2395
  const t = r("tabWidth"), o = r("editorId"), n = r("theme"), i = r("previewTheme"), s = r("language"), c = r(
2336
2396
  "usedLanguageText"
2337
- ), d = r("disabled"), u = r("showToolbarName"), v = r("customIcon"), m = r("noUploadImg"), f = r("tableShape"), g = r("noPrettier"), p = r("codeTheme"), k = r("setting"), E = r("updateSetting"), M = r("catalogVisible"), A = r("defToolbars"), S = r("floatingToolbars"), D = r("rootRef"), L = I(), T = kt(), R = I(!1), z = new j(), q = new j(), $ = new j(), Te = new j(), Je = new j(), Qe = La(o, {
2338
- noPrettier: g
2339
- }), we = () => [
2397
+ ), d = r("disabled"), u = r("contentDisabled"), v = r("showToolbarName"), m = r("customIcon"), h = r("noUploadImg"), g = r("tableShape"), p = r("noPrettier"), y = r("codeTheme"), I = r("setting"), M = r("updateSetting"), R = r("catalogVisible"), x = r("defToolbars"), N = r("floatingToolbars"), D = r("rootRef"), E = S(), $ = $t(), V = S(!1), _ = new Y(), C = new Y(), ue = new Y(), we = new Y(), Je = new Y(), Qe = wa(o, {
2398
+ noPrettier: p
2399
+ }), ye = () => [
2340
2400
  ...Qe,
2341
- ...Rt,
2342
2401
  ...Mt,
2343
- Ft
2402
+ ...Ft,
2403
+ Bt
2344
2404
  ], oe = {
2345
- paste: Ea(e, T),
2405
+ paste: Ta(e, $),
2346
2406
  blur: e.onBlur,
2347
2407
  focus: e.onFocus,
2348
2408
  drop: e.onDrop,
2349
2409
  compositionstart: () => {
2350
- R.value = !0;
2410
+ V.value = !0;
2351
2411
  },
2352
- compositionend: (w, F) => {
2353
- R.value = !1, e.updateModelValue(F.state.doc.toString());
2412
+ compositionend: (f, F) => {
2413
+ V.value = !1, e.updateModelValue(F.state.doc.toString());
2354
2414
  },
2355
- input: (w) => {
2356
- e.onInput && e.onInput(w);
2357
- const { data: F } = w;
2358
- e.maxlength && e.modelValue.length + F.length > e.maxlength && h.emit(o, X, {
2415
+ input: (f) => {
2416
+ e.onInput && e.onInput(f);
2417
+ const { data: F } = f;
2418
+ e.maxlength && e.modelValue.length + F.length > e.maxlength && L.emit(o, J, {
2359
2419
  name: "overlength",
2360
2420
  message: "The input text is too long",
2361
2421
  data: F
2362
2422
  });
2363
2423
  }
2364
- }, et = na({
2365
- privide(w) {
2366
- w.provide("editorId", o), w.provide("theme", n), w.provide("previewTheme", i), w.provide("language", s), w.provide("disabled", d), w.provide("noUploadImg", m), w.provide("tableShape", f), w.provide("noPrettier", g), w.provide("codeTheme", p), w.provide("showToolbarName", u), w.provide("setting", k), w.provide("updateSetting", E), w.provide("usedLanguageText", c), w.provide("catalogVisible", M), w.provide("defToolbars", A), w.provide("tabWidth", t), w.provide("customIcon", v), w.provide("floatingToolbars", S), w.provide("rootRef", D);
2424
+ }, et = Zo({
2425
+ privide(f) {
2426
+ f.provide("editorId", o), f.provide("theme", n), f.provide("previewTheme", i), f.provide("language", s), f.provide("disabled", d), f.provide("contentDisabled", u), f.provide("noUploadImg", h), f.provide("tableShape", g), f.provide("noPrettier", p), f.provide("codeTheme", y), f.provide("showToolbarName", v), f.provide("setting", I), f.provide("updateSetting", M), f.provide("usedLanguageText", c), f.provide("catalogVisible", R), f.provide("defToolbars", x), f.provide("tabWidth", t), f.provide("customIcon", m), f.provide("floatingToolbars", N), f.provide("rootRef", D);
2367
2427
  }
2368
2428
  }), tt = [
2369
2429
  {
2370
2430
  type: "theme",
2371
- extension: ({ theme: w }) => w.value === "light" ? Me : Ve,
2372
- compartment: z,
2431
+ extension: ({ theme: f }) => f.value === "light" ? Me : Ve,
2432
+ compartment: _,
2373
2433
  options: {
2374
2434
  theme: n
2375
2435
  }
2376
2436
  },
2377
2437
  {
2378
2438
  type: "updateListener",
2379
- extension: B.updateListener.of((w) => {
2380
- w.docChanged && (e.onChange(w.state.doc.toString()), R.value || e.updateModelValue(w.state.doc.toString()));
2439
+ extension: B.updateListener.of((f) => {
2440
+ f.docChanged && (e.onChange(f.state.doc.toString()), V.value || e.updateModelValue(f.state.doc.toString()));
2381
2441
  })
2382
2442
  },
2383
2443
  {
2384
2444
  type: "domEventHandlers",
2385
2445
  extension: B.domEventHandlers(oe),
2386
- compartment: Te
2446
+ compartment: we
2387
2447
  },
2388
2448
  {
2389
2449
  type: "completions",
2390
2450
  extension: Ee(e.completions),
2391
- compartment: q
2451
+ compartment: C
2392
2452
  },
2393
2453
  {
2394
2454
  type: "history",
2395
2455
  extension: $e(),
2396
- compartment: $
2456
+ compartment: ue
2397
2457
  }
2398
- ], ye = Z.codeMirrorExtensions(
2458
+ ], Ce = X.codeMirrorExtensions(
2399
2459
  [
2400
2460
  // 横向换行
2401
2461
  {
@@ -2404,200 +2464,190 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2404
2464
  },
2405
2465
  {
2406
2466
  type: "keymap",
2407
- extension: zt.of(we())
2467
+ extension: qt.of(ye())
2408
2468
  },
2409
2469
  // 解决多行placeholder时,光标异常的情况
2410
2470
  {
2411
2471
  type: "drawSelection",
2412
- extension: qt()
2472
+ extension: Ut()
2413
2473
  },
2414
2474
  {
2415
2475
  type: "markdown",
2416
- extension: Bt({ codeLanguages: Pt })
2476
+ extension: Pt({ codeLanguages: Ht })
2417
2477
  },
2418
2478
  {
2419
2479
  type: "linkShortener",
2420
- extension: (w) => Pa(w),
2480
+ extension: (f) => Ea(f),
2421
2481
  options: {
2422
2482
  maxLength: 30
2423
2483
  }
2424
2484
  },
2425
2485
  {
2426
2486
  type: "floatingToolbar",
2427
- extension: S.value.length > 0 ? et : [],
2487
+ extension: N.value.length > 0 ? et : [],
2428
2488
  compartment: Je
2429
2489
  }
2430
2490
  ],
2431
2491
  {
2432
2492
  editorId: o,
2433
2493
  theme: n.value,
2434
- keyBindings: we()
2494
+ keyBindings: ye()
2435
2495
  }
2436
- ), ot = () => [...tt, ...ye].map(Ha);
2496
+ ), ot = () => [...tt, ...Ce].map(Wa);
2437
2497
  return K(() => {
2438
- const w = new B({
2498
+ const f = new B({
2439
2499
  doc: e.modelValue,
2440
- parent: L.value,
2500
+ parent: E.value,
2441
2501
  extensions: ot()
2442
- }), F = new go(w);
2443
- T.value = F, setTimeout(() => {
2444
- F.setTabSize(t), F.setDisabled(d.value), F.setReadOnly(e.readonly), e.placeholder && F.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && F.setMaxLength(e.maxlength), e.autofocus && w.focus();
2445
- }, 0), h.on(o, {
2446
- name: Ke,
2502
+ }), F = new no(f);
2503
+ $.value = F, setTimeout(() => {
2504
+ F.setTabSize(t), F.setDisabled(d.value), F.setReadOnly(e.readonly), e.placeholder && F.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && F.setMaxLength(e.maxlength), e.autofocus && f.focus();
2505
+ }, 0), L.on(o, {
2506
+ name: je,
2447
2507
  callback() {
2448
- At(w);
2508
+ At(f);
2449
2509
  }
2450
- }), h.on(o, {
2451
- name: Ue,
2510
+ }), L.on(o, {
2511
+ name: Ge,
2452
2512
  callback() {
2453
- Dt(w);
2513
+ Rt(f);
2454
2514
  }
2455
- }), h.on(o, {
2456
- name: y,
2457
- async callback(O, H = {}) {
2458
- if (O === "image" && H.transform) {
2459
- const V = e.transformImgUrl(H.url);
2460
- if (V instanceof Promise)
2461
- V.then(async (_) => {
2462
- const { text: W, options: J } = await ue(
2463
- O,
2464
- T.value,
2465
- { ...H, url: _ }
2466
- );
2467
- T.value?.replaceSelectedText(W, J, o);
2468
- }).catch((_) => {
2469
- console.error(_);
2470
- });
2471
- else {
2472
- const { text: _, options: W } = await ue(O, T.value, {
2473
- ...H,
2474
- url: V
2475
- });
2476
- T.value?.replaceSelectedText(_, W, o);
2477
- }
2478
- } else {
2479
- const { text: V, options: _ } = await ue(
2480
- O,
2481
- T.value,
2482
- H
2515
+ }), L.on(o, {
2516
+ name: Yt,
2517
+ async callback({ direct: z, params: H = {}, source: G = "interaction" }) {
2518
+ const ae = () => u.value && G !== "programmatic";
2519
+ if (ae()) return;
2520
+ const O = async (W) => {
2521
+ const { text: q, options: at } = await La(
2522
+ z,
2523
+ $.value,
2524
+ W
2483
2525
  );
2484
- T.value?.replaceSelectedText(V, _, o);
2485
- }
2526
+ ae() || $.value?.replaceSelectedText(q, at, o);
2527
+ };
2528
+ if (z === "image" && H.transform) {
2529
+ const W = e.transformImgUrl(H.url);
2530
+ W instanceof Promise ? W.then((q) => O({ ...H, url: q })).catch((q) => {
2531
+ console.error(q);
2532
+ }) : await O({ ...H, url: W });
2533
+ } else
2534
+ await O(H);
2486
2535
  }
2487
- }), h.on(o, {
2488
- name: Gt,
2489
- callback: Et((O) => {
2490
- const H = { ...oe }, V = Object.keys(oe);
2491
- for (const _ in O) {
2492
- const W = _;
2493
- V.includes(W) ? H[W] = (J, Ce) => {
2494
- O[W](J, Ce), J.defaultPrevented || oe[W](J, Ce);
2495
- } : H[W] = O[W];
2536
+ }), L.on(o, {
2537
+ name: Zt,
2538
+ callback: Lt((z) => {
2539
+ const H = { ...oe }, G = Object.keys(oe);
2540
+ for (const ae in z) {
2541
+ const O = ae;
2542
+ G.includes(O) ? H[O] = (W, q) => {
2543
+ z[O](W, q), W.defaultPrevented || oe[O](W, q);
2544
+ } : H[O] = z[O];
2496
2545
  }
2497
- T.value?.view.dispatch({
2498
- effects: Te.reconfigure(
2546
+ $.value?.view.dispatch({
2547
+ effects: we.reconfigure(
2499
2548
  B.domEventHandlers(H)
2500
2549
  )
2501
2550
  });
2502
2551
  })
2503
- }), h.on(o, {
2504
- name: jt,
2505
- callback: (O, H) => {
2506
- const V = w.state.doc.line(O);
2507
- w.dispatch(
2508
- w.state.update({ changes: { from: V.from, to: V.to, insert: H } })
2552
+ }), L.on(o, {
2553
+ name: Xt,
2554
+ callback: (z, H) => {
2555
+ if (u.value) return;
2556
+ const G = f.state.doc.line(z);
2557
+ f.dispatch(
2558
+ f.state.update({ changes: { from: G.from, to: G.to, insert: H } })
2509
2559
  );
2510
2560
  }
2511
- }), h.on(o, {
2512
- name: Yt,
2561
+ }), L.on(o, {
2562
+ name: Jt,
2513
2563
  callback() {
2514
- h.emit(o, xe, w);
2564
+ L.emit(o, xe, f);
2515
2565
  }
2516
- }), h.emit(o, xe, w);
2517
- }), N(
2566
+ }), L.emit(o, xe, f);
2567
+ }), A(
2518
2568
  n,
2519
2569
  () => {
2520
- T.value?.view.dispatch({
2521
- effects: z.reconfigure(n.value === "light" ? Me : Ve)
2570
+ $.value?.view.dispatch({
2571
+ effects: _.reconfigure(n.value === "light" ? Me : Ve)
2522
2572
  });
2523
2573
  },
2524
2574
  { deep: !0 }
2525
- ), N(
2575
+ ), A(
2526
2576
  () => e.completions,
2527
2577
  () => {
2528
- T.value?.view.dispatch({
2529
- effects: q.reconfigure(Ee(e.completions))
2578
+ $.value?.view.dispatch({
2579
+ effects: C.reconfigure(Ee(e.completions))
2530
2580
  });
2531
2581
  },
2532
2582
  { deep: !0 }
2533
- ), N(
2583
+ ), A(
2534
2584
  () => e.modelValue,
2535
2585
  () => {
2536
- T.value?.getValue() !== e.modelValue && T.value?.setValue(e.modelValue);
2586
+ $.value?.getValue() !== e.modelValue && $.value?.setValue(e.modelValue);
2537
2587
  }
2538
- ), N(
2588
+ ), A(
2539
2589
  () => e.placeholder,
2540
2590
  () => {
2541
- T.value?.setPlaceholder(e.placeholder);
2591
+ $.value?.setPlaceholder(e.placeholder);
2542
2592
  }
2543
- ), N([d], () => {
2544
- T.value?.setDisabled(d.value);
2545
- }), N(
2593
+ ), A([d], () => {
2594
+ $.value?.setDisabled(d.value);
2595
+ }), A(
2546
2596
  () => e.readonly,
2547
2597
  () => {
2548
- T.value?.setDisabled(e.readonly);
2598
+ $.value?.setReadOnly(e.readonly);
2549
2599
  }
2550
- ), N(
2600
+ ), A(
2551
2601
  () => e.maxlength,
2552
2602
  () => {
2553
- e.maxlength && T.value?.setMaxLength(e.maxlength);
2603
+ e.maxlength && $.value?.setMaxLength(e.maxlength);
2554
2604
  }
2555
- ), fo(() => {
2556
- const w = ye.find(
2605
+ ), so(() => {
2606
+ const f = Ce.find(
2557
2607
  (F) => F.type === "floatingToolbar"
2558
2608
  );
2559
- w?.compartment && (S.value.length > 0 ? T.value?.view.dispatch({
2560
- effects: w.compartment.reconfigure(
2561
- Xe(w)
2609
+ f?.compartment && (N.value.length > 0 ? $.value?.view.dispatch({
2610
+ effects: f.compartment.reconfigure(
2611
+ Xe(f)
2562
2612
  )
2563
- }) : T.value?.view.dispatch({
2564
- effects: w.compartment.reconfigure([])
2613
+ }) : $.value?.view.dispatch({
2614
+ effects: f.compartment.reconfigure([])
2565
2615
  }));
2566
- }, S), {
2567
- inputWrapperRef: L,
2568
- codeMirrorUt: T,
2616
+ }, N), {
2617
+ inputWrapperRef: E,
2618
+ codeMirrorUt: $,
2569
2619
  resetHistory() {
2570
- T.value?.view.dispatch({ effects: $.reconfigure([]) }), T.value?.view.dispatch({ effects: $.reconfigure($e()) });
2620
+ $.value?.view.dispatch({ effects: ue.reconfigure([]) }), $.value?.view.dispatch({ effects: ue.reconfigure($e()) });
2571
2621
  }
2572
2622
  };
2573
- }, Va = (e, t, o) => {
2574
- const n = r("setting"), i = P(() => /px$/.test(`${e.inputBoxWidth}`) ? "50%" : e.inputBoxWidth), s = Y({
2623
+ }, za = (e, t, o) => {
2624
+ const n = r("setting"), i = P(() => /px$/.test(`${e.inputBoxWidth}`) ? "50%" : e.inputBoxWidth), s = Z({
2575
2625
  resizedWidth: i.value
2576
- }), c = Y({
2626
+ }), c = Z({
2577
2627
  width: i.value
2578
- }), d = Y({
2628
+ }), d = Z({
2579
2629
  insetInlineStart: i.value,
2580
2630
  display: "initial"
2581
- }), u = (f) => {
2631
+ }), u = (h) => {
2582
2632
  const g = t.value?.offsetWidth || 0, p = t.value?.getBoundingClientRect().x || 0;
2583
- let k = f.x - p;
2584
- k / g < ae ? k = g * ae : k > g - g * ae && (k = g - g * ae);
2585
- const E = `${k / g * 100}%`;
2586
- c.width = E, d.insetInlineStart = E, s.resizedWidth = E, e.oninputBoxWidthChange?.(E);
2587
- }, v = (f) => {
2588
- f.target === o.value && document.addEventListener("mousemove", u);
2633
+ let y = h.x - p;
2634
+ y / g < le ? y = g * le : y > g - g * le && (y = g - g * le);
2635
+ const I = `${y / g * 100}%`;
2636
+ c.width = I, d.insetInlineStart = I, s.resizedWidth = I, e.oninputBoxWidthChange?.(I);
2637
+ }, v = (h) => {
2638
+ h.target === o.value && document.addEventListener("mousemove", u);
2589
2639
  }, m = () => {
2590
2640
  document.removeEventListener("mousemove", u);
2591
2641
  };
2592
- return N([o], () => {
2642
+ return A([o], () => {
2593
2643
  document.removeEventListener("mousedown", v), document.removeEventListener("mouseup", m), document.addEventListener("mousedown", v), document.addEventListener("mouseup", m);
2594
2644
  }), K(() => {
2595
2645
  document.addEventListener("mousedown", v), document.addEventListener("mouseup", m);
2596
- }), he(() => {
2646
+ }), pe(() => {
2597
2647
  document.removeEventListener("mousedown", v), document.removeEventListener("mouseup", m);
2598
- }), N([i], ([f]) => {
2599
- s.resizedWidth = f, c.width = f, d.insetInlineStart = f;
2600
- }), N(
2648
+ }), A([i], ([h]) => {
2649
+ s.resizedWidth = h, c.width = h, d.insetInlineStart = h;
2650
+ }), A(
2601
2651
  [
2602
2652
  () => n.value.htmlPreview,
2603
2653
  () => n.value.preview,
@@ -2613,8 +2663,8 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2613
2663
  inputWrapperStyle: c,
2614
2664
  resizeOperateStyle: d
2615
2665
  };
2616
- }, Wa = () => {
2617
- const e = r("editorId"), t = I(!0), o = ze();
2666
+ }, qa = () => {
2667
+ const e = r("editorId"), t = S(!0), o = ze();
2618
2668
  return {
2619
2669
  onCatalogActive: (c, d) => {
2620
2670
  const u = document.querySelector(
@@ -2628,8 +2678,8 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2628
2678
  onMouseenter: () => t.value = !1,
2629
2679
  onMouseleave: () => t.value = !0
2630
2680
  };
2631
- }, be = /* @__PURE__ */ C({
2632
- name: `${xt}CustomScrollbar`,
2681
+ }, ve = /* @__PURE__ */ w({
2682
+ name: `${St}CustomScrollbar`,
2633
2683
  props: {
2634
2684
  id: {
2635
2685
  type: String,
@@ -2667,44 +2717,46 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2667
2717
  setup(e, {
2668
2718
  slots: t
2669
2719
  }) {
2670
- const o = I(null), n = I(null), i = I(null), s = I(null);
2720
+ const o = S(null), n = S(null), i = S(null), s = S(null);
2671
2721
  let c = null, d = null, u = !1, v = 0, m = 0;
2672
- const f = () => {
2722
+ const h = () => {
2673
2723
  if (!n.value || !o.value || !i.value || !s.value) return;
2674
- const S = o.value.clientHeight, D = n.value.scrollHeight, L = n.value.scrollTop;
2675
- if (D <= S) {
2724
+ const x = o.value.clientHeight, N = n.value.scrollHeight, D = n.value.scrollTop;
2725
+ if (N <= x) {
2676
2726
  i.value.style.display = "none", e.alwaysShowTrack || (s.value.style.display = "none");
2677
2727
  return;
2678
2728
  } else
2679
2729
  i.value.style.display = "block", s.value.style.display = "block";
2680
- const T = S / D, R = Math.max(S * T, 20), z = S - R, q = Math.min(L * T, z);
2681
- i.value.style.height = `${R}px`, i.value.style.top = `${q}px`;
2682
- }, g = () => f(), p = (S) => {
2683
- u = !0, v = S.clientY, m = n.value.scrollTop, document.body.style.userSelect = "none";
2684
- }, k = (S) => {
2730
+ const E = x / N, $ = Math.max(x * E, 20), V = x - $, _ = Math.min(D * E, V);
2731
+ i.value.style.height = `${$}px`, i.value.style.top = `${_}px`;
2732
+ }, g = () => h(), p = (x) => {
2733
+ u = !0, v = x.clientY, m = n.value.scrollTop, document.body.style.userSelect = "none";
2734
+ }, y = (x) => {
2685
2735
  if (!u || !n.value || !o.value) return;
2686
- const D = S.clientY - v, L = n.value.scrollHeight / o.value.clientHeight;
2687
- n.value.scrollTop = m + D * L;
2688
- }, E = () => {
2736
+ const N = x.clientY - v, D = n.value.scrollHeight / o.value.clientHeight;
2737
+ n.value.scrollTop = m + N * D;
2738
+ }, I = () => {
2689
2739
  u = !1, document.body.style.userSelect = "";
2690
- }, M = (S) => {
2691
- n.value && n.value.removeEventListener("scroll", g), n.value = S, n.value ? (n.value.addEventListener("scroll", g), f()) : s.value && !e.alwaysShowTrack && (s.value.style.display = "none");
2692
- }, A = () => {
2740
+ }, M = (x) => {
2741
+ n.value && n.value.removeEventListener("scroll", g), n.value = x, n.value ? (n.value.addEventListener("scroll", g), h()) : s.value && !e.alwaysShowTrack && (s.value.style.display = "none");
2742
+ }, R = () => {
2693
2743
  if (!o.value) return;
2694
- const S = e.scrollTarget ? o.value.querySelector(e.scrollTarget) : o.value.firstElementChild;
2695
- M(S);
2744
+ const x = e.scrollTarget ? o.value.querySelector(e.scrollTarget) : o.value.firstElementChild;
2745
+ M(x);
2696
2746
  };
2697
2747
  return K(async () => {
2698
- await ie(), A(), c = new MutationObserver(() => {
2748
+ await ce();
2749
+ const x = o.value;
2750
+ x && (R(), c = new MutationObserver(() => {
2699
2751
  d && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
2700
- A();
2752
+ R();
2701
2753
  });
2702
- }), c.observe(o.value, {
2754
+ }), c.observe(x, {
2703
2755
  childList: !0,
2704
2756
  subtree: !0
2705
- }), window.addEventListener("resize", f), i.value?.addEventListener("mousedown", p), document.addEventListener("mousemove", k), document.addEventListener("mouseup", E);
2706
- }), he(() => {
2707
- c?.disconnect(), n.value && n.value.removeEventListener("scroll", g), window.removeEventListener("resize", f), i.value?.removeEventListener("mousedown", p), document.removeEventListener("mousemove", k), document.removeEventListener("mouseup", E);
2757
+ }), window.addEventListener("resize", h), i.value?.addEventListener("mousedown", p), document.addEventListener("mousemove", y), document.addEventListener("mouseup", I));
2758
+ }), pe(() => {
2759
+ c?.disconnect(), n.value && n.value.removeEventListener("scroll", g), window.removeEventListener("resize", h), i.value?.removeEventListener("mousedown", p), document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", I);
2708
2760
  }), () => a("div", {
2709
2761
  id: e.id,
2710
2762
  class: [`${l}-custom-scrollbar`, e.class],
@@ -2719,45 +2771,45 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2719
2771
  ref: i
2720
2772
  }, null)])]);
2721
2773
  }
2722
- }), _a = ze(), za = {
2774
+ }), Ua = ze(), Ka = {
2723
2775
  flex: 1
2724
- }, qa = /* @__PURE__ */ C({
2776
+ }, Ga = /* @__PURE__ */ w({
2725
2777
  name: "MDEditorContent",
2726
- props: st,
2778
+ props: it,
2727
2779
  setup(e, t) {
2728
- const o = r("editorId"), n = r("catalogVisible"), i = r("theme"), s = r("setting"), c = I(""), d = I(), u = I(), {
2780
+ const o = r("editorId"), n = r("catalogVisible"), i = r("theme"), s = r("setting"), c = S(""), d = S(), u = S(), {
2729
2781
  inputWrapperRef: v,
2730
2782
  codeMirrorUt: m,
2731
- resetHistory: f
2732
- } = Oa(e), {
2783
+ resetHistory: h
2784
+ } = _a(e), {
2733
2785
  inputWrapperStyle: g,
2734
2786
  resizeOperateStyle: p
2735
- } = Va(e, d, u);
2736
- oo(e, c, m);
2787
+ } = za(e, d, u);
2788
+ lo(e, c, m);
2737
2789
  const {
2738
- onCatalogActive: k,
2739
- onMouseenter: E,
2790
+ onCatalogActive: y,
2791
+ onMouseenter: I,
2740
2792
  onMouseleave: M
2741
- } = Wa(), A = (L, T) => {
2742
- if (!s.value.preview && T.line !== void 0) {
2743
- L.preventDefault();
2744
- const R = m.value?.view;
2745
- if (R) {
2746
- const z = R.state.doc.line(T.line + 1), q = R.lineBlockAt(z.from)?.top, $ = R.scrollDOM;
2747
- _a($, q);
2793
+ } = qa(), R = (D, E) => {
2794
+ if (!s.value.preview && E.line !== void 0) {
2795
+ D.preventDefault();
2796
+ const $ = m.value?.view;
2797
+ if ($) {
2798
+ const V = $.state.doc.line(E.line + 1), _ = $.lineBlockAt(V.from)?.top, C = $.scrollDOM;
2799
+ Ua(C, _);
2748
2800
  }
2749
2801
  }
2750
- }, S = P(() => s.value.preview ? "preview" : "editor"), D = (L) => {
2751
- c.value = L, e.onHtmlChanged(L);
2802
+ }, x = P(() => s.value.preview ? "preview" : "editor"), N = (D) => {
2803
+ c.value = D, e.onHtmlChanged(D);
2752
2804
  };
2753
2805
  return t.expose({
2754
2806
  getSelectedText() {
2755
2807
  return m.value?.getSelectedText();
2756
2808
  },
2757
- focus(L) {
2758
- m.value?.focus(L);
2809
+ focus(D) {
2810
+ m.value?.focus(D);
2759
2811
  },
2760
- resetHistory: f,
2812
+ resetHistory: h,
2761
2813
  getEditorView() {
2762
2814
  return m.value?.view;
2763
2815
  }
@@ -2766,7 +2818,7 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2766
2818
  }, [a("div", {
2767
2819
  class: `${l}-content-wrapper`,
2768
2820
  ref: d
2769
- }, [a(be, {
2821
+ }, [a(ve, {
2770
2822
  alwaysShowTrack: !0,
2771
2823
  scrollTarget: `#${o} .cm-scroller`,
2772
2824
  style: g
@@ -2779,13 +2831,13 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2779
2831
  class: `${l}-resize-operate`,
2780
2832
  style: p,
2781
2833
  ref: u
2782
- }, null), a(be, {
2783
- style: za
2834
+ }, null), a(ve, {
2835
+ style: Ka
2784
2836
  }, {
2785
- default: () => [a(it, {
2837
+ default: () => [a(ct, {
2786
2838
  modelValue: e.modelValue,
2787
2839
  onChange: e.onChange,
2788
- onHtmlChanged: D,
2840
+ onHtmlChanged: N,
2789
2841
  onGetCatalog: e.onGetCatalog,
2790
2842
  mdHeadingId: e.mdHeadingId,
2791
2843
  noMermaid: e.noMermaid,
@@ -2801,9 +2853,9 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2801
2853
  previewComponent: e.previewComponent,
2802
2854
  noEcharts: e.noEcharts
2803
2855
  }, null)]
2804
- })]), n.value && a(be, {
2856
+ })]), n.value && a(ve, {
2805
2857
  class: `${l}-catalog-${e.catalogLayout}`,
2806
- onMouseenter: E,
2858
+ onMouseenter: I,
2807
2859
  onMouseleave: M
2808
2860
  }, {
2809
2861
  default: () => [a(We, {
@@ -2813,14 +2865,14 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2813
2865
  mdHeadingId: e.mdHeadingId,
2814
2866
  key: "internal-catalog",
2815
2867
  scrollElementOffsetTop: 2,
2816
- syncWith: S.value,
2817
- onClick: A,
2868
+ syncWith: x.value,
2869
+ onClick: R,
2818
2870
  catalogMaxDepth: e.catalogMaxDepth,
2819
- onActive: k
2871
+ onActive: y
2820
2872
  }, null)]
2821
2873
  })]);
2822
2874
  }
2823
- }), Ua = /* @__PURE__ */ C({
2875
+ }), ja = /* @__PURE__ */ w({
2824
2876
  props: {
2825
2877
  modelValue: {
2826
2878
  type: String,
@@ -2835,7 +2887,7 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2835
2887
  class: `${l}-footer-label`
2836
2888
  }, [`${t.value.footer?.markdownTotal}:`]), a("span", null, [e.modelValue?.length || 0])]);
2837
2889
  }
2838
- }), Ka = {
2890
+ }), Ya = {
2839
2891
  checked: {
2840
2892
  type: Boolean,
2841
2893
  default: !1
@@ -2849,9 +2901,9 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2849
2901
  type: Boolean,
2850
2902
  default: void 0
2851
2903
  }
2852
- }, Ga = /* @__PURE__ */ C({
2904
+ }, Za = /* @__PURE__ */ w({
2853
2905
  name: `${l}-checkbox`,
2854
- props: Ka,
2906
+ props: Ya,
2855
2907
  setup(e) {
2856
2908
  return () => a("div", {
2857
2909
  class: [`${l}-checkbox`, e.checked && `${l}-checkbox-checked`, e.disabled && `${l}-disabled`],
@@ -2860,7 +2912,7 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2860
2912
  }
2861
2913
  }, null);
2862
2914
  }
2863
- }), ja = {
2915
+ }), Xa = {
2864
2916
  scrollAuto: {
2865
2917
  type: Boolean
2866
2918
  },
@@ -2869,8 +2921,8 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2869
2921
  default: () => {
2870
2922
  }
2871
2923
  }
2872
- }, Ya = /* @__PURE__ */ C({
2873
- props: ja,
2924
+ }, Ja = /* @__PURE__ */ w({
2925
+ props: Xa,
2874
2926
  setup(e) {
2875
2927
  const t = r("usedLanguageText"), o = r("disabled");
2876
2928
  return () => a("div", {
@@ -2880,13 +2932,13 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2880
2932
  onClick: () => {
2881
2933
  o?.value || e.onScrollAutoChange(!e.scrollAuto);
2882
2934
  }
2883
- }, [t?.value.footer?.scrollAuto]), a(Ga, {
2935
+ }, [t?.value.footer?.scrollAuto]), a(Za, {
2884
2936
  checked: e.scrollAuto,
2885
2937
  onChange: e.onScrollAutoChange,
2886
2938
  disabled: o?.value
2887
2939
  }, null)]);
2888
2940
  }
2889
- }), Za = {
2941
+ }), Qa = {
2890
2942
  modelValue: {
2891
2943
  type: String,
2892
2944
  default: ""
@@ -2909,36 +2961,36 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2909
2961
  defFooters: {
2910
2962
  type: Object
2911
2963
  }
2912
- }, Xa = /* @__PURE__ */ C({
2964
+ }, el = /* @__PURE__ */ w({
2913
2965
  name: "MDEditorFooter",
2914
- props: Za,
2966
+ props: Qa,
2915
2967
  setup(e) {
2916
2968
  const t = r("theme"), o = r("language"), n = r("disabled"), i = P(() => {
2917
2969
  const c = e.footers.indexOf("="), d = c === -1 ? e.footers : e.footers.slice(0, c), u = c === -1 ? [] : e.footers.slice(c, Number.MAX_SAFE_INTEGER);
2918
2970
  return [d, u];
2919
2971
  }), s = (c) => {
2920
- if (St.includes(c))
2972
+ if (It.includes(c))
2921
2973
  switch (c) {
2922
2974
  case "markdownTotal":
2923
- return a(Ua, {
2975
+ return a(ja, {
2924
2976
  modelValue: e.modelValue
2925
2977
  }, null);
2926
2978
  case "scrollSwitch":
2927
- return !e.noScrollAuto && a(Ya, {
2979
+ return !e.noScrollAuto && a(Ja, {
2928
2980
  scrollAuto: e.scrollAuto,
2929
2981
  onScrollAutoChange: e.onScrollAutoChange
2930
2982
  }, null);
2931
2983
  }
2932
2984
  else if (e.defFooters instanceof Array) {
2933
2985
  const d = e.defFooters[c];
2934
- return d ? ne(d, {
2986
+ return d ? re(d, {
2935
2987
  theme: d.props?.theme || t.value,
2936
2988
  language: d.props?.language || o.value,
2937
2989
  disabled: d.props?.disabled || n?.value
2938
2990
  }) : "";
2939
2991
  } else if (e.defFooters && e.defFooters.children instanceof Array) {
2940
2992
  const d = e.defFooters.children[c];
2941
- return d ? ne(d, {
2993
+ return d ? re(d, {
2942
2994
  theme: d.props?.theme || t.value,
2943
2995
  language: d.props?.language || o.value,
2944
2996
  disabled: d.props?.disabled || n?.value
@@ -2957,7 +3009,7 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2957
3009
  }, [d])]);
2958
3010
  };
2959
3011
  }
2960
- }), Ja = {
3012
+ }), tl = {
2961
3013
  // 工具栏选择显示
2962
3014
  toolbars: {
2963
3015
  type: Array,
@@ -2968,19 +3020,19 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
2968
3020
  type: Array,
2969
3021
  default: () => []
2970
3022
  }
2971
- }, Qa = /* @__PURE__ */ C({
3023
+ }, ol = /* @__PURE__ */ w({
2972
3024
  name: "MDEditorToolbar",
2973
- props: Ja,
3025
+ props: tl,
2974
3026
  setup(e) {
2975
- const t = r("editorId"), o = r("showToolbarName"), n = `${t}-toolbar-wrapper`, i = I(), s = I(), {
3027
+ const t = r("editorId"), o = r("showToolbarName"), n = `${t}-toolbar-wrapper`, i = S(), s = S(), {
2976
3028
  barRender: c
2977
3029
  } = Ze(), d = P(() => {
2978
- const u = e.toolbars.filter((g) => !e.toolbarsExclude.includes(g)), v = u.indexOf("="), m = v === -1 ? u : u.slice(0, v + 1), f = v === -1 ? [] : u.slice(v, Number.MAX_SAFE_INTEGER);
2979
- return [m, f];
3030
+ const u = e.toolbars.filter((g) => !e.toolbarsExclude.includes(g)), v = u.indexOf("="), m = v === -1 ? u : u.slice(0, v + 1), h = v === -1 ? [] : u.slice(v, Number.MAX_SAFE_INTEGER);
3031
+ return [m, h];
2980
3032
  });
2981
- return N(() => e.toolbars, () => {
2982
- ie(() => {
2983
- i.value && Lt(i.value);
3033
+ return A(() => e.toolbars, () => {
3034
+ ce(() => {
3035
+ i.value && Dt(i.value);
2984
3036
  });
2985
3037
  }, {
2986
3038
  immediate: !0
@@ -3000,80 +3052,80 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
3000
3052
  }, [v])])])]);
3001
3053
  };
3002
3054
  }
3003
- }), ve = /* @__PURE__ */ C({
3055
+ }), ge = /* @__PURE__ */ w({
3004
3056
  name: "MdEditorV3",
3005
- props: ut,
3006
- emits: ct,
3057
+ props: dt,
3058
+ emits: ut,
3007
3059
  setup(e, t) {
3008
3060
  const {
3009
3061
  noKatex: o,
3010
3062
  noMermaid: n,
3011
3063
  noHighlight: i
3012
- } = e, s = Y({
3064
+ } = e, s = Z({
3013
3065
  scrollAuto: e.scrollAuto
3014
- }), c = I(), d = I(), u = P(() => Se({
3066
+ }), c = S(), d = S(), u = P(() => Se({
3015
3067
  props: e,
3016
3068
  ctx: t
3017
3069
  }, "defToolbars")), v = P(() => Se({
3018
3070
  props: e,
3019
3071
  ctx: t
3020
- }, "defFooters")), m = dt(e), [f, g] = mt(e, t, {
3072
+ }, "defFooters")), m = mt(e), [h, g] = bt(e, t, {
3021
3073
  editorId: m
3022
- }), p = bt(e, {
3074
+ }), p = vt(e, {
3023
3075
  editorId: m
3024
3076
  });
3025
- vt(e, t, {
3077
+ gt(e, t, {
3026
3078
  editorId: m
3027
- }), gt(e), ht(e, t, {
3079
+ }), ht(e), pt(e, t, {
3028
3080
  editorId: m
3029
3081
  }), ft(e, t, {
3030
3082
  editorId: m,
3031
3083
  catalogVisible: p,
3032
- setting: f,
3084
+ setting: h,
3033
3085
  updateSetting: g,
3034
3086
  codeRef: d
3035
- }), pt(e, {
3087
+ }), Tt(e, {
3036
3088
  rootRef: c,
3037
3089
  editorId: m,
3038
- setting: f,
3090
+ setting: h,
3039
3091
  updateSetting: g,
3040
3092
  catalogVisible: p,
3041
3093
  defToolbars: u
3042
- }), he(() => {
3043
- h.clear(m);
3094
+ }), pe(() => {
3095
+ L.clear(m);
3044
3096
  });
3045
- const k = ($) => {
3046
- t.emit("update:modelValue", $);
3047
- }, E = ($) => {
3048
- e.onChange?.($), t.emit("onChange", $);
3049
- }, M = ($) => {
3050
- e.onHtmlChanged?.($), t.emit("onHtmlChanged", $);
3051
- }, A = ($) => {
3052
- e.onGetCatalog?.($), t.emit("onGetCatalog", $);
3053
- }, S = ($) => {
3054
- e.onBlur?.($), t.emit("onBlur", $);
3055
- }, D = ($) => {
3056
- e.onFocus?.($), t.emit("onFocus", $);
3057
- }, L = ($) => {
3058
- e.onInput?.($), t.emit("onInput", $);
3059
- }, T = ($) => {
3060
- e.onDrop?.($), t.emit("onDrop", $);
3061
- }, R = ($) => {
3062
- e.oninputBoxWidthChange?.($), t.emit("oninputBoxWidthChange", $);
3063
- }, z = () => {
3097
+ const y = (C) => {
3098
+ t.emit("update:modelValue", C);
3099
+ }, I = (C) => {
3100
+ e.onChange?.(C), t.emit("onChange", C);
3101
+ }, M = (C) => {
3102
+ e.onHtmlChanged?.(C), t.emit("onHtmlChanged", C);
3103
+ }, R = (C) => {
3104
+ e.onGetCatalog?.(C), t.emit("onGetCatalog", C);
3105
+ }, x = (C) => {
3106
+ e.onBlur?.(C), t.emit("onBlur", C);
3107
+ }, N = (C) => {
3108
+ e.onFocus?.(C), t.emit("onFocus", C);
3109
+ }, D = (C) => {
3110
+ e.onInput?.(C), t.emit("onInput", C);
3111
+ }, E = (C) => {
3112
+ e.onDrop?.(C), t.emit("onDrop", C);
3113
+ }, $ = (C) => {
3114
+ e.oninputBoxWidthChange?.(C), t.emit("oninputBoxWidthChange", C);
3115
+ }, V = () => {
3064
3116
  e.onRemount?.(), t.emit("onRemount");
3065
- }, q = ($) => {
3066
- s.scrollAuto = $;
3117
+ }, _ = (C) => {
3118
+ s.scrollAuto = C;
3067
3119
  };
3068
3120
  return () => a("div", {
3069
3121
  id: m,
3070
- class: [l, e.class, e.theme === "dark" && `${l}-dark`, f.fullscreen || f.pageFullscreen ? `${l}-fullscreen` : ""],
3122
+ class: [l, e.class, e.theme === "dark" && `${l}-dark`, h.fullscreen || h.pageFullscreen ? `${l}-fullscreen` : ""],
3071
3123
  style: e.style,
3072
3124
  ref: c
3073
- }, [e.toolbars.length > 0 && a(Qa, {
3125
+ }, [e.toolbars.length > 0 && a(ol, {
3074
3126
  toolbars: e.toolbars,
3075
3127
  toolbarsExclude: e.toolbarsExclude
3076
- }, null), a(qa, {
3128
+ }, null), a(Ga, {
3077
3129
  ref: d,
3078
3130
  modelValue: e.modelValue,
3079
3131
  mdHeadingId: e.mdHeadingId,
@@ -3088,38 +3140,38 @@ const Xe = (e) => e.extension instanceof Function ? e.extension(e.options) : e.e
3088
3140
  maxlength: e.maxLength,
3089
3141
  autoDetectCode: e.autoDetectCode,
3090
3142
  noHighlight: i,
3091
- updateModelValue: k,
3092
- onChange: E,
3143
+ updateModelValue: y,
3144
+ onChange: I,
3093
3145
  onHtmlChanged: M,
3094
- onGetCatalog: A,
3095
- onBlur: S,
3096
- onFocus: D,
3097
- onInput: L,
3146
+ onGetCatalog: R,
3147
+ onBlur: x,
3148
+ onFocus: N,
3149
+ onInput: D,
3098
3150
  completions: e.completions,
3099
3151
  noImgZoomIn: e.noImgZoomIn,
3100
- onDrop: T,
3152
+ onDrop: E,
3101
3153
  inputBoxWidth: e.inputBoxWidth,
3102
- oninputBoxWidthChange: R,
3154
+ oninputBoxWidthChange: $,
3103
3155
  sanitizeMermaid: e.sanitizeMermaid,
3104
3156
  transformImgUrl: e.transformImgUrl,
3105
3157
  codeFoldable: e.codeFoldable,
3106
3158
  autoFoldThreshold: e.autoFoldThreshold,
3107
- onRemount: z,
3159
+ onRemount: V,
3108
3160
  catalogLayout: e.catalogLayout,
3109
3161
  catalogMaxDepth: e.catalogMaxDepth,
3110
3162
  noEcharts: e.noEcharts,
3111
3163
  previewComponent: e.previewComponent
3112
- }, null), e.footers.length > 0 && a(Xa, {
3164
+ }, null), e.footers.length > 0 && a(el, {
3113
3165
  modelValue: e.modelValue,
3114
3166
  footers: e.footers,
3115
3167
  defFooters: v.value,
3116
- noScrollAuto: !f.preview && !f.htmlPreview || f.previewOnly,
3168
+ noScrollAuto: !h.preview && !h.htmlPreview || h.previewOnly,
3117
3169
  scrollAuto: s.scrollAuto,
3118
- onScrollAutoChange: q
3170
+ onScrollAutoChange: _
3119
3171
  }, null)]);
3120
3172
  }
3121
3173
  });
3122
- ve.install = (e) => (e.component(ve.name, ve), e.use(yt).use(at).use(wt).use(We).use(Tt), e);
3174
+ ge.install = (e) => (e.component(ge.name, ge), e.use(Ct).use(lt).use(yt).use(We).use(wt), e);
3123
3175
  export {
3124
- ve as default
3176
+ ge as default
3125
3177
  };