From d74f923ac44cd930acf18a10e1881f1fb74b395f Mon Sep 17 00:00:00 2001 From: Quentin Nativel Date: Thu, 24 Apr 2025 16:41:31 +0200 Subject: [PATCH 1/2] 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 --- packages/core/src/editor/BlockNoteEditor.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/editor/BlockNoteEditor.ts b/packages/core/src/editor/BlockNoteEditor.ts index f79362f90..b1c2878a1 100644 --- a/packages/core/src/editor/BlockNoteEditor.ts +++ b/packages/core/src/editor/BlockNoteEditor.ts @@ -625,15 +625,15 @@ export class BlockNoteEditor< if (newOptions.uploadFile) { const uploadFile = newOptions.uploadFile; - this.uploadFile = async (file, block) => { + this.uploadFile = async (file, blockId) => { this.onUploadStartCallbacks.forEach((callback) => - callback.apply(this, [block]) + callback.apply(this, [blockId]) ); try { - return await uploadFile(file, block); + return await uploadFile(file, blockId); } finally { this.onUploadEndCallbacks.forEach((callback) => - callback.apply(this, [block]) + callback.apply(this, [blockId]) ); } }; From 0bf7ee4127439210148162730d7086239fffa99a Mon Sep 17 00:00:00 2001 From: Quentin Nativel Date: Thu, 24 Apr 2025 16:42:37 +0200 Subject: [PATCH 2/2] feat(file-panel): add blockId parameter to the call of editor.uploadFile --- .../react/src/components/FilePanel/DefaultTabs/UploadTab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/components/FilePanel/DefaultTabs/UploadTab.tsx b/packages/react/src/components/FilePanel/DefaultTabs/UploadTab.tsx index e0cc5a46c..b56867b44 100644 --- a/packages/react/src/components/FilePanel/DefaultTabs/UploadTab.tsx +++ b/packages/react/src/components/FilePanel/DefaultTabs/UploadTab.tsx @@ -50,7 +50,7 @@ export const UploadTab = < if (editor.uploadFile !== undefined) { try { - let updateData = await editor.uploadFile(file); + let updateData = await editor.uploadFile(file, block.id); if (typeof updateData === "string") { // received a url updateData = {