Skip to content

Commit 004c0bf

Browse files
QuentinNativelQuentin Nativel
and
Quentin Nativel
authored
fix: provide blockId to uploadFile in UploadTab (#1641)
* refactor(core): rename block to blockId Rename the input of editor.uploadFile to make it clearer that it is a string that is manipulated and to make it coherent with the above function definition * feat(file-panel): add blockId parameter to the call of editor.uploadFile --------- Co-authored-by: Quentin Nativel <[email protected]>
1 parent 03edfae commit 004c0bf

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/core/src/editor/BlockNoteEditor.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,15 @@ export class BlockNoteEditor<
625625

626626
if (newOptions.uploadFile) {
627627
const uploadFile = newOptions.uploadFile;
628-
this.uploadFile = async (file, block) => {
628+
this.uploadFile = async (file, blockId) => {
629629
this.onUploadStartCallbacks.forEach((callback) =>
630-
callback.apply(this, [block])
630+
callback.apply(this, [blockId])
631631
);
632632
try {
633-
return await uploadFile(file, block);
633+
return await uploadFile(file, blockId);
634634
} finally {
635635
this.onUploadEndCallbacks.forEach((callback) =>
636-
callback.apply(this, [block])
636+
callback.apply(this, [blockId])
637637
);
638638
}
639639
};

packages/react/src/components/FilePanel/DefaultTabs/UploadTab.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const UploadTab = <
5050

5151
if (editor.uploadFile !== undefined) {
5252
try {
53-
let updateData = await editor.uploadFile(file);
53+
let updateData = await editor.uploadFile(file, block.id);
5454
if (typeof updateData === "string") {
5555
// received a url
5656
updateData = {

0 commit comments

Comments
 (0)