diff --git a/resources/js/components/SMAttachments.vue b/resources/js/components/SMAttachments.vue
index 05a016b..8632f02 100644
--- a/resources/js/components/SMAttachments.vue
+++ b/resources/js/components/SMAttachments.vue
@@ -41,6 +41,21 @@
+
+
+ |
({{ bytesReadable(file.size) }})
@@ -84,26 +99,35 @@ const props = defineProps({
* Handle the user adding a new media item.
*/
const handleClickAdd = async () => {
- let result = await openDialog(SMDialogMedia, {
- mime: "",
- accepts: "",
- allowUpload: true,
- multiple: true,
- });
-
- if (result) {
- const mediaResult = result as Media[];
- let newValue = props.modelValue;
- let mediaIds = new Set(newValue.map((item) => item.id));
-
- mediaResult.forEach((item) => {
- if (!mediaIds.has(item.id)) {
- newValue.push(item);
- mediaIds.add(item.id);
- }
+ if (props.showEditor) {
+ let result = await openDialog(SMDialogMedia, {
+ mime: "",
+ accepts: "",
+ allowUpload: true,
+ multiple: true,
});
- emits("update:modelValue", newValue);
+ if (result) {
+ const mediaResult = result as Media[];
+ let newValue = props.modelValue;
+ let mediaIds = new Set(newValue.map((item) => item.id));
+
+ mediaResult.forEach((item) => {
+ if (!mediaIds.has(item.id)) {
+ newValue.push(item);
+ mediaIds.add(item.id);
+ }
+ });
+
+ emits("update:modelValue", newValue);
+ }
+ }
+};
+
+const handleClickDelete = (id: string) => {
+ if (props.showEditor == true) {
+ const newList = props.modelValue.filter((item) => item.id !== id);
+ emits("update:modelValue", newList);
}
};
|