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