@mario9/tiptap-editor 0.1.6 → 0.2.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,21 +1,21 @@
1
- import { defineComponent as c, computed as V, ref as H, createVNode as e, createTextVNode as m, mergeProps as k, inject as B, watch as D, nextTick as P, watchEffect as G, Fragment as de, provide as z } from "vue";
1
+ import { defineComponent as p, computed as F, ref as y, createVNode as e, createTextVNode as g, mergeProps as b, inject as A, watch as D, nextTick as O, watchEffect as K, Fragment as de, provide as P } from "vue";
2
2
  import pe from "@tiptap/starter-kit";
3
3
  import { nodeViewProps as Ce, NodeViewWrapper as ve, VueNodeViewRenderer as fe, useEditor as he, EditorContent as ge } from "@tiptap/vue-3";
4
4
  import { TaskList as me, TaskItem as we } from "@tiptap/extension-list";
5
5
  import { TextAlign as be } from "@tiptap/extension-text-align";
6
6
  import { Placeholder as ke } from "@tiptap/extension-placeholder";
7
7
  import { CodeBlockLowlight as xe } from "@tiptap/extension-code-block-lowlight";
8
- import { createLowlight as He, common as Be } from "lowlight";
8
+ import { createLowlight as He, common as ye } from "lowlight";
9
9
  import { Image as Ae } from "@tiptap/extension-image";
10
- import { Plugin as ye, NodeSelection as Me } from "@tiptap/pm/state";
11
- import { Decoration as Ie, DecorationSet as Le } from "@tiptap/pm/view";
12
- import { TableRow as Ee, TableHeader as Fe, TableCell as Ve, Table as Te } from "@tiptap/extension-table";
10
+ import { Plugin as Be, NodeSelection as Me } from "@tiptap/pm/state";
11
+ import { Decoration as Le, DecorationSet as Ie } from "@tiptap/pm/view";
12
+ import { TableRow as Ee, TableHeader as Fe, TableCell as Te, Table as Ve } from "@tiptap/extension-table";
13
13
  import { Mathematics as Ze } from "@tiptap/extension-mathematics";
14
14
  import { Node as Re, mergeAttributes as De } from "@tiptap/core";
15
15
  import { ElTooltip as R, ElButton as Z, ElPopover as J, ElInput as X, ElDropdown as j, ElDropdownMenu as W, ElDropdownItem as E, ElDialog as Se, ElRadioGroup as Ue, ElRadioButton as q } from "element-plus";
16
16
  import _e from "katex";
