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