md-editor-v3 4.1.0 → 4.2.0-beta.0

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,8 +1,8 @@
1
1
  var Ze = Object.defineProperty;
2
2
  var Je = (e, o, a) => o in e ? Ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[o] = a;
3
- var q = (e, o, a) => (Je(e, typeof o != "symbol" ? o + "" : o, a), a);
4
- import { defineComponent as O, createVNode as t, inject as A, ref as U, onMounted as W, reactive as Z, computed as fe, watch as I, nextTick as me, Fragment as Ke, toRef as te, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
5
- import { p as n, a as _, s as et, b as tt, d as lt } from "./chunks/config.mjs";
3
+ var U = (e, o, a) => (Je(e, typeof o != "symbol" ? o + "" : o, a), a);
4
+ import { defineComponent as O, createVNode as t, inject as A, ref as G, onMounted as z, reactive as Z, computed as fe, watch as F, nextTick as me, Fragment as Ke, toRef as te, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
5
+ import { p as n, a as W, s as et, b as tt, d as lt } from "./chunks/config.mjs";
6
6
  import { a as ee, D as ot } from "./chunks/index2.mjs";
7
7
  import { b as h, a as at } from "./chunks/index4.mjs";
8
8
  import { linkTo as nt, debounce as rt, throttle as it, smoothScroll as Ee } from "@vavt/util";
@@ -13,27 +13,28 @@ import { minimalSetup as xt, EditorView as re } from "codemirror";
13
13
  import { EditorView as ge, placeholder as wt, keymap as Tt } from "@codemirror/view";
14
14
  import { languages as St } from "@codemirror/language-data";
15
15
  import { markdown as At } from "@codemirror/lang-markdown";
16
- import { deleteLine as Mt, indentWithTab as Lt, undo as Dt, redo as Et } from "@codemirror/commands";
17
- import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Ht } from "@codemirror/language";
16
+ import { htmlCompletionSource as Mt, html as Lt } from "@codemirror/lang-html";
17
+ import { deleteLine as Dt, indentWithTab as Et, undo as Ht, redo as It } from "@codemirror/commands";
18
+ import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Bt } from "@codemirror/language";
18
19
  import { tags as s } from "@lezer/highlight";
19
- import { EditorSelection as Y, EditorState as se, Compartment as Bt, StateEffect as Ft } from "@codemirror/state";
20
- import { autocompletion as It } from "@codemirror/autocomplete";
20
+ import { EditorSelection as P, EditorState as se, Compartment as Ft, StateEffect as Ot } from "@codemirror/state";
21
+ import { autocompletion as Vt } from "@codemirror/autocomplete";
21
22
  import { g as He } from "./chunks/vue-tsx.mjs";
22
23
  import Ye from "./MdCatalog.mjs";
23
- import Ot from "./NormalToolbar.mjs";
24
+ import Rt from "./NormalToolbar.mjs";
24
25
  import "medium-zoom";
25
26
  import "copy-to-clipboard";
26
27
  import "markdown-it";
27
28
  import "markdown-it-image-figures";
28
29
  import "markdown-it-task-lists";
29
30
  import "lru-cache";