17
- import { BubbleMenu as Pe } from "@tiptap/vue-3/menus";
18
- const ze = Ae.extend({
17
+ import { BubbleMenu as Oe } from "@tiptap/vue-3/menus";
18
+ const Pe = Ae.extend({
19
19
  addAttributes() {
20
20
  return {
21
21
  ...this.parent?.(),
@@ -29,32 +29,32 @@ const ze = Ae.extend({
29
29
  addProseMirrorPlugins() {
30
30
  const t = this.name;
31
31
  return [
32
- new ye({
32
+ new Be({
33
33
  props: {
34
34
  decorations(l) {
35
35
  const n = [];
36
36
  return l.doc.descendants((o, u) => {
37
37
  o.type.name === t && o.attrs.align && n.push(
38
- Ie.node(u, u + o.nodeSize, {
38
+ Le.node(u, u + o.nodeSize, {
39
39
  "data-align": o.attrs.align
40
40
  })
41
41
  );
42
- }), Le.create(l.doc, n);
42
+ }), Ie.create(l.doc, n);
43
43
  }
44
44
  }
45
45
  })
46
46
  ];
47
47
  }
48
- }), Oe = /* @__PURE__ */ c({
48
+ }), $e = /* @__PURE__ */ p({
49
49
  name: "ImageUploadView",
50
50
  props: Ce,
51
51
  setup(t) {
52
- const l = V(() => t.node.attrs.accept), n = V(() => t.node.attrs.limit), o = V(() => t.node.attrs.maxSize), u = H([]), s = H(), f = H(!1), g = async (a) => {
52
+ const l = F(() => t.node.attrs.accept), n = F(() => t.node.attrs.limit), o = F(() => t.node.attrs.maxSize), u = y([]), d = y(), f = y(!1), m = async (a) => {
53
53
  if (o.value > 0 && a.size > o.value)
54
54
  return t.extension.options.onError?.(new Error(`文件大小超出限制 ${o.value / 1024 / 1024}MB`)), null;
55
- const d = crypto.randomUUID();
55
+ const C = crypto.randomUUID();
56
56
  u.value.push({
57
- id: d,
57
+ id: C,
58
58
  file: a,
59
59
  progress: 0,
60
60
  status: "uploading"
@@ -64,26 +64,26 @@ const ze = Ae.extend({
64
64
  if (!v) throw new Error("未配置 upload 函数");
65
65
  const h = await v(a);
66
66
  if (!h) throw new Error("上传失败:未返回 URL");
67
- const A = u.value.find((T) => T.id === d);
68
- return A && (A.status = "success", A.progress = 100), t.extension.options.onSuccess?.(h), h;
67
+ const B = u.value.find((V) => V.id === C);
68
+ return B && (B.status = "success", B.progress = 100), t.extension.options.onSuccess?.(h), h;
69
69
  } catch (v) {
70
- const h = u.value.find((A) => A.id === d);
70
+ const h = u.value.find((B) => B.id === C);
71
71
  return h && (h.status = "error", h.progress = 0), t.extension.options.onError?.(v instanceof Error ? v : new Error("上传失败")), null;
72
72
  }
73
- }, r = async (a) => {
73
+ }, c = async (a) => {
74
74
  if (!a.length) return;
75
75
  if (a.length > n.value) {
76
76
  t.extension.options.onError?.(new Error(`最多上传 ${n.value} 个文件`));
77
77
  return;
78
78
  }
79
- const d = (await Promise.all(a.map(g))).filter((v) => !!v);
80
- if (d.length > 0) {
79
+ const C = (await Promise.all(a.map(m))).filter((v) => !!v);
80
+ if (C.length > 0) {
81
81
  const v = t.getPos();
82
82
  if (typeof v != "number") return;
83
- const h = d.map((A) => ({
83
+ const h = C.map((B) => ({
84
84
  type: "image",
85
85
  attrs: {
86
- src: A
86
+ src: B
87
87
  }
88
88
  }));
89
89
  t.editor.chain().focus().deleteRange({
@@ -91,27 +91,27 @@ const ze = Ae.extend({
91
91
  to: v + t.node.nodeSize
92
92
  }).insertContentAt(v, h).run();
93
93
  }
94
- }, C = () => {
95
- u.value.length === 0 && s.value && (s.value.value = "", s.value.click());
94
+ }, H = () => {
95
+ u.value.length === 0 && d.value && (d.value.value = "", d.value.click());
96
96
  }, i = (a) => {
97
- const d = a.target.files;
98
- d && r(Array.from(d));
99
- }, p = (a) => {
97
+ const C = a.target.files;
98
+ C && c(Array.from(C));
99
+ }, s = (a) => {
100
100
  a.preventDefault(), f.value = !0;
101
- }, w = (a) => {
101
+ }, r = (a) => {
102
102
  a.currentTarget.contains(a.relatedTarget) || (f.value = !1);
103
- }, I = (a) => {
104
- a.preventDefault(), f.value = !1;
105
- const d = Array.from(a.dataTransfer?.files ?? []);
106
- d.length && r(d);
107
103
  }, x = (a) => {
108
- u.value = u.value.filter((d) => d.id !== a);
104
+ a.preventDefault(), f.value = !1;
105
+ const C = Array.from(a.dataTransfer?.files ?? []);
106
+ C.length && c(C);
107
+ }, k = (a) => {
108
+ u.value = u.value.filter((C) => C.id !== a);
109
109
  };
110
110
  return () => e(ve, {
111
111
  class: "tiptap-image-upload"
112
112
  }, {
113
113
  default: () => [e("div", {
114
- onClick: C
114
+ onClick: H
115
115
  }, [u.value.length ? e("div", {
116
116
  class: "tiptap-image-upload-previews"
117
117
  }, [u.value.map((a) => e("div", {
@@ -130,24 +130,24 @@ const ze = Ae.extend({
130
130
  class: "tiptap-image-upload-subtext"
131
131
  }, [a.status === "uploading" ? `${a.progress}%` : a.status === "error" ? "上传失败" : "上传成功"]), e("button", {
132
132
  class: "tiptap-image-upload-remove",
133
- onClick: (d) => {
134
- d.stopPropagation(), x(a.id);
133
+ onClick: (C) => {
134
+ C.stopPropagation(), k(a.id);
135
135
  }
136
- }, [m("×")])])]))]) : e("div", {
136
+ }, [g("×")])])]))]) : e("div", {
137
137
  class: ["tiptap-image-upload-drag-area", {
138
138
  "drag-active": f.value
139
139
  }],
140
- onDragover: p,
141
- onDragleave: w,
142
- onDrop: I
140
+ onDragover: s,
141
+ onDragleave: r,
142
+ onDrop: x
143
143
  }, [e("div", {
144
144
  class: "tiptap-image-upload-content"
145
145
  }, [e("span", {
146
146
  class: "tiptap-image-upload-text"
147
- }, [e("em", null, [m("点击上传")]), m(" 或拖拽图片到此处")]), e("span", {
147
+ }, [e("em", null, [g("点击上传")]), g(" 或拖拽图片到此处")]), e("span", {
148
148
  class: "tiptap-image-upload-subtext"
149
- }, [m("最多 "), n.value, m(" 个文件"), o.value ? `,每个不超过 ${o.value / 1024 / 1024}MB` : ""])])]), e("input", {
150
- ref: s,
149
+ }, [g("最多 "), n.value, g(" 个文件"), o.value ? `,每个不超过 ${o.value / 1024 / 1024}MB` : ""])])]), e("input", {
150
+ ref: d,
151
151
  type: "file",
152
152
  accept: l.value,
153
153
  multiple: n.value > 1,
@@ -156,7 +156,7 @@ const ze = Ae.extend({
156
156
  }, null)])]
157
157
  });
158
158
  }
159
- }), $e = Re.create({
159
+ }), ze = Re.create({
160
160
  name: "imageUpload",
161
161
  group: "block",
162
162
  draggable: !0,
@@ -203,7 +203,7 @@ const ze = Ae.extend({
203
203
  }, t)];
204
204
  },
205
205
  addNodeView() {
206
- return fe(Oe);
206
+ return fe($e);
207
207
  },
208
208
  addCommands() {
209
209
  return {
@@ -236,7 +236,20 @@ const ze = Ae.extend({
236
236
  }
237
237
  };
238
238
  }
239
- }), Ne = {
239
+ }), Ne = [
240
+ "undo-redo",
241
+ "|",
242
+ "text-style",
243
+ "code-block",
244
+ "|",
245
+ "list",
246
+ "|",
247
+ "text-align",
248
+ "|",
249
+ "image",
250
+ "table",
251
+ "math"
252
+ ], je = {
240
253
  icon: {
241
254
  type: Object,
242
255
  required: !0
@@ -255,9 +268,9 @@ const ze = Ae.extend({
255
268
  onClick: {
256
269
  type: Function
257
270
  }
258
- }, b = /* @__PURE__ */ c({
271
+ }, w = /* @__PURE__ */ p({
259
272
  name: "IconButton",
260
- props: Ne,
273
+ props: je,
261
274
  setup(t) {
262
275
  return () => e(R, {
263
276
  showArrow: !1,
@@ -275,12 +288,12 @@ const ze = Ae.extend({
275
288
  }, null)]
276
289
  });
277
290
  }
278
- }), je = /* @__PURE__ */ c({
291
+ }), We = /* @__PURE__ */ p({
279
292
  name: "UndoIcon",
280
293
  setup(t, {
281
294
  attrs: l
282
295
  }) {
283
- return () => e("svg", k({
296
+ return () => e("svg", b({
284
297
  width: "24",
285
298
  height: "24",
286
299
  viewBox: "0 0 24 24",
@@ -293,12 +306,12 @@ const ze = Ae.extend({
293
306
  fill: "currentColor"
294
307
  }, null)]);
295
308
  }
296
- }), We = /* @__PURE__ */ c({
309
+ }), qe = /* @__PURE__ */ p({
297
310
  name: "RedoIcon",
298
311
  setup(t, {
299
312
  attrs: l
300
313
  }) {
301
- return () => e("svg", k({
314
+ return () => e("svg", b({
302
315
  width: "24",
303
316
  height: "24",
304
317
  viewBox: "0 0 24 24",
@@ -311,28 +324,28 @@ const ze = Ae.extend({
311
324
  fill: "currentColor"
312
325
  }, null)]);
313
326
  }
314
- }), qe = /* @__PURE__ */ c({
327
+ }), Ge = /* @__PURE__ */ p({
315
328
  name: "UndoRedoButton",
316
329
  setup() {
317
- const t = B("editor"), l = V(() => t?.value?.can().undo() ?? !1), n = V(() => t?.value?.can().redo() ?? !1);
318
- return () => e("div", null, [e(b, {
319
- icon: je,
330
+ const t = A("editor"), l = F(() => t?.value?.can().undo() ?? !1), n = F(() => t?.value?.can().redo() ?? !1);
331
+ return () => e("div", null, [e(w, {
332
+ icon: We,
320
333
  tooltip: "撤销",
321
334
  disabled: !l.value,
322
335
  onClick: () => t?.value?.chain().focus().undo().run()
323
- }, null), e(b, {
324
- icon: We,
336
+ }, null), e(w, {
337
+ icon: qe,
325
338
  tooltip: "重做",
326
339
  disabled: !n.value,
327
340
  onClick: () => t?.value?.chain().focus().redo().run()
328
341
  }, null)]);
329
342
  }
330
- }), Ke = /* @__PURE__ */ c({
343
+ }), Ke = /* @__PURE__ */ p({
331
344
  name: "LinkIcon",
332
345
  setup(t, {
333
346
  attrs: l
334
347
  }) {
335
- return () => e("svg", k({
348
+ return () => e("svg", b({
336
349
  width: "24",
337
350
  height: "24",
338
351
  viewBox: "0 0 24 24",
@@ -346,12 +359,12 @@ const ze = Ae.extend({
346
359
  fill: "currentColor"
347
360
  }, null)]);
348
361
  }
349
- }), Ge = /* @__PURE__ */ c({
362
+ }), Je = /* @__PURE__ */ p({
350
363
  name: "CornerDownLeftIcon",
351
364
  setup(t, {
352
365
  attrs: l
353
366
  }) {
354
- return () => e("svg", k({
367
+ return () => e("svg", b({
355
368
  width: "24",
356
369
  height: "24",
357
370
  viewBox: "0 0 24 24",
@@ -367,12 +380,12 @@ const ze = Ae.extend({
367
380
  d: "M20 4v7a4 4 0 0 1-4 4H4"
368
381
  }, null)]);
369
382
  }
370
- }), Je = /* @__PURE__ */ c({
383
+ }), Xe = /* @__PURE__ */ p({
371
384
  name: "ExternalLinkIcon",
372
385
  setup(t, {
373
386
  attrs: l
374
387
  }) {
375
- return () => e("svg", k({
388
+ return () => e("svg", b({
376
389
  width: "24",
377
390
  height: "24",
378
391
  viewBox: "0 0 24 24",
@@ -393,12 +406,12 @@ const ze = Ae.extend({
393
406
  y2: "3"
394
407
  }, null)]);
395
408
  }
396
- }), Xe = /* @__PURE__ */ c({
409
+ }), Qe = /* @__PURE__ */ p({
397
410
  name: "TrashIcon",
398
411
  setup(t, {
399
412
  attrs: l
400
413
  }) {
401
- return () => e("svg", k({
414
+ return () => e("svg", b({
402
415
  width: "24",
403
416
  height: "24",
404
417
  viewBox: "0 0 24 24",
@@ -414,13 +427,13 @@ const ze = Ae.extend({
414
427
  d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
415
428
  }, null)]);
416
429
  }
417
- }), Qe = /* @__PURE__ */ c({
430
+ }), Ye = /* @__PURE__ */ p({
418
431
  name: "LinkPopover",
419
432
  setup() {
420
- const t = B("editor"), l = H(!1), n = H("");
433
+ const t = A("editor"), l = y(!1), n = y("");
421
434
  let o = !1;
422
435
  D(() => t?.value?.isActive("link"), (i) => {
423
- o || i && (n.value = t?.value?.getAttributes("link").href ?? "", P(() => {
436
+ o || i && (n.value = t?.value?.getAttributes("link").href ?? "", O(() => {
424
437
  l.value = !0;
425
438
  }));
426
439
  });
@@ -429,37 +442,37 @@ const ze = Ae.extend({
429
442
  if (!i || !n.value) return;
430
443
  o = !0;
431
444
  const {
432
- empty: p
445
+ empty: s
433
446
  } = i.state.selection;
434
- let w = i.chain().focus().extendMarkRange("link").setLink({
447
+ let r = i.chain().focus().extendMarkRange("link").setLink({
435
448
  href: n.value
436
449
  });
437
- p && (w = w.insertContent({
450
+ s && (r = r.insertContent({
438
451
  type: "text",
439
452
  text: n.value
440
- })), w.run(), l.value = !1, P(() => {
453
+ })), r.run(), l.value = !1, O(() => {
441
454
  o = !1;
442
455
  });
443
- }, s = () => {
456
+ }, d = () => {
444
457
  const i = t?.value;
445
- i && (o = !0, i.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", l.value = !1, P(() => {
458
+ i && (o = !0, i.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", l.value = !1, O(() => {
446
459
  o = !1;
447
460
  }));
448
461
  }, f = () => {
449
462
  const i = t?.value?.getAttributes("link").href;
450
463
  i && window.open(i, "_blank", "noopener,noreferrer");
451
- }, g = (i) => {
464
+ }, m = (i) => {
452
465
  i.key === "Enter" && (i.preventDefault(), u());
453
- }, r = (i) => {
466
+ }, c = (i) => {
454
467
  i && (n.value = t?.value?.getAttributes("link").href ?? ""), l.value = i;
455
- }, C = (i) => {
468
+ }, H = (i) => {
456
469
  n.value = i;
457
470
  };
458
471
  return () => {
459
472
  const i = t?.value?.isActive("link") ?? !1;
460
473
  return e(J, {
461
474
  visible: l.value,
462
- "onUpdate:visible": r,
475
+ "onUpdate:visible": c,
463
476
  placement: "bottom",
464
477
  width: 300,
465
478
  trigger: "click",
@@ -467,7 +480,7 @@ const ze = Ae.extend({
467
480
  popperClass: "link-popover-popper",
468
481
  offset: 6
469
482
  }, {
470
- reference: () => e("span", null, [e(b, {
483
+ reference: () => e("span", null, [e(w, {
471
484
  tooltip: "链接",
472
485
  icon: Ke,
473
486
  class: ["tiptap-button", {
@@ -478,12 +491,12 @@ const ze = Ae.extend({
478
491
  class: "link-popover-inner"
479
492
  }, [e(X, {
480
493
  modelValue: n.value,
481
- "onUpdate:modelValue": C,
494
+ "onUpdate:modelValue": H,
482
495
  type: "url",
483
496
  placeholder: "请输入链接...",
484
497
  size: "small",
485
498
  autofocus: !0,
486
- onKeydown: g
499
+ onKeydown: m
487
500
  }, null), e("div", {
488
501
  class: "link-popover-actions"
489
502
  }, [e(R, {
@@ -493,7 +506,7 @@ const ze = Ae.extend({
493
506
  }, {
494
507
  default: () => [e(Z, {
495
508
  text: !0,
496
- icon: Ge,
509
+ icon: Je,
497
510
  disabled: !n.value,
498
511
  onClick: u
499
512
  }, null)]
@@ -504,7 +517,7 @@ const ze = Ae.extend({
504
517
  }, {
505
518
  default: () => [e(Z, {
506
519
  text: !0,
507
- icon: Je,
520
+ icon: Xe,
508
521
  disabled: !n.value && !i,
509
522
  onClick: f
510
523
  }, null)]
@@ -515,20 +528,20 @@ const ze = Ae.extend({
515
528
  }, {
516
529
  default: () => [e(Z, {
517
530
  text: !0,
518
- icon: Xe,
531
+ icon: Qe,
519
532
  disabled: !i,
520
- onClick: s
533
+ onClick: d
521
534
  }, null)]
522
535
  })])])
523
536
  });
524
537
  };
525
538
  }
526
- }), Q = /* @__PURE__ */ c({
539
+ }), Q = /* @__PURE__ */ p({
527
540
  name: "BoldIcon",
528
541
  setup(t, {
529
542
  attrs: l
530
543
  }) {
531
- return () => e("svg", k({
544
+ return () => e("svg", b({
532
545
  width: "24",
533
546
  height: "24",
534
547
  viewBox: "0 0 24 24",
@@ -541,12 +554,12 @@ const ze = Ae.extend({
541
554
  fill: "currentColor"
542
555
  }, null)]);
543
556
  }
544
- }), Y = /* @__PURE__ */ c({
557
+ }), Y = /* @__PURE__ */ p({
545
558
  name: "ItalicIcon",
546
559
  setup(t, {
547
560
  attrs: l
548
561
  }) {
549
- return () => e("svg", k({
562
+ return () => e("svg", b({
550
563
  width: "24",
551
564
  height: "24",
552
565
  viewBox: "0 0 24 24",
@@ -557,12 +570,12 @@ const ze = Ae.extend({
557
570
  fill: "currentColor"
558
571
  }, null)]);
559
572
  }
560
- }), ee = /* @__PURE__ */ c({
573
+ }), ee = /* @__PURE__ */ p({
561
574
  name: "StrikeIcon",
562
575
  setup(t, {
563
576
  attrs: l
564
577
  }) {
565
- return () => e("svg", k({
578
+ return () => e("svg", b({
566
579
  width: "24",
567
580
  height: "24",
568
581
  viewBox: "0 0 24 24",
@@ -576,12 +589,12 @@ const ze = Ae.extend({
576
589
  fill: "currentColor"
577
590
  }, null)]);
578
591
  }
579
- }), te = /* @__PURE__ */ c({
592
+ }), te = /* @__PURE__ */ p({
580
593
  name: "UnderlineIcon",
581
594
  setup(t, {
582
595
  attrs: l
583
596
  }) {
584
- return () => e("svg", k({
597
+ return () => e("svg", b({
585
598
  width: "24",
586
599
  height: "24",
587
600
  viewBox: "0 0 24 24",
@@ -594,38 +607,38 @@ const ze = Ae.extend({
594
607
  fill: "currentColor"
595
608
  }, null)]);
596
609
  }
597
- }), Ye = /* @__PURE__ */ c({
610
+ }), e1 = /* @__PURE__ */ p({
598
611
  name: "TextStyleButton",
599
612
  setup() {
600
- const t = B("editor");
601
- return () => e("div", null, [e(b, {
613
+ const t = A("editor");
614
+ return () => e("div", null, [e(w, {
602
615
  icon: Q,
603
616
  tooltip: "粗体",
604
617
  isActive: t?.value?.isActive("bold"),
605
618
  onClick: () => t?.value?.chain().focus().toggleBold().run()
606
- }, null), e(b, {
619
+ }, null), e(w, {
607
620
  icon: Y,
608
621
  tooltip: "斜体",
609
622
  isActive: t?.value?.isActive("italic"),
610
623
  onClick: () => t?.value?.chain().focus().toggleItalic().run()
611
- }, null), e(b, {
624
+ }, null), e(w, {
612
625
  icon: ee,
613
626
  tooltip: "删除线",
614
627
  isActive: t?.value?.isActive("strike"),
615
628
  onClick: () => t?.value?.chain().focus().toggleStrike().run()
616
- }, null), e(b, {
629
+ }, null), e(w, {
617
630
  icon: te,
618
631
  tooltip: "下划线",
619
632
  isActive: t?.value?.isActive("underline"),
620
633
  onClick: () => t?.value?.chain().focus().toggleUnderline().run()
621
- }, null), e(Qe, null, null)]);
634
+ }, null), e(Ye, null, null)]);
622
635
  }
623
- }), le = /* @__PURE__ */ c({
636
+ }), le = /* @__PURE__ */ p({
624
637
  name: "AlignLeftIcon",
625
638
  setup(t, {
626
639
  attrs: l
627
640
  }) {
628
- return () => e("svg", k({
641
+ return () => e("svg", b({
629
642
  width: "24",
630
643
  height: "24",
631
644
  viewBox: "0 0 24 24",
@@ -648,12 +661,12 @@ const ze = Ae.extend({
648
661
  fill: "currentColor"
649
662
  }, null)]);
650
663
  }
651
- }), ne = /* @__PURE__ */ c({
664
+ }), ne = /* @__PURE__ */ p({
652
665
  name: "AlignCenterIcon",
653
666
  setup(t, {
654
667
  attrs: l
655
668
  }) {
656
- return () => e("svg", k({
669
+ return () => e("svg", b({
657
670
  width: "24",
658
671
  height: "24",
659
672
  viewBox: "0 0 24 24",
@@ -676,12 +689,12 @@ const ze = Ae.extend({
676
689
  fill: "currentColor"
677
690
  }, null)]);
678
691
  }
679
- }), oe = /* @__PURE__ */ c({
692
+ }), oe = /* @__PURE__ */ p({
680
693
  name: "AlignRightIcon",
681
694
  setup(t, {
682
695
  attrs: l
683
696
  }) {
684
- return () => e("svg", k({
697
+ return () => e("svg", b({
685
698
  width: "24",
686
699
  height: "24",
687
700
  viewBox: "0 0 24 24",
@@ -704,12 +717,12 @@ const ze = Ae.extend({
704
717
  fill: "currentColor"
705
718
  }, null)]);
706
719
  }
707
- }), e1 = /* @__PURE__ */ c({
720
+ }), t1 = /* @__PURE__ */ p({
708
721
  name: "AlignJustifyIcon",
709
722
  setup(t, {
710
723
  attrs: l
711
724
  }) {
712
- return () => e("svg", k({
725
+ return () => e("svg", b({
713
726
  width: "24",
714
727
  height: "24",
715
728
  viewBox: "0 0 24 24",
@@ -732,33 +745,33 @@ const ze = Ae.extend({
732
745
  fill: "currentColor"
733
746
  }, null)]);
734
747
  }
735
- }), t1 = /* @__PURE__ */ c({
748
+ }), l1 = /* @__PURE__ */ p({
736
749
  name: "TextAlignButton",
737
750
  setup() {
738
- const t = B("editor");
739
- return () => e("div", null, [e(b, {
751
+ const t = A("editor");
752
+ return () => e("div", null, [e(w, {
740
753
  icon: le,
741
754
  tooltip: "左边对齐",
742
755
  isActive: t?.value?.isActive({
743
756
  textAlign: "left"
744
757
  }),
745
758
  onClick: () => t?.value?.chain().focus().setTextAlign("left").run()
746
- }, null), e(b, {
759
+ }, null), e(w, {
747
760
  icon: ne,
748
761
  tooltip: "中间对齐",
749
762
  isActive: t?.value?.isActive({
750
763
  textAlign: "center"
751
764
  }),
752
765
  onClick: () => t?.value?.chain().focus().setTextAlign("center").run()
753
- }, null), e(b, {
766
+ }, null), e(w, {
754
767
  icon: oe,
755
768
  tooltip: "右边对齐",
756
769
  isActive: t?.value?.isActive({
757
770
  textAlign: "right"
758
771
  }),
759
772
  onClick: () => t?.value?.chain().focus().setTextAlign("right").run()
760
- }, null), e(b, {
761
- icon: e1,
773
+ }, null), e(w, {
774
+ icon: t1,
762
775
  tooltip: "两端对齐",
763
776
  isActive: t?.value?.isActive({
764
777
  textAlign: "justify"
@@ -766,12 +779,12 @@ const ze = Ae.extend({
766
779
  onClick: () => t?.value?.chain().focus().setTextAlign("justify").run()
767
780
  }, null)]);
768
781
  }
769
- }), l1 = /* @__PURE__ */ c({
782
+ }), n1 = /* @__PURE__ */ p({
770
783
  name: "ListIcon",
771
784
  setup(t, {
772
785
  attrs: l
773
786
  }) {
774
- return () => e("svg", k({
787
+ return () => e("svg", b({
775
788
  width: "24",
776
789
  height: "24",
777
790
  viewBox: "0 0 24 24",
@@ -809,12 +822,12 @@ const ze = Ae.extend({
809
822
  fill: "currentColor"
810
823
  }, null)]);
811
824
  }
812
- }), n1 = /* @__PURE__ */ c({
825
+ }), o1 = /* @__PURE__ */ p({
813
826
  name: "ListOrderedIcon",
814
827
  setup(t, {
815
828
  attrs: l
816
829
  }) {
817
- return () => e("svg", k({
830
+ return () => e("svg", b({
818
831
  width: "24",
819
832
  height: "24",
820
833
  viewBox: "0 0 24 24",
@@ -852,12 +865,12 @@ const ze = Ae.extend({
852
865
  fill: "currentColor"
853
866
  }, null)]);
854
867
  }
855
- }), o1 = /* @__PURE__ */ c({
868
+ }), i1 = /* @__PURE__ */ p({
856
869
  name: "ListTodoIcon",
857
870
  setup(t, {
858
871
  attrs: l
859
872
  }) {
860
- return () => e("svg", k({
873
+ return () => e("svg", b({
861
874
  width: "24",
862
875
  height: "24",
863
876
  viewBox: "0 0 24 24",
@@ -890,33 +903,33 @@ const ze = Ae.extend({
890
903
  fill: "currentColor"
891
904
  }, null)]);
892
905
  }
893
- }), i1 = /* @__PURE__ */ c({
906
+ }), u1 = /* @__PURE__ */ p({
894
907
  name: "ListButton",
895
908
  setup() {
896
- const t = B("editor");
897
- return () => e("div", null, [e(b, {
898
- icon: l1,
909
+ const t = A("editor");
910
+ return () => e("div", null, [e(w, {
911
+ icon: n1,
899
912
  tooltip: "无序列表",
900
913
  isActive: t?.value?.isActive("bulletList"),
901
914
  onClick: () => t?.value?.chain().focus().toggleBulletList().run()
902
- }, null), e(b, {
903
- icon: n1,
915
+ }, null), e(w, {
916
+ icon: o1,
904
917
  tooltip: "有序列表",
905
918
  isActive: t?.value?.isActive("orderedList"),
906
919
  onClick: () => t?.value?.chain().focus().toggleOrderedList().run()
907
- }, null), e(b, {
908
- icon: o1,
920
+ }, null), e(w, {
921
+ icon: i1,
909
922
  tooltip: "任务列表",
910
923
  isActive: t?.value?.isActive("taskList"),
911
924
  onClick: () => t?.value?.chain().focus().toggleTaskList().run()
912
925
  }, null)]);
913
926
  }
914
- }), u1 = /* @__PURE__ */ c({
927
+ }), r1 = /* @__PURE__ */ p({
915
928
  name: "ImagePlusIcon",
916
929
  setup(t, {
917
930
  attrs: l
918
931
  }) {
919
- return () => e("svg", k({
932
+ return () => e("svg", b({
920
933
  width: "24",
921
934
  height: "24",
922
935
  viewBox: "0 0 24 24",
@@ -929,22 +942,22 @@ const ze = Ae.extend({
929
942
  fill: "currentColor"
930
943
  }, null)]);
931
944
  }
932
- }), r1 = /* @__PURE__ */ c({
945
+ }), a1 = /* @__PURE__ */ p({
933
946
  name: "ImageButton",
934
947
  setup() {
935
- const t = B("editor");
936
- return () => e("div", null, [e(b, {
937
- icon: u1,
948
+ const t = A("editor");
949
+ return () => e("div", null, [e(w, {
950
+ icon: r1,
938
951
  tooltip: "图片",
939
952
  onClick: () => t?.value?.commands.setImageUploadNode()
940
953
  }, null)]);
941
954
  }
942
- }), a1 = /* @__PURE__ */ c({
955
+ }), s1 = /* @__PURE__ */ p({
943
956
  name: "TableIcon",
944
957
  setup(t, {
945
958
  attrs: l
946
959
  }) {
947
- return () => e("svg", k({
960
+ return () => e("svg", b({
948
961
  width: "24",
949
962
  height: "24",
950
963
  viewBox: "0 0 24 24",
@@ -957,23 +970,23 @@ const ze = Ae.extend({
957
970
  fill: "currentColor"
958
971
  }, null)]);
959
972
  }
960
- }), s1 = 8, c1 = 8, d1 = /* @__PURE__ */ c({
973
+ }), c1 = 8, d1 = 8, p1 = /* @__PURE__ */ p({
961
974
  name: "TableButton",
962
975
  setup() {
963
- const t = B("editor"), l = H(!1), n = H(0), o = H(0), u = (g, r) => {
964
- n.value = g, o.value = r;
965
- }, s = () => {
976
+ const t = A("editor"), l = y(!1), n = y(0), o = y(0), u = (m, c) => {
977
+ n.value = m, o.value = c;
978
+ }, d = () => {
966
979
  n.value = 0, o.value = 0;
967
- }, f = (g, r) => {
980
+ }, f = (m, c) => {
968
981
  t?.value?.chain().focus().insertTable({
969
- rows: r,
970
- cols: g,
982
+ rows: c,
983
+ cols: m,
971
984
  withHeaderRow: !0
972
985
  }).run(), l.value = !1;
973
986
  };
974
987
  return () => e(J, {
975
988
  visible: l.value,
976
- "onUpdate:visible": (g) => l.value = g,
989
+ "onUpdate:visible": (m) => l.value = m,
977
990
  trigger: "click",
978
991
  placement: "bottom-start",
979
992
  popperClass: "table-picker-popper",
@@ -992,7 +1005,7 @@ const ze = Ae.extend({
992
1005
  "is-active": l.value
993
1006
  }]
994
1007
  }, {
995
- default: () => [e(a1, {
1008
+ default: () => [e(s1, {
996
1009
  class: "tiptap-button-icon"
997
1010
  }, null)]
998
1011
  })]
@@ -1001,34 +1014,34 @@ const ze = Ae.extend({
1001
1014
  class: "table-picker"
1002
1015
  }, [e("div", {
1003
1016
  class: "table-picker-grid",
1004
- onMouseleave: s
1017
+ onMouseleave: d
1005
1018
  }, [Array.from({
1006
- length: c1
1007
- }, (g, r) => e("div", {
1008
- key: r,
1019
+ length: d1
1020
+ }, (m, c) => e("div", {
1021
+ key: c,
1009
1022
  class: "table-picker-row"
1010
1023
  }, [Array.from({
1011
- length: s1
1012
- }, (C, i) => e("div", {
1024
+ length: c1
1025
+ }, (H, i) => e("div", {
1013
1026
  key: i,
1014
1027
  class: ["table-picker-cell", {
1015
- "is-active": i < n.value && r < o.value
1028
+ "is-active": i < n.value && c < o.value
1016
1029
  }],
1017
- onMouseenter: () => u(i + 1, r + 1),
1018
- onClick: () => f(i + 1, r + 1)
1030
+ onMouseenter: () => u(i + 1, c + 1),
1031
+ onClick: () => f(i + 1, c + 1)
1019
1032
  }, null))]))]), e("div", {
1020
1033
  class: "table-picker-footer"
1021
1034
  }, [e("div", {
1022
1035
  class: "table-picker-counter"
1023
- }, [e("span", null, [m("列")]), e("span", null, [n.value || 1])]), e("span", {
1036
+ }, [e("span", null, [g("列")]), e("span", null, [n.value || 1])]), e("span", {
1024
1037
  class: "table-picker-x"
1025
- }, [m("x")]), e("div", {
1038
+ }, [g("x")]), e("div", {
1026
1039
  class: "table-picker-counter"
1027
- }, [e("span", null, [m("行")]), e("span", null, [o.value || 1])])])])
1040
+ }, [e("span", null, [g("行")]), e("span", null, [o.value || 1])])])])
1028
1041
  });
1029
1042
  }
1030
1043
  });
1031
- function p1(t) {
1044
+ function C1(t) {
1032
1045
  let l = t.nodeType === Node.TEXT_NODE ? t.parentElement : t;
1033
1046
  for (; l && l instanceof HTMLElement; ) {
1034
1047
  if (l.tagName === "TD" || l.tagName === "TH") return l;
@@ -1036,106 +1049,106 @@ function p1(t) {
1036
1049
  }
1037
1050
  return null;
1038
1051
  }
1039
- function C1(t) {
1052
+ function v1(t) {
1040
1053
  if (!t.isActive("tableCell") && !t.isActive("tableHeader")) return null;
1041
1054
  const {
1042
1055
  node: l
1043
- } = t.view.domAtPos(t.state.selection.from), n = p1(l);
1056
+ } = t.view.domAtPos(t.state.selection.from), n = C1(l);
1044
1057
  if (!n) return null;
1045
- const o = n.parentElement, u = o.parentElement, s = n.closest("table");
1046
- if (!s) return null;
1047
- const f = Array.from(o.children).indexOf(n), g = Array.from(u.children).indexOf(o), r = o.children.length, C = u.children.length, i = n.getBoundingClientRect(), p = s.getBoundingClientRect(), w = t.view.dom.closest(".tiptap-editor").getBoundingClientRect();
1058
+ const o = n.parentElement, u = o.parentElement, d = n.closest("table");
1059
+ if (!d) return null;
1060
+ const f = Array.from(o.children).indexOf(n), m = Array.from(u.children).indexOf(o), c = o.children.length, H = u.children.length, i = n.getBoundingClientRect(), s = d.getBoundingClientRect(), r = t.view.dom.closest(".tiptap-editor").getBoundingClientRect();
1048
1061
  return {
1049
1062
  cell: n,
1050
1063
  colIndex: f,
1051
- rowIndex: g,
1052
- totalCols: r,
1053
- totalRows: C,
1064
+ rowIndex: m,
1065
+ totalCols: c,
1066
+ totalRows: H,
1054
1067
  cellRect: i,
1055
- tableRect: p,
1056
- editorRect: w
1068
+ tableRect: s,
1069
+ editorRect: r
1057
1070
  };
1058
1071
  }
1059
- function K(t) {
1072
+ function G(t) {
1060
1073
  const {
1061
1074
  state: l
1062
1075
  } = t, n = l.selection.from;
1063
1076
  let o = null;
1064
- return l.doc.nodesBetween(0, l.doc.content.size, (u, s) => {
1065
- if (u.type.name === "table" && s <= n && n <= s + u.nodeSize)
1077
+ return l.doc.nodesBetween(0, l.doc.content.size, (u, d) => {
1078
+ if (u.type.name === "table" && d <= n && n <= d + u.nodeSize)
1066
1079
  return o = {
1067
1080
  node: u,
1068
- pos: s
1081
+ pos: d
1069
1082
  }, !1;
1070
1083
  }), o;
1071
1084
  }
1072
- const v1 = /* @__PURE__ */ c({
1085
+ const f1 = /* @__PURE__ */ p({
1073
1086
  name: "TableControls",
1074
1087
  setup() {
1075
- const t = B("editor"), l = B("readonly"), n = H(null), o = H(null);
1088
+ const t = A("editor"), l = A("readonly"), n = y(null), o = y(null);
1076
1089
  function u() {
1077
1090
  const i = t?.value;
1078
1091
  if (o.value && (o.value.classList.remove("tcc-cell-focused"), o.value = null), !i) {
1079
1092
  n.value = null;
1080
1093
  return;
1081
1094
  }
1082
- const p = C1(i);
1083
- n.value = p, p && (p.cell.classList.add("tcc-cell-focused"), o.value = p.cell);
1095
+ const s = v1(i);
1096
+ n.value = s, s && (s.cell.classList.add("tcc-cell-focused"), o.value = s.cell);
1084
1097
  }
1085
- G((i) => {
1086
- const p = t?.value;
1087
- p && (p.on("selectionUpdate", u), p.on("transaction", u), i(() => {
1088
- p.off("selectionUpdate", u), p.off("transaction", u), o.value && (o.value.classList.remove("tcc-cell-focused"), o.value = null);
1098
+ K((i) => {
1099
+ const s = t?.value;
1100
+ s && (s.on("selectionUpdate", u), s.on("transaction", u), i(() => {
1101
+ s.off("selectionUpdate", u), s.off("transaction", u), o.value && (o.value.classList.remove("tcc-cell-focused"), o.value = null);
1089
1102
  }));
1090
1103
  });
1091
- function s(i) {
1092
- const p = t?.value;
1093
- if (!p || !n.value) return;
1104
+ function d(i) {
1105
+ const s = t?.value;
1106
+ if (!s || !n.value) return;
1094
1107
  const {
1095
- colIndex: w,
1096
- totalCols: I
1097
- } = n.value, x = i === "left" ? w - 1 : w + 1;
1098
- if (x < 0 || x >= I) return;
1099
- const a = K(p);
1108
+ colIndex: r,
1109
+ totalCols: x
1110
+ } = n.value, k = i === "left" ? r - 1 : r + 1;
1111
+ if (k < 0 || k >= x) return;
1112
+ const a = G(s);
1100
1113
  if (!a) return;
1101
1114
  const {
1102
- node: d,
1115
+ node: C,
1103
1116
  pos: v
1104
1117
  } = a, h = [];
1105
- d.forEach((L) => {
1106
- if (L.type.name !== "tableRow") {
1107
- h.push(L);
1118
+ C.forEach((I) => {
1119
+ if (I.type.name !== "tableRow") {
1120
+ h.push(I);
1108
1121
  return;
1109
1122
  }
1110
- const y = [];
1111
- L.forEach((U) => y.push(U));
1112
- const S = y[w];
1113
- y[w] = y[x], y[x] = S, h.push(L.type.create(L.attrs, y, L.marks));
1123
+ const M = [];
1124
+ I.forEach((U) => M.push(U));
1125
+ const S = M[r];
1126
+ M[r] = M[k], M[k] = S, h.push(I.type.create(I.attrs, M, I.marks));
1114
1127
  });
1115
- const A = d.type.create(d.attrs, h, d.marks), T = p.state.tr.replaceWith(v, v + d.nodeSize, A);
1116
- p.view.dispatch(T);
1128
+ const B = C.type.create(C.attrs, h, C.marks), V = s.state.tr.replaceWith(v, v + C.nodeSize, B);
1129
+ s.view.dispatch(V);
1117
1130
  }
1118
1131
  function f(i) {
1119
- const p = t?.value;
1120
- if (!p || !n.value) return;
1132
+ const s = t?.value;
1133
+ if (!s || !n.value) return;
1121
1134
  const {
1122
- rowIndex: w,
1123
- totalRows: I
1124
- } = n.value, x = i === "up" ? w - 1 : w + 1;
1125
- if (x < 0 || x >= I) return;
1126
- const a = K(p);
1135
+ rowIndex: r,
1136
+ totalRows: x
1137
+ } = n.value, k = i === "up" ? r - 1 : r + 1;
1138
+ if (k < 0 || k >= x) return;
1139
+ const a = G(s);
1127
1140
  if (!a) return;
1128
1141
  const {
1129
- node: d,
1142
+ node: C,
1130
1143
  pos: v
1131
1144
  } = a, h = [];
1132
- d.forEach((y) => h.push(y));
1133
- const A = h[w];
1134
- h[w] = h[x], h[x] = A;
1135
- const T = d.type.create(d.attrs, h, d.marks), L = p.state.tr.replaceWith(v, v + d.nodeSize, T);
1136
- p.view.dispatch(L);
1145
+ C.forEach((M) => h.push(M));
1146
+ const B = h[r];
1147
+ h[r] = h[k], h[k] = B;
1148
+ const V = C.type.create(C.attrs, h, C.marks), I = s.state.tr.replaceWith(v, v + C.nodeSize, V);
1149
+ s.view.dispatch(I);
1137
1150
  }
1138
- const g = () => e("svg", {
1151
+ const m = () => e("svg", {
1139
1152
  width: "16",
1140
1153
  height: "4",
1141
1154
  viewBox: "0 0 16 4",
@@ -1152,7 +1165,7 @@ const v1 = /* @__PURE__ */ c({
1152
1165
  cx: "14",
1153
1166
  cy: "2",
1154
1167
  r: "1.5"
1155
- }, null)]), r = () => e("svg", {
1168
+ }, null)]), c = () => e("svg", {
1156
1169
  width: "4",
1157
1170
  height: "16",
1158
1171
  viewBox: "0 0 4 16",
@@ -1169,7 +1182,7 @@ const v1 = /* @__PURE__ */ c({
1169
1182
  cx: "2",
1170
1183
  cy: "14",
1171
1184
  r: "1.5"
1172
- }, null)]), C = () => e("svg", {
1185
+ }, null)]), H = () => e("svg", {
1173
1186
  width: "10",
1174
1187
  height: "10",
1175
1188
  viewBox: "0 0 10 10",
@@ -1185,123 +1198,123 @@ const v1 = /* @__PURE__ */ c({
1185
1198
  const i = n.value;
1186
1199
  if (!i) return null;
1187
1200
  const {
1188
- colIndex: p,
1189
- rowIndex: w,
1190
- totalCols: I,
1191
- totalRows: x,
1201
+ colIndex: s,
1202
+ rowIndex: r,
1203
+ totalCols: x,
1204
+ totalRows: k,
1192
1205
  cellRect: a,
1193
- tableRect: d,
1206
+ tableRect: C,
1194
1207
  editorRect: v
1195
- } = i, h = d.top - v.top, A = d.left - v.left, T = d.right - v.left, L = d.bottom - v.top, y = a.left - v.left, S = a.top - v.top, U = a.width, O = a.height, ie = {
1208
+ } = i, h = C.top - v.top, B = C.left - v.left, V = C.right - v.left, I = C.bottom - v.top, M = a.left - v.left, S = a.top - v.top, U = a.width, $ = a.height, ie = {
1196
1209
  position: "absolute",
1197
1210
  top: `${h - 20}px`,
1198
- left: `${y + U / 2 - 18}px`
1211
+ left: `${M + U / 2 - 18}px`
1199
1212
  }, ue = {
1200
1213
  position: "absolute",
1201
- top: `${S + O / 2 - 18}px`,
1202
- left: `${A - 20}px`
1214
+ top: `${S + $ / 2 - 18}px`,
1215
+ left: `${B - 20}px`
1203
1216
  }, re = {
1204
1217
  position: "absolute",
1205
- top: `${S + O / 2 - 12}px`,
1206
- left: `${T + 6}px`
1218
+ top: `${S + $ / 2 - 12}px`,
1219
+ left: `${V + 6}px`
1207
1220
  }, ae = {
1208
1221
  position: "absolute",
1209
- top: `${L + 6}px`,
1210
- left: `${y + U / 2 - 12}px`
1211
- }, se = p === 0, $ = p === I - 1, ce = w === 0, N = w === x - 1, F = t?.value;
1222
+ top: `${I + 6}px`,
1223
+ left: `${M + U / 2 - 12}px`
1224
+ }, se = s === 0, z = s === x - 1, ce = r === 0, N = r === k - 1, T = t?.value;
1212
1225
  return e("div", {
1213
1226
  class: "table-cell-controls"
1214
1227
  }, [e(j, {
1215
1228
  trigger: "click",
1216
1229
  placement: "bottom",
1217
1230
  style: ie,
1218
- onCommand: (M) => {
1219
- M === "move-left" ? s("left") : M === "move-right" ? s("right") : M === "insert-left" ? F?.chain().focus().addColumnBefore().run() : M === "insert-right" ? F?.chain().focus().addColumnAfter().run() : M === "delete" && F?.chain().focus().deleteColumn().run();
1231
+ onCommand: (L) => {
1232
+ L === "move-left" ? d("left") : L === "move-right" ? d("right") : L === "insert-left" ? T?.chain().focus().addColumnBefore().run() : L === "insert-right" ? T?.chain().focus().addColumnAfter().run() : L === "delete" && T?.chain().focus().deleteColumn().run();
1220
1233
  }
1221
1234
  }, {
1222
1235
  default: () => [e("button", {
1223
1236
  class: "tcc-btn tcc-btn--col"
1224
- }, [e(g, null, null)])],
1237
+ }, [e(m, null, null)])],
1225
1238
  dropdown: () => e(W, null, {
1226
1239
  default: () => [e(E, {
1227
1240
  command: "move-left",
1228
1241
  disabled: se
1229
1242
  }, {
1230
- default: () => [m("移动列到左侧")]
1243
+ default: () => [g("移动列到左侧")]
1231
1244
  }), e(E, {
1232
1245
  command: "move-right",
1233
- disabled: $
1246
+ disabled: z
1234
1247
  }, {
1235
- default: () => [m("移动列到右侧")]
1248
+ default: () => [g("移动列到右侧")]
1236
1249
  }), e(E, {
1237
1250
  command: "insert-left"
1238
1251
  }, {
1239
- default: () => [m("在左侧插入一列")]
1252
+ default: () => [g("在左侧插入一列")]
1240
1253
  }), e(E, {
1241
1254
  command: "insert-right"
1242
1255
  }, {
1243
- default: () => [m("在右侧插入一列")]
1256
+ default: () => [g("在右侧插入一列")]
1244
1257
  }), e(E, {
1245
1258
  command: "delete",
1246
1259
  divided: !0
1247
1260
  }, {
1248
- default: () => [m("删除列")]
1261
+ default: () => [g("删除列")]
1249
1262
  })]
1250
1263
  })
1251
1264
  }), e(j, {
1252
1265
  trigger: "click",
1253
1266
  placement: "right",
1254
1267
  style: ue,
1255
- onCommand: (M) => {
1256
- M === "move-up" ? f("up") : M === "move-down" ? f("down") : M === "insert-above" ? F?.chain().focus().addRowBefore().run() : M === "insert-below" ? F?.chain().focus().addRowAfter().run() : M === "delete" && F?.chain().focus().deleteRow().run();
1268
+ onCommand: (L) => {
1269
+ L === "move-up" ? f("up") : L === "move-down" ? f("down") : L === "insert-above" ? T?.chain().focus().addRowBefore().run() : L === "insert-below" ? T?.chain().focus().addRowAfter().run() : L === "delete" && T?.chain().focus().deleteRow().run();
1257
1270
  }
1258
1271
  }, {
1259
1272
  default: () => [e("button", {
1260
1273
  class: "tcc-btn tcc-btn--row"
1261
- }, [e(r, null, null)])],
1274
+ }, [e(c, null, null)])],
1262
1275
  dropdown: () => e(W, null, {
1263
1276
  default: () => [e(E, {
1264
1277
  command: "move-up",
1265
1278
  disabled: ce
1266
1279
  }, {
1267
- default: () => [m("上移")]
1280
+ default: () => [g("上移")]
1268
1281
  }), e(E, {
1269
1282
  command: "move-down",
1270
1283
  disabled: N
1271
1284
  }, {
1272
- default: () => [m("下移")]
1285
+ default: () => [g("下移")]
1273
1286
  }), e(E, {
1274
1287
  command: "insert-above"
1275
1288
  }, {
1276
- default: () => [m("在上方插入一行")]
1289
+ default: () => [g("在上方插入一行")]
1277
1290
  }), e(E, {
1278
1291
  command: "insert-below"
1279
1292
  }, {
1280
- default: () => [m("在下方插入一行")]
1293
+ default: () => [g("在下方插入一行")]
1281
1294
  }), e(E, {
1282
1295
  command: "delete",
1283
1296
  divided: !0
1284
1297
  }, {
1285
- default: () => [m("删除行")]
1298
+ default: () => [g("删除行")]
1286
1299
  })]
1287
1300
  })
1288
- }), $ && e("button", {
1301
+ }), z && e("button", {
1289
1302
  class: "tcc-btn tcc-btn--add",
1290
1303
  style: re,
1291
- onClick: () => F?.chain().focus().addColumnAfter().run()
1292
- }, [e(C, null, null)]), N && e("button", {
1304
+ onClick: () => T?.chain().focus().addColumnAfter().run()
1305
+ }, [e(H, null, null)]), N && e("button", {
1293
1306
  class: "tcc-btn tcc-btn--add",
1294
1307
  style: ae,
1295
- onClick: () => F?.chain().focus().addRowAfter().run()
1296
- }, [e(C, null, null)])]);
1308
+ onClick: () => T?.chain().focus().addRowAfter().run()
1309
+ }, [e(H, null, null)])]);
1297
1310
  };
1298
1311
  }
1299
- }), f1 = /* @__PURE__ */ c({
1312
+ }), h1 = /* @__PURE__ */ p({
1300
1313
  name: "MathIcon",
1301
1314
  setup(t, {
1302
1315
  attrs: l
1303
1316
  }) {
1304
- return () => e("svg", k({
1317
+ return () => e("svg", b({
1305
1318
  width: "24",
1306
1319
  height: "24",
1307
1320
  viewBox: "0 0 24 24",
@@ -1314,18 +1327,18 @@ const v1 = /* @__PURE__ */ c({
1314
1327
  fill: "currentColor"
1315
1328
  }, null)]);
1316
1329
  }
1317
- }), h1 = /* @__PURE__ */ c({
1330
+ }), g1 = /* @__PURE__ */ p({
1318
1331
  name: "MathButton",
1319
1332
  setup() {
1320
- const t = B("editor"), l = B("openMathDialog");
1321
- return () => e(b, {
1322
- icon: f1,
1333
+ const t = A("editor"), l = A("openMathDialog");
1334
+ return () => e(w, {
1335
+ icon: h1,
1323
1336
  tooltip: "数学公式",
1324
1337
  isActive: t?.value?.isActive("inlineMath") || t?.value?.isActive("blockMath"),
1325
1338
  onClick: () => l?.()
1326
1339
  }, null);
1327
1340
  }
1328
- }), g1 = /* @__PURE__ */ c({
1341
+ }), m1 = /* @__PURE__ */ p({
1329
1342
  name: "MathEditDialog",
1330
1343
  props: {
1331
1344
  visible: {
@@ -1349,44 +1362,44 @@ const v1 = /* @__PURE__ */ c({
1349
1362
  setup(t, {
1350
1363
  emit: l
1351
1364
  }) {
1352
- const n = B("editor"), o = H(""), u = H("inline");
1353
- D(() => t.latex, (r) => {
1354
- o.value = r;
1365
+ const n = A("editor"), o = y(""), u = y("inline");
1366
+ D(() => t.latex, (c) => {
1367
+ o.value = c;
1355
1368
  }, {
1356
1369
  immediate: !0
1357
- }), D(() => t.type, (r) => {
1358
- u.value = r;
1370
+ }), D(() => t.type, (c) => {
1371
+ u.value = c;
1359
1372
  }, {
1360
1373
  immediate: !0
1361
1374
  });
1362
- const s = V(() => t.pos === null), f = V(() => o.value.trim() ? _e.renderToString(o.value, {
1375
+ const d = F(() => t.pos === null), f = F(() => o.value.trim() ? _e.renderToString(o.value, {
1363
1376
  displayMode: u.value === "block",
1364
1377
  throwOnError: !1
1365
- }) : ""), g = () => {
1366
- const r = n?.value;
1367
- if (!(!r || !o.value.trim())) {
1368
- if (s.value)
1369
- u.value === "inline" ? r.chain().focus().insertInlineMath({
1378
+ }) : ""), m = () => {
1379
+ const c = n?.value;
1380
+ if (!(!c || !o.value.trim())) {
1381
+ if (d.value)
1382
+ u.value === "inline" ? c.chain().focus().insertInlineMath({
1370
1383
  latex: o.value
1371
- }).run() : r.chain().focus().insertBlockMath({
1384
+ }).run() : c.chain().focus().insertBlockMath({
1372
1385
  latex: o.value
1373
1386
  }).run();
1374
1387
  else if (u.value === t.type)
1375
- t.type === "inline" ? r.commands.updateInlineMath({
1388
+ t.type === "inline" ? c.commands.updateInlineMath({
1376
1389
  latex: o.value,
1377
1390
  pos: t.pos
1378
- }) : r.commands.updateBlockMath({
1391
+ }) : c.commands.updateBlockMath({
1379
1392
  latex: o.value,
1380
1393
  pos: t.pos
1381
1394
  });
1382
1395
  else {
1383
- const C = t.pos;
1384
- t.type === "inline" ? r.chain().focus().deleteInlineMath({
1385
- pos: C
1396
+ const H = t.pos;
1397
+ t.type === "inline" ? c.chain().focus().deleteInlineMath({
1398
+ pos: H
1386
1399
  }).insertBlockMath({
1387
1400
  latex: o.value
1388
- }).run() : r.chain().focus().deleteBlockMath({
1389
- pos: C
1401
+ }).run() : c.chain().focus().deleteBlockMath({
1402
+ pos: H
1390
1403
  }).insertInlineMath({
1391
1404
  latex: o.value
1392
1405
  }).run();
@@ -1396,34 +1409,34 @@ const v1 = /* @__PURE__ */ c({
1396
1409
  };
1397
1410
  return () => e(Se, {
1398
1411
  modelValue: t.visible,
1399
- title: s.value ? "插入数学公式" : "编辑数学公式",
1412
+ title: d.value ? "插入数学公式" : "编辑数学公式",
1400
1413
  width: "520px",
1401
- "onUpdate:modelValue": (r) => l("update:visible", r)
1414
+ "onUpdate:modelValue": (c) => l("update:visible", c)
1402
1415
  }, {
1403
1416
  default: () => [e("div", {
1404
1417
  class: "math-dialog"
1405
1418
  }, [e(Ue, {
1406
1419
  modelValue: u.value,
1407
- "onUpdate:modelValue": (r) => {
1408
- u.value = r;
1420
+ "onUpdate:modelValue": (c) => {
1421
+ u.value = c;
1409
1422
  }
1410
1423
  }, {
1411
1424
  default: () => [e(q, {
1412
1425
  value: "inline"
1413
1426
  }, {
1414
- default: () => [m("行内公式")]
1427
+ default: () => [g("行内公式")]
1415
1428
  }), e(q, {
1416
1429
  value: "block"
1417
1430
  }, {
1418
- default: () => [m("块级公式")]
1431
+ default: () => [g("块级公式")]
1419
1432
  })]
1420
1433
  }), e(X, {
1421
1434
  modelValue: o.value,
1422
1435
  type: "textarea",
1423
1436
  rows: 3,
1424
1437
  placeholder: "请输入 LaTeX 公式,例如:E=mc^2",
1425
- "onUpdate:modelValue": (r) => {
1426
- o.value = r;
1438
+ "onUpdate:modelValue": (c) => {
1439
+ o.value = c;
1427
1440
  }
1428
1441
  }, null), e("div", {
1429
1442
  class: ["math-preview", {
@@ -1433,21 +1446,21 @@ const v1 = /* @__PURE__ */ c({
1433
1446
  innerHTML: f.value
1434
1447
  }, null) : e("span", {
1435
1448
  class: "math-preview__placeholder"
1436
- }, [m("预览将在此处显示")])])])],
1449
+ }, [g("预览将在此处显示")])])])],
1437
1450
  footer: () => e(de, null, [e(Z, {
1438
1451
  onClick: () => l("update:visible", !1)
1439
1452
  }, {
1440
- default: () => [m("取消")]
1453
+ default: () => [g("取消")]
1441
1454
  }), e(Z, {
1442
1455
  type: "primary",
1443
1456
  disabled: !o.value.trim(),
1444
- onClick: g
1457
+ onClick: m
1445
1458
  }, {
1446
- default: () => [m("确认")]
1459
+ default: () => [g("确认")]
1447
1460
  })])
1448
1461
  });
1449
1462
  }
1450
- }), m1 = [{
1463
+ }), w1 = [{
1451
1464
  value: "left",
1452
1465
  title: "居左",
1453
1466
  Icon: le
@@ -1460,7 +1473,7 @@ const v1 = /* @__PURE__ */ c({
1460
1473
  title: "居右",
1461
1474
  Icon: oe
1462
1475
  }], _ = (t) => t.preventDefault();
1463
- function w1(t) {
1476
+ function b1(t) {
1464
1477
  if (!t.isActive("image")) return null;
1465
1478
  const {
1466
1479
  selection: l
@@ -1474,11 +1487,11 @@ function w1(t) {
1474
1487
  align: n.attrs.align ?? "left"
1475
1488
  };
1476
1489
  }
1477
- function b1(t) {
1490
+ function k1(t) {
1478
1491
  const l = t.startsWith("data:") ? "image.png" : t.split("/").pop()?.split("?")[0] || "image.png", n = document.createElement("a");
1479
1492
  n.href = t, n.download = l, document.body.appendChild(n), n.click(), document.body.removeChild(n);
1480
1493
  }
1481
- const k1 = () => e("svg", {
1494
+ const x1 = () => e("svg", {
1482
1495
  width: "16",
1483
1496
  height: "16",
1484
1497
  viewBox: "0 0 24 24",
@@ -1496,7 +1509,7 @@ const k1 = () => e("svg", {
1496
1509
  y1: "15",
1497
1510
  x2: "12",
1498
1511
  y2: "3"
1499
- }, null)]), x1 = () => e("svg", {
1512
+ }, null)]), H1 = () => e("svg", {
1500
1513
  width: "16",
1501
1514
  height: "16",
1502
1515
  viewBox: "0 0 24 24",
@@ -1509,7 +1522,7 @@ const k1 = () => e("svg", {
1509
1522
  points: "1 4 1 10 7 10"
1510
1523
  }, null), e("path", {
1511
1524
  d: "M3.51 15a9 9 0 1 0 .49-4.1L1 10"
1512
- }, null)]), H1 = () => e("svg", {
1525
+ }, null)]), y1 = () => e("svg", {
1513
1526
  width: "16",
1514
1527
  height: "16",
1515
1528
  viewBox: "0 0 24 24",
@@ -1526,93 +1539,93 @@ const k1 = () => e("svg", {
1526
1539
  d: "M10 11v6M14 11v6"
1527
1540
  }, null), e("path", {
1528
1541
  d: "M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"
1529
- }, null)]), B1 = /* @__PURE__ */ c({
1542
+ }, null)]), A1 = /* @__PURE__ */ p({
1530
1543
  name: "ImageControls",
1531
1544
  setup() {
1532
- const t = B("editor"), l = B("readonly"), n = H(null);
1545
+ const t = A("editor"), l = A("readonly"), n = y(null);
1533
1546
  function o() {
1534
1547
  const u = t?.value;
1535
1548
  if (!u) {
1536
1549
  n.value = null;
1537
1550
  return;
1538
1551
  }
1539
- n.value = w1(u);
1552
+ n.value = b1(u);
1540
1553
  }
1541
- return G((u) => {
1542
- const s = t?.value;
1543
- s && (s.on("transaction", o), u(() => {
1544
- s.off("transaction", o);
1554
+ return K((u) => {
1555
+ const d = t?.value;
1556
+ d && (d.on("transaction", o), u(() => {
1557
+ d.off("transaction", o);
1545
1558
  }));
1546
1559
  }), () => {
1547
1560
  const u = n.value;
1548
1561
  if (!u) return null;
1549
- const s = t?.value;
1550
- if (!s) return null;
1562
+ const d = t?.value;
1563
+ if (!d) return null;
1551
1564
  const {
1552
1565
  pos: f,
1553
- nodeSize: g,
1554
- src: r,
1555
- align: C
1556
- } = u, i = l?.value ?? !1, p = s.view.nodeDOM(f);
1557
- if (!p || !(p instanceof HTMLElement)) return null;
1558
- const w = p.querySelector("[data-resize-wrapper]") ?? p, I = s.view.dom.closest(".tiptap-editor");
1559
- if (!I) return null;
1560
- const x = w.getBoundingClientRect(), a = I.getBoundingClientRect(), d = {
1566
+ nodeSize: m,
1567
+ src: c,
1568
+ align: H
1569
+ } = u, i = l?.value ?? !1, s = d.view.nodeDOM(f);
1570
+ if (!s || !(s instanceof HTMLElement)) return null;
1571
+ const r = s.querySelector("[data-resize-wrapper]") ?? s, x = d.view.dom.closest(".tiptap-editor");
1572
+ if (!x) return null;
1573
+ const k = r.getBoundingClientRect(), a = x.getBoundingClientRect(), C = {
1561
1574
  position: "absolute",
1562
- top: `${x.top - a.top}px`,
1563
- left: `${x.left - a.left + x.width / 2}px`,
1575
+ top: `${k.top - a.top}px`,
1576
+ left: `${k.left - a.left + k.width / 2}px`,
1564
1577
  transform: "translate(-50%, calc(-100% - 8px))",
1565
1578
  zIndex: 20
1566
1579
  };
1567
1580
  return e("div", {
1568
1581
  class: "image-controls",
1569
- style: d
1570
- }, [!i && m1.map(({
1582
+ style: C
1583
+ }, [!i && w1.map(({
1571
1584
  value: v,
1572
1585
  title: h,
1573
- Icon: A
1586
+ Icon: B
1574
1587
  }) => e("button", {
1575
1588
  key: v,
1576
- class: ["image-controls-btn", C === v && "is-active"],
1589
+ class: ["image-controls-btn", H === v && "is-active"],
1577
1590
  title: h,
1578
1591
  onMousedown: _,
1579
- onClick: () => s.chain().focus().updateAttributes("image", {
1592
+ onClick: () => d.chain().focus().updateAttributes("image", {
1580
1593
  align: v
1581
1594
  }).run()
1582
- }, [e(A, null, null)])), !i && e("span", {
1595
+ }, [e(B, null, null)])), !i && e("span", {
1583
1596
  class: "image-controls-separator"
1584
1597
  }, null), e("button", {
1585
1598
  class: "image-controls-btn",
1586
1599
  title: "下载",
1587
1600
  onMousedown: _,
1588
- onClick: () => b1(r)
1589
- }, [e(k1, null, null)]), !i && e("button", {
1601
+ onClick: () => k1(c)
1602
+ }, [e(x1, null, null)]), !i && e("button", {
1590
1603
  class: "image-controls-btn",
1591
1604
  title: "重新上传",
1592
1605
  onMousedown: _,
1593
- onClick: () => s.chain().focus().deleteRange({
1606
+ onClick: () => d.chain().focus().deleteRange({
1594
1607
  from: f,
1595
- to: f + g
1608
+ to: f + m
1596
1609
  }).insertContentAt(f, {
1597
1610
  type: "imageUpload"
1598
1611
  }).run()
1599
- }, [e(x1, null, null)]), !i && e("button", {
1612
+ }, [e(H1, null, null)]), !i && e("button", {
1600
1613
  class: "image-controls-btn",
1601
1614
  title: "删除",
1602
1615
  onMousedown: _,
1603
- onClick: () => s.chain().focus().deleteRange({
1616
+ onClick: () => d.chain().focus().deleteRange({
1604
1617
  from: f,
1605
- to: f + g
1618
+ to: f + m
1606
1619
  }).run()
1607
- }, [e(H1, null, null)])]);
1620
+ }, [e(y1, null, null)])]);
1608
1621
  };
1609
1622
  }
1610
- }), A1 = /* @__PURE__ */ c({
1623
+ }), B1 = /* @__PURE__ */ p({
1611
1624
  name: "CodeBlockIcon",
1612
1625
  setup(t, {
1613
1626
  attrs: l
1614
1627
  }) {
1615
- return () => e("svg", k({
1628
+ return () => e("svg", b({
1616
1629
  width: "24",
1617
1630
  height: "24",
1618
1631
  viewBox: "0 0 24 24",
@@ -1628,22 +1641,22 @@ const k1 = () => e("svg", {
1628
1641
  points: "8 6 2 12 8 18"
1629
1642
  }, null)]);
1630
1643
  }
1631
- }), y1 = /* @__PURE__ */ c({
1644
+ }), M1 = /* @__PURE__ */ p({
1632
1645
  name: "CodeBlockButton",
1633
1646
  setup() {
1634
- const t = B("editor");
1635
- return () => e(b, {
1636
- icon: A1,
1647
+ const t = A("editor");
1648
+ return () => e(w, {
1649
+ icon: B1,
1637
1650
  tooltip: "代码块",
1638
1651
  isActive: t?.value?.isActive("codeBlock"),
1639
1652
  onClick: () => t?.value?.chain().focus().toggleCodeBlock().run()
1640
1653
  }, null);
1641
1654
  }
1642
- }), M1 = /* @__PURE__ */ c({
1655
+ }), L1 = /* @__PURE__ */ p({
1643
1656
  name: "BubbleMenuBar",
1644
1657
  setup() {
1645
- const t = B("editor"), l = B("readonly");
1646
- return () => t?.value ? e(Pe, {
1658
+ const t = A("editor"), l = A("readonly");
1659
+ return () => t?.value ? e(Oe, {
1647
1660
  editor: t.value,
1648
1661
  class: "bubble-menu",
1649
1662
  options: {
@@ -1657,29 +1670,29 @@ const k1 = () => e("svg", {
1657
1670
  const {
1658
1671
  editor: o,
1659
1672
  from: u,
1660
- to: s
1673
+ to: d
1661
1674
  } = n;
1662
- return !(u === s || o.isActive("image") || o.isActive("table"));
1675
+ return !(u === d || o.isActive("image") || o.isActive("table"));
1663
1676
  }
1664
1677
  }, {
1665
1678
  default: () => [e("div", {
1666
1679
  class: "bubble-menu-content"
1667
- }, [e(b, {
1680
+ }, [e(w, {
1668
1681
  icon: Q,
1669
1682
  tooltip: "粗体",
1670
1683
  isActive: t.value.isActive("bold"),
1671
1684
  onClick: () => t.value?.chain().focus().toggleBold().run()
1672
- }, null), e(b, {
1685
+ }, null), e(w, {
1673
1686
  icon: Y,
1674
1687
  tooltip: "斜体",
1675
1688
  isActive: t.value.isActive("italic"),
1676
1689
  onClick: () => t.value?.chain().focus().toggleItalic().run()
1677
- }, null), e(b, {
1690
+ }, null), e(w, {
1678
1691
  icon: ee,
1679
1692
  tooltip: "删除线",
1680
1693
  isActive: t.value.isActive("strike"),
1681
1694
  onClick: () => t.value?.chain().focus().toggleStrike().run()
1682
- }, null), e(b, {
1695
+ }, null), e(w, {
1683
1696
  icon: te,
1684
1697
  tooltip: "下划线",
1685
1698
  isActive: t.value.isActive("underline"),
@@ -1687,7 +1700,7 @@ const k1 = () => e("svg", {
1687
1700
  }, null)])]
1688
1701
  }) : null;
1689
1702
  }
1690
- }), I1 = He(Be), W1 = /* @__PURE__ */ c({
1703
+ }), I1 = He(ye), q1 = /* @__PURE__ */ p({
1691
1704
  name: "TiptapEditor",
1692
1705
  props: {
1693
1706
  modelValue: {
@@ -1705,17 +1718,46 @@ const k1 = () => e("svg", {
1705
1718
  readonly: {
1706
1719
  type: Boolean,
1707
1720
  default: !1
1721
+ },
1722
+ toolbar: {
1723
+ type: Array,
1724
+ default: void 0
1708
1725
  }
1709
1726
  },
1710
1727
  emits: ["update:modelValue"],
1711
1728
  setup(t, {
1712
1729
  emit: l
1713
1730
  }) {
1714
- const n = H(!1), o = H(""), u = H(null), s = H("inline"), f = V(() => t.readonly ?? !1), g = (C = {}) => {
1715
- f.value || (o.value = C.latex ?? "", u.value = C.pos ?? null, s.value = C.type ?? "inline", n.value = !0);
1731
+ const n = {
1732
+ "undo-redo": Ge,
1733
+ "text-style": e1,
1734
+ "code-block": M1,
1735
+ list: u1,
1736
+ "text-align": l1,
1737
+ image: a1,
1738
+ table: p1,
1739
+ math: g1
1740
+ }, o = F(() => t.toolbar ?? Ne), u = (r, x) => {
1741
+ if (r === "|")
1742
+ return e("div", {
1743
+ key: `separator-${x}`,
1744
+ class: "tiptap-separator"
1745
+ }, null);
1746
+ if (typeof r == "object" && r.type === "custom") {
1747
+ const a = r.component;
1748
+ return e(a, {
1749
+ key: r.key ?? `custom-${x}`
1750
+ }, null);
1751
+ }
1752
+ const k = n[r];
1753
+ return k ? e(k, {
1754
+ key: r
1755
+ }, null) : null;
1756
+ }, d = y(!1), f = y(""), m = y(null), c = y("inline"), H = F(() => t.readonly ?? !1), i = (r = {}) => {
1757
+ H.value || (f.value = r.latex ?? "", m.value = r.pos ?? null, c.value = r.type ?? "inline", d.value = !0);
1716
1758
  };
1717
- z("openMathDialog", g), z("readonly", f);
1718
- const r = he({
1759
+ P("openMathDialog", i), P("readonly", H);
1760
+ const s = he({
1719
1761
  content: t.modelValue,
1720
1762
  editable: !t.readonly,
1721
1763
  extensions: [pe.configure({
@@ -1733,7 +1775,7 @@ const k1 = () => e("svg", {
1733
1775
  types: ["heading", "paragraph"]
1734
1776
  }), me, we.configure({
1735
1777
  nested: !0
1736
- }), ze.configure({
1778
+ }), Pe.configure({
1737
1779
  allowBase64: !0,
1738
1780
  resize: {
1739
1781
  enabled: !0,
@@ -1742,68 +1784,69 @@ const k1 = () => e("svg", {
1742
1784
  minHeight: 50,
1743
1785
  alwaysPreserveAspectRatio: !1
1744
1786
  }
1745
- }), $e.configure({
1787
+ }), ze.configure({
1746
1788
  ...t.upload ? {
1747
1789
  upload: t.upload
1748
1790
  } : {}
1749
- }), Te.configure({
1791
+ }), Ve.configure({
1750
1792
  resizable: !0
1751
- }), Ee, Fe, Ve, Ze.configure({
1793
+ }), Ee, Fe, Te, Ze.configure({
1752
1794
  inlineOptions: {
1753
- onClick: (C, i) => g({
1754
- latex: C.attrs.latex,
1755
- pos: i,
1795
+ onClick: (r, x) => i({
1796
+ latex: r.attrs.latex,
1797
+ pos: x,
1756
1798
  type: "inline"
1757
1799
  })
1758
1800
  },
1759
1801
  blockOptions: {
1760
- onClick: (C, i) => g({
1761
- latex: C.attrs.latex,
1762
- pos: i,
1802
+ onClick: (r, x) => i({
1803
+ latex: r.attrs.latex,
1804
+ pos: x,
1763
1805
  type: "block"
1764
1806
  })
1765
1807
  }
1766
1808
  })],
1767
1809
  onUpdate: ({
1768
- editor: C
1810
+ editor: r
1769
1811
  }) => {
1770
- l("update:modelValue", C.getHTML());
1812
+ l("update:modelValue", r.getHTML());
1771
1813
  }
1772
1814
  });
1773
- return z("editor", r), D(() => t.modelValue, (C) => {
1774
- r.value && C !== r.value.getHTML() && r.value.commands.setContent(C, {
1815
+ return P("editor", s), D(() => t.modelValue, (r) => {
1816
+ s.value && r !== s.value.getHTML() && s.value.commands.setContent(r, {
1775
1817
  emitUpdate: !1
1776
1818
  });
1777
- }), D(() => t.readonly, (C) => {
1778
- r.value?.setEditable(!C);
1819
+ }), D(() => t.readonly, (r) => {
1820
+ s.value?.setEditable(!r);
1779
1821
  }), () => e("div", {
1780
1822
  class: "tiptap-editor"
1781
1823
  }, [!t.readonly && e("div", {
1782
1824
  class: "tiptap-toolbar"
1783
- }, [e(qe, null, null), e("div", {
1784
- class: "tiptap-separator"
1785
- }, null), e(Ye, null, null), e(y1, null, null), e("div", {
1786
- class: "tiptap-separator"
1787
- }, null), e(i1, null, null), e("div", {
1788
- class: "tiptap-separator"
1789
- }, null), e(t1, null, null), e("div", {
1790
- class: "tiptap-separator"
1791
- }, null), e(r1, null, null), e(d1, null, null), e(h1, null, null)]), e(ge, {
1825
+ }, [o.value.map((r, x) => u(r, x))]), e(ge, {
1792
1826
  class: "tiptap-content",
1793
- editor: r.value
1794
- }, null), e(M1, null, null), e(v1, null, null), e(B1, null, null), e(g1, {
1795
- visible: n.value,
1796
- latex: o.value,
1797
- pos: u.value,
1798
- type: s.value,
1799
- "onUpdate:visible": (C) => {
1800
- n.value = C;
1827
+ editor: s.value
1828
+ }, null), e(L1, null, null), e(f1, null, null), e(A1, null, null), e(m1, {
1829
+ visible: d.value,
1830
+ latex: f.value,
1831
+ pos: m.value,
1832
+ type: c.value,
1833
+ "onUpdate:visible": (r) => {
1834
+ d.value = r;
1801
1835
  }
1802
1836
  }, null)]);
1803
1837
  }
1804
1838
  });
1805
1839
  export {
1806
- b as IconButton,
1807
- ze as ImageWithAlign,
1808
- W1 as TiptapEditor
1840
+ M1 as CodeBlockButton,
1841
+ Ne as DEFAULT_TOOLBAR_CONFIG,
1842
+ w as IconButton,
1843
+ a1 as ImageButton,
1844
+ Pe as ImageWithAlign,
1845
+ u1 as ListButton,
1846
+ g1 as MathButton,
1847
+ p1 as TableButton,
1848
+ l1 as TextAlignButton,
1849
+ e1 as TextStyleButton,
1850
+ q1 as TiptapEditor,
1851
+ Ge as UndoRedoButton
1809
1852
  };