@mario9/tiptap-editor 1.0.1 → 1.0.2
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/dist/tiptap-editor.css +1 -1
- package/dist/tiptap-editor.js +536 -550
- package/dist/tiptap-editor.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/tiptap-editor.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as s, createVNode as e, mergeProps as b, inject as y, ref as H, computed as T, provide as P, watch as _, createTextVNode as g, watchEffect as K, Fragment as de, h as pe } from "vue";
|
|
2
2
|
import Ce from "@tiptap/starter-kit";
|
|
3
3
|
import { useEditor as ve, EditorContent as fe, nodeViewProps as he, NodeViewWrapper as me, VueNodeViewRenderer as ge } from "@tiptap/vue-3";
|
|
4
4
|
import { TaskList as we, TaskItem as be } from "@tiptap/extension-list";
|
|
5
|
-
import { TextAlign as
|
|
6
|
-
import { Placeholder as
|
|
5
|
+
import { TextAlign as xe } from "@tiptap/extension-text-align";
|
|
6
|
+
import { Placeholder as ke } from "@tiptap/extension-placeholder";
|
|
7
7
|
import { BubbleMenu as He } from "@tiptap/vue-3/menus";
|
|
8
|
-
import { ElTooltip as D, ElButton as Z, ElPopover as
|
|
8
|
+
import { ElTooltip as D, ElButton as Z, ElPopover as G, ElInput as J, ElDropdown as N, ElDropdownMenu as j, ElDropdownItem as L, ElDialog as ye, ElRadioGroup as Be, ElRadioButton as W } from "element-plus";
|
|
9
9
|
import { Image as Ae } from "@tiptap/extension-image";
|
|
10
10
|
import { Plugin as Me, NodeSelection as Ie } from "@tiptap/pm/state";
|
|
11
|
-
import { Decoration as
|
|
11
|
+
import { Decoration as Ee, DecorationSet as Le } from "@tiptap/pm/view";
|
|
12
12
|
import { CodeBlockLowlight as Fe } from "@tiptap/extension-code-block-lowlight";
|
|
13
13
|
import { createLowlight as Te, common as Ve } from "lowlight";
|
|
14
14
|
import { TableRow as Ze, TableHeader as De, TableCell as Re, Table as Se } from "@tiptap/extension-table";
|
|
@@ -34,7 +34,7 @@ const Oe = {
|
|
|
34
34
|
onClick: {
|
|
35
35
|
type: Function
|
|
36
36
|
}
|
|
37
|
-
}, w = /* @__PURE__ */
|
|
37
|
+
}, w = /* @__PURE__ */ s({
|
|
38
38
|
name: "IconButton",
|
|
39
39
|
props: Oe,
|
|
40
40
|
setup(t) {
|
|
@@ -54,7 +54,7 @@ const Oe = {
|
|
|
54
54
|
}, null)]
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), X = /* @__PURE__ */ s({
|
|
58
58
|
name: "BoldIcon",
|
|
59
59
|
setup(t, {
|
|
60
60
|
attrs: l
|
|
@@ -72,7 +72,7 @@ const Oe = {
|
|
|
72
72
|
fill: "currentColor"
|
|
73
73
|
}, null)]);
|
|
74
74
|
}
|
|
75
|
-
}),
|
|
75
|
+
}), Q = /* @__PURE__ */ s({
|
|
76
76
|
name: "ItalicIcon",
|
|
77
77
|
setup(t, {
|
|
78
78
|
attrs: l
|
|
@@ -88,7 +88,7 @@ const Oe = {
|
|
|
88
88
|
fill: "currentColor"
|
|
89
89
|
}, null)]);
|
|
90
90
|
}
|
|
91
|
-
}),
|
|
91
|
+
}), Y = /* @__PURE__ */ s({
|
|
92
92
|
name: "StrikeIcon",
|
|
93
93
|
setup(t, {
|
|
94
94
|
attrs: l
|
|
@@ -107,7 +107,7 @@ const Oe = {
|
|
|
107
107
|
fill: "currentColor"
|
|
108
108
|
}, null)]);
|
|
109
109
|
}
|
|
110
|
-
}),
|
|
110
|
+
}), ee = /* @__PURE__ */ s({
|
|
111
111
|
name: "UnderlineIcon",
|
|
112
112
|
setup(t, {
|
|
113
113
|
attrs: l
|
|
@@ -125,10 +125,192 @@ const Oe = {
|
|
|
125
125
|
fill: "currentColor"
|
|
126
126
|
}, null)]);
|
|
127
127
|
}
|
|
128
|
-
}), $e = /* @__PURE__ */
|
|
128
|
+
}), $e = /* @__PURE__ */ s({
|
|
129
|
+
name: "LinkIcon",
|
|
130
|
+
setup(t, {
|
|
131
|
+
attrs: l
|
|
132
|
+
}) {
|
|
133
|
+
return () => e("svg", b({
|
|
134
|
+
width: "24",
|
|
135
|
+
height: "24",
|
|
136
|
+
viewBox: "0 0 24 24",
|
|
137
|
+
fill: "currentColor",
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
139
|
+
}, l), [e("path", {
|
|
140
|
+
d: "M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",
|
|
141
|
+
fill: "currentColor"
|
|
142
|
+
}, null), e("path", {
|
|
143
|
+
d: "M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",
|
|
144
|
+
fill: "currentColor"
|
|
145
|
+
}, null)]);
|
|
146
|
+
}
|
|
147
|
+
}), Ne = /* @__PURE__ */ s({
|
|
148
|
+
name: "CornerDownLeftIcon",
|
|
149
|
+
setup(t, {
|
|
150
|
+
attrs: l
|
|
151
|
+
}) {
|
|
152
|
+
return () => e("svg", b({
|
|
153
|
+
width: "24",
|
|
154
|
+
height: "24",
|
|
155
|
+
viewBox: "0 0 24 24",
|
|
156
|
+
fill: "none",
|
|
157
|
+
stroke: "currentColor",
|
|
158
|
+
"stroke-width": "2",
|
|
159
|
+
"stroke-linecap": "round",
|
|
160
|
+
"stroke-linejoin": "round",
|
|
161
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
162
|
+
}, l), [e("polyline", {
|
|
163
|
+
points: "9 10 4 15 9 20"
|
|
164
|
+
}, null), e("path", {
|
|
165
|
+
d: "M20 4v7a4 4 0 0 1-4 4H4"
|
|
166
|
+
}, null)]);
|
|
167
|
+
}
|
|
168
|
+
}), je = /* @__PURE__ */ s({
|
|
169
|
+
name: "ExternalLinkIcon",
|
|
170
|
+
setup(t, {
|
|
171
|
+
attrs: l
|
|
172
|
+
}) {
|
|
173
|
+
return () => e("svg", b({
|
|
174
|
+
width: "24",
|
|
175
|
+
height: "24",
|
|
176
|
+
viewBox: "0 0 24 24",
|
|
177
|
+
fill: "none",
|
|
178
|
+
stroke: "currentColor",
|
|
179
|
+
"stroke-width": "2",
|
|
180
|
+
"stroke-linecap": "round",
|
|
181
|
+
"stroke-linejoin": "round",
|
|
182
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
183
|
+
}, l), [e("path", {
|
|
184
|
+
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
|
|
185
|
+
}, null), e("polyline", {
|
|
186
|
+
points: "15 3 21 3 21 9"
|
|
187
|
+
}, null), e("line", {
|
|
188
|
+
x1: "10",
|
|
189
|
+
y1: "14",
|
|
190
|
+
x2: "21",
|
|
191
|
+
y2: "3"
|
|
192
|
+
}, null)]);
|
|
193
|
+
}
|
|
194
|
+
}), We = /* @__PURE__ */ s({
|
|
195
|
+
name: "TrashIcon",
|
|
196
|
+
setup(t, {
|
|
197
|
+
attrs: l
|
|
198
|
+
}) {
|
|
199
|
+
return () => e("svg", b({
|
|
200
|
+
width: "24",
|
|
201
|
+
height: "24",
|
|
202
|
+
viewBox: "0 0 24 24",
|
|
203
|
+
fill: "none",
|
|
204
|
+
stroke: "currentColor",
|
|
205
|
+
"stroke-width": "2",
|
|
206
|
+
"stroke-linecap": "round",
|
|
207
|
+
"stroke-linejoin": "round",
|
|
208
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
209
|
+
}, l), [e("polyline", {
|
|
210
|
+
points: "3 6 5 6 21 6"
|
|
211
|
+
}, null), e("path", {
|
|
212
|
+
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"
|
|
213
|
+
}, null)]);
|
|
214
|
+
}
|
|
215
|
+
}), te = /* @__PURE__ */ s({
|
|
216
|
+
name: "LinkPopover",
|
|
217
|
+
setup() {
|
|
218
|
+
const t = y("editor"), l = H(!1), n = H(""), o = () => {
|
|
219
|
+
const C = t?.value;
|
|
220
|
+
if (!C || !n.value) return;
|
|
221
|
+
const {
|
|
222
|
+
empty: h
|
|
223
|
+
} = C.state.selection;
|
|
224
|
+
let c = C.chain().focus().extendMarkRange("link").setLink({
|
|
225
|
+
href: n.value
|
|
226
|
+
});
|
|
227
|
+
h && (c = c.insertContent({
|
|
228
|
+
type: "text",
|
|
229
|
+
text: n.value
|
|
230
|
+
})), c.run(), l.value = !1;
|
|
231
|
+
}, i = () => {
|
|
232
|
+
const C = t?.value;
|
|
233
|
+
C && (C.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", l.value = !1);
|
|
234
|
+
}, u = () => {
|
|
235
|
+
const C = t?.value?.getAttributes("link").href;
|
|
236
|
+
C && window.open(C, "_blank", "noopener,noreferrer");
|
|
237
|
+
}, v = (C) => {
|
|
238
|
+
C.key === "Enter" && (C.preventDefault(), o());
|
|
239
|
+
}, p = (C) => {
|
|
240
|
+
C && (n.value = t?.value?.getAttributes("link").href ?? ""), l.value = C;
|
|
241
|
+
}, a = (C) => {
|
|
242
|
+
n.value = C;
|
|
243
|
+
};
|
|
244
|
+
return () => {
|
|
245
|
+
const C = t?.value?.isActive("link") ?? !1;
|
|
246
|
+
return e(G, {
|
|
247
|
+
visible: l.value,
|
|
248
|
+
"onUpdate:visible": p,
|
|
249
|
+
placement: "bottom",
|
|
250
|
+
width: 300,
|
|
251
|
+
trigger: "click",
|
|
252
|
+
showArrow: !1,
|
|
253
|
+
popperClass: "tiptap-link-popover-popper",
|
|
254
|
+
offset: 6
|
|
255
|
+
}, {
|
|
256
|
+
reference: () => e("span", null, [e(w, {
|
|
257
|
+
tooltip: "链接",
|
|
258
|
+
icon: $e,
|
|
259
|
+
isActive: C
|
|
260
|
+
}, null)]),
|
|
261
|
+
default: () => e("div", {
|
|
262
|
+
class: "tiptap-link-popover-inner"
|
|
263
|
+
}, [e(J, {
|
|
264
|
+
modelValue: n.value,
|
|
265
|
+
"onUpdate:modelValue": a,
|
|
266
|
+
type: "url",
|
|
267
|
+
placeholder: "请输入链接...",
|
|
268
|
+
size: "small",
|
|
269
|
+
autofocus: !0,
|
|
270
|
+
onKeydown: v
|
|
271
|
+
}, null), e("div", {
|
|
272
|
+
class: "tiptap-link-popover-actions"
|
|
273
|
+
}, [e(D, {
|
|
274
|
+
content: "确认",
|
|
275
|
+
showArrow: !1,
|
|
276
|
+
offset: 4
|
|
277
|
+
}, {
|
|
278
|
+
default: () => [e(Z, {
|
|
279
|
+
text: !0,
|
|
280
|
+
icon: Ne,
|
|
281
|
+
disabled: !n.value,
|
|
282
|
+
onClick: o
|
|
283
|
+
}, null)]
|
|
284
|
+
}), e(D, {
|
|
285
|
+
content: "在新标签页打开",
|
|
286
|
+
showArrow: !1,
|
|
287
|
+
offset: 4
|
|
288
|
+
}, {
|
|
289
|
+
default: () => [e(Z, {
|
|
290
|
+
text: !0,
|
|
291
|
+
icon: je,
|
|
292
|
+
disabled: !n.value && !C,
|
|
293
|
+
onClick: u
|
|
294
|
+
}, null)]
|
|
295
|
+
}), e(D, {
|
|
296
|
+
content: "移除链接",
|
|
297
|
+
showArrow: !1,
|
|
298
|
+
offset: 4
|
|
299
|
+
}, {
|
|
300
|
+
default: () => [e(Z, {
|
|
301
|
+
text: !0,
|
|
302
|
+
icon: We,
|
|
303
|
+
disabled: !C,
|
|
304
|
+
onClick: i
|
|
305
|
+
}, null)]
|
|
306
|
+
})])])
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}), qe = /* @__PURE__ */ s({
|
|
129
311
|
name: "BubbleMenuBar",
|
|
130
312
|
setup() {
|
|
131
|
-
const t =
|
|
313
|
+
const t = y("editor"), l = y("readonly");
|
|
132
314
|
return () => t?.value ? e(He, {
|
|
133
315
|
editor: t.value,
|
|
134
316
|
class: "bubble-menu",
|
|
@@ -149,31 +331,31 @@ const Oe = {
|
|
|
149
331
|
}
|
|
150
332
|
}, {
|
|
151
333
|
default: () => [e("div", {
|
|
152
|
-
class: "bubble-menu
|
|
334
|
+
class: "tiptap-bubble-menu"
|
|
153
335
|
}, [e(w, {
|
|
154
|
-
icon:
|
|
336
|
+
icon: X,
|
|
155
337
|
tooltip: "粗体",
|
|
156
338
|
isActive: t.value.isActive("bold"),
|
|
157
339
|
onClick: () => t.value?.chain().focus().toggleBold().run()
|
|
158
340
|
}, null), e(w, {
|
|
159
|
-
icon:
|
|
341
|
+
icon: Q,
|
|
160
342
|
tooltip: "斜体",
|
|
161
343
|
isActive: t.value.isActive("italic"),
|
|
162
344
|
onClick: () => t.value?.chain().focus().toggleItalic().run()
|
|
163
345
|
}, null), e(w, {
|
|
164
|
-
icon:
|
|
346
|
+
icon: Y,
|
|
165
347
|
tooltip: "删除线",
|
|
166
348
|
isActive: t.value.isActive("strike"),
|
|
167
349
|
onClick: () => t.value?.chain().focus().toggleStrike().run()
|
|
168
350
|
}, null), e(w, {
|
|
169
|
-
icon:
|
|
351
|
+
icon: ee,
|
|
170
352
|
tooltip: "下划线",
|
|
171
353
|
isActive: t.value.isActive("underline"),
|
|
172
354
|
onClick: () => t.value?.chain().focus().toggleUnderline().run()
|
|
173
|
-
}, null)])]
|
|
355
|
+
}, null), e(te, null, null)])]
|
|
174
356
|
}) : null;
|
|
175
357
|
}
|
|
176
|
-
}),
|
|
358
|
+
}), Wt = /* @__PURE__ */ s({
|
|
177
359
|
name: "TiptapEditor",
|
|
178
360
|
props: {
|
|
179
361
|
modelValue: {
|
|
@@ -219,9 +401,9 @@ const Oe = {
|
|
|
219
401
|
openOnClick: !1,
|
|
220
402
|
enableClickSelection: !0
|
|
221
403
|
}
|
|
222
|
-
}), xe.configure({
|
|
223
|
-
placeholder: t.placeholder
|
|
224
404
|
}), ke.configure({
|
|
405
|
+
placeholder: t.placeholder
|
|
406
|
+
}), xe.configure({
|
|
225
407
|
types: ["heading", "paragraph"]
|
|
226
408
|
}), we, be.configure({
|
|
227
409
|
nested: !0
|
|
@@ -234,11 +416,11 @@ const Oe = {
|
|
|
234
416
|
l("update:modelValue", u.getHTML());
|
|
235
417
|
}
|
|
236
418
|
});
|
|
237
|
-
return P("editor", i),
|
|
419
|
+
return P("editor", i), _(() => t.modelValue, (u) => {
|
|
238
420
|
i.value && u !== i.value.getHTML() && i.value.commands.setContent(u, {
|
|
239
421
|
emitUpdate: !1
|
|
240
422
|
});
|
|
241
|
-
}),
|
|
423
|
+
}), _(() => t.readonly, (u) => {
|
|
242
424
|
i.value?.setEditable(!u);
|
|
243
425
|
}), () => e("div", {
|
|
244
426
|
class: "tiptap-editor"
|
|
@@ -254,7 +436,7 @@ const Oe = {
|
|
|
254
436
|
})]), e(fe, {
|
|
255
437
|
class: "tiptap-content",
|
|
256
438
|
editor: i.value
|
|
257
|
-
}, null), e(
|
|
439
|
+
}, null), e(qe, null, null), o.map(({
|
|
258
440
|
plugin: u,
|
|
259
441
|
result: v
|
|
260
442
|
}) => {
|
|
@@ -264,7 +446,7 @@ const Oe = {
|
|
|
264
446
|
}, null) : null;
|
|
265
447
|
})]);
|
|
266
448
|
}
|
|
267
|
-
}),
|
|
449
|
+
}), Ke = Ae.extend({
|
|
268
450
|
addAttributes() {
|
|
269
451
|
return {
|
|
270
452
|
...this.parent?.(),
|
|
@@ -284,17 +466,17 @@ const Oe = {
|
|
|
284
466
|
const n = [];
|
|
285
467
|
return l.doc.descendants((o, i) => {
|
|
286
468
|
o.type.name === t && o.attrs.align && n.push(
|
|
287
|
-
|
|
469
|
+
Ee.node(i, i + o.nodeSize, {
|
|
288
470
|
"data-align": o.attrs.align
|
|
289
471
|
})
|
|
290
472
|
);
|
|
291
|
-
}),
|
|
473
|
+
}), Le.create(l.doc, n);
|
|
292
474
|
}
|
|
293
475
|
}
|
|
294
476
|
})
|
|
295
477
|
];
|
|
296
478
|
}
|
|
297
|
-
}),
|
|
479
|
+
}), Ge = /* @__PURE__ */ s({
|
|
298
480
|
name: "UndoIcon",
|
|
299
481
|
setup(t, {
|
|
300
482
|
attrs: l
|
|
@@ -312,7 +494,7 @@ const Oe = {
|
|
|
312
494
|
fill: "currentColor"
|
|
313
495
|
}, null)]);
|
|
314
496
|
}
|
|
315
|
-
}),
|
|
497
|
+
}), Je = /* @__PURE__ */ s({
|
|
316
498
|
name: "RedoIcon",
|
|
317
499
|
setup(t, {
|
|
318
500
|
attrs: l
|
|
@@ -330,253 +512,57 @@ const Oe = {
|
|
|
330
512
|
fill: "currentColor"
|
|
331
513
|
}, null)]);
|
|
332
514
|
}
|
|
333
|
-
}),
|
|
515
|
+
}), Xe = /* @__PURE__ */ s({
|
|
334
516
|
name: "UndoRedoButton",
|
|
335
517
|
setup() {
|
|
336
|
-
const t =
|
|
518
|
+
const t = y("editor"), l = T(() => t?.value?.can().undo() ?? !1), n = T(() => t?.value?.can().redo() ?? !1);
|
|
337
519
|
return () => e("div", null, [e(w, {
|
|
338
|
-
icon:
|
|
520
|
+
icon: Ge,
|
|
339
521
|
tooltip: "撤销",
|
|
340
522
|
disabled: !l.value,
|
|
341
523
|
onClick: () => t?.value?.chain().focus().undo().run()
|
|
342
524
|
}, null), e(w, {
|
|
343
|
-
icon:
|
|
525
|
+
icon: Je,
|
|
344
526
|
tooltip: "重做",
|
|
345
527
|
disabled: !n.value,
|
|
346
528
|
onClick: () => t?.value?.chain().focus().redo().run()
|
|
347
529
|
}, null)]);
|
|
348
530
|
}
|
|
349
|
-
}),
|
|
531
|
+
}), qt = {
|
|
350
532
|
name: "undo-redo",
|
|
351
533
|
install: () => ({ extensions: [] }),
|
|
352
|
-
toolbarComponent:
|
|
353
|
-
},
|
|
354
|
-
name: "LinkIcon",
|
|
355
|
-
setup(t, {
|
|
356
|
-
attrs: l
|
|
357
|
-
}) {
|
|
358
|
-
return () => e("svg", b({
|
|
359
|
-
width: "24",
|
|
360
|
-
height: "24",
|
|
361
|
-
viewBox: "0 0 24 24",
|
|
362
|
-
fill: "currentColor",
|
|
363
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
364
|
-
}, l), [e("path", {
|
|
365
|
-
d: "M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",
|
|
366
|
-
fill: "currentColor"
|
|
367
|
-
}, null), e("path", {
|
|
368
|
-
d: "M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",
|
|
369
|
-
fill: "currentColor"
|
|
370
|
-
}, null)]);
|
|
371
|
-
}
|
|
372
|
-
}), Ge = /* @__PURE__ */ c({
|
|
373
|
-
name: "CornerDownLeftIcon",
|
|
374
|
-
setup(t, {
|
|
375
|
-
attrs: l
|
|
376
|
-
}) {
|
|
377
|
-
return () => e("svg", b({
|
|
378
|
-
width: "24",
|
|
379
|
-
height: "24",
|
|
380
|
-
viewBox: "0 0 24 24",
|
|
381
|
-
fill: "none",
|
|
382
|
-
stroke: "currentColor",
|
|
383
|
-
"stroke-width": "2",
|
|
384
|
-
"stroke-linecap": "round",
|
|
385
|
-
"stroke-linejoin": "round",
|
|
386
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
387
|
-
}, l), [e("polyline", {
|
|
388
|
-
points: "9 10 4 15 9 20"
|
|
389
|
-
}, null), e("path", {
|
|
390
|
-
d: "M20 4v7a4 4 0 0 1-4 4H4"
|
|
391
|
-
}, null)]);
|
|
392
|
-
}
|
|
393
|
-
}), Je = /* @__PURE__ */ c({
|
|
394
|
-
name: "ExternalLinkIcon",
|
|
395
|
-
setup(t, {
|
|
396
|
-
attrs: l
|
|
397
|
-
}) {
|
|
398
|
-
return () => e("svg", b({
|
|
399
|
-
width: "24",
|
|
400
|
-
height: "24",
|
|
401
|
-
viewBox: "0 0 24 24",
|
|
402
|
-
fill: "none",
|
|
403
|
-
stroke: "currentColor",
|
|
404
|
-
"stroke-width": "2",
|
|
405
|
-
"stroke-linecap": "round",
|
|
406
|
-
"stroke-linejoin": "round",
|
|
407
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
408
|
-
}, l), [e("path", {
|
|
409
|
-
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
|
|
410
|
-
}, null), e("polyline", {
|
|
411
|
-
points: "15 3 21 3 21 9"
|
|
412
|
-
}, null), e("line", {
|
|
413
|
-
x1: "10",
|
|
414
|
-
y1: "14",
|
|
415
|
-
x2: "21",
|
|
416
|
-
y2: "3"
|
|
417
|
-
}, null)]);
|
|
418
|
-
}
|
|
419
|
-
}), Xe = /* @__PURE__ */ c({
|
|
420
|
-
name: "TrashIcon",
|
|
421
|
-
setup(t, {
|
|
422
|
-
attrs: l
|
|
423
|
-
}) {
|
|
424
|
-
return () => e("svg", b({
|
|
425
|
-
width: "24",
|
|
426
|
-
height: "24",
|
|
427
|
-
viewBox: "0 0 24 24",
|
|
428
|
-
fill: "none",
|
|
429
|
-
stroke: "currentColor",
|
|
430
|
-
"stroke-width": "2",
|
|
431
|
-
"stroke-linecap": "round",
|
|
432
|
-
"stroke-linejoin": "round",
|
|
433
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
434
|
-
}, l), [e("polyline", {
|
|
435
|
-
points: "3 6 5 6 21 6"
|
|
436
|
-
}, null), e("path", {
|
|
437
|
-
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"
|
|
438
|
-
}, null)]);
|
|
439
|
-
}
|
|
440
|
-
}), Qe = /* @__PURE__ */ c({
|
|
441
|
-
name: "LinkPopover",
|
|
442
|
-
setup() {
|
|
443
|
-
const t = H("editor"), l = x(!1), n = x("");
|
|
444
|
-
let o = !1;
|
|
445
|
-
R(() => t?.value?.isActive("link"), (r) => {
|
|
446
|
-
o || r && (n.value = t?.value?.getAttributes("link").href ?? "", z(() => {
|
|
447
|
-
l.value = !0;
|
|
448
|
-
}));
|
|
449
|
-
});
|
|
450
|
-
const i = () => {
|
|
451
|
-
const r = t?.value;
|
|
452
|
-
if (!r || !n.value) return;
|
|
453
|
-
o = !0;
|
|
454
|
-
const {
|
|
455
|
-
empty: C
|
|
456
|
-
} = r.state.selection;
|
|
457
|
-
let g = r.chain().focus().extendMarkRange("link").setLink({
|
|
458
|
-
href: n.value
|
|
459
|
-
});
|
|
460
|
-
C && (g = g.insertContent({
|
|
461
|
-
type: "text",
|
|
462
|
-
text: n.value
|
|
463
|
-
})), g.run(), l.value = !1, z(() => {
|
|
464
|
-
o = !1;
|
|
465
|
-
});
|
|
466
|
-
}, u = () => {
|
|
467
|
-
const r = t?.value;
|
|
468
|
-
r && (o = !0, r.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", l.value = !1, z(() => {
|
|
469
|
-
o = !1;
|
|
470
|
-
}));
|
|
471
|
-
}, v = () => {
|
|
472
|
-
const r = t?.value?.getAttributes("link").href;
|
|
473
|
-
r && window.open(r, "_blank", "noopener,noreferrer");
|
|
474
|
-
}, p = (r) => {
|
|
475
|
-
r.key === "Enter" && (r.preventDefault(), i());
|
|
476
|
-
}, s = (r) => {
|
|
477
|
-
r && (n.value = t?.value?.getAttributes("link").href ?? ""), l.value = r;
|
|
478
|
-
}, B = (r) => {
|
|
479
|
-
n.value = r;
|
|
480
|
-
};
|
|
481
|
-
return () => {
|
|
482
|
-
const r = t?.value?.isActive("link") ?? !1;
|
|
483
|
-
return e(J, {
|
|
484
|
-
visible: l.value,
|
|
485
|
-
"onUpdate:visible": s,
|
|
486
|
-
placement: "bottom",
|
|
487
|
-
width: 300,
|
|
488
|
-
trigger: "click",
|
|
489
|
-
showArrow: !1,
|
|
490
|
-
popperClass: "link-popover-popper",
|
|
491
|
-
offset: 6
|
|
492
|
-
}, {
|
|
493
|
-
reference: () => e("span", null, [e(w, {
|
|
494
|
-
tooltip: "链接",
|
|
495
|
-
icon: Ke,
|
|
496
|
-
class: ["tiptap-button", {
|
|
497
|
-
"is-active": r
|
|
498
|
-
}]
|
|
499
|
-
}, null)]),
|
|
500
|
-
default: () => e("div", {
|
|
501
|
-
class: "link-popover-inner"
|
|
502
|
-
}, [e(X, {
|
|
503
|
-
modelValue: n.value,
|
|
504
|
-
"onUpdate:modelValue": B,
|
|
505
|
-
type: "url",
|
|
506
|
-
placeholder: "请输入链接...",
|
|
507
|
-
size: "small",
|
|
508
|
-
autofocus: !0,
|
|
509
|
-
onKeydown: p
|
|
510
|
-
}, null), e("div", {
|
|
511
|
-
class: "link-popover-actions"
|
|
512
|
-
}, [e(D, {
|
|
513
|
-
content: "确认",
|
|
514
|
-
showArrow: !1,
|
|
515
|
-
offset: 4
|
|
516
|
-
}, {
|
|
517
|
-
default: () => [e(Z, {
|
|
518
|
-
text: !0,
|
|
519
|
-
icon: Ge,
|
|
520
|
-
disabled: !n.value,
|
|
521
|
-
onClick: i
|
|
522
|
-
}, null)]
|
|
523
|
-
}), e(D, {
|
|
524
|
-
content: "在新标签页打开",
|
|
525
|
-
showArrow: !1,
|
|
526
|
-
offset: 4
|
|
527
|
-
}, {
|
|
528
|
-
default: () => [e(Z, {
|
|
529
|
-
text: !0,
|
|
530
|
-
icon: Je,
|
|
531
|
-
disabled: !n.value && !r,
|
|
532
|
-
onClick: v
|
|
533
|
-
}, null)]
|
|
534
|
-
}), e(D, {
|
|
535
|
-
content: "移除链接",
|
|
536
|
-
showArrow: !1,
|
|
537
|
-
offset: 4
|
|
538
|
-
}, {
|
|
539
|
-
default: () => [e(Z, {
|
|
540
|
-
text: !0,
|
|
541
|
-
icon: Xe,
|
|
542
|
-
disabled: !r,
|
|
543
|
-
onClick: u
|
|
544
|
-
}, null)]
|
|
545
|
-
})])])
|
|
546
|
-
});
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
}), Ye = /* @__PURE__ */ c({
|
|
534
|
+
toolbarComponent: Xe
|
|
535
|
+
}, Qe = /* @__PURE__ */ s({
|
|
550
536
|
name: "TextStyleButton",
|
|
551
537
|
setup() {
|
|
552
|
-
const t =
|
|
538
|
+
const t = y("editor");
|
|
553
539
|
return () => e("div", null, [e(w, {
|
|
554
|
-
icon:
|
|
540
|
+
icon: X,
|
|
555
541
|
tooltip: "粗体",
|
|
556
542
|
isActive: t?.value?.isActive("bold"),
|
|
557
543
|
onClick: () => t?.value?.chain().focus().toggleBold().run()
|
|
558
544
|
}, null), e(w, {
|
|
559
|
-
icon:
|
|
545
|
+
icon: Q,
|
|
560
546
|
tooltip: "斜体",
|
|
561
547
|
isActive: t?.value?.isActive("italic"),
|
|
562
548
|
onClick: () => t?.value?.chain().focus().toggleItalic().run()
|
|
563
549
|
}, null), e(w, {
|
|
564
|
-
icon:
|
|
550
|
+
icon: Y,
|
|
565
551
|
tooltip: "删除线",
|
|
566
552
|
isActive: t?.value?.isActive("strike"),
|
|
567
553
|
onClick: () => t?.value?.chain().focus().toggleStrike().run()
|
|
568
554
|
}, null), e(w, {
|
|
569
|
-
icon:
|
|
555
|
+
icon: ee,
|
|
570
556
|
tooltip: "下划线",
|
|
571
557
|
isActive: t?.value?.isActive("underline"),
|
|
572
558
|
onClick: () => t?.value?.chain().focus().toggleUnderline().run()
|
|
573
|
-
}, null), e(
|
|
559
|
+
}, null), e(te, null, null)]);
|
|
574
560
|
}
|
|
575
|
-
}),
|
|
561
|
+
}), Kt = {
|
|
576
562
|
name: "text-style",
|
|
577
563
|
install: () => ({ extensions: [] }),
|
|
578
|
-
toolbarComponent:
|
|
579
|
-
}, le = /* @__PURE__ */
|
|
564
|
+
toolbarComponent: Qe
|
|
565
|
+
}, le = /* @__PURE__ */ s({
|
|
580
566
|
name: "AlignLeftIcon",
|
|
581
567
|
setup(t, {
|
|
582
568
|
attrs: l
|
|
@@ -604,7 +590,7 @@ const Oe = {
|
|
|
604
590
|
fill: "currentColor"
|
|
605
591
|
}, null)]);
|
|
606
592
|
}
|
|
607
|
-
}), ne = /* @__PURE__ */
|
|
593
|
+
}), ne = /* @__PURE__ */ s({
|
|
608
594
|
name: "AlignCenterIcon",
|
|
609
595
|
setup(t, {
|
|
610
596
|
attrs: l
|
|
@@ -632,7 +618,7 @@ const Oe = {
|
|
|
632
618
|
fill: "currentColor"
|
|
633
619
|
}, null)]);
|
|
634
620
|
}
|
|
635
|
-
}), oe = /* @__PURE__ */
|
|
621
|
+
}), oe = /* @__PURE__ */ s({
|
|
636
622
|
name: "AlignRightIcon",
|
|
637
623
|
setup(t, {
|
|
638
624
|
attrs: l
|
|
@@ -660,7 +646,7 @@ const Oe = {
|
|
|
660
646
|
fill: "currentColor"
|
|
661
647
|
}, null)]);
|
|
662
648
|
}
|
|
663
|
-
}),
|
|
649
|
+
}), Ye = /* @__PURE__ */ s({
|
|
664
650
|
name: "AlignJustifyIcon",
|
|
665
651
|
setup(t, {
|
|
666
652
|
attrs: l
|
|
@@ -688,10 +674,10 @@ const Oe = {
|
|
|
688
674
|
fill: "currentColor"
|
|
689
675
|
}, null)]);
|
|
690
676
|
}
|
|
691
|
-
}),
|
|
677
|
+
}), et = /* @__PURE__ */ s({
|
|
692
678
|
name: "TextAlignButton",
|
|
693
679
|
setup() {
|
|
694
|
-
const t =
|
|
680
|
+
const t = y("editor");
|
|
695
681
|
return () => e("div", null, [e(w, {
|
|
696
682
|
icon: le,
|
|
697
683
|
tooltip: "左边对齐",
|
|
@@ -714,7 +700,7 @@ const Oe = {
|
|
|
714
700
|
}),
|
|
715
701
|
onClick: () => t?.value?.chain().focus().setTextAlign("right").run()
|
|
716
702
|
}, null), e(w, {
|
|
717
|
-
icon:
|
|
703
|
+
icon: Ye,
|
|
718
704
|
tooltip: "两端对齐",
|
|
719
705
|
isActive: t?.value?.isActive({
|
|
720
706
|
textAlign: "justify"
|
|
@@ -722,11 +708,11 @@ const Oe = {
|
|
|
722
708
|
onClick: () => t?.value?.chain().focus().setTextAlign("justify").run()
|
|
723
709
|
}, null)]);
|
|
724
710
|
}
|
|
725
|
-
}),
|
|
711
|
+
}), Gt = {
|
|
726
712
|
name: "text-align",
|
|
727
713
|
install: () => ({ extensions: [] }),
|
|
728
|
-
toolbarComponent:
|
|
729
|
-
},
|
|
714
|
+
toolbarComponent: et
|
|
715
|
+
}, tt = /* @__PURE__ */ s({
|
|
730
716
|
name: "ListIcon",
|
|
731
717
|
setup(t, {
|
|
732
718
|
attrs: l
|
|
@@ -769,7 +755,7 @@ const Oe = {
|
|
|
769
755
|
fill: "currentColor"
|
|
770
756
|
}, null)]);
|
|
771
757
|
}
|
|
772
|
-
}),
|
|
758
|
+
}), lt = /* @__PURE__ */ s({
|
|
773
759
|
name: "ListOrderedIcon",
|
|
774
760
|
setup(t, {
|
|
775
761
|
attrs: l
|
|
@@ -812,7 +798,7 @@ const Oe = {
|
|
|
812
798
|
fill: "currentColor"
|
|
813
799
|
}, null)]);
|
|
814
800
|
}
|
|
815
|
-
}),
|
|
801
|
+
}), nt = /* @__PURE__ */ s({
|
|
816
802
|
name: "ListTodoIcon",
|
|
817
803
|
setup(t, {
|
|
818
804
|
attrs: l
|
|
@@ -850,32 +836,32 @@ const Oe = {
|
|
|
850
836
|
fill: "currentColor"
|
|
851
837
|
}, null)]);
|
|
852
838
|
}
|
|
853
|
-
}),
|
|
839
|
+
}), ot = /* @__PURE__ */ s({
|
|
854
840
|
name: "ListButton",
|
|
855
841
|
setup() {
|
|
856
|
-
const t =
|
|
842
|
+
const t = y("editor");
|
|
857
843
|
return () => e("div", null, [e(w, {
|
|
858
|
-
icon:
|
|
844
|
+
icon: tt,
|
|
859
845
|
tooltip: "无序列表",
|
|
860
846
|
isActive: t?.value?.isActive("bulletList"),
|
|
861
847
|
onClick: () => t?.value?.chain().focus().toggleBulletList().run()
|
|
862
848
|
}, null), e(w, {
|
|
863
|
-
icon:
|
|
849
|
+
icon: lt,
|
|
864
850
|
tooltip: "有序列表",
|
|
865
851
|
isActive: t?.value?.isActive("orderedList"),
|
|
866
852
|
onClick: () => t?.value?.chain().focus().toggleOrderedList().run()
|
|
867
853
|
}, null), e(w, {
|
|
868
|
-
icon:
|
|
854
|
+
icon: nt,
|
|
869
855
|
tooltip: "任务列表",
|
|
870
856
|
isActive: t?.value?.isActive("taskList"),
|
|
871
857
|
onClick: () => t?.value?.chain().focus().toggleTaskList().run()
|
|
872
858
|
}, null)]);
|
|
873
859
|
}
|
|
874
|
-
}),
|
|
860
|
+
}), Jt = {
|
|
875
861
|
name: "list",
|
|
876
862
|
install: () => ({ extensions: [] }),
|
|
877
|
-
toolbarComponent:
|
|
878
|
-
},
|
|
863
|
+
toolbarComponent: ot
|
|
864
|
+
}, it = /* @__PURE__ */ s({
|
|
879
865
|
name: "CodeBlockIcon",
|
|
880
866
|
setup(t, {
|
|
881
867
|
attrs: l
|
|
@@ -896,24 +882,24 @@ const Oe = {
|
|
|
896
882
|
points: "8 6 2 12 8 18"
|
|
897
883
|
}, null)]);
|
|
898
884
|
}
|
|
899
|
-
}),
|
|
885
|
+
}), ut = /* @__PURE__ */ s({
|
|
900
886
|
name: "CodeBlockButton",
|
|
901
887
|
setup() {
|
|
902
|
-
const t =
|
|
888
|
+
const t = y("editor");
|
|
903
889
|
return () => e(w, {
|
|
904
|
-
icon:
|
|
890
|
+
icon: it,
|
|
905
891
|
tooltip: "代码块",
|
|
906
892
|
isActive: t?.value?.isActive("codeBlock"),
|
|
907
893
|
onClick: () => t?.value?.chain().focus().toggleCodeBlock().run()
|
|
908
894
|
}, null);
|
|
909
895
|
}
|
|
910
|
-
}),
|
|
896
|
+
}), rt = Te(Ve), Xt = {
|
|
911
897
|
name: "code-block",
|
|
912
898
|
install: () => ({
|
|
913
|
-
extensions: [Fe.configure({ lowlight:
|
|
899
|
+
extensions: [Fe.configure({ lowlight: rt, defaultLanguage: "plaintext" })]
|
|
914
900
|
}),
|
|
915
|
-
toolbarComponent:
|
|
916
|
-
},
|
|
901
|
+
toolbarComponent: ut
|
|
902
|
+
}, at = /* @__PURE__ */ s({
|
|
917
903
|
name: "TableIcon",
|
|
918
904
|
setup(t, {
|
|
919
905
|
attrs: l
|
|
@@ -931,26 +917,26 @@ const Oe = {
|
|
|
931
917
|
fill: "currentColor"
|
|
932
918
|
}, null)]);
|
|
933
919
|
}
|
|
934
|
-
}),
|
|
920
|
+
}), st = 8, ct = 8, dt = /* @__PURE__ */ s({
|
|
935
921
|
name: "TableButton",
|
|
936
922
|
setup() {
|
|
937
|
-
const t =
|
|
938
|
-
n.value = p, o.value =
|
|
923
|
+
const t = y("editor"), l = H(!1), n = H(0), o = H(0), i = (p, a) => {
|
|
924
|
+
n.value = p, o.value = a;
|
|
939
925
|
}, u = () => {
|
|
940
926
|
n.value = 0, o.value = 0;
|
|
941
|
-
}, v = (p,
|
|
927
|
+
}, v = (p, a) => {
|
|
942
928
|
t?.value?.chain().focus().insertTable({
|
|
943
|
-
rows:
|
|
929
|
+
rows: a,
|
|
944
930
|
cols: p,
|
|
945
931
|
withHeaderRow: !0
|
|
946
932
|
}).run(), l.value = !1;
|
|
947
933
|
};
|
|
948
|
-
return () => e(
|
|
934
|
+
return () => e(G, {
|
|
949
935
|
visible: l.value,
|
|
950
936
|
"onUpdate:visible": (p) => l.value = p,
|
|
951
937
|
trigger: "click",
|
|
952
938
|
placement: "bottom-start",
|
|
953
|
-
popperClass: "table-picker-popper",
|
|
939
|
+
popperClass: "tiptap-table-picker-popper",
|
|
954
940
|
width: "auto",
|
|
955
941
|
showArrow: !1
|
|
956
942
|
}, {
|
|
@@ -966,43 +952,43 @@ const Oe = {
|
|
|
966
952
|
"is-active": l.value
|
|
967
953
|
}]
|
|
968
954
|
}, {
|
|
969
|
-
default: () => [e(
|
|
955
|
+
default: () => [e(at, {
|
|
970
956
|
class: "tiptap-button-icon"
|
|
971
957
|
}, null)]
|
|
972
958
|
})]
|
|
973
959
|
})]),
|
|
974
960
|
default: () => e("div", {
|
|
975
|
-
class: "table-picker"
|
|
961
|
+
class: "tiptap-table-picker"
|
|
976
962
|
}, [e("div", {
|
|
977
|
-
class: "table-picker-grid",
|
|
963
|
+
class: "tiptap-table-picker-grid",
|
|
978
964
|
onMouseleave: u
|
|
979
|
-
}, [Array.from({
|
|
980
|
-
length: dt
|
|
981
|
-
}, (p, s) => e("div", {
|
|
982
|
-
key: s,
|
|
983
|
-
class: "table-picker-row"
|
|
984
965
|
}, [Array.from({
|
|
985
966
|
length: ct
|
|
986
|
-
}, (
|
|
987
|
-
key:
|
|
988
|
-
class:
|
|
989
|
-
|
|
967
|
+
}, (p, a) => e("div", {
|
|
968
|
+
key: a,
|
|
969
|
+
class: "tiptap-table-picker-row"
|
|
970
|
+
}, [Array.from({
|
|
971
|
+
length: st
|
|
972
|
+
}, (C, h) => e("div", {
|
|
973
|
+
key: h,
|
|
974
|
+
class: ["tiptap-table-picker-cell", {
|
|
975
|
+
"is-active": h < n.value && a < o.value
|
|
990
976
|
}],
|
|
991
|
-
onMouseenter: () => i(
|
|
992
|
-
onClick: () => v(
|
|
977
|
+
onMouseenter: () => i(h + 1, a + 1),
|
|
978
|
+
onClick: () => v(h + 1, a + 1)
|
|
993
979
|
}, null))]))]), e("div", {
|
|
994
|
-
class: "table-picker-footer"
|
|
980
|
+
class: "tiptap-table-picker-footer"
|
|
995
981
|
}, [e("div", {
|
|
996
|
-
class: "table-picker-counter"
|
|
997
|
-
}, [e("span", null, [
|
|
998
|
-
class: "table-picker-x"
|
|
999
|
-
}, [
|
|
1000
|
-
class: "table-picker-counter"
|
|
1001
|
-
}, [e("span", null, [
|
|
982
|
+
class: "tiptap-table-picker-counter"
|
|
983
|
+
}, [e("span", null, [g("列")]), e("span", null, [n.value || 1])]), e("span", {
|
|
984
|
+
class: "tiptap-table-picker-x"
|
|
985
|
+
}, [g("x")]), e("div", {
|
|
986
|
+
class: "tiptap-table-picker-counter"
|
|
987
|
+
}, [e("span", null, [g("行")]), e("span", null, [o.value || 1])])])])
|
|
1002
988
|
});
|
|
1003
989
|
}
|
|
1004
990
|
});
|
|
1005
|
-
function
|
|
991
|
+
function pt(t) {
|
|
1006
992
|
let l = t.nodeType === Node.TEXT_NODE ? t.parentElement : t;
|
|
1007
993
|
for (; l && l instanceof HTMLElement; ) {
|
|
1008
994
|
if (l.tagName === "TD" || l.tagName === "TH") return l;
|
|
@@ -1010,27 +996,27 @@ function Ct(t) {
|
|
|
1010
996
|
}
|
|
1011
997
|
return null;
|
|
1012
998
|
}
|
|
1013
|
-
function
|
|
999
|
+
function Ct(t) {
|
|
1014
1000
|
if (!t.isActive("tableCell") && !t.isActive("tableHeader")) return null;
|
|
1015
1001
|
const {
|
|
1016
1002
|
node: l
|
|
1017
|
-
} = t.view.domAtPos(t.state.selection.from), n =
|
|
1003
|
+
} = t.view.domAtPos(t.state.selection.from), n = pt(l);
|
|
1018
1004
|
if (!n) return null;
|
|
1019
1005
|
const o = n.parentElement, i = o.parentElement, u = n.closest("table");
|
|
1020
1006
|
if (!u) return null;
|
|
1021
|
-
const v = Array.from(o.children).indexOf(n), p = Array.from(i.children).indexOf(o),
|
|
1007
|
+
const v = Array.from(o.children).indexOf(n), p = Array.from(i.children).indexOf(o), a = o.children.length, C = i.children.length, h = n.getBoundingClientRect(), c = u.getBoundingClientRect(), x = t.view.dom.closest(".tiptap-editor").getBoundingClientRect();
|
|
1022
1008
|
return {
|
|
1023
1009
|
cell: n,
|
|
1024
1010
|
colIndex: v,
|
|
1025
1011
|
rowIndex: p,
|
|
1026
|
-
totalCols:
|
|
1027
|
-
totalRows:
|
|
1028
|
-
cellRect:
|
|
1029
|
-
tableRect:
|
|
1030
|
-
editorRect:
|
|
1012
|
+
totalCols: a,
|
|
1013
|
+
totalRows: C,
|
|
1014
|
+
cellRect: h,
|
|
1015
|
+
tableRect: c,
|
|
1016
|
+
editorRect: x
|
|
1031
1017
|
};
|
|
1032
1018
|
}
|
|
1033
|
-
function
|
|
1019
|
+
function q(t) {
|
|
1034
1020
|
const {
|
|
1035
1021
|
state: l
|
|
1036
1022
|
} = t, n = l.selection.from;
|
|
@@ -1043,71 +1029,71 @@ function K(t) {
|
|
|
1043
1029
|
}, !1;
|
|
1044
1030
|
}), o;
|
|
1045
1031
|
}
|
|
1046
|
-
const
|
|
1032
|
+
const vt = /* @__PURE__ */ s({
|
|
1047
1033
|
name: "TableControls",
|
|
1048
1034
|
setup() {
|
|
1049
|
-
const t =
|
|
1035
|
+
const t = y("editor"), l = y("readonly"), n = H(null), o = H(null);
|
|
1050
1036
|
function i() {
|
|
1051
|
-
const
|
|
1052
|
-
if (o.value && (o.value.classList.remove("
|
|
1037
|
+
const h = t?.value;
|
|
1038
|
+
if (o.value && (o.value.classList.remove("tiptap-cell-focused"), o.value = null), !h) {
|
|
1053
1039
|
n.value = null;
|
|
1054
1040
|
return;
|
|
1055
1041
|
}
|
|
1056
|
-
const
|
|
1057
|
-
n.value =
|
|
1042
|
+
const c = Ct(h);
|
|
1043
|
+
n.value = c, c && (c.cell.classList.add("tiptap-cell-focused"), o.value = c.cell);
|
|
1058
1044
|
}
|
|
1059
|
-
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
|
|
1045
|
+
K((h) => {
|
|
1046
|
+
const c = t?.value;
|
|
1047
|
+
c && (c.on("selectionUpdate", i), c.on("transaction", i), h(() => {
|
|
1048
|
+
c.off("selectionUpdate", i), c.off("transaction", i), o.value && (o.value.classList.remove("tiptap-cell-focused"), o.value = null);
|
|
1063
1049
|
}));
|
|
1064
1050
|
});
|
|
1065
|
-
function u(
|
|
1066
|
-
const
|
|
1067
|
-
if (!
|
|
1051
|
+
function u(h) {
|
|
1052
|
+
const c = t?.value;
|
|
1053
|
+
if (!c || !n.value) return;
|
|
1068
1054
|
const {
|
|
1069
|
-
colIndex:
|
|
1055
|
+
colIndex: x,
|
|
1070
1056
|
totalCols: I
|
|
1071
|
-
} = n.value, k =
|
|
1057
|
+
} = n.value, k = h === "left" ? x - 1 : x + 1;
|
|
1072
1058
|
if (k < 0 || k >= I) return;
|
|
1073
|
-
const
|
|
1074
|
-
if (!
|
|
1059
|
+
const r = q(c);
|
|
1060
|
+
if (!r) return;
|
|
1075
1061
|
const {
|
|
1076
1062
|
node: d,
|
|
1077
1063
|
pos: f
|
|
1078
|
-
} =
|
|
1079
|
-
d.forEach((
|
|
1080
|
-
if (
|
|
1081
|
-
|
|
1064
|
+
} = r, m = [];
|
|
1065
|
+
d.forEach((E) => {
|
|
1066
|
+
if (E.type.name !== "tableRow") {
|
|
1067
|
+
m.push(E);
|
|
1082
1068
|
return;
|
|
1083
1069
|
}
|
|
1084
1070
|
const A = [];
|
|
1085
|
-
|
|
1086
|
-
const
|
|
1087
|
-
A[
|
|
1071
|
+
E.forEach((S) => A.push(S));
|
|
1072
|
+
const R = A[x];
|
|
1073
|
+
A[x] = A[k], A[k] = R, m.push(E.type.create(E.attrs, A, E.marks));
|
|
1088
1074
|
});
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1075
|
+
const B = d.type.create(d.attrs, m, d.marks), V = c.state.tr.replaceWith(f, f + d.nodeSize, B);
|
|
1076
|
+
c.view.dispatch(V);
|
|
1091
1077
|
}
|
|
1092
|
-
function v(
|
|
1093
|
-
const
|
|
1094
|
-
if (!
|
|
1078
|
+
function v(h) {
|
|
1079
|
+
const c = t?.value;
|
|
1080
|
+
if (!c || !n.value) return;
|
|
1095
1081
|
const {
|
|
1096
|
-
rowIndex:
|
|
1082
|
+
rowIndex: x,
|
|
1097
1083
|
totalRows: I
|
|
1098
|
-
} = n.value, k =
|
|
1084
|
+
} = n.value, k = h === "up" ? x - 1 : x + 1;
|
|
1099
1085
|
if (k < 0 || k >= I) return;
|
|
1100
|
-
const
|
|
1101
|
-
if (!
|
|
1086
|
+
const r = q(c);
|
|
1087
|
+
if (!r) return;
|
|
1102
1088
|
const {
|
|
1103
1089
|
node: d,
|
|
1104
1090
|
pos: f
|
|
1105
|
-
} =
|
|
1106
|
-
d.forEach((A) =>
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1109
|
-
const V = d.type.create(d.attrs,
|
|
1110
|
-
|
|
1091
|
+
} = r, m = [];
|
|
1092
|
+
d.forEach((A) => m.push(A));
|
|
1093
|
+
const B = m[x];
|
|
1094
|
+
m[x] = m[k], m[k] = B;
|
|
1095
|
+
const V = d.type.create(d.attrs, m, d.marks), E = c.state.tr.replaceWith(f, f + d.nodeSize, V);
|
|
1096
|
+
c.view.dispatch(E);
|
|
1111
1097
|
}
|
|
1112
1098
|
const p = () => e("svg", {
|
|
1113
1099
|
width: "16",
|
|
@@ -1126,7 +1112,7 @@ const ft = /* @__PURE__ */ c({
|
|
|
1126
1112
|
cx: "14",
|
|
1127
1113
|
cy: "2",
|
|
1128
1114
|
r: "1.5"
|
|
1129
|
-
}, null)]),
|
|
1115
|
+
}, null)]), a = () => e("svg", {
|
|
1130
1116
|
width: "4",
|
|
1131
1117
|
height: "16",
|
|
1132
1118
|
viewBox: "0 0 4 16",
|
|
@@ -1143,7 +1129,7 @@ const ft = /* @__PURE__ */ c({
|
|
|
1143
1129
|
cx: "2",
|
|
1144
1130
|
cy: "14",
|
|
1145
1131
|
r: "1.5"
|
|
1146
|
-
}, null)]),
|
|
1132
|
+
}, null)]), C = () => e("svg", {
|
|
1147
1133
|
width: "10",
|
|
1148
1134
|
height: "10",
|
|
1149
1135
|
viewBox: "0 0 10 10",
|
|
@@ -1156,36 +1142,36 @@ const ft = /* @__PURE__ */ c({
|
|
|
1156
1142
|
}, null)]);
|
|
1157
1143
|
return () => {
|
|
1158
1144
|
if (l?.value) return null;
|
|
1159
|
-
const
|
|
1160
|
-
if (!
|
|
1145
|
+
const h = n.value;
|
|
1146
|
+
if (!h) return null;
|
|
1161
1147
|
const {
|
|
1162
|
-
colIndex:
|
|
1163
|
-
rowIndex:
|
|
1148
|
+
colIndex: c,
|
|
1149
|
+
rowIndex: x,
|
|
1164
1150
|
totalCols: I,
|
|
1165
1151
|
totalRows: k,
|
|
1166
|
-
cellRect:
|
|
1152
|
+
cellRect: r,
|
|
1167
1153
|
tableRect: d,
|
|
1168
1154
|
editorRect: f
|
|
1169
|
-
} =
|
|
1155
|
+
} = h, m = d.top - f.top, B = d.left - f.left, V = d.right - f.left, E = d.bottom - f.top, A = r.left - f.left, R = r.top - f.top, S = r.width, z = r.height, ie = {
|
|
1170
1156
|
position: "absolute",
|
|
1171
|
-
top: `${
|
|
1172
|
-
left: `${A +
|
|
1157
|
+
top: `${m - 20}px`,
|
|
1158
|
+
left: `${A + S / 2 - 18}px`
|
|
1173
1159
|
}, ue = {
|
|
1174
1160
|
position: "absolute",
|
|
1175
|
-
top: `${
|
|
1176
|
-
left: `${
|
|
1161
|
+
top: `${R + z / 2 - 18}px`,
|
|
1162
|
+
left: `${B - 20}px`
|
|
1177
1163
|
}, re = {
|
|
1178
1164
|
position: "absolute",
|
|
1179
|
-
top: `${
|
|
1165
|
+
top: `${R + z / 2 - 12}px`,
|
|
1180
1166
|
left: `${V + 6}px`
|
|
1181
1167
|
}, ae = {
|
|
1182
1168
|
position: "absolute",
|
|
1183
|
-
top: `${
|
|
1184
|
-
left: `${A +
|
|
1185
|
-
}, se =
|
|
1169
|
+
top: `${E + 6}px`,
|
|
1170
|
+
left: `${A + S / 2 - 12}px`
|
|
1171
|
+
}, se = c === 0, O = c === I - 1, ce = x === 0, $ = x === k - 1, F = t?.value;
|
|
1186
1172
|
return e("div", {
|
|
1187
|
-
class: "table-
|
|
1188
|
-
}, [e(
|
|
1173
|
+
class: "tiptap-table-controls"
|
|
1174
|
+
}, [e(N, {
|
|
1189
1175
|
trigger: "click",
|
|
1190
1176
|
placement: "bottom",
|
|
1191
1177
|
style: ie,
|
|
@@ -1194,35 +1180,35 @@ const ft = /* @__PURE__ */ c({
|
|
|
1194
1180
|
}
|
|
1195
1181
|
}, {
|
|
1196
1182
|
default: () => [e("button", {
|
|
1197
|
-
class: "
|
|
1183
|
+
class: "tiptap-table-btn tiptap-table-btn--col"
|
|
1198
1184
|
}, [e(p, null, null)])],
|
|
1199
|
-
dropdown: () => e(
|
|
1200
|
-
default: () => [e(
|
|
1185
|
+
dropdown: () => e(j, null, {
|
|
1186
|
+
default: () => [e(L, {
|
|
1201
1187
|
command: "move-left",
|
|
1202
1188
|
disabled: se
|
|
1203
1189
|
}, {
|
|
1204
|
-
default: () => [
|
|
1205
|
-
}), e(
|
|
1190
|
+
default: () => [g("移动列到左侧")]
|
|
1191
|
+
}), e(L, {
|
|
1206
1192
|
command: "move-right",
|
|
1207
|
-
disabled:
|
|
1193
|
+
disabled: O
|
|
1208
1194
|
}, {
|
|
1209
|
-
default: () => [
|
|
1210
|
-
}), e(
|
|
1195
|
+
default: () => [g("移动列到右侧")]
|
|
1196
|
+
}), e(L, {
|
|
1211
1197
|
command: "insert-left"
|
|
1212
1198
|
}, {
|
|
1213
|
-
default: () => [
|
|
1214
|
-
}), e(
|
|
1199
|
+
default: () => [g("在左侧插入一列")]
|
|
1200
|
+
}), e(L, {
|
|
1215
1201
|
command: "insert-right"
|
|
1216
1202
|
}, {
|
|
1217
|
-
default: () => [
|
|
1218
|
-
}), e(
|
|
1203
|
+
default: () => [g("在右侧插入一列")]
|
|
1204
|
+
}), e(L, {
|
|
1219
1205
|
command: "delete",
|
|
1220
1206
|
divided: !0
|
|
1221
1207
|
}, {
|
|
1222
|
-
default: () => [
|
|
1208
|
+
default: () => [g("删除列")]
|
|
1223
1209
|
})]
|
|
1224
1210
|
})
|
|
1225
|
-
}), e(
|
|
1211
|
+
}), e(N, {
|
|
1226
1212
|
trigger: "click",
|
|
1227
1213
|
placement: "right",
|
|
1228
1214
|
style: ue,
|
|
@@ -1231,53 +1217,53 @@ const ft = /* @__PURE__ */ c({
|
|
|
1231
1217
|
}
|
|
1232
1218
|
}, {
|
|
1233
1219
|
default: () => [e("button", {
|
|
1234
|
-
class: "
|
|
1235
|
-
}, [e(
|
|
1236
|
-
dropdown: () => e(
|
|
1237
|
-
default: () => [e(
|
|
1220
|
+
class: "tiptap-table-btn tiptap-table-btn--row"
|
|
1221
|
+
}, [e(a, null, null)])],
|
|
1222
|
+
dropdown: () => e(j, null, {
|
|
1223
|
+
default: () => [e(L, {
|
|
1238
1224
|
command: "move-up",
|
|
1239
1225
|
disabled: ce
|
|
1240
1226
|
}, {
|
|
1241
|
-
default: () => [
|
|
1242
|
-
}), e(
|
|
1227
|
+
default: () => [g("上移")]
|
|
1228
|
+
}), e(L, {
|
|
1243
1229
|
command: "move-down",
|
|
1244
|
-
disabled:
|
|
1230
|
+
disabled: $
|
|
1245
1231
|
}, {
|
|
1246
|
-
default: () => [
|
|
1247
|
-
}), e(
|
|
1232
|
+
default: () => [g("下移")]
|
|
1233
|
+
}), e(L, {
|
|
1248
1234
|
command: "insert-above"
|
|
1249
1235
|
}, {
|
|
1250
|
-
default: () => [
|
|
1251
|
-
}), e(
|
|
1236
|
+
default: () => [g("在上方插入一行")]
|
|
1237
|
+
}), e(L, {
|
|
1252
1238
|
command: "insert-below"
|
|
1253
1239
|
}, {
|
|
1254
|
-
default: () => [
|
|
1255
|
-
}), e(
|
|
1240
|
+
default: () => [g("在下方插入一行")]
|
|
1241
|
+
}), e(L, {
|
|
1256
1242
|
command: "delete",
|
|
1257
1243
|
divided: !0
|
|
1258
1244
|
}, {
|
|
1259
|
-
default: () => [
|
|
1245
|
+
default: () => [g("删除行")]
|
|
1260
1246
|
})]
|
|
1261
1247
|
})
|
|
1262
|
-
}),
|
|
1263
|
-
class: "
|
|
1248
|
+
}), O && e("button", {
|
|
1249
|
+
class: "tiptap-table-btn tiptap-table-btn--add",
|
|
1264
1250
|
style: re,
|
|
1265
1251
|
onClick: () => F?.chain().focus().addColumnAfter().run()
|
|
1266
|
-
}, [e(
|
|
1267
|
-
class: "
|
|
1252
|
+
}, [e(C, null, null)]), $ && e("button", {
|
|
1253
|
+
class: "tiptap-table-btn tiptap-table-btn--add",
|
|
1268
1254
|
style: ae,
|
|
1269
1255
|
onClick: () => F?.chain().focus().addRowAfter().run()
|
|
1270
|
-
}, [e(
|
|
1256
|
+
}, [e(C, null, null)])]);
|
|
1271
1257
|
};
|
|
1272
1258
|
}
|
|
1273
|
-
}),
|
|
1259
|
+
}), Qt = {
|
|
1274
1260
|
name: "table",
|
|
1275
1261
|
install: () => ({
|
|
1276
1262
|
extensions: [Se.configure({ resizable: !0 }), Ze, De, Re],
|
|
1277
|
-
controlComponent:
|
|
1263
|
+
controlComponent: vt
|
|
1278
1264
|
}),
|
|
1279
|
-
toolbarComponent:
|
|
1280
|
-
},
|
|
1265
|
+
toolbarComponent: dt
|
|
1266
|
+
}, ft = /* @__PURE__ */ s({
|
|
1281
1267
|
name: "MathIcon",
|
|
1282
1268
|
setup(t, {
|
|
1283
1269
|
attrs: l
|
|
@@ -1295,18 +1281,18 @@ const ft = /* @__PURE__ */ c({
|
|
|
1295
1281
|
fill: "currentColor"
|
|
1296
1282
|
}, null)]);
|
|
1297
1283
|
}
|
|
1298
|
-
}),
|
|
1284
|
+
}), ht = /* @__PURE__ */ s({
|
|
1299
1285
|
name: "MathButton",
|
|
1300
1286
|
setup() {
|
|
1301
|
-
const t =
|
|
1287
|
+
const t = y("editor"), l = y("openMathDialog");
|
|
1302
1288
|
return () => e(w, {
|
|
1303
|
-
icon:
|
|
1289
|
+
icon: ft,
|
|
1304
1290
|
tooltip: "数学公式",
|
|
1305
1291
|
isActive: t?.value?.isActive("inlineMath") || t?.value?.isActive("blockMath"),
|
|
1306
1292
|
onClick: () => l?.()
|
|
1307
1293
|
}, null);
|
|
1308
1294
|
}
|
|
1309
|
-
}),
|
|
1295
|
+
}), mt = /* @__PURE__ */ s({
|
|
1310
1296
|
name: "MathEditDialog",
|
|
1311
1297
|
props: {
|
|
1312
1298
|
visible: {
|
|
@@ -1330,13 +1316,13 @@ const ft = /* @__PURE__ */ c({
|
|
|
1330
1316
|
setup(t, {
|
|
1331
1317
|
emit: l
|
|
1332
1318
|
}) {
|
|
1333
|
-
const n =
|
|
1334
|
-
|
|
1335
|
-
o.value =
|
|
1319
|
+
const n = y("editor"), o = H(""), i = H("inline");
|
|
1320
|
+
_(() => t.latex, (a) => {
|
|
1321
|
+
o.value = a;
|
|
1336
1322
|
}, {
|
|
1337
1323
|
immediate: !0
|
|
1338
|
-
}),
|
|
1339
|
-
i.value =
|
|
1324
|
+
}), _(() => t.type, (a) => {
|
|
1325
|
+
i.value = a;
|
|
1340
1326
|
}, {
|
|
1341
1327
|
immediate: !0
|
|
1342
1328
|
});
|
|
@@ -1344,30 +1330,30 @@ const ft = /* @__PURE__ */ c({
|
|
|
1344
1330
|
displayMode: i.value === "block",
|
|
1345
1331
|
throwOnError: !1
|
|
1346
1332
|
}) : ""), p = () => {
|
|
1347
|
-
const
|
|
1348
|
-
if (!(!
|
|
1333
|
+
const a = n?.value;
|
|
1334
|
+
if (!(!a || !o.value.trim())) {
|
|
1349
1335
|
if (u.value)
|
|
1350
|
-
i.value === "inline" ?
|
|
1336
|
+
i.value === "inline" ? a.chain().focus().insertInlineMath({
|
|
1351
1337
|
latex: o.value
|
|
1352
|
-
}).run() :
|
|
1338
|
+
}).run() : a.chain().focus().insertBlockMath({
|
|
1353
1339
|
latex: o.value
|
|
1354
1340
|
}).run();
|
|
1355
1341
|
else if (i.value === t.type)
|
|
1356
|
-
t.type === "inline" ?
|
|
1342
|
+
t.type === "inline" ? a.commands.updateInlineMath({
|
|
1357
1343
|
latex: o.value,
|
|
1358
1344
|
pos: t.pos
|
|
1359
|
-
}) :
|
|
1345
|
+
}) : a.commands.updateBlockMath({
|
|
1360
1346
|
latex: o.value,
|
|
1361
1347
|
pos: t.pos
|
|
1362
1348
|
});
|
|
1363
1349
|
else {
|
|
1364
|
-
const
|
|
1365
|
-
t.type === "inline" ?
|
|
1366
|
-
pos:
|
|
1350
|
+
const C = t.pos;
|
|
1351
|
+
t.type === "inline" ? a.chain().focus().deleteInlineMath({
|
|
1352
|
+
pos: C
|
|
1367
1353
|
}).insertBlockMath({
|
|
1368
1354
|
latex: o.value
|
|
1369
|
-
}).run() :
|
|
1370
|
-
pos:
|
|
1355
|
+
}).run() : a.chain().focus().deleteBlockMath({
|
|
1356
|
+
pos: C
|
|
1371
1357
|
}).insertInlineMath({
|
|
1372
1358
|
latex: o.value
|
|
1373
1359
|
}).run();
|
|
@@ -1379,66 +1365,66 @@ const ft = /* @__PURE__ */ c({
|
|
|
1379
1365
|
modelValue: t.visible,
|
|
1380
1366
|
title: u.value ? "插入数学公式" : "编辑数学公式",
|
|
1381
1367
|
width: "520px",
|
|
1382
|
-
"onUpdate:modelValue": (
|
|
1368
|
+
"onUpdate:modelValue": (a) => l("update:visible", a)
|
|
1383
1369
|
}, {
|
|
1384
1370
|
default: () => [e("div", {
|
|
1385
|
-
class: "math-dialog"
|
|
1371
|
+
class: "tiptap-math-dialog"
|
|
1386
1372
|
}, [e(Be, {
|
|
1387
1373
|
modelValue: i.value,
|
|
1388
|
-
"onUpdate:modelValue": (
|
|
1389
|
-
i.value =
|
|
1374
|
+
"onUpdate:modelValue": (a) => {
|
|
1375
|
+
i.value = a;
|
|
1390
1376
|
}
|
|
1391
1377
|
}, {
|
|
1392
|
-
default: () => [e(
|
|
1378
|
+
default: () => [e(W, {
|
|
1393
1379
|
value: "inline"
|
|
1394
1380
|
}, {
|
|
1395
|
-
default: () => [
|
|
1396
|
-
}), e(
|
|
1381
|
+
default: () => [g("行内公式")]
|
|
1382
|
+
}), e(W, {
|
|
1397
1383
|
value: "block"
|
|
1398
1384
|
}, {
|
|
1399
|
-
default: () => [
|
|
1385
|
+
default: () => [g("块级公式")]
|
|
1400
1386
|
})]
|
|
1401
|
-
}), e(
|
|
1387
|
+
}), e(J, {
|
|
1402
1388
|
modelValue: o.value,
|
|
1403
1389
|
type: "textarea",
|
|
1404
1390
|
rows: 3,
|
|
1405
1391
|
placeholder: "请输入 LaTeX 公式,例如:E=mc^2",
|
|
1406
|
-
"onUpdate:modelValue": (
|
|
1407
|
-
o.value =
|
|
1392
|
+
"onUpdate:modelValue": (a) => {
|
|
1393
|
+
o.value = a;
|
|
1408
1394
|
}
|
|
1409
1395
|
}, null), e("div", {
|
|
1410
|
-
class: ["math-preview", {
|
|
1411
|
-
"math-preview--empty": !v.value
|
|
1396
|
+
class: ["tiptap-math-preview", {
|
|
1397
|
+
"tiptap-math-preview--empty": !v.value
|
|
1412
1398
|
}]
|
|
1413
1399
|
}, [v.value ? e("div", {
|
|
1414
1400
|
innerHTML: v.value
|
|
1415
1401
|
}, null) : e("span", {
|
|
1416
|
-
class: "math-preview__placeholder"
|
|
1417
|
-
}, [
|
|
1402
|
+
class: "tiptap-math-preview__placeholder"
|
|
1403
|
+
}, [g("预览将在此处显示")])])])],
|
|
1418
1404
|
footer: () => e(de, null, [e(Z, {
|
|
1419
1405
|
onClick: () => l("update:visible", !1)
|
|
1420
1406
|
}, {
|
|
1421
|
-
default: () => [
|
|
1407
|
+
default: () => [g("取消")]
|
|
1422
1408
|
}), e(Z, {
|
|
1423
1409
|
type: "primary",
|
|
1424
1410
|
disabled: !o.value.trim(),
|
|
1425
1411
|
onClick: p
|
|
1426
1412
|
}, {
|
|
1427
|
-
default: () => [
|
|
1413
|
+
default: () => [g("确认")]
|
|
1428
1414
|
})])
|
|
1429
1415
|
});
|
|
1430
1416
|
}
|
|
1431
|
-
}),
|
|
1417
|
+
}), Yt = {
|
|
1432
1418
|
name: "math",
|
|
1433
|
-
toolbarComponent:
|
|
1419
|
+
toolbarComponent: ht,
|
|
1434
1420
|
install(t) {
|
|
1435
|
-
const l =
|
|
1421
|
+
const l = H(!1), n = H(""), o = H(null), i = H("inline"), u = (p = {}) => {
|
|
1436
1422
|
t.readonly.value || (n.value = p.latex ?? "", o.value = p.pos ?? null, i.value = p.type ?? "inline", l.value = !0);
|
|
1437
1423
|
};
|
|
1438
1424
|
t.provide("openMathDialog", u);
|
|
1439
|
-
const v =
|
|
1425
|
+
const v = s({
|
|
1440
1426
|
name: "MathEditDialogWrapper",
|
|
1441
|
-
setup: () => () => pe(
|
|
1427
|
+
setup: () => () => pe(mt, {
|
|
1442
1428
|
visible: l.value,
|
|
1443
1429
|
latex: n.value,
|
|
1444
1430
|
pos: o.value,
|
|
@@ -1452,128 +1438,128 @@ const ft = /* @__PURE__ */ c({
|
|
|
1452
1438
|
extensions: [
|
|
1453
1439
|
Ue.configure({
|
|
1454
1440
|
inlineOptions: {
|
|
1455
|
-
onClick: (p,
|
|
1441
|
+
onClick: (p, a) => u({ latex: p.attrs.latex, pos: a, type: "inline" })
|
|
1456
1442
|
},
|
|
1457
1443
|
blockOptions: {
|
|
1458
|
-
onClick: (p,
|
|
1444
|
+
onClick: (p, a) => u({ latex: p.attrs.latex, pos: a, type: "block" })
|
|
1459
1445
|
}
|
|
1460
1446
|
})
|
|
1461
1447
|
],
|
|
1462
1448
|
controlComponent: v
|
|
1463
1449
|
};
|
|
1464
1450
|
}
|
|
1465
|
-
},
|
|
1451
|
+
}, gt = /* @__PURE__ */ s({
|
|
1466
1452
|
name: "ImageUploadView",
|
|
1467
1453
|
props: he,
|
|
1468
1454
|
setup(t) {
|
|
1469
|
-
const l = T(() => t.node.attrs.accept), n = T(() => t.node.attrs.limit), o = T(() => t.node.attrs.maxSize), i =
|
|
1470
|
-
if (o.value > 0 &&
|
|
1455
|
+
const l = T(() => t.node.attrs.accept), n = T(() => t.node.attrs.limit), o = T(() => t.node.attrs.maxSize), i = H([]), u = H(), v = H(!1), p = async (r) => {
|
|
1456
|
+
if (o.value > 0 && r.size > o.value)
|
|
1471
1457
|
return t.extension.options.onError?.(new Error(`文件大小超出限制 ${o.value / 1024 / 1024}MB`)), null;
|
|
1472
1458
|
const d = crypto.randomUUID();
|
|
1473
1459
|
i.value.push({
|
|
1474
1460
|
id: d,
|
|
1475
|
-
file:
|
|
1461
|
+
file: r,
|
|
1476
1462
|
progress: 0,
|
|
1477
1463
|
status: "uploading"
|
|
1478
1464
|
});
|
|
1479
1465
|
try {
|
|
1480
1466
|
const f = t.extension.options.upload;
|
|
1481
1467
|
if (!f) throw new Error("未配置 upload 函数");
|
|
1482
|
-
const
|
|
1483
|
-
if (!
|
|
1484
|
-
const
|
|
1485
|
-
return
|
|
1468
|
+
const m = await f(r);
|
|
1469
|
+
if (!m) throw new Error("上传失败:未返回 URL");
|
|
1470
|
+
const B = i.value.find((V) => V.id === d);
|
|
1471
|
+
return B && (B.status = "success", B.progress = 100), t.extension.options.onSuccess?.(m), m;
|
|
1486
1472
|
} catch (f) {
|
|
1487
|
-
const
|
|
1488
|
-
return
|
|
1473
|
+
const m = i.value.find((B) => B.id === d);
|
|
1474
|
+
return m && (m.status = "error", m.progress = 0), t.extension.options.onError?.(f instanceof Error ? f : new Error("上传失败")), null;
|
|
1489
1475
|
}
|
|
1490
|
-
},
|
|
1491
|
-
if (!
|
|
1492
|
-
if (
|
|
1476
|
+
}, a = async (r) => {
|
|
1477
|
+
if (!r.length) return;
|
|
1478
|
+
if (r.length > n.value) {
|
|
1493
1479
|
t.extension.options.onError?.(new Error(`最多上传 ${n.value} 个文件`));
|
|
1494
1480
|
return;
|
|
1495
1481
|
}
|
|
1496
|
-
const d = (await Promise.all(
|
|
1482
|
+
const d = (await Promise.all(r.map(p))).filter((f) => !!f);
|
|
1497
1483
|
if (d.length > 0) {
|
|
1498
1484
|
const f = t.getPos();
|
|
1499
1485
|
if (typeof f != "number") return;
|
|
1500
|
-
const
|
|
1486
|
+
const m = d.map((B) => ({
|
|
1501
1487
|
type: "image",
|
|
1502
1488
|
attrs: {
|
|
1503
|
-
src:
|
|
1489
|
+
src: B
|
|
1504
1490
|
}
|
|
1505
1491
|
}));
|
|
1506
1492
|
t.editor.chain().focus().deleteRange({
|
|
1507
1493
|
from: f,
|
|
1508
1494
|
to: f + t.node.nodeSize
|
|
1509
|
-
}).insertContentAt(f,
|
|
1495
|
+
}).insertContentAt(f, m).run();
|
|
1510
1496
|
}
|
|
1511
|
-
},
|
|
1497
|
+
}, C = () => {
|
|
1512
1498
|
i.value.length === 0 && u.value && (u.value.value = "", u.value.click());
|
|
1513
|
-
},
|
|
1514
|
-
const d =
|
|
1515
|
-
d &&
|
|
1516
|
-
},
|
|
1517
|
-
|
|
1518
|
-
},
|
|
1519
|
-
|
|
1520
|
-
}, I = (
|
|
1521
|
-
|
|
1522
|
-
const d = Array.from(
|
|
1523
|
-
d.length &&
|
|
1524
|
-
}, k = (
|
|
1525
|
-
i.value = i.value.filter((d) => d.id !==
|
|
1499
|
+
}, h = (r) => {
|
|
1500
|
+
const d = r.target.files;
|
|
1501
|
+
d && a(Array.from(d));
|
|
1502
|
+
}, c = (r) => {
|
|
1503
|
+
r.preventDefault(), v.value = !0;
|
|
1504
|
+
}, x = (r) => {
|
|
1505
|
+
r.currentTarget.contains(r.relatedTarget) || (v.value = !1);
|
|
1506
|
+
}, I = (r) => {
|
|
1507
|
+
r.preventDefault(), v.value = !1;
|
|
1508
|
+
const d = Array.from(r.dataTransfer?.files ?? []);
|
|
1509
|
+
d.length && a(d);
|
|
1510
|
+
}, k = (r) => {
|
|
1511
|
+
i.value = i.value.filter((d) => d.id !== r);
|
|
1526
1512
|
};
|
|
1527
1513
|
return () => e(me, {
|
|
1528
1514
|
class: "tiptap-image-upload"
|
|
1529
1515
|
}, {
|
|
1530
1516
|
default: () => [e("div", {
|
|
1531
|
-
onClick:
|
|
1517
|
+
onClick: C
|
|
1532
1518
|
}, [i.value.length ? e("div", {
|
|
1533
1519
|
class: "tiptap-image-upload-previews"
|
|
1534
|
-
}, [i.value.map((
|
|
1535
|
-
key:
|
|
1520
|
+
}, [i.value.map((r) => e("div", {
|
|
1521
|
+
key: r.id,
|
|
1536
1522
|
class: "tiptap-image-upload-preview"
|
|
1537
|
-
}, [
|
|
1523
|
+
}, [r.status === "uploading" && e("div", {
|
|
1538
1524
|
class: "tiptap-image-upload-progress",
|
|
1539
1525
|
style: {
|
|
1540
|
-
width: `${
|
|
1526
|
+
width: `${r.progress}%`
|
|
1541
1527
|
}
|
|
1542
1528
|
}, null), e("div", {
|
|
1543
1529
|
class: "tiptap-image-upload-preview-content"
|
|
1544
1530
|
}, [e("span", {
|
|
1545
1531
|
class: "tiptap-image-upload-text"
|
|
1546
|
-
}, [
|
|
1532
|
+
}, [r.file.name]), e("span", {
|
|
1547
1533
|
class: "tiptap-image-upload-subtext"
|
|
1548
|
-
}, [
|
|
1534
|
+
}, [r.status === "uploading" ? `${r.progress}%` : r.status === "error" ? "上传失败" : "上传成功"]), e("button", {
|
|
1549
1535
|
class: "tiptap-image-upload-remove",
|
|
1550
1536
|
onClick: (d) => {
|
|
1551
|
-
d.stopPropagation(), k(
|
|
1537
|
+
d.stopPropagation(), k(r.id);
|
|
1552
1538
|
}
|
|
1553
|
-
}, [
|
|
1539
|
+
}, [g("×")])])]))]) : e("div", {
|
|
1554
1540
|
class: ["tiptap-image-upload-drag-area", {
|
|
1555
1541
|
"drag-active": v.value
|
|
1556
1542
|
}],
|
|
1557
|
-
onDragover:
|
|
1558
|
-
onDragleave:
|
|
1543
|
+
onDragover: c,
|
|
1544
|
+
onDragleave: x,
|
|
1559
1545
|
onDrop: I
|
|
1560
1546
|
}, [e("div", {
|
|
1561
1547
|
class: "tiptap-image-upload-content"
|
|
1562
1548
|
}, [e("span", {
|
|
1563
1549
|
class: "tiptap-image-upload-text"
|
|
1564
|
-
}, [e("em", null, [
|
|
1550
|
+
}, [e("em", null, [g("点击上传")]), g(" 或拖拽图片到此处")]), e("span", {
|
|
1565
1551
|
class: "tiptap-image-upload-subtext"
|
|
1566
|
-
}, [
|
|
1552
|
+
}, [g("最多 "), n.value, g(" 个文件"), o.value ? `,每个不超过 ${o.value / 1024 / 1024}MB` : ""])])]), e("input", {
|
|
1567
1553
|
ref: u,
|
|
1568
1554
|
type: "file",
|
|
1569
1555
|
accept: l.value,
|
|
1570
1556
|
multiple: n.value > 1,
|
|
1571
|
-
onChange:
|
|
1572
|
-
onClick: (
|
|
1557
|
+
onChange: h,
|
|
1558
|
+
onClick: (r) => r.stopPropagation()
|
|
1573
1559
|
}, null)])]
|
|
1574
1560
|
});
|
|
1575
1561
|
}
|
|
1576
|
-
}),
|
|
1562
|
+
}), wt = Pe.create({
|
|
1577
1563
|
name: "imageUpload",
|
|
1578
1564
|
group: "block",
|
|
1579
1565
|
draggable: !0,
|
|
@@ -1620,7 +1606,7 @@ const ft = /* @__PURE__ */ c({
|
|
|
1620
1606
|
}, t)];
|
|
1621
1607
|
},
|
|
1622
1608
|
addNodeView() {
|
|
1623
|
-
return ge(
|
|
1609
|
+
return ge(gt);
|
|
1624
1610
|
},
|
|
1625
1611
|
addCommands() {
|
|
1626
1612
|
return {
|
|
@@ -1653,7 +1639,7 @@ const ft = /* @__PURE__ */ c({
|
|
|
1653
1639
|
}
|
|
1654
1640
|
};
|
|
1655
1641
|
}
|
|
1656
|
-
}),
|
|
1642
|
+
}), bt = /* @__PURE__ */ s({
|
|
1657
1643
|
name: "ImagePlusIcon",
|
|
1658
1644
|
setup(t, {
|
|
1659
1645
|
attrs: l
|
|
@@ -1671,17 +1657,17 @@ const ft = /* @__PURE__ */ c({
|
|
|
1671
1657
|
fill: "currentColor"
|
|
1672
1658
|
}, null)]);
|
|
1673
1659
|
}
|
|
1674
|
-
}), xt = /* @__PURE__ */
|
|
1660
|
+
}), xt = /* @__PURE__ */ s({
|
|
1675
1661
|
name: "ImageButton",
|
|
1676
1662
|
setup() {
|
|
1677
|
-
const t =
|
|
1663
|
+
const t = y("editor");
|
|
1678
1664
|
return () => e("div", null, [e(w, {
|
|
1679
|
-
icon:
|
|
1665
|
+
icon: bt,
|
|
1680
1666
|
tooltip: "图片",
|
|
1681
1667
|
onClick: () => t?.value?.commands.setImageUploadNode()
|
|
1682
1668
|
}, null)]);
|
|
1683
1669
|
}
|
|
1684
|
-
}),
|
|
1670
|
+
}), kt = [{
|
|
1685
1671
|
value: "left",
|
|
1686
1672
|
title: "居左",
|
|
1687
1673
|
Icon: le
|
|
@@ -1693,8 +1679,8 @@ const ft = /* @__PURE__ */ c({
|
|
|
1693
1679
|
value: "right",
|
|
1694
1680
|
title: "居右",
|
|
1695
1681
|
Icon: oe
|
|
1696
|
-
}],
|
|
1697
|
-
function
|
|
1682
|
+
}], U = (t) => t.preventDefault();
|
|
1683
|
+
function Ht(t) {
|
|
1698
1684
|
if (!t.isActive("image")) return null;
|
|
1699
1685
|
const {
|
|
1700
1686
|
selection: l
|
|
@@ -1708,11 +1694,11 @@ function yt(t) {
|
|
|
1708
1694
|
align: n.attrs.align ?? "left"
|
|
1709
1695
|
};
|
|
1710
1696
|
}
|
|
1711
|
-
function
|
|
1697
|
+
function yt(t) {
|
|
1712
1698
|
const l = t.startsWith("data:") ? "image.png" : t.split("/").pop()?.split("?")[0] || "image.png", n = document.createElement("a");
|
|
1713
1699
|
n.href = t, n.download = l, document.body.appendChild(n), n.click(), document.body.removeChild(n);
|
|
1714
1700
|
}
|
|
1715
|
-
const
|
|
1701
|
+
const Bt = () => e("svg", {
|
|
1716
1702
|
width: "16",
|
|
1717
1703
|
height: "16",
|
|
1718
1704
|
viewBox: "0 0 24 24",
|
|
@@ -1730,7 +1716,7 @@ const At = () => e("svg", {
|
|
|
1730
1716
|
y1: "15",
|
|
1731
1717
|
x2: "12",
|
|
1732
1718
|
y2: "3"
|
|
1733
|
-
}, null)]),
|
|
1719
|
+
}, null)]), At = () => e("svg", {
|
|
1734
1720
|
width: "16",
|
|
1735
1721
|
height: "16",
|
|
1736
1722
|
viewBox: "0 0 24 24",
|
|
@@ -1743,7 +1729,7 @@ const At = () => e("svg", {
|
|
|
1743
1729
|
points: "1 4 1 10 7 10"
|
|
1744
1730
|
}, null), e("path", {
|
|
1745
1731
|
d: "M3.51 15a9 9 0 1 0 .49-4.1L1 10"
|
|
1746
|
-
}, null)]),
|
|
1732
|
+
}, null)]), Mt = () => e("svg", {
|
|
1747
1733
|
width: "16",
|
|
1748
1734
|
height: "16",
|
|
1749
1735
|
viewBox: "0 0 24 24",
|
|
@@ -1760,19 +1746,19 @@ const At = () => e("svg", {
|
|
|
1760
1746
|
d: "M10 11v6M14 11v6"
|
|
1761
1747
|
}, null), e("path", {
|
|
1762
1748
|
d: "M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"
|
|
1763
|
-
}, null)]),
|
|
1749
|
+
}, null)]), It = /* @__PURE__ */ s({
|
|
1764
1750
|
name: "ImageControls",
|
|
1765
1751
|
setup() {
|
|
1766
|
-
const t =
|
|
1752
|
+
const t = y("editor"), l = y("readonly"), n = H(null);
|
|
1767
1753
|
function o() {
|
|
1768
1754
|
const i = t?.value;
|
|
1769
1755
|
if (!i) {
|
|
1770
1756
|
n.value = null;
|
|
1771
1757
|
return;
|
|
1772
1758
|
}
|
|
1773
|
-
n.value =
|
|
1759
|
+
n.value = Ht(i);
|
|
1774
1760
|
}
|
|
1775
|
-
return
|
|
1761
|
+
return K((i) => {
|
|
1776
1762
|
const u = t?.value;
|
|
1777
1763
|
u && (u.on("transaction", o), i(() => {
|
|
1778
1764
|
u.off("transaction", o);
|
|
@@ -1785,67 +1771,67 @@ const At = () => e("svg", {
|
|
|
1785
1771
|
const {
|
|
1786
1772
|
pos: v,
|
|
1787
1773
|
nodeSize: p,
|
|
1788
|
-
src:
|
|
1789
|
-
align:
|
|
1790
|
-
} = i,
|
|
1791
|
-
if (!
|
|
1792
|
-
const
|
|
1774
|
+
src: a,
|
|
1775
|
+
align: C
|
|
1776
|
+
} = i, h = l?.value ?? !1, c = u.view.nodeDOM(v);
|
|
1777
|
+
if (!c || !(c instanceof HTMLElement)) return null;
|
|
1778
|
+
const x = c.querySelector("[data-resize-wrapper]") ?? c, I = u.view.dom.closest(".tiptap-editor");
|
|
1793
1779
|
if (!I) return null;
|
|
1794
|
-
const k =
|
|
1780
|
+
const k = x.getBoundingClientRect(), r = I.getBoundingClientRect(), d = {
|
|
1795
1781
|
position: "absolute",
|
|
1796
|
-
top: `${k.top -
|
|
1797
|
-
left: `${k.left -
|
|
1782
|
+
top: `${k.top - r.top}px`,
|
|
1783
|
+
left: `${k.left - r.left + k.width / 2}px`,
|
|
1798
1784
|
transform: "translate(-50%, calc(-100% - 8px))",
|
|
1799
1785
|
zIndex: 20
|
|
1800
1786
|
};
|
|
1801
1787
|
return e("div", {
|
|
1802
|
-
class: "image-controls",
|
|
1788
|
+
class: "tiptap-image-controls",
|
|
1803
1789
|
style: d
|
|
1804
|
-
}, [!
|
|
1790
|
+
}, [!h && kt.map(({
|
|
1805
1791
|
value: f,
|
|
1806
|
-
title:
|
|
1807
|
-
Icon:
|
|
1792
|
+
title: m,
|
|
1793
|
+
Icon: B
|
|
1808
1794
|
}) => e("button", {
|
|
1809
1795
|
key: f,
|
|
1810
|
-
class: ["image-controls-btn",
|
|
1811
|
-
title:
|
|
1812
|
-
onMousedown:
|
|
1796
|
+
class: ["tiptap-image-controls-btn", C === f && "is-active"],
|
|
1797
|
+
title: m,
|
|
1798
|
+
onMousedown: U,
|
|
1813
1799
|
onClick: () => u.chain().focus().updateAttributes("image", {
|
|
1814
1800
|
align: f
|
|
1815
1801
|
}).run()
|
|
1816
|
-
}, [e(
|
|
1817
|
-
class: "image-controls-separator"
|
|
1802
|
+
}, [e(B, null, null)])), !h && e("span", {
|
|
1803
|
+
class: "tiptap-image-controls-separator"
|
|
1818
1804
|
}, null), e("button", {
|
|
1819
|
-
class: "image-controls-btn",
|
|
1805
|
+
class: "tiptap-image-controls-btn",
|
|
1820
1806
|
title: "下载",
|
|
1821
|
-
onMousedown:
|
|
1822
|
-
onClick: () =>
|
|
1823
|
-
}, [e(
|
|
1824
|
-
class: "image-controls-btn",
|
|
1807
|
+
onMousedown: U,
|
|
1808
|
+
onClick: () => yt(a)
|
|
1809
|
+
}, [e(Bt, null, null)]), !h && e("button", {
|
|
1810
|
+
class: "tiptap-image-controls-btn",
|
|
1825
1811
|
title: "重新上传",
|
|
1826
|
-
onMousedown:
|
|
1812
|
+
onMousedown: U,
|
|
1827
1813
|
onClick: () => u.chain().focus().deleteRange({
|
|
1828
1814
|
from: v,
|
|
1829
1815
|
to: v + p
|
|
1830
1816
|
}).insertContentAt(v, {
|
|
1831
1817
|
type: "imageUpload"
|
|
1832
1818
|
}).run()
|
|
1833
|
-
}, [e(
|
|
1834
|
-
class: "image-controls-btn",
|
|
1819
|
+
}, [e(At, null, null)]), !h && e("button", {
|
|
1820
|
+
class: "tiptap-image-controls-btn",
|
|
1835
1821
|
title: "删除",
|
|
1836
|
-
onMousedown:
|
|
1822
|
+
onMousedown: U,
|
|
1837
1823
|
onClick: () => u.chain().focus().deleteRange({
|
|
1838
1824
|
from: v,
|
|
1839
1825
|
to: v + p
|
|
1840
1826
|
}).run()
|
|
1841
|
-
}, [e(
|
|
1827
|
+
}, [e(Mt, null, null)])]);
|
|
1842
1828
|
};
|
|
1843
1829
|
}
|
|
1844
|
-
}),
|
|
1830
|
+
}), e1 = {
|
|
1845
1831
|
name: "image",
|
|
1846
1832
|
install: (t) => ({
|
|
1847
1833
|
extensions: [
|
|
1848
|
-
|
|
1834
|
+
Ke.configure({
|
|
1849
1835
|
allowBase64: !0,
|
|
1850
1836
|
resize: {
|
|
1851
1837
|
enabled: !0,
|
|
@@ -1855,17 +1841,17 @@ const At = () => e("svg", {
|
|
|
1855
1841
|
alwaysPreserveAspectRatio: !1
|
|
1856
1842
|
}
|
|
1857
1843
|
}),
|
|
1858
|
-
|
|
1844
|
+
wt.configure({ ...t.upload ? { upload: t.upload } : {} })
|
|
1859
1845
|
],
|
|
1860
|
-
controlComponent:
|
|
1846
|
+
controlComponent: It
|
|
1861
1847
|
}),
|
|
1862
1848
|
toolbarComponent: xt
|
|
1863
|
-
},
|
|
1849
|
+
}, t1 = {
|
|
1864
1850
|
name: "separator",
|
|
1865
1851
|
install: () => ({
|
|
1866
1852
|
extensions: []
|
|
1867
1853
|
}),
|
|
1868
|
-
toolbarComponent: /* @__PURE__ */
|
|
1854
|
+
toolbarComponent: /* @__PURE__ */ s({
|
|
1869
1855
|
name: "ToolbarSeparator",
|
|
1870
1856
|
setup: () => () => e("div", {
|
|
1871
1857
|
class: "tiptap-separator"
|
|
@@ -1873,16 +1859,16 @@ const At = () => e("svg", {
|
|
|
1873
1859
|
})
|
|
1874
1860
|
};
|
|
1875
1861
|
export {
|
|
1876
|
-
|
|
1862
|
+
Xt as CodeBlockFeature,
|
|
1877
1863
|
w as IconButton,
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1864
|
+
e1 as ImageFeature,
|
|
1865
|
+
Ke as ImageWithAlign,
|
|
1866
|
+
Jt as ListFeature,
|
|
1867
|
+
Yt as MathFeature,
|
|
1868
|
+
t1 as SeparatorFeature,
|
|
1869
|
+
Qt as TableFeature,
|
|
1870
|
+
Gt as TextAlignFeature,
|
|
1871
|
+
Kt as TextStyleFeature,
|
|
1872
|
+
Wt as TiptapEditor,
|
|
1873
|
+
qt as UndoRedoFeature
|
|
1888
1874
|
};
|