30
- const Vt = /* @__PURE__ */ O({
31
+ const Pt = /* @__PURE__ */ O({
31
32
  setup() {
32
33
  return () => t("div", {
33
34
  class: `${n}-divider`
34
35
  }, null);
35
36
  }
36
- }), Rt = {
37
+ }), Nt = {
37
38
  noPrettier: {
38
39
  type: Boolean
39
40
  },
@@ -74,11 +75,11 @@ const Vt = /* @__PURE__ */ O({
74
75
  noUploadImg: {
75
76
  type: Boolean
76
77
  }
77
- }, Nt = (e) => {
78
- var f, u, d, p;
78
+ }, qt = (e) => {
79
+ var f, u, d, v;
79
80
  const o = A("editorId");
80
- let a = (u = (f = _.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : u.instance;
81
- const l = (p = (d = _.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : p.js, i = U(!1), r = ($) => {
81
+ let a = (u = (f = W.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : u.instance;
82
+ const l = (v = (d = W.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : v.js, r = G(!1), i = (y) => {
82
83
  if (!a) {
83
84
  h.emit(o, "errorCatcher", {
84
85
  name: "fullscreen",
@@ -86,26 +87,26 @@ const Vt = /* @__PURE__ */ O({
86
87
  });
87
88
  return;
88
89
  }
89
- a.isEnabled ? (i.value = !0, ($ === void 0 ? !a.isFullscreen : $) ? a.request() : a.exit()) : console.error("browser does not support screenfull!");
90
+ a.isEnabled ? (r.value = !0, (y === void 0 ? !a.isFullscreen : y) ? a.request() : a.exit()) : console.error("browser does not support screenfull!");
90
91
  }, c = () => {
91
92
  a && a.isEnabled && a.on("change", () => {
92
- (i.value || e.setting.fullscreen) && (i.value = !1, e.updateSetting("fullscreen"));
93
+ (r.value || e.setting.fullscreen) && (r.value = !1, e.updateSetting("fullscreen"));
93
94
  });
94
95
  }, m = () => {
95
96
  a = window.screenfull, c();
96
97
  };
97
- return W(() => {
98
+ return z(() => {
98
99
  if (c(), !a) {
99
- const $ = document.createElement("script");
100
- $.src = l || et, $.onload = m, $.id = `${n}-screenfull`, $t($, "screenfull");
100
+ const y = document.createElement("script");
101
+ y.src = l || et, y.onload = m, y.id = `${n}-screenfull`, $t(y, "screenfull");
101
102
  }
102
- }), W(() => {
103
+ }), z(() => {
103
104
  h.on(o, {
104
105
  name: st,
105
- callback: r
106
+ callback: i
106
107
  });
107
- }), { fullscreenHandler: r };
108
- }, Pt = {
108
+ }), { fullscreenHandler: i };
109
+ }, Ut = {
109
110
  tableShape: {
110
111
  type: Array,
111
112
  default: () => [6, 4]
@@ -115,9 +116,9 @@ const Vt = /* @__PURE__ */ O({
115
116
  default: () => {
116
117
  }
117
118
  }
118
- }, qt = /* @__PURE__ */ O({
119
+ }, Gt = /* @__PURE__ */ O({
119
120
  name: "TableShape",
120
- props: Pt,
121
+ props: Ut,
121
122
  setup(e) {
122
123
  const o = Z({
123
124
  x: -1,
@@ -131,20 +132,20 @@ const Vt = /* @__PURE__ */ O({
131
132
  }, [new Array(e.tableShape[1]).fill("").map((a, l) => t("div", {
132
133
  class: `${n}-table-shape-row`,
133
134
  key: `table-shape-row-${l}`
134
- }, [new Array(e.tableShape[0]).fill("").map((i, r) => t("div", {
135
+ }, [new Array(e.tableShape[0]).fill("").map((r, i) => t("div", {
135
136
  class: `${n}-table-shape-col`,
136
- key: `table-shape-col-${r}`,
137
+ key: `table-shape-col-${i}`,
137
138
  onMouseenter: () => {
138
- o.x = l, o.y = r;
139
+ o.x = l, o.y = i;
139
140
  },
140
141
  onClick: () => {
141
142
  e.onSelected(o);
142
143
  }
143
144
  }, [t("div", {
144
- class: [`${n}-table-shape-col-default`, l <= o.x && r <= o.y && `${n}-table-shape-col-include`]
145
+ class: [`${n}-table-shape-col-default`, l <= o.x && i <= o.y && `${n}-table-shape-col-include`]
145
146
  }, null)]))]))]);
146
147
  }
147
- }), Ut = qt, Gt = {
148
+ }), Kt = Gt, jt = {
148
149
  type: {
149
150
  type: String,
150
151
  default: "link"
@@ -163,26 +164,26 @@ const Vt = /* @__PURE__ */ O({
163
164
  default: () => {
164
165
  }
165
166
  }
166
- }, Kt = /* @__PURE__ */ O({
167
- props: Gt,
167
+ }, _t = /* @__PURE__ */ O({
168
+ props: jt,
168
169
  setup(e) {
169
170
  const o = A("usedLanguageText"), a = A("editorId"), l = fe(() => {
170
- var r, c;
171
+ var i, c;
171
172
  switch (e.type) {
172
173
  case "link":
173
- return (r = o.value.linkModalTips) == null ? void 0 : r.linkTitle;
174
+ return (i = o.value.linkModalTips) == null ? void 0 : i.linkTitle;
174
175
  case "image":
175
176
  return (c = o.value.linkModalTips) == null ? void 0 : c.imageTitle;
176
177
  default:
177
178
  return "";
178
179
  }
179
- }), i = Z({
180
+ }), r = Z({
180
181
  desc: "",
181
182
  url: ""
182
183
  });
183
- return I(() => e.visible, (r) => {
184
- r || setTimeout(() => {
185
- i.desc = "", i.url = "";
184
+ return F(() => e.visible, (i) => {
185
+ i || setTimeout(() => {
186
+ r.desc = "", r.url = "";
186
187
  }, 200);
187
188
  }), () => t(_e, {
188
189
  title: l.value,
@@ -190,20 +191,20 @@ const Vt = /* @__PURE__ */ O({
190
191
  onClose: e.onCancel
191
192
  }, {
192
193
  default: () => {
193
- var r, c, m, f, u;
194
+ var i, c, m, f, u;
194
195
  return [t("div", {
195
196
  class: `${n}-form-item`
196
197
  }, [t("label", {
197
198
  class: `${n}-label`,
198
199
  for: `link-desc-${a}`
199
- }, [(r = o.value.linkModalTips) == null ? void 0 : r.descLabel]), t("input", {
200
+ }, [(i = o.value.linkModalTips) == null ? void 0 : i.descLabel]), t("input", {
200
201
  placeholder: (c = o.value.linkModalTips) == null ? void 0 : c.descLabelPlaceHolder,
201
202
  class: `${n}-input`,
202
203
  id: `link-desc-${a}`,
203
204
  type: "text",
204
- value: i.desc,
205
+ value: r.desc,
205
206
  onChange: (d) => {
206
- i.desc = d.target.value;
207
+ r.desc = d.target.value;
207
208
  },
208
209
  autocomplete: "off"
209
210
  }, null)]), t("div", {
@@ -216,9 +217,9 @@ const Vt = /* @__PURE__ */ O({
216
217
  class: `${n}-input`,
217
218
  id: `link-url-${a}`,
218
219
  type: "text",
219
- value: i.url,
220
+ value: r.url,
220
221
  onChange: (d) => {
221
- i.url = d.target.value;
222
+ r.url = d.target.value;
222
223
  },
223
224
  autocomplete: "off"
224
225
  }, null)]), t("div", {
@@ -227,13 +228,13 @@ const Vt = /* @__PURE__ */ O({
227
228
  class: [`${n}-btn`, `${n}-btn-row`],
228
229
  type: "button",
229
230
  onClick: () => {
230
- e.onOk(i), i.desc = "", i.url = "";
231
+ e.onOk(r), r.desc = "", r.url = "";
231
232
  }
232
233
  }, [(u = o.value.linkModalTips) == null ? void 0 : u.buttonOK])])];
233
234
  }
234
235
  });
235
236
  }
236
- }), jt = {
237
+ }), Wt = {
237
238
  visible: {
238
239
  type: Boolean,
239
240
  default: !1
@@ -248,13 +249,13 @@ const Vt = /* @__PURE__ */ O({
248
249
  default: () => {
249
250
  }
250
251
  }
251
- }, _t = /* @__PURE__ */ O({
252
- props: jt,
252
+ }, zt = /* @__PURE__ */ O({
253
+ props: Wt,
253
254
  setup(e) {
254
- var d, p, $;
255
+ var d, v, y;
255
256
  const o = A("usedLanguageText"), a = A("editorId");
256
- let l = ($ = (p = (d = _) == null ? void 0 : d.editorExtensions) == null ? void 0 : p.cropper) == null ? void 0 : $.instance;
257
- const i = U(), r = U(), c = U(), m = Z({
257
+ let l = (y = (v = (d = W) == null ? void 0 : d.editorExtensions) == null ? void 0 : v.cropper) == null ? void 0 : y.instance;
258
+ const r = G(), i = G(), c = G(), m = Z({
258
259
  cropperInited: !1,
259
260
  imgSelected: !1,
260
261
  imgSrc: "",
@@ -262,8 +263,8 @@ const Vt = /* @__PURE__ */ O({
262
263
  isFullscreen: !1
263
264
  });
264
265
  let f = null;
265
- I(() => e.visible, () => {
266
- e.visible && !m.cropperInited && (l = l || window.Cropper, i.value.onchange = () => {
266
+ F(() => e.visible, () => {
267
+ e.visible && !m.cropperInited && (l = l || window.Cropper, r.value.onchange = () => {
267
268
  if (!l) {
268
269
  h.emit(a, "errorCatcher", {
269
270
  name: "Cropper",
@@ -271,25 +272,25 @@ const Vt = /* @__PURE__ */ O({
271
272
  });
272
273
  return;
273
274
  }
274
- const b = i.value.files || [];
275
+ const b = r.value.files || [];
275
276
  if (m.imgSelected = !0, (b == null ? void 0 : b.length) > 0) {
276
- const v = new FileReader();
277
- v.onload = (g) => {
277
+ const p = new FileReader();
278
+ p.onload = (g) => {
278
279
  m.imgSrc = g.target.result, me(() => {
279
- f = new l(r.value, {
280
+ f = new l(i.value, {
280
281
  viewMode: 2,
281
282
  preview: `.${n}-clip-preview-target`
282
283
  // aspectRatio: 16 / 9,
283
284
  });
284
285
  });
285
- }, v.readAsDataURL(b[0]);
286
+ }, p.readAsDataURL(b[0]);
286
287
  }
287
288
  });
288
- }), I(() => [m.imgSelected], () => {
289
+ }), F(() => [m.imgSelected], () => {
289
290
  c.value.style = "";
290
- }), I(() => m.isFullscreen, () => {
291
+ }), F(() => m.isFullscreen, () => {
291
292
  me(() => {
292
- f == null || f.destroy(), c.value.style = "", r.value && (f = new l(r.value, {
293
+ f == null || f.destroy(), c.value.style = "", i.value && (f = new l(i.value, {
293
294
  viewMode: 2,
294
295
  preview: `.${n}-clip-preview-target`
295
296
  // aspectRatio: 16 / 9,
@@ -297,7 +298,7 @@ const Vt = /* @__PURE__ */ O({
297
298
  });
298
299
  });
299
300
  const u = () => {
300
- f.clear(), f.destroy(), f = null, i.value.value = "", m.imgSelected = !1;
301
+ f.clear(), f.destroy(), f = null, r.value.value = "", m.imgSelected = !1;
301
302
  };
302
303
  return () => {
303
304
  var b;
@@ -308,14 +309,14 @@ const Vt = /* @__PURE__ */ O({
308
309
  onClose: e.onCancel,
309
310
  showAdjust: !0,
310
311
  isFullscreen: m.isFullscreen,
311
- onAdjust: (v) => {
312
- m.isFullscreen = v;
312
+ onAdjust: (p) => {
313
+ m.isFullscreen = p;
313
314
  },
314
315
  width: "668px",
315
316
  height: "421px"
316
317
  }, {
317
318
  default: () => {
318
- var v, g;
319
+ var p, g;
319
320
  return [t("div", {
320
321
  class: `${n}-form-item ${n}-clip`
321
322
  }, [t("div", {
@@ -324,7 +325,7 @@ const Vt = /* @__PURE__ */ O({
324
325
  class: `${n}-clip-cropper`
325
326
  }, [t("img", {
326
327
  src: m.imgSrc,
327
- ref: r,
328
+ ref: i,
328
329
  style: {
329
330
  display: "none"
330
331
  },
@@ -340,7 +341,7 @@ const Vt = /* @__PURE__ */ O({
340
341
  }, null)])])]) : t("div", {
341
342
  class: `${n}-clip-upload`,
342
343
  onClick: () => {
343
- i.value.click();
344
+ r.value.click();
344
345
  }
345
346
  }, [t("svg", {
346
347
  class: `${n}-icon`,
@@ -359,12 +360,12 @@ const Vt = /* @__PURE__ */ O({
359
360
  type: "button",
360
361
  onClick: () => {
361
362
  if (f) {
362
- const y = f.getCroppedCanvas();
363
- h.emit(a, "uploadImage", [at(y.toDataURL("image/png"))], e.onOk), u();
363
+ const k = f.getCroppedCanvas();
364
+ h.emit(a, "uploadImage", [at(k.toDataURL("image/png"))], e.onOk), u();
364
365
  }
365
366
  }
366
- }, [((v = o.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((g = o.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
367
- ref: i,
367
+ }, [((p = o.value.clipModalTips) == null ? void 0 : p.buttonUpload) || ((g = o.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
368
+ ref: r,
368
369
  accept: "image/*",
369
370
  type: "file",
370
371
  multiple: !1,
@@ -376,7 +377,7 @@ const Vt = /* @__PURE__ */ O({
376
377
  });
377
378
  };
378
379
  }
379
- }), Wt = {
380
+ }), Yt = {
380
381
  type: {
381
382
  type: String,
382
383
  default: "link"
@@ -399,27 +400,27 @@ const Vt = /* @__PURE__ */ O({
399
400
  default: () => {
400
401
  }
401
402
  }
402
- }, zt = /* @__PURE__ */ O({
403
- props: Wt,
403
+ }, Zt = /* @__PURE__ */ O({
404
+ props: Yt,
404
405
  setup(e) {
405
- return () => t(Ke, null, [t(Kt, {
406
+ return () => t(Ke, null, [t(_t, {
406
407
  type: e.type,
407
408
  visible: e.linkVisible,
408
409
  onOk: e.onOk,
409
410
  onCancel: e.onCancel
410
- }, null), t(_t, {
411
+ }, null), t(zt, {
411
412
  visible: e.clipVisible,
412
413
  onOk: e.onOk,
413
414
  onCancel: e.onCancel
414
415
  }, null)]);
415
416
  }
416
- }), Yt = /* @__PURE__ */ O({
417
+ }), Jt = /* @__PURE__ */ O({
417
418
  name: "MDEditorToolbar",
418
- props: Rt,
419
+ props: Nt,
419
420
  setup(e) {
420
421
  const o = A("editorId"), a = A("usedLanguageText"), {
421
422
  fullscreenHandler: l
422
- } = Nt(e), i = `${o}-toolbar-wrapper`, r = Z({
423
+ } = qt(e), r = `${o}-toolbar-wrapper`, i = Z({
423
424
  title: !1,
424
425
  catalog: !1,
425
426
  // 图片上传下拉
@@ -429,14 +430,14 @@ const Vt = /* @__PURE__ */ O({
429
430
  // mermaid
430
431
  mermaid: !1,
431
432
  katex: !1
432
- }), c = (b, v) => {
433
- h.emit(o, "replace", b, v);
433
+ }), c = (b, p) => {
434
+ h.emit(o, "replace", b, p);
434
435
  }, m = Z({
435
436
  type: "link",
436
437
  linkVisible: !1,
437
438
  clipVisible: !1
438
- }), f = U();
439
- W(() => {
439
+ }), f = G();
440
+ z(() => {
440
441
  h.on(o, {
441
442
  name: "openModals",
442
443
  callback(b) {
@@ -445,24 +446,24 @@ const Vt = /* @__PURE__ */ O({
445
446
  });
446
447
  });
447
448
  const u = fe(() => {
448
- const b = e.toolbars.filter((x) => !e.toolbarsExclude.includes(x)), v = b.indexOf("="), g = v === -1 ? b : b.slice(0, v + 1), y = v === -1 ? [] : b.slice(v, Number.MAX_SAFE_INTEGER);
449
- return [g, y];
450
- }), d = U(), p = () => {
449
+ const b = e.toolbars.filter((x) => !e.toolbarsExclude.includes(x)), p = b.indexOf("="), g = p === -1 ? b : b.slice(0, p + 1), k = p === -1 ? [] : b.slice(p, Number.MAX_SAFE_INTEGER);
450
+ return [g, k];
451
+ }), d = G(), v = () => {
451
452
  h.emit(o, "uploadImage", Array.from(d.value.files || [])), d.value.value = "";
452
453
  };
453
- W(() => {
454
- d.value.addEventListener("change", p);
454
+ z(() => {
455
+ d.value.addEventListener("change", v);
455
456
  });
456
- const $ = (b) => {
457
- var v, g, y, x, T, w, M, k, S, R, L, D, V, B, E, G, N, ae, J, K, P, X, j, H, F, Q, ne, he, be, ve, pe, ke, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le, De;
457
+ const y = (b) => {
458
+ var p, g, k, x, T, w, M, C, S, R, L, D, V, I, E, K, N, ae, J, j, q, X, _, H, B, Q, ne, he, be, ve, pe, ke, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le, De;
458
459
  if (tt.includes(b))
459
460
  switch (b) {
460
461
  case "-":
461
- return t(Vt, null, null);
462
+ return t(Pt, null, null);
462
463
  case "bold":
463
464
  return t("div", {
464
465
  class: `${n}-toolbar-item`,
465
- title: (v = a.value.toolbarTips) == null ? void 0 : v.bold,
466
+ title: (p = a.value.toolbarTips) == null ? void 0 : p.bold,
466
467
  onClick: () => {
467
468
  c("bold");
468
469
  }
@@ -488,7 +489,7 @@ const Vt = /* @__PURE__ */ O({
488
489
  case "italic":
489
490
  return t("div", {
490
491
  class: `${n}-toolbar-item`,
491
- title: (y = a.value.toolbarTips) == null ? void 0 : y.italic,
492
+ title: (k = a.value.toolbarTips) == null ? void 0 : k.italic,
492
493
  onClick: () => {
493
494
  c("italic");
494
495
  }
@@ -513,15 +514,15 @@ const Vt = /* @__PURE__ */ O({
513
514
  }, null)])]);
514
515
  case "title":
515
516
  return t(ee, {
516
- relative: `#${i}`,
517
- visible: r.title,
518
- onChange: (C) => {
519
- r.title = C;
517
+ relative: `#${r}`,
518
+ visible: i.title,
519
+ onChange: ($) => {
520
+ i.title = $;
520
521
  },
521
522
  overlay: t("ul", {
522
523
  class: `${n}-menu`,
523
524
  onClick: () => {
524
- r.title = !1;
525
+ i.title = !1;
525
526
  }
526
527
  }, [t("li", {
527
528
  class: `${n}-menu-item`,
@@ -543,7 +544,7 @@ const Vt = /* @__PURE__ */ O({
543
544
  onClick: () => {
544
545
  c("h4");
545
546
  }
546
- }, [(k = a.value.titleItem) == null ? void 0 : k.h4]), t("li", {
547
+ }, [(C = a.value.titleItem) == null ? void 0 : C.h4]), t("li", {
547
548
  class: `${n}-menu-item`,
548
549
  onClick: () => {
549
550
  c("h5");
@@ -556,10 +557,10 @@ const Vt = /* @__PURE__ */ O({
556
557
  }, [(R = a.value.titleItem) == null ? void 0 : R.h6])])
557
558
  }, {
558
559
  default: () => {
559
- var C;
560
+ var $;
560
561
  return [t("div", {
561
562
  class: `${n}-toolbar-item`,
562
- title: (C = a.value.toolbarTips) == null ? void 0 : C.title
563
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.title
563
564
  }, [t("svg", {
564
565
  class: `${n}-icon`,
565
566
  "aria-hidden": "true"
@@ -610,7 +611,7 @@ const Vt = /* @__PURE__ */ O({
610
611
  case "unorderedList":
611
612
  return t("div", {
612
613
  class: `${n}-toolbar-item`,
613
- title: (B = a.value.toolbarTips) == null ? void 0 : B.unorderedList,
614
+ title: (I = a.value.toolbarTips) == null ? void 0 : I.unorderedList,
614
615
  onClick: () => {
615
616
  c("unorderedList");
616
617
  }
@@ -636,7 +637,7 @@ const Vt = /* @__PURE__ */ O({
636
637
  case "task":
637
638
  return t("div", {
638
639
  class: `${n}-toolbar-item`,
639
- title: (G = a.value.toolbarTips) == null ? void 0 : G.task,
640
+ title: (K = a.value.toolbarTips) == null ? void 0 : K.task,
640
641
  onClick: () => {
641
642
  c("task");
642
643
  }
@@ -688,7 +689,7 @@ const Vt = /* @__PURE__ */ O({
688
689
  case "image":
689
690
  return e.noUploadImg ? t("div", {
690
691
  class: `${n}-toolbar-item`,
691
- title: (K = a.value.toolbarTips) == null ? void 0 : K.image,
692
+ title: (j = a.value.toolbarTips) == null ? void 0 : j.image,
692
693
  onClick: () => {
693
694
  m.type = "image", m.linkVisible = !0;
694
695
  }
@@ -698,22 +699,22 @@ const Vt = /* @__PURE__ */ O({
698
699
  }, [t("use", {
699
700
  "xlink:href": "#md-editor-icon-image"
700
701
  }, null)])]) : t(ee, {
701
- relative: `#${i}`,
702
- visible: r.image,
703
- onChange: (C) => {
704
- r.image = C;
702
+ relative: `#${r}`,
703
+ visible: i.image,
704
+ onChange: ($) => {
705
+ i.image = $;
705
706
  },
706
707
  overlay: t("ul", {
707
708
  class: `${n}-menu`,
708
709
  onClick: () => {
709
- r.title = !1;
710
+ i.title = !1;
710
711
  }
711
712
  }, [t("li", {
712
713
  class: `${n}-menu-item`,
713
714
  onClick: () => {
714
715
  m.type = "image", m.linkVisible = !0;
715
716
  }
716
- }, [(P = a.value.imgTitleItem) == null ? void 0 : P.link]), t("li", {
717
+ }, [(q = a.value.imgTitleItem) == null ? void 0 : q.link]), t("li", {
717
718
  class: `${n}-menu-item`,
718
719
  onClick: () => {
719
720
  d.value.click();
@@ -723,13 +724,13 @@ const Vt = /* @__PURE__ */ O({
723
724
  onClick: () => {
724
725
  m.clipVisible = !0;
725
726
  }
726
- }, [(j = a.value.imgTitleItem) == null ? void 0 : j.clip2upload])])
727
+ }, [(_ = a.value.imgTitleItem) == null ? void 0 : _.clip2upload])])
727
728
  }, {
728
729
  default: () => {
729
- var C;
730
+ var $;
730
731
  return [t("div", {
731
732
  class: `${n}-toolbar-item`,
732
- title: (C = a.value.toolbarTips) == null ? void 0 : C.image
733
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.image
733
734
  }, [t("svg", {
734
735
  class: `${n}-icon`,
735
736
  "aria-hidden": "true"
@@ -740,26 +741,26 @@ const Vt = /* @__PURE__ */ O({
740
741
  });
741
742
  case "table":
742
743
  return t(ee, {
743
- relative: `#${i}`,
744
- visible: r.table,
745
- onChange: (C) => {
746
- r.table = C;
744
+ relative: `#${r}`,
745
+ visible: i.table,
746
+ onChange: ($) => {
747
+ i.table = $;
747
748
  },
748
749
  key: "bar-table",
749
- overlay: t(Ut, {
750
+ overlay: t(Kt, {
750
751
  tableShape: e.tableShape,
751
- onSelected: (C) => {
752
+ onSelected: ($) => {
752
753
  c("table", {
753
- selectedShape: C
754
+ selectedShape: $
754
755
  });
755
756
  }
756
757
  }, null)
757
758
  }, {
758
759
  default: () => {
759
- var C;
760
+ var $;
760
761
  return [t("div", {
761
762
  class: `${n}-toolbar-item`,
762
- title: (C = a.value.toolbarTips) == null ? void 0 : C.table
763
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.table
763
764
  }, [t("svg", {
764
765
  class: `${n}-icon`,
765
766
  "aria-hidden": "true"
@@ -784,7 +785,7 @@ const Vt = /* @__PURE__ */ O({
784
785
  case "next":
785
786
  return t("div", {
786
787
  class: `${n}-toolbar-item`,
787
- title: (F = a.value.toolbarTips) == null ? void 0 : F.next,
788
+ title: (B = a.value.toolbarTips) == null ? void 0 : B.next,
788
789
  onClick: () => {
789
790
  h.emit(o, "ctrlShiftZ");
790
791
  }
@@ -899,15 +900,15 @@ const Vt = /* @__PURE__ */ O({
899
900
  }, null)])]);
900
901
  case "mermaid":
901
902
  return t(ee, {
902
- relative: `#${i}`,
903
- visible: r.mermaid,
904
- onChange: (C) => {
905
- r.mermaid = C;
903
+ relative: `#${r}`,
904
+ visible: i.mermaid,
905
+ onChange: ($) => {
906
+ i.mermaid = $;
906
907
  },
907
908
  overlay: t("ul", {
908
909
  class: `${n}-menu`,
909
910
  onClick: () => {
910
- r.mermaid = !1;
911
+ i.mermaid = !1;
911
912
  }
912
913
  }, [t("li", {
913
914
  class: `${n}-menu-item`,
@@ -953,10 +954,10 @@ const Vt = /* @__PURE__ */ O({
953
954
  key: "bar-mermaid"
954
955
  }, {
955
956
  default: () => {
956
- var C;
957
+ var $;
957
958
  return [t("div", {
958
959
  class: `${n}-toolbar-item`,
959
- title: (C = a.value.toolbarTips) == null ? void 0 : C.mermaid
960
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.mermaid
960
961
  }, [t("svg", {
961
962
  class: `${n}-icon`,
962
963
  "aria-hidden": "true"
@@ -967,15 +968,15 @@ const Vt = /* @__PURE__ */ O({
967
968
  });
968
969
  case "katex":
969
970
  return t(ee, {
970
- relative: `#${i}`,
971
- visible: r.katex,
972
- onChange: (C) => {
973
- r.katex = C;
971
+ relative: `#${r}`,
972
+ visible: i.katex,
973
+ onChange: ($) => {
974
+ i.katex = $;
974
975
  },
975
976
  overlay: t("ul", {
976
977
  class: `${n}-menu`,
977
978
  onClick: () => {
978
- r.katex = !1;
979
+ i.katex = !1;
979
980
  }
980
981
  }, [t("li", {
981
982
  class: `${n}-menu-item`,
@@ -991,10 +992,10 @@ const Vt = /* @__PURE__ */ O({
991
992
  key: "bar-katex"
992
993
  }, {
993
994
  default: () => {
994
- var C;
995
+ var $;
995
996
  return [t("div", {
996
997
  class: `${n}-toolbar-item`,
997
- title: (C = a.value.toolbarTips) == null ? void 0 : C.katex
998
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.katex
998
999
  }, [t("svg", {
999
1000
  class: `${n}-icon`,
1000
1001
  "aria-hidden": "true"
@@ -1008,10 +1009,10 @@ const Vt = /* @__PURE__ */ O({
1008
1009
  return e.defToolbars instanceof Array ? e.defToolbars[b] || "" : e.defToolbars && e.defToolbars.children instanceof Array && e.defToolbars.children[b] || "";
1009
1010
  };
1010
1011
  return () => {
1011
- const b = u.value[0].map((g) => $(g)), v = u.value[1].map((g) => $(g));
1012
+ const b = u.value[0].map((g) => y(g)), p = u.value[1].map((g) => y(g));
1012
1013
  return t(Ke, null, [e.toolbars.length > 0 && t("div", {
1013
1014
  class: `${n}-toolbar-wrapper`,
1014
- id: i
1015
+ id: r
1015
1016
  }, [t("div", {
1016
1017
  class: `${n}-toolbar`
1017
1018
  }, [t("div", {
@@ -1019,7 +1020,7 @@ const Vt = /* @__PURE__ */ O({
1019
1020
  ref: f
1020
1021
  }, [b]), t("div", {
1021
1022
  class: `${n}-toolbar-right`
1022
- }, [v])])]), t("input", {
1023
+ }, [p])])]), t("input", {
1023
1024
  ref: d,
1024
1025
  accept: "image/*",
1025
1026
  type: "file",
@@ -1027,7 +1028,7 @@ const Vt = /* @__PURE__ */ O({
1027
1028
  style: {
1028
1029
  display: "none"
1029
1030
  }
1030
- }, null), t(zt, {
1031
+ }, null), t(Zt, {
1031
1032
  linkVisible: m.linkVisible,
1032
1033
  clipVisible: m.clipVisible,
1033
1034
  type: m.type,
@@ -1043,12 +1044,12 @@ const Vt = /* @__PURE__ */ O({
1043
1044
  }, null)]);
1044
1045
  };
1045
1046
  }
1046
- }), Zt = (e, o) => {
1047
+ }), Xt = (e, o) => {
1047
1048
  const a = rt(() => {
1048
1049
  e.removeEventListener("scroll", l), e.addEventListener("scroll", l), o.removeEventListener("scroll", l), o.addEventListener("scroll", l);
1049
- }, 50), l = (i) => {
1050
- const r = e.clientHeight, c = o.clientHeight, m = e.scrollHeight, f = o.scrollHeight, u = (m - r) / (f - c);
1051
- i.target === e ? (o.removeEventListener("scroll", l), o.scrollTo({
1050
+ }, 50), l = (r) => {
1051
+ const i = e.clientHeight, c = o.clientHeight, m = e.scrollHeight, f = o.scrollHeight, u = (m - i) / (f - c);
1052
+ r.target === e ? (o.removeEventListener("scroll", l), o.scrollTo({
1052
1053
  top: e.scrollTop / u
1053
1054
  // behavior: 'smooth'
1054
1055
  }), a()) : (e.removeEventListener("scroll", l), e.scrollTo({
@@ -1066,97 +1067,97 @@ const Vt = /* @__PURE__ */ O({
1066
1067
  e.removeEventListener("scroll", l), o.removeEventListener("scroll", l);
1067
1068
  }
1068
1069
  ];
1069
- }, Jt = (e, o, a) => {
1070
- const { view: l } = a, i = (p) => l.lineBlockAt(l.state.doc.line(p).from).top, r = (p) => l.lineBlockAt(l.state.doc.line(p).from).height;
1070
+ }, Qt = (e, o, a) => {
1071
+ const { view: l } = a, r = (v) => l.lineBlockAt(l.state.doc.line(v).from).top, i = (v) => l.lineBlockAt(l.state.doc.line(v).from).height;
1071
1072
  let c = [];
1072
1073
  const m = () => {
1073
1074
  c = [];
1074
- const p = Array.from(o.querySelectorAll("[data-line]")).map(
1075
+ const v = Array.from(o.querySelectorAll("[data-line]")).map(
1075
1076
  (g) => Number(g.dataset.line) + 1
1076
- ), { lines: $ } = l.state.doc;
1077
- let b = 1, v = p.shift() ?? $;
1078
- for (let g = 1; g <= $; g++)
1079
- g === v && (b = g, v = p.shift() || $ + 1), c.push({
1077
+ ), { lines: y } = l.state.doc;
1078
+ let b = 1, p = v.shift() ?? y;
1079
+ for (let g = 1; g <= y; g++)
1080
+ g === p && (b = g, p = v.shift() || y + 1), c.push({
1080
1081
  start: b,
1081
- end: v - 1
1082
+ end: p - 1
1082
1083
  });
1083
1084
  };
1084
1085
  let f = 0, u = 0;
1085
- const d = it((p) => {
1086
- var v, g, y, x, T, w, M;
1087
- if (!((v = o.firstElementChild) != null && v.firstElementChild))
1086
+ const d = it((v) => {
1087
+ var p, g, k, x, T, w, M;
1088
+ if (!((p = o.firstElementChild) != null && p.firstElementChild))
1088
1089
  return;
1089
- const $ = l.lineBlockAtHeight(l.scrollDOM.scrollTop), { number: b } = l.state.doc.lineAt($.from);
1090
+ const y = l.lineBlockAtHeight(l.scrollDOM.scrollTop), { number: b } = l.state.doc.lineAt(y.from);
1090
1091
  if (!(b > c.length) && !(l.state.doc.lines < c[c.length - 1].end))
1091
- if (p.target === e) {
1092
+ if (v.target === e) {
1092
1093
  if (u !== 0)
1093
1094
  return;
1094
1095
  f++;
1095
- const k = c[b - 1], S = i(k.end) + r(k.end);
1096
+ const C = c[b - 1], S = r(C.end) + i(C.end);
1096
1097
  let R = 0;
1097
- const L = i(k.start), D = o.querySelector(`[data-line="${k.start - 1}"]`) || ((g = o.firstElementChild) == null ? void 0 : g.firstElementChild), V = o.querySelector(`[data-line="${k.end}"]`) || ((y = o.lastElementChild) == null ? void 0 : y.lastElementChild);
1098
- let B = 0, E = 0;
1099
- L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (S - L), B = V.offsetTop) : S > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, B = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (S - L), E = D.offsetTop, B = V.offsetTop - E);
1100
- const G = E - 10 + B * R;
1101
- Ee(o, G, () => {
1098
+ const L = r(C.start), D = o.querySelector(`[data-line="${C.start - 1}"]`) || ((g = o.firstElementChild) == null ? void 0 : g.firstElementChild), V = o.querySelector(`[data-line="${C.end}"]`) || ((k = o.lastElementChild) == null ? void 0 : k.lastElementChild);
1099
+ let I = 0, E = 0;
1100
+ L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (S - L), I = V.offsetTop) : S > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, I = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (S - L), E = D.offsetTop, I = V.offsetTop - E);
1101
+ const K = E - 10 + I * R;
1102
+ Ee(o, K, () => {
1102
1103
  f--;
1103
1104
  });
1104
1105
  } else {
1105
1106
  if (f !== 0)
1106
1107
  return;
1107
1108
  u++;
1108
- const k = Array.from(
1109
+ const C = Array.from(
1109
1110
  o.querySelectorAll("[data-line]")
1110
1111
  ), S = o.scrollTop, R = o.scrollHeight;
1111
- let L = k.length === 0 ? 1 : Math.ceil(
1112
- Number(k[k.length - 1].dataset.line) * (S / R)
1112
+ let L = C.length === 0 ? 1 : Math.ceil(
1113
+ Number(C[C.length - 1].dataset.line) * (S / R)
1113
1114
  ), D = (x = o.firstElementChild) == null ? void 0 : x.firstElementChild;
1114
1115
  for (let H = L; H >= 0; H--) {
1115
- const F = o.querySelector(`[data-line="${H}"]`);
1116
- if (F && F.offsetTop <= S) {
1117
- D = F, L = H;
1116
+ const B = o.querySelector(`[data-line="${H}"]`);
1117
+ if (B && B.offsetTop <= S) {
1118
+ D = B, L = H;
1118
1119
  break;
1119
1120
  }
1120
1121
  }
1121
- let V = (T = o.firstElementChild) == null ? void 0 : T.firstElementChild, B = (w = o.firstElementChild) == null ? void 0 : w.lastElementChild;
1122
- for (; k.length > 0; ) {
1123
- const H = k.indexOf(D);
1124
- if (H + 1 >= k.length)
1122
+ let V = (T = o.firstElementChild) == null ? void 0 : T.firstElementChild, I = (w = o.firstElementChild) == null ? void 0 : w.lastElementChild;
1123
+ for (; C.length > 0; ) {
1124
+ const H = C.indexOf(D);
1125
+ if (H + 1 >= C.length)
1125
1126
  break;
1126
- const F = k[H + 1];
1127
+ const B = C[H + 1];
1127
1128
  if (H === -1) {
1128
- B = F;
1129
+ I = B;
1129
1130
  break;
1130
1131
  }
1131
1132
  const Q = D.offsetTop;
1132
1133
  if (Q > S) {
1133
1134
  if (H === 0) {
1134
- V = D, B = F;
1135
+ V = D, I = B;
1135
1136
  break;
1136
1137
  }
1137
- D = k[H - 1];
1138
+ D = C[H - 1];
1138
1139
  continue;
1139
1140
  }
1140
- const ne = F.offsetTop;
1141
+ const ne = B.offsetTop;
1141
1142
  if (Q <= S && ne > S) {
1142
- V = D, B = F;
1143
+ V = D, I = B;
1143
1144
  break;
1144
1145
  }
1145
- D = F;
1146
+ D = B;
1146
1147
  }
1147
- const E = V.offsetTop, G = B.offsetTop;
1148
+ const E = V.offsetTop, K = I.offsetTop;
1148
1149
  let N = 0;
1149
- const { start: ae, end: J } = c[Number(V.dataset.line || 0)], K = i(ae);
1150
- let P = i(J);
1151
- const X = r(J);
1152
- let j = 0;
1153
- V === ((M = o.firstElementChild) == null ? void 0 : M.firstElementChild) ? (N = Math.max(S / G, 0), j = P + X - K) : P > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (N = Math.max(
1150
+ const { start: ae, end: J } = c[Number(V.dataset.line || 0)], j = r(ae);
1151
+ let q = r(J);
1152
+ const X = i(J);
1153
+ let _ = 0;
1154
+ V === ((M = o.firstElementChild) == null ? void 0 : M.firstElementChild) ? (N = Math.max(S / K, 0), _ = q + X - j) : q > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (N = Math.max(
1154
1155
  (S - E) / (o.scrollHeight - E - o.clientHeight),
1155
1156
  0
1156
- ), P = i(l.state.doc.lines) + r(l.state.doc.lines), j = 8 + P - K - e.clientHeight) : (N = Math.max(
1157
- (S - E) / (G - E),
1157
+ ), q = r(l.state.doc.lines) + i(l.state.doc.lines), _ = 8 + q - j - e.clientHeight) : (N = Math.max(
1158
+ (S - E) / (K - E),
1158
1159
  0
1159
- ), j = P + X - K), Ee(e, K + j * N, () => {
1160
+ ), _ = q + X - j), Ee(e, j + _ * N, () => {
1160
1161
  u--;
1161
1162
  });
1162
1163
  }
@@ -1169,25 +1170,25 @@ const Vt = /* @__PURE__ */ O({
1169
1170
  c = [], e.removeEventListener("scroll", d), o.removeEventListener("scroll", d);
1170
1171
  }
1171
1172
  ];
1172
- }, Xt = (e, o, a) => {
1173
+ }, el = (e, o, a) => {
1173
1174
  const l = A("editorId");
1174
- let i = () => {
1175
- }, r = () => {
1175
+ let r = () => {
1176
+ }, i = () => {
1176
1177
  };
1177
1178
  const c = () => {
1178
- i();
1179
+ r();
1179
1180
  const m = document.querySelector(".cm-scroller"), f = document.querySelector(
1180
1181
  `[id="${l}-preview-wrapper"][data-show="true"]`
1181
1182
  ), u = document.querySelector(
1182
1183
  `[id="${l}-html-wrapper"][data-show="true"]`
1183
1184
  );
1184
- (f || u) && ([r, i] = (f ? Jt : Zt)(
1185
+ (f || u) && ([i, r] = (f ? Qt : Xt)(
1185
1186
  m,
1186
1187
  f || u,
1187
1188
  a.value
1188
- )), e.scrollAuto && r();
1189
+ )), e.scrollAuto && i();
1189
1190
  };
1190
- I(
1191
+ F(
1191
1192
  [
1192
1193
  o,
1193
1194
  te(e.setting, "preview"),
@@ -1198,87 +1199,87 @@ const Vt = /* @__PURE__ */ O({
1198
1199
  () => {
1199
1200
  me(c);
1200
1201
  }
1201
- ), I(
1202
+ ), F(
1202
1203
  () => e.scrollAuto,
1203
1204
  (m) => {
1204
- m ? r() : i();
1205
+ m ? i() : r();
1205
1206
  }
1206
- ), W(c);
1207
- }, Qt = Xt, el = (e, o, a) => {
1208
- var d, p, $, b, v, g;
1209
- let l = "", i = 0, r = 0, c = !0, m = !1;
1210
- const f = o.getSelectedText(), u = (d = _.editorConfig) == null ? void 0 : d.mermaidTemplate;
1207
+ ), z(c);
1208
+ }, tl = el, ll = (e, o, a) => {
1209
+ var d, v, y, b, p, g;
1210
+ let l = "", r = 0, i = 0, c = !0, m = !1;
1211
+ const f = o.getSelectedText(), u = (d = W.editorConfig) == null ? void 0 : d.mermaidTemplate;
1211
1212
  if (/^h[1-6]{1}$/.test(e)) {
1212
- const y = e.replace(/^h(\d)/, (x, T) => new Array(Number(T)).fill("#", 0, T).join(""));
1213
- l = `${y} ${f}`, i = y.length + 1;
1213
+ const k = e.replace(/^h(\d)/, (x, T) => new Array(Number(T)).fill("#", 0, T).join(""));
1214
+ l = `${k} ${f}`, r = k.length + 1;
1214
1215
  } else if (e === "prettier") {
1215
- const y = window.prettier || (($ = (p = _.editorExtensions) == null ? void 0 : p.prettier) == null ? void 0 : $.prettierInstance), x = [
1216
- ((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((g = (v = _.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : g.parserMarkdownInstance)
1216
+ const k = window.prettier || ((y = (v = W.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : y.prettierInstance), x = [
1217
+ ((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((g = (p = W.editorExtensions) == null ? void 0 : p.prettier) == null ? void 0 : g.parserMarkdownInstance)
1217
1218
  ];
1218
- !y || x[0] === void 0 ? (h.emit(a.editorId, "errorCatcher", {
1219
+ !k || x[0] === void 0 ? (h.emit(a.editorId, "errorCatcher", {
1219
1220
  name: "prettier",
1220
1221
  message: "prettier is undefined"
1221
- }), l = o.getValue()) : l = y.format(o.getValue(), {
1222
+ }), l = o.getValue()) : l = k.format(o.getValue(), {
1222
1223
  parser: "markdown",
1223
1224
  plugins: x
1224
1225
  }), c = !1, m = !0;
1225
1226
  } else
1226
1227
  switch (e) {
1227
1228
  case "bold": {
1228
- l = `**${f}**`, i = 2, r = -2;
1229
+ l = `**${f}**`, r = 2, i = -2;
1229
1230
  break;
1230
1231
  }
1231
1232
  case "underline": {
1232
- l = `<u>${f}</u>`, i = 3, r = -4;
1233
+ l = `<u>${f}</u>`, r = 3, i = -4;
1233
1234
  break;
1234
1235
  }
1235
1236
  case "italic": {
1236
- l = `*${f}*`, i = 1, r = -1;
1237
+ l = `*${f}*`, r = 1, i = -1;
1237
1238
  break;
1238
1239
  }
1239
1240
  case "strikeThrough": {
1240
- l = `~~${f}~~`, i = 2, r = -2;
1241
+ l = `~~${f}~~`, r = 2, i = -2;
1241
1242
  break;
1242
1243
  }
1243
1244
  case "sub": {
1244
- l = `<sub>${f}</sub>`, i = 5, r = -6;
1245
+ l = `<sub>${f}</sub>`, r = 5, i = -6;
1245
1246
  break;
1246
1247
  }
1247
1248
  case "sup": {
1248
- l = `<sup>${f}</sup>`, i = 5, r = -6;
1249
+ l = `<sup>${f}</sup>`, r = 5, i = -6;
1249
1250
  break;
1250
1251
  }
1251
1252
  case "codeRow": {
1252
- l = "`" + f + "`", i = 1, r = -1;
1253
+ l = "`" + f + "`", r = 1, i = -1;
1253
1254
  break;
1254
1255
  }
1255
1256
  case "quote": {
1256
- l = `> ${f}`, i = 2;
1257
+ l = `> ${f}`, r = 2;
1257
1258
  break;
1258
1259
  }
1259
1260
  case "orderedList": {
1260
- l = `1. ${f}`, i = 3;
1261
+ l = `1. ${f}`, r = 3;
1261
1262
  break;
1262
1263
  }
1263
1264
  case "unorderedList": {
1264
- l = `- ${f}`, i = 2;
1265
+ l = `- ${f}`, r = 2;
1265
1266
  break;
1266
1267
  }
1267
1268
  case "task": {
1268
- l = `- [ ] ${f}`, i = 6;
1269
+ l = `- [ ] ${f}`, r = 6;
1269
1270
  break;
1270
1271
  }
1271
1272
  case "code": {
1272
- const y = a.text || f || "", x = a.mode || "language";
1273
+ const k = a.text || f || "", x = a.mode || "language";
1273
1274
  l = `\`\`\`${x}
1274
- ${y}
1275
+ ${k}
1275
1276
  \`\`\`
1276
- `, i = 3, r = 3 + x.length - l.length;
1277
+ `, r = 3, i = 3 + x.length - l.length;
1277
1278
  break;
1278
1279
  }
1279
1280
  case "table": {
1280
1281
  l = "|";
1281
- const { selectedShape: y = { x: 1, y: 1 } } = a, { x, y: T } = y;
1282
+ const { selectedShape: k = { x: 1, y: 1 } } = a, { x, y: T } = k;
1282
1283
  for (let w = 0; w <= T; w++)
1283
1284
  l += " col |";
1284
1285
  l += `
@@ -1291,18 +1292,18 @@ ${y}
1291
1292
  for (let M = 0; M <= T; M++)
1292
1293
  l += " content |";
1293
1294
  }
1294
- i = 2, r = 5 - l.length;
1295
+ r = 2, i = 5 - l.length;
1295
1296
  break;
1296
1297
  }
1297
1298
  case "link": {
1298
- const { desc: y, url: x } = a;
1299
- l = `[${y}](${x})`, c = !1;
1299
+ const { desc: k, url: x } = a;
1300
+ l = `[${k}](${x})`, c = !1;
1300
1301
  break;
1301
1302
  }
1302
1303
  case "image": {
1303
- const { desc: y, url: x, urls: T } = a;
1304
- T instanceof Array ? l = T.reduce((w, M) => w + `![${y}](${M})
1305
- `, "") : l = `![${y}](${x})
1304
+ const { desc: k, url: x, urls: T } = a;
1305
+ T instanceof Array ? l = T.reduce((w, M) => w + `![${k}](${M})
1306
+ `, "") : l = `![${k}](${x})
1306
1307
  `, c = !1;
1307
1308
  break;
1308
1309
  }
@@ -1311,7 +1312,7 @@ ${y}
1311
1312
  ${(u == null ? void 0 : u.flow) || `flowchart TD
1312
1313
  Start --> Stop`}
1313
1314
  \`\`\`
1314
- `, i = 3, r = 10 - l.length;
1315
+ `, r = 3, i = 10 - l.length;
1315
1316
  break;
1316
1317
  }
1317
1318
  case "sequence": {
@@ -1321,7 +1322,7 @@ ${(u == null ? void 0 : u.sequence) || `sequenceDiagram
1321
1322
  B-->>A: hi!
1322
1323
  A-)B: bye!`}
1323
1324
  \`\`\`
1324
- `, i = 3, r = 10 - l.length;
1325
+ `, r = 3, i = 10 - l.length;
1325
1326
  break;
1326
1327
  }
1327
1328
  case "gantt": {
@@ -1333,7 +1334,7 @@ section Section
1333
1334
  A task :a1, 2014-01-01, 30d
1334
1335
  Another task :after a1, 20d`}
1335
1336
  \`\`\`
1336
- `, i = 3, r = 10 - l.length;
1337
+ `, r = 3, i = 10 - l.length;
1337
1338
  break;
1338
1339
  }
1339
1340
  case "class": {
@@ -1342,7 +1343,7 @@ ${(u == null ? void 0 : u.class) || `classDiagram
1342
1343
  class Animal
1343
1344
  Vehicle <|-- Car`}
1344
1345
  \`\`\`
1345
- `, i = 3, r = 10 - l.length;
1346
+ `, r = 3, i = 10 - l.length;
1346
1347
  break;
1347
1348
  }
1348
1349
  case "state": {
@@ -1350,7 +1351,7 @@ ${(u == null ? void 0 : u.class) || `classDiagram
1350
1351
  ${(u == null ? void 0 : u.state) || `stateDiagram-v2
1351
1352
  s1 --> s2`}
1352
1353
  \`\`\`
1353
- `, i = 3, r = 10 - l.length;
1354
+ `, r = 3, i = 10 - l.length;
1354
1355
  break;
1355
1356
  }
1356
1357
  case "pie": {
@@ -1360,7 +1361,7 @@ ${(u == null ? void 0 : u.pie) || `pie title Pets adopted by volunteers
1360
1361
  "Cats" : 85
1361
1362
  "Rats" : 15`}
1362
1363
  \`\`\`
1363
- `, i = 3, r = 10 - l.length;
1364
+ `, r = 3, i = 10 - l.length;
1364
1365
  break;
1365
1366
  }
1366
1367
  case "relationship": {
@@ -1369,7 +1370,7 @@ ${(u == null ? void 0 : u.relationship) || `erDiagram
1369
1370
  CAR ||--o{ NAMED-DRIVER : allows
1370
1371
  PERSON ||--o{ NAMED-DRIVER : is`}
1371
1372
  \`\`\`
1372
- `, i = 3, r = 10 - l.length;
1373
+ `, r = 3, i = 10 - l.length;
1373
1374
  break;
1374
1375
  }
1375
1376
  case "journey": {
@@ -1384,23 +1385,23 @@ ${(u == null ? void 0 : u.journey) || `journey
1384
1385
  Go downstairs: 5: Me
1385
1386
  Sit down: 5: Me`}
1386
1387
  \`\`\`
1387
- `, i = 3, r = 10 - l.length;
1388
+ `, r = 3, i = 10 - l.length;
1388
1389
  break;
1389
1390
  }
1390
1391
  case "katexInline": {
1391
- l = "$$", i = 1, r = -1;
1392
+ l = "$$", r = 1, i = -1;
1392
1393
  break;
1393
1394
  }
1394
1395
  case "katexBlock": {
1395
1396
  l = `$$
1396
1397
 
1397
1398
  $$
1398
- `, i = 3, r = -4;
1399
+ `, r = 3, i = -4;
1399
1400
  break;
1400
1401
  }
1401
1402
  case "universal": {
1402
- const { generate: y } = a, x = y(f);
1403
- l = x.targetValue, c = x.select, i = x.deviationStart, r = x.deviationEnd;
1403
+ const { generate: k } = a, x = k(f);
1404
+ l = x.targetValue, c = x.select, r = x.deviationStart, i = x.deviationEnd;
1404
1405
  }
1405
1406
  }
1406
1407
  return {
@@ -1409,14 +1410,14 @@ $$
1409
1410
  // 是否选中
1410
1411
  select: c,
1411
1412
  // 选中时,开始位置的偏移量
1412
- deviationStart: i,
1413
+ deviationStart: r,
1413
1414
  // 结束的偏移量
1414
- deviationEnd: r,
1415
+ deviationEnd: i,
1415
1416
  // 是否整个替换
1416
1417
  replaceAll: m
1417
1418
  }
1418
1419
  };
1419
- }, tl = "#e5c07b", Be = "var(--md-color)", ll = "#56b6c2", ol = "#ffffff", le = "var(--md-color)", Fe = "#e5c07b", al = "#e5c07b", nl = "var(--md-color)", Ie = "#d19a66", rl = "#c678dd", il = "#21252b", sl = "#2c313a", Oe = "var(--md-bk-color)", ce = "var(--md-bk-color)", cl = "#ceedfa33", Ve = "#528bff", dl = ge.theme(
1420
+ }, ol = "#e5c07b", Ie = "var(--md-color)", al = "#56b6c2", nl = "#ffffff", le = "var(--md-color)", Be = "#e5c07b", rl = "#e5c07b", il = "var(--md-color)", Fe = "#d19a66", sl = "#c678dd", cl = "#21252b", dl = "#2c313a", Oe = "var(--md-bk-color)", ce = "var(--md-bk-color)", ul = "#ceedfa33", Ve = "#528bff", ml = ge.theme(
1420
1421
  {
1421
1422
  "&": {
1422
1423
  color: le,
@@ -1426,8 +1427,8 @@ $$
1426
1427
  caretColor: Ve
1427
1428
  },
1428
1429
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: Ve },
1429
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: cl },
1430
- ".cm-panels": { backgroundColor: il, color: le },
1430
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ul },
1431
+ ".cm-panels": { backgroundColor: cl, color: le },
1431
1432
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1432
1433
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1433
1434
  ".cm-searchMatch": {
@@ -1449,7 +1450,7 @@ $$
1449
1450
  borderColor: "var(--md-border-color)"
1450
1451
  },
1451
1452
  ".cm-activeLineGutter": {
1452
- backgroundColor: sl
1453
+ backgroundColor: dl
1453
1454
  },
1454
1455
  ".cm-foldPlaceholder": {
1455
1456
  backgroundColor: "transparent",
@@ -1475,11 +1476,11 @@ $$
1475
1476
  }
1476
1477
  },
1477
1478
  { dark: !0 }
1478
- ), ul = We.define([
1479
- { tag: s.keyword, color: rl },
1480
- { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Be },
1481
- { tag: [s.function(s.variableName), s.labelName], color: al },
1482
- { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Ie },
1479
+ ), fl = We.define([
1480
+ { tag: s.keyword, color: sl },
1481
+ { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Ie },
1482
+ { tag: [s.function(s.variableName), s.labelName], color: rl },
1483
+ { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Fe },
1483
1484
  { tag: [s.definition(s.name), s.separator], color: le },
1484
1485
  {
1485
1486
  tag: [
@@ -1492,7 +1493,7 @@ $$
1492
1493
  s.self,
1493
1494
  s.namespace
1494
1495
  ],
1495
- color: tl
1496
+ color: ol
1496
1497
  },
1497
1498
  {
1498
1499
  tag: [
@@ -1504,21 +1505,21 @@ $$
1504
1505
  s.link,
1505
1506
  s.special(s.string)
1506
1507
  ],
1507
- color: ll
1508
+ color: al
1508
1509
  },
1509
- { tag: [s.meta, s.comment], color: Fe },
1510
+ { tag: [s.meta, s.comment], color: Be },
1510
1511
  { tag: s.strong, fontWeight: "bold" },
1511
1512
  { tag: s.emphasis, fontStyle: "italic" },
1512
1513
  { tag: s.strikethrough, textDecoration: "line-through" },
1513
- { tag: s.link, color: Fe, textDecoration: "underline" },
1514
- { tag: s.heading, fontWeight: "bold", color: Be },
1515
- { tag: [s.atom, s.bool, s.special(s.variableName)], color: Ie },
1516
- { tag: [s.processingInstruction, s.string, s.inserted], color: nl },
1517
- { tag: s.invalid, color: ol }
1518
- ]), ml = [
1519
- dl,
1520
- ze(ul)
1521
- ], fl = "#e5c07b", Re = "#3f4a54", gl = "#56b6c2", hl = "#fff", oe = "#3f4a54", Ne = "#2d8cf0", bl = "#2d8cf0", vl = "#3f4a54", Pe = "#d19a66", pl = "#c678dd", kl = "#21252b", Cl = "#ceedfa33", qe = "var(--md-bk-color)", de = "var(--md-bk-color)", $l = "#bad5fa", Ue = "#3f4a54", yl = ge.theme(
1514
+ { tag: s.link, color: Be, textDecoration: "underline" },
1515
+ { tag: s.heading, fontWeight: "bold", color: Ie },
1516
+ { tag: [s.atom, s.bool, s.special(s.variableName)], color: Fe },
1517
+ { tag: [s.processingInstruction, s.string, s.inserted], color: il },
1518
+ { tag: s.invalid, color: nl }
1519
+ ]), gl = [
1520
+ ml,
1521
+ ze(fl)
1522
+ ], hl = "#e5c07b", Re = "#3f4a54", bl = "#56b6c2", vl = "#fff", oe = "#3f4a54", Pe = "#2d8cf0", pl = "#2d8cf0", kl = "#3f4a54", Ne = "#d19a66", Cl = "#c678dd", $l = "#21252b", yl = "#ceedfa33", qe = "var(--md-bk-color)", de = "var(--md-bk-color)", xl = "#bad5fa", Ue = "#3f4a54", wl = ge.theme(
1522
1523
  {
1523
1524
  "&": {
1524
1525
  color: oe,
@@ -1528,8 +1529,8 @@ $$
1528
1529
  caretColor: Ue
1529
1530
  },
1530
1531
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: Ue },
1531
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: $l },
1532
- ".cm-panels": { backgroundColor: kl, color: oe },
1532
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: xl },
1533
+ ".cm-panels": { backgroundColor: $l, color: oe },
1533
1534
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1534
1535
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1535
1536
  ".cm-searchMatch": {
@@ -1551,7 +1552,7 @@ $$
1551
1552
  borderColor: "var(--md-border-color)"
1552
1553
  },
1553
1554
  ".cm-activeLineGutter": {
1554
- backgroundColor: Cl
1555
+ backgroundColor: yl
1555
1556
  },
1556
1557
  ".cm-foldPlaceholder": {
1557
1558
  backgroundColor: "transparent",
@@ -1577,11 +1578,11 @@ $$
1577
1578
  }
1578
1579
  }
1579
1580
  // { dark: true }
1580
- ), xl = We.define([
1581
- { tag: s.keyword, color: pl },
1581
+ ), Tl = We.define([
1582
+ { tag: s.keyword, color: Cl },
1582
1583
  { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Re },
1583
- { tag: [s.function(s.variableName), s.labelName], color: bl },
1584
- { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Pe },
1584
+ { tag: [s.function(s.variableName), s.labelName], color: pl },
1585
+ { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Ne },
1585
1586
  { tag: [s.definition(s.name), s.separator], color: oe },
1586
1587
  {
1587
1588
  tag: [
@@ -1594,7 +1595,7 @@ $$
1594
1595
  s.self,
1595
1596
  s.namespace
1596
1597
  ],
1597
- color: fl
1598
+ color: hl
1598
1599
  },
1599
1600
  {
1600
1601
  tag: [
@@ -1606,40 +1607,40 @@ $$
1606
1607
  s.link,
1607
1608
  s.special(s.string)
1608
1609
  ],
1609
- color: gl
1610
+ color: bl
1610
1611
  },
1611
- { tag: [s.meta, s.comment], color: Ne },
1612
+ { tag: [s.meta, s.comment], color: Pe },
1612
1613
  { tag: s.strong, fontWeight: "bold" },
1613
1614
  { tag: s.emphasis, fontStyle: "italic" },
1614
1615
  { tag: s.strikethrough, textDecoration: "line-through" },
1615
- { tag: s.link, color: Ne, textDecoration: "underline" },
1616
+ { tag: s.link, color: Pe, textDecoration: "underline" },
1616
1617
  { tag: s.heading, fontWeight: "bold", color: Re },
1617
- { tag: [s.atom, s.bool, s.special(s.variableName)], color: Pe },
1618
- { tag: [s.processingInstruction, s.string, s.inserted], color: vl },
1619
- { tag: s.invalid, color: hl }
1620
- ]), wl = [
1621
- yl,
1622
- ze(xl)
1623
- ], ie = (e, o, a, l, i) => (r, c, m, f) => {
1618
+ { tag: [s.atom, s.bool, s.special(s.variableName)], color: Ne },
1619
+ { tag: [s.processingInstruction, s.string, s.inserted], color: kl },
1620
+ { tag: s.invalid, color: vl }
1621
+ ]), Sl = [
1622
+ wl,
1623
+ ze(Tl)
1624
+ ], ie = (e, o, a, l, r) => (i, c, m, f) => {
1624
1625
  const u = `${e}${o}`.slice(f - m);
1625
- r.dispatch(r.state.replaceSelection(`${u}${a}${l}`));
1626
- const d = m + c.label.length + (i === "title" ? a.length : 0);
1627
- r.dispatch({
1628
- selection: Y.create(
1626
+ i.dispatch(i.state.replaceSelection(`${u}${a}${l}`));
1627
+ const d = m + c.label.length + (r === "title" ? a.length : 0);
1628
+ i.dispatch({
1629
+ selection: P.create(
1629
1630
  [
1630
- Y.range(
1631
- m + c.label.length + (i === "title" ? 1 : -o.length),
1631
+ P.range(
1632
+ m + c.label.length + (r === "title" ? 1 : -o.length),
1632
1633
  d
1633
1634
  ),
1634
- Y.cursor(d)
1635
+ P.cursor(d)
1635
1636
  ],
1636
1637
  1
1637
1638
  )
1638
- }), r.focus();
1639
- }, Ge = (e) => (o, a, l, i) => {
1640
- const r = e.slice(i - l);
1641
- o.dispatch(o.state.replaceSelection(`${r} `));
1642
- }, Tl = (e) => {
1639
+ }), i.focus();
1640
+ }, Ge = (e) => (o, a, l, r) => {
1641
+ const i = e.slice(r - l);
1642
+ o.dispatch(o.state.replaceSelection(`${i} `));
1643
+ }, Al = (e) => {
1643
1644
  const o = (a) => {
1644
1645
  const l = a.matchBefore(
1645
1646
  /^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
@@ -1648,8 +1649,8 @@ $$
1648
1649
  from: l.from,
1649
1650
  options: [
1650
1651
  // 标题
1651
- ...["h1", "h2", "h3", "h4", "h5", "h6"].map((i, r) => {
1652
- const c = new Array(r + 1).fill("#").join("");
1652
+ ...["h1", "h2", "h3", "h4", "h5", "h6"].map((r, i) => {
1653
+ const c = new Array(i + 1).fill("#").join("");
1653
1654
  return {
1654
1655
  label: c,
1655
1656
  type: "text",
@@ -1657,12 +1658,12 @@ $$
1657
1658
  };
1658
1659
  }),
1659
1660
  // 任务列表
1660
- ...["unchecked", "checked"].map((i) => {
1661
- const r = i === "checked" ? "- [x]" : "- [ ]";
1661
+ ...["unchecked", "checked"].map((r) => {
1662
+ const i = r === "checked" ? "- [x]" : "- [ ]";
1662
1663
  return {
1663
- label: r,
1664
+ label: i,
1664
1665
  type: "text",
1665
- apply: Ge(r)
1666
+ apply: Ge(i)
1666
1667
  };
1667
1668
  }),
1668
1669
  // 代码
@@ -1670,10 +1671,10 @@ $$
1670
1671
  ["`", ""],
1671
1672
  ["```", "language"],
1672
1673
  ["```mermaid\n", ""]
1673
- ].map((i) => ({
1674
- label: `${i[0]}${i[1]}`,
1674
+ ].map((r) => ({
1675
+ label: `${r[0]}${r[1]}`,
1675
1676
  type: "text",
1676
- apply: ie(i[0], i[1], "", i[0] === "`" ? "`" : "\n```", "type")
1677
+ apply: ie(r[0], r[1], "", r[0] === "`" ? "`" : "\n```", "type")
1677
1678
  })),
1678
1679
  // 链接
1679
1680
  {
@@ -1725,39 +1726,39 @@ $$`, "title")
1725
1726
  "caution",
1726
1727
  "error",
1727
1728
  "attention"
1728
- ].map((i) => ({
1729
- label: `!!! ${i}`,
1729
+ ].map((r) => ({
1730
+ label: `!!! ${r}`,
1730
1731
  type: "text",
1731
- apply: ie("!!!", ` ${i}`, " Title", `
1732
+ apply: ie("!!!", ` ${r}`, " Title", `
1732
1733
 
1733
1734
  !!!`, "title")
1734
1735
  }))
1735
1736
  ]
1736
1737
  };
1737
1738
  };
1738
- return It({
1739
- override: e ? [o, ...e] : [o]
1739
+ return Vt({
1740
+ override: e ? [o, Mt, ...e] : [o]
1740
1741
  });
1741
- }, Sl = Tl, z = (e) => {
1742
- const o = new Bt();
1742
+ }, Ml = Al, Y = (e) => {
1743
+ const o = new Ft();
1743
1744
  return (l) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(l) }) : e.dispatch({
1744
- effects: Ft.appendConfig.of(o.of(l))
1745
+ effects: Ot.appendConfig.of(o.of(l))
1745
1746
  }), !0);
1746
1747
  };
1747
- class Al {
1748
+ class Ll {
1748
1749
  constructor(o) {
1749
- q(this, "view");
1750
+ U(this, "view");
1750
1751
  // 切换tabSize的执行方法。切换时,Compartment实例需要相同
1751
- q(this, "toggleTabSize");
1752
- q(this, "togglePlaceholder");
1752
+ U(this, "toggleTabSize");
1753
+ U(this, "togglePlaceholder");
1753
1754
  /**
1754
1755
  * 设置全部的扩展
1755
1756
  */
1756
- q(this, "setExtensions");
1757
- q(this, "toggleDisabled");
1758
- q(this, "toggleReadOnly");
1759
- q(this, "toggleMaxlength");
1760
- this.view = o, this.toggleTabSize = z(this.view), this.togglePlaceholder = z(this.view), this.setExtensions = z(this.view), this.toggleDisabled = z(this.view), this.toggleReadOnly = z(this.view), this.toggleMaxlength = z(this.view);
1757
+ U(this, "setExtensions");
1758
+ U(this, "toggleDisabled");
1759
+ U(this, "toggleReadOnly");
1760
+ U(this, "toggleMaxlength");
1761
+ this.view = o, this.toggleTabSize = Y(this.view), this.togglePlaceholder = Y(this.view), this.setExtensions = Y(this.view), this.toggleDisabled = Y(this.view), this.toggleReadOnly = Y(this.view), this.toggleMaxlength = Y(this.view);
1761
1762
  }
1762
1763
  getValue() {
1763
1764
  return this.view.state.doc.toString();
@@ -1807,12 +1808,12 @@ class Al {
1807
1808
  }
1808
1809
  const { from: l } = this.view.state.selection.main;
1809
1810
  if (this.view.dispatch(this.view.state.replaceSelection(o)), a.select) {
1810
- const i = l + o.length + a.deviationEnd;
1811
+ const r = l + o.length + a.deviationEnd;
1811
1812
  this.view.dispatch({
1812
- selection: Y.create(
1813
+ selection: P.create(
1813
1814
  [
1814
- Y.range(l + a.deviationStart, i),
1815
- Y.cursor(i)
1815
+ P.range(l + a.deviationStart, r),
1816
+ P.cursor(r)
1816
1817
  ],
1817
1818
  1
1818
1819
  )
@@ -1827,7 +1828,7 @@ class Al {
1827
1828
  setTabSize(o) {
1828
1829
  this.toggleTabSize([
1829
1830
  se.tabSize.of(o),
1830
- Ht.of(" ".repeat(o))
1831
+ Bt.of(" ".repeat(o))
1831
1832
  ]);
1832
1833
  }
1833
1834
  /**
@@ -1838,8 +1839,27 @@ class Al {
1838
1839
  setPlaceholder(o) {
1839
1840
  this.togglePlaceholder(wt(o));
1840
1841
  }
1841
- focus() {
1842
- this.view.focus();
1842
+ focus(o) {
1843
+ if (this.view.focus(), !o)
1844
+ return;
1845
+ let a = 0, l = 0, r = 0;
1846
+ switch (o) {
1847
+ case "start":
1848
+ break;
1849
+ case "end": {
1850
+ a = l = r = this.getValue().length;
1851
+ break;
1852
+ }
1853
+ default:
1854
+ a = o.rangeAnchor || o.cursorPos, l = o.rangeHead || o.cursorPos, r = o.cursorPos;
1855
+ }
1856
+ this.view.dispatch({
1857
+ scrollIntoView: !0,
1858
+ selection: P.create(
1859
+ [P.range(a, l), P.cursor(r)],
1860
+ 1
1861
+ )
1862
+ });
1843
1863
  }
1844
1864
  setDisabled(o) {
1845
1865
  this.toggleDisabled([ge.editable.of(!o)]);
@@ -1853,39 +1873,39 @@ class Al {
1853
1873
  ]);
1854
1874
  }
1855
1875
  }
1856
- const Ml = (e) => {
1876
+ const Dl = (e) => {
1857
1877
  const o = A("editorId");
1858
1878
  return (l) => {
1859
1879
  if (l.clipboardData) {
1860
1880
  if (l.clipboardData.files.length > 0) {
1861
- const { files: i } = l.clipboardData;
1881
+ const { files: r } = l.clipboardData;
1862
1882
  h.emit(
1863
1883
  o,
1864
1884
  "uploadImage",
1865
- Array.from(i).filter((r) => /image\/.*/.test(r.type))
1885
+ Array.from(r).filter((i) => /image\/.*/.test(i.type))
1866
1886
  ), l.preventDefault();
1867
1887
  }
1868
1888
  if (e.autoDetectCode && l.clipboardData.types.includes("vscode-editor-data")) {
1869
- const i = JSON.parse(l.clipboardData.getData("vscode-editor-data"));
1889
+ const r = JSON.parse(l.clipboardData.getData("vscode-editor-data"));
1870
1890
  h.emit(o, "replace", "code", {
1871
- mode: i.mode,
1891
+ mode: r.mode,
1872
1892
  text: l.clipboardData.getData("text/plain")
1873
1893
  }), l.preventDefault();
1874
1894
  }
1875
1895
  }
1876
1896
  };
1877
- }, Ll = Ml, Dl = (e) => {
1897
+ }, El = Dl, Hl = (e) => {
1878
1898
  const o = A("editorId");
1879
- W(() => {
1899
+ z(() => {
1880
1900
  h.on(o, {
1881
1901
  name: dt,
1882
- callback() {
1883
- var a;
1884
- (a = e.value) == null || a.focus();
1902
+ callback(a) {
1903
+ var l;
1904
+ (l = e.value) == null || l.focus(a);
1885
1905
  }
1886
1906
  });
1887
1907
  });
1888
- }, El = Dl, Hl = (e, o) => [
1908
+ }, Il = Hl, Bl = (e, o) => [
1889
1909
  {
1890
1910
  key: "Ctrl-b",
1891
1911
  mac: "Cmd-b",
@@ -1894,7 +1914,7 @@ const Ml = (e) => {
1894
1914
  {
1895
1915
  key: "Ctrl-d",
1896
1916
  mac: "Cmd-d",
1897
- run: Mt,
1917
+ run: Dt,
1898
1918
  preventDefault: !0
1899
1919
  },
1900
1920
  {
@@ -1964,8 +1984,8 @@ const Ml = (e) => {
1964
1984
  key: "Ctrl-c",
1965
1985
  mac: "Cmd-c",
1966
1986
  shift: () => (h.emit(e, "replace", "code"), !0),
1967
- any(M, k) {
1968
- return (k.ctrlKey || k.metaKey) && k.altKey && k.code === "KeyC" ? (h.emit(e, "replace", "codeRow"), !0) : !1;
1987
+ any(M, C) {
1988
+ return (C.ctrlKey || C.metaKey) && C.altKey && C.code === "KeyC" ? (h.emit(e, "replace", "codeRow"), !0) : !1;
1969
1989
  }
1970
1990
  },
1971
1991
  {
@@ -1979,12 +1999,13 @@ const Ml = (e) => {
1979
1999
  shift: () => o.noPrettier ? !1 : (h.emit(e, "replace", "prettier"), !0)
1980
2000
  },
1981
2001
  {
1982
- any: (M, k) => (k.ctrlKey || k.metaKey) && k.altKey && k.shiftKey && k.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
2002
+ any: (M, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
1983
2003
  }
1984
- ], Bl = Hl, Fl = (e) => {
1985
- const o = A("tabWidth"), a = A("editorId"), l = A("theme"), i = U(), r = Xe(), c = Bl(a, e), m = Ll(e), f = [
1986
- Tt.of([...c, Lt]),
2004
+ ], Fl = Bl, Ol = (e) => {
2005
+ const o = A("tabWidth"), a = A("editorId"), l = A("theme"), r = G(), i = Xe(), c = Fl(a, e), m = El(e), f = [
2006
+ Tt.of([...c, Et]),
1987
2007
  xt,
2008
+ Lt(),
1988
2009
  At({ codeLanguages: St }),
1989
2010
  // 横向换行
1990
2011
  re.lineWrapping,
@@ -1999,80 +2020,82 @@ const Ml = (e) => {
1999
2020
  ], u = () => {
2000
2021
  const d = [
2001
2022
  ...f,
2002
- l.value === "light" ? wl : ml,
2003
- Sl(e.completions)
2023
+ l.value === "light" ? Sl : gl,
2024
+ Ml(e.completions)
2004
2025
  ];
2005
- return _.codeMirrorExtensions(l.value, d, [
2026
+ return W.codeMirrorExtensions(l.value, d, [
2006
2027
  ...c
2007
2028
  ]);
2008
2029
  };
2009
- return W(() => {
2030
+ return z(() => {
2010
2031
  const d = new re({
2011
2032
  doc: e.value,
2012
- parent: i.value
2013
- });
2014
- r.value = new Al(d), r.value.setTabSize(o), r.value.setExtensions(u()), r.value.setDisabled(e.disabled), r.value.setReadOnly(e.readonly), e.placeholder && r.value.setPlaceholder(e.placeholder), e.autofocus && d.focus(), e.maxlength && r.value.setMaxLength(e.maxlength), h.on(a, {
2033
+ parent: r.value
2034
+ }), v = new Ll(d);
2035
+ i.value = v, setTimeout(() => {
2036
+ v.setTabSize(o), v.setDisabled(e.disabled), v.setReadOnly(e.readonly), v.setExtensions(u()), e.placeholder && v.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && v.setMaxLength(e.maxlength), e.autofocus && d.focus();
2037
+ }, 0), h.on(a, {
2015
2038
  name: "ctrlZ",
2016
2039
  callback() {
2017
- Dt(d);
2040
+ Ht(d);
2018
2041
  }
2019
2042
  }), h.on(a, {
2020
2043
  name: "ctrlShiftZ",
2021
2044
  callback() {
2022
- Et(d);
2045
+ It(d);
2023
2046
  }
2024
2047
  }), h.on(a, {
2025
2048
  name: "replace",
2026
- callback(p, $ = {}) {
2027
- var g;
2028
- const { text: b, options: v } = el(p, r.value, $);
2029
- (g = r.value) == null || g.replaceSelectedText(b, v);
2049
+ callback(y, b = {}) {
2050
+ var k;
2051
+ const { text: p, options: g } = ll(y, i.value, b);
2052
+ (k = i.value) == null || k.replaceSelectedText(p, g);
2030
2053
  }
2031
2054
  });
2032
- }), I(
2055
+ }), F(
2033
2056
  [l, te(e, "completions")],
2034
2057
  () => {
2035
2058
  var d;
2036
- (d = r.value) == null || d.setExtensions(u());
2059
+ (d = i.value) == null || d.setExtensions(u());
2037
2060
  },
2038
2061
  {
2039
2062
  deep: !0
2040
2063
  }
2041
- ), I(
2064
+ ), F(
2042
2065
  () => e.value,
2043
2066
  () => {
2044
- var d, p;
2045
- ((d = r.value) == null ? void 0 : d.getValue()) !== e.value && ((p = r.value) == null || p.setValue(e.value));
2067
+ var d, v;
2068
+ ((d = i.value) == null ? void 0 : d.getValue()) !== e.value && ((v = i.value) == null || v.setValue(e.value));
2046
2069
  }
2047
- ), I(
2070
+ ), F(
2048
2071
  () => e.placeholder,
2049
2072
  () => {
2050
2073
  var d;
2051
- (d = r.value) == null || d.setPlaceholder(e.placeholder);
2074
+ (d = i.value) == null || d.setPlaceholder(e.placeholder);
2052
2075
  }
2053
- ), I(
2076
+ ), F(
2054
2077
  () => e.disabled,
2055
2078
  () => {
2056
2079
  var d;
2057
- (d = r.value) == null || d.setDisabled(e.disabled);
2080
+ (d = i.value) == null || d.setDisabled(e.disabled);
2058
2081
  }
2059
- ), I(
2082
+ ), F(
2060
2083
  () => e.readonly,
2061
2084
  () => {
2062
2085
  var d;
2063
- (d = r.value) == null || d.setDisabled(e.readonly);
2086
+ (d = i.value) == null || d.setDisabled(e.readonly);
2064
2087
  }
2065
- ), I(
2088
+ ), F(
2066
2089
  () => e.maxlength,
2067
2090
  () => {
2068
2091
  var d;
2069
- e.maxlength && ((d = r.value) == null || d.setMaxLength(e.maxlength));
2092
+ e.maxlength && ((d = i.value) == null || d.setMaxLength(e.maxlength));
2070
2093
  }
2071
- ), El(r), {
2072
- inputWrapperRef: i,
2073
- codeMirrorUt: r
2094
+ ), Il(i), {
2095
+ inputWrapperRef: r,
2096
+ codeMirrorUt: i
2074
2097
  };
2075
- }, Il = Fl, Ol = {
2098
+ }, Vl = Ol, Rl = {
2076
2099
  value: {
2077
2100
  type: String,
2078
2101
  default: ""
@@ -2165,15 +2188,15 @@ const Ml = (e) => {
2165
2188
  completions: {
2166
2189
  type: Array
2167
2190
  }
2168
- }, Vl = /* @__PURE__ */ O({
2191
+ }, Pl = /* @__PURE__ */ O({
2169
2192
  name: "MDEditorContent",
2170
- props: Ol,
2193
+ props: Rl,
2171
2194
  setup(e) {
2172
- const o = U(""), {
2195
+ const o = G(""), {
2173
2196
  inputWrapperRef: a,
2174
2197
  codeMirrorUt: l
2175
- } = Il(e);
2176
- return Qt(e, o, l), () => t("div", {
2198
+ } = Vl(e);
2199
+ return tl(e, o, l), () => t("div", {
2177
2200
  class: `${n}-content`
2178
2201
  }, [t("div", {
2179
2202
  class: `${n}-input-wrapper`,
@@ -2181,8 +2204,8 @@ const Ml = (e) => {
2181
2204
  }, null), t(ut, {
2182
2205
  modelValue: e.value,
2183
2206
  setting: e.setting,
2184
- onHtmlChanged: (i) => {
2185
- o.value = i, e.onHtmlChanged(i);
2207
+ onHtmlChanged: (r) => {
2208
+ o.value = r, e.onHtmlChanged(r);
2186
2209
  },
2187
2210
  onGetCatalog: e.onGetCatalog,
2188
2211
  mdHeadingId: e.mdHeadingId,
@@ -2193,7 +2216,7 @@ const Ml = (e) => {
2193
2216
  noHighlight: e.noHighlight
2194
2217
  }, null)]);
2195
2218
  }
2196
- }), Rl = /* @__PURE__ */ O({
2219
+ }), Nl = /* @__PURE__ */ O({
2197
2220
  props: {
2198
2221
  modelValue: {
2199
2222
  type: String,
@@ -2211,7 +2234,7 @@ const Ml = (e) => {
2211
2234
  }, [`${(a = o.value.footer) == null ? void 0 : a.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
2212
2235
  };
2213
2236
  }
2214
- }), Nl = {
2237
+ }), ql = {
2215
2238
  checked: {
2216
2239
  type: Boolean,
2217
2240
  default: !1
@@ -2221,8 +2244,8 @@ const Ml = (e) => {
2221
2244
  default: () => {
2222
2245
  }
2223
2246
  }
2224
- }, Pl = /* @__PURE__ */ O({
2225
- props: Nl,
2247
+ }, Ul = /* @__PURE__ */ O({
2248
+ props: ql,
2226
2249
  setup(e) {
2227
2250
  return () => t("div", {
2228
2251
  class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
@@ -2231,7 +2254,7 @@ const Ml = (e) => {
2231
2254
  }
2232
2255
  }, null);
2233
2256
  }
2234
- }), ql = {
2257
+ }), Gl = {
2235
2258
  scrollAuto: {
2236
2259
  type: Boolean
2237
2260
  },
@@ -2240,8 +2263,8 @@ const Ml = (e) => {
2240
2263
  default: () => {
2241
2264
  }
2242
2265
  }
2243
- }, Ul = /* @__PURE__ */ O({
2244
- props: ql,
2266
+ }, Kl = /* @__PURE__ */ O({
2267
+ props: Gl,
2245
2268
  setup(e) {
2246
2269
  const o = A("usedLanguageText");
2247
2270
  return () => {
@@ -2253,13 +2276,13 @@ const Ml = (e) => {
2253
2276
  onClick: () => {
2254
2277
  e.onScrollAutoChange(!e.scrollAuto);
2255
2278
  }
2256
- }, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Pl, {
2279
+ }, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Ul, {
2257
2280
  checked: e.scrollAuto,
2258
2281
  onChange: e.onScrollAutoChange
2259
2282
  }, null)]);
2260
2283
  };
2261
2284
  }
2262
- }), Gl = {
2285
+ }), jl = {
2263
2286
  modelValue: {
2264
2287
  type: String,
2265
2288
  default: ""
@@ -2279,22 +2302,22 @@ const Ml = (e) => {
2279
2302
  defFooters: {
2280
2303
  type: Object
2281
2304
  }
2282
- }, Kl = /* @__PURE__ */ O({
2305
+ }, _l = /* @__PURE__ */ O({
2283
2306
  name: "MDEditorFooter",
2284
- props: Gl,
2307
+ props: jl,
2285
2308
  setup(e) {
2286
2309
  const o = fe(() => {
2287
- const l = e.footers.indexOf("="), i = l === -1 ? e.footers : e.footers.slice(0, l), r = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
2288
- return [i, r];
2310
+ const l = e.footers.indexOf("="), r = l === -1 ? e.footers : e.footers.slice(0, l), i = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
2311
+ return [r, i];
2289
2312
  }), a = (l) => {
2290
2313
  if (lt.includes(l))
2291
2314
  switch (l) {
2292
2315
  case "markdownTotal":
2293
- return t(Rl, {
2316
+ return t(Nl, {
2294
2317
  modelValue: e.modelValue
2295
2318
  }, null);
2296
2319
  case "scrollSwitch":
2297
- return t(Ul, {
2320
+ return t(Kl, {
2298
2321
  scrollAuto: e.scrollAuto,
2299
2322
  onScrollAutoChange: e.onScrollAutoChange
2300
2323
  }, null);
@@ -2303,17 +2326,17 @@ const Ml = (e) => {
2303
2326
  return e.defFooters instanceof Array ? e.defFooters[l] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[l] || "";
2304
2327
  };
2305
2328
  return () => {
2306
- const l = o.value[0].map((r) => a(r)), i = o.value[1].map((r) => a(r));
2329
+ const l = o.value[0].map((i) => a(i)), r = o.value[1].map((i) => a(i));
2307
2330
  return t("div", {
2308
2331
  class: `${n}-footer`
2309
2332
  }, [t("div", {
2310
2333
  class: `${n}-footer-left`
2311
2334
  }, [l]), t("div", {
2312
2335
  class: `${n}-footer-right`
2313
- }, [i])]);
2336
+ }, [r])]);
2314
2337
  };
2315
2338
  }
2316
- }), jl = /* @__PURE__ */ O({
2339
+ }), Wl = /* @__PURE__ */ O({
2317
2340
  name: "MdEditorV3",
2318
2341
  props: mt,
2319
2342
  emits: ft,
@@ -2321,20 +2344,20 @@ const Ml = (e) => {
2321
2344
  const {
2322
2345
  editorId: a,
2323
2346
  noKatex: l,
2324
- noMermaid: i,
2325
- noPrettier: r,
2347
+ noMermaid: r,
2348
+ noPrettier: i,
2326
2349
  noUploadImg: c,
2327
2350
  noHighlight: m
2328
2351
  } = e, f = Z({
2329
2352
  scrollAuto: e.scrollAuto
2330
2353
  });
2331
2354
  gt(e, o), ht(e), bt(e);
2332
- const [u, d] = vt(e, o), p = pt(e);
2355
+ const [u, d] = vt(e, o), v = pt(e);
2333
2356
  return Qe(() => {
2334
2357
  h.clear(a);
2335
- }), kt(e, o, p, u, d), () => {
2336
- var v;
2337
- const $ = He({
2358
+ }), kt(e, o, v, u, d), () => {
2359
+ var p;
2360
+ const y = He({
2338
2361
  props: e,
2339
2362
  ctx: o
2340
2363
  }, "defToolbars"), b = He({
@@ -2345,21 +2368,21 @@ const Ml = (e) => {
2345
2368
  id: a,
2346
2369
  class: [n, e.class, e.theme === "dark" && `${n}-dark`, u.fullscreen || u.pageFullscreen ? `${n}-fullscreen` : ""],
2347
2370
  style: e.style
2348
- }, [t(Yt, {
2349
- noPrettier: r,
2371
+ }, [t(Jt, {
2372
+ noPrettier: i,
2350
2373
  toolbars: e.toolbars,
2351
2374
  toolbarsExclude: e.toolbarsExclude,
2352
2375
  setting: u,
2353
2376
  updateSetting: d,
2354
2377
  tableShape: e.tableShape,
2355
- defToolbars: $,
2378
+ defToolbars: y,
2356
2379
  noUploadImg: c
2357
- }, null), t(Vl, {
2380
+ }, null), t(Pl, {
2358
2381
  value: e.modelValue,
2359
2382
  setting: u,
2360
2383
  mdHeadingId: e.mdHeadingId,
2361
- noMermaid: i,
2362
- noPrettier: r,
2384
+ noMermaid: r,
2385
+ noPrettier: i,
2363
2386
  sanitize: e.sanitize,
2364
2387
  placeholder: e.placeholder,
2365
2388
  noKatex: l,
@@ -2387,13 +2410,13 @@ const Ml = (e) => {
2387
2410
  e.onFocus ? e.onFocus(g) : o.emit("onFocus", g);
2388
2411
  },
2389
2412
  completions: e.completions
2390
- }, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(Kl, {
2413
+ }, null), ((p = e.footers) == null ? void 0 : p.length) > 0 && t(_l, {
2391
2414
  modelValue: e.modelValue,
2392
2415
  footers: e.footers,
2393
2416
  defFooters: b,
2394
2417
  scrollAuto: f.scrollAuto,
2395
2418
  onScrollAutoChange: (g) => f.scrollAuto = g
2396
- }, null), p.value && t(Ye, {
2419
+ }, null), v.value && t(Ye, {
2397
2420
  theme: e.theme,
2398
2421
  class: `${n}-catalog-editor`,
2399
2422
  editorId: a,
@@ -2402,8 +2425,8 @@ const Ml = (e) => {
2402
2425
  }, null)]);
2403
2426
  };
2404
2427
  }
2405
- }), ue = jl;
2406
- ue.install = (e) => (e.component(ue.name, ue), e.use(Ot).use(ot).use(yt).use(Ye).use(Ct), e);
2428
+ }), ue = Wl;
2429
+ ue.install = (e) => (e.component(ue.name, ue), e.use(Rt).use(ot).use(yt).use(Ye).use(Ct), e);
2407
2430
  export {
2408
2431
  ue as default
2409
2432
  };