-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
62 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
|
||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
version: 9 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { createImageUpload } from "novel/plugins"; | ||
import { toast } from "sonner"; | ||
|
||
const onUpload = async (file: File) => { | ||
const promise = fetch("/api/upload", { | ||
method: "POST", | ||
headers: { | ||
"content-type": file?.type || "application/octet-stream", | ||
"x-vercel-filename": file?.name || "image.png", | ||
}, | ||
body: file, | ||
}); | ||
|
||
//This should return a src of the uploaded image | ||
return promise; | ||
}; | ||
|
||
export const uploadFn = createImageUpload({ | ||
onUpload, | ||
validateFn: (file) => { | ||
if (!file.type.includes("image/")) { | ||
toast.error("File type not supported."); | ||
return false; | ||
} else if (file.size / 1024 / 1024 > 20) { | ||
toast.error("File size too big (max 20MB)."); | ||
return false; | ||
} | ||
|
||
return true; | ||
}, | ||
}); |
File renamed without changes.