sprintify-ui 0.11.34 → 0.12.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.
- package/README.md +0 -2
- package/dist/sprintify-ui.es.js +9166 -8478
- package/dist/style.css +1 -4
- package/dist/types/components/BaseDropdown.vue.d.ts +9 -0
- package/dist/types/components/BaseRichText.vue.d.ts +0 -8
- package/dist/types/components/BaseTipTap.vue.d.ts +2 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +3 -5
- package/src/assets/base-rich-text.css +13 -287
- package/src/assets/main.css +0 -3
- package/src/components/BaseDropdown.vue +16 -2
- package/src/components/BaseRichText.stories.js +5 -22
- package/src/components/BaseRichText.vue +3 -53
- package/src/components/BaseTipTap.vue +289 -45
- package/src/lang/en.json +1 -0
- package/src/lang/fr.json +1 -0
- package/dist/BaseCkeditor-D39KO4I5.js +0 -143
- package/dist/types/components/BaseCkeditor.vue.d.ts +0 -32
- package/src/components/BaseCkeditor.vue +0 -170
|
@@ -22,6 +22,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
22
22
|
default: string;
|
|
23
23
|
type: PropType<Placement>;
|
|
24
24
|
};
|
|
25
|
+
twButton: {
|
|
26
|
+
default: string;
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
};
|
|
25
29
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
30
|
animated: {
|
|
27
31
|
default: boolean;
|
|
@@ -35,8 +39,13 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
35
39
|
default: string;
|
|
36
40
|
type: PropType<Placement>;
|
|
37
41
|
};
|
|
42
|
+
twButton: {
|
|
43
|
+
default: string;
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
};
|
|
38
46
|
}>> & Readonly<{}>, {
|
|
39
47
|
placement: Placement;
|
|
48
|
+
twButton: string;
|
|
40
49
|
animated: boolean;
|
|
41
50
|
keepAlive: boolean;
|
|
42
51
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -2,12 +2,6 @@ import { Size } from '@/utils/sizes';
|
|
|
2
2
|
import { ToolbarOption } from '@/types/ToolbarOption';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
modelValue: string | null | undefined;
|
|
5
|
-
driver?: 'ckeditor' | 'tiptap';
|
|
6
|
-
/**
|
|
7
|
-
* Defines the CKEditor layout style.
|
|
8
|
-
* Only applicable when `driver` is 'ckeditor'.
|
|
9
|
-
*/
|
|
10
|
-
editor?: 'classic' | 'inline' | 'balloon';
|
|
11
5
|
size?: Size;
|
|
12
6
|
toolbar?: ToolbarOption[] | string[];
|
|
13
7
|
placeholder?: string;
|
|
@@ -35,7 +29,5 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
35
29
|
name: string;
|
|
36
30
|
hasError: boolean;
|
|
37
31
|
toolbar: ToolbarOption[] | string[];
|
|
38
|
-
editor: "classic" | "inline" | "balloon";
|
|
39
|
-
driver: "ckeditor" | "tiptap";
|
|
40
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
33
|
export default _default;
|
|
@@ -4,7 +4,8 @@ type __VLS_Props = {
|
|
|
4
4
|
hasError?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
placeholder?: string;
|
|
7
|
-
toolbar?: string[];
|
|
7
|
+
toolbar?: string[] | 'simple' | 'complete';
|
|
8
|
+
noMargin?: boolean;
|
|
8
9
|
};
|
|
9
10
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
11
|
"update:modelValue": (...args: any[]) => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ declare const messages: {
|
|
|
68
68
|
page: string;
|
|
69
69
|
pagination_detail_1: string;
|
|
70
70
|
pagination_detail_2: string;
|
|
71
|
+
paste_link: string;
|
|
71
72
|
postal_code_zip_code: string;
|
|
72
73
|
previous: string;
|
|
73
74
|
previous_month: string;
|
|
@@ -170,6 +171,7 @@ declare const messages: {
|
|
|
170
171
|
page: string;
|
|
171
172
|
pagination_detail_1: string;
|
|
172
173
|
pagination_detail_2: string;
|
|
174
|
+
paste_link: string;
|
|
173
175
|
postal_code_zip_code: string;
|
|
174
176
|
previous: string;
|
|
175
177
|
previous_month: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprintify-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"generate-llm-txt": "node scripts/generate-llm-txt.js",
|
|
@@ -16,13 +16,11 @@
|
|
|
16
16
|
"vue-tsc": "vue-tsc"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@ckeditor/ckeditor5-vue": "^7.3.0",
|
|
20
19
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
21
20
|
"@tailwindcss/forms": "^0.5.3",
|
|
22
21
|
"@tailwindcss/typography": "^0.5.8",
|
|
23
22
|
"@vueuse/core": "^10.0.0",
|
|
24
23
|
"axios": "^0.26.1 || ^1.0.0",
|
|
25
|
-
"ckeditor5": "^47.3.0",
|
|
26
24
|
"croppie": "^2.6.5",
|
|
27
25
|
"flatpickr": "^4.6.13",
|
|
28
26
|
"humanize-duration": "^3.0.0",
|
|
@@ -40,6 +38,8 @@
|
|
|
40
38
|
"dependencies": {
|
|
41
39
|
"@floating-ui/vue": "^1.0.6",
|
|
42
40
|
"@headlessui/vue": "^1.7.19",
|
|
41
|
+
"@tiptap/extension-highlight": "^3.22.4",
|
|
42
|
+
"@tiptap/extension-image": "^3.22.4",
|
|
43
43
|
"@tiptap/extension-subscript": "^3.20.4",
|
|
44
44
|
"@tiptap/extension-superscript": "^3.20.4",
|
|
45
45
|
"color2k": "^2.0.3",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@babel/core": "^7.24.0",
|
|
50
|
-
"@ckeditor/ckeditor5-vue": "^7.3.0",
|
|
51
50
|
"@commitlint/cli": "^17.8.1",
|
|
52
51
|
"@commitlint/config-conventional": "^17.8.1",
|
|
53
52
|
"@iconify/vue": "^4.1.1",
|
|
@@ -77,7 +76,6 @@
|
|
|
77
76
|
"autoprefixer": "^10.4.18",
|
|
78
77
|
"axios": "^0.26.1",
|
|
79
78
|
"babel-loader": "^8.3.0",
|
|
80
|
-
"ckeditor5": "^47.3.0",
|
|
81
79
|
"croppie": "^2.6.5",
|
|
82
80
|
"cz-conventional-changelog": "^3.3.0",
|
|
83
81
|
"eslint": "^8.57.0",
|
|
@@ -1,291 +1,4 @@
|
|
|
1
1
|
body {
|
|
2
|
-
.base-rich-text {
|
|
3
|
-
|
|
4
|
-
&.error {
|
|
5
|
-
.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content, .ck.ck-editor__main > .ck-editor__editable:not(.ck-focused) {
|
|
6
|
-
@apply border-red-500;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/** Style Prose */
|
|
11
|
-
.ck-content {
|
|
12
|
-
|
|
13
|
-
@apply p-3.5;
|
|
14
|
-
|
|
15
|
-
@apply leading-snug;
|
|
16
|
-
|
|
17
|
-
h1, h2, h3, h4, h5, h6 {
|
|
18
|
-
@apply font-bold leading-snug tracking-normal;
|
|
19
|
-
margin-top: 0;
|
|
20
|
-
margin-bottom: 0.375em;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
h1 {
|
|
24
|
-
@apply text-4xl;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
h2 {
|
|
28
|
-
@apply text-3xl;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
h3 {
|
|
32
|
-
@apply text-2xl;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
h4 {
|
|
36
|
-
@apply text-xl;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
h5 {
|
|
40
|
-
@apply text-lg;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
h6 {
|
|
44
|
-
@apply text-base;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
p {
|
|
48
|
-
@apply text-base leading-snug;
|
|
49
|
-
margin: 1em 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
h1,
|
|
53
|
-
h2,
|
|
54
|
-
h3,
|
|
55
|
-
h4,
|
|
56
|
-
h5,
|
|
57
|
-
h6,
|
|
58
|
-
p {
|
|
59
|
-
&:first-child {
|
|
60
|
-
margin-top: 0;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
ol,
|
|
65
|
-
ul {
|
|
66
|
-
@apply text-base leading-snug;
|
|
67
|
-
padding-left: 1.5em;
|
|
68
|
-
margin-bottom: 1em;
|
|
69
|
-
|
|
70
|
-
li {
|
|
71
|
-
@apply leading-snug;
|
|
72
|
-
margin: 0.3em 0;
|
|
73
|
-
|
|
74
|
-
&::before {
|
|
75
|
-
@apply text-slate-500;
|
|
76
|
-
width: 2em;
|
|
77
|
-
left: 3em;
|
|
78
|
-
text-align: left;
|
|
79
|
-
position: absolute;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
blockquote {
|
|
85
|
-
@apply text-base bg-slate-100;
|
|
86
|
-
margin: 1em 0;
|
|
87
|
-
padding: 1em;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
a {
|
|
91
|
-
@apply text-blue-600 underline;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/* Size: xs */
|
|
97
|
-
.base-rich-text-xs {
|
|
98
|
-
.ck-content {
|
|
99
|
-
|
|
100
|
-
@apply p-2.5;
|
|
101
|
-
|
|
102
|
-
h1 {
|
|
103
|
-
@apply text-2xl;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
h2 {
|
|
107
|
-
@apply text-xl;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
h3 {
|
|
111
|
-
@apply text-lg;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
h4 {
|
|
115
|
-
@apply text-base;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
p {
|
|
119
|
-
@apply text-xs;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
ol,
|
|
123
|
-
ul {
|
|
124
|
-
li {
|
|
125
|
-
@apply text-xs;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
blockquote {
|
|
130
|
-
@apply text-xs;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
pre, .ql-syntax {
|
|
134
|
-
@apply text-xs;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/* Size: sm */
|
|
142
|
-
.base-rich-text-sm {
|
|
143
|
-
.ck-content {
|
|
144
|
-
|
|
145
|
-
@apply p-3;
|
|
146
|
-
|
|
147
|
-
h1 {
|
|
148
|
-
@apply text-3xl;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
h2 {
|
|
152
|
-
@apply text-2xl;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
h3 {
|
|
156
|
-
@apply text-xl;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
h4 {
|
|
160
|
-
@apply text-lg;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
p {
|
|
164
|
-
@apply text-sm;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
ol,
|
|
168
|
-
ul {
|
|
169
|
-
li {
|
|
170
|
-
@apply text-sm;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
blockquote {
|
|
175
|
-
@apply text-sm;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
pre, .ql-syntax {
|
|
179
|
-
@apply text-sm;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/* Size: md */
|
|
185
|
-
.base-rich-text-md {
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/* Size: lg */
|
|
190
|
-
.base-rich-text-lg {
|
|
191
|
-
.ck-content {
|
|
192
|
-
|
|
193
|
-
@apply p-5;
|
|
194
|
-
|
|
195
|
-
h1 {
|
|
196
|
-
@apply text-5xl;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
h2 {
|
|
200
|
-
@apply text-4xl;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
h3 {
|
|
204
|
-
@apply text-3xl;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
h4 {
|
|
208
|
-
@apply text-2xl;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
p {
|
|
212
|
-
@apply text-lg;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
ol,
|
|
216
|
-
ul {
|
|
217
|
-
li {
|
|
218
|
-
@apply text-lg;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
blockquote {
|
|
223
|
-
@apply text-lg;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
pre, .ql-syntax {
|
|
227
|
-
@apply text-lg;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/* Size: xl */
|
|
233
|
-
.base-rich-text-xl {
|
|
234
|
-
.ck-content {
|
|
235
|
-
|
|
236
|
-
@apply p-6;
|
|
237
|
-
|
|
238
|
-
h1 {
|
|
239
|
-
@apply text-6xl;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
h2 {
|
|
243
|
-
@apply text-5xl;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
h3 {
|
|
247
|
-
@apply text-2xl;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
h4 {
|
|
251
|
-
@apply text-xl;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
p {
|
|
255
|
-
@apply text-xl;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
ol,
|
|
259
|
-
ul {
|
|
260
|
-
li {
|
|
261
|
-
@apply text-xl;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
blockquote {
|
|
266
|
-
@apply text-xl;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
pre, .ql-syntax {
|
|
270
|
-
@apply text-xl;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.base-rich-text-no-margin {
|
|
276
|
-
.ck-content {
|
|
277
|
-
h1, h2, h3, h4, h5, h6, p, ol, ul {
|
|
278
|
-
margin: 0;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
ol, ul {
|
|
282
|
-
li {
|
|
283
|
-
margin: 0;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
2
|
|
|
290
3
|
/** TipTap */
|
|
291
4
|
|
|
@@ -317,3 +30,16 @@ body .tiptap {
|
|
|
317
30
|
pointer-events: none;
|
|
318
31
|
}
|
|
319
32
|
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
body .tip-tap-no-margin .prose {
|
|
36
|
+
h1, h2, h3, h4, h5, h6, p, ol, ul {
|
|
37
|
+
margin: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ol, ul {
|
|
41
|
+
li {
|
|
42
|
+
margin: 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/assets/main.css
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Popover v-slot="{ open }">
|
|
3
|
-
<PopoverButton
|
|
3
|
+
<PopoverButton
|
|
4
|
+
:class="twButtonInternal"
|
|
5
|
+
>
|
|
4
6
|
<div ref="buttonRef">
|
|
5
7
|
<slot name="button" />
|
|
6
8
|
</div>
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
import { autoUpdate, offset, flip, shift, useFloating, Placement } from '@floating-ui/vue';
|
|
44
46
|
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue';
|
|
45
47
|
import { unrefElement } from '@vueuse/core';
|
|
48
|
+
import { twMerge } from 'tailwind-merge';
|
|
46
49
|
import { PropType } from 'vue';
|
|
47
50
|
|
|
48
51
|
const buttonRef = ref<InstanceType<typeof PopoverButton> | null>(null);
|
|
@@ -62,7 +65,11 @@ const props = defineProps({
|
|
|
62
65
|
placement: {
|
|
63
66
|
default: 'bottom-end',
|
|
64
67
|
type: String as PropType<Placement>,
|
|
65
|
-
}
|
|
68
|
+
},
|
|
69
|
+
twButton: {
|
|
70
|
+
default: 'outline-none',
|
|
71
|
+
type: String,
|
|
72
|
+
},
|
|
66
73
|
});
|
|
67
74
|
|
|
68
75
|
const { floatingStyles } = useFloating(buttonRefEl, dropdownRef, {
|
|
@@ -71,4 +78,11 @@ const { floatingStyles } = useFloating(buttonRefEl, dropdownRef, {
|
|
|
71
78
|
whileElementsMounted: autoUpdate,
|
|
72
79
|
});
|
|
73
80
|
|
|
81
|
+
const twButtonInternal = computed(() => {
|
|
82
|
+
return twMerge(
|
|
83
|
+
'outline-none',
|
|
84
|
+
props.twButton,
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
74
88
|
</script>
|
|
@@ -19,10 +19,6 @@ export default {
|
|
|
19
19
|
placeholder: "This is a custom placeholder...",
|
|
20
20
|
},
|
|
21
21
|
argTypes: {
|
|
22
|
-
driver: {
|
|
23
|
-
control: { type: "select" },
|
|
24
|
-
options: ["ckeditor", "tiptap"],
|
|
25
|
-
},
|
|
26
22
|
editor: {
|
|
27
23
|
control: { type: "select" },
|
|
28
24
|
options: ["classic", "inline", "balloon"],
|
|
@@ -47,35 +43,22 @@ const Template = (args) => ({
|
|
|
47
43
|
`,
|
|
48
44
|
});
|
|
49
45
|
|
|
50
|
-
export const
|
|
51
|
-
|
|
52
|
-
driver: "tiptap",
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const ClassicEditor = Template.bind({});
|
|
56
|
-
ClassicEditor.args = {
|
|
57
|
-
editor: "classic",
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const InlineEditor = Template.bind({});
|
|
61
|
-
InlineEditor.args = {
|
|
62
|
-
editor: "inline",
|
|
46
|
+
export const Demo = Template.bind({});
|
|
47
|
+
Demo.args = {
|
|
63
48
|
};
|
|
64
49
|
|
|
65
|
-
export const
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
export const NoMargin = Template.bind({});
|
|
51
|
+
NoMargin.args = {
|
|
52
|
+
noMargin: true,
|
|
68
53
|
};
|
|
69
54
|
|
|
70
55
|
export const CustomToolbar = Template.bind({});
|
|
71
56
|
CustomToolbar.args = {
|
|
72
|
-
editor: "classic",
|
|
73
57
|
toolbar: [
|
|
74
58
|
"bold",
|
|
75
59
|
"italic",
|
|
76
60
|
"underline",
|
|
77
61
|
"strikethrough",
|
|
78
|
-
"|",
|
|
79
62
|
"undo",
|
|
80
63
|
"redo",
|
|
81
64
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div>
|
|
3
3
|
<BaseTipTap
|
|
4
4
|
:model-value="modelValue"
|
|
5
5
|
:size="sizeInternal"
|
|
@@ -7,36 +7,10 @@
|
|
|
7
7
|
:has-error="hasErrorInternal"
|
|
8
8
|
:placeholder="placeholder"
|
|
9
9
|
:toolbar="toolbar"
|
|
10
|
+
:no-margin="noMargin"
|
|
10
11
|
@update:model-value="emitUpdate"
|
|
11
12
|
/>
|
|
12
13
|
</div>
|
|
13
|
-
<div
|
|
14
|
-
v-else
|
|
15
|
-
class="base-rich-text relative"
|
|
16
|
-
:class="[
|
|
17
|
-
hasErrorInternal ? 'error' : '',
|
|
18
|
-
sizeInternal == 'xs' ? 'base-rich-text-xs' : '',
|
|
19
|
-
sizeInternal == 'sm' ? 'base-rich-text-sm' : '',
|
|
20
|
-
sizeInternal == 'md' ? 'base-rich-text-base' : '',
|
|
21
|
-
sizeInternal == 'lg' ? 'base-rich-text-lg' : '',
|
|
22
|
-
sizeInternal == 'xl' ? 'base-rich-text-xl' : '',
|
|
23
|
-
props.noMargin ? 'base-rich-text-no-margin' : '',
|
|
24
|
-
]"
|
|
25
|
-
>
|
|
26
|
-
<BaseCkeditor
|
|
27
|
-
ref="baseCkeditorRef"
|
|
28
|
-
:model-value="modelValue"
|
|
29
|
-
:editor="editor"
|
|
30
|
-
:size="sizeInternal"
|
|
31
|
-
:toolbar="toolbar"
|
|
32
|
-
:placeholder="placeholder"
|
|
33
|
-
:disabled="disabled"
|
|
34
|
-
@update:model-value="emitUpdate"
|
|
35
|
-
@focus="emit('focus', $event)"
|
|
36
|
-
@blur="emit('blur', $event)"
|
|
37
|
-
@input="emit('input', $event)"
|
|
38
|
-
/>
|
|
39
|
-
</div>
|
|
40
14
|
</template>
|
|
41
15
|
|
|
42
16
|
<script lang="ts" setup>
|
|
@@ -45,16 +19,8 @@ import { Size } from '@/utils/sizes';
|
|
|
45
19
|
import { ToolbarOption } from '@/types/ToolbarOption';
|
|
46
20
|
import BaseTipTap from './BaseTipTap.vue';
|
|
47
21
|
|
|
48
|
-
const BaseCkeditor = defineAsyncComponent(() => import('./BaseCkeditor.vue'));
|
|
49
|
-
|
|
50
22
|
const props = withDefaults(defineProps<{
|
|
51
23
|
modelValue: string | null | undefined;
|
|
52
|
-
driver?: 'ckeditor' | 'tiptap';
|
|
53
|
-
/**
|
|
54
|
-
* Defines the CKEditor layout style.
|
|
55
|
-
* Only applicable when `driver` is 'ckeditor'.
|
|
56
|
-
*/
|
|
57
|
-
editor?: 'classic' | 'inline' | 'balloon';
|
|
58
24
|
size?: Size;
|
|
59
25
|
toolbar?: ToolbarOption[] | string[];
|
|
60
26
|
placeholder?: string;
|
|
@@ -64,7 +30,6 @@ const props = withDefaults(defineProps<{
|
|
|
64
30
|
hasError?: boolean;
|
|
65
31
|
noMargin?: boolean;
|
|
66
32
|
}>(), {
|
|
67
|
-
driver: 'ckeditor',
|
|
68
33
|
editor: 'classic',
|
|
69
34
|
size: 'md',
|
|
70
35
|
toolbar: undefined,
|
|
@@ -77,7 +42,7 @@ const props = withDefaults(defineProps<{
|
|
|
77
42
|
|
|
78
43
|
const emit = defineEmits(['update:modelValue', 'focus', 'blur', 'input']);
|
|
79
44
|
|
|
80
|
-
const {
|
|
45
|
+
const { hasErrorInternal, emitUpdate, sizeInternal } =
|
|
81
46
|
useField({
|
|
82
47
|
name: computed(() => props.name),
|
|
83
48
|
required: computed(() => props.required),
|
|
@@ -86,19 +51,4 @@ const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate, sizeIntern
|
|
|
86
51
|
emit: emit,
|
|
87
52
|
});
|
|
88
53
|
|
|
89
|
-
const baseCkeditorRef = ref<InstanceType<typeof BaseCkeditor> | null>(null);
|
|
90
|
-
|
|
91
|
-
// This make sure that the latest editor data is emitted when the form is submitted
|
|
92
|
-
// If the user types really fast, then press submit really fast, the editor data might not be up to date
|
|
93
|
-
// This is a workaround to make sure that the latest data is emitted
|
|
94
|
-
addBeforeSubmitListener(() => {
|
|
95
|
-
if (!baseCkeditorRef.value) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const latestData = baseCkeditorRef.value.getEditorData();
|
|
100
|
-
|
|
101
|
-
emitUpdate(latestData);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
54
|
</script>
|