@mpdev_ab/document-creator 0.2.1 → 0.2.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/document-creator.js
CHANGED
|
@@ -1,22 +1,46 @@
|
|
|
1
|
-
import { defineComponent as $, ref as
|
|
2
|
-
import { nodeViewProps as
|
|
3
|
-
import
|
|
4
|
-
import { TextStyle as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { Table as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { Extension as
|
|
18
|
-
import
|
|
19
|
-
const
|
|
1
|
+
import { defineComponent as $, ref as w, computed as A, openBlock as h, createBlock as E, unref as H, normalizeClass as C, withCtx as y, createElementVNode as n, normalizeStyle as I, createElementBlock as b, Fragment as M, renderList as L, toDisplayString as S, withDirectives as z, withKeys as N, vModelText as V, createCommentVNode as T, inject as Q, renderSlot as X, onMounted as F, onBeforeUnmount as O, createVNode as g, nextTick as _, createTextVNode as D, Teleport as Y, withModifiers as j, vModelRadio as K, provide as ee, watch as q } from "vue";
|
|
2
|
+
import { nodeViewProps as te, NodeViewWrapper as ne, VueNodeViewRenderer as le, useEditor as oe, EditorContent as ie } from "@tiptap/vue-3";
|
|
3
|
+
import re from "@tiptap/starter-kit";
|
|
4
|
+
import { TextStyle as se } from "@tiptap/extension-text-style";
|
|
5
|
+
import ae from "@tiptap/extension-font-family";
|
|
6
|
+
import ue from "@tiptap/extension-underline";
|
|
7
|
+
import de from "@tiptap/extension-subscript";
|
|
8
|
+
import ce from "@tiptap/extension-superscript";
|
|
9
|
+
import me from "@tiptap/extension-color";
|
|
10
|
+
import fe from "@tiptap/extension-text-align";
|
|
11
|
+
import ve from "@tiptap/extension-link";
|
|
12
|
+
import ge from "@tiptap/extension-placeholder";
|
|
13
|
+
import { Table as he } from "@tiptap/extension-table";
|
|
14
|
+
import be from "@tiptap/extension-table-row";
|
|
15
|
+
import pe from "@tiptap/extension-table-cell";
|
|
16
|
+
import xe from "@tiptap/extension-table-header";
|
|
17
|
+
import { Extension as G, Node as ye, mergeAttributes as ke } from "@tiptap/core";
|
|
18
|
+
import we from "@tiptap/extension-image";
|
|
19
|
+
const Ce = pe.extend({
|
|
20
|
+
addAttributes() {
|
|
21
|
+
var e;
|
|
22
|
+
return {
|
|
23
|
+
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
24
|
+
backgroundColor: {
|
|
25
|
+
default: null,
|
|
26
|
+
parseHTML: (l) => l.style.backgroundColor || l.getAttribute("data-background-color") || null,
|
|
27
|
+
renderHTML: (l) => l.backgroundColor ? { style: `background-color: ${l.backgroundColor}` } : {}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}), $e = xe.extend({
|
|
32
|
+
addAttributes() {
|
|
33
|
+
var e;
|
|
34
|
+
return {
|
|
35
|
+
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
36
|
+
backgroundColor: {
|
|
37
|
+
default: null,
|
|
38
|
+
parseHTML: (l) => l.style.backgroundColor || l.getAttribute("data-background-color") || null,
|
|
39
|
+
renderHTML: (l) => l.backgroundColor ? { style: `background-color: ${l.backgroundColor}` } : {}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}), Me = G.create({
|
|
20
44
|
name: "fontSize",
|
|
21
45
|
addOptions() {
|
|
22
46
|
return {
|
|
@@ -31,8 +55,8 @@ const we = X.create({
|
|
|
31
55
|
fontSize: {
|
|
32
56
|
default: null,
|
|
33
57
|
parseHTML: (e) => {
|
|
34
|
-
var
|
|
35
|
-
return ((
|
|
58
|
+
var l;
|
|
59
|
+
return ((l = e.style.fontSize) == null ? void 0 : l.replace(/['"]+/g, "")) || null;
|
|
36
60
|
},
|
|
37
61
|
renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
|
|
38
62
|
}
|
|
@@ -42,11 +66,11 @@ const we = X.create({
|
|
|
42
66
|
},
|
|
43
67
|
addCommands() {
|
|
44
68
|
return {
|
|
45
|
-
setFontSize: (e) => ({ chain:
|
|
69
|
+
setFontSize: (e) => ({ chain: l }) => l().setMark("textStyle", { fontSize: e }).run(),
|
|
46
70
|
unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
|
|
47
71
|
};
|
|
48
72
|
}
|
|
49
|
-
}),
|
|
73
|
+
}), Te = G.create({
|
|
50
74
|
name: "lineHeight",
|
|
51
75
|
addOptions() {
|
|
52
76
|
return {
|
|
@@ -69,128 +93,128 @@ const we = X.create({
|
|
|
69
93
|
},
|
|
70
94
|
addCommands() {
|
|
71
95
|
return {
|
|
72
|
-
setLineHeight: (e) => ({ commands:
|
|
73
|
-
(t) =>
|
|
96
|
+
setLineHeight: (e) => ({ commands: l }) => this.options.types.every(
|
|
97
|
+
(t) => l.updateAttributes(t, { lineHeight: e })
|
|
74
98
|
),
|
|
75
99
|
unsetLineHeight: () => ({ commands: e }) => this.options.types.every(
|
|
76
|
-
(
|
|
100
|
+
(l) => e.resetAttributes(l, "lineHeight")
|
|
77
101
|
)
|
|
78
102
|
};
|
|
79
103
|
}
|
|
80
|
-
}),
|
|
104
|
+
}), Ae = ["src", "alt"], Le = {
|
|
81
105
|
key: 0,
|
|
82
106
|
class: "absolute -top-10 left-0 flex items-center gap-1 bg-white border border-gray-200 rounded shadow-md p-1 z-10"
|
|
83
|
-
},
|
|
107
|
+
}, Se = ["onClick"], Be = /* @__PURE__ */ $({
|
|
84
108
|
__name: "ImageResizePopover",
|
|
85
|
-
props:
|
|
109
|
+
props: te,
|
|
86
110
|
setup(e) {
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
return
|
|
111
|
+
const l = e, t = w(l.node.attrs.width || ""), c = w(l.node.attrs.alt || ""), o = A(() => {
|
|
112
|
+
const s = {};
|
|
113
|
+
return l.node.attrs.width && (s.width = l.node.attrs.width), l.node.attrs.height && (s.height = l.node.attrs.height), s;
|
|
90
114
|
}), a = A(() => {
|
|
91
|
-
const
|
|
92
|
-
return
|
|
115
|
+
const s = l.node.attrs.align;
|
|
116
|
+
return s === "center" ? "mx-auto block" : s === "right" ? "ml-auto block" : "block";
|
|
93
117
|
});
|
|
94
|
-
function
|
|
95
|
-
const
|
|
96
|
-
|
|
118
|
+
function u() {
|
|
119
|
+
const s = l.getPos();
|
|
120
|
+
s != null && l.editor.commands.setNodeSelection(s);
|
|
97
121
|
}
|
|
98
|
-
function i(
|
|
99
|
-
|
|
122
|
+
function i(s) {
|
|
123
|
+
l.updateAttributes({ width: s }), t.value = s;
|
|
100
124
|
}
|
|
101
|
-
function m(
|
|
102
|
-
|
|
125
|
+
function m(s) {
|
|
126
|
+
l.updateAttributes({ align: s });
|
|
103
127
|
}
|
|
104
128
|
function r() {
|
|
105
|
-
|
|
129
|
+
l.updateAttributes({ alt: c.value });
|
|
106
130
|
}
|
|
107
|
-
return (
|
|
131
|
+
return (s, d) => (h(), E(H(ne), {
|
|
108
132
|
class: C(["relative inline-block", a.value])
|
|
109
133
|
}, {
|
|
110
134
|
default: y(() => [
|
|
111
|
-
|
|
112
|
-
src:
|
|
113
|
-
alt:
|
|
114
|
-
style:
|
|
115
|
-
class: C(["cursor-pointer max-w-full",
|
|
116
|
-
onClick:
|
|
117
|
-
}, null, 14,
|
|
118
|
-
|
|
119
|
-
(
|
|
120
|
-
key:
|
|
135
|
+
n("img", {
|
|
136
|
+
src: s.node.attrs.src,
|
|
137
|
+
alt: s.node.attrs.alt || "",
|
|
138
|
+
style: I(o.value),
|
|
139
|
+
class: C(["cursor-pointer max-w-full", s.selected ? "ring-2 ring-blue-400" : ""]),
|
|
140
|
+
onClick: u
|
|
141
|
+
}, null, 14, Ae),
|
|
142
|
+
s.selected ? (h(), b("div", Le, [
|
|
143
|
+
(h(), b(M, null, L(["25%", "50%", "75%", "100%"], (v) => n("button", {
|
|
144
|
+
key: v,
|
|
121
145
|
class: "px-2 py-0.5 text-xs rounded hover:bg-gray-100",
|
|
122
|
-
onClick: (x) => i(
|
|
123
|
-
},
|
|
124
|
-
z(
|
|
125
|
-
"onUpdate:modelValue":
|
|
146
|
+
onClick: (x) => i(v)
|
|
147
|
+
}, S(v), 9, Se)), 64)),
|
|
148
|
+
z(n("input", {
|
|
149
|
+
"onUpdate:modelValue": d[0] || (d[0] = (v) => t.value = v),
|
|
126
150
|
class: "w-16 border border-gray-300 rounded px-1 py-0.5 text-xs",
|
|
127
151
|
placeholder: "e.g. 100%",
|
|
128
|
-
onKeydown:
|
|
152
|
+
onKeydown: d[1] || (d[1] = N((v) => i(t.value), ["enter"]))
|
|
129
153
|
}, null, 544), [
|
|
130
154
|
[V, t.value]
|
|
131
155
|
]),
|
|
132
|
-
|
|
133
|
-
|
|
156
|
+
d[9] || (d[9] = n("span", { class: "w-px h-4 bg-gray-300 mx-1" }, null, -1)),
|
|
157
|
+
n("button", {
|
|
134
158
|
class: "px-1 py-0.5 text-xs rounded hover:bg-gray-100",
|
|
135
159
|
title: "Align left",
|
|
136
|
-
onClick:
|
|
137
|
-
}, [...
|
|
138
|
-
|
|
160
|
+
onClick: d[2] || (d[2] = (v) => m("left"))
|
|
161
|
+
}, [...d[6] || (d[6] = [
|
|
162
|
+
n("svg", {
|
|
139
163
|
class: "w-3 h-3",
|
|
140
164
|
viewBox: "0 0 24 24",
|
|
141
165
|
fill: "none",
|
|
142
166
|
stroke: "currentColor",
|
|
143
167
|
"stroke-width": "2"
|
|
144
168
|
}, [
|
|
145
|
-
|
|
169
|
+
n("path", { d: "M3 6h18M3 12h10M3 18h14" })
|
|
146
170
|
], -1)
|
|
147
171
|
])]),
|
|
148
|
-
|
|
172
|
+
n("button", {
|
|
149
173
|
class: "px-1 py-0.5 text-xs rounded hover:bg-gray-100",
|
|
150
174
|
title: "Align center",
|
|
151
|
-
onClick:
|
|
152
|
-
}, [...
|
|
153
|
-
|
|
175
|
+
onClick: d[3] || (d[3] = (v) => m("center"))
|
|
176
|
+
}, [...d[7] || (d[7] = [
|
|
177
|
+
n("svg", {
|
|
154
178
|
class: "w-3 h-3",
|
|
155
179
|
viewBox: "0 0 24 24",
|
|
156
180
|
fill: "none",
|
|
157
181
|
stroke: "currentColor",
|
|
158
182
|
"stroke-width": "2"
|
|
159
183
|
}, [
|
|
160
|
-
|
|
184
|
+
n("path", { d: "M3 6h18M7 12h10M5 18h14" })
|
|
161
185
|
], -1)
|
|
162
186
|
])]),
|
|
163
|
-
|
|
187
|
+
n("button", {
|
|
164
188
|
class: "px-1 py-0.5 text-xs rounded hover:bg-gray-100",
|
|
165
189
|
title: "Align right",
|
|
166
|
-
onClick:
|
|
167
|
-
}, [...
|
|
168
|
-
|
|
190
|
+
onClick: d[4] || (d[4] = (v) => m("right"))
|
|
191
|
+
}, [...d[8] || (d[8] = [
|
|
192
|
+
n("svg", {
|
|
169
193
|
class: "w-3 h-3",
|
|
170
194
|
viewBox: "0 0 24 24",
|
|
171
195
|
fill: "none",
|
|
172
196
|
stroke: "currentColor",
|
|
173
197
|
"stroke-width": "2"
|
|
174
198
|
}, [
|
|
175
|
-
|
|
199
|
+
n("path", { d: "M3 6h18M11 12h10M7 18h14" })
|
|
176
200
|
], -1)
|
|
177
201
|
])]),
|
|
178
|
-
|
|
179
|
-
z(
|
|
180
|
-
"onUpdate:modelValue":
|
|
202
|
+
d[10] || (d[10] = n("span", { class: "w-px h-4 bg-gray-300 mx-1" }, null, -1)),
|
|
203
|
+
z(n("input", {
|
|
204
|
+
"onUpdate:modelValue": d[5] || (d[5] = (v) => c.value = v),
|
|
181
205
|
class: "w-20 border border-gray-300 rounded px-1 py-0.5 text-xs",
|
|
182
206
|
placeholder: "Alt text",
|
|
183
207
|
onBlur: r,
|
|
184
|
-
onKeydown:
|
|
208
|
+
onKeydown: N(r, ["enter"])
|
|
185
209
|
}, null, 544), [
|
|
186
|
-
[V,
|
|
210
|
+
[V, c.value]
|
|
187
211
|
])
|
|
188
212
|
])) : T("", !0)
|
|
189
213
|
]),
|
|
190
214
|
_: 1
|
|
191
215
|
}, 8, ["class"]));
|
|
192
216
|
}
|
|
193
|
-
}),
|
|
217
|
+
}), He = we.extend({
|
|
194
218
|
name: "image",
|
|
195
219
|
addAttributes() {
|
|
196
220
|
var e;
|
|
@@ -198,39 +222,39 @@ const we = X.create({
|
|
|
198
222
|
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
199
223
|
width: {
|
|
200
224
|
default: null,
|
|
201
|
-
parseHTML: (
|
|
202
|
-
renderHTML: (
|
|
225
|
+
parseHTML: (l) => l.getAttribute("width") || l.style.width || null,
|
|
226
|
+
renderHTML: (l) => l.width ? { style: `width: ${l.width}` } : {}
|
|
203
227
|
},
|
|
204
228
|
height: {
|
|
205
229
|
default: null,
|
|
206
|
-
parseHTML: (
|
|
207
|
-
renderHTML: (
|
|
230
|
+
parseHTML: (l) => l.getAttribute("height") || l.style.height || null,
|
|
231
|
+
renderHTML: (l) => l.height ? { style: `height: ${l.height}` } : {}
|
|
208
232
|
},
|
|
209
233
|
align: {
|
|
210
234
|
default: null,
|
|
211
|
-
parseHTML: (
|
|
212
|
-
renderHTML: (
|
|
213
|
-
if (!
|
|
235
|
+
parseHTML: (l) => l.getAttribute("data-align") || null,
|
|
236
|
+
renderHTML: (l) => {
|
|
237
|
+
if (!l.align) return {};
|
|
214
238
|
const t = {
|
|
215
239
|
left: "margin-right: auto",
|
|
216
240
|
center: "margin-left: auto; margin-right: auto",
|
|
217
241
|
right: "margin-left: auto"
|
|
218
242
|
};
|
|
219
243
|
return {
|
|
220
|
-
"data-align":
|
|
221
|
-
style: `display: block; ${t[
|
|
244
|
+
"data-align": l.align,
|
|
245
|
+
style: `display: block; ${t[l.align] || ""}`
|
|
222
246
|
};
|
|
223
247
|
}
|
|
224
248
|
}
|
|
225
249
|
};
|
|
226
250
|
},
|
|
227
251
|
addNodeView() {
|
|
228
|
-
return le(
|
|
252
|
+
return le(Be);
|
|
229
253
|
}
|
|
230
254
|
}).configure({
|
|
231
255
|
allowBase64: !0,
|
|
232
256
|
inline: !1
|
|
233
|
-
}),
|
|
257
|
+
}), ze = ye.create({
|
|
234
258
|
name: "video",
|
|
235
259
|
group: "block",
|
|
236
260
|
atom: !0,
|
|
@@ -247,17 +271,72 @@ const we = X.create({
|
|
|
247
271
|
return [{ tag: "iframe[src]" }];
|
|
248
272
|
},
|
|
249
273
|
renderHTML({ HTMLAttributes: e }) {
|
|
250
|
-
return ["div", { class: "video-wrapper" }, ["iframe",
|
|
274
|
+
return ["div", { class: "video-wrapper" }, ["iframe", ke(e)]];
|
|
251
275
|
},
|
|
252
276
|
addCommands() {
|
|
253
277
|
return {
|
|
254
|
-
setVideo: (e) => ({ commands:
|
|
278
|
+
setVideo: (e) => ({ commands: l }) => l.insertContent({
|
|
255
279
|
type: this.name,
|
|
256
280
|
attrs: e
|
|
257
281
|
})
|
|
258
282
|
};
|
|
259
283
|
}
|
|
260
|
-
}),
|
|
284
|
+
}), W = 40, Ee = G.create({
|
|
285
|
+
name: "indent",
|
|
286
|
+
addOptions() {
|
|
287
|
+
return {
|
|
288
|
+
types: ["heading", "paragraph"],
|
|
289
|
+
maxIndent: 200
|
|
290
|
+
};
|
|
291
|
+
},
|
|
292
|
+
addGlobalAttributes() {
|
|
293
|
+
return [
|
|
294
|
+
{
|
|
295
|
+
types: this.options.types,
|
|
296
|
+
attributes: {
|
|
297
|
+
indent: {
|
|
298
|
+
default: 0,
|
|
299
|
+
parseHTML: (e) => {
|
|
300
|
+
const l = e.style.paddingLeft;
|
|
301
|
+
return l && parseInt(l, 10) || 0;
|
|
302
|
+
},
|
|
303
|
+
renderHTML: (e) => !e.indent || e.indent === 0 ? {} : { style: `padding-left: ${e.indent}px` }
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
];
|
|
308
|
+
},
|
|
309
|
+
addCommands() {
|
|
310
|
+
return {
|
|
311
|
+
indent: () => ({ tr: e, state: l, dispatch: t }) => {
|
|
312
|
+
const { selection: c } = l, { from: o, to: a } = c;
|
|
313
|
+
let u = !1;
|
|
314
|
+
return l.doc.nodesBetween(o, a, (i, m) => {
|
|
315
|
+
if (this.options.types.includes(i.type.name)) {
|
|
316
|
+
const r = i.attrs.indent || 0, s = Math.min(r + W, this.options.maxIndent);
|
|
317
|
+
s !== r && (e.setNodeMarkup(m, void 0, { ...i.attrs, indent: s }), u = !0);
|
|
318
|
+
}
|
|
319
|
+
}), u && t && t(e), u;
|
|
320
|
+
},
|
|
321
|
+
outdent: () => ({ tr: e, state: l, dispatch: t }) => {
|
|
322
|
+
const { selection: c } = l, { from: o, to: a } = c;
|
|
323
|
+
let u = !1;
|
|
324
|
+
return l.doc.nodesBetween(o, a, (i, m) => {
|
|
325
|
+
if (this.options.types.includes(i.type.name)) {
|
|
326
|
+
const r = i.attrs.indent || 0, s = Math.max(r - W, 0);
|
|
327
|
+
s !== r && (e.setNodeMarkup(m, void 0, { ...i.attrs, indent: s }), u = !0);
|
|
328
|
+
}
|
|
329
|
+
}), u && t && t(e), u;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
},
|
|
333
|
+
addKeyboardShortcuts() {
|
|
334
|
+
return {
|
|
335
|
+
Tab: () => this.editor.commands.indent(),
|
|
336
|
+
"Shift-Tab": () => this.editor.commands.outdent()
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}), Re = {
|
|
261
340
|
toolbar: "bg-white border-b border-gray-200 p-2 flex flex-wrap items-center gap-1",
|
|
262
341
|
toolbarButton: "hover:bg-gray-100 rounded p-1.5 text-gray-600 cursor-pointer",
|
|
263
342
|
toolbarButtonActive: "bg-blue-100 text-blue-600",
|
|
@@ -265,10 +344,10 @@ const we = X.create({
|
|
|
265
344
|
dropdown: "bg-white border border-gray-200 rounded shadow-lg py-1 z-50",
|
|
266
345
|
modal: "bg-white rounded-lg shadow-xl p-6",
|
|
267
346
|
saveButton: "bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700"
|
|
268
|
-
},
|
|
347
|
+
}, Ie = {
|
|
269
348
|
maxSize: 5 * 1024 * 1024,
|
|
270
349
|
allowedTypes: ["image/jpeg", "image/png", "image/gif"]
|
|
271
|
-
},
|
|
350
|
+
}, Ve = [
|
|
272
351
|
"Arial",
|
|
273
352
|
"Times New Roman",
|
|
274
353
|
"Courier New",
|
|
@@ -277,36 +356,36 @@ const we = X.create({
|
|
|
277
356
|
"Trebuchet MS",
|
|
278
357
|
"Comic Sans MS",
|
|
279
358
|
"Impact"
|
|
280
|
-
],
|
|
281
|
-
function
|
|
282
|
-
const e = Z
|
|
359
|
+
], Fe = ["8", "10", "12", "14", "16", "18", "20", "24", "28", "32", "36", "48", "72"], Oe = ["1", "1.15", "1.5", "2", "2.5", "3"], Z = Symbol("document-editor");
|
|
360
|
+
function nn() {
|
|
361
|
+
const e = Q(Z);
|
|
283
362
|
if (!e)
|
|
284
363
|
throw new Error("useDocumentEditor must be used within a DocumentEditor component");
|
|
285
364
|
return {
|
|
286
365
|
editor: e,
|
|
287
366
|
getHTML: () => {
|
|
288
|
-
var
|
|
289
|
-
return ((
|
|
367
|
+
var l;
|
|
368
|
+
return ((l = e.value) == null ? void 0 : l.getHTML()) ?? "";
|
|
290
369
|
},
|
|
291
370
|
getText: () => {
|
|
292
|
-
var
|
|
293
|
-
return ((
|
|
371
|
+
var l;
|
|
372
|
+
return ((l = e.value) == null ? void 0 : l.getText()) ?? "";
|
|
294
373
|
},
|
|
295
|
-
setContent: (
|
|
374
|
+
setContent: (l) => {
|
|
296
375
|
var t;
|
|
297
|
-
return (t = e.value) == null ? void 0 : t.commands.setContent(
|
|
376
|
+
return (t = e.value) == null ? void 0 : t.commands.setContent(l);
|
|
298
377
|
},
|
|
299
378
|
focus: () => {
|
|
300
|
-
var
|
|
301
|
-
return (
|
|
379
|
+
var l;
|
|
380
|
+
return (l = e.value) == null ? void 0 : l.commands.focus();
|
|
302
381
|
},
|
|
303
382
|
isEmpty: () => {
|
|
304
|
-
var
|
|
305
|
-
return ((
|
|
383
|
+
var l;
|
|
384
|
+
return ((l = e.value) == null ? void 0 : l.isEmpty) ?? !0;
|
|
306
385
|
}
|
|
307
386
|
};
|
|
308
387
|
}
|
|
309
|
-
const
|
|
388
|
+
const Ne = ["title", "disabled"], k = /* @__PURE__ */ $({
|
|
310
389
|
__name: "ToolbarButton",
|
|
311
390
|
props: {
|
|
312
391
|
theme: {},
|
|
@@ -316,26 +395,26 @@ const Fe = ["title", "disabled"], w = /* @__PURE__ */ $({
|
|
|
316
395
|
},
|
|
317
396
|
emits: ["click"],
|
|
318
397
|
setup(e) {
|
|
319
|
-
return (
|
|
398
|
+
return (l, t) => (h(), b("button", {
|
|
320
399
|
type: "button",
|
|
321
400
|
class: C([e.theme.toolbarButton, e.isActive && e.theme.toolbarButtonActive]),
|
|
322
401
|
title: e.title,
|
|
323
402
|
disabled: e.disabled,
|
|
324
|
-
onClick: t[0] || (t[0] = (
|
|
403
|
+
onClick: t[0] || (t[0] = (c) => l.$emit("click"))
|
|
325
404
|
}, [
|
|
326
|
-
|
|
327
|
-
], 10,
|
|
405
|
+
X(l.$slots, "default")
|
|
406
|
+
], 10, Ne));
|
|
328
407
|
}
|
|
329
|
-
}),
|
|
408
|
+
}), De = (e, l) => {
|
|
330
409
|
const t = e.__vccOpts || e;
|
|
331
|
-
for (const [
|
|
332
|
-
t[
|
|
410
|
+
for (const [c, o] of l)
|
|
411
|
+
t[c] = o;
|
|
333
412
|
return t;
|
|
334
|
-
},
|
|
335
|
-
function
|
|
336
|
-
return
|
|
413
|
+
}, Ue = {}, Pe = { class: "w-px h-6 bg-gray-300 mx-1" };
|
|
414
|
+
function je(e, l) {
|
|
415
|
+
return h(), b("div", Pe);
|
|
337
416
|
}
|
|
338
|
-
const B = /* @__PURE__ */
|
|
417
|
+
const B = /* @__PURE__ */ De(Ue, [["render", je]]), Ge = ["title"], U = /* @__PURE__ */ $({
|
|
339
418
|
__name: "ToolbarDropdown",
|
|
340
419
|
props: {
|
|
341
420
|
theme: {},
|
|
@@ -343,54 +422,54 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
343
422
|
title: {}
|
|
344
423
|
},
|
|
345
424
|
setup(e) {
|
|
346
|
-
const
|
|
347
|
-
function
|
|
348
|
-
|
|
425
|
+
const l = w(!1), t = w(null);
|
|
426
|
+
function c() {
|
|
427
|
+
l.value = !1;
|
|
349
428
|
}
|
|
350
429
|
function o(a) {
|
|
351
|
-
t.value && !t.value.contains(a.target) && (
|
|
430
|
+
t.value && !t.value.contains(a.target) && (l.value = !1);
|
|
352
431
|
}
|
|
353
|
-
return
|
|
432
|
+
return F(() => document.addEventListener("click", o)), O(() => document.removeEventListener("click", o)), (a, u) => (h(), b("div", {
|
|
354
433
|
class: "relative",
|
|
355
434
|
ref_key: "dropdownRef",
|
|
356
435
|
ref: t
|
|
357
436
|
}, [
|
|
358
|
-
|
|
437
|
+
n("button", {
|
|
359
438
|
type: "button",
|
|
360
439
|
class: C([e.theme.toolbarButton, "flex items-center gap-1 px-2 text-sm"]),
|
|
361
440
|
title: e.title,
|
|
362
|
-
onClick:
|
|
441
|
+
onClick: u[0] || (u[0] = (i) => l.value = !l.value)
|
|
363
442
|
}, [
|
|
364
|
-
|
|
365
|
-
|
|
443
|
+
n("span", null, S(e.label), 1),
|
|
444
|
+
u[1] || (u[1] = n("svg", {
|
|
366
445
|
class: "w-3 h-3",
|
|
367
446
|
viewBox: "0 0 12 12",
|
|
368
447
|
fill: "currentColor"
|
|
369
448
|
}, [
|
|
370
|
-
|
|
449
|
+
n("path", {
|
|
371
450
|
d: "M2 4l4 4 4-4",
|
|
372
451
|
stroke: "currentColor",
|
|
373
452
|
"stroke-width": "1.5",
|
|
374
453
|
fill: "none"
|
|
375
454
|
})
|
|
376
455
|
], -1))
|
|
377
|
-
], 10,
|
|
378
|
-
|
|
456
|
+
], 10, Ge),
|
|
457
|
+
l.value ? (h(), b("div", {
|
|
379
458
|
key: 0,
|
|
380
459
|
class: C([e.theme.dropdown, "absolute top-full left-0 mt-1 min-w-[150px] max-h-60 overflow-y-auto"])
|
|
381
460
|
}, [
|
|
382
|
-
|
|
461
|
+
X(a.$slots, "default", { close: c })
|
|
383
462
|
], 2)) : T("", !0)
|
|
384
463
|
], 512));
|
|
385
464
|
}
|
|
386
|
-
}),
|
|
465
|
+
}), Ke = ["onClick"], qe = /* @__PURE__ */ $({
|
|
387
466
|
__name: "HeadingPicker",
|
|
388
467
|
props: {
|
|
389
468
|
editor: {},
|
|
390
469
|
theme: {}
|
|
391
470
|
},
|
|
392
471
|
setup(e) {
|
|
393
|
-
const
|
|
472
|
+
const l = e, t = [
|
|
394
473
|
{ label: "Paragraph", value: "paragraph", class: "text-sm" },
|
|
395
474
|
{ label: "Heading 1", value: 1, class: "text-2xl font-bold" },
|
|
396
475
|
{ label: "Heading 2", value: 2, class: "text-xl font-bold" },
|
|
@@ -399,116 +478,116 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
399
478
|
{ label: "Heading 5", value: 5, class: "text-sm font-semibold" },
|
|
400
479
|
{ label: "Heading 6", value: 6, class: "text-xs font-semibold" }
|
|
401
480
|
];
|
|
402
|
-
function
|
|
481
|
+
function c(u) {
|
|
403
482
|
var i, m;
|
|
404
|
-
return
|
|
483
|
+
return u.value === "paragraph" ? (i = l.editor) == null ? void 0 : i.isActive("paragraph") : (m = l.editor) == null ? void 0 : m.isActive("heading", { level: u.value });
|
|
405
484
|
}
|
|
406
485
|
const o = A(() => {
|
|
407
|
-
const
|
|
408
|
-
return (
|
|
486
|
+
const u = t.find((i) => c(i));
|
|
487
|
+
return (u == null ? void 0 : u.label) ?? "Paragraph";
|
|
409
488
|
});
|
|
410
|
-
function a(
|
|
489
|
+
function a(u) {
|
|
411
490
|
var i, m;
|
|
412
|
-
|
|
491
|
+
u.value === "paragraph" ? (i = l.editor) == null || i.chain().focus().setParagraph().run() : (m = l.editor) == null || m.chain().focus().toggleHeading({ level: u.value }).run();
|
|
413
492
|
}
|
|
414
|
-
return (
|
|
493
|
+
return (u, i) => (h(), E(U, {
|
|
415
494
|
theme: e.theme,
|
|
416
495
|
label: o.value,
|
|
417
496
|
title: "Block type"
|
|
418
497
|
}, {
|
|
419
498
|
default: y(({ close: m }) => [
|
|
420
|
-
(
|
|
499
|
+
(h(), b(M, null, L(t, (r) => n("button", {
|
|
421
500
|
key: r.value,
|
|
422
501
|
class: C([
|
|
423
502
|
"block w-full text-left px-3 py-1.5 hover:bg-gray-100",
|
|
424
503
|
r.class,
|
|
425
|
-
|
|
504
|
+
c(r) ? "bg-gray-50 font-semibold" : ""
|
|
426
505
|
]),
|
|
427
|
-
onClick: (
|
|
506
|
+
onClick: (s) => {
|
|
428
507
|
a(r), m();
|
|
429
508
|
}
|
|
430
|
-
},
|
|
509
|
+
}, S(r.label), 11, Ke)), 64))
|
|
431
510
|
]),
|
|
432
511
|
_: 1
|
|
433
512
|
}, 8, ["theme", "label"]));
|
|
434
513
|
}
|
|
435
|
-
}),
|
|
514
|
+
}), We = ["onClick"], Je = /* @__PURE__ */ $({
|
|
436
515
|
__name: "FontFamilyPicker",
|
|
437
516
|
props: {
|
|
438
517
|
editor: {},
|
|
439
518
|
theme: {}
|
|
440
519
|
},
|
|
441
520
|
setup(e) {
|
|
442
|
-
const
|
|
521
|
+
const l = e, t = Ve, c = A(() => {
|
|
443
522
|
var o;
|
|
444
523
|
for (const a of t)
|
|
445
|
-
if ((o =
|
|
524
|
+
if ((o = l.editor) != null && o.isActive("textStyle", { fontFamily: a })) return a;
|
|
446
525
|
return "Font";
|
|
447
526
|
});
|
|
448
|
-
return (o, a) => (
|
|
527
|
+
return (o, a) => (h(), E(U, {
|
|
449
528
|
theme: e.theme,
|
|
450
|
-
label:
|
|
529
|
+
label: c.value,
|
|
451
530
|
title: "Font family"
|
|
452
531
|
}, {
|
|
453
|
-
default: y(({ close:
|
|
454
|
-
(
|
|
532
|
+
default: y(({ close: u }) => [
|
|
533
|
+
(h(!0), b(M, null, L(H(t), (i) => (h(), b("button", {
|
|
455
534
|
key: i,
|
|
456
|
-
style:
|
|
535
|
+
style: I({ fontFamily: i }),
|
|
457
536
|
class: C([
|
|
458
537
|
"block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",
|
|
459
|
-
|
|
538
|
+
c.value === i ? "bg-gray-50 font-semibold" : ""
|
|
460
539
|
]),
|
|
461
540
|
onClick: (m) => {
|
|
462
541
|
var r;
|
|
463
|
-
(r = e.editor) == null || r.chain().focus().setFontFamily(i).run(),
|
|
542
|
+
(r = e.editor) == null || r.chain().focus().setFontFamily(i).run(), u();
|
|
464
543
|
}
|
|
465
|
-
},
|
|
544
|
+
}, S(i), 15, We))), 128))
|
|
466
545
|
]),
|
|
467
546
|
_: 1
|
|
468
547
|
}, 8, ["theme", "label"]));
|
|
469
548
|
}
|
|
470
|
-
}),
|
|
549
|
+
}), Xe = ["onClick"], Ye = /* @__PURE__ */ $({
|
|
471
550
|
__name: "FontSizePicker",
|
|
472
551
|
props: {
|
|
473
552
|
editor: {},
|
|
474
553
|
theme: {}
|
|
475
554
|
},
|
|
476
555
|
setup(e) {
|
|
477
|
-
const
|
|
556
|
+
const l = e, t = Fe, c = A(() => {
|
|
478
557
|
var o;
|
|
479
558
|
for (const a of t)
|
|
480
|
-
if ((o =
|
|
559
|
+
if ((o = l.editor) != null && o.isActive("textStyle", { fontSize: a + "px" })) return a;
|
|
481
560
|
return "";
|
|
482
561
|
});
|
|
483
|
-
return (o, a) => (
|
|
562
|
+
return (o, a) => (h(), E(U, {
|
|
484
563
|
theme: e.theme,
|
|
485
|
-
label:
|
|
564
|
+
label: c.value || "Size",
|
|
486
565
|
title: "Font size"
|
|
487
566
|
}, {
|
|
488
|
-
default: y(({ close:
|
|
489
|
-
(
|
|
567
|
+
default: y(({ close: u }) => [
|
|
568
|
+
(h(!0), b(M, null, L(H(t), (i) => (h(), b("button", {
|
|
490
569
|
key: i,
|
|
491
570
|
class: C([
|
|
492
571
|
"block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",
|
|
493
|
-
|
|
572
|
+
c.value === i ? "bg-gray-50 font-semibold" : ""
|
|
494
573
|
]),
|
|
495
574
|
onClick: (m) => {
|
|
496
575
|
var r;
|
|
497
|
-
(r = e.editor) == null || r.chain().focus().setFontSize(i + "px").run(),
|
|
576
|
+
(r = e.editor) == null || r.chain().focus().setFontSize(i + "px").run(), u();
|
|
498
577
|
}
|
|
499
|
-
},
|
|
578
|
+
}, S(i), 11, Xe))), 128))
|
|
500
579
|
]),
|
|
501
580
|
_: 1
|
|
502
581
|
}, 8, ["theme", "label"]));
|
|
503
582
|
}
|
|
504
|
-
}),
|
|
583
|
+
}), Ze = { class: "grid grid-cols-8 gap-1 mb-2" }, Qe = ["title", "onClick"], _e = { class: "flex items-center gap-2 pt-2 border-t border-gray-100" }, et = ["value"], tt = /* @__PURE__ */ $({
|
|
505
584
|
__name: "ColorPicker",
|
|
506
585
|
props: {
|
|
507
586
|
editor: {},
|
|
508
587
|
theme: {}
|
|
509
588
|
},
|
|
510
589
|
setup(e) {
|
|
511
|
-
const
|
|
590
|
+
const l = e, t = w(!1), c = w(null), o = [
|
|
512
591
|
"#000000",
|
|
513
592
|
"#434343",
|
|
514
593
|
"#666666",
|
|
@@ -549,90 +628,90 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
549
628
|
"#d5a6bd"
|
|
550
629
|
], a = A(() => {
|
|
551
630
|
var m;
|
|
552
|
-
return ((m =
|
|
631
|
+
return ((m = l.editor) == null ? void 0 : m.getAttributes("textStyle").color) || "#000000";
|
|
553
632
|
});
|
|
554
|
-
function
|
|
633
|
+
function u(m) {
|
|
555
634
|
var r;
|
|
556
|
-
(r =
|
|
635
|
+
(r = l.editor) == null || r.chain().focus().setColor(m).run(), t.value = !1;
|
|
557
636
|
}
|
|
558
637
|
function i(m) {
|
|
559
|
-
|
|
638
|
+
c.value && !c.value.contains(m.target) && (t.value = !1);
|
|
560
639
|
}
|
|
561
|
-
return
|
|
640
|
+
return F(() => document.addEventListener("click", i)), O(() => document.removeEventListener("click", i)), (m, r) => (h(), b("div", {
|
|
562
641
|
class: "relative",
|
|
563
642
|
ref_key: "pickerRef",
|
|
564
|
-
ref:
|
|
643
|
+
ref: c
|
|
565
644
|
}, [
|
|
566
|
-
|
|
645
|
+
n("button", {
|
|
567
646
|
type: "button",
|
|
568
647
|
class: C([e.theme.toolbarButton, "flex items-center gap-1 px-2"]),
|
|
569
648
|
title: "Font color",
|
|
570
|
-
onClick: r[0] || (r[0] = (
|
|
649
|
+
onClick: r[0] || (r[0] = (s) => t.value = !t.value)
|
|
571
650
|
}, [
|
|
572
|
-
r[2] || (r[2] =
|
|
573
|
-
|
|
651
|
+
r[2] || (r[2] = n("span", null, "A", -1)),
|
|
652
|
+
n("div", {
|
|
574
653
|
class: "w-4 h-1 rounded",
|
|
575
|
-
style:
|
|
654
|
+
style: I({ backgroundColor: a.value })
|
|
576
655
|
}, null, 4)
|
|
577
656
|
], 2),
|
|
578
|
-
t.value ? (
|
|
657
|
+
t.value ? (h(), b("div", {
|
|
579
658
|
key: 0,
|
|
580
659
|
class: C([e.theme.dropdown, "absolute top-full left-0 mt-1 p-2 w-48"])
|
|
581
660
|
}, [
|
|
582
|
-
|
|
583
|
-
(
|
|
584
|
-
key:
|
|
661
|
+
n("div", Ze, [
|
|
662
|
+
(h(), b(M, null, L(o, (s) => n("button", {
|
|
663
|
+
key: s,
|
|
585
664
|
class: "w-5 h-5 rounded border border-gray-200 cursor-pointer hover:scale-110 transition-transform",
|
|
586
|
-
style:
|
|
587
|
-
title:
|
|
588
|
-
onClick: (
|
|
589
|
-
}, null, 12,
|
|
665
|
+
style: I({ backgroundColor: s }),
|
|
666
|
+
title: s,
|
|
667
|
+
onClick: (d) => u(s)
|
|
668
|
+
}, null, 12, Qe)), 64))
|
|
590
669
|
]),
|
|
591
|
-
|
|
592
|
-
r[3] || (r[3] =
|
|
593
|
-
|
|
670
|
+
n("div", _e, [
|
|
671
|
+
r[3] || (r[3] = n("label", { class: "text-xs text-gray-500" }, "Custom:", -1)),
|
|
672
|
+
n("input", {
|
|
594
673
|
type: "color",
|
|
595
674
|
value: a.value,
|
|
596
675
|
class: "w-6 h-6 cursor-pointer",
|
|
597
|
-
onInput: r[1] || (r[1] = (
|
|
598
|
-
}, null, 40,
|
|
676
|
+
onInput: r[1] || (r[1] = (s) => u(s.target.value))
|
|
677
|
+
}, null, 40, et)
|
|
599
678
|
])
|
|
600
679
|
], 2)) : T("", !0)
|
|
601
680
|
], 512));
|
|
602
681
|
}
|
|
603
|
-
}),
|
|
682
|
+
}), nt = /* @__PURE__ */ $({
|
|
604
683
|
__name: "AlignmentButtons",
|
|
605
684
|
props: {
|
|
606
685
|
editor: {},
|
|
607
686
|
theme: {}
|
|
608
687
|
},
|
|
609
688
|
setup(e) {
|
|
610
|
-
return (
|
|
611
|
-
var
|
|
612
|
-
return
|
|
613
|
-
|
|
689
|
+
return (l, t) => {
|
|
690
|
+
var c, o, a, u;
|
|
691
|
+
return h(), b(M, null, [
|
|
692
|
+
g(k, {
|
|
614
693
|
theme: e.theme,
|
|
615
694
|
title: "Align left",
|
|
616
|
-
"is-active": (
|
|
695
|
+
"is-active": (c = e.editor) == null ? void 0 : c.isActive({ textAlign: "left" }),
|
|
617
696
|
onClick: t[0] || (t[0] = (i) => {
|
|
618
697
|
var m;
|
|
619
698
|
return (m = e.editor) == null ? void 0 : m.chain().focus().setTextAlign("left").run();
|
|
620
699
|
})
|
|
621
700
|
}, {
|
|
622
701
|
default: y(() => [...t[4] || (t[4] = [
|
|
623
|
-
|
|
702
|
+
n("svg", {
|
|
624
703
|
class: "w-4 h-4",
|
|
625
704
|
viewBox: "0 0 24 24",
|
|
626
705
|
fill: "none",
|
|
627
706
|
stroke: "currentColor",
|
|
628
707
|
"stroke-width": "2"
|
|
629
708
|
}, [
|
|
630
|
-
|
|
709
|
+
n("path", { d: "M3 6h18M3 12h10M3 18h14" })
|
|
631
710
|
], -1)
|
|
632
711
|
])]),
|
|
633
712
|
_: 1
|
|
634
713
|
}, 8, ["theme", "is-active"]),
|
|
635
|
-
|
|
714
|
+
g(k, {
|
|
636
715
|
theme: e.theme,
|
|
637
716
|
title: "Align center",
|
|
638
717
|
"is-active": (o = e.editor) == null ? void 0 : o.isActive({ textAlign: "center" }),
|
|
@@ -642,19 +721,19 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
642
721
|
})
|
|
643
722
|
}, {
|
|
644
723
|
default: y(() => [...t[5] || (t[5] = [
|
|
645
|
-
|
|
724
|
+
n("svg", {
|
|
646
725
|
class: "w-4 h-4",
|
|
647
726
|
viewBox: "0 0 24 24",
|
|
648
727
|
fill: "none",
|
|
649
728
|
stroke: "currentColor",
|
|
650
729
|
"stroke-width": "2"
|
|
651
730
|
}, [
|
|
652
|
-
|
|
731
|
+
n("path", { d: "M3 6h18M7 12h10M5 18h14" })
|
|
653
732
|
], -1)
|
|
654
733
|
])]),
|
|
655
734
|
_: 1
|
|
656
735
|
}, 8, ["theme", "is-active"]),
|
|
657
|
-
|
|
736
|
+
g(k, {
|
|
658
737
|
theme: e.theme,
|
|
659
738
|
title: "Align right",
|
|
660
739
|
"is-active": (a = e.editor) == null ? void 0 : a.isActive({ textAlign: "right" }),
|
|
@@ -664,36 +743,36 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
664
743
|
})
|
|
665
744
|
}, {
|
|
666
745
|
default: y(() => [...t[6] || (t[6] = [
|
|
667
|
-
|
|
746
|
+
n("svg", {
|
|
668
747
|
class: "w-4 h-4",
|
|
669
748
|
viewBox: "0 0 24 24",
|
|
670
749
|
fill: "none",
|
|
671
750
|
stroke: "currentColor",
|
|
672
751
|
"stroke-width": "2"
|
|
673
752
|
}, [
|
|
674
|
-
|
|
753
|
+
n("path", { d: "M3 6h18M11 12h10M7 18h14" })
|
|
675
754
|
], -1)
|
|
676
755
|
])]),
|
|
677
756
|
_: 1
|
|
678
757
|
}, 8, ["theme", "is-active"]),
|
|
679
|
-
|
|
758
|
+
g(k, {
|
|
680
759
|
theme: e.theme,
|
|
681
760
|
title: "Justify",
|
|
682
|
-
"is-active": (
|
|
761
|
+
"is-active": (u = e.editor) == null ? void 0 : u.isActive({ textAlign: "justify" }),
|
|
683
762
|
onClick: t[3] || (t[3] = (i) => {
|
|
684
763
|
var m;
|
|
685
764
|
return (m = e.editor) == null ? void 0 : m.chain().focus().setTextAlign("justify").run();
|
|
686
765
|
})
|
|
687
766
|
}, {
|
|
688
767
|
default: y(() => [...t[7] || (t[7] = [
|
|
689
|
-
|
|
768
|
+
n("svg", {
|
|
690
769
|
class: "w-4 h-4",
|
|
691
770
|
viewBox: "0 0 24 24",
|
|
692
771
|
fill: "none",
|
|
693
772
|
stroke: "currentColor",
|
|
694
773
|
"stroke-width": "2"
|
|
695
774
|
}, [
|
|
696
|
-
|
|
775
|
+
n("path", { d: "M3 6h18M3 12h18M3 18h18" })
|
|
697
776
|
], -1)
|
|
698
777
|
])]),
|
|
699
778
|
_: 1
|
|
@@ -701,127 +780,127 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
701
780
|
], 64);
|
|
702
781
|
};
|
|
703
782
|
}
|
|
704
|
-
}),
|
|
783
|
+
}), lt = ["onClick"], ot = /* @__PURE__ */ $({
|
|
705
784
|
__name: "LineHeightPicker",
|
|
706
785
|
props: {
|
|
707
786
|
editor: {},
|
|
708
787
|
theme: {}
|
|
709
788
|
},
|
|
710
789
|
setup(e) {
|
|
711
|
-
const
|
|
790
|
+
const l = e, t = Oe, c = A(() => {
|
|
712
791
|
var o, a;
|
|
713
|
-
return ((o =
|
|
792
|
+
return ((o = l.editor) == null ? void 0 : o.getAttributes("paragraph").lineHeight) || ((a = l.editor) == null ? void 0 : a.getAttributes("heading").lineHeight) || "";
|
|
714
793
|
});
|
|
715
|
-
return (o, a) => (
|
|
794
|
+
return (o, a) => (h(), E(U, {
|
|
716
795
|
theme: e.theme,
|
|
717
|
-
label:
|
|
796
|
+
label: c.value || "Height",
|
|
718
797
|
title: "Line height"
|
|
719
798
|
}, {
|
|
720
|
-
default: y(({ close:
|
|
721
|
-
(
|
|
799
|
+
default: y(({ close: u }) => [
|
|
800
|
+
(h(!0), b(M, null, L(H(t), (i) => (h(), b("button", {
|
|
722
801
|
key: i,
|
|
723
802
|
class: C([
|
|
724
803
|
"block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",
|
|
725
|
-
|
|
804
|
+
c.value === i ? "bg-gray-50 font-semibold" : ""
|
|
726
805
|
]),
|
|
727
806
|
onClick: (m) => {
|
|
728
807
|
var r;
|
|
729
|
-
(r = e.editor) == null || r.chain().focus().setLineHeight(i).run(),
|
|
808
|
+
(r = e.editor) == null || r.chain().focus().setLineHeight(i).run(), u();
|
|
730
809
|
}
|
|
731
|
-
},
|
|
810
|
+
}, S(i), 11, lt))), 128))
|
|
732
811
|
]),
|
|
733
812
|
_: 1
|
|
734
813
|
}, 8, ["theme", "label"]));
|
|
735
814
|
}
|
|
736
|
-
}),
|
|
815
|
+
}), it = { class: "flex gap-2" }, rt = /* @__PURE__ */ $({
|
|
737
816
|
__name: "LinkButton",
|
|
738
817
|
props: {
|
|
739
818
|
editor: {},
|
|
740
819
|
theme: {}
|
|
741
820
|
},
|
|
742
821
|
setup(e) {
|
|
743
|
-
const
|
|
744
|
-
function
|
|
745
|
-
var
|
|
746
|
-
|
|
747
|
-
var
|
|
748
|
-
return (
|
|
822
|
+
const l = e, t = w(!1), c = w(""), o = w(null), a = w(null);
|
|
823
|
+
function u() {
|
|
824
|
+
var s;
|
|
825
|
+
c.value = ((s = l.editor) == null ? void 0 : s.getAttributes("link").href) || "", t.value = !t.value, t.value && _(() => {
|
|
826
|
+
var d;
|
|
827
|
+
return (d = a.value) == null ? void 0 : d.focus();
|
|
749
828
|
});
|
|
750
829
|
}
|
|
751
830
|
function i() {
|
|
752
|
-
var
|
|
753
|
-
|
|
831
|
+
var s;
|
|
832
|
+
c.value && ((s = l.editor) == null || s.chain().focus().extendMarkRange("link").setLink({ href: c.value }).run()), t.value = !1;
|
|
754
833
|
}
|
|
755
834
|
function m() {
|
|
756
|
-
var
|
|
757
|
-
(
|
|
835
|
+
var s;
|
|
836
|
+
(s = l.editor) == null || s.chain().focus().unsetLink().run(), t.value = !1;
|
|
758
837
|
}
|
|
759
|
-
function r(
|
|
760
|
-
o.value && !o.value.contains(
|
|
838
|
+
function r(s) {
|
|
839
|
+
o.value && !o.value.contains(s.target) && (t.value = !1);
|
|
761
840
|
}
|
|
762
|
-
return
|
|
763
|
-
var
|
|
764
|
-
return
|
|
841
|
+
return F(() => document.addEventListener("click", r)), O(() => document.removeEventListener("click", r)), (s, d) => {
|
|
842
|
+
var v, x;
|
|
843
|
+
return h(), b("div", {
|
|
765
844
|
class: "relative",
|
|
766
845
|
ref_key: "linkRef",
|
|
767
846
|
ref: o
|
|
768
847
|
}, [
|
|
769
|
-
|
|
848
|
+
g(k, {
|
|
770
849
|
theme: e.theme,
|
|
771
850
|
title: "Link",
|
|
772
|
-
"is-active": (
|
|
773
|
-
onClick:
|
|
851
|
+
"is-active": (v = e.editor) == null ? void 0 : v.isActive("link"),
|
|
852
|
+
onClick: u
|
|
774
853
|
}, {
|
|
775
|
-
default: y(() => [...
|
|
776
|
-
|
|
854
|
+
default: y(() => [...d[2] || (d[2] = [
|
|
855
|
+
n("svg", {
|
|
777
856
|
class: "w-4 h-4",
|
|
778
857
|
viewBox: "0 0 24 24",
|
|
779
858
|
fill: "none",
|
|
780
859
|
stroke: "currentColor",
|
|
781
860
|
"stroke-width": "2"
|
|
782
861
|
}, [
|
|
783
|
-
|
|
784
|
-
|
|
862
|
+
n("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
|
|
863
|
+
n("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
|
|
785
864
|
], -1)
|
|
786
865
|
])]),
|
|
787
866
|
_: 1
|
|
788
867
|
}, 8, ["theme", "is-active"]),
|
|
789
|
-
t.value ? (
|
|
868
|
+
t.value ? (h(), b("div", {
|
|
790
869
|
key: 0,
|
|
791
870
|
class: C([e.theme.dropdown, "absolute top-full left-0 mt-1 p-3 w-72"])
|
|
792
871
|
}, [
|
|
793
|
-
|
|
794
|
-
z(
|
|
872
|
+
d[3] || (d[3] = n("label", { class: "block text-xs text-gray-500 mb-1" }, "URL", -1)),
|
|
873
|
+
z(n("input", {
|
|
795
874
|
ref_key: "urlInput",
|
|
796
875
|
ref: a,
|
|
797
|
-
"onUpdate:modelValue":
|
|
876
|
+
"onUpdate:modelValue": d[0] || (d[0] = (p) => c.value = p),
|
|
798
877
|
type: "url",
|
|
799
878
|
placeholder: "https://example.com",
|
|
800
879
|
class: "w-full border border-gray-300 rounded px-2 py-1 text-sm mb-2",
|
|
801
|
-
onKeydown:
|
|
880
|
+
onKeydown: N(i, ["enter"])
|
|
802
881
|
}, null, 544), [
|
|
803
|
-
[V,
|
|
882
|
+
[V, c.value]
|
|
804
883
|
]),
|
|
805
|
-
|
|
806
|
-
|
|
884
|
+
n("div", it, [
|
|
885
|
+
n("button", {
|
|
807
886
|
class: "px-3 py-1 text-sm bg-blue-600 text-white rounded hover:bg-blue-700",
|
|
808
887
|
onClick: i
|
|
809
888
|
}, " Apply "),
|
|
810
|
-
(x = e.editor) != null && x.isActive("link") ? (
|
|
889
|
+
(x = e.editor) != null && x.isActive("link") ? (h(), b("button", {
|
|
811
890
|
key: 0,
|
|
812
891
|
class: "px-3 py-1 text-sm bg-red-100 text-red-600 rounded hover:bg-red-200",
|
|
813
892
|
onClick: m
|
|
814
893
|
}, " Remove ")) : T("", !0),
|
|
815
|
-
|
|
894
|
+
n("button", {
|
|
816
895
|
class: "px-3 py-1 text-sm text-gray-500 hover:text-gray-700",
|
|
817
|
-
onClick:
|
|
896
|
+
onClick: d[1] || (d[1] = (p) => t.value = !1)
|
|
818
897
|
}, " Cancel ")
|
|
819
898
|
])
|
|
820
899
|
], 2)) : T("", !0)
|
|
821
900
|
], 512);
|
|
822
901
|
};
|
|
823
902
|
}
|
|
824
|
-
}),
|
|
903
|
+
}), st = ["accept"], at = /* @__PURE__ */ $({
|
|
825
904
|
__name: "ImageUploadButton",
|
|
826
905
|
props: {
|
|
827
906
|
editor: {},
|
|
@@ -829,222 +908,222 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
829
908
|
imageConfig: {}
|
|
830
909
|
},
|
|
831
910
|
emits: ["error"],
|
|
832
|
-
setup(e, { emit:
|
|
833
|
-
const t = e,
|
|
834
|
-
...
|
|
911
|
+
setup(e, { emit: l }) {
|
|
912
|
+
const t = e, c = l, o = w(null), a = A(() => ({
|
|
913
|
+
...Ie,
|
|
835
914
|
...t.imageConfig
|
|
836
|
-
})),
|
|
915
|
+
})), u = A(() => a.value.allowedTypes.join(","));
|
|
837
916
|
function i() {
|
|
838
917
|
var r;
|
|
839
918
|
(r = o.value) == null || r.click();
|
|
840
919
|
}
|
|
841
920
|
function m(r) {
|
|
842
921
|
var x;
|
|
843
|
-
const
|
|
844
|
-
if (!
|
|
845
|
-
if (!a.value.allowedTypes.includes(
|
|
846
|
-
|
|
922
|
+
const s = r.target, d = (x = s.files) == null ? void 0 : x[0];
|
|
923
|
+
if (!d) return;
|
|
924
|
+
if (!a.value.allowedTypes.includes(d.type)) {
|
|
925
|
+
c("error", { message: `File type ${d.type} is not allowed`, detail: { allowedTypes: a.value.allowedTypes } }), s.value = "";
|
|
847
926
|
return;
|
|
848
927
|
}
|
|
849
|
-
if (
|
|
928
|
+
if (d.size > a.value.maxSize) {
|
|
850
929
|
const p = (a.value.maxSize / 1048576).toFixed(1);
|
|
851
|
-
|
|
930
|
+
c("error", { message: `File size exceeds ${p}MB limit`, detail: { maxSize: a.value.maxSize, fileSize: d.size } }), s.value = "";
|
|
852
931
|
return;
|
|
853
932
|
}
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
var
|
|
857
|
-
const p =
|
|
858
|
-
(
|
|
859
|
-
},
|
|
933
|
+
const v = new FileReader();
|
|
934
|
+
v.onload = () => {
|
|
935
|
+
var f;
|
|
936
|
+
const p = v.result;
|
|
937
|
+
(f = t.editor) == null || f.chain().focus().setImage({ src: p }).run();
|
|
938
|
+
}, v.readAsDataURL(d), s.value = "";
|
|
860
939
|
}
|
|
861
|
-
return (r,
|
|
862
|
-
|
|
940
|
+
return (r, s) => (h(), b(M, null, [
|
|
941
|
+
g(k, {
|
|
863
942
|
theme: e.theme,
|
|
864
943
|
title: "Insert image",
|
|
865
944
|
onClick: i
|
|
866
945
|
}, {
|
|
867
|
-
default: y(() => [...
|
|
868
|
-
|
|
946
|
+
default: y(() => [...s[0] || (s[0] = [
|
|
947
|
+
n("svg", {
|
|
869
948
|
class: "w-4 h-4",
|
|
870
949
|
viewBox: "0 0 24 24",
|
|
871
950
|
fill: "none",
|
|
872
951
|
stroke: "currentColor",
|
|
873
952
|
"stroke-width": "2"
|
|
874
953
|
}, [
|
|
875
|
-
|
|
954
|
+
n("rect", {
|
|
876
955
|
x: "3",
|
|
877
956
|
y: "3",
|
|
878
957
|
width: "18",
|
|
879
958
|
height: "18",
|
|
880
959
|
rx: "2"
|
|
881
960
|
}),
|
|
882
|
-
|
|
961
|
+
n("circle", {
|
|
883
962
|
cx: "8.5",
|
|
884
963
|
cy: "8.5",
|
|
885
964
|
r: "1.5"
|
|
886
965
|
}),
|
|
887
|
-
|
|
966
|
+
n("path", { d: "M21 15l-5-5L5 21" })
|
|
888
967
|
], -1)
|
|
889
968
|
])]),
|
|
890
969
|
_: 1
|
|
891
970
|
}, 8, ["theme"]),
|
|
892
|
-
|
|
971
|
+
n("input", {
|
|
893
972
|
ref_key: "fileInput",
|
|
894
973
|
ref: o,
|
|
895
974
|
type: "file",
|
|
896
|
-
accept:
|
|
975
|
+
accept: u.value,
|
|
897
976
|
class: "hidden",
|
|
898
977
|
onChange: m
|
|
899
|
-
}, null, 40,
|
|
978
|
+
}, null, 40, st)
|
|
900
979
|
], 64));
|
|
901
980
|
}
|
|
902
|
-
}),
|
|
981
|
+
}), ut = { class: "mb-1 text-xs text-gray-500 text-center" }, dt = ["onMouseenter"], ct = 8, J = 10, mt = /* @__PURE__ */ $({
|
|
903
982
|
__name: "TableGridPicker",
|
|
904
983
|
props: {
|
|
905
984
|
editor: {},
|
|
906
985
|
theme: {}
|
|
907
986
|
},
|
|
908
987
|
setup(e) {
|
|
909
|
-
const
|
|
910
|
-
function
|
|
911
|
-
var
|
|
912
|
-
(
|
|
988
|
+
const l = e, t = w(!1), c = w(0), o = w(0), a = w(null);
|
|
989
|
+
function u(m, r) {
|
|
990
|
+
var s;
|
|
991
|
+
(s = l.editor) == null || s.chain().focus().insertTable({ rows: m, cols: r, withHeaderRow: !0 }).run(), t.value = !1, c.value = 0, o.value = 0;
|
|
913
992
|
}
|
|
914
993
|
function i(m) {
|
|
915
994
|
a.value && !a.value.contains(m.target) && (t.value = !1);
|
|
916
995
|
}
|
|
917
|
-
return
|
|
996
|
+
return F(() => document.addEventListener("click", i)), O(() => document.removeEventListener("click", i)), (m, r) => (h(), b("div", {
|
|
918
997
|
class: "relative",
|
|
919
998
|
ref_key: "pickerRef",
|
|
920
999
|
ref: a
|
|
921
1000
|
}, [
|
|
922
|
-
|
|
1001
|
+
g(k, {
|
|
923
1002
|
theme: e.theme,
|
|
924
1003
|
title: "Insert table",
|
|
925
|
-
onClick: r[0] || (r[0] = (
|
|
1004
|
+
onClick: r[0] || (r[0] = (s) => t.value = !t.value)
|
|
926
1005
|
}, {
|
|
927
1006
|
default: y(() => [...r[2] || (r[2] = [
|
|
928
|
-
|
|
1007
|
+
n("svg", {
|
|
929
1008
|
class: "w-4 h-4",
|
|
930
1009
|
viewBox: "0 0 24 24",
|
|
931
1010
|
fill: "none",
|
|
932
1011
|
stroke: "currentColor",
|
|
933
1012
|
"stroke-width": "2"
|
|
934
1013
|
}, [
|
|
935
|
-
|
|
1014
|
+
n("rect", {
|
|
936
1015
|
x: "3",
|
|
937
1016
|
y: "3",
|
|
938
1017
|
width: "18",
|
|
939
1018
|
height: "18",
|
|
940
1019
|
rx: "1"
|
|
941
1020
|
}),
|
|
942
|
-
|
|
1021
|
+
n("path", { d: "M3 9h18M3 15h18M9 3v18M15 3v18" })
|
|
943
1022
|
], -1)
|
|
944
1023
|
])]),
|
|
945
1024
|
_: 1
|
|
946
1025
|
}, 8, ["theme"]),
|
|
947
|
-
t.value ? (
|
|
1026
|
+
t.value ? (h(), b("div", {
|
|
948
1027
|
key: 0,
|
|
949
1028
|
class: C([e.theme.dropdown, "absolute top-full left-0 mt-1 p-2"])
|
|
950
1029
|
}, [
|
|
951
|
-
|
|
952
|
-
|
|
1030
|
+
n("div", ut, S(o.value > 0 ? `${o.value} × ${c.value}` : "Select size"), 1),
|
|
1031
|
+
n("div", {
|
|
953
1032
|
class: "grid gap-0.5",
|
|
954
|
-
style:
|
|
1033
|
+
style: I({ gridTemplateColumns: `repeat(${J}, 1fr)` })
|
|
955
1034
|
}, [
|
|
956
|
-
(
|
|
957
|
-
key: "row-" +
|
|
1035
|
+
(h(), b(M, null, L(ct, (s) => (h(), b(M, {
|
|
1036
|
+
key: "row-" + s
|
|
958
1037
|
}, [
|
|
959
|
-
(
|
|
960
|
-
key: "cell-" +
|
|
961
|
-
class: C(["w-5 h-5 border cursor-pointer",
|
|
962
|
-
onMouseenter: (
|
|
963
|
-
|
|
1038
|
+
(h(), b(M, null, L(J, (d) => n("div", {
|
|
1039
|
+
key: "cell-" + s + "-" + d,
|
|
1040
|
+
class: C(["w-5 h-5 border cursor-pointer", s <= c.value && d <= o.value ? "bg-blue-200 border-blue-300" : "bg-white border-gray-300"]),
|
|
1041
|
+
onMouseenter: (v) => {
|
|
1042
|
+
c.value = s, o.value = d;
|
|
964
1043
|
},
|
|
965
|
-
onClick: r[1] || (r[1] = (
|
|
966
|
-
}, null, 42,
|
|
1044
|
+
onClick: r[1] || (r[1] = (v) => u(c.value, o.value))
|
|
1045
|
+
}, null, 42, dt)), 64))
|
|
967
1046
|
], 64))), 64))
|
|
968
1047
|
], 4)
|
|
969
1048
|
], 2)) : T("", !0)
|
|
970
1049
|
], 512));
|
|
971
1050
|
}
|
|
972
|
-
}),
|
|
1051
|
+
}), ft = { class: "flex gap-2" }, vt = /* @__PURE__ */ $({
|
|
973
1052
|
__name: "VideoEmbedButton",
|
|
974
1053
|
props: {
|
|
975
1054
|
editor: {},
|
|
976
1055
|
theme: {}
|
|
977
1056
|
},
|
|
978
1057
|
setup(e) {
|
|
979
|
-
const
|
|
1058
|
+
const l = e, t = w(!1), c = w(""), o = w(null);
|
|
980
1059
|
function a(m) {
|
|
981
1060
|
const r = m.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/);
|
|
982
1061
|
if (r) return `https://www.youtube.com/embed/${r[1]}`;
|
|
983
|
-
const
|
|
984
|
-
return
|
|
1062
|
+
const s = m.match(/vimeo\.com\/(\d+)/);
|
|
1063
|
+
return s ? `https://player.vimeo.com/video/${s[1]}` : m;
|
|
985
1064
|
}
|
|
986
|
-
function
|
|
1065
|
+
function u() {
|
|
987
1066
|
var m;
|
|
988
|
-
if (
|
|
989
|
-
const r = a(
|
|
990
|
-
(m =
|
|
1067
|
+
if (c.value) {
|
|
1068
|
+
const r = a(c.value);
|
|
1069
|
+
(m = l.editor) == null || m.chain().focus().setVideo({ src: r }).run();
|
|
991
1070
|
}
|
|
992
|
-
t.value = !1,
|
|
1071
|
+
t.value = !1, c.value = "";
|
|
993
1072
|
}
|
|
994
1073
|
function i(m) {
|
|
995
1074
|
o.value && !o.value.contains(m.target) && (t.value = !1);
|
|
996
1075
|
}
|
|
997
|
-
return
|
|
1076
|
+
return F(() => document.addEventListener("click", i)), O(() => document.removeEventListener("click", i)), (m, r) => (h(), b("div", {
|
|
998
1077
|
class: "relative",
|
|
999
1078
|
ref_key: "videoRef",
|
|
1000
1079
|
ref: o
|
|
1001
1080
|
}, [
|
|
1002
|
-
|
|
1081
|
+
g(k, {
|
|
1003
1082
|
theme: e.theme,
|
|
1004
1083
|
title: "Embed video",
|
|
1005
|
-
onClick: r[0] || (r[0] = (
|
|
1084
|
+
onClick: r[0] || (r[0] = (s) => t.value = !t.value)
|
|
1006
1085
|
}, {
|
|
1007
1086
|
default: y(() => [...r[3] || (r[3] = [
|
|
1008
|
-
|
|
1087
|
+
n("svg", {
|
|
1009
1088
|
class: "w-4 h-4",
|
|
1010
1089
|
viewBox: "0 0 24 24",
|
|
1011
1090
|
fill: "none",
|
|
1012
1091
|
stroke: "currentColor",
|
|
1013
1092
|
"stroke-width": "2"
|
|
1014
1093
|
}, [
|
|
1015
|
-
|
|
1094
|
+
n("polygon", { points: "5,3 19,12 5,21" })
|
|
1016
1095
|
], -1)
|
|
1017
1096
|
])]),
|
|
1018
1097
|
_: 1
|
|
1019
1098
|
}, 8, ["theme"]),
|
|
1020
|
-
t.value ? (
|
|
1099
|
+
t.value ? (h(), b("div", {
|
|
1021
1100
|
key: 0,
|
|
1022
1101
|
class: C([e.theme.dropdown, "absolute top-full left-0 mt-1 p-3 w-80"])
|
|
1023
1102
|
}, [
|
|
1024
|
-
r[4] || (r[4] =
|
|
1025
|
-
z(
|
|
1026
|
-
"onUpdate:modelValue": r[1] || (r[1] = (
|
|
1103
|
+
r[4] || (r[4] = n("label", { class: "block text-xs text-gray-500 mb-1" }, "Video URL (YouTube, Vimeo)", -1)),
|
|
1104
|
+
z(n("input", {
|
|
1105
|
+
"onUpdate:modelValue": r[1] || (r[1] = (s) => c.value = s),
|
|
1027
1106
|
type: "url",
|
|
1028
1107
|
placeholder: "https://www.youtube.com/watch?v=...",
|
|
1029
1108
|
class: "w-full border border-gray-300 rounded px-2 py-1 text-sm mb-2",
|
|
1030
|
-
onKeydown:
|
|
1109
|
+
onKeydown: N(u, ["enter"])
|
|
1031
1110
|
}, null, 544), [
|
|
1032
|
-
[V,
|
|
1111
|
+
[V, c.value]
|
|
1033
1112
|
]),
|
|
1034
|
-
|
|
1035
|
-
|
|
1113
|
+
n("div", ft, [
|
|
1114
|
+
n("button", {
|
|
1036
1115
|
class: "px-3 py-1 text-sm bg-blue-600 text-white rounded hover:bg-blue-700",
|
|
1037
|
-
onClick:
|
|
1116
|
+
onClick: u
|
|
1038
1117
|
}, " Embed "),
|
|
1039
|
-
|
|
1118
|
+
n("button", {
|
|
1040
1119
|
class: "px-3 py-1 text-sm text-gray-500 hover:text-gray-700",
|
|
1041
|
-
onClick: r[2] || (r[2] = (
|
|
1120
|
+
onClick: r[2] || (r[2] = (s) => t.value = !1)
|
|
1042
1121
|
}, " Cancel ")
|
|
1043
1122
|
])
|
|
1044
1123
|
], 2)) : T("", !0)
|
|
1045
1124
|
], 512));
|
|
1046
1125
|
}
|
|
1047
|
-
}),
|
|
1126
|
+
}), gt = /* @__PURE__ */ $({
|
|
1048
1127
|
__name: "EditorToolbar",
|
|
1049
1128
|
props: {
|
|
1050
1129
|
editor: {},
|
|
@@ -1053,311 +1132,359 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
1053
1132
|
},
|
|
1054
1133
|
emits: ["saveTemplate", "loadTemplate", "save", "error"],
|
|
1055
1134
|
setup(e) {
|
|
1056
|
-
return (
|
|
1057
|
-
var
|
|
1058
|
-
return
|
|
1135
|
+
return (l, t) => {
|
|
1136
|
+
var c, o, a, u, i, m, r, s, d, v, x;
|
|
1137
|
+
return h(), b("div", {
|
|
1059
1138
|
class: C(e.theme.toolbar)
|
|
1060
1139
|
}, [
|
|
1061
|
-
|
|
1140
|
+
g(k, {
|
|
1062
1141
|
theme: e.theme,
|
|
1063
1142
|
title: "Undo",
|
|
1064
1143
|
onClick: t[0] || (t[0] = (p) => {
|
|
1065
|
-
var
|
|
1066
|
-
return (
|
|
1144
|
+
var f;
|
|
1145
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().undo().run();
|
|
1067
1146
|
}),
|
|
1068
|
-
disabled: !((
|
|
1147
|
+
disabled: !((c = e.editor) != null && c.can().undo())
|
|
1069
1148
|
}, {
|
|
1070
|
-
default: y(() => [...t[
|
|
1071
|
-
|
|
1149
|
+
default: y(() => [...t[18] || (t[18] = [
|
|
1150
|
+
n("svg", {
|
|
1072
1151
|
class: "w-4 h-4",
|
|
1073
1152
|
viewBox: "0 0 24 24",
|
|
1074
1153
|
fill: "none",
|
|
1075
1154
|
stroke: "currentColor",
|
|
1076
1155
|
"stroke-width": "2"
|
|
1077
1156
|
}, [
|
|
1078
|
-
|
|
1079
|
-
|
|
1157
|
+
n("path", { d: "M3 10h10a5 5 0 0 1 0 10H9" }),
|
|
1158
|
+
n("path", { d: "M3 10l4-4M3 10l4 4" })
|
|
1080
1159
|
], -1)
|
|
1081
1160
|
])]),
|
|
1082
1161
|
_: 1
|
|
1083
1162
|
}, 8, ["theme", "disabled"]),
|
|
1084
|
-
|
|
1163
|
+
g(k, {
|
|
1085
1164
|
theme: e.theme,
|
|
1086
1165
|
title: "Redo",
|
|
1087
1166
|
onClick: t[1] || (t[1] = (p) => {
|
|
1088
|
-
var
|
|
1089
|
-
return (
|
|
1167
|
+
var f;
|
|
1168
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().redo().run();
|
|
1090
1169
|
}),
|
|
1091
1170
|
disabled: !((o = e.editor) != null && o.can().redo())
|
|
1092
1171
|
}, {
|
|
1093
|
-
default: y(() => [...t[
|
|
1094
|
-
|
|
1172
|
+
default: y(() => [...t[19] || (t[19] = [
|
|
1173
|
+
n("svg", {
|
|
1095
1174
|
class: "w-4 h-4",
|
|
1096
1175
|
viewBox: "0 0 24 24",
|
|
1097
1176
|
fill: "none",
|
|
1098
1177
|
stroke: "currentColor",
|
|
1099
1178
|
"stroke-width": "2"
|
|
1100
1179
|
}, [
|
|
1101
|
-
|
|
1102
|
-
|
|
1180
|
+
n("path", { d: "M21 10H11a5 5 0 0 0 0 10h4" }),
|
|
1181
|
+
n("path", { d: "M21 10l-4-4M21 10l-4 4" })
|
|
1103
1182
|
], -1)
|
|
1104
1183
|
])]),
|
|
1105
1184
|
_: 1
|
|
1106
1185
|
}, 8, ["theme", "disabled"]),
|
|
1107
|
-
|
|
1108
|
-
|
|
1186
|
+
g(B),
|
|
1187
|
+
g(qe, {
|
|
1109
1188
|
editor: e.editor,
|
|
1110
1189
|
theme: e.theme
|
|
1111
1190
|
}, null, 8, ["editor", "theme"]),
|
|
1112
|
-
|
|
1113
|
-
|
|
1191
|
+
g(B),
|
|
1192
|
+
g(Je, {
|
|
1114
1193
|
editor: e.editor,
|
|
1115
1194
|
theme: e.theme
|
|
1116
1195
|
}, null, 8, ["editor", "theme"]),
|
|
1117
|
-
|
|
1196
|
+
g(Ye, {
|
|
1118
1197
|
editor: e.editor,
|
|
1119
1198
|
theme: e.theme
|
|
1120
1199
|
}, null, 8, ["editor", "theme"]),
|
|
1121
|
-
|
|
1122
|
-
|
|
1200
|
+
g(B),
|
|
1201
|
+
g(k, {
|
|
1123
1202
|
theme: e.theme,
|
|
1124
1203
|
title: "Bold",
|
|
1125
1204
|
"is-active": (a = e.editor) == null ? void 0 : a.isActive("bold"),
|
|
1126
1205
|
onClick: t[2] || (t[2] = (p) => {
|
|
1127
|
-
var
|
|
1128
|
-
return (
|
|
1206
|
+
var f;
|
|
1207
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleBold().run();
|
|
1129
1208
|
})
|
|
1130
1209
|
}, {
|
|
1131
|
-
default: y(() => [...t[
|
|
1132
|
-
|
|
1210
|
+
default: y(() => [...t[20] || (t[20] = [
|
|
1211
|
+
n("svg", {
|
|
1133
1212
|
class: "w-4 h-4",
|
|
1134
1213
|
viewBox: "0 0 24 24",
|
|
1135
1214
|
fill: "none",
|
|
1136
1215
|
stroke: "currentColor",
|
|
1137
1216
|
"stroke-width": "2"
|
|
1138
1217
|
}, [
|
|
1139
|
-
|
|
1218
|
+
n("path", { d: "M6 4h8a4 4 0 0 1 0 8H6V4zm0 8h9a4.5 4.5 0 0 1 0 9H6v-9z" })
|
|
1140
1219
|
], -1)
|
|
1141
1220
|
])]),
|
|
1142
1221
|
_: 1
|
|
1143
1222
|
}, 8, ["theme", "is-active"]),
|
|
1144
|
-
|
|
1223
|
+
g(k, {
|
|
1145
1224
|
theme: e.theme,
|
|
1146
1225
|
title: "Italic",
|
|
1147
|
-
"is-active": (
|
|
1226
|
+
"is-active": (u = e.editor) == null ? void 0 : u.isActive("italic"),
|
|
1148
1227
|
onClick: t[3] || (t[3] = (p) => {
|
|
1149
|
-
var
|
|
1150
|
-
return (
|
|
1228
|
+
var f;
|
|
1229
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleItalic().run();
|
|
1151
1230
|
})
|
|
1152
1231
|
}, {
|
|
1153
|
-
default: y(() => [...t[
|
|
1154
|
-
|
|
1232
|
+
default: y(() => [...t[21] || (t[21] = [
|
|
1233
|
+
n("svg", {
|
|
1155
1234
|
class: "w-4 h-4",
|
|
1156
1235
|
viewBox: "0 0 24 24",
|
|
1157
1236
|
fill: "none",
|
|
1158
1237
|
stroke: "currentColor",
|
|
1159
1238
|
"stroke-width": "2"
|
|
1160
1239
|
}, [
|
|
1161
|
-
|
|
1240
|
+
n("path", { d: "M10 4h4M14 4l-4 16M6 20h4" })
|
|
1162
1241
|
], -1)
|
|
1163
1242
|
])]),
|
|
1164
1243
|
_: 1
|
|
1165
1244
|
}, 8, ["theme", "is-active"]),
|
|
1166
|
-
|
|
1245
|
+
g(k, {
|
|
1167
1246
|
theme: e.theme,
|
|
1168
1247
|
title: "Underline",
|
|
1169
1248
|
"is-active": (i = e.editor) == null ? void 0 : i.isActive("underline"),
|
|
1170
1249
|
onClick: t[4] || (t[4] = (p) => {
|
|
1171
|
-
var
|
|
1172
|
-
return (
|
|
1250
|
+
var f;
|
|
1251
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleUnderline().run();
|
|
1173
1252
|
})
|
|
1174
1253
|
}, {
|
|
1175
|
-
default: y(() => [...t[
|
|
1176
|
-
|
|
1254
|
+
default: y(() => [...t[22] || (t[22] = [
|
|
1255
|
+
n("svg", {
|
|
1177
1256
|
class: "w-4 h-4",
|
|
1178
1257
|
viewBox: "0 0 24 24",
|
|
1179
1258
|
fill: "none",
|
|
1180
1259
|
stroke: "currentColor",
|
|
1181
1260
|
"stroke-width": "2"
|
|
1182
1261
|
}, [
|
|
1183
|
-
|
|
1262
|
+
n("path", { d: "M6 4v6a6 6 0 0 0 12 0V4M4 20h16" })
|
|
1184
1263
|
], -1)
|
|
1185
1264
|
])]),
|
|
1186
1265
|
_: 1
|
|
1187
1266
|
}, 8, ["theme", "is-active"]),
|
|
1188
|
-
|
|
1267
|
+
g(k, {
|
|
1189
1268
|
theme: e.theme,
|
|
1190
1269
|
title: "Strikethrough",
|
|
1191
1270
|
"is-active": (m = e.editor) == null ? void 0 : m.isActive("strike"),
|
|
1192
1271
|
onClick: t[5] || (t[5] = (p) => {
|
|
1193
|
-
var
|
|
1194
|
-
return (
|
|
1272
|
+
var f;
|
|
1273
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleStrike().run();
|
|
1195
1274
|
})
|
|
1196
1275
|
}, {
|
|
1197
|
-
default: y(() => [...t[
|
|
1198
|
-
|
|
1276
|
+
default: y(() => [...t[23] || (t[23] = [
|
|
1277
|
+
n("svg", {
|
|
1199
1278
|
class: "w-4 h-4",
|
|
1200
1279
|
viewBox: "0 0 24 24",
|
|
1201
1280
|
fill: "none",
|
|
1202
1281
|
stroke: "currentColor",
|
|
1203
1282
|
"stroke-width": "2"
|
|
1204
1283
|
}, [
|
|
1205
|
-
|
|
1284
|
+
n("path", { d: "M4 12h16M7 5c0 0 1-1 5-1s5 2 5 4-2 3-5 3M7 19c0 0 1 1 5 1s5-2 5-4" })
|
|
1206
1285
|
], -1)
|
|
1207
1286
|
])]),
|
|
1208
1287
|
_: 1
|
|
1209
1288
|
}, 8, ["theme", "is-active"]),
|
|
1210
|
-
|
|
1289
|
+
g(k, {
|
|
1211
1290
|
theme: e.theme,
|
|
1212
1291
|
title: "Subscript",
|
|
1213
1292
|
"is-active": (r = e.editor) == null ? void 0 : r.isActive("subscript"),
|
|
1214
1293
|
onClick: t[6] || (t[6] = (p) => {
|
|
1215
|
-
var
|
|
1216
|
-
return (
|
|
1294
|
+
var f;
|
|
1295
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleSubscript().run();
|
|
1217
1296
|
})
|
|
1218
1297
|
}, {
|
|
1219
|
-
default: y(() => [...t[
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1298
|
+
default: y(() => [...t[24] || (t[24] = [
|
|
1299
|
+
n("span", { class: "text-xs font-semibold" }, [
|
|
1300
|
+
D("X"),
|
|
1301
|
+
n("sub", null, "2")
|
|
1223
1302
|
], -1)
|
|
1224
1303
|
])]),
|
|
1225
1304
|
_: 1
|
|
1226
1305
|
}, 8, ["theme", "is-active"]),
|
|
1227
|
-
|
|
1306
|
+
g(k, {
|
|
1228
1307
|
theme: e.theme,
|
|
1229
1308
|
title: "Superscript",
|
|
1230
|
-
"is-active": (
|
|
1309
|
+
"is-active": (s = e.editor) == null ? void 0 : s.isActive("superscript"),
|
|
1231
1310
|
onClick: t[7] || (t[7] = (p) => {
|
|
1232
|
-
var
|
|
1233
|
-
return (
|
|
1311
|
+
var f;
|
|
1312
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleSuperscript().run();
|
|
1234
1313
|
})
|
|
1235
1314
|
}, {
|
|
1236
|
-
default: y(() => [...t[
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1315
|
+
default: y(() => [...t[25] || (t[25] = [
|
|
1316
|
+
n("span", { class: "text-xs font-semibold" }, [
|
|
1317
|
+
D("X"),
|
|
1318
|
+
n("sup", null, "2")
|
|
1240
1319
|
], -1)
|
|
1241
1320
|
])]),
|
|
1242
1321
|
_: 1
|
|
1243
1322
|
}, 8, ["theme", "is-active"]),
|
|
1244
|
-
|
|
1323
|
+
g(tt, {
|
|
1245
1324
|
editor: e.editor,
|
|
1246
1325
|
theme: e.theme
|
|
1247
1326
|
}, null, 8, ["editor", "theme"]),
|
|
1248
|
-
|
|
1249
|
-
|
|
1327
|
+
g(B),
|
|
1328
|
+
g(nt, {
|
|
1250
1329
|
editor: e.editor,
|
|
1251
1330
|
theme: e.theme
|
|
1252
1331
|
}, null, 8, ["editor", "theme"]),
|
|
1253
|
-
|
|
1332
|
+
g(k, {
|
|
1333
|
+
theme: e.theme,
|
|
1334
|
+
title: "Indent",
|
|
1335
|
+
onClick: t[8] || (t[8] = (p) => {
|
|
1336
|
+
var f;
|
|
1337
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().indent().run();
|
|
1338
|
+
})
|
|
1339
|
+
}, {
|
|
1340
|
+
default: y(() => [...t[26] || (t[26] = [
|
|
1341
|
+
n("svg", {
|
|
1342
|
+
class: "w-4 h-4",
|
|
1343
|
+
viewBox: "0 0 24 24",
|
|
1344
|
+
fill: "none",
|
|
1345
|
+
stroke: "currentColor",
|
|
1346
|
+
"stroke-width": "2"
|
|
1347
|
+
}, [
|
|
1348
|
+
n("path", {
|
|
1349
|
+
d: "M21 6h-8M21 12h-8M21 18h-8M3 6l4 3-4 3V6z",
|
|
1350
|
+
fill: "currentColor"
|
|
1351
|
+
})
|
|
1352
|
+
], -1)
|
|
1353
|
+
])]),
|
|
1354
|
+
_: 1
|
|
1355
|
+
}, 8, ["theme"]),
|
|
1356
|
+
g(k, {
|
|
1357
|
+
theme: e.theme,
|
|
1358
|
+
title: "Outdent",
|
|
1359
|
+
onClick: t[9] || (t[9] = (p) => {
|
|
1360
|
+
var f;
|
|
1361
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().outdent().run();
|
|
1362
|
+
})
|
|
1363
|
+
}, {
|
|
1364
|
+
default: y(() => [...t[27] || (t[27] = [
|
|
1365
|
+
n("svg", {
|
|
1366
|
+
class: "w-4 h-4",
|
|
1367
|
+
viewBox: "0 0 24 24",
|
|
1368
|
+
fill: "none",
|
|
1369
|
+
stroke: "currentColor",
|
|
1370
|
+
"stroke-width": "2"
|
|
1371
|
+
}, [
|
|
1372
|
+
n("path", {
|
|
1373
|
+
d: "M21 6h-8M21 12h-8M21 18h-8M7 6L3 9l4 3V6z",
|
|
1374
|
+
fill: "currentColor"
|
|
1375
|
+
})
|
|
1376
|
+
], -1)
|
|
1377
|
+
])]),
|
|
1378
|
+
_: 1
|
|
1379
|
+
}, 8, ["theme"]),
|
|
1380
|
+
g(ot, {
|
|
1254
1381
|
editor: e.editor,
|
|
1255
1382
|
theme: e.theme
|
|
1256
1383
|
}, null, 8, ["editor", "theme"]),
|
|
1257
|
-
|
|
1258
|
-
|
|
1384
|
+
g(B),
|
|
1385
|
+
g(k, {
|
|
1259
1386
|
theme: e.theme,
|
|
1260
1387
|
title: "Bullet list",
|
|
1261
|
-
"is-active": (
|
|
1262
|
-
onClick: t[
|
|
1263
|
-
var
|
|
1264
|
-
return (
|
|
1388
|
+
"is-active": (d = e.editor) == null ? void 0 : d.isActive("bulletList"),
|
|
1389
|
+
onClick: t[10] || (t[10] = (p) => {
|
|
1390
|
+
var f;
|
|
1391
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleBulletList().run();
|
|
1265
1392
|
})
|
|
1266
1393
|
}, {
|
|
1267
|
-
default: y(() => [...t[
|
|
1268
|
-
|
|
1394
|
+
default: y(() => [...t[28] || (t[28] = [
|
|
1395
|
+
n("svg", {
|
|
1269
1396
|
class: "w-4 h-4",
|
|
1270
1397
|
viewBox: "0 0 24 24",
|
|
1271
1398
|
fill: "none",
|
|
1272
1399
|
stroke: "currentColor",
|
|
1273
1400
|
"stroke-width": "2"
|
|
1274
1401
|
}, [
|
|
1275
|
-
|
|
1402
|
+
n("circle", {
|
|
1276
1403
|
cx: "4",
|
|
1277
1404
|
cy: "6",
|
|
1278
1405
|
r: "1.5",
|
|
1279
1406
|
fill: "currentColor"
|
|
1280
1407
|
}),
|
|
1281
|
-
|
|
1282
|
-
|
|
1408
|
+
n("path", { d: "M9 6h12" }),
|
|
1409
|
+
n("circle", {
|
|
1283
1410
|
cx: "4",
|
|
1284
1411
|
cy: "12",
|
|
1285
1412
|
r: "1.5",
|
|
1286
1413
|
fill: "currentColor"
|
|
1287
1414
|
}),
|
|
1288
|
-
|
|
1289
|
-
|
|
1415
|
+
n("path", { d: "M9 12h12" }),
|
|
1416
|
+
n("circle", {
|
|
1290
1417
|
cx: "4",
|
|
1291
1418
|
cy: "18",
|
|
1292
1419
|
r: "1.5",
|
|
1293
1420
|
fill: "currentColor"
|
|
1294
1421
|
}),
|
|
1295
|
-
|
|
1422
|
+
n("path", { d: "M9 18h12" })
|
|
1296
1423
|
], -1)
|
|
1297
1424
|
])]),
|
|
1298
1425
|
_: 1
|
|
1299
1426
|
}, 8, ["theme", "is-active"]),
|
|
1300
|
-
|
|
1427
|
+
g(k, {
|
|
1301
1428
|
theme: e.theme,
|
|
1302
1429
|
title: "Numbered list",
|
|
1303
|
-
"is-active": (
|
|
1304
|
-
onClick: t[
|
|
1305
|
-
var
|
|
1306
|
-
return (
|
|
1430
|
+
"is-active": (v = e.editor) == null ? void 0 : v.isActive("orderedList"),
|
|
1431
|
+
onClick: t[11] || (t[11] = (p) => {
|
|
1432
|
+
var f;
|
|
1433
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleOrderedList().run();
|
|
1307
1434
|
})
|
|
1308
1435
|
}, {
|
|
1309
|
-
default: y(() => [...t[
|
|
1310
|
-
|
|
1436
|
+
default: y(() => [...t[29] || (t[29] = [
|
|
1437
|
+
n("svg", {
|
|
1311
1438
|
class: "w-4 h-4",
|
|
1312
1439
|
viewBox: "0 0 24 24",
|
|
1313
1440
|
fill: "none",
|
|
1314
1441
|
stroke: "currentColor",
|
|
1315
1442
|
"stroke-width": "2"
|
|
1316
1443
|
}, [
|
|
1317
|
-
|
|
1444
|
+
n("text", {
|
|
1318
1445
|
x: "2",
|
|
1319
1446
|
y: "8",
|
|
1320
1447
|
"font-size": "7",
|
|
1321
1448
|
fill: "currentColor",
|
|
1322
1449
|
stroke: "none"
|
|
1323
1450
|
}, "1"),
|
|
1324
|
-
|
|
1325
|
-
|
|
1451
|
+
n("path", { d: "M9 6h12" }),
|
|
1452
|
+
n("text", {
|
|
1326
1453
|
x: "2",
|
|
1327
1454
|
y: "14",
|
|
1328
1455
|
"font-size": "7",
|
|
1329
1456
|
fill: "currentColor",
|
|
1330
1457
|
stroke: "none"
|
|
1331
1458
|
}, "2"),
|
|
1332
|
-
|
|
1333
|
-
|
|
1459
|
+
n("path", { d: "M9 12h12" }),
|
|
1460
|
+
n("text", {
|
|
1334
1461
|
x: "2",
|
|
1335
1462
|
y: "20",
|
|
1336
1463
|
"font-size": "7",
|
|
1337
1464
|
fill: "currentColor",
|
|
1338
1465
|
stroke: "none"
|
|
1339
1466
|
}, "3"),
|
|
1340
|
-
|
|
1467
|
+
n("path", { d: "M9 18h12" })
|
|
1341
1468
|
], -1)
|
|
1342
1469
|
])]),
|
|
1343
1470
|
_: 1
|
|
1344
1471
|
}, 8, ["theme", "is-active"]),
|
|
1345
|
-
|
|
1472
|
+
g(k, {
|
|
1346
1473
|
theme: e.theme,
|
|
1347
1474
|
title: "Blockquote",
|
|
1348
1475
|
"is-active": (x = e.editor) == null ? void 0 : x.isActive("blockquote"),
|
|
1349
|
-
onClick: t[
|
|
1350
|
-
var
|
|
1351
|
-
return (
|
|
1476
|
+
onClick: t[12] || (t[12] = (p) => {
|
|
1477
|
+
var f;
|
|
1478
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().toggleBlockquote().run();
|
|
1352
1479
|
})
|
|
1353
1480
|
}, {
|
|
1354
|
-
default: y(() => [...t[
|
|
1355
|
-
|
|
1481
|
+
default: y(() => [...t[30] || (t[30] = [
|
|
1482
|
+
n("svg", {
|
|
1356
1483
|
class: "w-4 h-4",
|
|
1357
1484
|
viewBox: "0 0 24 24",
|
|
1358
1485
|
fill: "currentColor"
|
|
1359
1486
|
}, [
|
|
1360
|
-
|
|
1487
|
+
n("path", {
|
|
1361
1488
|
d: "M3 3h8v8H3zM13 3h8v8h-8zM5 11l-2 6h4l2-6zM15 11l-2 6h4l2-6z",
|
|
1362
1489
|
opacity: "0.6"
|
|
1363
1490
|
})
|
|
@@ -1365,232 +1492,232 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
1365
1492
|
])]),
|
|
1366
1493
|
_: 1
|
|
1367
1494
|
}, 8, ["theme", "is-active"]),
|
|
1368
|
-
|
|
1495
|
+
g(k, {
|
|
1369
1496
|
theme: e.theme,
|
|
1370
1497
|
title: "Horizontal rule",
|
|
1371
|
-
onClick: t[
|
|
1372
|
-
var
|
|
1373
|
-
return (
|
|
1498
|
+
onClick: t[13] || (t[13] = (p) => {
|
|
1499
|
+
var f;
|
|
1500
|
+
return (f = e.editor) == null ? void 0 : f.chain().focus().setHorizontalRule().run();
|
|
1374
1501
|
})
|
|
1375
1502
|
}, {
|
|
1376
|
-
default: y(() => [...t[
|
|
1377
|
-
|
|
1503
|
+
default: y(() => [...t[31] || (t[31] = [
|
|
1504
|
+
n("svg", {
|
|
1378
1505
|
class: "w-4 h-4",
|
|
1379
1506
|
viewBox: "0 0 24 24",
|
|
1380
1507
|
fill: "none",
|
|
1381
1508
|
stroke: "currentColor",
|
|
1382
1509
|
"stroke-width": "2"
|
|
1383
1510
|
}, [
|
|
1384
|
-
|
|
1511
|
+
n("path", { d: "M3 12h18" })
|
|
1385
1512
|
], -1)
|
|
1386
1513
|
])]),
|
|
1387
1514
|
_: 1
|
|
1388
1515
|
}, 8, ["theme"]),
|
|
1389
|
-
|
|
1390
|
-
|
|
1516
|
+
g(B),
|
|
1517
|
+
g(rt, {
|
|
1391
1518
|
editor: e.editor,
|
|
1392
1519
|
theme: e.theme
|
|
1393
1520
|
}, null, 8, ["editor", "theme"]),
|
|
1394
|
-
|
|
1521
|
+
g(at, {
|
|
1395
1522
|
editor: e.editor,
|
|
1396
1523
|
theme: e.theme,
|
|
1397
1524
|
"image-config": e.imageConfig,
|
|
1398
|
-
onError: t[
|
|
1525
|
+
onError: t[14] || (t[14] = (p) => l.$emit("error", p))
|
|
1399
1526
|
}, null, 8, ["editor", "theme", "image-config"]),
|
|
1400
|
-
|
|
1527
|
+
g(mt, {
|
|
1401
1528
|
editor: e.editor,
|
|
1402
1529
|
theme: e.theme
|
|
1403
1530
|
}, null, 8, ["editor", "theme"]),
|
|
1404
|
-
|
|
1531
|
+
g(vt, {
|
|
1405
1532
|
editor: e.editor,
|
|
1406
1533
|
theme: e.theme
|
|
1407
1534
|
}, null, 8, ["editor", "theme"]),
|
|
1408
|
-
|
|
1409
|
-
|
|
1535
|
+
g(B),
|
|
1536
|
+
g(k, {
|
|
1410
1537
|
theme: e.theme,
|
|
1411
1538
|
title: "Save as template",
|
|
1412
|
-
onClick: t[
|
|
1539
|
+
onClick: t[15] || (t[15] = (p) => l.$emit("saveTemplate"))
|
|
1413
1540
|
}, {
|
|
1414
|
-
default: y(() => [...t[
|
|
1415
|
-
|
|
1541
|
+
default: y(() => [...t[32] || (t[32] = [
|
|
1542
|
+
n("svg", {
|
|
1416
1543
|
class: "w-4 h-4",
|
|
1417
1544
|
viewBox: "0 0 24 24",
|
|
1418
1545
|
fill: "none",
|
|
1419
1546
|
stroke: "currentColor",
|
|
1420
1547
|
"stroke-width": "2"
|
|
1421
1548
|
}, [
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1549
|
+
n("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }),
|
|
1550
|
+
n("polyline", { points: "17,21 17,13 7,13 7,21" }),
|
|
1551
|
+
n("polyline", { points: "7,3 7,8 15,8" })
|
|
1425
1552
|
], -1)
|
|
1426
1553
|
])]),
|
|
1427
1554
|
_: 1
|
|
1428
1555
|
}, 8, ["theme"]),
|
|
1429
|
-
|
|
1556
|
+
g(k, {
|
|
1430
1557
|
theme: e.theme,
|
|
1431
1558
|
title: "Load template",
|
|
1432
|
-
onClick: t[
|
|
1559
|
+
onClick: t[16] || (t[16] = (p) => l.$emit("loadTemplate"))
|
|
1433
1560
|
}, {
|
|
1434
|
-
default: y(() => [...t[
|
|
1435
|
-
|
|
1561
|
+
default: y(() => [...t[33] || (t[33] = [
|
|
1562
|
+
n("svg", {
|
|
1436
1563
|
class: "w-4 h-4",
|
|
1437
1564
|
viewBox: "0 0 24 24",
|
|
1438
1565
|
fill: "none",
|
|
1439
1566
|
stroke: "currentColor",
|
|
1440
1567
|
"stroke-width": "2"
|
|
1441
1568
|
}, [
|
|
1442
|
-
|
|
1569
|
+
n("path", { d: "M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" })
|
|
1443
1570
|
], -1)
|
|
1444
1571
|
])]),
|
|
1445
1572
|
_: 1
|
|
1446
1573
|
}, 8, ["theme"]),
|
|
1447
|
-
|
|
1448
|
-
|
|
1574
|
+
g(B),
|
|
1575
|
+
n("button", {
|
|
1449
1576
|
class: C(e.theme.saveButton),
|
|
1450
|
-
onClick: t[
|
|
1577
|
+
onClick: t[17] || (t[17] = (p) => l.$emit("save"))
|
|
1451
1578
|
}, " Save ", 2)
|
|
1452
1579
|
], 2);
|
|
1453
1580
|
};
|
|
1454
1581
|
}
|
|
1455
|
-
}),
|
|
1582
|
+
}), ht = {
|
|
1456
1583
|
key: 0,
|
|
1457
1584
|
class: "bg-white border border-gray-200 rounded-lg shadow-lg p-2 flex flex-wrap gap-1 mb-1"
|
|
1458
|
-
},
|
|
1585
|
+
}, bt = { class: "flex gap-1" }, pt = { class: "flex gap-1" }, xt = { class: "flex gap-1" }, yt = { class: "flex gap-1 items-center" }, kt = /* @__PURE__ */ $({
|
|
1459
1586
|
__name: "TablePopoverMenu",
|
|
1460
1587
|
props: {
|
|
1461
1588
|
editor: {}
|
|
1462
1589
|
},
|
|
1463
1590
|
setup(e) {
|
|
1464
|
-
const
|
|
1465
|
-
function t(
|
|
1591
|
+
const l = e;
|
|
1592
|
+
function t(c) {
|
|
1466
1593
|
var o;
|
|
1467
|
-
(o =
|
|
1594
|
+
(o = l.editor) == null || o.chain().focus().setCellAttribute("backgroundColor", c).run();
|
|
1468
1595
|
}
|
|
1469
|
-
return (
|
|
1596
|
+
return (c, o) => {
|
|
1470
1597
|
var a;
|
|
1471
|
-
return (a = e.editor) != null && a.isActive("table") ? (
|
|
1472
|
-
|
|
1473
|
-
|
|
1598
|
+
return (a = e.editor) != null && a.isActive("table") ? (h(), b("div", ht, [
|
|
1599
|
+
n("div", bt, [
|
|
1600
|
+
n("button", {
|
|
1474
1601
|
class: "px-2 py-1 text-xs rounded hover:bg-gray-100",
|
|
1475
|
-
onClick: o[0] || (o[0] = (
|
|
1602
|
+
onClick: o[0] || (o[0] = (u) => {
|
|
1476
1603
|
var i;
|
|
1477
1604
|
return (i = e.editor) == null ? void 0 : i.chain().focus().addRowBefore().run();
|
|
1478
1605
|
})
|
|
1479
1606
|
}, " + Row Above "),
|
|
1480
|
-
|
|
1607
|
+
n("button", {
|
|
1481
1608
|
class: "px-2 py-1 text-xs rounded hover:bg-gray-100",
|
|
1482
|
-
onClick: o[1] || (o[1] = (
|
|
1609
|
+
onClick: o[1] || (o[1] = (u) => {
|
|
1483
1610
|
var i;
|
|
1484
1611
|
return (i = e.editor) == null ? void 0 : i.chain().focus().addRowAfter().run();
|
|
1485
1612
|
})
|
|
1486
1613
|
}, " + Row Below "),
|
|
1487
|
-
|
|
1614
|
+
n("button", {
|
|
1488
1615
|
class: "px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",
|
|
1489
|
-
onClick: o[2] || (o[2] = (
|
|
1616
|
+
onClick: o[2] || (o[2] = (u) => {
|
|
1490
1617
|
var i;
|
|
1491
1618
|
return (i = e.editor) == null ? void 0 : i.chain().focus().deleteRow().run();
|
|
1492
1619
|
})
|
|
1493
1620
|
}, " Delete Row ")
|
|
1494
1621
|
]),
|
|
1495
|
-
o[12] || (o[12] =
|
|
1496
|
-
|
|
1497
|
-
|
|
1622
|
+
o[12] || (o[12] = n("span", { class: "w-px h-6 bg-gray-300" }, null, -1)),
|
|
1623
|
+
n("div", pt, [
|
|
1624
|
+
n("button", {
|
|
1498
1625
|
class: "px-2 py-1 text-xs rounded hover:bg-gray-100",
|
|
1499
|
-
onClick: o[3] || (o[3] = (
|
|
1626
|
+
onClick: o[3] || (o[3] = (u) => {
|
|
1500
1627
|
var i;
|
|
1501
1628
|
return (i = e.editor) == null ? void 0 : i.chain().focus().addColumnBefore().run();
|
|
1502
1629
|
})
|
|
1503
1630
|
}, " + Col Left "),
|
|
1504
|
-
|
|
1631
|
+
n("button", {
|
|
1505
1632
|
class: "px-2 py-1 text-xs rounded hover:bg-gray-100",
|
|
1506
|
-
onClick: o[4] || (o[4] = (
|
|
1633
|
+
onClick: o[4] || (o[4] = (u) => {
|
|
1507
1634
|
var i;
|
|
1508
1635
|
return (i = e.editor) == null ? void 0 : i.chain().focus().addColumnAfter().run();
|
|
1509
1636
|
})
|
|
1510
1637
|
}, " + Col Right "),
|
|
1511
|
-
|
|
1638
|
+
n("button", {
|
|
1512
1639
|
class: "px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",
|
|
1513
|
-
onClick: o[5] || (o[5] = (
|
|
1640
|
+
onClick: o[5] || (o[5] = (u) => {
|
|
1514
1641
|
var i;
|
|
1515
1642
|
return (i = e.editor) == null ? void 0 : i.chain().focus().deleteColumn().run();
|
|
1516
1643
|
})
|
|
1517
1644
|
}, " Delete Col ")
|
|
1518
1645
|
]),
|
|
1519
|
-
o[13] || (o[13] =
|
|
1520
|
-
|
|
1521
|
-
|
|
1646
|
+
o[13] || (o[13] = n("span", { class: "w-px h-6 bg-gray-300" }, null, -1)),
|
|
1647
|
+
n("div", xt, [
|
|
1648
|
+
n("button", {
|
|
1522
1649
|
class: "px-2 py-1 text-xs rounded hover:bg-gray-100",
|
|
1523
|
-
onClick: o[6] || (o[6] = (
|
|
1650
|
+
onClick: o[6] || (o[6] = (u) => {
|
|
1524
1651
|
var i;
|
|
1525
1652
|
return (i = e.editor) == null ? void 0 : i.chain().focus().mergeCells().run();
|
|
1526
1653
|
})
|
|
1527
1654
|
}, " Merge "),
|
|
1528
|
-
|
|
1655
|
+
n("button", {
|
|
1529
1656
|
class: "px-2 py-1 text-xs rounded hover:bg-gray-100",
|
|
1530
|
-
onClick: o[7] || (o[7] = (
|
|
1657
|
+
onClick: o[7] || (o[7] = (u) => {
|
|
1531
1658
|
var i;
|
|
1532
1659
|
return (i = e.editor) == null ? void 0 : i.chain().focus().splitCell().run();
|
|
1533
1660
|
})
|
|
1534
1661
|
}, " Split ")
|
|
1535
1662
|
]),
|
|
1536
|
-
o[14] || (o[14] =
|
|
1537
|
-
|
|
1663
|
+
o[14] || (o[14] = n("span", { class: "w-px h-6 bg-gray-300" }, null, -1)),
|
|
1664
|
+
n("button", {
|
|
1538
1665
|
class: "px-2 py-1 text-xs rounded hover:bg-gray-100",
|
|
1539
|
-
onClick: o[8] || (o[8] = (
|
|
1666
|
+
onClick: o[8] || (o[8] = (u) => {
|
|
1540
1667
|
var i;
|
|
1541
1668
|
return (i = e.editor) == null ? void 0 : i.chain().focus().toggleHeaderRow().run();
|
|
1542
1669
|
})
|
|
1543
1670
|
}, " Toggle Header "),
|
|
1544
|
-
|
|
1671
|
+
n("button", {
|
|
1545
1672
|
class: "px-2 py-1 text-xs rounded hover:bg-red-50 text-red-600",
|
|
1546
|
-
onClick: o[9] || (o[9] = (
|
|
1673
|
+
onClick: o[9] || (o[9] = (u) => {
|
|
1547
1674
|
var i;
|
|
1548
1675
|
return (i = e.editor) == null ? void 0 : i.chain().focus().deleteTable().run();
|
|
1549
1676
|
})
|
|
1550
1677
|
}, " Delete Table "),
|
|
1551
|
-
o[15] || (o[15] =
|
|
1552
|
-
|
|
1553
|
-
o[11] || (o[11] =
|
|
1554
|
-
|
|
1678
|
+
o[15] || (o[15] = n("span", { class: "w-px h-6 bg-gray-300" }, null, -1)),
|
|
1679
|
+
n("div", yt, [
|
|
1680
|
+
o[11] || (o[11] = n("label", { class: "text-xs text-gray-500" }, "Cell BG:", -1)),
|
|
1681
|
+
n("input", {
|
|
1555
1682
|
type: "color",
|
|
1556
1683
|
class: "w-5 h-5 cursor-pointer",
|
|
1557
|
-
onInput: o[10] || (o[10] = (
|
|
1684
|
+
onInput: o[10] || (o[10] = (u) => t(u.target.value))
|
|
1558
1685
|
}, null, 32)
|
|
1559
1686
|
])
|
|
1560
1687
|
])) : T("", !0);
|
|
1561
1688
|
};
|
|
1562
1689
|
}
|
|
1563
|
-
}),
|
|
1690
|
+
}), wt = { class: "mb-3" }, Ct = { class: "mb-4" }, $t = { class: "flex gap-4" }, Mt = { class: "flex items-center gap-2 text-sm" }, Tt = { class: "flex items-center gap-2 text-sm" }, At = { class: "flex justify-end gap-2" }, Lt = ["disabled"], St = /* @__PURE__ */ $({
|
|
1564
1691
|
__name: "SaveTemplateModal",
|
|
1565
1692
|
props: {
|
|
1566
1693
|
theme: {}
|
|
1567
1694
|
},
|
|
1568
1695
|
emits: ["save"],
|
|
1569
|
-
setup(e, { expose:
|
|
1570
|
-
const
|
|
1696
|
+
setup(e, { expose: l, emit: t }) {
|
|
1697
|
+
const c = t, o = w(!1), a = w(""), u = w("document");
|
|
1571
1698
|
function i() {
|
|
1572
|
-
a.value = "",
|
|
1699
|
+
a.value = "", u.value = "document", o.value = !0;
|
|
1573
1700
|
}
|
|
1574
1701
|
function m() {
|
|
1575
1702
|
o.value = !1;
|
|
1576
1703
|
}
|
|
1577
1704
|
function r() {
|
|
1578
|
-
|
|
1705
|
+
c("save", { name: a.value.trim(), type: u.value }), m();
|
|
1579
1706
|
}
|
|
1580
|
-
return
|
|
1581
|
-
o.value ? (
|
|
1707
|
+
return l({ open: i, close: m }), (s, d) => (h(), E(Y, { to: "body" }, [
|
|
1708
|
+
o.value ? (h(), b("div", {
|
|
1582
1709
|
key: 0,
|
|
1583
1710
|
class: "fixed inset-0 bg-black/50 flex items-center justify-center z-50",
|
|
1584
1711
|
onClick: j(m, ["self"])
|
|
1585
1712
|
}, [
|
|
1586
|
-
|
|
1713
|
+
n("div", {
|
|
1587
1714
|
class: C([e.theme.modal, "w-96"])
|
|
1588
1715
|
}, [
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
z(
|
|
1593
|
-
"onUpdate:modelValue":
|
|
1716
|
+
d[7] || (d[7] = n("h2", { class: "text-lg font-semibold mb-4" }, "Save as Template", -1)),
|
|
1717
|
+
n("div", wt, [
|
|
1718
|
+
d[3] || (d[3] = n("label", { class: "block text-sm font-medium text-gray-700 mb-1" }, "Template Name", -1)),
|
|
1719
|
+
z(n("input", {
|
|
1720
|
+
"onUpdate:modelValue": d[0] || (d[0] = (v) => a.value = v),
|
|
1594
1721
|
type: "text",
|
|
1595
1722
|
class: "w-full border border-gray-300 rounded px-3 py-2 text-sm",
|
|
1596
1723
|
placeholder: "My Template"
|
|
@@ -1598,56 +1725,56 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
1598
1725
|
[V, a.value]
|
|
1599
1726
|
])
|
|
1600
1727
|
]),
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
z(
|
|
1606
|
-
"onUpdate:modelValue":
|
|
1728
|
+
n("div", Ct, [
|
|
1729
|
+
d[6] || (d[6] = n("label", { class: "block text-sm font-medium text-gray-700 mb-1" }, "Type", -1)),
|
|
1730
|
+
n("div", $t, [
|
|
1731
|
+
n("label", Mt, [
|
|
1732
|
+
z(n("input", {
|
|
1733
|
+
"onUpdate:modelValue": d[1] || (d[1] = (v) => u.value = v),
|
|
1607
1734
|
type: "radio",
|
|
1608
1735
|
value: "document"
|
|
1609
1736
|
}, null, 512), [
|
|
1610
|
-
[
|
|
1737
|
+
[K, u.value]
|
|
1611
1738
|
]),
|
|
1612
|
-
|
|
1739
|
+
d[4] || (d[4] = D(" Full Document ", -1))
|
|
1613
1740
|
]),
|
|
1614
|
-
|
|
1615
|
-
z(
|
|
1616
|
-
"onUpdate:modelValue":
|
|
1741
|
+
n("label", Tt, [
|
|
1742
|
+
z(n("input", {
|
|
1743
|
+
"onUpdate:modelValue": d[2] || (d[2] = (v) => u.value = v),
|
|
1617
1744
|
type: "radio",
|
|
1618
1745
|
value: "snippet"
|
|
1619
1746
|
}, null, 512), [
|
|
1620
|
-
[
|
|
1747
|
+
[K, u.value]
|
|
1621
1748
|
]),
|
|
1622
|
-
|
|
1749
|
+
d[5] || (d[5] = D(" Snippet ", -1))
|
|
1623
1750
|
])
|
|
1624
1751
|
])
|
|
1625
1752
|
]),
|
|
1626
|
-
|
|
1627
|
-
|
|
1753
|
+
n("div", At, [
|
|
1754
|
+
n("button", {
|
|
1628
1755
|
class: "px-4 py-2 text-sm text-gray-600 hover:text-gray-800",
|
|
1629
1756
|
onClick: m
|
|
1630
1757
|
}, "Cancel"),
|
|
1631
|
-
|
|
1758
|
+
n("button", {
|
|
1632
1759
|
class: C(e.theme.saveButton),
|
|
1633
1760
|
disabled: !a.value.trim(),
|
|
1634
1761
|
onClick: r
|
|
1635
|
-
}, "Save", 10,
|
|
1762
|
+
}, "Save", 10, Lt)
|
|
1636
1763
|
])
|
|
1637
1764
|
], 2)
|
|
1638
1765
|
])) : T("", !0)
|
|
1639
1766
|
]));
|
|
1640
1767
|
}
|
|
1641
|
-
}),
|
|
1768
|
+
}), Bt = {
|
|
1642
1769
|
key: 0,
|
|
1643
1770
|
class: "text-center py-8 text-gray-500"
|
|
1644
|
-
},
|
|
1771
|
+
}, Ht = {
|
|
1645
1772
|
key: 1,
|
|
1646
1773
|
class: "text-center py-8 text-gray-500"
|
|
1647
|
-
},
|
|
1774
|
+
}, zt = {
|
|
1648
1775
|
key: 2,
|
|
1649
1776
|
class: "overflow-y-auto flex-1 -mx-6 px-6"
|
|
1650
|
-
},
|
|
1777
|
+
}, Et = ["onClick"], Rt = { class: "font-medium text-sm" }, It = ["onClick"], Vt = /* @__PURE__ */ $({
|
|
1651
1778
|
__name: "LoadTemplateModal",
|
|
1652
1779
|
props: {
|
|
1653
1780
|
theme: {},
|
|
@@ -1655,59 +1782,59 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
1655
1782
|
loading: { type: Boolean }
|
|
1656
1783
|
},
|
|
1657
1784
|
emits: ["select", "delete", "load"],
|
|
1658
|
-
setup(e, { expose:
|
|
1659
|
-
const
|
|
1785
|
+
setup(e, { expose: l, emit: t }) {
|
|
1786
|
+
const c = t, o = w(!1);
|
|
1660
1787
|
function a() {
|
|
1661
|
-
o.value = !0,
|
|
1788
|
+
o.value = !0, c("load");
|
|
1662
1789
|
}
|
|
1663
|
-
function
|
|
1790
|
+
function u() {
|
|
1664
1791
|
o.value = !1;
|
|
1665
1792
|
}
|
|
1666
1793
|
function i(r) {
|
|
1667
|
-
|
|
1794
|
+
c("select", r), u();
|
|
1668
1795
|
}
|
|
1669
1796
|
function m(r) {
|
|
1670
|
-
confirm(`Delete template "${r.name}"?`) &&
|
|
1797
|
+
confirm(`Delete template "${r.name}"?`) && c("delete", r);
|
|
1671
1798
|
}
|
|
1672
|
-
return
|
|
1673
|
-
o.value ? (
|
|
1799
|
+
return l({ open: a, close: u }), (r, s) => (h(), E(Y, { to: "body" }, [
|
|
1800
|
+
o.value ? (h(), b("div", {
|
|
1674
1801
|
key: 0,
|
|
1675
1802
|
class: "fixed inset-0 bg-black/50 flex items-center justify-center z-50",
|
|
1676
|
-
onClick: j(
|
|
1803
|
+
onClick: j(u, ["self"])
|
|
1677
1804
|
}, [
|
|
1678
|
-
|
|
1805
|
+
n("div", {
|
|
1679
1806
|
class: C([e.theme.modal, "w-[500px] max-h-[80vh] flex flex-col"])
|
|
1680
1807
|
}, [
|
|
1681
|
-
|
|
1682
|
-
e.loading ? (
|
|
1683
|
-
(
|
|
1684
|
-
key:
|
|
1808
|
+
s[0] || (s[0] = n("h2", { class: "text-lg font-semibold mb-4" }, "Load Template", -1)),
|
|
1809
|
+
e.loading ? (h(), b("div", Bt, "Loading templates...")) : e.templates.length === 0 ? (h(), b("div", Ht, "No templates found")) : (h(), b("div", zt, [
|
|
1810
|
+
(h(!0), b(M, null, L(e.templates, (d) => (h(), b("div", {
|
|
1811
|
+
key: d.id,
|
|
1685
1812
|
class: "flex items-center justify-between p-3 border border-gray-200 rounded mb-2 hover:bg-gray-50 cursor-pointer group",
|
|
1686
|
-
onClick: (
|
|
1813
|
+
onClick: (v) => i(d)
|
|
1687
1814
|
}, [
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
class: C(["inline-block text-xs px-2 py-0.5 rounded mt-1",
|
|
1692
|
-
},
|
|
1815
|
+
n("div", null, [
|
|
1816
|
+
n("div", Rt, S(d.name), 1),
|
|
1817
|
+
n("span", {
|
|
1818
|
+
class: C(["inline-block text-xs px-2 py-0.5 rounded mt-1", d.type === "document" ? "bg-blue-100 text-blue-700" : "bg-green-100 text-green-700"])
|
|
1819
|
+
}, S(d.type === "document" ? "Document" : "Snippet"), 3)
|
|
1693
1820
|
]),
|
|
1694
|
-
|
|
1821
|
+
n("button", {
|
|
1695
1822
|
class: "text-red-400 hover:text-red-600 opacity-0 group-hover:opacity-100 text-sm px-2",
|
|
1696
|
-
onClick: j((
|
|
1697
|
-
}, " Delete ", 8,
|
|
1698
|
-
], 8,
|
|
1823
|
+
onClick: j((v) => m(d), ["stop"])
|
|
1824
|
+
}, " Delete ", 8, It)
|
|
1825
|
+
], 8, Et))), 128))
|
|
1699
1826
|
])),
|
|
1700
|
-
|
|
1701
|
-
|
|
1827
|
+
n("div", { class: "flex justify-end pt-4" }, [
|
|
1828
|
+
n("button", {
|
|
1702
1829
|
class: "px-4 py-2 text-sm text-gray-600 hover:text-gray-800",
|
|
1703
|
-
onClick:
|
|
1830
|
+
onClick: u
|
|
1704
1831
|
}, "Cancel")
|
|
1705
1832
|
])
|
|
1706
1833
|
], 2)
|
|
1707
1834
|
])) : T("", !0)
|
|
1708
1835
|
]));
|
|
1709
1836
|
}
|
|
1710
|
-
}),
|
|
1837
|
+
}), Ft = { class: "border border-gray-200 rounded-lg overflow-hidden" }, ln = /* @__PURE__ */ $({
|
|
1711
1838
|
__name: "DocumentEditor",
|
|
1712
1839
|
props: {
|
|
1713
1840
|
modelValue: {},
|
|
@@ -1719,123 +1846,124 @@ const B = /* @__PURE__ */ Ve(Ie, [["render", De]]), Ne = ["title"], U = /* @__PU
|
|
|
1719
1846
|
readonly: { type: Boolean, default: !1 }
|
|
1720
1847
|
},
|
|
1721
1848
|
emits: ["update:modelValue", "save", "saveTemplate", "loadTemplates", "deleteTemplate", "error"],
|
|
1722
|
-
setup(e, { emit:
|
|
1723
|
-
const t = e,
|
|
1724
|
-
...
|
|
1849
|
+
setup(e, { emit: l }) {
|
|
1850
|
+
const t = e, c = l, o = A(() => ({
|
|
1851
|
+
...Re,
|
|
1725
1852
|
...t.theme
|
|
1726
|
-
})), a =
|
|
1853
|
+
})), a = oe({
|
|
1727
1854
|
content: t.modelValue,
|
|
1728
1855
|
editable: !t.readonly,
|
|
1729
1856
|
extensions: [
|
|
1730
|
-
ie,
|
|
1731
1857
|
re,
|
|
1732
1858
|
se,
|
|
1733
|
-
we,
|
|
1734
1859
|
ae,
|
|
1860
|
+
Me,
|
|
1735
1861
|
ue,
|
|
1736
1862
|
de,
|
|
1737
|
-
ce
|
|
1738
|
-
me.configure({ types: ["
|
|
1739
|
-
|
|
1740
|
-
|
|
1863
|
+
ce,
|
|
1864
|
+
me.configure({ types: ["textStyle"] }),
|
|
1865
|
+
fe.configure({ types: ["heading", "paragraph"] }),
|
|
1866
|
+
Te,
|
|
1867
|
+
Ee,
|
|
1868
|
+
ve.configure({
|
|
1741
1869
|
openOnClick: !1,
|
|
1742
1870
|
HTMLAttributes: {
|
|
1743
1871
|
target: "_blank",
|
|
1744
1872
|
rel: "noopener noreferrer"
|
|
1745
1873
|
}
|
|
1746
1874
|
}),
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
he,
|
|
1875
|
+
He,
|
|
1876
|
+
he.configure({ resizable: !0 }),
|
|
1750
1877
|
be,
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1878
|
+
Ce,
|
|
1879
|
+
$e,
|
|
1880
|
+
ze,
|
|
1881
|
+
ge.configure({
|
|
1754
1882
|
placeholder: t.placeholder || "Start typing..."
|
|
1755
1883
|
})
|
|
1756
1884
|
],
|
|
1757
1885
|
onUpdate: () => {
|
|
1758
|
-
var
|
|
1759
|
-
|
|
1886
|
+
var v;
|
|
1887
|
+
c("update:modelValue", ((v = a.value) == null ? void 0 : v.getHTML()) ?? "");
|
|
1760
1888
|
}
|
|
1761
1889
|
});
|
|
1762
|
-
|
|
1890
|
+
ee(Z, a), q(() => t.modelValue, (v) => {
|
|
1763
1891
|
var x, p;
|
|
1764
|
-
((x = a.value) == null ? void 0 : x.getHTML()) !==
|
|
1765
|
-
}),
|
|
1892
|
+
((x = a.value) == null ? void 0 : x.getHTML()) !== v && ((p = a.value) == null || p.commands.setContent(v, { emitUpdate: !1 }));
|
|
1893
|
+
}), q(() => t.readonly, (v) => {
|
|
1766
1894
|
var x;
|
|
1767
|
-
(x = a.value) == null || x.setEditable(!
|
|
1895
|
+
(x = a.value) == null || x.setEditable(!v);
|
|
1768
1896
|
});
|
|
1769
|
-
function
|
|
1770
|
-
|
|
1897
|
+
function u(v) {
|
|
1898
|
+
c("error", v);
|
|
1771
1899
|
}
|
|
1772
|
-
const i =
|
|
1773
|
-
function r(
|
|
1774
|
-
var
|
|
1775
|
-
const x = ((
|
|
1776
|
-
|
|
1900
|
+
const i = w(null), m = w(null);
|
|
1901
|
+
function r(v) {
|
|
1902
|
+
var f, R, P;
|
|
1903
|
+
const x = ((f = a.value) == null ? void 0 : f.getHTML()) ?? "", p = v.type === "snippet" && ((R = a.value) != null && R.state.selection.content()) && ((P = a.value) == null ? void 0 : P.state.selection.content().content.textBetween(0, a.value.state.selection.content().content.size)) || x;
|
|
1904
|
+
c("saveTemplate", { name: v.name, type: v.type, content: p });
|
|
1777
1905
|
}
|
|
1778
|
-
function
|
|
1779
|
-
var x, p,
|
|
1780
|
-
if (
|
|
1906
|
+
function s(v) {
|
|
1907
|
+
var x, p, f, R;
|
|
1908
|
+
if (v.type === "document") {
|
|
1781
1909
|
if (((x = a.value) == null ? void 0 : x.getHTML()) !== "<p></p>" && ((p = a.value) == null ? void 0 : p.getHTML()) !== "" && !confirm("Replace current content with this template?")) return;
|
|
1782
|
-
(
|
|
1910
|
+
(f = a.value) == null || f.commands.setContent(v.content);
|
|
1783
1911
|
} else
|
|
1784
|
-
(R = a.value) == null || R.commands.insertContent(
|
|
1912
|
+
(R = a.value) == null || R.commands.insertContent(v.content);
|
|
1785
1913
|
}
|
|
1786
|
-
function
|
|
1914
|
+
function d() {
|
|
1787
1915
|
var x;
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1916
|
+
const v = ((x = a.value) == null ? void 0 : x.getHTML()) ?? "";
|
|
1917
|
+
c("save", v);
|
|
1790
1918
|
}
|
|
1791
|
-
return (
|
|
1792
|
-
t.readonly ? T("", !0) : (
|
|
1793
|
-
|
|
1919
|
+
return (v, x) => (h(), b("div", Ft, [
|
|
1920
|
+
t.readonly ? T("", !0) : (h(), b(M, { key: 0 }, [
|
|
1921
|
+
g(gt, {
|
|
1794
1922
|
editor: H(a),
|
|
1795
1923
|
theme: o.value,
|
|
1796
1924
|
"image-config": t.image,
|
|
1797
1925
|
onSaveTemplate: x[0] || (x[0] = (p) => {
|
|
1798
|
-
var
|
|
1799
|
-
return (
|
|
1926
|
+
var f;
|
|
1927
|
+
return (f = i.value) == null ? void 0 : f.open();
|
|
1800
1928
|
}),
|
|
1801
1929
|
onLoadTemplate: x[1] || (x[1] = (p) => {
|
|
1802
|
-
var
|
|
1803
|
-
return (
|
|
1930
|
+
var f;
|
|
1931
|
+
return (f = m.value) == null ? void 0 : f.open();
|
|
1804
1932
|
}),
|
|
1805
|
-
onSave:
|
|
1806
|
-
onError:
|
|
1933
|
+
onSave: d,
|
|
1934
|
+
onError: u
|
|
1807
1935
|
}, null, 8, ["editor", "theme", "image-config"]),
|
|
1808
|
-
|
|
1936
|
+
g(kt, { editor: H(a) }, null, 8, ["editor"])
|
|
1809
1937
|
], 64)),
|
|
1810
|
-
|
|
1938
|
+
g(H(ie), {
|
|
1811
1939
|
editor: H(a),
|
|
1812
1940
|
class: C(o.value.editor)
|
|
1813
1941
|
}, null, 8, ["editor", "class"]),
|
|
1814
|
-
|
|
1942
|
+
g(St, {
|
|
1815
1943
|
ref_key: "saveTemplateModal",
|
|
1816
1944
|
ref: i,
|
|
1817
1945
|
theme: o.value,
|
|
1818
1946
|
onSave: r
|
|
1819
1947
|
}, null, 8, ["theme"]),
|
|
1820
|
-
|
|
1948
|
+
g(Vt, {
|
|
1821
1949
|
ref_key: "loadTemplateModal",
|
|
1822
1950
|
ref: m,
|
|
1823
1951
|
theme: o.value,
|
|
1824
1952
|
templates: t.templates ?? [],
|
|
1825
1953
|
loading: t.templatesLoading ?? !1,
|
|
1826
|
-
onLoad: x[2] || (x[2] = (p) =>
|
|
1827
|
-
onSelect:
|
|
1828
|
-
onDelete: x[3] || (x[3] = (p) =>
|
|
1954
|
+
onLoad: x[2] || (x[2] = (p) => c("loadTemplates")),
|
|
1955
|
+
onSelect: s,
|
|
1956
|
+
onDelete: x[3] || (x[3] = (p) => c("deleteTemplate", p))
|
|
1829
1957
|
}, null, 8, ["theme", "templates", "loading"])
|
|
1830
1958
|
]));
|
|
1831
1959
|
}
|
|
1832
1960
|
});
|
|
1833
1961
|
export {
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1962
|
+
Ie as DEFAULT_IMAGE_CONFIG,
|
|
1963
|
+
Re as DEFAULT_THEME,
|
|
1964
|
+
ln as DocumentEditor,
|
|
1965
|
+
Fe as FONT_SIZES,
|
|
1966
|
+
Oe as LINE_HEIGHTS,
|
|
1967
|
+
Ve as WEB_SAFE_FONTS,
|
|
1968
|
+
nn as useDocumentEditor
|
|
1841
1969
|
};
|