* feat: support i18n * feat: wip support i18n * feat: complete space translation * feat: complete page translation * feat: update space translation * feat: update workspace translation * feat: update group translation * feat: update workspace translation * feat: update page translation * feat: update user translation * chore: update pnpm-lock * feat: add query translation * refactor: merge to single file * chore: remove necessary code * feat: save language to BE * fix: only load current language * feat: save language to locale column * fix: cleanups * add language menu to preferences page * new translations * translate editor * Translate editor placeholders * translate space selection component --------- Co-authored-by: Philip Okugbe <phil@docmost.com> Co-authored-by: Philip Okugbe <16838612+Philipinho@users.noreply.github.com>
36 lines
1 KiB
TypeScript
36 lines
1 KiB
TypeScript
import { handleVideoUpload } from "@docmost/editor-ext";
|
|
import { uploadFile } from "@/features/page/services/page-service.ts";
|
|
import { notifications } from "@mantine/notifications";
|
|
import { getFileUploadSizeLimit } from "@/lib/config.ts";
|
|
import { formatBytes } from "@/lib";
|
|
import i18n from "i18next";
|
|
|
|
export const uploadVideoAction = handleVideoUpload({
|
|
onUpload: async (file: File, pageId: string): Promise<any> => {
|
|
try {
|
|
return await uploadFile(file, pageId);
|
|
} catch (err) {
|
|
notifications.show({
|
|
color: "red",
|
|
message: err?.response.data.message,
|
|
});
|
|
throw err;
|
|
}
|
|
},
|
|
validateFn: (file) => {
|
|
if (!file.type.includes("video/")) {
|
|
return false;
|
|
}
|
|
|
|
if (file.size > getFileUploadSizeLimit()) {
|
|
notifications.show({
|
|
color: "red",
|
|
message: i18n.t("File exceeds the {{limit}} attachment limit", {
|
|
limit: formatBytes(getFileUploadSizeLimit()),
|
|
}),
|
|
});
|
|
return false;
|
|
}
|
|
return true;
|
|
},
|
|
});
|