@finema/core 3.22.0 → 3.24.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/README.md +22 -2
- package/dist/module.d.mts +2 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +18 -15
- package/dist/runtime/components/App.vue +1 -1
- package/dist/runtime/components/DevToolsWindow/index.vue +24 -26
- package/dist/runtime/components/Dialog/index.d.vue.ts +1 -4
- package/dist/runtime/components/Dialog/index.vue +17 -17
- package/dist/runtime/components/Dialog/index.vue.d.ts +1 -4
- package/dist/runtime/components/Empty.d.vue.ts +1 -2
- package/dist/runtime/components/Empty.vue +19 -11
- package/dist/runtime/components/Empty.vue.d.ts +1 -2
- package/dist/runtime/components/FlexDeck/index.vue +21 -23
- package/dist/runtime/components/Form/FieldWrapper.vue +1 -1
- package/dist/runtime/components/Form/Fields.d.vue.ts +1 -1
- package/dist/runtime/components/Form/Fields.vue +26 -20
- package/dist/runtime/components/Form/Fields.vue.d.ts +1 -1
- package/dist/runtime/components/Form/InputCheckbox/index.vue +3 -6
- package/dist/runtime/components/Form/InputCheckboxGroup/index.vue +3 -6
- package/dist/runtime/components/Form/InputComponent/index.vue +2 -1
- package/dist/runtime/components/Form/InputCurrency/index.vue +11 -11
- package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +3 -1
- package/dist/runtime/components/Form/InputDateTime/index.vue +12 -17
- package/dist/runtime/components/Form/InputDateTimeRange/date_range_time_field.types.d.ts +1 -1
- package/dist/runtime/components/Form/InputDateTimeRange/index.vue +28 -20
- package/dist/runtime/components/Form/InputMonth/index.vue +14 -12
- package/dist/runtime/components/Form/InputMonth/types.d.ts +1 -1
- package/dist/runtime/components/Form/InputNumber/index.vue +3 -6
- package/dist/runtime/components/Form/InputRadio/index.vue +3 -6
- package/dist/runtime/components/Form/InputRating/index.vue +3 -6
- package/dist/runtime/components/Form/InputSearch/index.vue +6 -7
- package/dist/runtime/components/Form/InputSelect/index.vue +6 -15
- package/dist/runtime/components/Form/InputSelectMultiple/index.vue +7 -18
- package/dist/runtime/components/Form/InputTags/index.vue +3 -6
- package/dist/runtime/components/Form/InputText/index.vue +41 -51
- package/dist/runtime/components/Form/InputTextarea/index.vue +3 -6
- package/dist/runtime/components/Form/InputTime/index.vue +32 -27
- package/dist/runtime/components/Form/InputTime/types.d.ts +1 -1
- package/dist/runtime/components/Form/InputToggle/index.vue +3 -5
- package/dist/runtime/components/Form/InputUploadDropzone/index.d.vue.ts +1 -4
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +25 -23
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue.d.ts +1 -4
- package/dist/runtime/components/Form/InputUploadDropzone/types.d.ts +2 -2
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.d.vue.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +22 -23
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue.d.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.d.vue.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +26 -24
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue.d.ts +0 -5
- package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputUploadImageAuto/index.d.vue.ts +1 -6
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +22 -23
- package/dist/runtime/components/Form/InputUploadImageAuto/index.vue.d.ts +1 -6
- package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +3 -3
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImagePasteExtension.js +7 -6
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadExtension.js +13 -12
- package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue +3 -1
- package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue +20 -22
- package/dist/runtime/components/Form/InputWYSIWYG/index.vue +140 -118
- package/dist/runtime/components/Form/fileState/EmptyState.vue +1 -1
- package/dist/runtime/components/Form/fileState/FailedState.vue +4 -2
- package/dist/runtime/components/Form/fileState/MultipleFilesState.d.vue.ts +4 -4
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue +5 -5
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue.d.ts +4 -4
- package/dist/runtime/components/Form/fileState/SuccessState.d.vue.ts +2 -2
- package/dist/runtime/components/Form/fileState/SuccessState.vue +8 -13
- package/dist/runtime/components/Form/fileState/SuccessState.vue.d.ts +2 -2
- package/dist/runtime/components/Form/fileState/useFilePicker.d.ts +34 -0
- package/dist/runtime/components/Form/fileState/useFilePicker.js +48 -0
- package/dist/runtime/components/Form/fileState/useFileState.d.ts +7 -9
- package/dist/runtime/components/Form/fileState/useFileState.js +32 -120
- package/dist/runtime/components/Form/fileState/useUploadImageState.d.ts +7 -8
- package/dist/runtime/components/Form/fileState/useUploadImageState.js +27 -301
- package/dist/runtime/components/Form/fileState/useUploadState.d.ts +11 -7
- package/dist/runtime/components/Form/fileState/useUploadState.js +52 -136
- package/dist/runtime/components/Form/fileState/useUploadStateMultiple.d.ts +12 -18
- package/dist/runtime/components/Form/fileState/useUploadStateMultiple.js +88 -226
- package/dist/runtime/components/Form/types.d.ts +2 -0
- package/dist/runtime/components/Image.vue +4 -10
- package/dist/runtime/components/Loader.d.vue.ts +2 -1
- package/dist/runtime/components/Loader.vue +10 -7
- package/dist/runtime/components/Loader.vue.d.ts +2 -1
- package/dist/runtime/components/Log/LogItem.vue +1 -3
- package/dist/runtime/components/Log/index.vue +1 -3
- package/dist/runtime/components/Table/Base.d.vue.ts +15 -1
- package/dist/runtime/components/Table/Base.vue +9 -29
- package/dist/runtime/components/Table/Base.vue.d.ts +15 -1
- package/dist/runtime/components/Table/ColumnText.d.vue.ts +2 -3
- package/dist/runtime/components/Table/ColumnText.vue +1 -1
- package/dist/runtime/components/Table/ColumnText.vue.d.ts +2 -3
- package/dist/runtime/components/Table/Pagination.vue +19 -22
- package/dist/runtime/components/Table/index.d.vue.ts +1 -1
- package/dist/runtime/components/Table/index.vue +5 -7
- package/dist/runtime/components/Table/index.vue.d.ts +1 -1
- package/dist/runtime/composables/loaderList.d.ts +2 -1
- package/dist/runtime/composables/loaderList.js +3 -4
- package/dist/runtime/composables/loaderObject.d.ts +2 -1
- package/dist/runtime/composables/loaderObject.js +2 -1
- package/dist/runtime/composables/loaderPage.js +223 -350
- package/dist/runtime/composables/useConfig.js +4 -3
- package/dist/runtime/composables/useDialog.js +3 -1
- package/dist/runtime/composables/useForm.d.ts +2 -2
- package/dist/runtime/composables/useForm.js +2 -4
- package/dist/runtime/composables/useMessages.d.ts +10 -0
- package/dist/runtime/composables/useMessages.js +10 -0
- package/dist/runtime/composables/useTable.js +2 -14
- package/dist/runtime/helpers/apiBaseHelper.js +6 -24
- package/dist/runtime/helpers/apiListHelper.js +2 -5
- package/dist/runtime/helpers/apiObjectHelper.js +2 -5
- package/dist/runtime/helpers/apiPageHelper.d.ts +0 -1
- package/dist/runtime/helpers/apiPageHelper.js +19 -38
- package/dist/runtime/helpers/componentHelper.js +2 -6
- package/dist/runtime/helpers/uploadCore.d.ts +54 -0
- package/dist/runtime/helpers/uploadCore.js +81 -0
- package/dist/runtime/i18n/valibot.d.ts +5 -68
- package/dist/runtime/i18n/valibot.js +33 -29
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +42 -0
- package/dist/runtime/locale/index.d.ts +7 -0
- package/dist/runtime/locale/index.js +5 -0
- package/dist/runtime/locale/th.d.ts +43 -0
- package/dist/runtime/locale/th.js +42 -0
- package/dist/runtime/server/tsconfig.json +1 -1
- package/dist/runtime/styles/main.css +1 -1
- package/dist/runtime/utils/ParamHelper.js +1 -1
- package/dist/runtime/utils/StringHelper.js +1 -4
- package/dist/runtime/utils/TimeHelper.js +2 -2
- package/dist/runtime/utils/lodash.js +2 -2
- package/package.json +57 -36
|
@@ -21,7 +21,7 @@ export interface IUploadDropzoneAutoMultipleProps extends IFieldProps {
|
|
|
21
21
|
retryLabel?: string;
|
|
22
22
|
}
|
|
23
23
|
export type IUploadDropzoneAutoMultipleField = IFormFieldBase<INPUT_TYPES.UPLOAD_DROPZONE_AUTO_MULTIPLE, IUploadDropzoneAutoMultipleProps, {
|
|
24
|
-
change
|
|
25
|
-
success
|
|
26
|
-
delete
|
|
24
|
+
change?: (value: File[] | undefined) => void;
|
|
25
|
+
success?: (res: any) => void;
|
|
26
|
+
delete?: (index: number, value: IFileValue) => void;
|
|
27
27
|
}>;
|
|
@@ -9,18 +9,13 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadImageAutoProps,
|
|
|
9
9
|
onDelete?: (() => any) | undefined;
|
|
10
10
|
onChange?: ((value: File | undefined) => any) | undefined;
|
|
11
11
|
}>, {
|
|
12
|
-
|
|
13
|
-
selectFileSubLabel: string;
|
|
14
|
-
uploadingLabel: string;
|
|
15
|
-
uploadFailedLabel: string;
|
|
16
|
-
retryLabel: string;
|
|
12
|
+
accept: string[] | string;
|
|
17
13
|
bodyKey: string;
|
|
18
14
|
responseURL: string;
|
|
19
15
|
responsePath: string;
|
|
20
16
|
responseName: string;
|
|
21
17
|
responseSize: string;
|
|
22
18
|
responseID: string;
|
|
23
|
-
accept: string[] | string;
|
|
24
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
20
|
declare const _default: typeof __VLS_export;
|
|
26
21
|
export default _default;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
<EmptyState
|
|
10
10
|
v-if="uploadState.isEmpty.value"
|
|
11
11
|
:theme="theme"
|
|
12
|
-
:select-file-label="selectFileLabel"
|
|
13
|
-
:select-file-sub-label="selectFileSubLabel"
|
|
12
|
+
:select-file-label="selectFileLabel ?? messages.upload.selectImage"
|
|
13
|
+
:select-file-sub-label="selectFileSubLabel ?? messages.upload.dropHere"
|
|
14
14
|
:placeholder="placeholder"
|
|
15
15
|
@open-file="uploadState.handleOpenFile"
|
|
16
16
|
/>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:theme="theme"
|
|
22
22
|
:selected-file="uploadState.selectedFile.value"
|
|
23
23
|
:percent="uploadState.percent.value"
|
|
24
|
-
:uploading-label="uploadingLabel"
|
|
24
|
+
:uploading-label="uploadingLabel ?? messages.upload.uploading"
|
|
25
25
|
/>
|
|
26
26
|
|
|
27
27
|
<!-- Success State -->
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
v-if="uploadState.isError.value"
|
|
42
42
|
:theme="theme"
|
|
43
43
|
:selected-file="uploadState.selectedFile.value"
|
|
44
|
-
:upload-failed-label="uploadFailedLabel"
|
|
45
|
-
:retry-label="retryLabel"
|
|
44
|
+
:upload-failed-label="uploadFailedLabel ?? messages.upload.uploadFailed"
|
|
45
|
+
:retry-label="retryLabel ?? messages.upload.retry"
|
|
46
46
|
@retry="uploadState.handleRetryUpload"
|
|
47
47
|
@delete="uploadState.handleDeleteFile"
|
|
48
48
|
/>
|
|
@@ -62,6 +62,7 @@ import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
|
62
62
|
import { useFieldHOC } from "#core/composables/useForm";
|
|
63
63
|
import { uploadFileDropzoneTheme } from "#core/theme/uploadFileDropzone";
|
|
64
64
|
import { useUiConfig } from "#core/composables/useConfig";
|
|
65
|
+
import { useCoreMessages } from "#core/composables/useMessages";
|
|
65
66
|
import { downloadFileFromURL } from "#core/helpers/componentHelper";
|
|
66
67
|
const emits = defineEmits(["change", "success", "delete"]);
|
|
67
68
|
const props = defineProps({
|
|
@@ -76,11 +77,11 @@ const props = defineProps({
|
|
|
76
77
|
accept: { type: [Array, String], required: false, default: () => ["image/*"] },
|
|
77
78
|
maxSize: { type: Number, required: false },
|
|
78
79
|
dimensions: { type: Object, required: false },
|
|
79
|
-
selectFileLabel: { type: String, required: false
|
|
80
|
-
selectFileSubLabel: { type: String, required: false
|
|
81
|
-
uploadingLabel: { type: String, required: false
|
|
82
|
-
uploadFailedLabel: { type: String, required: false
|
|
83
|
-
retryLabel: { type: String, required: false
|
|
80
|
+
selectFileLabel: { type: String, required: false },
|
|
81
|
+
selectFileSubLabel: { type: String, required: false },
|
|
82
|
+
uploadingLabel: { type: String, required: false },
|
|
83
|
+
uploadFailedLabel: { type: String, required: false },
|
|
84
|
+
retryLabel: { type: String, required: false },
|
|
84
85
|
form: { type: Object, required: false },
|
|
85
86
|
name: { type: String, required: true },
|
|
86
87
|
errorMessage: { type: String, required: false },
|
|
@@ -94,19 +95,14 @@ const props = defineProps({
|
|
|
94
95
|
readonly: { type: Boolean, required: false },
|
|
95
96
|
required: { type: Boolean, required: false },
|
|
96
97
|
help: { type: String, required: false },
|
|
97
|
-
ui: { type: null, required: false }
|
|
98
|
+
ui: { type: null, required: false },
|
|
99
|
+
containerUi: { type: null, required: false }
|
|
98
100
|
});
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
setErrors,
|
|
103
|
-
value
|
|
104
|
-
} = useFieldHOC(props);
|
|
105
|
-
const acceptedFileTypes = computed(
|
|
106
|
-
() => typeof props.accept === "string" ? props.accept : props.accept?.join(",")
|
|
107
|
-
);
|
|
101
|
+
const { messages } = useCoreMessages();
|
|
102
|
+
const { wrapperProps, handleChange: onChange, setErrors, value } = useFieldHOC(props);
|
|
103
|
+
const acceptedFileTypes = computed(() => typeof props.accept === "string" ? props.accept : props.accept?.join(","));
|
|
108
104
|
const dropzoneRef = useTemplateRef("dropzoneRef");
|
|
109
|
-
const uploadState = useUploadImageState(
|
|
105
|
+
const uploadState = useUploadImageState({
|
|
110
106
|
props,
|
|
111
107
|
emits,
|
|
112
108
|
onChange,
|
|
@@ -115,9 +111,12 @@ const uploadState = useUploadImageState(
|
|
|
115
111
|
acceptedFileTypes,
|
|
116
112
|
wrapperProps,
|
|
117
113
|
dropzoneRef
|
|
118
|
-
);
|
|
114
|
+
});
|
|
119
115
|
const theme = computed(
|
|
120
|
-
() => useUiConfig(
|
|
116
|
+
() => useUiConfig(
|
|
117
|
+
uploadFileDropzoneTheme,
|
|
118
|
+
"uploadFileDropzone"
|
|
119
|
+
)({
|
|
121
120
|
dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
|
|
122
121
|
disabled: wrapperProps.value.disabled,
|
|
123
122
|
failed: uploadState.upload.status.value.isError
|
|
@@ -9,18 +9,13 @@ declare const __VLS_export: import("vue").DefineComponent<IUploadImageAutoProps,
|
|
|
9
9
|
onDelete?: (() => any) | undefined;
|
|
10
10
|
onChange?: ((value: File | undefined) => any) | undefined;
|
|
11
11
|
}>, {
|
|
12
|
-
|
|
13
|
-
selectFileSubLabel: string;
|
|
14
|
-
uploadingLabel: string;
|
|
15
|
-
uploadFailedLabel: string;
|
|
16
|
-
retryLabel: string;
|
|
12
|
+
accept: string[] | string;
|
|
17
13
|
bodyKey: string;
|
|
18
14
|
responseURL: string;
|
|
19
15
|
responsePath: string;
|
|
20
16
|
responseName: string;
|
|
21
17
|
responseSize: string;
|
|
22
18
|
responseID: string;
|
|
23
|
-
accept: string[] | string;
|
|
24
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
20
|
declare const _default: typeof __VLS_export;
|
|
26
21
|
export default _default;
|
|
@@ -31,7 +31,7 @@ export interface IUploadImageAutoProps extends IFieldProps {
|
|
|
31
31
|
retryLabel?: string;
|
|
32
32
|
}
|
|
33
33
|
export type IUploadImageAutoField = IFormFieldBase<INPUT_TYPES.UPLOAD_IMAGE_AUTO, IUploadImageAutoProps, {
|
|
34
|
-
change
|
|
35
|
-
success
|
|
36
|
-
delete
|
|
34
|
+
change?: (value: File | undefined) => void;
|
|
35
|
+
success?: (res: any) => void;
|
|
36
|
+
delete?: () => void;
|
|
37
37
|
}>;
|
|
@@ -39,14 +39,15 @@ export const ImagePaste = Extension.create({
|
|
|
39
39
|
console.warn("ImagePaste: requestOptions is not configured");
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
|
-
const {
|
|
43
|
-
schema
|
|
44
|
-
} = view.state;
|
|
42
|
+
const { schema } = view.state;
|
|
45
43
|
const pos = view.state.selection.from;
|
|
46
44
|
if (schema.nodes.imageUpload) {
|
|
47
|
-
const transaction = view.state.tr.insert(
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
const transaction = view.state.tr.insert(
|
|
46
|
+
pos,
|
|
47
|
+
schema.nodes.imageUpload.create({
|
|
48
|
+
loading: true
|
|
49
|
+
})
|
|
50
|
+
);
|
|
50
51
|
view.dispatch(transaction);
|
|
51
52
|
}
|
|
52
53
|
const request = {
|
|
@@ -10,25 +10,26 @@ export const ImageUpload = Node.create({
|
|
|
10
10
|
return {};
|
|
11
11
|
},
|
|
12
12
|
parseHTML() {
|
|
13
|
-
return [
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
tag: 'div[data-type="image-upload"]'
|
|
16
|
+
}
|
|
17
|
+
];
|
|
16
18
|
},
|
|
17
|
-
renderHTML({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
renderHTML({ HTMLAttributes }) {
|
|
20
|
+
return [
|
|
21
|
+
"div",
|
|
22
|
+
mergeAttributes(HTMLAttributes, {
|
|
23
|
+
"data-type": "image-upload"
|
|
24
|
+
})
|
|
25
|
+
];
|
|
23
26
|
},
|
|
24
27
|
addNodeView() {
|
|
25
28
|
return VueNodeViewRenderer(ImageUploadNodeComponent);
|
|
26
29
|
},
|
|
27
30
|
addCommands() {
|
|
28
31
|
return {
|
|
29
|
-
insertImageUpload: () => ({
|
|
30
|
-
commands
|
|
31
|
-
}) => {
|
|
32
|
+
insertImageUpload: () => ({ commands }) => {
|
|
32
33
|
return commands.insertContent({
|
|
33
34
|
type: this.name
|
|
34
35
|
});
|
|
@@ -38,7 +38,9 @@ const props = defineProps({
|
|
|
38
38
|
extension: { type: Object, required: true },
|
|
39
39
|
HTMLAttributes: { type: Object, required: true }
|
|
40
40
|
});
|
|
41
|
-
const options = computed(
|
|
41
|
+
const options = computed(
|
|
42
|
+
() => props.extension.options
|
|
43
|
+
);
|
|
42
44
|
const file = ref(null);
|
|
43
45
|
const loading = ref(false);
|
|
44
46
|
watch(file, async (newFile) => {
|
|
@@ -9,27 +9,27 @@ const url = ref("");
|
|
|
9
9
|
const active = computed(() => props.editor.isActive("link"));
|
|
10
10
|
const disabled = computed(() => {
|
|
11
11
|
if (!props.editor.isEditable) return true;
|
|
12
|
-
const {
|
|
13
|
-
selection
|
|
14
|
-
} = props.editor.state;
|
|
12
|
+
const { selection } = props.editor.state;
|
|
15
13
|
return selection.empty && !props.editor.isActive("link");
|
|
16
14
|
});
|
|
17
|
-
watch(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
watch(
|
|
16
|
+
() => props.editor,
|
|
17
|
+
(editor, _, onCleanup) => {
|
|
18
|
+
if (!editor) return;
|
|
19
|
+
const updateUrl = () => {
|
|
20
|
+
const { href } = editor.getAttributes("link");
|
|
21
|
+
url.value = href || "";
|
|
22
|
+
};
|
|
23
|
+
updateUrl();
|
|
24
|
+
editor.on("selectionUpdate", updateUrl);
|
|
25
|
+
onCleanup(() => {
|
|
26
|
+
editor.off("selectionUpdate", updateUrl);
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
immediate: true
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
33
|
watch(active, (isActive) => {
|
|
34
34
|
if (isActive && props.autoOpen) {
|
|
35
35
|
open.value = true;
|
|
@@ -37,9 +37,7 @@ watch(active, (isActive) => {
|
|
|
37
37
|
});
|
|
38
38
|
const setLink = () => {
|
|
39
39
|
if (!url.value) return;
|
|
40
|
-
const {
|
|
41
|
-
selection
|
|
42
|
-
} = props.editor.state;
|
|
40
|
+
const { selection } = props.editor.state;
|
|
43
41
|
const isEmpty = selection.empty;
|
|
44
42
|
const hasCode = props.editor.isActive("code");
|
|
45
43
|
let chain = props.editor.chain().focus();
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]"
|
|
19
19
|
:ui="{
|
|
20
20
|
content: '',
|
|
21
|
-
base: ['min-h-[200px] w-full sm:px-3
|
|
21
|
+
base: ['min-h-[200px] w-full py-1 sm:px-3']
|
|
22
22
|
}"
|
|
23
23
|
:handlers="customHandlers"
|
|
24
24
|
>
|
|
@@ -38,9 +38,11 @@
|
|
|
38
38
|
:editor="editor"
|
|
39
39
|
:items="imageToolbarItems(editor)"
|
|
40
40
|
layout="bubble"
|
|
41
|
-
:should-show="
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
:should-show="
|
|
42
|
+
({ editor: editor2, view }) => {
|
|
43
|
+
return editor2.isActive('image') && view.hasFocus();
|
|
44
|
+
}
|
|
45
|
+
"
|
|
44
46
|
/>
|
|
45
47
|
|
|
46
48
|
<EditorSuggestionMenu
|
|
@@ -87,12 +89,10 @@ const props = defineProps({
|
|
|
87
89
|
readonly: { type: Boolean, required: false },
|
|
88
90
|
required: { type: Boolean, required: false },
|
|
89
91
|
help: { type: String, required: false },
|
|
90
|
-
ui: { type: null, required: false }
|
|
92
|
+
ui: { type: null, required: false },
|
|
93
|
+
containerUi: { type: null, required: false }
|
|
91
94
|
});
|
|
92
|
-
const {
|
|
93
|
-
value,
|
|
94
|
-
wrapperProps
|
|
95
|
-
} = useFieldHOC(props);
|
|
95
|
+
const { value, wrapperProps } = useFieldHOC(props);
|
|
96
96
|
const ui = computed(() => useUiConfig(wysiwygTheme, "wysiwyg")({}));
|
|
97
97
|
const appendToBody = false ? () => document.body : void 0;
|
|
98
98
|
const customHandlers = {
|
|
@@ -109,35 +109,38 @@ const customHandlers = {
|
|
|
109
109
|
};
|
|
110
110
|
const imageToolbarItems = (editor) => {
|
|
111
111
|
const node = editor.state.doc.nodeAt(editor.state.selection.from);
|
|
112
|
-
return [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
tooltip: {
|
|
122
|
-
text: "Delete"
|
|
123
|
-
},
|
|
124
|
-
onClick: () => {
|
|
125
|
-
const {
|
|
126
|
-
state
|
|
127
|
-
} = editor;
|
|
128
|
-
const {
|
|
129
|
-
selection
|
|
130
|
-
} = state;
|
|
131
|
-
const pos = selection.from;
|
|
132
|
-
const node2 = state.doc.nodeAt(pos);
|
|
133
|
-
if (node2 && node2.type.name === "image") {
|
|
134
|
-
editor.chain().focus().deleteRange({
|
|
135
|
-
from: pos,
|
|
136
|
-
to: pos + node2.nodeSize
|
|
137
|
-
}).run();
|
|
112
|
+
return [
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
icon: "i-lucide-download",
|
|
116
|
+
to: node?.attrs?.src,
|
|
117
|
+
download: true,
|
|
118
|
+
tooltip: {
|
|
119
|
+
text: "Download"
|
|
120
|
+
}
|
|
138
121
|
}
|
|
139
|
-
|
|
140
|
-
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
{
|
|
125
|
+
icon: "i-lucide-trash",
|
|
126
|
+
tooltip: {
|
|
127
|
+
text: "Delete"
|
|
128
|
+
},
|
|
129
|
+
onClick: () => {
|
|
130
|
+
const { state } = editor;
|
|
131
|
+
const { selection } = state;
|
|
132
|
+
const pos = selection.from;
|
|
133
|
+
const node2 = state.doc.nodeAt(pos);
|
|
134
|
+
if (node2 && node2.type.name === "image") {
|
|
135
|
+
editor.chain().focus().deleteRange({
|
|
136
|
+
from: pos,
|
|
137
|
+
to: pos + node2.nodeSize
|
|
138
|
+
}).run();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
];
|
|
141
144
|
};
|
|
142
145
|
const toolbarItems = [
|
|
143
146
|
// Block types
|
|
@@ -150,27 +153,32 @@ const toolbarItems = [
|
|
|
150
153
|
content: {
|
|
151
154
|
align: "start"
|
|
152
155
|
},
|
|
153
|
-
items: [
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
156
|
+
items: [
|
|
157
|
+
{
|
|
158
|
+
kind: "heading",
|
|
159
|
+
level: 1,
|
|
160
|
+
icon: "i-lucide-heading-1",
|
|
161
|
+
label: "Heading 1"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
kind: "heading",
|
|
165
|
+
level: 2,
|
|
166
|
+
icon: "i-lucide-heading-2",
|
|
167
|
+
label: "Heading 2"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
kind: "heading",
|
|
171
|
+
level: 3,
|
|
172
|
+
icon: "i-lucide-heading-3",
|
|
173
|
+
label: "Heading 3"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
kind: "heading",
|
|
177
|
+
level: 4,
|
|
178
|
+
icon: "i-lucide-heading-4",
|
|
179
|
+
label: "Heading 4"
|
|
180
|
+
}
|
|
181
|
+
]
|
|
174
182
|
},
|
|
175
183
|
// Text alignment
|
|
176
184
|
{
|
|
@@ -216,15 +224,18 @@ const toolbarItems = [
|
|
|
216
224
|
content: {
|
|
217
225
|
align: "start"
|
|
218
226
|
},
|
|
219
|
-
items: [
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
items: [
|
|
228
|
+
{
|
|
229
|
+
kind: "bulletList",
|
|
230
|
+
icon: "i-lucide-list",
|
|
231
|
+
label: "Bullet List"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
kind: "orderedList",
|
|
235
|
+
icon: "i-lucide-list-ordered",
|
|
236
|
+
label: "Ordered List"
|
|
237
|
+
}
|
|
238
|
+
]
|
|
228
239
|
},
|
|
229
240
|
{
|
|
230
241
|
kind: "blockquote",
|
|
@@ -249,66 +260,77 @@ const toolbarItems = [
|
|
|
249
260
|
}
|
|
250
261
|
],
|
|
251
262
|
// Text formatting
|
|
252
|
-
[
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
263
|
+
[
|
|
264
|
+
{
|
|
265
|
+
kind: "mark",
|
|
266
|
+
mark: "bold",
|
|
267
|
+
icon: "i-lucide-bold",
|
|
268
|
+
tooltip: {
|
|
269
|
+
text: "Bold"
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
kind: "mark",
|
|
274
|
+
mark: "italic",
|
|
275
|
+
icon: "i-lucide-italic",
|
|
276
|
+
tooltip: {
|
|
277
|
+
text: "Italic"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
kind: "mark",
|
|
282
|
+
mark: "underline",
|
|
283
|
+
icon: "i-lucide-underline",
|
|
284
|
+
tooltip: {
|
|
285
|
+
text: "Underline"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
kind: "mark",
|
|
290
|
+
mark: "strike",
|
|
291
|
+
icon: "i-lucide-strikethrough",
|
|
292
|
+
tooltip: {
|
|
293
|
+
text: "Strikethrough"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
kind: "mark",
|
|
298
|
+
mark: "code",
|
|
299
|
+
icon: "i-lucide-code",
|
|
300
|
+
tooltip: {
|
|
301
|
+
text: "Code"
|
|
302
|
+
}
|
|
286
303
|
}
|
|
287
|
-
|
|
304
|
+
],
|
|
288
305
|
// Link & image
|
|
289
306
|
[
|
|
290
307
|
{
|
|
291
308
|
slot: "link"
|
|
292
309
|
},
|
|
293
|
-
...props.image?.requestOptions ? [
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
310
|
+
...props.image?.requestOptions ? [
|
|
311
|
+
{
|
|
312
|
+
kind: "imageUpload",
|
|
313
|
+
icon: "i-lucide-image"
|
|
314
|
+
}
|
|
315
|
+
] : []
|
|
297
316
|
],
|
|
298
317
|
// History controls
|
|
299
|
-
[
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
318
|
+
[
|
|
319
|
+
{
|
|
320
|
+
kind: "undo",
|
|
321
|
+
icon: "i-lucide-undo",
|
|
322
|
+
tooltip: {
|
|
323
|
+
text: "Undo"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
kind: "redo",
|
|
328
|
+
icon: "i-lucide-redo",
|
|
329
|
+
tooltip: {
|
|
330
|
+
text: "Redo"
|
|
331
|
+
}
|
|
310
332
|
}
|
|
311
|
-
|
|
333
|
+
]
|
|
312
334
|
];
|
|
313
335
|
const suggestionItems = [
|
|
314
336
|
[
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<h1 class="truncate font-bold">
|
|
12
12
|
{{ selectedFile.name }}
|
|
13
13
|
</h1>
|
|
14
|
-
<p class="
|
|
14
|
+
<p class="truncate font-light text-error">
|
|
15
15
|
{{ uploadFailedLabel }}
|
|
16
16
|
</p>
|
|
17
17
|
<Button
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<Icon
|
|
28
28
|
:name="icons.actionDeleteIcon"
|
|
29
29
|
:class="theme.actionDeleteIconClass()"
|
|
30
|
-
title="
|
|
30
|
+
:title="messages.upload.remove"
|
|
31
31
|
@click="$emit('delete')"
|
|
32
32
|
/>
|
|
33
33
|
</div>
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
</template>
|
|
36
36
|
|
|
37
37
|
<script setup>
|
|
38
|
+
import { useCoreMessages } from "#core/composables/useMessages";
|
|
38
39
|
import { isImage } from "#core/helpers/componentHelper";
|
|
39
40
|
import { useUiIconConfig } from "#core/composables/useConfig";
|
|
40
41
|
defineEmits(["retry", "delete"]);
|
|
@@ -51,4 +52,5 @@ const getFileIcon = (file) => {
|
|
|
51
52
|
}
|
|
52
53
|
return icons.filePreviewIcon;
|
|
53
54
|
};
|
|
55
|
+
const { messages } = useCoreMessages();
|
|
54
56
|
</script>
|
|
@@ -17,14 +17,14 @@ interface Props {
|
|
|
17
17
|
}
|
|
18
18
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
19
|
delete: (index: number) => any;
|
|
20
|
-
download: (value: IFileValue) => any;
|
|
21
|
-
preview: (value: IFileValue) => any;
|
|
22
20
|
retry: (index: number) => any;
|
|
21
|
+
preview: (value: IFileValue) => any;
|
|
22
|
+
download: (value: IFileValue) => any;
|
|
23
23
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
24
24
|
onDelete?: ((index: number) => any) | undefined;
|
|
25
|
-
onDownload?: ((value: IFileValue) => any) | undefined;
|
|
26
|
-
onPreview?: ((value: IFileValue) => any) | undefined;
|
|
27
25
|
onRetry?: ((index: number) => any) | undefined;
|
|
26
|
+
onPreview?: ((value: IFileValue) => any) | undefined;
|
|
27
|
+
onDownload?: ((value: IFileValue) => any) | undefined;
|
|
28
28
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
29
|
declare const _default: typeof __VLS_export;
|
|
30
30
|
export default _default;
|