@mpdev_ab/document-creator 0.1.1 → 0.2.1

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.
@@ -1,22 +1,22 @@
1
- import { defineComponent as C, ref as y, computed as H, openBlock as g, createBlock as V, unref as L, normalizeClass as w, withCtx as x, createElementVNode as l, normalizeStyle as D, createElementBlock as p, Fragment as A, renderList as E, toDisplayString as z, withDirectives as F, withKeys as P, vModelText as I, createCommentVNode as B, inject as _, renderSlot as X, onMounted as U, onBeforeUnmount as N, createVNode as h, nextTick as ee, createTextVNode as j, Teleport as Y, withModifiers as K, vModelRadio as J, provide as te, watch as q } from "vue";
2
- import { nodeViewProps as le, NodeViewWrapper as ne, VueNodeViewRenderer as oe, useEditor as ie, EditorContent as re } from "@tiptap/vue-3";
3
- import se from "@tiptap/starter-kit";
4
- import { TextStyle as ae } from "@tiptap/extension-text-style";
5
- import ue from "@tiptap/extension-font-family";
6
- import de from "@tiptap/extension-underline";
7
- import ce from "@tiptap/extension-subscript";
8
- import me from "@tiptap/extension-superscript";
9
- import fe from "@tiptap/extension-color";
10
- import ve from "@tiptap/extension-text-align";
11
- import ge from "@tiptap/extension-link";
12
- import he from "@tiptap/extension-placeholder";
13
- import { Table as pe } from "@tiptap/extension-table";
14
- import be from "@tiptap/extension-table-row";
15
- import xe from "@tiptap/extension-table-cell";
16
- import ye from "@tiptap/extension-table-header";
17
- import { Extension as Z, Node as ke, mergeAttributes as we } from "@tiptap/core";
18
- import Ce from "@tiptap/extension-image";
19
- const $e = Z.create({
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
- }), Te = Z.create({
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
- }), Me = ["src", "alt"], Ae = {
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
- }, Se = ["onClick"], Le = /* @__PURE__ */ C({
83
+ }, Te = ["onClick"], Ae = /* @__PURE__ */ $({
84
84
  __name: "ImageResizePopover",
85
- props: le,
85
+ props: ee,
86
86
  setup(e) {
87
- const n = e, t = y(n.node.attrs.width || ""), c = y(n.node.attrs.alt || ""), o = H(() => {
88
- const d = {};
89
- return n.node.attrs.width && (d.width = n.node.attrs.width), n.node.attrs.height && (d.height = n.node.attrs.height), d;
90
- }), a = H(() => {
91
- const d = n.node.attrs.align;
92
- return d === "center" ? "mx-auto block" : d === "right" ? "ml-auto block" : "block";
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 m() {
95
- const d = n.getPos();
96
- d != null && n.editor.commands.setNodeSelection(d);
94
+ function c() {
95
+ const u = n.getPos();
96
+ u != null && n.editor.commands.setNodeSelection(u);
97
97
  }
98
- function i(d) {
99
- n.updateAttributes({ width: d }), t.value = d;
98
+ function i(u) {
99
+ n.updateAttributes({ width: u }), t.value = u;
100
100
  }
101
- function s(d) {
102
- n.updateAttributes({ align: d });
101
+ function m(u) {
102
+ n.updateAttributes({ align: u });
103
103
  }
104
104
  function r() {
105
- n.updateAttributes({ alt: c.value });
105
+ n.updateAttributes({ alt: d.value });
106
106
  }
107
- return (d, u) => (g(), V(L(ne), {
108
- class: w(["relative inline-block", a.value])
107
+ return (u, s) => (g(), E(H(te), {
108
+ class: C(["relative inline-block", a.value])
109
109
  }, {
110
- default: x(() => [
110
+ default: y(() => [
111
111
  l("img", {
112
- src: d.node.attrs.src,
113
- alt: d.node.attrs.alt || "",
114
- style: D(o.value),
115
- class: w(["cursor-pointer max-w-full", d.selected ? "ring-2 ring-blue-400" : ""]),
116
- onClick: m
117
- }, null, 14, Me),
118
- d.selected ? (g(), p("div", Ae, [
119
- (g(), p(A, null, E(["25%", "50%", "75%", "100%"], (b) => l("button", {
120
- key: b,
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: (S) => i(b)
123
- }, z(b), 9, Se)), 64)),
124
- F(l("input", {
125
- "onUpdate:modelValue": u[0] || (u[0] = (b) => t.value = b),
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: u[1] || (u[1] = P((b) => i(t.value), ["enter"]))
128
+ onKeydown: s[1] || (s[1] = D((f) => i(t.value), ["enter"]))
129
129
  }, null, 544), [
130
- [I, t.value]
130
+ [V, t.value]
131
131
  ]),
132
- u[9] || (u[9] = l("span", { class: "w-px h-4 bg-gray-300 mx-1" }, null, -1)),
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: u[2] || (u[2] = (b) => s("left"))
137
- }, [...u[6] || (u[6] = [
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: u[3] || (u[3] = (b) => s("center"))
152
- }, [...u[7] || (u[7] = [
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: u[4] || (u[4] = (b) => s("right"))
167
- }, [...u[8] || (u[8] = [
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
- u[10] || (u[10] = l("span", { class: "w-px h-4 bg-gray-300 mx-1" }, null, -1)),
179
- F(l("input", {
180
- "onUpdate:modelValue": u[5] || (u[5] = (b) => c.value = b),
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: P(r, ["enter"])
184
+ onKeydown: D(r, ["enter"])
185
185
  }, null, 544), [
186
- [I, c.value]
186
+ [V, d.value]
187
187
  ])
188
- ])) : B("", !0)
188
+ ])) : T("", !0)
189
189
  ]),
190
190
  _: 1
191
191
  }, 8, ["class"]));
192
192
  }
193
- }), Be = Ce.extend({
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 oe(Le);
228
+ return le(Ae);
229
229
  }
230
230
  }).configure({
231
231
  allowBase64: !0,
232
232
  inline: !1
233
- }), He = ke.create({
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", we(e)]];
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
- }), Ee = {
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
- }, ze = {
268
+ }, He = {
269
269
  maxSize: 5 * 1024 * 1024,
270
270
  allowedTypes: ["image/jpeg", "image/png", "image/gif"]
271
- }, Re = [
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
- ], Fe = ["8", "10", "12", "14", "16", "18", "20", "24", "28", "32", "36", "48", "72"], Ve = ["1", "1.15", "1.5", "2", "2.5", "3"];
281
- function Oe(e) {
282
- const n = y([]), t = y(!1), c = y(null), o = {
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 De = ["title", "disabled"], k = /* @__PURE__ */ C({
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(), p("button", {
319
+ return (n, t) => (g(), b("button", {
357
320
  type: "button",
358
- class: w([e.theme.toolbarButton, e.isActive && e.theme.toolbarButtonActive]),
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] = (c) => n.$emit("click"))
324
+ onClick: t[0] || (t[0] = (d) => n.$emit("click"))
362
325
  }, [
363
- X(n.$slots, "default")
364
- ], 10, De));
326
+ W(n.$slots, "default")
327
+ ], 10, Fe));
365
328
  }
366
- }), Ie = (e, n) => {
329
+ }), Ve = (e, n) => {
367
330
  const t = e.__vccOpts || e;
368
- for (const [c, o] of n)
369
- t[c] = o;
331
+ for (const [d, o] of n)
332
+ t[d] = o;
370
333
  return t;
371
- }, Ue = {}, Ne = { class: "w-px h-6 bg-gray-300 mx-1" };
372
- function Pe(e, n) {
373
- return g(), p("div", Ne);
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 R = /* @__PURE__ */ Ie(Ue, [["render", Pe]]), je = ["title"], G = /* @__PURE__ */ C({
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 = y(!1), t = y(null);
384
- function c() {
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 U(() => document.addEventListener("click", o)), N(() => document.removeEventListener("click", o)), (a, m) => (g(), p("div", {
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: w([e.theme.toolbarButton, "flex items-center gap-1 px-2 text-sm"]),
360
+ class: C([e.theme.toolbarButton, "flex items-center gap-1 px-2 text-sm"]),
398
361
  title: e.title,
399
- onClick: m[0] || (m[0] = (i) => n.value = !n.value)
362
+ onClick: c[0] || (c[0] = (i) => n.value = !n.value)
400
363
  }, [
401
- l("span", null, z(e.label), 1),
402
- m[1] || (m[1] = l("svg", {
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, je),
415
- n.value ? (g(), p("div", {
377
+ ], 10, Ne),
378
+ n.value ? (g(), b("div", {
416
379
  key: 0,
417
- class: w([e.theme.dropdown, "absolute top-full left-0 mt-1 min-w-[150px] max-h-60 overflow-y-auto"])
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
- X(a.$slots, "default", { close: c })
420
- ], 2)) : B("", !0)
382
+ W(a.$slots, "default", { close: d })
383
+ ], 2)) : T("", !0)
421
384
  ], 512));
422
385
  }
423
- }), Ge = ["onClick"], Ke = /* @__PURE__ */ C({
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(m) {
440
- var i, s;
441
- return m.value === "paragraph" ? (i = n.editor) == null ? void 0 : i.isActive("paragraph") : (s = n.editor) == null ? void 0 : s.isActive("heading", { level: m.value });
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 = H(() => {
444
- const m = t.find((i) => c(i));
445
- return (m == null ? void 0 : m.label) ?? "Paragraph";
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(m) {
448
- var i, s;
449
- m.value === "paragraph" ? (i = n.editor) == null || i.chain().focus().setParagraph().run() : (s = n.editor) == null || s.chain().focus().toggleHeading({ level: m.value }).run();
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 (m, i) => (g(), V(G, {
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: x(({ close: s }) => [
457
- (g(), p(A, null, E(t, (r) => l("button", {
419
+ default: y(({ close: m }) => [
420
+ (g(), b(M, null, S(t, (r) => l("button", {
458
421
  key: r.value,
459
- class: w([
422
+ class: C([
460
423
  "block w-full text-left px-3 py-1.5 hover:bg-gray-100",
461
424
  r.class,
462
- c(r) ? "bg-gray-50 font-semibold" : ""
425
+ d(r) ? "bg-gray-50 font-semibold" : ""
463
426
  ]),
464
- onClick: (d) => {
465
- a(r), s();
427
+ onClick: (u) => {
428
+ a(r), m();
466
429
  }
467
- }, z(r.label), 11, Ge)), 64))
430
+ }, L(r.label), 11, Ue)), 64))
468
431
  ]),
469
432
  _: 1
470
433
  }, 8, ["theme", "label"]));
471
434
  }
472
- }), Je = ["onClick"], qe = /* @__PURE__ */ C({
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 = Re, c = H(() => {
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(), V(G, {
448
+ return (o, a) => (g(), E(U, {
486
449
  theme: e.theme,
487
- label: c.value,
450
+ label: d.value,
488
451
  title: "Font family"
489
452
  }, {
490
- default: x(({ close: m }) => [
491
- (g(!0), p(A, null, E(L(t), (i) => (g(), p("button", {
453
+ default: y(({ close: c }) => [
454
+ (g(!0), b(M, null, S(H(t), (i) => (g(), b("button", {
492
455
  key: i,
493
- style: D({ fontFamily: i }),
494
- class: w([
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
- c.value === i ? "bg-gray-50 font-semibold" : ""
459
+ d.value === i ? "bg-gray-50 font-semibold" : ""
497
460
  ]),
498
- onClick: (s) => {
461
+ onClick: (m) => {
499
462
  var r;
500
- (r = e.editor) == null || r.chain().focus().setFontFamily(i).run(), m();
463
+ (r = e.editor) == null || r.chain().focus().setFontFamily(i).run(), c();
501
464
  }
502
- }, z(i), 15, Je))), 128))
465
+ }, L(i), 15, je))), 128))
503
466
  ]),
504
467
  _: 1
505
468
  }, 8, ["theme", "label"]));
506
469
  }
507
- }), We = ["onClick"], Xe = /* @__PURE__ */ C({
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 = Fe, c = H(() => {
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(), V(G, {
483
+ return (o, a) => (g(), E(U, {
521
484
  theme: e.theme,
522
- label: c.value || "Size",
485
+ label: d.value || "Size",
523
486
  title: "Font size"
524
487
  }, {
525
- default: x(({ close: m }) => [
526
- (g(!0), p(A, null, E(L(t), (i) => (g(), p("button", {
488
+ default: y(({ close: c }) => [
489
+ (g(!0), b(M, null, S(H(t), (i) => (g(), b("button", {
527
490
  key: i,
528
- class: w([
491
+ class: C([
529
492
  "block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",
530
- c.value === i ? "bg-gray-50 font-semibold" : ""
493
+ d.value === i ? "bg-gray-50 font-semibold" : ""
531
494
  ]),
532
- onClick: (s) => {
495
+ onClick: (m) => {
533
496
  var r;
534
- (r = e.editor) == null || r.chain().focus().setFontSize(i + "px").run(), m();
497
+ (r = e.editor) == null || r.chain().focus().setFontSize(i + "px").run(), c();
535
498
  }
536
- }, z(i), 11, We))), 128))
499
+ }, L(i), 11, Ke))), 128))
537
500
  ]),
538
501
  _: 1
539
502
  }, 8, ["theme", "label"]));
540
503
  }
541
- }), Ye = { class: "grid grid-cols-8 gap-1 mb-2" }, Ze = ["title", "onClick"], Qe = { class: "flex items-center gap-2 pt-2 border-t border-gray-100" }, _e = ["value"], et = /* @__PURE__ */ C({
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 = y(!1), c = y(null), o = [
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 = H(() => {
588
- var s;
589
- return ((s = n.editor) == null ? void 0 : s.getAttributes("textStyle").color) || "#000000";
550
+ ], a = A(() => {
551
+ var m;
552
+ return ((m = n.editor) == null ? void 0 : m.getAttributes("textStyle").color) || "#000000";
590
553
  });
591
- function m(s) {
554
+ function c(m) {
592
555
  var r;
593
- (r = n.editor) == null || r.chain().focus().setColor(s).run(), t.value = !1;
556
+ (r = n.editor) == null || r.chain().focus().setColor(m).run(), t.value = !1;
594
557
  }
595
- function i(s) {
596
- c.value && !c.value.contains(s.target) && (t.value = !1);
558
+ function i(m) {
559
+ d.value && !d.value.contains(m.target) && (t.value = !1);
597
560
  }
598
- return U(() => document.addEventListener("click", i)), N(() => document.removeEventListener("click", i)), (s, r) => (g(), p("div", {
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: c
564
+ ref: d
602
565
  }, [
603
566
  l("button", {
604
567
  type: "button",
605
- class: w([e.theme.toolbarButton, "flex items-center gap-1 px-2"]),
568
+ class: C([e.theme.toolbarButton, "flex items-center gap-1 px-2"]),
606
569
  title: "Font color",
607
- onClick: r[0] || (r[0] = (d) => t.value = !t.value)
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: D({ backgroundColor: a.value })
575
+ style: F({ backgroundColor: a.value })
613
576
  }, null, 4)
614
577
  ], 2),
615
- t.value ? (g(), p("div", {
578
+ t.value ? (g(), b("div", {
616
579
  key: 0,
617
- class: w([e.theme.dropdown, "absolute top-full left-0 mt-1 p-2 w-48"])
580
+ class: C([e.theme.dropdown, "absolute top-full left-0 mt-1 p-2 w-48"])
618
581
  }, [
619
- l("div", Ye, [
620
- (g(), p(A, null, E(o, (d) => l("button", {
621
- key: d,
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: D({ backgroundColor: d }),
624
- title: d,
625
- onClick: (u) => m(d)
626
- }, null, 12, Ze)), 64))
586
+ style: F({ backgroundColor: u }),
587
+ title: u,
588
+ onClick: (s) => c(u)
589
+ }, null, 12, Je)), 64))
627
590
  ]),
628
- l("div", Qe, [
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] = (d) => m(d.target.value))
635
- }, null, 40, _e)
597
+ onInput: r[1] || (r[1] = (u) => c(u.target.value))
598
+ }, null, 40, Ye)
636
599
  ])
637
- ], 2)) : B("", !0)
600
+ ], 2)) : T("", !0)
638
601
  ], 512));
639
602
  }
640
- }), tt = /* @__PURE__ */ C({
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 c, o, a, m;
649
- return g(), p(A, null, [
650
- h(k, {
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": (c = e.editor) == null ? void 0 : c.isActive({ textAlign: "left" }),
616
+ "is-active": (d = e.editor) == null ? void 0 : d.isActive({ textAlign: "left" }),
654
617
  onClick: t[0] || (t[0] = (i) => {
655
- var s;
656
- return (s = e.editor) == null ? void 0 : s.chain().focus().setTextAlign("left").run();
618
+ var m;
619
+ return (m = e.editor) == null ? void 0 : m.chain().focus().setTextAlign("left").run();
657
620
  })
658
621
  }, {
659
- default: x(() => [...t[4] || (t[4] = [
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(k, {
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 s;
678
- return (s = e.editor) == null ? void 0 : s.chain().focus().setTextAlign("center").run();
640
+ var m;
641
+ return (m = e.editor) == null ? void 0 : m.chain().focus().setTextAlign("center").run();
679
642
  })
680
643
  }, {
681
- default: x(() => [...t[5] || (t[5] = [
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(k, {
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 s;
700
- return (s = e.editor) == null ? void 0 : s.chain().focus().setTextAlign("right").run();
662
+ var m;
663
+ return (m = e.editor) == null ? void 0 : m.chain().focus().setTextAlign("right").run();
701
664
  })
702
665
  }, {
703
- default: x(() => [...t[6] || (t[6] = [
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(k, {
679
+ h(w, {
717
680
  theme: e.theme,
718
681
  title: "Justify",
719
- "is-active": (m = e.editor) == null ? void 0 : m.isActive({ textAlign: "justify" }),
682
+ "is-active": (c = e.editor) == null ? void 0 : c.isActive({ textAlign: "justify" }),
720
683
  onClick: t[3] || (t[3] = (i) => {
721
- var s;
722
- return (s = e.editor) == null ? void 0 : s.chain().focus().setTextAlign("justify").run();
684
+ var m;
685
+ return (m = e.editor) == null ? void 0 : m.chain().focus().setTextAlign("justify").run();
723
686
  })
724
687
  }, {
725
- default: x(() => [...t[7] || (t[7] = [
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
- }), lt = ["onClick"], nt = /* @__PURE__ */ C({
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 = Ve, c = H(() => {
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(), V(G, {
715
+ return (o, a) => (g(), E(U, {
753
716
  theme: e.theme,
754
- label: c.value || "Height",
717
+ label: d.value || "Height",
755
718
  title: "Line height"
756
719
  }, {
757
- default: x(({ close: m }) => [
758
- (g(!0), p(A, null, E(L(t), (i) => (g(), p("button", {
720
+ default: y(({ close: c }) => [
721
+ (g(!0), b(M, null, S(H(t), (i) => (g(), b("button", {
759
722
  key: i,
760
- class: w([
723
+ class: C([
761
724
  "block w-full text-left px-3 py-1.5 hover:bg-gray-100 text-sm",
762
- c.value === i ? "bg-gray-50 font-semibold" : ""
725
+ d.value === i ? "bg-gray-50 font-semibold" : ""
763
726
  ]),
764
- onClick: (s) => {
727
+ onClick: (m) => {
765
728
  var r;
766
- (r = e.editor) == null || r.chain().focus().setLineHeight(i).run(), m();
729
+ (r = e.editor) == null || r.chain().focus().setLineHeight(i).run(), c();
767
730
  }
768
- }, z(i), 11, lt))), 128))
731
+ }, L(i), 11, _e))), 128))
769
732
  ]),
770
733
  _: 1
771
734
  }, 8, ["theme", "label"]));
772
735
  }
773
- }), ot = { class: "flex gap-2" }, it = /* @__PURE__ */ C({
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 = y(!1), c = y(""), o = y(null), a = y(null);
781
- function m() {
782
- var d;
783
- c.value = ((d = n.editor) == null ? void 0 : d.getAttributes("link").href) || "", t.value = !t.value, t.value && ee(() => {
784
- var u;
785
- return (u = a.value) == null ? void 0 : u.focus();
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 d;
790
- c.value && ((d = n.editor) == null || d.chain().focus().extendMarkRange("link").setLink({ href: c.value }).run()), t.value = !1;
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 s() {
793
- var d;
794
- (d = n.editor) == null || d.chain().focus().unsetLink().run(), t.value = !1;
755
+ function m() {
756
+ var u;
757
+ (u = n.editor) == null || u.chain().focus().unsetLink().run(), t.value = !1;
795
758
  }
796
- function r(d) {
797
- o.value && !o.value.contains(d.target) && (t.value = !1);
759
+ function r(u) {
760
+ o.value && !o.value.contains(u.target) && (t.value = !1);
798
761
  }
799
- return U(() => document.addEventListener("click", r)), N(() => document.removeEventListener("click", r)), (d, u) => {
800
- var b, S;
801
- return g(), p("div", {
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(k, {
769
+ h(w, {
807
770
  theme: e.theme,
808
771
  title: "Link",
809
- "is-active": (b = e.editor) == null ? void 0 : b.isActive("link"),
810
- onClick: m
772
+ "is-active": (f = e.editor) == null ? void 0 : f.isActive("link"),
773
+ onClick: c
811
774
  }, {
812
- default: x(() => [...u[2] || (u[2] = [
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(), p("div", {
789
+ t.value ? (g(), b("div", {
827
790
  key: 0,
828
- class: w([e.theme.dropdown, "absolute top-full left-0 mt-1 p-3 w-72"])
791
+ class: C([e.theme.dropdown, "absolute top-full left-0 mt-1 p-3 w-72"])
829
792
  }, [
830
- u[3] || (u[3] = l("label", { class: "block text-xs text-gray-500 mb-1" }, "URL", -1)),
831
- F(l("input", {
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": u[0] || (u[0] = (v) => c.value = v),
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: P(i, ["enter"])
801
+ onKeydown: D(i, ["enter"])
839
802
  }, null, 544), [
840
- [I, c.value]
803
+ [V, d.value]
841
804
  ]),
842
- l("div", ot, [
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
- (S = e.editor) != null && S.isActive("link") ? (g(), p("button", {
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: s
851
- }, " Remove ")) : B("", !0),
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: u[1] || (u[1] = (v) => t.value = !1)
817
+ onClick: s[1] || (s[1] = (p) => t.value = !1)
855
818
  }, " Cancel ")
856
819
  ])
857
- ], 2)) : B("", !0)
820
+ ], 2)) : T("", !0)
858
821
  ], 512);
859
822
  };
860
823
  }
861
- }), rt = ["accept"], st = /* @__PURE__ */ C({
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, c = n, o = y(null), a = H(() => ({
871
- ...ze,
833
+ const t = e, d = n, o = k(null), a = A(() => ({
834
+ ...He,
872
835
  ...t.imageConfig
873
- })), m = H(() => a.value.allowedTypes.join(","));
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 s(r) {
879
- var S;
880
- const d = r.target, u = (S = d.files) == null ? void 0 : S[0];
881
- if (!u) return;
882
- if (!a.value.allowedTypes.includes(u.type)) {
883
- c("error", { message: `File type ${u.type} is not allowed`, detail: { allowedTypes: a.value.allowedTypes } }), d.value = "";
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 (u.size > a.value.maxSize) {
887
- const v = (a.value.maxSize / 1048576).toFixed(1);
888
- c("error", { message: `File size exceeds ${v}MB limit`, detail: { maxSize: a.value.maxSize, fileSize: u.size } }), d.value = "";
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 b = new FileReader();
892
- b.onload = () => {
893
- var f;
894
- const v = b.result;
895
- (f = t.editor) == null || f.chain().focus().setImage({ src: v }).run();
896
- }, b.readAsDataURL(u), d.value = "";
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, d) => (g(), p(A, null, [
899
- h(k, {
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: x(() => [...d[0] || (d[0] = [
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: m.value,
896
+ accept: c.value,
934
897
  class: "hidden",
935
- onChange: s
936
- }, null, 40, rt)
898
+ onChange: m
899
+ }, null, 40, nt)
937
900
  ], 64));
938
901
  }
939
- }), at = { class: "mb-1 text-xs text-gray-500 text-center" }, ut = ["onMouseenter"], dt = 8, W = 10, ct = /* @__PURE__ */ C({
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 = y(!1), c = y(0), o = y(0), a = y(null);
947
- function m(s, r) {
948
- var d;
949
- (d = n.editor) == null || d.chain().focus().insertTable({ rows: s, cols: r, withHeaderRow: !0 }).run(), t.value = !1, c.value = 0, o.value = 0;
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(s) {
952
- a.value && !a.value.contains(s.target) && (t.value = !1);
914
+ function i(m) {
915
+ a.value && !a.value.contains(m.target) && (t.value = !1);
953
916
  }
954
- return U(() => document.addEventListener("click", i)), N(() => document.removeEventListener("click", i)), (s, r) => (g(), p("div", {
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(k, {
922
+ h(w, {
960
923
  theme: e.theme,
961
924
  title: "Insert table",
962
- onClick: r[0] || (r[0] = (d) => t.value = !t.value)
925
+ onClick: r[0] || (r[0] = (u) => t.value = !t.value)
963
926
  }, {
964
- default: x(() => [...r[2] || (r[2] = [
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(), p("div", {
947
+ t.value ? (g(), b("div", {
985
948
  key: 0,
986
- class: w([e.theme.dropdown, "absolute top-full left-0 mt-1 p-2"])
949
+ class: C([e.theme.dropdown, "absolute top-full left-0 mt-1 p-2"])
987
950
  }, [
988
- l("div", at, z(o.value > 0 ? `${o.value} × ${c.value}` : "Select size"), 1),
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: D({ gridTemplateColumns: `repeat(${W}, 1fr)` })
954
+ style: F({ gridTemplateColumns: `repeat(${q}, 1fr)` })
992
955
  }, [
993
- (g(), p(A, null, E(dt, (d) => (g(), p(A, {
994
- key: "row-" + d
956
+ (g(), b(M, null, S(st, (u) => (g(), b(M, {
957
+ key: "row-" + u
995
958
  }, [
996
- (g(), p(A, null, E(W, (u) => l("div", {
997
- key: "cell-" + d + "-" + u,
998
- class: w(["w-5 h-5 border cursor-pointer", d <= c.value && u <= o.value ? "bg-blue-200 border-blue-300" : "bg-white border-gray-300"]),
999
- onMouseenter: (b) => {
1000
- c.value = d, o.value = u;
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] = (b) => m(c.value, o.value))
1003
- }, null, 42, ut)), 64))
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)) : B("", !0)
969
+ ], 2)) : T("", !0)
1007
970
  ], 512));
1008
971
  }
1009
- }), mt = { class: "flex gap-2" }, ft = /* @__PURE__ */ C({
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 = y(!1), c = y(""), o = y(null);
1017
- function a(s) {
1018
- const r = s.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/);
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 d = s.match(/vimeo\.com\/(\d+)/);
1021
- return d ? `https://player.vimeo.com/video/${d[1]}` : s;
983
+ const u = m.match(/vimeo\.com\/(\d+)/);
984
+ return u ? `https://player.vimeo.com/video/${u[1]}` : m;
1022
985
  }
1023
- function m() {
1024
- var s;
1025
- if (c.value) {
1026
- const r = a(c.value);
1027
- (s = n.editor) == null || s.chain().focus().setVideo({ src: r }).run();
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, c.value = "";
992
+ t.value = !1, d.value = "";
1030
993
  }
1031
- function i(s) {
1032
- o.value && !o.value.contains(s.target) && (t.value = !1);
994
+ function i(m) {
995
+ o.value && !o.value.contains(m.target) && (t.value = !1);
1033
996
  }
1034
- return U(() => document.addEventListener("click", i)), N(() => document.removeEventListener("click", i)), (s, r) => (g(), p("div", {
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(k, {
1002
+ h(w, {
1040
1003
  theme: e.theme,
1041
1004
  title: "Embed video",
1042
- onClick: r[0] || (r[0] = (d) => t.value = !t.value)
1005
+ onClick: r[0] || (r[0] = (u) => t.value = !t.value)
1043
1006
  }, {
1044
- default: x(() => [...r[3] || (r[3] = [
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(), p("div", {
1020
+ t.value ? (g(), b("div", {
1058
1021
  key: 0,
1059
- class: w([e.theme.dropdown, "absolute top-full left-0 mt-1 p-3 w-80"])
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
- F(l("input", {
1063
- "onUpdate:modelValue": r[1] || (r[1] = (d) => c.value = d),
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: P(m, ["enter"])
1030
+ onKeydown: D(c, ["enter"])
1068
1031
  }, null, 544), [
1069
- [I, c.value]
1032
+ [V, d.value]
1070
1033
  ]),
1071
- l("div", mt, [
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: m
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] = (d) => t.value = !1)
1041
+ onClick: r[2] || (r[2] = (u) => t.value = !1)
1079
1042
  }, " Cancel ")
1080
1043
  ])
1081
- ], 2)) : B("", !0)
1044
+ ], 2)) : T("", !0)
1082
1045
  ], 512));
1083
1046
  }
1084
- }), vt = /* @__PURE__ */ C({
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 c, o, a, m, i, s, r, d, u, b, S;
1095
- return g(), p("div", {
1096
- class: w(e.theme.toolbar)
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(k, {
1061
+ h(w, {
1099
1062
  theme: e.theme,
1100
1063
  title: "Undo",
1101
- onClick: t[0] || (t[0] = (v) => {
1102
- var f;
1103
- return (f = e.editor) == null ? void 0 : f.chain().focus().undo().run();
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: !((c = e.editor) != null && c.can().undo())
1068
+ disabled: !((d = e.editor) != null && d.can().undo())
1106
1069
  }, {
1107
- default: x(() => [...t[16] || (t[16] = [
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(k, {
1084
+ h(w, {
1122
1085
  theme: e.theme,
1123
1086
  title: "Redo",
1124
- onClick: t[1] || (t[1] = (v) => {
1125
- var f;
1126
- return (f = e.editor) == null ? void 0 : f.chain().focus().redo().run();
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: x(() => [...t[17] || (t[17] = [
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(R),
1145
- h(Ke, {
1107
+ h(B),
1108
+ h(Pe, {
1146
1109
  editor: e.editor,
1147
1110
  theme: e.theme
1148
1111
  }, null, 8, ["editor", "theme"]),
1149
- h(R),
1150
- h(qe, {
1112
+ h(B),
1113
+ h(Ge, {
1151
1114
  editor: e.editor,
1152
1115
  theme: e.theme
1153
1116
  }, null, 8, ["editor", "theme"]),
1154
- h(Xe, {
1117
+ h(qe, {
1155
1118
  editor: e.editor,
1156
1119
  theme: e.theme
1157
1120
  }, null, 8, ["editor", "theme"]),
1158
- h(R),
1159
- h(k, {
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] = (v) => {
1164
- var f;
1165
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleBold().run();
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: x(() => [...t[18] || (t[18] = [
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(k, {
1144
+ h(w, {
1182
1145
  theme: e.theme,
1183
1146
  title: "Italic",
1184
- "is-active": (m = e.editor) == null ? void 0 : m.isActive("italic"),
1185
- onClick: t[3] || (t[3] = (v) => {
1186
- var f;
1187
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleItalic().run();
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: x(() => [...t[19] || (t[19] = [
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(k, {
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] = (v) => {
1208
- var f;
1209
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleUnderline().run();
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: x(() => [...t[20] || (t[20] = [
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(k, {
1188
+ h(w, {
1226
1189
  theme: e.theme,
1227
1190
  title: "Strikethrough",
1228
- "is-active": (s = e.editor) == null ? void 0 : s.isActive("strike"),
1229
- onClick: t[5] || (t[5] = (v) => {
1230
- var f;
1231
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleStrike().run();
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: x(() => [...t[21] || (t[21] = [
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(k, {
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] = (v) => {
1252
- var f;
1253
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleSubscript().run();
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: x(() => [...t[22] || (t[22] = [
1219
+ default: y(() => [...t[22] || (t[22] = [
1257
1220
  l("span", { class: "text-xs font-semibold" }, [
1258
- j("X"),
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(k, {
1227
+ h(w, {
1265
1228
  theme: e.theme,
1266
1229
  title: "Superscript",
1267
- "is-active": (d = e.editor) == null ? void 0 : d.isActive("superscript"),
1268
- onClick: t[7] || (t[7] = (v) => {
1269
- var f;
1270
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleSuperscript().run();
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: x(() => [...t[23] || (t[23] = [
1236
+ default: y(() => [...t[23] || (t[23] = [
1274
1237
  l("span", { class: "text-xs font-semibold" }, [
1275
- j("X"),
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(et, {
1244
+ h(Ze, {
1282
1245
  editor: e.editor,
1283
1246
  theme: e.theme
1284
1247
  }, null, 8, ["editor", "theme"]),
1285
- h(R),
1286
- h(tt, {
1248
+ h(B),
1249
+ h(Qe, {
1287
1250
  editor: e.editor,
1288
1251
  theme: e.theme
1289
1252
  }, null, 8, ["editor", "theme"]),
1290
- h(nt, {
1253
+ h(et, {
1291
1254
  editor: e.editor,
1292
1255
  theme: e.theme
1293
1256
  }, null, 8, ["editor", "theme"]),
1294
- h(R),
1295
- h(k, {
1257
+ h(B),
1258
+ h(w, {
1296
1259
  theme: e.theme,
1297
1260
  title: "Bullet list",
1298
- "is-active": (u = e.editor) == null ? void 0 : u.isActive("bulletList"),
1299
- onClick: t[8] || (t[8] = (v) => {
1300
- var f;
1301
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleBulletList().run();
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: x(() => [...t[24] || (t[24] = [
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(k, {
1300
+ h(w, {
1338
1301
  theme: e.theme,
1339
1302
  title: "Numbered list",
1340
- "is-active": (b = e.editor) == null ? void 0 : b.isActive("orderedList"),
1341
- onClick: t[9] || (t[9] = (v) => {
1342
- var f;
1343
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleOrderedList().run();
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: x(() => [...t[25] || (t[25] = [
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(k, {
1345
+ h(w, {
1383
1346
  theme: e.theme,
1384
1347
  title: "Blockquote",
1385
- "is-active": (S = e.editor) == null ? void 0 : S.isActive("blockquote"),
1386
- onClick: t[10] || (t[10] = (v) => {
1387
- var f;
1388
- return (f = e.editor) == null ? void 0 : f.chain().focus().toggleBlockquote().run();
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: x(() => [...t[26] || (t[26] = [
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(k, {
1368
+ h(w, {
1406
1369
  theme: e.theme,
1407
1370
  title: "Horizontal rule",
1408
- onClick: t[11] || (t[11] = (v) => {
1409
- var f;
1410
- return (f = e.editor) == null ? void 0 : f.chain().focus().setHorizontalRule().run();
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: x(() => [...t[27] || (t[27] = [
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(R),
1427
- h(it, {
1389
+ h(B),
1390
+ h(lt, {
1428
1391
  editor: e.editor,
1429
1392
  theme: e.theme
1430
1393
  }, null, 8, ["editor", "theme"]),
1431
- h(st, {
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] = (v) => n.$emit("error", v))
1398
+ onError: t[12] || (t[12] = (p) => n.$emit("error", p))
1436
1399
  }, null, 8, ["editor", "theme", "image-config"]),
1437
- h(ct, {
1400
+ h(at, {
1438
1401
  editor: e.editor,
1439
1402
  theme: e.theme
1440
1403
  }, null, 8, ["editor", "theme"]),
1441
- h(ft, {
1404
+ h(dt, {
1442
1405
  editor: e.editor,
1443
1406
  theme: e.theme
1444
1407
  }, null, 8, ["editor", "theme"]),
1445
- h(R),
1446
- h(k, {
1408
+ h(B),
1409
+ h(w, {
1447
1410
  theme: e.theme,
1448
1411
  title: "Save as template",
1449
- onClick: t[13] || (t[13] = (v) => n.$emit("saveTemplate"))
1412
+ onClick: t[13] || (t[13] = (p) => n.$emit("saveTemplate"))
1450
1413
  }, {
1451
- default: x(() => [...t[28] || (t[28] = [
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(k, {
1429
+ h(w, {
1467
1430
  theme: e.theme,
1468
1431
  title: "Load template",
1469
- onClick: t[14] || (t[14] = (v) => n.$emit("loadTemplate"))
1432
+ onClick: t[14] || (t[14] = (p) => n.$emit("loadTemplate"))
1470
1433
  }, {
1471
- default: x(() => [...t[29] || (t[29] = [
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(R),
1447
+ h(B),
1485
1448
  l("button", {
1486
- class: w(e.theme.saveButton),
1487
- onClick: t[15] || (t[15] = (v) => n.$emit("save"))
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
- }), gt = {
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
- }, ht = { class: "flex gap-1" }, pt = { class: "flex gap-1" }, bt = { class: "flex gap-1" }, xt = { class: "flex gap-1 items-center" }, yt = /* @__PURE__ */ C({
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(c) {
1465
+ function t(d) {
1503
1466
  var o;
1504
- (o = n.editor) == null || o.chain().focus().setCellAttribute("backgroundColor", c).run();
1467
+ (o = n.editor) == null || o.chain().focus().setCellAttribute("backgroundColor", d).run();
1505
1468
  }
1506
- return (c, o) => {
1469
+ return (d, o) => {
1507
1470
  var a;
1508
- return (a = e.editor) != null && a.isActive("table") ? (g(), p("div", gt, [
1509
- l("div", ht, [
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] = (m) => {
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] = (m) => {
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] = (m) => {
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", pt, [
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] = (m) => {
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] = (m) => {
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] = (m) => {
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", bt, [
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] = (m) => {
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] = (m) => {
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] = (m) => {
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] = (m) => {
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", xt, [
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] = (m) => t(m.target.value))
1557
+ onInput: o[10] || (o[10] = (c) => t(c.target.value))
1595
1558
  }, null, 32)
1596
1559
  ])
1597
- ])) : B("", !0);
1560
+ ])) : T("", !0);
1598
1561
  };
1599
1562
  }
1600
- }), kt = { class: "mb-3" }, wt = { class: "mb-4" }, Ct = { class: "flex gap-4" }, $t = { class: "flex items-center gap-2 text-sm" }, Tt = { class: "flex items-center gap-2 text-sm" }, Mt = { class: "flex justify-end gap-2" }, At = ["disabled"], St = /* @__PURE__ */ C({
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 c = t, o = y(!1), a = y(""), m = y("document");
1570
+ const d = t, o = k(!1), a = k(""), c = k("document");
1608
1571
  function i() {
1609
- a.value = "", m.value = "document", o.value = !0;
1572
+ a.value = "", c.value = "document", o.value = !0;
1610
1573
  }
1611
- function s() {
1574
+ function m() {
1612
1575
  o.value = !1;
1613
1576
  }
1614
1577
  function r() {
1615
- c("save", { name: a.value.trim(), type: m.value }), s();
1578
+ d("save", { name: a.value.trim(), type: c.value }), m();
1616
1579
  }
1617
- return n({ open: i, close: s }), (d, u) => (g(), V(Y, { to: "body" }, [
1618
- o.value ? (g(), p("div", {
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: K(s, ["self"])
1584
+ onClick: j(m, ["self"])
1622
1585
  }, [
1623
1586
  l("div", {
1624
- class: w([e.theme.modal, "w-96"])
1587
+ class: C([e.theme.modal, "w-96"])
1625
1588
  }, [
1626
- u[7] || (u[7] = l("h2", { class: "text-lg font-semibold mb-4" }, "Save as Template", -1)),
1627
- l("div", kt, [
1628
- u[3] || (u[3] = l("label", { class: "block text-sm font-medium text-gray-700 mb-1" }, "Template Name", -1)),
1629
- F(l("input", {
1630
- "onUpdate:modelValue": u[0] || (u[0] = (b) => a.value = b),
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
- [I, a.value]
1598
+ [V, a.value]
1636
1599
  ])
1637
1600
  ]),
1638
- l("div", wt, [
1639
- u[6] || (u[6] = l("label", { class: "block text-sm font-medium text-gray-700 mb-1" }, "Type", -1)),
1640
- l("div", Ct, [
1641
- l("label", $t, [
1642
- F(l("input", {
1643
- "onUpdate:modelValue": u[1] || (u[1] = (b) => m.value = b),
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
- [J, m.value]
1610
+ [G, c.value]
1648
1611
  ]),
1649
- u[4] || (u[4] = j(" Full Document ", -1))
1612
+ s[4] || (s[4] = N(" Full Document ", -1))
1650
1613
  ]),
1651
- l("label", Tt, [
1652
- F(l("input", {
1653
- "onUpdate:modelValue": u[2] || (u[2] = (b) => m.value = b),
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
- [J, m.value]
1620
+ [G, c.value]
1658
1621
  ]),
1659
- u[5] || (u[5] = j(" Snippet ", -1))
1622
+ s[5] || (s[5] = N(" Snippet ", -1))
1660
1623
  ])
1661
1624
  ])
1662
1625
  ]),
1663
- l("div", Mt, [
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: s
1629
+ onClick: m
1667
1630
  }, "Cancel"),
1668
1631
  l("button", {
1669
- class: w(e.theme.saveButton),
1632
+ class: C(e.theme.saveButton),
1670
1633
  disabled: !a.value.trim(),
1671
1634
  onClick: r
1672
- }, "Save", 10, At)
1635
+ }, "Save", 10, $t)
1673
1636
  ])
1674
1637
  ], 2)
1675
- ])) : B("", !0)
1638
+ ])) : T("", !0)
1676
1639
  ]));
1677
1640
  }
1678
- }), Lt = {
1641
+ }), Tt = {
1679
1642
  key: 0,
1680
1643
  class: "text-center py-8 text-gray-500"
1681
- }, Bt = {
1644
+ }, At = {
1682
1645
  key: 1,
1683
1646
  class: "text-center py-8 text-gray-500"
1684
- }, Ht = {
1647
+ }, St = {
1685
1648
  key: 2,
1686
1649
  class: "overflow-y-auto flex-1 -mx-6 px-6"
1687
- }, Et = ["onClick"], zt = { class: "font-medium text-sm" }, Rt = ["onClick"], Ft = /* @__PURE__ */ C({
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 c = t, o = y(!1);
1659
+ const d = t, o = k(!1);
1697
1660
  function a() {
1698
- o.value = !0, c("load");
1661
+ o.value = !0, d("load");
1699
1662
  }
1700
- function m() {
1663
+ function c() {
1701
1664
  o.value = !1;
1702
1665
  }
1703
1666
  function i(r) {
1704
- c("select", r), m();
1667
+ d("select", r), c();
1705
1668
  }
1706
- function s(r) {
1707
- confirm(`Delete template "${r.name}"?`) && c("delete", r);
1669
+ function m(r) {
1670
+ confirm(`Delete template "${r.name}"?`) && d("delete", r);
1708
1671
  }
1709
- return n({ open: a, close: m }), (r, d) => (g(), V(Y, { to: "body" }, [
1710
- o.value ? (g(), p("div", {
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: K(m, ["self"])
1676
+ onClick: j(c, ["self"])
1714
1677
  }, [
1715
1678
  l("div", {
1716
- class: w([e.theme.modal, "w-[500px] max-h-[80vh] flex flex-col"])
1679
+ class: C([e.theme.modal, "w-[500px] max-h-[80vh] flex flex-col"])
1717
1680
  }, [
1718
- d[0] || (d[0] = l("h2", { class: "text-lg font-semibold mb-4" }, "Load Template", -1)),
1719
- e.loading ? (g(), p("div", Lt, "Loading templates...")) : e.templates.length === 0 ? (g(), p("div", Bt, "No templates found")) : (g(), p("div", Ht, [
1720
- (g(!0), p(A, null, E(e.templates, (u) => (g(), p("div", {
1721
- key: u.id,
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: (b) => i(u)
1686
+ onClick: (f) => i(s)
1724
1687
  }, [
1725
1688
  l("div", null, [
1726
- l("div", zt, z(u.name), 1),
1689
+ l("div", Bt, L(s.name), 1),
1727
1690
  l("span", {
1728
- class: w(["inline-block text-xs px-2 py-0.5 rounded mt-1", u.type === "document" ? "bg-blue-100 text-blue-700" : "bg-green-100 text-green-700"])
1729
- }, z(u.type === "document" ? "Document" : "Snippet"), 3)
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: K((b) => s(u), ["stop"])
1734
- }, " Delete ", 8, Rt)
1735
- ], 8, Et))), 128))
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: m
1703
+ onClick: c
1741
1704
  }, "Cancel")
1742
1705
  ])
1743
1706
  ], 2)
1744
- ])) : B("", !0)
1707
+ ])) : T("", !0)
1745
1708
  ]));
1746
1709
  }
1747
- }), Vt = { class: "border border-gray-200 rounded-lg overflow-hidden" }, ll = /* @__PURE__ */ C({
1710
+ }), Et = { class: "border border-gray-200 rounded-lg overflow-hidden" }, _t = /* @__PURE__ */ $({
1748
1711
  __name: "DocumentEditor",
1749
1712
  props: {
1750
1713
  modelValue: {},
1751
- mode: { default: "document" },
1752
- templateMeta: {},
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, c = n, o = H(() => ({
1762
- ...Ee,
1723
+ const t = e, d = n, o = A(() => ({
1724
+ ...Be,
1763
1725
  ...t.theme
1764
- })), a = ie({
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
- fe.configure({ types: ["textStyle"] }),
1776
- ve.configure({ types: ["heading", "paragraph"] }),
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
- Be,
1786
- pe.configure({ resizable: !0 }),
1747
+ Se,
1748
+ ge.configure({ resizable: !0 }),
1749
+ he,
1787
1750
  be,
1788
- xe,
1789
- ye,
1790
- He,
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 v;
1797
- c("update:modelValue", ((v = a.value) == null ? void 0 : v.getHTML()) ?? "");
1758
+ var f;
1759
+ d("update:modelValue", ((f = a.value) == null ? void 0 : f.getHTML()) ?? "");
1798
1760
  }
1799
1761
  });
1800
- te(Q, a), q(() => t.modelValue, (v) => {
1801
- var f, $;
1802
- ((f = a.value) == null ? void 0 : f.getHTML()) !== v && (($ = a.value) == null || $.commands.setContent(v, { emitUpdate: !1 }));
1803
- }), q(() => t.readonly, (v) => {
1804
- var f;
1805
- (f = a.value) == null || f.setEditable(!v);
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 m(v) {
1808
- c("error", v);
1769
+ function c(f) {
1770
+ d("error", f);
1809
1771
  }
1810
- const i = Oe(t.api), s = y(null), r = y(null);
1811
- async function d(v) {
1812
- var f, $, T;
1813
- try {
1814
- const M = ((f = a.value) == null ? void 0 : f.getHTML()) ?? "", O = v.type === "snippet" && (($ = a.value) != null && $.state.selection.content()) && ((T = a.value) == null ? void 0 : T.state.selection.content().content.textBetween(0, a.value.state.selection.content().content.size)) || M;
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(v) {
1822
- var f, $, T, M;
1823
- if (v.type === "document") {
1824
- if (((f = a.value) == null ? void 0 : f.getHTML()) !== "<p></p>" && (($ = a.value) == null ? void 0 : $.getHTML()) !== "" && !confirm("Replace current content with this template?")) return;
1825
- (T = a.value) == null || T.commands.setContent(v.content);
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
- (M = a.value) == null || M.commands.insertContent(v.content);
1784
+ (R = a.value) == null || R.commands.insertContent(f.content);
1828
1785
  }
1829
- async function b(v) {
1830
- try {
1831
- await i.deleteTemplate(v.id), await i.loadTemplates();
1832
- } catch (f) {
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 (v, f) => (g(), p("div", Vt, [
1857
- t.readonly ? B("", !0) : (g(), p(A, { key: 0 }, [
1858
- h(vt, {
1859
- editor: L(a),
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: f[0] || (f[0] = ($) => {
1863
- var T;
1864
- return (T = s.value) == null ? void 0 : T.open();
1797
+ onSaveTemplate: x[0] || (x[0] = (p) => {
1798
+ var v;
1799
+ return (v = i.value) == null ? void 0 : v.open();
1865
1800
  }),
1866
- onLoadTemplate: f[1] || (f[1] = ($) => {
1867
- var T;
1868
- return (T = r.value) == null ? void 0 : T.open();
1801
+ onLoadTemplate: x[1] || (x[1] = (p) => {
1802
+ var v;
1803
+ return (v = m.value) == null ? void 0 : v.open();
1869
1804
  }),
1870
- onSave: S,
1871
- onError: m
1805
+ onSave: s,
1806
+ onError: c
1872
1807
  }, null, 8, ["editor", "theme", "image-config"]),
1873
- h(yt, { editor: L(a) }, null, 8, ["editor"])
1808
+ h(bt, { editor: H(a) }, null, 8, ["editor"])
1874
1809
  ], 64)),
1875
- h(L(re), {
1876
- editor: L(a),
1877
- class: w(o.value.editor)
1810
+ h(H(oe), {
1811
+ editor: H(a),
1812
+ class: C(o.value.editor)
1878
1813
  }, null, 8, ["editor", "class"]),
1879
- h(St, {
1814
+ h(Mt, {
1880
1815
  ref_key: "saveTemplateModal",
1881
- ref: s,
1816
+ ref: i,
1882
1817
  theme: o.value,
1883
- onSave: d
1818
+ onSave: r
1884
1819
  }, null, 8, ["theme"]),
1885
- h(Ft, {
1820
+ h(zt, {
1886
1821
  ref_key: "loadTemplateModal",
1887
- ref: r,
1822
+ ref: m,
1888
1823
  theme: o.value,
1889
- templates: L(i).templates.value,
1890
- loading: L(i).loading.value,
1891
- onLoad: f[2] || (f[2] = ($) => L(i).loadTemplates()),
1824
+ templates: t.templates ?? [],
1825
+ loading: t.templatesLoading ?? !1,
1826
+ onLoad: x[2] || (x[2] = (p) => d("loadTemplates")),
1892
1827
  onSelect: u,
1893
- onDelete: b
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
- ze as DEFAULT_IMAGE_CONFIG,
1900
- Ee as DEFAULT_THEME,
1901
- ll as DocumentEditor,
1902
- Fe as FONT_SIZES,
1903
- Ve as LINE_HEIGHTS,
1904
- Re as WEB_SAFE_FONTS,
1905
- tl as useDocumentEditor
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
  };