ablok-components 0.3.60 → 0.3.61
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.
|
@@ -11,6 +11,10 @@ declare const _default: import('../../../../vue/dist/vue.esm-bundler.js').Define
|
|
|
11
11
|
type: StringConstructor;
|
|
12
12
|
default: string;
|
|
13
13
|
};
|
|
14
|
+
allowFullscreen: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
14
18
|
}>, {}, {}, {}, {}, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, {
|
|
15
19
|
"update:modelValue": (...args: any[]) => void;
|
|
16
20
|
}, string, import('../../../../vue/dist/vue.esm-bundler.js').PublicProps, Readonly<import('../../../../vue/dist/vue.esm-bundler.js').ExtractPropTypes<{
|
|
@@ -26,11 +30,16 @@ declare const _default: import('../../../../vue/dist/vue.esm-bundler.js').Define
|
|
|
26
30
|
type: StringConstructor;
|
|
27
31
|
default: string;
|
|
28
32
|
};
|
|
33
|
+
allowFullscreen: {
|
|
34
|
+
type: BooleanConstructor;
|
|
35
|
+
default: boolean;
|
|
36
|
+
};
|
|
29
37
|
}>> & Readonly<{
|
|
30
38
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
31
39
|
}>, {
|
|
32
40
|
modelValue: string;
|
|
33
41
|
disabled: boolean;
|
|
34
42
|
iconBasePath: string;
|
|
43
|
+
allowFullscreen: boolean;
|
|
35
44
|
}, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {}, any>;
|
|
36
45
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as S, ref as f, shallowRef as p, onMounted as M, onBeforeUnmount as V, watch as E, openBlock as u, createBlock as c, Teleport as U, createElementVNode as l, normalizeClass as b, createElementBlock as h, createVNode as i, createCommentVNode as y, resolveDynamicComponent as F } from "vue";
|
|
2
2
|
import n from "../../atoms/svg-icon/svg-icon.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
const
|
|
4
|
+
const R = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "rte-editor__controls mb-2"
|
|
7
7
|
}, I = ["disabled"], N = ["disabled"], O = { class: "btn-group" }, j = ["disabled"], z = ["disabled"], D = { class: "btn-group" }, K = { class: "dropdown" }, q = {
|
|
@@ -14,7 +14,7 @@ const F = {
|
|
|
14
14
|
"data-bs-toggle": "dropdown",
|
|
15
15
|
role: "button",
|
|
16
16
|
type: "button"
|
|
17
|
-
}, W = { class: "dropdown-menu" }, X = { class: "btn-group" }, Y = ["disabled"], Z = ["disabled"], _ = ["title"], it = /* @__PURE__ */
|
|
17
|
+
}, W = { class: "dropdown-menu" }, X = { class: "btn-group" }, Y = ["disabled"], Z = ["disabled"], _ = ["title"], it = /* @__PURE__ */ S({
|
|
18
18
|
__name: "rte-editor",
|
|
19
19
|
props: {
|
|
20
20
|
modelValue: {
|
|
@@ -28,20 +28,24 @@ const F = {
|
|
|
28
28
|
iconBasePath: {
|
|
29
29
|
type: String,
|
|
30
30
|
default: "/rte-icons-defs.svg"
|
|
31
|
+
},
|
|
32
|
+
allowFullscreen: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
31
35
|
}
|
|
32
36
|
},
|
|
33
37
|
emits: ["update:modelValue"],
|
|
34
38
|
setup(a, { emit: k }) {
|
|
35
|
-
const g = a,
|
|
36
|
-
|
|
39
|
+
const g = a, A = k, v = f(!1), d = f(!1), t = p(void 0), m = p(null);
|
|
40
|
+
M(async () => {
|
|
37
41
|
const [
|
|
38
42
|
{ Editor: r, mergeAttributes: e },
|
|
39
43
|
{ EditorContent: s },
|
|
40
|
-
{ default: C },
|
|
41
44
|
{ default: x },
|
|
42
45
|
{ default: L },
|
|
43
46
|
{ default: T },
|
|
44
|
-
{ default: $ }
|
|
47
|
+
{ default: $ },
|
|
48
|
+
{ default: w }
|
|
45
49
|
] = await Promise.all([
|
|
46
50
|
import("@tiptap/core"),
|
|
47
51
|
import("@tiptap/vue-3"),
|
|
@@ -54,14 +58,14 @@ const F = {
|
|
|
54
58
|
m.value = s, t.value = new r({
|
|
55
59
|
content: g.modelValue,
|
|
56
60
|
onUpdate: () => {
|
|
57
|
-
|
|
61
|
+
A("update:modelValue", t.value?.getHTML());
|
|
58
62
|
},
|
|
59
63
|
extensions: [
|
|
60
|
-
|
|
64
|
+
$.configure({
|
|
61
65
|
bold: !1,
|
|
62
66
|
link: !1
|
|
63
67
|
}),
|
|
64
|
-
|
|
68
|
+
w.extend({
|
|
65
69
|
addAttributes() {
|
|
66
70
|
return {
|
|
67
71
|
class: {
|
|
@@ -79,11 +83,11 @@ const F = {
|
|
|
79
83
|
return ["strong", e(this.options.HTMLAttributes, o), 0];
|
|
80
84
|
}
|
|
81
85
|
}),
|
|
82
|
-
|
|
86
|
+
L.configure({
|
|
83
87
|
types: ["heading", "paragraph"]
|
|
84
88
|
}),
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
x,
|
|
90
|
+
T.extend({
|
|
87
91
|
addAttributes() {
|
|
88
92
|
return {
|
|
89
93
|
...this.parent?.(),
|
|
@@ -146,16 +150,16 @@ const F = {
|
|
|
146
150
|
})
|
|
147
151
|
]
|
|
148
152
|
});
|
|
149
|
-
}),
|
|
153
|
+
}), V(() => {
|
|
150
154
|
t.value?.destroy();
|
|
151
|
-
}),
|
|
155
|
+
}), E(() => g.modelValue, (r, e) => {
|
|
152
156
|
if (t.value) {
|
|
153
157
|
if (t.value.getHTML() === r)
|
|
154
158
|
return;
|
|
155
159
|
t.value.commands.setContent(r);
|
|
156
160
|
}
|
|
157
161
|
});
|
|
158
|
-
function
|
|
162
|
+
function B() {
|
|
159
163
|
const r = t.value?.getAttributes("link").href, e = window.prompt("URL", r);
|
|
160
164
|
if (e !== null) {
|
|
161
165
|
if (e === "") {
|
|
@@ -169,23 +173,23 @@ const F = {
|
|
|
169
173
|
}
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
|
-
const
|
|
176
|
+
const P = () => {
|
|
173
177
|
t.value?.commands.setContent(`<textarea>${t.value.getHTML()}</textarea>`), v.value = !0;
|
|
174
|
-
},
|
|
178
|
+
}, C = () => {
|
|
175
179
|
t.value?.commands.setContent(t.value.getText()), v.value = !1;
|
|
176
180
|
};
|
|
177
|
-
return (r, e) => (
|
|
181
|
+
return (r, e) => (u(), c(U, {
|
|
178
182
|
to: "body",
|
|
179
183
|
disabled: !d.value
|
|
180
184
|
}, [
|
|
181
185
|
l("div", {
|
|
182
|
-
class:
|
|
186
|
+
class: b(["rte-editor", { "rte-editor--fullscreen": d.value }])
|
|
183
187
|
}, [
|
|
184
|
-
t.value ? (
|
|
185
|
-
v.value ? (
|
|
188
|
+
t.value ? (u(), h("div", R, [
|
|
189
|
+
v.value ? (u(), h("button", {
|
|
186
190
|
key: 1,
|
|
187
191
|
class: "btn btn-sm btn-light is-active",
|
|
188
|
-
onClick:
|
|
192
|
+
onClick: C,
|
|
189
193
|
disabled: !t.value.can().chain().focus().toggleCode().run(),
|
|
190
194
|
title: "Toggle Source"
|
|
191
195
|
}, [
|
|
@@ -193,10 +197,10 @@ const F = {
|
|
|
193
197
|
symbol: "source",
|
|
194
198
|
"base-path": a.iconBasePath
|
|
195
199
|
}, null, 8, ["base-path"])
|
|
196
|
-
], 8, N)) : (
|
|
200
|
+
], 8, N)) : (u(), h("button", {
|
|
197
201
|
key: 0,
|
|
198
|
-
class:
|
|
199
|
-
onClick:
|
|
202
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("code") }]),
|
|
203
|
+
onClick: P,
|
|
200
204
|
disabled: !t.value.can().chain().focus().toggleCode().run(),
|
|
201
205
|
title: "Toggle Source"
|
|
202
206
|
}, [
|
|
@@ -207,7 +211,7 @@ const F = {
|
|
|
207
211
|
], 10, I)),
|
|
208
212
|
l("div", O, [
|
|
209
213
|
l("button", {
|
|
210
|
-
class:
|
|
214
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("bold") }]),
|
|
211
215
|
onClick: e[0] || (e[0] = (s) => t.value?.chain().focus().toggleBold().run()),
|
|
212
216
|
disabled: !t.value.can().chain().focus().toggleBold().run(),
|
|
213
217
|
title: "Toggle Bold"
|
|
@@ -218,7 +222,7 @@ const F = {
|
|
|
218
222
|
}, null, 8, ["base-path"])
|
|
219
223
|
], 10, j),
|
|
220
224
|
l("button", {
|
|
221
|
-
class:
|
|
225
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("italic") }]),
|
|
222
226
|
onClick: e[1] || (e[1] = (s) => t.value?.chain().focus().toggleItalic().run()),
|
|
223
227
|
disabled: !t.value.can().chain().focus().toggleItalic().run(),
|
|
224
228
|
title: "Toggle Italic"
|
|
@@ -232,23 +236,23 @@ const F = {
|
|
|
232
236
|
l("div", D, [
|
|
233
237
|
l("div", K, [
|
|
234
238
|
l("button", q, [
|
|
235
|
-
t.value.isActive("heading", { level: 1 }) ? (
|
|
239
|
+
t.value.isActive("heading", { level: 1 }) ? (u(), c(n, {
|
|
236
240
|
key: 0,
|
|
237
241
|
symbol: "h1",
|
|
238
242
|
"base-path": a.iconBasePath
|
|
239
|
-
}, null, 8, ["base-path"])) : t.value.isActive("heading", { level: 2 }) ? (
|
|
243
|
+
}, null, 8, ["base-path"])) : t.value.isActive("heading", { level: 2 }) ? (u(), c(n, {
|
|
240
244
|
key: 1,
|
|
241
245
|
symbol: "h2",
|
|
242
246
|
"base-path": a.iconBasePath
|
|
243
|
-
}, null, 8, ["base-path"])) : t.value.isActive("heading", { level: 3 }) ? (
|
|
247
|
+
}, null, 8, ["base-path"])) : t.value.isActive("heading", { level: 3 }) ? (u(), c(n, {
|
|
244
248
|
key: 2,
|
|
245
249
|
symbol: "h3",
|
|
246
250
|
"base-path": a.iconBasePath
|
|
247
|
-
}, null, 8, ["base-path"])) : t.value.isActive("heading", { level: 4 }) ? (
|
|
251
|
+
}, null, 8, ["base-path"])) : t.value.isActive("heading", { level: 4 }) ? (u(), c(n, {
|
|
248
252
|
key: 3,
|
|
249
253
|
symbol: "h4",
|
|
250
254
|
"base-path": a.iconBasePath
|
|
251
|
-
}, null, 8, ["base-path"])) : (
|
|
255
|
+
}, null, 8, ["base-path"])) : (u(), c(n, {
|
|
252
256
|
key: 4,
|
|
253
257
|
symbol: "headline",
|
|
254
258
|
"base-path": a.iconBasePath
|
|
@@ -257,7 +261,7 @@ const F = {
|
|
|
257
261
|
l("ul", G, [
|
|
258
262
|
l("li", null, [
|
|
259
263
|
l("button", {
|
|
260
|
-
class:
|
|
264
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("heading", { level: 1 }) }]),
|
|
261
265
|
onClick: e[2] || (e[2] = (s) => t.value?.chain().focus().setHeading({ level: 1 }).run()),
|
|
262
266
|
title: "Set Heading 1"
|
|
263
267
|
}, [
|
|
@@ -269,7 +273,7 @@ const F = {
|
|
|
269
273
|
]),
|
|
270
274
|
l("li", null, [
|
|
271
275
|
l("button", {
|
|
272
|
-
class:
|
|
276
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("heading", { level: 2 }) }]),
|
|
273
277
|
onClick: e[3] || (e[3] = (s) => t.value?.chain().focus().setHeading({ level: 2 }).run()),
|
|
274
278
|
title: "Set Heading 2"
|
|
275
279
|
}, [
|
|
@@ -281,7 +285,7 @@ const F = {
|
|
|
281
285
|
]),
|
|
282
286
|
l("li", null, [
|
|
283
287
|
l("button", {
|
|
284
|
-
class:
|
|
288
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("heading", { level: 3 }) }]),
|
|
285
289
|
onClick: e[4] || (e[4] = (s) => t.value?.chain().focus().setHeading({ level: 3 }).run()),
|
|
286
290
|
title: "Set Heading 3"
|
|
287
291
|
}, [
|
|
@@ -293,7 +297,7 @@ const F = {
|
|
|
293
297
|
]),
|
|
294
298
|
l("li", null, [
|
|
295
299
|
l("button", {
|
|
296
|
-
class:
|
|
300
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("heading", { level: 4 }) }]),
|
|
297
301
|
onClick: e[5] || (e[5] = (s) => t.value?.chain().focus().setHeading({ level: 4 }).run()),
|
|
298
302
|
title: "Set Heading 4"
|
|
299
303
|
}, [
|
|
@@ -306,7 +310,7 @@ const F = {
|
|
|
306
310
|
])
|
|
307
311
|
]),
|
|
308
312
|
l("button", {
|
|
309
|
-
class:
|
|
313
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("paragraph") }]),
|
|
310
314
|
onClick: e[6] || (e[6] = (s) => t.value?.chain().focus().setParagraph().run()),
|
|
311
315
|
title: "Set Paragraph"
|
|
312
316
|
}, [
|
|
@@ -316,7 +320,7 @@ const F = {
|
|
|
316
320
|
}, null, 8, ["base-path"])
|
|
317
321
|
], 2),
|
|
318
322
|
l("button", {
|
|
319
|
-
class:
|
|
323
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("bulletList") }]),
|
|
320
324
|
onClick: e[7] || (e[7] = (s) => t.value?.chain().focus().toggleBulletList().run()),
|
|
321
325
|
title: "Toggle Bullet List"
|
|
322
326
|
}, [
|
|
@@ -326,7 +330,7 @@ const F = {
|
|
|
326
330
|
}, null, 8, ["base-path"])
|
|
327
331
|
], 2),
|
|
328
332
|
l("button", {
|
|
329
|
-
class:
|
|
333
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("orderedList") }]),
|
|
330
334
|
onClick: e[8] || (e[8] = (s) => t.value?.chain().focus().toggleOrderedList().run()),
|
|
331
335
|
title: "Toggle Ordered List"
|
|
332
336
|
}, [
|
|
@@ -338,19 +342,19 @@ const F = {
|
|
|
338
342
|
]),
|
|
339
343
|
l("div", J, [
|
|
340
344
|
l("button", Q, [
|
|
341
|
-
t.value.isActive({ textAlign: "center" }) ? (
|
|
345
|
+
t.value.isActive({ textAlign: "center" }) ? (u(), c(n, {
|
|
342
346
|
key: 0,
|
|
343
347
|
symbol: "align-center",
|
|
344
348
|
"base-path": a.iconBasePath
|
|
345
|
-
}, null, 8, ["base-path"])) : t.value.isActive({ textAlign: "left" }) ? (
|
|
349
|
+
}, null, 8, ["base-path"])) : t.value.isActive({ textAlign: "left" }) ? (u(), c(n, {
|
|
346
350
|
key: 1,
|
|
347
351
|
symbol: "align-left",
|
|
348
352
|
"base-path": a.iconBasePath
|
|
349
|
-
}, null, 8, ["base-path"])) : t.value.isActive({ textAlign: "right" }) ? (
|
|
353
|
+
}, null, 8, ["base-path"])) : t.value.isActive({ textAlign: "right" }) ? (u(), c(n, {
|
|
350
354
|
key: 2,
|
|
351
355
|
symbol: "align-right",
|
|
352
356
|
"base-path": a.iconBasePath
|
|
353
|
-
}, null, 8, ["base-path"])) : (
|
|
357
|
+
}, null, 8, ["base-path"])) : (u(), c(n, {
|
|
354
358
|
key: 3,
|
|
355
359
|
symbol: "align-justify",
|
|
356
360
|
"base-path": a.iconBasePath
|
|
@@ -359,7 +363,7 @@ const F = {
|
|
|
359
363
|
l("ul", W, [
|
|
360
364
|
l("li", null, [
|
|
361
365
|
l("button", {
|
|
362
|
-
class:
|
|
366
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive({ textAlign: "left" }) }]),
|
|
363
367
|
onClick: e[9] || (e[9] = (s) => t.value?.chain().focus().setTextAlign("left").run())
|
|
364
368
|
}, [
|
|
365
369
|
i(n, {
|
|
@@ -370,7 +374,7 @@ const F = {
|
|
|
370
374
|
]),
|
|
371
375
|
l("li", null, [
|
|
372
376
|
l("button", {
|
|
373
|
-
class:
|
|
377
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive({ textAlign: "center" }) }]),
|
|
374
378
|
onClick: e[10] || (e[10] = (s) => t.value?.chain().focus().setTextAlign("center").run())
|
|
375
379
|
}, [
|
|
376
380
|
i(n, {
|
|
@@ -381,7 +385,7 @@ const F = {
|
|
|
381
385
|
]),
|
|
382
386
|
l("li", null, [
|
|
383
387
|
l("button", {
|
|
384
|
-
class:
|
|
388
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive({ textAlign: "right" }) }]),
|
|
385
389
|
onClick: e[11] || (e[11] = (s) => t.value?.chain().focus().setTextAlign("right").run())
|
|
386
390
|
}, [
|
|
387
391
|
i(n, {
|
|
@@ -392,7 +396,7 @@ const F = {
|
|
|
392
396
|
]),
|
|
393
397
|
l("li", null, [
|
|
394
398
|
l("button", {
|
|
395
|
-
class:
|
|
399
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive({ textAlign: "pretty" }) }]),
|
|
396
400
|
onClick: e[12] || (e[12] = (s) => t.value?.chain().focus().setTextAlign("right").run())
|
|
397
401
|
}, [
|
|
398
402
|
i(n, {
|
|
@@ -403,9 +407,9 @@ const F = {
|
|
|
403
407
|
])
|
|
404
408
|
])
|
|
405
409
|
]),
|
|
406
|
-
t.value.isActive("link") ? (
|
|
410
|
+
t.value.isActive("link") ? (u(), h("button", {
|
|
407
411
|
key: 3,
|
|
408
|
-
class:
|
|
412
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("link") }]),
|
|
409
413
|
onClick: e[13] || (e[13] = (s) => t.value.chain().focus().unsetLink().run()),
|
|
410
414
|
title: "Unset Link"
|
|
411
415
|
}, [
|
|
@@ -413,10 +417,10 @@ const F = {
|
|
|
413
417
|
symbol: "unlink",
|
|
414
418
|
"base-path": a.iconBasePath
|
|
415
419
|
}, null, 8, ["base-path"])
|
|
416
|
-
], 2)) : (
|
|
420
|
+
], 2)) : (u(), h("button", {
|
|
417
421
|
key: 2,
|
|
418
|
-
class:
|
|
419
|
-
onClick:
|
|
422
|
+
class: b(["btn btn-sm btn-light", { "is-active": t.value.isActive("link") }]),
|
|
423
|
+
onClick: B,
|
|
420
424
|
title: "Set Link"
|
|
421
425
|
}, [
|
|
422
426
|
i(n, {
|
|
@@ -448,7 +452,8 @@ const F = {
|
|
|
448
452
|
}, null, 8, ["base-path"])
|
|
449
453
|
], 8, Z)
|
|
450
454
|
]),
|
|
451
|
-
|
|
455
|
+
a.allowFullscreen ? (u(), h("button", {
|
|
456
|
+
key: 4,
|
|
452
457
|
class: "btn btn-sm btn-light ms-auto",
|
|
453
458
|
onClick: e[16] || (e[16] = (s) => d.value = !d.value),
|
|
454
459
|
title: d.value ? "Exit Fullscreen" : "Fullscreen"
|
|
@@ -457,9 +462,9 @@ const F = {
|
|
|
457
462
|
symbol: d.value ? "close" : "maximize",
|
|
458
463
|
"base-path": a.iconBasePath
|
|
459
464
|
}, null, 8, ["symbol", "base-path"])
|
|
460
|
-
], 8, _)
|
|
461
|
-
])) :
|
|
462
|
-
(
|
|
465
|
+
], 8, _)) : y("", !0)
|
|
466
|
+
])) : y("", !0),
|
|
467
|
+
(u(), c(F(m.value), {
|
|
463
468
|
class: "rte-editor__content",
|
|
464
469
|
editor: t.value
|
|
465
470
|
}, null, 8, ["editor"]))
|