@mario9/tiptap-editor 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/tiptap-editor.css +1 -1
- package/dist/tiptap-editor.js +581 -572
- package/dist/tiptap-editor.umd.cjs +1 -1
- package/package.json +8 -8
package/dist/tiptap-editor.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { nodeViewProps as Be, NodeViewWrapper as Me, VueNodeViewRenderer as Ae, useEditor as
|
|
4
|
-
import { TaskList as
|
|
5
|
-
import { TextAlign as
|
|
6
|
-
import { Placeholder as
|
|
7
|
-
import { CodeBlockLowlight as
|
|
8
|
-
import { createLowlight as
|
|
9
|
-
import { Image as
|
|
10
|
-
import { Plugin as
|
|
11
|
-
import { Decoration as
|
|
12
|
-
import { TableRow as
|
|
13
|
-
import { Mathematics as
|
|
14
|
-
import { Node as
|
|
15
|
-
import { ElTooltip as
|
|
16
|
-
import
|
|
17
|
-
import { BubbleMenu as
|
|
18
|
-
const
|
|
1
|
+
import { defineComponent as d, computed as S, ref as B, openBlock as Z, createBlock as le, unref as g, withCtx as D, createElementBlock as R, normalizeClass as ne, createElementVNode as L, createTextVNode as H, toDisplayString as N, Fragment as be, renderList as xe, normalizeStyle as He, createCommentVNode as oe, withModifiers as X, createVNode as e, mergeProps as k, inject as M, watch as z, nextTick as W, watchEffect as ie, provide as K } from "vue";
|
|
2
|
+
import ye from "@tiptap/starter-kit";
|
|
3
|
+
import { nodeViewProps as Be, NodeViewWrapper as Me, VueNodeViewRenderer as Ae, useEditor as Le, EditorContent as Ie } from "@tiptap/vue-3";
|
|
4
|
+
import { TaskList as Ee, TaskItem as Ve } from "@tiptap/extension-list";
|
|
5
|
+
import { TextAlign as Te } from "@tiptap/extension-text-align";
|
|
6
|
+
import { Placeholder as Ze } from "@tiptap/extension-placeholder";
|
|
7
|
+
import { CodeBlockLowlight as Fe } from "@tiptap/extension-code-block-lowlight";
|
|
8
|
+
import { createLowlight as Re, common as _e } from "lowlight";
|
|
9
|
+
import { Image as De } from "@tiptap/extension-image";
|
|
10
|
+
import { Plugin as Se, NodeSelection as Ue } from "@tiptap/pm/state";
|
|
11
|
+
import { Decoration as $e, DecorationSet as ze } from "@tiptap/pm/view";
|
|
12
|
+
import { TableRow as Oe, TableHeader as Pe, TableCell as Ne, Table as je } from "@tiptap/extension-table";
|
|
13
|
+
import { Mathematics as We } from "@tiptap/extension-mathematics";
|
|
14
|
+
import { Node as Ke, mergeAttributes as qe } from "@tiptap/core";
|
|
15
|
+
import { ElTooltip as $, ElButton as U, ElPopover as re, ElInput as ue, ElDropdown as Q, ElDropdownMenu as Y, ElDropdownItem as F, ElDialog as Ge, ElRadioGroup as Je, ElRadioButton as ee } from "element-plus";
|
|
16
|
+
import Xe from "katex";
|
|
17
|
+
import { BubbleMenu as Qe } from "@tiptap/vue-3/menus";
|
|
18
|
+
const Ye = De.extend({
|
|
19
19
|
addAttributes() {
|
|
20
20
|
return {
|
|
21
21
|
...this.parent?.(),
|
|
@@ -29,130 +29,130 @@ const Qe = Re.extend({
|
|
|
29
29
|
addProseMirrorPlugins() {
|
|
30
30
|
const t = this.name;
|
|
31
31
|
return [
|
|
32
|
-
new
|
|
32
|
+
new Se({
|
|
33
33
|
props: {
|
|
34
34
|
decorations(l) {
|
|
35
35
|
const n = [];
|
|
36
|
-
return l.doc.descendants((
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"data-align":
|
|
36
|
+
return l.doc.descendants((r, s) => {
|
|
37
|
+
r.type.name === t && r.attrs.align && n.push(
|
|
38
|
+
$e.node(s, s + r.nodeSize, {
|
|
39
|
+
"data-align": r.attrs.align
|
|
40
40
|
})
|
|
41
41
|
);
|
|
42
|
-
}),
|
|
42
|
+
}), ze.create(l.doc, n);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
})
|
|
46
46
|
];
|
|
47
47
|
}
|
|
48
|
-
}),
|
|
48
|
+
}), e1 = { class: "tiptap-image-upload-content" }, t1 = { class: "tiptap-image-upload-subtext" }, l1 = {
|
|
49
49
|
key: 1,
|
|
50
50
|
class: "tiptap-image-upload-previews"
|
|
51
|
-
},
|
|
51
|
+
}, n1 = { class: "tiptap-image-upload-preview-content" }, o1 = { class: "tiptap-image-upload-text" }, i1 = { class: "tiptap-image-upload-subtext" }, r1 = ["onClick"], u1 = ["accept", "multiple"], a1 = /* @__PURE__ */ d({
|
|
52
52
|
__name: "ImageUploadView",
|
|
53
53
|
props: Be,
|
|
54
54
|
setup(t) {
|
|
55
|
-
const l = t, n =
|
|
56
|
-
if (
|
|
55
|
+
const l = t, n = S(() => l.node.attrs.accept), r = S(() => l.node.attrs.limit), s = S(() => l.node.attrs.maxSize), u = B([]), v = B(), f = B(!1), h = async (c) => {
|
|
56
|
+
if (s.value > 0 && c.size > s.value)
|
|
57
57
|
return l.extension.options.onError?.(
|
|
58
|
-
new Error(`文件大小超出限制 ${
|
|
58
|
+
new Error(`文件大小超出限制 ${s.value / 1024 / 1024}MB`)
|
|
59
59
|
), null;
|
|
60
60
|
const p = crypto.randomUUID();
|
|
61
|
-
u.value.push({ id: p, file:
|
|
61
|
+
u.value.push({ id: p, file: c, progress: 0, status: "uploading" });
|
|
62
62
|
try {
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
67
|
-
const
|
|
68
|
-
return
|
|
69
|
-
} catch (
|
|
70
|
-
const
|
|
71
|
-
return
|
|
63
|
+
const C = l.extension.options.upload;
|
|
64
|
+
if (!C) throw new Error("未配置 upload 函数");
|
|
65
|
+
const x = await C(c);
|
|
66
|
+
if (!x) throw new Error("上传失败:未返回 URL");
|
|
67
|
+
const I = u.value.find((E) => E.id === p);
|
|
68
|
+
return I && (I.status = "success", I.progress = 100), l.extension.options.onSuccess?.(x), x;
|
|
69
|
+
} catch (C) {
|
|
70
|
+
const x = u.value.find((I) => I.id === p);
|
|
71
|
+
return x && (x.status = "error", x.progress = 0), l.extension.options.onError?.(C instanceof Error ? C : new Error("上传失败")), null;
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
if (!
|
|
75
|
-
if (
|
|
76
|
-
l.extension.options.onError?.(new Error(`最多上传 ${
|
|
73
|
+
}, y = async (c) => {
|
|
74
|
+
if (!c.length) return;
|
|
75
|
+
if (c.length > r.value) {
|
|
76
|
+
l.extension.options.onError?.(new Error(`最多上传 ${r.value} 个文件`));
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
const p = (await Promise.all(
|
|
79
|
+
const p = (await Promise.all(c.map(h))).filter((C) => !!C);
|
|
80
80
|
if (p.length > 0) {
|
|
81
|
-
const
|
|
82
|
-
if (typeof
|
|
83
|
-
const
|
|
84
|
-
l.editor.chain().focus().deleteRange({ from:
|
|
81
|
+
const C = l.getPos();
|
|
82
|
+
if (typeof C != "number") return;
|
|
83
|
+
const x = p.map((I) => ({ type: "image", attrs: { src: I } }));
|
|
84
|
+
l.editor.chain().focus().deleteRange({ from: C, to: C + l.node.nodeSize }).insertContentAt(C, x).run();
|
|
85
85
|
}
|
|
86
86
|
}, o = () => {
|
|
87
|
-
u.value.length === 0 &&
|
|
88
|
-
},
|
|
89
|
-
const p =
|
|
90
|
-
p &&
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
const p = Array.from(
|
|
98
|
-
p.length &&
|
|
99
|
-
},
|
|
100
|
-
u.value = u.value.filter((p) => p.id !==
|
|
87
|
+
u.value.length === 0 && v.value && (v.value.value = "", v.value.click());
|
|
88
|
+
}, i = (c) => {
|
|
89
|
+
const p = c.target.files;
|
|
90
|
+
p && y(Array.from(p));
|
|
91
|
+
}, a = (c) => {
|
|
92
|
+
c.preventDefault(), f.value = !0;
|
|
93
|
+
}, m = (c) => {
|
|
94
|
+
c.currentTarget.contains(c.relatedTarget) || (f.value = !1);
|
|
95
|
+
}, b = (c) => {
|
|
96
|
+
c.preventDefault(), f.value = !1;
|
|
97
|
+
const p = Array.from(c.dataTransfer?.files ?? []);
|
|
98
|
+
p.length && y(p);
|
|
99
|
+
}, A = (c) => {
|
|
100
|
+
u.value = u.value.filter((p) => p.id !== c);
|
|
101
101
|
};
|
|
102
|
-
return (
|
|
102
|
+
return (c, p) => (Z(), le(g(Me), {
|
|
103
103
|
class: "tiptap-image-upload",
|
|
104
104
|
onClick: o
|
|
105
105
|
}, {
|
|
106
|
-
default:
|
|
107
|
-
u.value.length ? (Z(), R("div",
|
|
108
|
-
(Z(!0), R(
|
|
109
|
-
key:
|
|
106
|
+
default: D(() => [
|
|
107
|
+
u.value.length ? (Z(), R("div", l1, [
|
|
108
|
+
(Z(!0), R(be, null, xe(u.value, (C) => (Z(), R("div", {
|
|
109
|
+
key: C.id,
|
|
110
110
|
class: "tiptap-image-upload-preview"
|
|
111
111
|
}, [
|
|
112
|
-
|
|
112
|
+
C.status === "uploading" ? (Z(), R("div", {
|
|
113
113
|
key: 0,
|
|
114
114
|
class: "tiptap-image-upload-progress",
|
|
115
|
-
style:
|
|
116
|
-
}, null, 4)) :
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
style: He({ width: `${C.progress}%` })
|
|
116
|
+
}, null, 4)) : oe("", !0),
|
|
117
|
+
L("div", n1, [
|
|
118
|
+
L("span", o1, N(C.file.name), 1),
|
|
119
|
+
L("span", i1, N(C.status === "uploading" ? `${C.progress}%` : C.status === "error" ? "上传失败" : "上传成功"), 1),
|
|
120
|
+
L("button", {
|
|
121
121
|
class: "tiptap-image-upload-remove",
|
|
122
|
-
onClick:
|
|
123
|
-
}, "×", 8,
|
|
122
|
+
onClick: X((x) => A(C.id), ["stop"])
|
|
123
|
+
}, "×", 8, r1)
|
|
124
124
|
])
|
|
125
125
|
]))), 128))
|
|
126
126
|
])) : (Z(), R("div", {
|
|
127
127
|
key: 0,
|
|
128
|
-
class:
|
|
129
|
-
onDragover:
|
|
130
|
-
onDragleave:
|
|
131
|
-
onDrop:
|
|
128
|
+
class: ne(["tiptap-image-upload-drag-area", { "drag-active": f.value }]),
|
|
129
|
+
onDragover: a,
|
|
130
|
+
onDragleave: m,
|
|
131
|
+
onDrop: b
|
|
132
132
|
}, [
|
|
133
|
-
|
|
134
|
-
p[1] || (p[1] =
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
L("div", e1, [
|
|
134
|
+
p[1] || (p[1] = L("span", { class: "tiptap-image-upload-text" }, [
|
|
135
|
+
L("em", null, "点击上传"),
|
|
136
|
+
H(" 或拖拽图片到此处")
|
|
137
137
|
], -1)),
|
|
138
|
-
|
|
138
|
+
L("span", t1, " 最多 " + N(r.value) + " 个文件" + N(s.value ? `,每个不超过 ${s.value / 1024 / 1024}MB` : ""), 1)
|
|
139
139
|
])
|
|
140
140
|
], 34)),
|
|
141
|
-
|
|
141
|
+
L("input", {
|
|
142
142
|
ref_key: "inputRef",
|
|
143
|
-
ref:
|
|
143
|
+
ref: v,
|
|
144
144
|
type: "file",
|
|
145
145
|
accept: n.value,
|
|
146
|
-
multiple:
|
|
147
|
-
onChange:
|
|
148
|
-
onClick: p[0] || (p[0] =
|
|
146
|
+
multiple: r.value > 1,
|
|
147
|
+
onChange: i,
|
|
148
|
+
onClick: p[0] || (p[0] = X(() => {
|
|
149
149
|
}, ["stop"]))
|
|
150
|
-
}, null, 40,
|
|
150
|
+
}, null, 40, u1)
|
|
151
151
|
]),
|
|
152
152
|
_: 1
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
155
|
-
}),
|
|
155
|
+
}), s1 = Ke.create({
|
|
156
156
|
name: "imageUpload",
|
|
157
157
|
group: "block",
|
|
158
158
|
draggable: !0,
|
|
@@ -194,12 +194,12 @@ const Qe = Re.extend({
|
|
|
194
194
|
renderHTML({
|
|
195
195
|
HTMLAttributes: t
|
|
196
196
|
}) {
|
|
197
|
-
return ["div",
|
|
197
|
+
return ["div", qe({
|
|
198
198
|
"data-type": "image-upload"
|
|
199
199
|
}, t)];
|
|
200
200
|
},
|
|
201
201
|
addNodeView() {
|
|
202
|
-
return Ae(
|
|
202
|
+
return Ae(a1);
|
|
203
203
|
},
|
|
204
204
|
addCommands() {
|
|
205
205
|
return {
|
|
@@ -221,18 +221,18 @@ const Qe = Re.extend({
|
|
|
221
221
|
nodeAfter: n
|
|
222
222
|
} = l.$from;
|
|
223
223
|
if (n?.type.name === "imageUpload" && t.isActive("imageUpload")) {
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
return
|
|
224
|
+
const r = t.view.nodeDOM(l.$from.pos);
|
|
225
|
+
if (r instanceof HTMLElement) {
|
|
226
|
+
const s = r.firstChild;
|
|
227
|
+
if (s instanceof HTMLElement)
|
|
228
|
+
return s.click(), !0;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
return !1;
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
}),
|
|
235
|
+
}), c1 = {
|
|
236
236
|
icon: {
|
|
237
237
|
type: Object,
|
|
238
238
|
required: !0
|
|
@@ -251,16 +251,16 @@ const Qe = Re.extend({
|
|
|
251
251
|
onClick: {
|
|
252
252
|
type: Function
|
|
253
253
|
}
|
|
254
|
-
},
|
|
254
|
+
}, w = /* @__PURE__ */ d({
|
|
255
255
|
name: "IconButton",
|
|
256
|
-
props:
|
|
256
|
+
props: c1,
|
|
257
257
|
setup(t) {
|
|
258
|
-
return () => e(
|
|
258
|
+
return () => e($, {
|
|
259
259
|
showArrow: !1,
|
|
260
260
|
offset: 6,
|
|
261
261
|
content: t.tooltip
|
|
262
262
|
}, {
|
|
263
|
-
default: () => [e(
|
|
263
|
+
default: () => [e(U, {
|
|
264
264
|
text: !0,
|
|
265
265
|
icon: t.icon,
|
|
266
266
|
class: ["tiptap-button", {
|
|
@@ -271,12 +271,12 @@ const Qe = Re.extend({
|
|
|
271
271
|
}, null)]
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
}),
|
|
274
|
+
}), d1 = /* @__PURE__ */ d({
|
|
275
275
|
name: "UndoIcon",
|
|
276
276
|
setup(t, {
|
|
277
277
|
attrs: l
|
|
278
278
|
}) {
|
|
279
|
-
return () => e("svg",
|
|
279
|
+
return () => e("svg", k({
|
|
280
280
|
width: "24",
|
|
281
281
|
height: "24",
|
|
282
282
|
viewBox: "0 0 24 24",
|
|
@@ -289,12 +289,12 @@ const Qe = Re.extend({
|
|
|
289
289
|
fill: "currentColor"
|
|
290
290
|
}, null)]);
|
|
291
291
|
}
|
|
292
|
-
}),
|
|
292
|
+
}), p1 = /* @__PURE__ */ d({
|
|
293
293
|
name: "RedoIcon",
|
|
294
294
|
setup(t, {
|
|
295
295
|
attrs: l
|
|
296
296
|
}) {
|
|
297
|
-
return () => e("svg",
|
|
297
|
+
return () => e("svg", k({
|
|
298
298
|
width: "24",
|
|
299
299
|
height: "24",
|
|
300
300
|
viewBox: "0 0 24 24",
|
|
@@ -307,28 +307,28 @@ const Qe = Re.extend({
|
|
|
307
307
|
fill: "currentColor"
|
|
308
308
|
}, null)]);
|
|
309
309
|
}
|
|
310
|
-
}),
|
|
310
|
+
}), C1 = /* @__PURE__ */ d({
|
|
311
311
|
name: "UndoRedoButton",
|
|
312
312
|
setup() {
|
|
313
|
-
const t =
|
|
314
|
-
return () => e("div", null, [e(
|
|
315
|
-
icon:
|
|
313
|
+
const t = M("editor"), l = S(() => t?.value?.can().undo() ?? !1), n = S(() => t?.value?.can().redo() ?? !1);
|
|
314
|
+
return () => e("div", null, [e(w, {
|
|
315
|
+
icon: d1,
|
|
316
316
|
tooltip: "撤销",
|
|
317
317
|
disabled: !l.value,
|
|
318
318
|
onClick: () => t?.value?.chain().focus().undo().run()
|
|
319
|
-
}, null), e(
|
|
320
|
-
icon:
|
|
319
|
+
}, null), e(w, {
|
|
320
|
+
icon: p1,
|
|
321
321
|
tooltip: "重做",
|
|
322
322
|
disabled: !n.value,
|
|
323
323
|
onClick: () => t?.value?.chain().focus().redo().run()
|
|
324
324
|
}, null)]);
|
|
325
325
|
}
|
|
326
|
-
}),
|
|
326
|
+
}), v1 = /* @__PURE__ */ d({
|
|
327
327
|
name: "LinkIcon",
|
|
328
328
|
setup(t, {
|
|
329
329
|
attrs: l
|
|
330
330
|
}) {
|
|
331
|
-
return () => e("svg",
|
|
331
|
+
return () => e("svg", k({
|
|
332
332
|
width: "24",
|
|
333
333
|
height: "24",
|
|
334
334
|
viewBox: "0 0 24 24",
|
|
@@ -342,12 +342,12 @@ const Qe = Re.extend({
|
|
|
342
342
|
fill: "currentColor"
|
|
343
343
|
}, null)]);
|
|
344
344
|
}
|
|
345
|
-
}),
|
|
345
|
+
}), f1 = /* @__PURE__ */ d({
|
|
346
346
|
name: "CornerDownLeftIcon",
|
|
347
347
|
setup(t, {
|
|
348
348
|
attrs: l
|
|
349
349
|
}) {
|
|
350
|
-
return () => e("svg",
|
|
350
|
+
return () => e("svg", k({
|
|
351
351
|
width: "24",
|
|
352
352
|
height: "24",
|
|
353
353
|
viewBox: "0 0 24 24",
|
|
@@ -363,12 +363,12 @@ const Qe = Re.extend({
|
|
|
363
363
|
d: "M20 4v7a4 4 0 0 1-4 4H4"
|
|
364
364
|
}, null)]);
|
|
365
365
|
}
|
|
366
|
-
}),
|
|
366
|
+
}), h1 = /* @__PURE__ */ d({
|
|
367
367
|
name: "ExternalLinkIcon",
|
|
368
368
|
setup(t, {
|
|
369
369
|
attrs: l
|
|
370
370
|
}) {
|
|
371
|
-
return () => e("svg",
|
|
371
|
+
return () => e("svg", k({
|
|
372
372
|
width: "24",
|
|
373
373
|
height: "24",
|
|
374
374
|
viewBox: "0 0 24 24",
|
|
@@ -389,12 +389,12 @@ const Qe = Re.extend({
|
|
|
389
389
|
y2: "3"
|
|
390
390
|
}, null)]);
|
|
391
391
|
}
|
|
392
|
-
}),
|
|
392
|
+
}), m1 = /* @__PURE__ */ d({
|
|
393
393
|
name: "TrashIcon",
|
|
394
394
|
setup(t, {
|
|
395
395
|
attrs: l
|
|
396
396
|
}) {
|
|
397
|
-
return () => e("svg",
|
|
397
|
+
return () => e("svg", k({
|
|
398
398
|
width: "24",
|
|
399
399
|
height: "24",
|
|
400
400
|
viewBox: "0 0 24 24",
|
|
@@ -410,52 +410,52 @@ const Qe = Re.extend({
|
|
|
410
410
|
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"
|
|
411
411
|
}, null)]);
|
|
412
412
|
}
|
|
413
|
-
}),
|
|
413
|
+
}), g1 = /* @__PURE__ */ d({
|
|
414
414
|
name: "LinkPopover",
|
|
415
415
|
setup() {
|
|
416
|
-
const t =
|
|
417
|
-
let
|
|
418
|
-
|
|
419
|
-
|
|
416
|
+
const t = M("editor"), l = B(!1), n = B("");
|
|
417
|
+
let r = !1;
|
|
418
|
+
z(() => t?.value?.isActive("link"), (o) => {
|
|
419
|
+
r || o && (n.value = t?.value?.getAttributes("link").href ?? "", W(() => {
|
|
420
420
|
l.value = !0;
|
|
421
421
|
}));
|
|
422
422
|
});
|
|
423
|
-
const
|
|
423
|
+
const s = () => {
|
|
424
424
|
const o = t?.value;
|
|
425
425
|
if (!o || !n.value) return;
|
|
426
|
-
|
|
426
|
+
r = !0;
|
|
427
427
|
const {
|
|
428
|
-
empty:
|
|
428
|
+
empty: i
|
|
429
429
|
} = o.state.selection;
|
|
430
|
-
let
|
|
430
|
+
let a = o.chain().focus().extendMarkRange("link").setLink({
|
|
431
431
|
href: n.value
|
|
432
432
|
});
|
|
433
|
-
|
|
433
|
+
i && (a = a.insertContent({
|
|
434
434
|
type: "text",
|
|
435
435
|
text: n.value
|
|
436
|
-
})),
|
|
437
|
-
|
|
436
|
+
})), a.run(), l.value = !1, W(() => {
|
|
437
|
+
r = !1;
|
|
438
438
|
});
|
|
439
439
|
}, u = () => {
|
|
440
440
|
const o = t?.value;
|
|
441
|
-
o && (
|
|
442
|
-
|
|
441
|
+
o && (r = !0, o.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", l.value = !1, W(() => {
|
|
442
|
+
r = !1;
|
|
443
443
|
}));
|
|
444
|
-
},
|
|
444
|
+
}, v = () => {
|
|
445
445
|
const o = t?.value?.getAttributes("link").href;
|
|
446
446
|
o && window.open(o, "_blank", "noopener,noreferrer");
|
|
447
|
-
}, m = (o) => {
|
|
448
|
-
o.key === "Enter" && (o.preventDefault(), a());
|
|
449
447
|
}, f = (o) => {
|
|
448
|
+
o.key === "Enter" && (o.preventDefault(), s());
|
|
449
|
+
}, h = (o) => {
|
|
450
450
|
o && (n.value = t?.value?.getAttributes("link").href ?? ""), l.value = o;
|
|
451
|
-
},
|
|
451
|
+
}, y = (o) => {
|
|
452
452
|
n.value = o;
|
|
453
453
|
};
|
|
454
454
|
return () => {
|
|
455
455
|
const o = t?.value?.isActive("link") ?? !1;
|
|
456
|
-
return e(
|
|
456
|
+
return e(re, {
|
|
457
457
|
visible: l.value,
|
|
458
|
-
"onUpdate:visible":
|
|
458
|
+
"onUpdate:visible": h,
|
|
459
459
|
placement: "bottom",
|
|
460
460
|
width: 300,
|
|
461
461
|
trigger: "click",
|
|
@@ -463,55 +463,55 @@ const Qe = Re.extend({
|
|
|
463
463
|
popperClass: "link-popover-popper",
|
|
464
464
|
offset: 6
|
|
465
465
|
}, {
|
|
466
|
-
reference: () => e("span", null, [e(
|
|
466
|
+
reference: () => e("span", null, [e(w, {
|
|
467
467
|
tooltip: "链接",
|
|
468
|
-
icon:
|
|
468
|
+
icon: v1,
|
|
469
469
|
class: ["tiptap-button", {
|
|
470
470
|
"is-active": o
|
|
471
471
|
}]
|
|
472
472
|
}, null)]),
|
|
473
473
|
default: () => e("div", {
|
|
474
474
|
class: "link-popover-inner"
|
|
475
|
-
}, [e(
|
|
475
|
+
}, [e(ue, {
|
|
476
476
|
modelValue: n.value,
|
|
477
|
-
"onUpdate:modelValue":
|
|
477
|
+
"onUpdate:modelValue": y,
|
|
478
478
|
type: "url",
|
|
479
479
|
placeholder: "请输入链接...",
|
|
480
480
|
size: "small",
|
|
481
481
|
autofocus: !0,
|
|
482
|
-
onKeydown:
|
|
482
|
+
onKeydown: f
|
|
483
483
|
}, null), e("div", {
|
|
484
484
|
class: "link-popover-actions"
|
|
485
|
-
}, [e(
|
|
485
|
+
}, [e($, {
|
|
486
486
|
content: "确认",
|
|
487
487
|
showArrow: !1,
|
|
488
488
|
offset: 4
|
|
489
489
|
}, {
|
|
490
|
-
default: () => [e(
|
|
490
|
+
default: () => [e(U, {
|
|
491
491
|
text: !0,
|
|
492
|
-
icon:
|
|
492
|
+
icon: f1,
|
|
493
493
|
disabled: !n.value,
|
|
494
|
-
onClick:
|
|
494
|
+
onClick: s
|
|
495
495
|
}, null)]
|
|
496
|
-
}), e(
|
|
496
|
+
}), e($, {
|
|
497
497
|
content: "在新标签页打开",
|
|
498
498
|
showArrow: !1,
|
|
499
499
|
offset: 4
|
|
500
500
|
}, {
|
|
501
|
-
default: () => [e(
|
|
501
|
+
default: () => [e(U, {
|
|
502
502
|
text: !0,
|
|
503
|
-
icon:
|
|
503
|
+
icon: h1,
|
|
504
504
|
disabled: !n.value && !o,
|
|
505
|
-
onClick:
|
|
505
|
+
onClick: v
|
|
506
506
|
}, null)]
|
|
507
|
-
}), e(
|
|
507
|
+
}), e($, {
|
|
508
508
|
content: "移除链接",
|
|
509
509
|
showArrow: !1,
|
|
510
510
|
offset: 4
|
|
511
511
|
}, {
|
|
512
|
-
default: () => [e(
|
|
512
|
+
default: () => [e(U, {
|
|
513
513
|
text: !0,
|
|
514
|
-
icon:
|
|
514
|
+
icon: m1,
|
|
515
515
|
disabled: !o,
|
|
516
516
|
onClick: u
|
|
517
517
|
}, null)]
|
|
@@ -519,12 +519,12 @@ const Qe = Re.extend({
|
|
|
519
519
|
});
|
|
520
520
|
};
|
|
521
521
|
}
|
|
522
|
-
}),
|
|
522
|
+
}), ae = /* @__PURE__ */ d({
|
|
523
523
|
name: "BoldIcon",
|
|
524
524
|
setup(t, {
|
|
525
525
|
attrs: l
|
|
526
526
|
}) {
|
|
527
|
-
return () => e("svg",
|
|
527
|
+
return () => e("svg", k({
|
|
528
528
|
width: "24",
|
|
529
529
|
height: "24",
|
|
530
530
|
viewBox: "0 0 24 24",
|
|
@@ -537,12 +537,12 @@ const Qe = Re.extend({
|
|
|
537
537
|
fill: "currentColor"
|
|
538
538
|
}, null)]);
|
|
539
539
|
}
|
|
540
|
-
}),
|
|
540
|
+
}), se = /* @__PURE__ */ d({
|
|
541
541
|
name: "ItalicIcon",
|
|
542
542
|
setup(t, {
|
|
543
543
|
attrs: l
|
|
544
544
|
}) {
|
|
545
|
-
return () => e("svg",
|
|
545
|
+
return () => e("svg", k({
|
|
546
546
|
width: "24",
|
|
547
547
|
height: "24",
|
|
548
548
|
viewBox: "0 0 24 24",
|
|
@@ -553,12 +553,12 @@ const Qe = Re.extend({
|
|
|
553
553
|
fill: "currentColor"
|
|
554
554
|
}, null)]);
|
|
555
555
|
}
|
|
556
|
-
}),
|
|
556
|
+
}), ce = /* @__PURE__ */ d({
|
|
557
557
|
name: "StrikeIcon",
|
|
558
558
|
setup(t, {
|
|
559
559
|
attrs: l
|
|
560
560
|
}) {
|
|
561
|
-
return () => e("svg",
|
|
561
|
+
return () => e("svg", k({
|
|
562
562
|
width: "24",
|
|
563
563
|
height: "24",
|
|
564
564
|
viewBox: "0 0 24 24",
|
|
@@ -572,12 +572,12 @@ const Qe = Re.extend({
|
|
|
572
572
|
fill: "currentColor"
|
|
573
573
|
}, null)]);
|
|
574
574
|
}
|
|
575
|
-
}),
|
|
575
|
+
}), de = /* @__PURE__ */ d({
|
|
576
576
|
name: "UnderlineIcon",
|
|
577
577
|
setup(t, {
|
|
578
578
|
attrs: l
|
|
579
579
|
}) {
|
|
580
|
-
return () => e("svg",
|
|
580
|
+
return () => e("svg", k({
|
|
581
581
|
width: "24",
|
|
582
582
|
height: "24",
|
|
583
583
|
viewBox: "0 0 24 24",
|
|
@@ -590,38 +590,38 @@ const Qe = Re.extend({
|
|
|
590
590
|
fill: "currentColor"
|
|
591
591
|
}, null)]);
|
|
592
592
|
}
|
|
593
|
-
}),
|
|
593
|
+
}), w1 = /* @__PURE__ */ d({
|
|
594
594
|
name: "TextStyleButton",
|
|
595
595
|
setup() {
|
|
596
|
-
const t =
|
|
597
|
-
return () => e("div", null, [e(
|
|
598
|
-
icon:
|
|
596
|
+
const t = M("editor");
|
|
597
|
+
return () => e("div", null, [e(w, {
|
|
598
|
+
icon: ae,
|
|
599
599
|
tooltip: "粗体",
|
|
600
600
|
isActive: t?.value?.isActive("bold"),
|
|
601
601
|
onClick: () => t?.value?.chain().focus().toggleBold().run()
|
|
602
|
-
}, null), e(
|
|
603
|
-
icon:
|
|
602
|
+
}, null), e(w, {
|
|
603
|
+
icon: se,
|
|
604
604
|
tooltip: "斜体",
|
|
605
605
|
isActive: t?.value?.isActive("italic"),
|
|
606
606
|
onClick: () => t?.value?.chain().focus().toggleItalic().run()
|
|
607
|
-
}, null), e(
|
|
608
|
-
icon:
|
|
607
|
+
}, null), e(w, {
|
|
608
|
+
icon: ce,
|
|
609
609
|
tooltip: "删除线",
|
|
610
610
|
isActive: t?.value?.isActive("strike"),
|
|
611
611
|
onClick: () => t?.value?.chain().focus().toggleStrike().run()
|
|
612
|
-
}, null), e(
|
|
613
|
-
icon:
|
|
612
|
+
}, null), e(w, {
|
|
613
|
+
icon: de,
|
|
614
614
|
tooltip: "下划线",
|
|
615
615
|
isActive: t?.value?.isActive("underline"),
|
|
616
616
|
onClick: () => t?.value?.chain().focus().toggleUnderline().run()
|
|
617
|
-
}, null), e(
|
|
617
|
+
}, null), e(g1, null, null)]);
|
|
618
618
|
}
|
|
619
|
-
}),
|
|
619
|
+
}), pe = /* @__PURE__ */ d({
|
|
620
620
|
name: "AlignLeftIcon",
|
|
621
621
|
setup(t, {
|
|
622
622
|
attrs: l
|
|
623
623
|
}) {
|
|
624
|
-
return () => e("svg",
|
|
624
|
+
return () => e("svg", k({
|
|
625
625
|
width: "24",
|
|
626
626
|
height: "24",
|
|
627
627
|
viewBox: "0 0 24 24",
|
|
@@ -644,12 +644,12 @@ const Qe = Re.extend({
|
|
|
644
644
|
fill: "currentColor"
|
|
645
645
|
}, null)]);
|
|
646
646
|
}
|
|
647
|
-
}),
|
|
647
|
+
}), Ce = /* @__PURE__ */ d({
|
|
648
648
|
name: "AlignCenterIcon",
|
|
649
649
|
setup(t, {
|
|
650
650
|
attrs: l
|
|
651
651
|
}) {
|
|
652
|
-
return () => e("svg",
|
|
652
|
+
return () => e("svg", k({
|
|
653
653
|
width: "24",
|
|
654
654
|
height: "24",
|
|
655
655
|
viewBox: "0 0 24 24",
|
|
@@ -672,12 +672,12 @@ const Qe = Re.extend({
|
|
|
672
672
|
fill: "currentColor"
|
|
673
673
|
}, null)]);
|
|
674
674
|
}
|
|
675
|
-
}),
|
|
675
|
+
}), ve = /* @__PURE__ */ d({
|
|
676
676
|
name: "AlignRightIcon",
|
|
677
677
|
setup(t, {
|
|
678
678
|
attrs: l
|
|
679
679
|
}) {
|
|
680
|
-
return () => e("svg",
|
|
680
|
+
return () => e("svg", k({
|
|
681
681
|
width: "24",
|
|
682
682
|
height: "24",
|
|
683
683
|
viewBox: "0 0 24 24",
|
|
@@ -700,12 +700,12 @@ const Qe = Re.extend({
|
|
|
700
700
|
fill: "currentColor"
|
|
701
701
|
}, null)]);
|
|
702
702
|
}
|
|
703
|
-
}),
|
|
703
|
+
}), k1 = /* @__PURE__ */ d({
|
|
704
704
|
name: "AlignJustifyIcon",
|
|
705
705
|
setup(t, {
|
|
706
706
|
attrs: l
|
|
707
707
|
}) {
|
|
708
|
-
return () => e("svg",
|
|
708
|
+
return () => e("svg", k({
|
|
709
709
|
width: "24",
|
|
710
710
|
height: "24",
|
|
711
711
|
viewBox: "0 0 24 24",
|
|
@@ -728,33 +728,33 @@ const Qe = Re.extend({
|
|
|
728
728
|
fill: "currentColor"
|
|
729
729
|
}, null)]);
|
|
730
730
|
}
|
|
731
|
-
}),
|
|
731
|
+
}), b1 = /* @__PURE__ */ d({
|
|
732
732
|
name: "TextAlignButton",
|
|
733
733
|
setup() {
|
|
734
|
-
const t =
|
|
735
|
-
return () => e("div", null, [e(
|
|
736
|
-
icon:
|
|
734
|
+
const t = M("editor");
|
|
735
|
+
return () => e("div", null, [e(w, {
|
|
736
|
+
icon: pe,
|
|
737
737
|
tooltip: "左边对齐",
|
|
738
738
|
isActive: t?.value?.isActive({
|
|
739
739
|
textAlign: "left"
|
|
740
740
|
}),
|
|
741
741
|
onClick: () => t?.value?.chain().focus().setTextAlign("left").run()
|
|
742
|
-
}, null), e(
|
|
743
|
-
icon:
|
|
742
|
+
}, null), e(w, {
|
|
743
|
+
icon: Ce,
|
|
744
744
|
tooltip: "中间对齐",
|
|
745
745
|
isActive: t?.value?.isActive({
|
|
746
746
|
textAlign: "center"
|
|
747
747
|
}),
|
|
748
748
|
onClick: () => t?.value?.chain().focus().setTextAlign("center").run()
|
|
749
|
-
}, null), e(
|
|
750
|
-
icon:
|
|
749
|
+
}, null), e(w, {
|
|
750
|
+
icon: ve,
|
|
751
751
|
tooltip: "右边对齐",
|
|
752
752
|
isActive: t?.value?.isActive({
|
|
753
753
|
textAlign: "right"
|
|
754
754
|
}),
|
|
755
755
|
onClick: () => t?.value?.chain().focus().setTextAlign("right").run()
|
|
756
|
-
}, null), e(
|
|
757
|
-
icon:
|
|
756
|
+
}, null), e(w, {
|
|
757
|
+
icon: k1,
|
|
758
758
|
tooltip: "两端对齐",
|
|
759
759
|
isActive: t?.value?.isActive({
|
|
760
760
|
textAlign: "justify"
|
|
@@ -762,12 +762,12 @@ const Qe = Re.extend({
|
|
|
762
762
|
onClick: () => t?.value?.chain().focus().setTextAlign("justify").run()
|
|
763
763
|
}, null)]);
|
|
764
764
|
}
|
|
765
|
-
}),
|
|
765
|
+
}), x1 = /* @__PURE__ */ d({
|
|
766
766
|
name: "ListIcon",
|
|
767
767
|
setup(t, {
|
|
768
768
|
attrs: l
|
|
769
769
|
}) {
|
|
770
|
-
return () => e("svg",
|
|
770
|
+
return () => e("svg", k({
|
|
771
771
|
width: "24",
|
|
772
772
|
height: "24",
|
|
773
773
|
viewBox: "0 0 24 24",
|
|
@@ -805,12 +805,12 @@ const Qe = Re.extend({
|
|
|
805
805
|
fill: "currentColor"
|
|
806
806
|
}, null)]);
|
|
807
807
|
}
|
|
808
|
-
}),
|
|
808
|
+
}), H1 = /* @__PURE__ */ d({
|
|
809
809
|
name: "ListOrderedIcon",
|
|
810
810
|
setup(t, {
|
|
811
811
|
attrs: l
|
|
812
812
|
}) {
|
|
813
|
-
return () => e("svg",
|
|
813
|
+
return () => e("svg", k({
|
|
814
814
|
width: "24",
|
|
815
815
|
height: "24",
|
|
816
816
|
viewBox: "0 0 24 24",
|
|
@@ -848,12 +848,12 @@ const Qe = Re.extend({
|
|
|
848
848
|
fill: "currentColor"
|
|
849
849
|
}, null)]);
|
|
850
850
|
}
|
|
851
|
-
}),
|
|
851
|
+
}), y1 = /* @__PURE__ */ d({
|
|
852
852
|
name: "ListTodoIcon",
|
|
853
853
|
setup(t, {
|
|
854
854
|
attrs: l
|
|
855
855
|
}) {
|
|
856
|
-
return () => e("svg",
|
|
856
|
+
return () => e("svg", k({
|
|
857
857
|
width: "24",
|
|
858
858
|
height: "24",
|
|
859
859
|
viewBox: "0 0 24 24",
|
|
@@ -886,33 +886,33 @@ const Qe = Re.extend({
|
|
|
886
886
|
fill: "currentColor"
|
|
887
887
|
}, null)]);
|
|
888
888
|
}
|
|
889
|
-
}), B1 = /* @__PURE__ */
|
|
889
|
+
}), B1 = /* @__PURE__ */ d({
|
|
890
890
|
name: "ListButton",
|
|
891
891
|
setup() {
|
|
892
|
-
const t =
|
|
893
|
-
return () => e("div", null, [e(
|
|
894
|
-
icon:
|
|
892
|
+
const t = M("editor");
|
|
893
|
+
return () => e("div", null, [e(w, {
|
|
894
|
+
icon: x1,
|
|
895
895
|
tooltip: "无序列表",
|
|
896
896
|
isActive: t?.value?.isActive("bulletList"),
|
|
897
897
|
onClick: () => t?.value?.chain().focus().toggleBulletList().run()
|
|
898
|
-
}, null), e(
|
|
899
|
-
icon:
|
|
898
|
+
}, null), e(w, {
|
|
899
|
+
icon: H1,
|
|
900
900
|
tooltip: "有序列表",
|
|
901
901
|
isActive: t?.value?.isActive("orderedList"),
|
|
902
902
|
onClick: () => t?.value?.chain().focus().toggleOrderedList().run()
|
|
903
|
-
}, null), e(
|
|
904
|
-
icon:
|
|
903
|
+
}, null), e(w, {
|
|
904
|
+
icon: y1,
|
|
905
905
|
tooltip: "任务列表",
|
|
906
906
|
isActive: t?.value?.isActive("taskList"),
|
|
907
907
|
onClick: () => t?.value?.chain().focus().toggleTaskList().run()
|
|
908
908
|
}, null)]);
|
|
909
909
|
}
|
|
910
|
-
}), M1 = /* @__PURE__ */
|
|
910
|
+
}), M1 = /* @__PURE__ */ d({
|
|
911
911
|
name: "ImagePlusIcon",
|
|
912
912
|
setup(t, {
|
|
913
913
|
attrs: l
|
|
914
914
|
}) {
|
|
915
|
-
return () => e("svg",
|
|
915
|
+
return () => e("svg", k({
|
|
916
916
|
width: "24",
|
|
917
917
|
height: "24",
|
|
918
918
|
viewBox: "0 0 24 24",
|
|
@@ -925,22 +925,22 @@ const Qe = Re.extend({
|
|
|
925
925
|
fill: "currentColor"
|
|
926
926
|
}, null)]);
|
|
927
927
|
}
|
|
928
|
-
}), A1 = /* @__PURE__ */
|
|
928
|
+
}), A1 = /* @__PURE__ */ d({
|
|
929
929
|
name: "ImageButton",
|
|
930
930
|
setup() {
|
|
931
|
-
const t =
|
|
932
|
-
return () => e("div", null, [e(
|
|
931
|
+
const t = M("editor");
|
|
932
|
+
return () => e("div", null, [e(w, {
|
|
933
933
|
icon: M1,
|
|
934
934
|
tooltip: "图片",
|
|
935
935
|
onClick: () => t?.value?.commands.setImageUploadNode()
|
|
936
936
|
}, null)]);
|
|
937
937
|
}
|
|
938
|
-
}),
|
|
938
|
+
}), L1 = /* @__PURE__ */ d({
|
|
939
939
|
name: "TableIcon",
|
|
940
940
|
setup(t, {
|
|
941
941
|
attrs: l
|
|
942
942
|
}) {
|
|
943
|
-
return () => e("svg",
|
|
943
|
+
return () => e("svg", k({
|
|
944
944
|
width: "24",
|
|
945
945
|
height: "24",
|
|
946
946
|
viewBox: "0 0 24 24",
|
|
@@ -953,42 +953,42 @@ const Qe = Re.extend({
|
|
|
953
953
|
fill: "currentColor"
|
|
954
954
|
}, null)]);
|
|
955
955
|
}
|
|
956
|
-
}),
|
|
956
|
+
}), I1 = 8, E1 = 8, V1 = /* @__PURE__ */ d({
|
|
957
957
|
name: "TableButton",
|
|
958
958
|
setup() {
|
|
959
|
-
const t =
|
|
960
|
-
n.value =
|
|
959
|
+
const t = M("editor"), l = B(!1), n = B(0), r = B(0), s = (f, h) => {
|
|
960
|
+
n.value = f, r.value = h;
|
|
961
961
|
}, u = () => {
|
|
962
|
-
n.value = 0,
|
|
963
|
-
},
|
|
962
|
+
n.value = 0, r.value = 0;
|
|
963
|
+
}, v = (f, h) => {
|
|
964
964
|
t?.value?.chain().focus().insertTable({
|
|
965
|
-
rows:
|
|
966
|
-
cols:
|
|
965
|
+
rows: h,
|
|
966
|
+
cols: f,
|
|
967
967
|
withHeaderRow: !0
|
|
968
968
|
}).run(), l.value = !1;
|
|
969
969
|
};
|
|
970
|
-
return () => e(
|
|
970
|
+
return () => e(re, {
|
|
971
971
|
visible: l.value,
|
|
972
|
-
"onUpdate:visible": (
|
|
972
|
+
"onUpdate:visible": (f) => l.value = f,
|
|
973
973
|
trigger: "click",
|
|
974
974
|
placement: "bottom-start",
|
|
975
975
|
popperClass: "table-picker-popper",
|
|
976
976
|
width: "auto",
|
|
977
977
|
showArrow: !1
|
|
978
978
|
}, {
|
|
979
|
-
reference: () => e("span", null, [e(
|
|
979
|
+
reference: () => e("span", null, [e($, {
|
|
980
980
|
content: "表格",
|
|
981
981
|
showArrow: !1,
|
|
982
982
|
offset: 6,
|
|
983
983
|
disabled: l.value
|
|
984
984
|
}, {
|
|
985
|
-
default: () => [e(
|
|
985
|
+
default: () => [e(U, {
|
|
986
986
|
text: !0,
|
|
987
987
|
class: ["tiptap-button", {
|
|
988
988
|
"is-active": l.value
|
|
989
989
|
}]
|
|
990
990
|
}, {
|
|
991
|
-
default: () => [e(
|
|
991
|
+
default: () => [e(L1, {
|
|
992
992
|
class: "tiptap-button-icon"
|
|
993
993
|
}, null)]
|
|
994
994
|
})]
|
|
@@ -999,32 +999,32 @@ const Qe = Re.extend({
|
|
|
999
999
|
class: "table-picker-grid",
|
|
1000
1000
|
onMouseleave: u
|
|
1001
1001
|
}, [Array.from({
|
|
1002
|
-
length:
|
|
1003
|
-
}, (
|
|
1004
|
-
key:
|
|
1002
|
+
length: E1
|
|
1003
|
+
}, (f, h) => e("div", {
|
|
1004
|
+
key: h,
|
|
1005
1005
|
class: "table-picker-row"
|
|
1006
1006
|
}, [Array.from({
|
|
1007
|
-
length:
|
|
1008
|
-
}, (
|
|
1007
|
+
length: I1
|
|
1008
|
+
}, (y, o) => e("div", {
|
|
1009
1009
|
key: o,
|
|
1010
1010
|
class: ["table-picker-cell", {
|
|
1011
|
-
"is-active": o < n.value &&
|
|
1011
|
+
"is-active": o < n.value && h < r.value
|
|
1012
1012
|
}],
|
|
1013
|
-
onMouseenter: () =>
|
|
1014
|
-
onClick: () =>
|
|
1013
|
+
onMouseenter: () => s(o + 1, h + 1),
|
|
1014
|
+
onClick: () => v(o + 1, h + 1)
|
|
1015
1015
|
}, null))]))]), e("div", {
|
|
1016
1016
|
class: "table-picker-footer"
|
|
1017
1017
|
}, [e("div", {
|
|
1018
1018
|
class: "table-picker-counter"
|
|
1019
|
-
}, [e("span", null, [
|
|
1019
|
+
}, [e("span", null, [H("列")]), e("span", null, [n.value || 1])]), e("span", {
|
|
1020
1020
|
class: "table-picker-x"
|
|
1021
|
-
}, [
|
|
1021
|
+
}, [H("x")]), e("div", {
|
|
1022
1022
|
class: "table-picker-counter"
|
|
1023
|
-
}, [e("span", null, [
|
|
1023
|
+
}, [e("span", null, [H("行")]), e("span", null, [r.value || 1])])])])
|
|
1024
1024
|
});
|
|
1025
1025
|
}
|
|
1026
1026
|
});
|
|
1027
|
-
function
|
|
1027
|
+
function T1(t) {
|
|
1028
1028
|
let l = t.nodeType === Node.TEXT_NODE ? t.parentElement : t;
|
|
1029
1029
|
for (; l && l instanceof HTMLElement; ) {
|
|
1030
1030
|
if (l.tagName === "TD" || l.tagName === "TH") return l;
|
|
@@ -1032,106 +1032,106 @@ function V1(t) {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
return null;
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function Z1(t) {
|
|
1036
1036
|
if (!t.isActive("tableCell") && !t.isActive("tableHeader")) return null;
|
|
1037
1037
|
const {
|
|
1038
1038
|
node: l
|
|
1039
|
-
} = t.view.domAtPos(t.state.selection.from), n =
|
|
1039
|
+
} = t.view.domAtPos(t.state.selection.from), n = T1(l);
|
|
1040
1040
|
if (!n) return null;
|
|
1041
|
-
const
|
|
1041
|
+
const r = n.parentElement, s = r.parentElement, u = n.closest("table");
|
|
1042
1042
|
if (!u) return null;
|
|
1043
|
-
const
|
|
1043
|
+
const v = Array.from(r.children).indexOf(n), f = Array.from(s.children).indexOf(r), h = r.children.length, y = s.children.length, o = n.getBoundingClientRect(), i = u.getBoundingClientRect(), a = t.view.dom.closest(".tiptap-editor").getBoundingClientRect();
|
|
1044
1044
|
return {
|
|
1045
1045
|
cell: n,
|
|
1046
|
-
colIndex:
|
|
1047
|
-
rowIndex:
|
|
1048
|
-
totalCols:
|
|
1049
|
-
totalRows:
|
|
1046
|
+
colIndex: v,
|
|
1047
|
+
rowIndex: f,
|
|
1048
|
+
totalCols: h,
|
|
1049
|
+
totalRows: y,
|
|
1050
1050
|
cellRect: o,
|
|
1051
|
-
tableRect:
|
|
1052
|
-
editorRect:
|
|
1051
|
+
tableRect: i,
|
|
1052
|
+
editorRect: a
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function te(t) {
|
|
1056
1056
|
const {
|
|
1057
1057
|
state: l
|
|
1058
1058
|
} = t, n = l.selection.from;
|
|
1059
|
-
let
|
|
1060
|
-
return l.doc.nodesBetween(0, l.doc.content.size, (
|
|
1061
|
-
if (
|
|
1062
|
-
return
|
|
1063
|
-
node:
|
|
1059
|
+
let r = null;
|
|
1060
|
+
return l.doc.nodesBetween(0, l.doc.content.size, (s, u) => {
|
|
1061
|
+
if (s.type.name === "table" && u <= n && n <= u + s.nodeSize)
|
|
1062
|
+
return r = {
|
|
1063
|
+
node: s,
|
|
1064
1064
|
pos: u
|
|
1065
1065
|
}, !1;
|
|
1066
|
-
}),
|
|
1066
|
+
}), r;
|
|
1067
1067
|
}
|
|
1068
|
-
const
|
|
1068
|
+
const F1 = /* @__PURE__ */ d({
|
|
1069
1069
|
name: "TableControls",
|
|
1070
1070
|
setup() {
|
|
1071
|
-
const t =
|
|
1072
|
-
function
|
|
1073
|
-
const
|
|
1074
|
-
if (
|
|
1075
|
-
|
|
1071
|
+
const t = M("editor"), l = M("readonly"), n = B(null), r = B(null);
|
|
1072
|
+
function s() {
|
|
1073
|
+
const o = t?.value;
|
|
1074
|
+
if (r.value && (r.value.classList.remove("tcc-cell-focused"), r.value = null), !o) {
|
|
1075
|
+
n.value = null;
|
|
1076
1076
|
return;
|
|
1077
1077
|
}
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1078
|
+
const i = Z1(o);
|
|
1079
|
+
n.value = i, i && (i.cell.classList.add("tcc-cell-focused"), r.value = i.cell);
|
|
1080
1080
|
}
|
|
1081
|
-
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1081
|
+
ie((o) => {
|
|
1082
|
+
const i = t?.value;
|
|
1083
|
+
i && (i.on("selectionUpdate", s), i.on("transaction", s), o(() => {
|
|
1084
|
+
i.off("selectionUpdate", s), i.off("transaction", s), r.value && (r.value.classList.remove("tcc-cell-focused"), r.value = null);
|
|
1085
1085
|
}));
|
|
1086
1086
|
});
|
|
1087
|
-
function
|
|
1088
|
-
const
|
|
1089
|
-
if (!
|
|
1087
|
+
function u(o) {
|
|
1088
|
+
const i = t?.value;
|
|
1089
|
+
if (!i || !n.value) return;
|
|
1090
1090
|
const {
|
|
1091
|
-
colIndex:
|
|
1092
|
-
totalCols:
|
|
1093
|
-
} =
|
|
1094
|
-
if (
|
|
1095
|
-
const
|
|
1096
|
-
if (!
|
|
1091
|
+
colIndex: a,
|
|
1092
|
+
totalCols: m
|
|
1093
|
+
} = n.value, b = o === "left" ? a - 1 : a + 1;
|
|
1094
|
+
if (b < 0 || b >= m) return;
|
|
1095
|
+
const A = te(i);
|
|
1096
|
+
if (!A) return;
|
|
1097
1097
|
const {
|
|
1098
|
-
node:
|
|
1099
|
-
pos:
|
|
1100
|
-
} =
|
|
1101
|
-
|
|
1102
|
-
if (
|
|
1103
|
-
|
|
1098
|
+
node: c,
|
|
1099
|
+
pos: p
|
|
1100
|
+
} = A, C = [];
|
|
1101
|
+
c.forEach((E) => {
|
|
1102
|
+
if (E.type.name !== "tableRow") {
|
|
1103
|
+
C.push(E);
|
|
1104
1104
|
return;
|
|
1105
1105
|
}
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1106
|
+
const V = [];
|
|
1107
|
+
E.forEach((P) => V.push(P));
|
|
1108
|
+
const O = V[a];
|
|
1109
|
+
V[a] = V[b], V[b] = O, C.push(E.type.create(E.attrs, V, E.marks));
|
|
1110
1110
|
});
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1111
|
+
const x = c.type.create(c.attrs, C, c.marks), I = i.state.tr.replaceWith(p, p + c.nodeSize, x);
|
|
1112
|
+
i.view.dispatch(I);
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1115
|
-
const
|
|
1116
|
-
if (!
|
|
1114
|
+
function v(o) {
|
|
1115
|
+
const i = t?.value;
|
|
1116
|
+
if (!i || !n.value) return;
|
|
1117
1117
|
const {
|
|
1118
|
-
rowIndex:
|
|
1119
|
-
totalRows:
|
|
1120
|
-
} =
|
|
1121
|
-
if (
|
|
1122
|
-
const
|
|
1123
|
-
if (!
|
|
1118
|
+
rowIndex: a,
|
|
1119
|
+
totalRows: m
|
|
1120
|
+
} = n.value, b = o === "up" ? a - 1 : a + 1;
|
|
1121
|
+
if (b < 0 || b >= m) return;
|
|
1122
|
+
const A = te(i);
|
|
1123
|
+
if (!A) return;
|
|
1124
1124
|
const {
|
|
1125
|
-
node:
|
|
1126
|
-
pos:
|
|
1127
|
-
} =
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1125
|
+
node: c,
|
|
1126
|
+
pos: p
|
|
1127
|
+
} = A, C = [];
|
|
1128
|
+
c.forEach((V) => C.push(V));
|
|
1129
|
+
const x = C[a];
|
|
1130
|
+
C[a] = C[b], C[b] = x;
|
|
1131
|
+
const I = c.type.create(c.attrs, C, c.marks), E = i.state.tr.replaceWith(p, p + c.nodeSize, I);
|
|
1132
|
+
i.view.dispatch(E);
|
|
1133
1133
|
}
|
|
1134
|
-
const
|
|
1134
|
+
const f = () => e("svg", {
|
|
1135
1135
|
width: "16",
|
|
1136
1136
|
height: "4",
|
|
1137
1137
|
viewBox: "0 0 16 4",
|
|
@@ -1148,7 +1148,7 @@ const Z1 = /* @__PURE__ */ c({
|
|
|
1148
1148
|
cx: "14",
|
|
1149
1149
|
cy: "2",
|
|
1150
1150
|
r: "1.5"
|
|
1151
|
-
}, null)]),
|
|
1151
|
+
}, null)]), h = () => e("svg", {
|
|
1152
1152
|
width: "4",
|
|
1153
1153
|
height: "16",
|
|
1154
1154
|
viewBox: "0 0 4 16",
|
|
@@ -1165,7 +1165,7 @@ const Z1 = /* @__PURE__ */ c({
|
|
|
1165
1165
|
cx: "2",
|
|
1166
1166
|
cy: "14",
|
|
1167
1167
|
r: "1.5"
|
|
1168
|
-
}, null)]),
|
|
1168
|
+
}, null)]), y = () => e("svg", {
|
|
1169
1169
|
width: "10",
|
|
1170
1170
|
height: "10",
|
|
1171
1171
|
viewBox: "0 0 10 10",
|
|
@@ -1177,126 +1177,127 @@ const Z1 = /* @__PURE__ */ c({
|
|
|
1177
1177
|
d: "M5 1v8M1 5h8"
|
|
1178
1178
|
}, null)]);
|
|
1179
1179
|
return () => {
|
|
1180
|
-
|
|
1181
|
-
|
|
1180
|
+
if (l?.value) return null;
|
|
1181
|
+
const o = n.value;
|
|
1182
|
+
if (!o) return null;
|
|
1182
1183
|
const {
|
|
1183
|
-
colIndex:
|
|
1184
|
-
rowIndex:
|
|
1185
|
-
totalCols:
|
|
1186
|
-
totalRows:
|
|
1187
|
-
cellRect:
|
|
1188
|
-
tableRect:
|
|
1189
|
-
editorRect:
|
|
1190
|
-
} =
|
|
1184
|
+
colIndex: i,
|
|
1185
|
+
rowIndex: a,
|
|
1186
|
+
totalCols: m,
|
|
1187
|
+
totalRows: b,
|
|
1188
|
+
cellRect: A,
|
|
1189
|
+
tableRect: c,
|
|
1190
|
+
editorRect: p
|
|
1191
|
+
} = o, C = c.top - p.top, x = c.left - p.left, I = c.right - p.left, E = c.bottom - p.top, V = A.left - p.left, O = A.top - p.top, P = A.width, q = A.height, fe = {
|
|
1191
1192
|
position: "absolute",
|
|
1192
|
-
top: `${
|
|
1193
|
-
left: `${
|
|
1194
|
-
},
|
|
1193
|
+
top: `${C - 20}px`,
|
|
1194
|
+
left: `${V + P / 2 - 18}px`
|
|
1195
|
+
}, he = {
|
|
1195
1196
|
position: "absolute",
|
|
1196
|
-
top: `${
|
|
1197
|
-
left: `${
|
|
1198
|
-
},
|
|
1197
|
+
top: `${O + q / 2 - 18}px`,
|
|
1198
|
+
left: `${x - 20}px`
|
|
1199
|
+
}, me = {
|
|
1199
1200
|
position: "absolute",
|
|
1200
|
-
top: `${
|
|
1201
|
-
left: `${
|
|
1202
|
-
},
|
|
1201
|
+
top: `${O + q / 2 - 12}px`,
|
|
1202
|
+
left: `${I + 6}px`
|
|
1203
|
+
}, ge = {
|
|
1203
1204
|
position: "absolute",
|
|
1204
|
-
top: `${
|
|
1205
|
-
left: `${
|
|
1206
|
-
},
|
|
1205
|
+
top: `${E + 6}px`,
|
|
1206
|
+
left: `${V + P / 2 - 12}px`
|
|
1207
|
+
}, we = i === 0, G = i === m - 1, ke = a === 0, J = a === b - 1, _ = t?.value;
|
|
1207
1208
|
return e("div", {
|
|
1208
1209
|
class: "table-cell-controls"
|
|
1209
|
-
}, [e(
|
|
1210
|
+
}, [e(Q, {
|
|
1210
1211
|
trigger: "click",
|
|
1211
1212
|
placement: "bottom",
|
|
1212
|
-
style:
|
|
1213
|
-
onCommand: (
|
|
1214
|
-
|
|
1213
|
+
style: fe,
|
|
1214
|
+
onCommand: (T) => {
|
|
1215
|
+
T === "move-left" ? u("left") : T === "move-right" ? u("right") : T === "insert-left" ? _?.chain().focus().addColumnBefore().run() : T === "insert-right" ? _?.chain().focus().addColumnAfter().run() : T === "delete" && _?.chain().focus().deleteColumn().run();
|
|
1215
1216
|
}
|
|
1216
1217
|
}, {
|
|
1217
1218
|
default: () => [e("button", {
|
|
1218
1219
|
class: "tcc-btn tcc-btn--col"
|
|
1219
|
-
}, [e(
|
|
1220
|
-
dropdown: () => e(
|
|
1221
|
-
default: () => [e(
|
|
1220
|
+
}, [e(f, null, null)])],
|
|
1221
|
+
dropdown: () => e(Y, null, {
|
|
1222
|
+
default: () => [e(F, {
|
|
1222
1223
|
command: "move-left",
|
|
1223
|
-
disabled:
|
|
1224
|
+
disabled: we
|
|
1224
1225
|
}, {
|
|
1225
|
-
default: () => [
|
|
1226
|
-
}), e(
|
|
1226
|
+
default: () => [H("移动列到左侧")]
|
|
1227
|
+
}), e(F, {
|
|
1227
1228
|
command: "move-right",
|
|
1228
|
-
disabled:
|
|
1229
|
+
disabled: G
|
|
1229
1230
|
}, {
|
|
1230
|
-
default: () => [
|
|
1231
|
-
}), e(
|
|
1231
|
+
default: () => [H("移动列到右侧")]
|
|
1232
|
+
}), e(F, {
|
|
1232
1233
|
command: "insert-left"
|
|
1233
1234
|
}, {
|
|
1234
|
-
default: () => [
|
|
1235
|
-
}), e(
|
|
1235
|
+
default: () => [H("在左侧插入一列")]
|
|
1236
|
+
}), e(F, {
|
|
1236
1237
|
command: "insert-right"
|
|
1237
1238
|
}, {
|
|
1238
|
-
default: () => [
|
|
1239
|
-
}), e(
|
|
1239
|
+
default: () => [H("在右侧插入一列")]
|
|
1240
|
+
}), e(F, {
|
|
1240
1241
|
command: "delete",
|
|
1241
1242
|
divided: !0
|
|
1242
1243
|
}, {
|
|
1243
|
-
default: () => [
|
|
1244
|
+
default: () => [H("删除列")]
|
|
1244
1245
|
})]
|
|
1245
1246
|
})
|
|
1246
|
-
}), e(
|
|
1247
|
+
}), e(Q, {
|
|
1247
1248
|
trigger: "click",
|
|
1248
1249
|
placement: "right",
|
|
1249
|
-
style:
|
|
1250
|
-
onCommand: (
|
|
1251
|
-
|
|
1250
|
+
style: he,
|
|
1251
|
+
onCommand: (T) => {
|
|
1252
|
+
T === "move-up" ? v("up") : T === "move-down" ? v("down") : T === "insert-above" ? _?.chain().focus().addRowBefore().run() : T === "insert-below" ? _?.chain().focus().addRowAfter().run() : T === "delete" && _?.chain().focus().deleteRow().run();
|
|
1252
1253
|
}
|
|
1253
1254
|
}, {
|
|
1254
1255
|
default: () => [e("button", {
|
|
1255
1256
|
class: "tcc-btn tcc-btn--row"
|
|
1256
|
-
}, [e(
|
|
1257
|
-
dropdown: () => e(
|
|
1258
|
-
default: () => [e(
|
|
1257
|
+
}, [e(h, null, null)])],
|
|
1258
|
+
dropdown: () => e(Y, null, {
|
|
1259
|
+
default: () => [e(F, {
|
|
1259
1260
|
command: "move-up",
|
|
1260
|
-
disabled:
|
|
1261
|
+
disabled: ke
|
|
1261
1262
|
}, {
|
|
1262
|
-
default: () => [
|
|
1263
|
-
}), e(
|
|
1263
|
+
default: () => [H("上移")]
|
|
1264
|
+
}), e(F, {
|
|
1264
1265
|
command: "move-down",
|
|
1265
|
-
disabled:
|
|
1266
|
+
disabled: J
|
|
1266
1267
|
}, {
|
|
1267
|
-
default: () => [
|
|
1268
|
-
}), e(
|
|
1268
|
+
default: () => [H("下移")]
|
|
1269
|
+
}), e(F, {
|
|
1269
1270
|
command: "insert-above"
|
|
1270
1271
|
}, {
|
|
1271
|
-
default: () => [
|
|
1272
|
-
}), e(
|
|
1272
|
+
default: () => [H("在上方插入一行")]
|
|
1273
|
+
}), e(F, {
|
|
1273
1274
|
command: "insert-below"
|
|
1274
1275
|
}, {
|
|
1275
|
-
default: () => [
|
|
1276
|
-
}), e(
|
|
1276
|
+
default: () => [H("在下方插入一行")]
|
|
1277
|
+
}), e(F, {
|
|
1277
1278
|
command: "delete",
|
|
1278
1279
|
divided: !0
|
|
1279
1280
|
}, {
|
|
1280
|
-
default: () => [
|
|
1281
|
+
default: () => [H("删除行")]
|
|
1281
1282
|
})]
|
|
1282
1283
|
})
|
|
1283
|
-
}),
|
|
1284
|
+
}), G && e("button", {
|
|
1284
1285
|
class: "tcc-btn tcc-btn--add",
|
|
1285
|
-
style:
|
|
1286
|
-
onClick: () =>
|
|
1287
|
-
}, [e(
|
|
1286
|
+
style: me,
|
|
1287
|
+
onClick: () => _?.chain().focus().addColumnAfter().run()
|
|
1288
|
+
}, [e(y, null, null)]), J && e("button", {
|
|
1288
1289
|
class: "tcc-btn tcc-btn--add",
|
|
1289
|
-
style:
|
|
1290
|
-
onClick: () =>
|
|
1291
|
-
}, [e(
|
|
1290
|
+
style: ge,
|
|
1291
|
+
onClick: () => _?.chain().focus().addRowAfter().run()
|
|
1292
|
+
}, [e(y, null, null)])]);
|
|
1292
1293
|
};
|
|
1293
1294
|
}
|
|
1294
|
-
}),
|
|
1295
|
+
}), R1 = /* @__PURE__ */ d({
|
|
1295
1296
|
name: "MathIcon",
|
|
1296
1297
|
setup(t, {
|
|
1297
1298
|
attrs: l
|
|
1298
1299
|
}) {
|
|
1299
|
-
return () => e("svg",
|
|
1300
|
+
return () => e("svg", k({
|
|
1300
1301
|
width: "24",
|
|
1301
1302
|
height: "24",
|
|
1302
1303
|
viewBox: "0 0 24 24",
|
|
@@ -1309,21 +1310,21 @@ const Z1 = /* @__PURE__ */ c({
|
|
|
1309
1310
|
fill: "currentColor"
|
|
1310
1311
|
}, null)]);
|
|
1311
1312
|
}
|
|
1312
|
-
}), _1 = /* @__PURE__ */
|
|
1313
|
+
}), _1 = /* @__PURE__ */ d({
|
|
1313
1314
|
name: "MathButton",
|
|
1314
1315
|
setup() {
|
|
1315
|
-
const t =
|
|
1316
|
-
return () => e(
|
|
1317
|
-
icon:
|
|
1316
|
+
const t = M("editor"), l = M("openMathDialog");
|
|
1317
|
+
return () => e(w, {
|
|
1318
|
+
icon: R1,
|
|
1318
1319
|
tooltip: "数学公式",
|
|
1319
1320
|
isActive: t?.value?.isActive("inlineMath") || t?.value?.isActive("blockMath"),
|
|
1320
1321
|
onClick: () => l?.()
|
|
1321
1322
|
}, null);
|
|
1322
1323
|
}
|
|
1323
|
-
}),
|
|
1324
|
+
}), D1 = { class: "math-dialog" }, S1 = {
|
|
1324
1325
|
key: 0,
|
|
1325
1326
|
class: "math-preview__placeholder"
|
|
1326
|
-
},
|
|
1327
|
+
}, U1 = ["innerHTML"], $1 = /* @__PURE__ */ d({
|
|
1327
1328
|
__name: "MathEditDialog",
|
|
1328
1329
|
props: {
|
|
1329
1330
|
visible: { type: Boolean },
|
|
@@ -1333,121 +1334,121 @@ const Z1 = /* @__PURE__ */ c({
|
|
|
1333
1334
|
},
|
|
1334
1335
|
emits: ["update:visible"],
|
|
1335
1336
|
setup(t, { emit: l }) {
|
|
1336
|
-
const n = t,
|
|
1337
|
-
|
|
1337
|
+
const n = t, r = l, s = M("editor"), u = B(""), v = B("inline");
|
|
1338
|
+
z(() => n.latex, (o) => {
|
|
1338
1339
|
u.value = o;
|
|
1339
|
-
}, { immediate: !0 }),
|
|
1340
|
-
|
|
1340
|
+
}, { immediate: !0 }), z(() => n.type, (o) => {
|
|
1341
|
+
v.value = o;
|
|
1341
1342
|
}, { immediate: !0 });
|
|
1342
|
-
const
|
|
1343
|
-
displayMode:
|
|
1343
|
+
const f = S(() => n.pos === null), h = S(() => u.value.trim() ? Xe.renderToString(u.value, {
|
|
1344
|
+
displayMode: v.value === "block",
|
|
1344
1345
|
throwOnError: !1
|
|
1345
|
-
}) : ""),
|
|
1346
|
-
const o =
|
|
1346
|
+
}) : ""), y = () => {
|
|
1347
|
+
const o = s?.value;
|
|
1347
1348
|
if (!(!o || !u.value.trim())) {
|
|
1348
|
-
if (
|
|
1349
|
-
|
|
1350
|
-
else if (
|
|
1349
|
+
if (f.value)
|
|
1350
|
+
v.value === "inline" ? o.chain().focus().insertInlineMath({ latex: u.value }).run() : o.chain().focus().insertBlockMath({ latex: u.value }).run();
|
|
1351
|
+
else if (v.value === n.type)
|
|
1351
1352
|
n.type === "inline" ? o.commands.updateInlineMath({ latex: u.value, pos: n.pos }) : o.commands.updateBlockMath({ latex: u.value, pos: n.pos });
|
|
1352
1353
|
else {
|
|
1353
|
-
const
|
|
1354
|
-
n.type === "inline" ? o.chain().focus().deleteInlineMath({ pos:
|
|
1354
|
+
const i = n.pos;
|
|
1355
|
+
n.type === "inline" ? o.chain().focus().deleteInlineMath({ pos: i }).insertBlockMath({ latex: u.value }).run() : o.chain().focus().deleteBlockMath({ pos: i }).insertInlineMath({ latex: u.value }).run();
|
|
1355
1356
|
}
|
|
1356
|
-
|
|
1357
|
+
r("update:visible", !1);
|
|
1357
1358
|
}
|
|
1358
1359
|
};
|
|
1359
|
-
return (o,
|
|
1360
|
+
return (o, i) => (Z(), le(g(Ge), {
|
|
1360
1361
|
"model-value": t.visible,
|
|
1361
|
-
title:
|
|
1362
|
+
title: f.value ? "插入数学公式" : "编辑数学公式",
|
|
1362
1363
|
width: "520px",
|
|
1363
|
-
"onUpdate:modelValue":
|
|
1364
|
+
"onUpdate:modelValue": i[3] || (i[3] = (a) => r("update:visible", a))
|
|
1364
1365
|
}, {
|
|
1365
|
-
footer:
|
|
1366
|
-
e(
|
|
1367
|
-
onClick:
|
|
1366
|
+
footer: D(() => [
|
|
1367
|
+
e(g(U), {
|
|
1368
|
+
onClick: i[2] || (i[2] = (a) => r("update:visible", !1))
|
|
1368
1369
|
}, {
|
|
1369
|
-
default:
|
|
1370
|
-
|
|
1370
|
+
default: D(() => [...i[6] || (i[6] = [
|
|
1371
|
+
H("取消", -1)
|
|
1371
1372
|
])]),
|
|
1372
1373
|
_: 1
|
|
1373
1374
|
}),
|
|
1374
|
-
e(
|
|
1375
|
+
e(g(U), {
|
|
1375
1376
|
type: "primary",
|
|
1376
1377
|
disabled: !u.value.trim(),
|
|
1377
|
-
onClick:
|
|
1378
|
+
onClick: y
|
|
1378
1379
|
}, {
|
|
1379
|
-
default:
|
|
1380
|
-
|
|
1380
|
+
default: D(() => [...i[7] || (i[7] = [
|
|
1381
|
+
H("确认", -1)
|
|
1381
1382
|
])]),
|
|
1382
1383
|
_: 1
|
|
1383
1384
|
}, 8, ["disabled"])
|
|
1384
1385
|
]),
|
|
1385
|
-
default:
|
|
1386
|
-
|
|
1387
|
-
e(
|
|
1388
|
-
modelValue:
|
|
1389
|
-
"onUpdate:modelValue":
|
|
1386
|
+
default: D(() => [
|
|
1387
|
+
L("div", D1, [
|
|
1388
|
+
e(g(Je), {
|
|
1389
|
+
modelValue: v.value,
|
|
1390
|
+
"onUpdate:modelValue": i[0] || (i[0] = (a) => v.value = a)
|
|
1390
1391
|
}, {
|
|
1391
|
-
default:
|
|
1392
|
-
e(
|
|
1393
|
-
default:
|
|
1394
|
-
|
|
1392
|
+
default: D(() => [
|
|
1393
|
+
e(g(ee), { value: "inline" }, {
|
|
1394
|
+
default: D(() => [...i[4] || (i[4] = [
|
|
1395
|
+
H("行内公式", -1)
|
|
1395
1396
|
])]),
|
|
1396
1397
|
_: 1
|
|
1397
1398
|
}),
|
|
1398
|
-
e(
|
|
1399
|
-
default:
|
|
1400
|
-
|
|
1399
|
+
e(g(ee), { value: "block" }, {
|
|
1400
|
+
default: D(() => [...i[5] || (i[5] = [
|
|
1401
|
+
H("块级公式", -1)
|
|
1401
1402
|
])]),
|
|
1402
1403
|
_: 1
|
|
1403
1404
|
})
|
|
1404
1405
|
]),
|
|
1405
1406
|
_: 1
|
|
1406
1407
|
}, 8, ["modelValue"]),
|
|
1407
|
-
e(
|
|
1408
|
+
e(g(ue), {
|
|
1408
1409
|
modelValue: u.value,
|
|
1409
|
-
"onUpdate:modelValue":
|
|
1410
|
+
"onUpdate:modelValue": i[1] || (i[1] = (a) => u.value = a),
|
|
1410
1411
|
type: "textarea",
|
|
1411
1412
|
rows: 3,
|
|
1412
1413
|
placeholder: "请输入 LaTeX 公式,例如:E=mc^2"
|
|
1413
1414
|
}, null, 8, ["modelValue"]),
|
|
1414
|
-
|
|
1415
|
-
class:
|
|
1415
|
+
L("div", {
|
|
1416
|
+
class: ne(["math-preview", { "math-preview--empty": !h.value }])
|
|
1416
1417
|
}, [
|
|
1417
|
-
|
|
1418
|
+
h.value ? (Z(), R("div", {
|
|
1418
1419
|
key: 1,
|
|
1419
|
-
innerHTML:
|
|
1420
|
-
}, null, 8,
|
|
1420
|
+
innerHTML: h.value
|
|
1421
|
+
}, null, 8, U1)) : (Z(), R("span", S1, "预览将在此处显示"))
|
|
1421
1422
|
], 2)
|
|
1422
1423
|
])
|
|
1423
1424
|
]),
|
|
1424
1425
|
_: 1
|
|
1425
1426
|
}, 8, ["model-value", "title"]));
|
|
1426
1427
|
}
|
|
1427
|
-
}),
|
|
1428
|
+
}), z1 = (t, l) => {
|
|
1428
1429
|
const n = t.__vccOpts || t;
|
|
1429
|
-
for (const [
|
|
1430
|
-
n[
|
|
1430
|
+
for (const [r, s] of l)
|
|
1431
|
+
n[r] = s;
|
|
1431
1432
|
return n;
|
|
1432
|
-
},
|
|
1433
|
+
}, O1 = /* @__PURE__ */ z1($1, [["__scopeId", "data-v-995dc22f"]]), P1 = [{
|
|
1433
1434
|
value: "left",
|
|
1434
1435
|
title: "居左",
|
|
1435
|
-
Icon:
|
|
1436
|
+
Icon: pe
|
|
1436
1437
|
}, {
|
|
1437
1438
|
value: "center",
|
|
1438
1439
|
title: "居中",
|
|
1439
|
-
Icon:
|
|
1440
|
+
Icon: Ce
|
|
1440
1441
|
}, {
|
|
1441
1442
|
value: "right",
|
|
1442
1443
|
title: "居右",
|
|
1443
|
-
Icon:
|
|
1444
|
-
}],
|
|
1445
|
-
function
|
|
1444
|
+
Icon: ve
|
|
1445
|
+
}], j = (t) => t.preventDefault();
|
|
1446
|
+
function N1(t) {
|
|
1446
1447
|
if (!t.isActive("image")) return null;
|
|
1447
1448
|
const {
|
|
1448
1449
|
selection: l
|
|
1449
1450
|
} = t.state;
|
|
1450
|
-
if (!(l instanceof
|
|
1451
|
+
if (!(l instanceof Ue) || l.node.type.name !== "image") return null;
|
|
1451
1452
|
const n = l.node;
|
|
1452
1453
|
return {
|
|
1453
1454
|
pos: l.from,
|
|
@@ -1456,11 +1457,11 @@ function O1(t) {
|
|
|
1456
1457
|
align: n.attrs.align ?? "left"
|
|
1457
1458
|
};
|
|
1458
1459
|
}
|
|
1459
|
-
function
|
|
1460
|
+
function j1(t) {
|
|
1460
1461
|
const l = t.startsWith("data:") ? "image.png" : t.split("/").pop()?.split("?")[0] || "image.png", n = document.createElement("a");
|
|
1461
1462
|
n.href = t, n.download = l, document.body.appendChild(n), n.click(), document.body.removeChild(n);
|
|
1462
1463
|
}
|
|
1463
|
-
const
|
|
1464
|
+
const W1 = () => e("svg", {
|
|
1464
1465
|
width: "16",
|
|
1465
1466
|
height: "16",
|
|
1466
1467
|
viewBox: "0 0 24 24",
|
|
@@ -1478,7 +1479,7 @@ const j1 = () => e("svg", {
|
|
|
1478
1479
|
y1: "15",
|
|
1479
1480
|
x2: "12",
|
|
1480
1481
|
y2: "3"
|
|
1481
|
-
}, null)]),
|
|
1482
|
+
}, null)]), K1 = () => e("svg", {
|
|
1482
1483
|
width: "16",
|
|
1483
1484
|
height: "16",
|
|
1484
1485
|
viewBox: "0 0 24 24",
|
|
@@ -1491,7 +1492,7 @@ const j1 = () => e("svg", {
|
|
|
1491
1492
|
points: "1 4 1 10 7 10"
|
|
1492
1493
|
}, null), e("path", {
|
|
1493
1494
|
d: "M3.51 15a9 9 0 1 0 .49-4.1L1 10"
|
|
1494
|
-
}, null)]),
|
|
1495
|
+
}, null)]), q1 = () => e("svg", {
|
|
1495
1496
|
width: "16",
|
|
1496
1497
|
height: "16",
|
|
1497
1498
|
viewBox: "0 0 24 24",
|
|
@@ -1508,93 +1509,93 @@ const j1 = () => e("svg", {
|
|
|
1508
1509
|
d: "M10 11v6M14 11v6"
|
|
1509
1510
|
}, null), e("path", {
|
|
1510
1511
|
d: "M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"
|
|
1511
|
-
}, null)]),
|
|
1512
|
+
}, null)]), G1 = /* @__PURE__ */ d({
|
|
1512
1513
|
name: "ImageControls",
|
|
1513
1514
|
setup() {
|
|
1514
|
-
const t =
|
|
1515
|
-
function
|
|
1516
|
-
const
|
|
1517
|
-
if (!
|
|
1518
|
-
|
|
1515
|
+
const t = M("editor"), l = M("readonly"), n = B(null);
|
|
1516
|
+
function r() {
|
|
1517
|
+
const s = t?.value;
|
|
1518
|
+
if (!s) {
|
|
1519
|
+
n.value = null;
|
|
1519
1520
|
return;
|
|
1520
1521
|
}
|
|
1521
|
-
|
|
1522
|
+
n.value = N1(s);
|
|
1522
1523
|
}
|
|
1523
|
-
return
|
|
1524
|
-
const
|
|
1525
|
-
|
|
1526
|
-
|
|
1524
|
+
return ie((s) => {
|
|
1525
|
+
const u = t?.value;
|
|
1526
|
+
u && (u.on("transaction", r), s(() => {
|
|
1527
|
+
u.off("transaction", r);
|
|
1527
1528
|
}));
|
|
1528
1529
|
}), () => {
|
|
1529
|
-
const
|
|
1530
|
-
if (!
|
|
1531
|
-
const
|
|
1532
|
-
if (!
|
|
1530
|
+
const s = n.value;
|
|
1531
|
+
if (!s) return null;
|
|
1532
|
+
const u = t?.value;
|
|
1533
|
+
if (!u) return null;
|
|
1533
1534
|
const {
|
|
1534
|
-
pos:
|
|
1535
|
-
nodeSize:
|
|
1536
|
-
src:
|
|
1537
|
-
align:
|
|
1538
|
-
} =
|
|
1539
|
-
if (!
|
|
1540
|
-
const
|
|
1541
|
-
if (!
|
|
1542
|
-
const
|
|
1535
|
+
pos: v,
|
|
1536
|
+
nodeSize: f,
|
|
1537
|
+
src: h,
|
|
1538
|
+
align: y
|
|
1539
|
+
} = s, o = l?.value ?? !1, i = u.view.nodeDOM(v);
|
|
1540
|
+
if (!i || !(i instanceof HTMLElement)) return null;
|
|
1541
|
+
const a = i.querySelector("[data-resize-wrapper]") ?? i, m = u.view.dom.closest(".tiptap-editor");
|
|
1542
|
+
if (!m) return null;
|
|
1543
|
+
const b = a.getBoundingClientRect(), A = m.getBoundingClientRect(), c = {
|
|
1543
1544
|
position: "absolute",
|
|
1544
|
-
top: `${
|
|
1545
|
-
left: `${
|
|
1545
|
+
top: `${b.top - A.top}px`,
|
|
1546
|
+
left: `${b.left - A.left + b.width / 2}px`,
|
|
1546
1547
|
transform: "translate(-50%, calc(-100% - 8px))",
|
|
1547
1548
|
zIndex: 20
|
|
1548
1549
|
};
|
|
1549
1550
|
return e("div", {
|
|
1550
1551
|
class: "image-controls",
|
|
1551
|
-
style:
|
|
1552
|
-
}, [P1.map(({
|
|
1553
|
-
value:
|
|
1554
|
-
title:
|
|
1555
|
-
Icon:
|
|
1552
|
+
style: c
|
|
1553
|
+
}, [!o && P1.map(({
|
|
1554
|
+
value: p,
|
|
1555
|
+
title: C,
|
|
1556
|
+
Icon: x
|
|
1556
1557
|
}) => e("button", {
|
|
1557
|
-
key:
|
|
1558
|
-
class: ["image-controls-btn",
|
|
1559
|
-
title:
|
|
1560
|
-
onMousedown:
|
|
1561
|
-
onClick: () =>
|
|
1562
|
-
align:
|
|
1558
|
+
key: p,
|
|
1559
|
+
class: ["image-controls-btn", y === p && "is-active"],
|
|
1560
|
+
title: C,
|
|
1561
|
+
onMousedown: j,
|
|
1562
|
+
onClick: () => u.chain().focus().updateAttributes("image", {
|
|
1563
|
+
align: p
|
|
1563
1564
|
}).run()
|
|
1564
|
-
}, [e(
|
|
1565
|
+
}, [e(x, null, null)])), !o && e("span", {
|
|
1565
1566
|
class: "image-controls-separator"
|
|
1566
1567
|
}, null), e("button", {
|
|
1567
1568
|
class: "image-controls-btn",
|
|
1568
1569
|
title: "下载",
|
|
1569
|
-
onMousedown:
|
|
1570
|
-
onClick: () =>
|
|
1571
|
-
}, [e(
|
|
1570
|
+
onMousedown: j,
|
|
1571
|
+
onClick: () => j1(h)
|
|
1572
|
+
}, [e(W1, null, null)]), !o && e("button", {
|
|
1572
1573
|
class: "image-controls-btn",
|
|
1573
1574
|
title: "重新上传",
|
|
1574
|
-
onMousedown:
|
|
1575
|
-
onClick: () =>
|
|
1576
|
-
from:
|
|
1577
|
-
to:
|
|
1578
|
-
}).insertContentAt(
|
|
1575
|
+
onMousedown: j,
|
|
1576
|
+
onClick: () => u.chain().focus().deleteRange({
|
|
1577
|
+
from: v,
|
|
1578
|
+
to: v + f
|
|
1579
|
+
}).insertContentAt(v, {
|
|
1579
1580
|
type: "imageUpload"
|
|
1580
1581
|
}).run()
|
|
1581
|
-
}, [e(
|
|
1582
|
+
}, [e(K1, null, null)]), !o && e("button", {
|
|
1582
1583
|
class: "image-controls-btn",
|
|
1583
1584
|
title: "删除",
|
|
1584
|
-
onMousedown:
|
|
1585
|
-
onClick: () =>
|
|
1586
|
-
from:
|
|
1587
|
-
to:
|
|
1585
|
+
onMousedown: j,
|
|
1586
|
+
onClick: () => u.chain().focus().deleteRange({
|
|
1587
|
+
from: v,
|
|
1588
|
+
to: v + f
|
|
1588
1589
|
}).run()
|
|
1589
|
-
}, [e(
|
|
1590
|
+
}, [e(q1, null, null)])]);
|
|
1590
1591
|
};
|
|
1591
1592
|
}
|
|
1592
|
-
}),
|
|
1593
|
+
}), J1 = /* @__PURE__ */ d({
|
|
1593
1594
|
name: "CodeBlockIcon",
|
|
1594
1595
|
setup(t, {
|
|
1595
1596
|
attrs: l
|
|
1596
1597
|
}) {
|
|
1597
|
-
return () => e("svg",
|
|
1598
|
+
return () => e("svg", k({
|
|
1598
1599
|
width: "24",
|
|
1599
1600
|
height: "24",
|
|
1600
1601
|
viewBox: "0 0 24 24",
|
|
@@ -1610,22 +1611,22 @@ const j1 = () => e("svg", {
|
|
|
1610
1611
|
points: "8 6 2 12 8 18"
|
|
1611
1612
|
}, null)]);
|
|
1612
1613
|
}
|
|
1613
|
-
}),
|
|
1614
|
+
}), X1 = /* @__PURE__ */ d({
|
|
1614
1615
|
name: "CodeBlockButton",
|
|
1615
1616
|
setup() {
|
|
1616
|
-
const t =
|
|
1617
|
-
return () => e(
|
|
1618
|
-
icon:
|
|
1617
|
+
const t = M("editor");
|
|
1618
|
+
return () => e(w, {
|
|
1619
|
+
icon: J1,
|
|
1619
1620
|
tooltip: "代码块",
|
|
1620
1621
|
isActive: t?.value?.isActive("codeBlock"),
|
|
1621
1622
|
onClick: () => t?.value?.chain().focus().toggleCodeBlock().run()
|
|
1622
1623
|
}, null);
|
|
1623
1624
|
}
|
|
1624
|
-
}),
|
|
1625
|
+
}), Q1 = /* @__PURE__ */ d({
|
|
1625
1626
|
name: "BubbleMenuBar",
|
|
1626
1627
|
setup() {
|
|
1627
|
-
const t =
|
|
1628
|
-
return () => t?.value ? e(
|
|
1628
|
+
const t = M("editor"), l = M("readonly");
|
|
1629
|
+
return () => t?.value ? e(Qe, {
|
|
1629
1630
|
editor: t.value,
|
|
1630
1631
|
class: "bubble-menu",
|
|
1631
1632
|
options: {
|
|
@@ -1634,74 +1635,80 @@ const j1 = () => e("svg", {
|
|
|
1634
1635
|
mainAxis: 8
|
|
1635
1636
|
}
|
|
1636
1637
|
},
|
|
1637
|
-
shouldShow: (
|
|
1638
|
+
shouldShow: (n) => {
|
|
1639
|
+
if (l?.value) return !1;
|
|
1638
1640
|
const {
|
|
1639
|
-
editor:
|
|
1640
|
-
from:
|
|
1641
|
-
to:
|
|
1642
|
-
} =
|
|
1643
|
-
return !(
|
|
1641
|
+
editor: r,
|
|
1642
|
+
from: s,
|
|
1643
|
+
to: u
|
|
1644
|
+
} = n;
|
|
1645
|
+
return !(s === u || r.isActive("image") || r.isActive("table"));
|
|
1644
1646
|
}
|
|
1645
1647
|
}, {
|
|
1646
1648
|
default: () => [e("div", {
|
|
1647
1649
|
class: "bubble-menu-content"
|
|
1648
|
-
}, [e(
|
|
1649
|
-
icon:
|
|
1650
|
+
}, [e(w, {
|
|
1651
|
+
icon: ae,
|
|
1650
1652
|
tooltip: "粗体",
|
|
1651
1653
|
isActive: t.value.isActive("bold"),
|
|
1652
1654
|
onClick: () => t.value?.chain().focus().toggleBold().run()
|
|
1653
|
-
}, null), e(
|
|
1654
|
-
icon:
|
|
1655
|
+
}, null), e(w, {
|
|
1656
|
+
icon: se,
|
|
1655
1657
|
tooltip: "斜体",
|
|
1656
1658
|
isActive: t.value.isActive("italic"),
|
|
1657
1659
|
onClick: () => t.value?.chain().focus().toggleItalic().run()
|
|
1658
|
-
}, null), e(
|
|
1659
|
-
icon:
|
|
1660
|
+
}, null), e(w, {
|
|
1661
|
+
icon: ce,
|
|
1660
1662
|
tooltip: "删除线",
|
|
1661
1663
|
isActive: t.value.isActive("strike"),
|
|
1662
1664
|
onClick: () => t.value?.chain().focus().toggleStrike().run()
|
|
1663
|
-
}, null), e(
|
|
1664
|
-
icon:
|
|
1665
|
+
}, null), e(w, {
|
|
1666
|
+
icon: de,
|
|
1665
1667
|
tooltip: "下划线",
|
|
1666
1668
|
isActive: t.value.isActive("underline"),
|
|
1667
1669
|
onClick: () => t.value?.chain().focus().toggleUnderline().run()
|
|
1668
1670
|
}, null)])]
|
|
1669
1671
|
}) : null;
|
|
1670
1672
|
}
|
|
1671
|
-
}),
|
|
1673
|
+
}), Y1 = { class: "tiptap-editor" }, et = {
|
|
1674
|
+
key: 0,
|
|
1675
|
+
class: "tiptap-toolbar"
|
|
1676
|
+
}, gt = /* @__PURE__ */ d({
|
|
1672
1677
|
__name: "TiptapEditor",
|
|
1673
1678
|
props: {
|
|
1674
1679
|
modelValue: { default: "" },
|
|
1675
1680
|
placeholder: { default: "请输入内容..." },
|
|
1676
|
-
upload: {}
|
|
1681
|
+
upload: {},
|
|
1682
|
+
readonly: { type: Boolean, default: !1 }
|
|
1677
1683
|
},
|
|
1678
1684
|
emits: ["update:modelValue"],
|
|
1679
1685
|
setup(t, { emit: l }) {
|
|
1680
|
-
const n =
|
|
1681
|
-
|
|
1686
|
+
const n = Re(_e), r = t, s = l, u = B(!1), v = B(""), f = B(null), h = B("inline"), y = S(() => r.readonly ?? !1), o = (a = {}) => {
|
|
1687
|
+
y.value || (v.value = a.latex ?? "", f.value = a.pos ?? null, h.value = a.type ?? "inline", u.value = !0);
|
|
1682
1688
|
};
|
|
1683
|
-
|
|
1684
|
-
const
|
|
1685
|
-
content:
|
|
1689
|
+
K("openMathDialog", o), K("readonly", y);
|
|
1690
|
+
const i = Le({
|
|
1691
|
+
content: r.modelValue,
|
|
1692
|
+
editable: !r.readonly,
|
|
1686
1693
|
extensions: [
|
|
1687
|
-
|
|
1694
|
+
ye.configure({
|
|
1688
1695
|
codeBlock: !1,
|
|
1689
1696
|
link: {
|
|
1690
1697
|
openOnClick: !1,
|
|
1691
1698
|
enableClickSelection: !0
|
|
1692
1699
|
}
|
|
1693
1700
|
}),
|
|
1694
|
-
Te.configure({
|
|
1695
|
-
placeholder: i.placeholder
|
|
1696
|
-
}),
|
|
1697
1701
|
Ze.configure({
|
|
1702
|
+
placeholder: r.placeholder
|
|
1703
|
+
}),
|
|
1704
|
+
Fe.configure({
|
|
1698
1705
|
lowlight: n,
|
|
1699
1706
|
defaultLanguage: "plaintext"
|
|
1700
1707
|
}),
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1708
|
+
Te.configure({ types: ["heading", "paragraph"] }),
|
|
1709
|
+
Ee,
|
|
1710
|
+
Ve.configure({ nested: !0 }),
|
|
1711
|
+
Ye.configure({
|
|
1705
1712
|
allowBase64: !0,
|
|
1706
1713
|
resize: {
|
|
1707
1714
|
enabled: !0,
|
|
@@ -1720,62 +1727,64 @@ const j1 = () => e("svg", {
|
|
|
1720
1727
|
alwaysPreserveAspectRatio: !1
|
|
1721
1728
|
}
|
|
1722
1729
|
}),
|
|
1723
|
-
|
|
1724
|
-
...
|
|
1730
|
+
s1.configure({
|
|
1731
|
+
...r.upload ? { upload: r.upload } : {}
|
|
1725
1732
|
}),
|
|
1726
|
-
|
|
1727
|
-
ze,
|
|
1728
|
-
Pe,
|
|
1733
|
+
je.configure({ resizable: !0 }),
|
|
1729
1734
|
Oe,
|
|
1730
|
-
|
|
1735
|
+
Pe,
|
|
1736
|
+
Ne,
|
|
1737
|
+
We.configure({
|
|
1731
1738
|
inlineOptions: {
|
|
1732
|
-
onClick: (
|
|
1739
|
+
onClick: (a, m) => o({ latex: a.attrs.latex, pos: m, type: "inline" })
|
|
1733
1740
|
},
|
|
1734
1741
|
blockOptions: {
|
|
1735
|
-
onClick: (
|
|
1742
|
+
onClick: (a, m) => o({ latex: a.attrs.latex, pos: m, type: "block" })
|
|
1736
1743
|
}
|
|
1737
1744
|
})
|
|
1738
1745
|
],
|
|
1739
|
-
onUpdate: ({ editor:
|
|
1740
|
-
|
|
1746
|
+
onUpdate: ({ editor: a }) => {
|
|
1747
|
+
s("update:modelValue", a.getHTML());
|
|
1741
1748
|
}
|
|
1742
1749
|
});
|
|
1743
|
-
return
|
|
1744
|
-
|
|
1745
|
-
}), (
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
e(
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
e(
|
|
1753
|
-
|
|
1754
|
-
e(
|
|
1755
|
-
|
|
1756
|
-
e(
|
|
1757
|
-
|
|
1758
|
-
e(
|
|
1759
|
-
|
|
1760
|
-
|
|
1750
|
+
return K("editor", i), z(() => r.modelValue, (a) => {
|
|
1751
|
+
i.value && a !== i.value.getHTML() && i.value.commands.setContent(a, { emitUpdate: !1 });
|
|
1752
|
+
}), z(() => r.readonly, (a) => {
|
|
1753
|
+
i.value?.setEditable(!a);
|
|
1754
|
+
}), (a, m) => (Z(), R("div", Y1, [
|
|
1755
|
+
t.readonly ? oe("", !0) : (Z(), R("div", et, [
|
|
1756
|
+
e(g(C1)),
|
|
1757
|
+
m[1] || (m[1] = L("div", { class: "tiptap-separator" }, null, -1)),
|
|
1758
|
+
e(g(w1)),
|
|
1759
|
+
e(g(X1)),
|
|
1760
|
+
m[2] || (m[2] = L("div", { class: "tiptap-separator" }, null, -1)),
|
|
1761
|
+
e(g(B1)),
|
|
1762
|
+
m[3] || (m[3] = L("div", { class: "tiptap-separator" }, null, -1)),
|
|
1763
|
+
e(g(b1)),
|
|
1764
|
+
m[4] || (m[4] = L("div", { class: "tiptap-separator" }, null, -1)),
|
|
1765
|
+
e(g(A1)),
|
|
1766
|
+
e(g(V1)),
|
|
1767
|
+
e(g(_1))
|
|
1768
|
+
])),
|
|
1769
|
+
e(g(Ie), {
|
|
1761
1770
|
class: "tiptap-content",
|
|
1762
|
-
editor:
|
|
1771
|
+
editor: g(i)
|
|
1763
1772
|
}, null, 8, ["editor"]),
|
|
1764
|
-
e(
|
|
1765
|
-
e(
|
|
1766
|
-
e(
|
|
1767
|
-
e(
|
|
1773
|
+
e(g(Q1)),
|
|
1774
|
+
e(g(F1)),
|
|
1775
|
+
e(g(G1)),
|
|
1776
|
+
e(O1, {
|
|
1768
1777
|
visible: u.value,
|
|
1769
|
-
"onUpdate:visible":
|
|
1770
|
-
latex:
|
|
1771
|
-
pos:
|
|
1772
|
-
type:
|
|
1778
|
+
"onUpdate:visible": m[0] || (m[0] = (b) => u.value = b),
|
|
1779
|
+
latex: v.value,
|
|
1780
|
+
pos: f.value,
|
|
1781
|
+
type: h.value
|
|
1773
1782
|
}, null, 8, ["visible", "latex", "pos", "type"])
|
|
1774
1783
|
]));
|
|
1775
1784
|
}
|
|
1776
1785
|
});
|
|
1777
1786
|
export {
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1787
|
+
w as IconButton,
|
|
1788
|
+
Ye as ImageWithAlign,
|
|
1789
|
+
gt as TiptapEditor
|
|
1781
1790
|
};
|