@finema/core 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +7 -2
- package/dist/runtime/components/FlexDeck/index.vue +79 -79
- package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
- package/dist/runtime/components/Form/Fields.vue +13 -13
- package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
- package/dist/runtime/components/Form/InputCheckboxGroup/index.vue +21 -21
- package/dist/runtime/components/Form/InputCurrency/index.vue +49 -49
- package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +1 -0
- package/dist/runtime/components/Form/InputDateTime/index.d.vue.ts +1 -0
- package/dist/runtime/components/Form/InputDateTime/index.vue +63 -61
- package/dist/runtime/components/Form/InputDateTime/index.vue.d.ts +1 -0
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +57 -56
- package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
- package/dist/runtime/components/Form/InputSelect/index.vue +46 -46
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +62 -62
- package/dist/runtime/components/Form/InputTags/index.vue +54 -54
- package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
- package/dist/runtime/components/Form/InputTime/index.vue +38 -38
- package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +30 -30
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +50 -50
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +50 -50
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +50 -50
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadExtension.d.ts +9 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadExtension.js +38 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.d.vue.ts +4 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue +104 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue.d.ts +4 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.d.vue.ts +8 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue +147 -0
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue.d.ts +8 -0
- package/dist/runtime/components/Form/InputWYSIWYG/index.d.vue.ts +14 -2
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue +309 -210
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue.d.ts +14 -2
- package/dist/runtime/components/Form/InputWYSIWYG/types.d.ts +12 -52
- package/dist/runtime/components/Form/fileState/EmptyState.vue +21 -21
- package/dist/runtime/components/Form/fileState/FailedState.vue +33 -33
- package/dist/runtime/components/Form/fileState/LoadingState.vue +24 -24
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue +75 -75
- package/dist/runtime/components/Form/fileState/PreviewModal.vue +23 -23
- package/dist/runtime/components/Form/index.vue +5 -5
- package/dist/runtime/components/Image.vue +28 -28
- package/dist/runtime/components/Log/index.vue +17 -17
- package/dist/runtime/components/Table/ColumnDate.vue +1 -1
- package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
- package/dist/runtime/components/Table/ColumnImage.vue +4 -4
- package/dist/runtime/components/Table/ColumnText.vue +1 -1
- package/dist/runtime/components/Table/Pagination.vue +46 -46
- package/dist/runtime/components/Table/Simple.vue +16 -16
- package/dist/runtime/server/tsconfig.json +3 -3
- package/package.json +3 -11
- package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.d.vue.ts +0 -12
- package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue +0 -38
- package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue.d.ts +0 -12
|
@@ -1,72 +1,78 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FieldWrapper v-bind="wrapperProps">
|
|
3
3
|
<div :class="ui.container()">
|
|
4
|
-
<
|
|
5
|
-
v-
|
|
6
|
-
|
|
4
|
+
<Editor
|
|
5
|
+
v-slot="{ editor }"
|
|
6
|
+
v-model="value"
|
|
7
|
+
content-type="html"
|
|
8
|
+
:editable="editable"
|
|
9
|
+
placeholder="Write, type '/' for commands..."
|
|
10
|
+
:autofocus="autoFocus"
|
|
11
|
+
class="min-h-[200px]"
|
|
12
|
+
:extensions="[
|
|
13
|
+
TextAlign.configure({
|
|
14
|
+
types: ['heading', 'paragraph'],
|
|
15
|
+
alignments: ['left', 'center', 'right', 'justify']
|
|
16
|
+
}),
|
|
17
|
+
ImageUpload.configure(image)
|
|
18
|
+
]"
|
|
19
|
+
:ui="{
|
|
20
|
+
content: '',
|
|
21
|
+
base: ['min-h-[200px] w-full sm:px-3 py-1']
|
|
22
|
+
}"
|
|
23
|
+
:handlers="customHandlers"
|
|
7
24
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
:
|
|
11
|
-
:class="ui.
|
|
25
|
+
<EditorToolbar
|
|
26
|
+
:editor="editor"
|
|
27
|
+
:items="toolbarItems"
|
|
28
|
+
:class="ui.toolbar()"
|
|
12
29
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type="button"
|
|
18
|
-
:title="item.title"
|
|
19
|
-
@click="item.action"
|
|
20
|
-
>
|
|
21
|
-
<Icon
|
|
22
|
-
:name="item.icon"
|
|
23
|
-
:class="ui.icon()"
|
|
30
|
+
<template #link>
|
|
31
|
+
<EditorLinkPopover
|
|
32
|
+
:editor="editor"
|
|
33
|
+
auto-open
|
|
24
34
|
/>
|
|
25
|
-
</
|
|
26
|
-
</
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
</template>
|
|
36
|
+
</EditorToolbar>
|
|
37
|
+
<EditorToolbar
|
|
38
|
+
:editor="editor"
|
|
39
|
+
:items="imageToolbarItems(editor)"
|
|
40
|
+
layout="bubble"
|
|
41
|
+
:should-show="({ editor: editor2, view }) => {
|
|
42
|
+
return editor2.isActive('image') && view.hasFocus();
|
|
43
|
+
}"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<EditorSuggestionMenu
|
|
30
47
|
:editor="editor"
|
|
31
|
-
:
|
|
48
|
+
:items="suggestionItems"
|
|
49
|
+
:append-to="appendToBody"
|
|
32
50
|
/>
|
|
33
|
-
|
|
34
|
-
<div
|
|
35
|
-
class="prose min-h-[200px] px-4 py-2"
|
|
36
|
-
v-html="value"
|
|
37
|
-
/>
|
|
38
|
-
</template>
|
|
39
|
-
</ClientOnly>
|
|
51
|
+
</Editor>
|
|
40
52
|
</div>
|
|
41
53
|
</FieldWrapper>
|
|
42
54
|
</template>
|
|
43
55
|
|
|
44
56
|
<script setup>
|
|
45
|
-
import { computed
|
|
46
|
-
import { EditorContent, useEditor } from "@tiptap/vue-3";
|
|
47
|
-
import StarterKit from "@tiptap/starter-kit";
|
|
48
|
-
import Underline from "@tiptap/extension-underline";
|
|
49
|
-
import TextAlign from "@tiptap/extension-text-align";
|
|
50
|
-
import Link from "@tiptap/extension-link";
|
|
51
|
-
import Image from "@tiptap/extension-image";
|
|
52
|
-
import Youtube from "@tiptap/extension-youtube";
|
|
57
|
+
import { computed } from "vue";
|
|
53
58
|
import { useFieldHOC } from "#core/composables/useForm";
|
|
54
59
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
55
60
|
import { wysiwygTheme } from "#core/theme/wysiwyg";
|
|
56
61
|
import { useUiConfig } from "#core/composables/useConfig";
|
|
62
|
+
import { TextAlign } from "@tiptap/extension-text-align";
|
|
63
|
+
import { ImageUpload } from "./EditorImageUploadExtension";
|
|
64
|
+
import EditorLinkPopover from "./EditorLinkPopover.vue";
|
|
57
65
|
const props = defineProps({
|
|
58
|
-
editable: { type: Boolean, required: false },
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
editable: { type: Boolean, required: false, default: () => true },
|
|
67
|
+
image: { type: Object, required: false, default: () => ({
|
|
68
|
+
bodyKey: "file",
|
|
69
|
+
responseURL: "url",
|
|
70
|
+
responsePath: "path",
|
|
71
|
+
responseName: "name",
|
|
72
|
+
responseSize: "size",
|
|
73
|
+
responseID: "id"
|
|
74
|
+
}) },
|
|
61
75
|
toolbar: { type: Object, required: false },
|
|
62
|
-
minHeight: { type: [String, Number], required: false },
|
|
63
|
-
maxHeight: { type: [String, Number], required: false },
|
|
64
|
-
size: { type: String, required: false, default: "md" },
|
|
65
|
-
color: { type: String, required: false, default: "gray" },
|
|
66
|
-
imageUpload: { type: Object, required: false },
|
|
67
|
-
linkOptions: { type: Object, required: false },
|
|
68
|
-
containerUi: { type: null, required: false },
|
|
69
|
-
image: { type: Object, required: false },
|
|
70
76
|
form: { type: Object, required: false },
|
|
71
77
|
name: { type: String, required: true },
|
|
72
78
|
errorMessage: { type: String, required: false },
|
|
@@ -86,196 +92,289 @@ const {
|
|
|
86
92
|
value,
|
|
87
93
|
wrapperProps
|
|
88
94
|
} = useFieldHOC(props);
|
|
89
|
-
const ui = computed(() => useUiConfig(wysiwygTheme, "wysiwyg")({
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return Object.values(props.toolbar).some(Boolean);
|
|
96
|
-
});
|
|
97
|
-
const editor = useEditor({
|
|
98
|
-
content: value.value,
|
|
99
|
-
extensions: [
|
|
100
|
-
StarterKit,
|
|
101
|
-
Underline,
|
|
102
|
-
TextAlign.configure({
|
|
103
|
-
types: ["heading", "paragraph"]
|
|
95
|
+
const ui = computed(() => useUiConfig(wysiwygTheme, "wysiwyg")({}));
|
|
96
|
+
const appendToBody = false ? () => document.body : void 0;
|
|
97
|
+
const customHandlers = {
|
|
98
|
+
imageUpload: {
|
|
99
|
+
canExecute: (editor) => editor.can().insertContent({
|
|
100
|
+
type: "imageUpload"
|
|
104
101
|
}),
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
execute: (editor) => editor.chain().focus().insertContent({
|
|
103
|
+
type: "imageUpload"
|
|
107
104
|
}),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
],
|
|
111
|
-
editorProps: {
|
|
112
|
-
attributes: {
|
|
113
|
-
class: "prose px-4 py-2 focus:outline-none min-h-[200px]"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
onUpdate: ({
|
|
117
|
-
editor: editor2
|
|
118
|
-
}) => {
|
|
119
|
-
value.value = editor2.getHTML();
|
|
105
|
+
isActive: (editor) => editor.isActive("imageUpload"),
|
|
106
|
+
isDisabled: void 0
|
|
120
107
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
108
|
+
};
|
|
109
|
+
const imageToolbarItems = (editor) => {
|
|
110
|
+
const node = editor.state.doc.nodeAt(editor.state.selection.from);
|
|
111
|
+
return [[{
|
|
112
|
+
icon: "i-lucide-download",
|
|
113
|
+
to: node?.attrs?.src,
|
|
114
|
+
download: true,
|
|
115
|
+
tooltip: {
|
|
116
|
+
text: "Download"
|
|
117
|
+
}
|
|
118
|
+
}], [{
|
|
119
|
+
icon: "i-lucide-trash",
|
|
120
|
+
tooltip: {
|
|
121
|
+
text: "Delete"
|
|
122
|
+
},
|
|
123
|
+
onClick: () => {
|
|
124
|
+
const {
|
|
125
|
+
state
|
|
126
|
+
} = editor;
|
|
127
|
+
const {
|
|
128
|
+
selection
|
|
129
|
+
} = state;
|
|
130
|
+
const pos = selection.from;
|
|
131
|
+
const node2 = state.doc.nodeAt(pos);
|
|
132
|
+
if (node2 && node2.type.name === "image") {
|
|
133
|
+
editor.chain().focus().deleteRange({
|
|
134
|
+
from: pos,
|
|
135
|
+
to: pos + node2.nodeSize
|
|
136
|
+
}).run();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}]];
|
|
140
|
+
};
|
|
141
|
+
const toolbarItems = [
|
|
142
|
+
// Block types
|
|
143
|
+
[
|
|
129
144
|
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
145
|
+
icon: "i-lucide-heading",
|
|
146
|
+
tooltip: {
|
|
147
|
+
text: "Headings"
|
|
148
|
+
},
|
|
149
|
+
content: {
|
|
150
|
+
align: "start"
|
|
151
|
+
},
|
|
152
|
+
items: [{
|
|
153
|
+
kind: "heading",
|
|
154
|
+
level: 1,
|
|
155
|
+
icon: "i-lucide-heading-1",
|
|
156
|
+
label: "Heading 1"
|
|
157
|
+
}, {
|
|
158
|
+
kind: "heading",
|
|
159
|
+
level: 2,
|
|
160
|
+
icon: "i-lucide-heading-2",
|
|
161
|
+
label: "Heading 2"
|
|
162
|
+
}, {
|
|
163
|
+
kind: "heading",
|
|
164
|
+
level: 3,
|
|
165
|
+
icon: "i-lucide-heading-3",
|
|
166
|
+
label: "Heading 3"
|
|
167
|
+
}, {
|
|
168
|
+
kind: "heading",
|
|
169
|
+
level: 4,
|
|
170
|
+
icon: "i-lucide-heading-4",
|
|
171
|
+
label: "Heading 4"
|
|
172
|
+
}]
|
|
136
173
|
},
|
|
174
|
+
// Text alignment
|
|
137
175
|
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
176
|
+
icon: "i-lucide-align-justify",
|
|
177
|
+
tooltip: {
|
|
178
|
+
text: "Text Align"
|
|
179
|
+
},
|
|
180
|
+
content: {
|
|
181
|
+
align: "end"
|
|
182
|
+
},
|
|
183
|
+
items: [
|
|
184
|
+
{
|
|
185
|
+
kind: "textAlign",
|
|
186
|
+
align: "left",
|
|
187
|
+
icon: "i-lucide-align-left",
|
|
188
|
+
label: "Align Left"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
kind: "textAlign",
|
|
192
|
+
align: "center",
|
|
193
|
+
icon: "i-lucide-align-center",
|
|
194
|
+
label: "Align Center"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
kind: "textAlign",
|
|
198
|
+
align: "right",
|
|
199
|
+
icon: "i-lucide-align-right",
|
|
200
|
+
label: "Align Right"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
kind: "textAlign",
|
|
204
|
+
align: "justify",
|
|
205
|
+
icon: "i-lucide-align-justify",
|
|
206
|
+
label: "Align Justify"
|
|
207
|
+
}
|
|
208
|
+
]
|
|
144
209
|
},
|
|
145
210
|
{
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
211
|
+
icon: "i-lucide-list",
|
|
212
|
+
tooltip: {
|
|
213
|
+
text: "Lists"
|
|
214
|
+
},
|
|
215
|
+
content: {
|
|
216
|
+
align: "start"
|
|
217
|
+
},
|
|
218
|
+
items: [{
|
|
219
|
+
kind: "bulletList",
|
|
220
|
+
icon: "i-lucide-list",
|
|
221
|
+
label: "Bullet List"
|
|
222
|
+
}, {
|
|
223
|
+
kind: "orderedList",
|
|
224
|
+
icon: "i-lucide-list-ordered",
|
|
225
|
+
label: "Ordered List"
|
|
226
|
+
}]
|
|
227
|
+
},
|
|
155
228
|
{
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
229
|
+
kind: "blockquote",
|
|
230
|
+
icon: "i-lucide-text-quote",
|
|
231
|
+
tooltip: {
|
|
232
|
+
text: "Blockquote"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
kind: "codeBlock",
|
|
237
|
+
icon: "i-lucide-square-code",
|
|
238
|
+
tooltip: {
|
|
239
|
+
text: "Code Block"
|
|
240
|
+
}
|
|
162
241
|
},
|
|
163
242
|
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
title: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E25\u0E33\u0E14\u0E31\u0E1A"
|
|
243
|
+
kind: "horizontalRule",
|
|
244
|
+
icon: "i-lucide-separator-horizontal",
|
|
245
|
+
tooltip: {
|
|
246
|
+
text: "Horizontal Rule"
|
|
247
|
+
}
|
|
170
248
|
}
|
|
171
249
|
],
|
|
172
|
-
|
|
250
|
+
// Text formatting
|
|
251
|
+
[{
|
|
252
|
+
kind: "mark",
|
|
253
|
+
mark: "bold",
|
|
254
|
+
icon: "i-lucide-bold",
|
|
255
|
+
tooltip: {
|
|
256
|
+
text: "Bold"
|
|
257
|
+
}
|
|
258
|
+
}, {
|
|
259
|
+
kind: "mark",
|
|
260
|
+
mark: "italic",
|
|
261
|
+
icon: "i-lucide-italic",
|
|
262
|
+
tooltip: {
|
|
263
|
+
text: "Italic"
|
|
264
|
+
}
|
|
265
|
+
}, {
|
|
266
|
+
kind: "mark",
|
|
267
|
+
mark: "underline",
|
|
268
|
+
icon: "i-lucide-underline",
|
|
269
|
+
tooltip: {
|
|
270
|
+
text: "Underline"
|
|
271
|
+
}
|
|
272
|
+
}, {
|
|
273
|
+
kind: "mark",
|
|
274
|
+
mark: "strike",
|
|
275
|
+
icon: "i-lucide-strikethrough",
|
|
276
|
+
tooltip: {
|
|
277
|
+
text: "Strikethrough"
|
|
278
|
+
}
|
|
279
|
+
}, {
|
|
280
|
+
kind: "mark",
|
|
281
|
+
mark: "code",
|
|
282
|
+
icon: "i-lucide-code",
|
|
283
|
+
tooltip: {
|
|
284
|
+
text: "Code"
|
|
285
|
+
}
|
|
286
|
+
}],
|
|
287
|
+
// Link & image
|
|
288
|
+
[
|
|
289
|
+
{
|
|
290
|
+
slot: "link"
|
|
291
|
+
},
|
|
292
|
+
...props.image?.requestOptions ? [{
|
|
293
|
+
kind: "imageUpload",
|
|
294
|
+
icon: "i-lucide-image"
|
|
295
|
+
}] : []
|
|
296
|
+
],
|
|
297
|
+
// History controls
|
|
298
|
+
[{
|
|
299
|
+
kind: "undo",
|
|
300
|
+
icon: "i-lucide-undo",
|
|
301
|
+
tooltip: {
|
|
302
|
+
text: "Undo"
|
|
303
|
+
}
|
|
304
|
+
}, {
|
|
305
|
+
kind: "redo",
|
|
306
|
+
icon: "i-lucide-redo",
|
|
307
|
+
tooltip: {
|
|
308
|
+
text: "Redo"
|
|
309
|
+
}
|
|
310
|
+
}]
|
|
311
|
+
];
|
|
312
|
+
const suggestionItems = [
|
|
313
|
+
[
|
|
314
|
+
{
|
|
315
|
+
type: "label",
|
|
316
|
+
label: "Text"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
kind: "paragraph",
|
|
320
|
+
label: "Paragraph",
|
|
321
|
+
icon: "i-lucide-type"
|
|
322
|
+
},
|
|
173
323
|
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
isActive: () => editor.value?.isActive({
|
|
179
|
-
textAlign: "left"
|
|
180
|
-
}) || false,
|
|
181
|
-
title: "\u0E08\u0E31\u0E14\u0E0A\u0E34\u0E14\u0E0B\u0E49\u0E32\u0E22"
|
|
324
|
+
kind: "heading",
|
|
325
|
+
level: 1,
|
|
326
|
+
label: "Heading 1",
|
|
327
|
+
icon: "i-lucide-heading-1"
|
|
182
328
|
},
|
|
183
329
|
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
isActive: () => editor.value?.isActive({
|
|
189
|
-
textAlign: "center"
|
|
190
|
-
}) || false,
|
|
191
|
-
title: "\u0E08\u0E31\u0E14\u0E01\u0E36\u0E48\u0E07\u0E01\u0E25\u0E32\u0E07"
|
|
330
|
+
kind: "heading",
|
|
331
|
+
level: 2,
|
|
332
|
+
label: "Heading 2",
|
|
333
|
+
icon: "i-lucide-heading-2"
|
|
192
334
|
},
|
|
193
335
|
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
isActive: () => editor.value?.isActive({
|
|
199
|
-
textAlign: "right"
|
|
200
|
-
}) || false,
|
|
201
|
-
title: "\u0E08\u0E31\u0E14\u0E0A\u0E34\u0E14\u0E02\u0E27\u0E32"
|
|
336
|
+
kind: "heading",
|
|
337
|
+
level: 3,
|
|
338
|
+
label: "Heading 3",
|
|
339
|
+
icon: "i-lucide-heading-3"
|
|
202
340
|
}
|
|
203
341
|
],
|
|
204
|
-
|
|
342
|
+
[
|
|
205
343
|
{
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
icon: "ph:link-simple",
|
|
209
|
-
action: () => {
|
|
210
|
-
const url = window.prompt("URL");
|
|
211
|
-
if (url) {
|
|
212
|
-
editor.value?.chain().focus().setLink({
|
|
213
|
-
href: url
|
|
214
|
-
}).run();
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
isActive: () => editor.value?.isActive("link") || false,
|
|
218
|
-
title: "\u0E41\u0E17\u0E23\u0E01\u0E25\u0E34\u0E07\u0E01\u0E4C"
|
|
344
|
+
type: "label",
|
|
345
|
+
label: "Lists"
|
|
219
346
|
},
|
|
220
347
|
{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
icon: "
|
|
224
|
-
action: () => {
|
|
225
|
-
const url = window.prompt("URL \u0E23\u0E39\u0E1B\u0E20\u0E32\u0E1E");
|
|
226
|
-
if (url) {
|
|
227
|
-
editor.value?.chain().focus().setImage({
|
|
228
|
-
src: url
|
|
229
|
-
}).run();
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
title: "\u0E41\u0E17\u0E23\u0E01\u0E23\u0E39\u0E1B\u0E20\u0E32\u0E1E"
|
|
348
|
+
kind: "bulletList",
|
|
349
|
+
label: "Bullet List",
|
|
350
|
+
icon: "i-lucide-list"
|
|
233
351
|
},
|
|
234
352
|
{
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
icon: "
|
|
238
|
-
action: () => {
|
|
239
|
-
const url = window.prompt("URL \u0E27\u0E34\u0E14\u0E35\u0E42\u0E2D");
|
|
240
|
-
if (url) {
|
|
241
|
-
editor.value?.chain().focus().setYoutubeVideo({
|
|
242
|
-
src: url
|
|
243
|
-
}).run();
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
title: "\u0E41\u0E17\u0E23\u0E01\u0E27\u0E34\u0E14\u0E35\u0E42\u0E2D"
|
|
353
|
+
kind: "orderedList",
|
|
354
|
+
label: "Numbered List",
|
|
355
|
+
icon: "i-lucide-list-ordered"
|
|
247
356
|
}
|
|
248
357
|
],
|
|
249
|
-
|
|
358
|
+
[
|
|
359
|
+
{
|
|
360
|
+
type: "label",
|
|
361
|
+
label: "Insert"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
kind: "blockquote",
|
|
365
|
+
label: "Blockquote",
|
|
366
|
+
icon: "i-lucide-text-quote"
|
|
367
|
+
},
|
|
250
368
|
{
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
icon: "
|
|
254
|
-
action: () => editor.value?.chain().focus().undo().run(),
|
|
255
|
-
title: "\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33"
|
|
369
|
+
kind: "codeBlock",
|
|
370
|
+
label: "Code Block",
|
|
371
|
+
icon: "i-lucide-square-code"
|
|
256
372
|
},
|
|
257
373
|
{
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
icon: "
|
|
261
|
-
action: () => editor.value?.chain().focus().redo().run(),
|
|
262
|
-
title: "\u0E17\u0E33\u0E43\u0E2B\u0E21\u0E48"
|
|
374
|
+
kind: "horizontalRule",
|
|
375
|
+
label: "Divider",
|
|
376
|
+
icon: "i-lucide-separator-horizontal"
|
|
263
377
|
}
|
|
264
378
|
]
|
|
265
|
-
|
|
266
|
-
const menuItems = computed(() => {
|
|
267
|
-
const items = [];
|
|
268
|
-
Object.entries(toolbarConfig).forEach(([groupKey, groupItems]) => {
|
|
269
|
-
const enabledItems = groupItems.filter((item) => {
|
|
270
|
-
if (groupKey === "textAlign") {
|
|
271
|
-
return props.toolbar?.textAlign;
|
|
272
|
-
}
|
|
273
|
-
return props.toolbar?.[item.key];
|
|
274
|
-
});
|
|
275
|
-
if (enabledItems.length > 0) {
|
|
276
|
-
items.push(enabledItems);
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
return items;
|
|
280
|
-
});
|
|
379
|
+
];
|
|
281
380
|
</script>
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { IWYSIWYGFieldProps } from '#core/components/Form/InputWYSIWYG/types';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<IWYSIWYGFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IWYSIWYGFieldProps> & Readonly<{}>, {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
image: {
|
|
4
|
+
requestOptions?: Omit<import("axios").AxiosRequestConfig, "baseURL"> & {
|
|
5
|
+
baseURL: string;
|
|
6
|
+
};
|
|
7
|
+
uploadPathURL?: string;
|
|
8
|
+
bodyKey?: string;
|
|
9
|
+
responseURL?: string;
|
|
10
|
+
responsePath?: string;
|
|
11
|
+
responseName?: string;
|
|
12
|
+
responseSize?: string;
|
|
13
|
+
responseID?: string;
|
|
14
|
+
maxSize?: number;
|
|
15
|
+
};
|
|
16
|
+
editable: boolean;
|
|
5
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
18
|
declare const _default: typeof __VLS_export;
|
|
7
19
|
export default _default;
|
|
@@ -3,60 +3,20 @@ import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '#core/components/
|
|
|
3
3
|
import type { AxiosRequestConfig } from 'axios';
|
|
4
4
|
export interface IWYSIWYGFieldProps extends IFieldProps {
|
|
5
5
|
editable?: boolean;
|
|
6
|
-
autofocus?: boolean;
|
|
7
|
-
content?: string;
|
|
8
|
-
toolbar?: {
|
|
9
|
-
bold?: boolean;
|
|
10
|
-
italic?: boolean;
|
|
11
|
-
underline?: boolean;
|
|
12
|
-
strike?: boolean;
|
|
13
|
-
code?: boolean;
|
|
14
|
-
heading?: boolean | number[];
|
|
15
|
-
paragraph?: boolean;
|
|
16
|
-
bulletList?: boolean;
|
|
17
|
-
orderedList?: boolean;
|
|
18
|
-
blockquote?: boolean;
|
|
19
|
-
codeBlock?: boolean;
|
|
20
|
-
horizontalRule?: boolean;
|
|
21
|
-
link?: boolean;
|
|
22
|
-
image?: {
|
|
23
|
-
requestOptions?: Omit<AxiosRequestConfig, 'baseURL'> & {
|
|
24
|
-
baseURL: string;
|
|
25
|
-
};
|
|
26
|
-
uploadPathURL?: string;
|
|
27
|
-
bodyKey?: string;
|
|
28
|
-
responseURL?: string;
|
|
29
|
-
responsePath?: string;
|
|
30
|
-
responseName?: string;
|
|
31
|
-
responseSize?: string;
|
|
32
|
-
responseID?: string;
|
|
33
|
-
accept?: string[] | string;
|
|
34
|
-
maxSize?: number;
|
|
35
|
-
} | boolean;
|
|
36
|
-
youtube?: boolean;
|
|
37
|
-
textAlign?: boolean;
|
|
38
|
-
undo?: boolean;
|
|
39
|
-
redo?: boolean;
|
|
40
|
-
};
|
|
41
|
-
minHeight?: string | number;
|
|
42
|
-
maxHeight?: string | number;
|
|
43
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
44
|
-
color?: 'primary' | 'gray';
|
|
45
|
-
imageUpload?: {
|
|
46
|
-
enabled?: boolean;
|
|
47
|
-
uploadUrl?: string;
|
|
48
|
-
maxSize?: number;
|
|
49
|
-
accept?: string[];
|
|
50
|
-
headers?: Record<string, string>;
|
|
51
|
-
};
|
|
52
|
-
linkOptions?: {
|
|
53
|
-
openOnClick?: boolean;
|
|
54
|
-
HTMLAttributes?: Record<string, any>;
|
|
55
|
-
};
|
|
56
|
-
containerUi?: any;
|
|
57
6
|
image?: {
|
|
58
|
-
requestOptions?:
|
|
7
|
+
requestOptions?: Omit<AxiosRequestConfig, 'baseURL'> & {
|
|
8
|
+
baseURL: string;
|
|
9
|
+
};
|
|
10
|
+
uploadPathURL?: string;
|
|
11
|
+
bodyKey?: string;
|
|
12
|
+
responseURL?: string;
|
|
13
|
+
responsePath?: string;
|
|
14
|
+
responseName?: string;
|
|
15
|
+
responseSize?: string;
|
|
16
|
+
responseID?: string;
|
|
17
|
+
maxSize?: number;
|
|
59
18
|
};
|
|
19
|
+
toolbar?: {};
|
|
60
20
|
}
|
|
61
21
|
export type IWYSIWYGField = IFormFieldBase<INPUT_TYPES.WYSIWYG, IWYSIWYGFieldProps, {
|
|
62
22
|
change?: (content: string) => void;
|