-
-
Notifications
You must be signed in to change notification settings - Fork 763
fix: File upload example (BLO-1311) #2996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /** | ||
| * Encodes a file as a base64 data URL and returns it. This keeps the demo | ||
| * self-contained (no external upload host, so nothing can rate-limit or break | ||
| * it), at the cost of embedding the file directly in the document. | ||
| * | ||
| * @warning This function should only be used for development purposes, replace with your own backend! | ||
| */ | ||
| export const uploadFile_DEV_ONLY = async (file: File): Promise<string> => { | ||
| return new Promise((resolve, reject) => { | ||
| const reader = new FileReader(); | ||
| reader.onload = () => resolve(reader.result as string); | ||
| reader.onerror = () => reject(reader.error); | ||
| reader.readAsDataURL(file); | ||
| }); | ||
| }; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ export * from "./Code/helpers/parse/parsePreCode.js"; | |
| export * from "./Code/helpers/render/createCodeBlock.js"; | ||
| export * from "./Code/helpers/toExternalHTML/createPreCode.js"; | ||
| export * from "./ToggleWrapper/createToggleWrapper.js"; | ||
| export * from "./File/helpers/uploadToTmpFilesDotOrg_DEV_ONLY.js"; | ||
| export * from "./File/helpers/uploadFile_DEV_ONLY.js"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh we had this exported before? That is strange to me
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I still remove the export then? Or keep as it was?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd remove it |
||
| export * from "./PageBreak/getPageBreakSlashMenuItems.js"; | ||
|
|
||
| export * from "./BlockNoteSchema.js"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't really want this exported, I get that it is a shared util, but not one that needs to be actually packaged. Just copy-paste in the places that need it