feat: editor file attachments (#194)

* fix current slider value

* WIP

* changes to extension attributes

* update command title
This commit is contained in:
Philip Okugbe
2024-08-26 12:38:47 +01:00
committed by GitHub
parent 7e80797e3f
commit 7dc37b933f
19 changed files with 450 additions and 16 deletions

View File

@ -1,12 +1,16 @@
import { handleVideoUpload } from "@docmost/editor-ext";
import { uploadFile } from "@/features/page/services/page-service.ts";
import { notifications } from "@mantine/notifications";
export const uploadVideoAction = handleVideoUpload({
onUpload: async (file: File, pageId: string): Promise<any> => {
try {
return await uploadFile(file, pageId);
} catch (err) {
console.error("failed to upload image", err);
notifications.show({
color: "red",
message: err?.response.data.message,
});
throw err;
}
},
@ -15,7 +19,11 @@ export const uploadVideoAction = handleVideoUpload({
return false;
}
if (file.size / 1024 / 1024 > 20) {
if (file.size / 1024 / 1024 > 50) {
notifications.show({
color: "red",
message: `File exceeds the 50 MB attachment limit`,
});
return false;
}
return true;