From 46fbe46c0c0a7eeb85305d1a8fe8f33ef1257df0 Mon Sep 17 00:00:00 2001 From: Yuriy Demidov Date: Sat, 2 Nov 2024 13:51:45 +0300 Subject: [PATCH] fix(bundle): file upload handler is not passed in wysiwyg mode (#453) `useMarkdownEditor()`: Take file upload handler from `props.handlers.uploadFile` with fallback from `props.fileUploadHandler` --- src/bundle/useMarkdownEditor.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bundle/useMarkdownEditor.ts b/src/bundle/useMarkdownEditor.ts index 450a82fa..e2212c38 100644 --- a/src/bundle/useMarkdownEditor.ts +++ b/src/bundle/useMarkdownEditor.ts @@ -34,6 +34,7 @@ export function useMarkdownEditor( const breaks = md.breaks ?? props.breaks; const preset: MarkdownEditorPreset = props.preset ?? 'full'; const renderStorage = new ReactRenderStorage(); + const uploadFile = handlers.uploadFile ?? props.fileUploadHandler; const needToSetDimensionsForUploadedImages = experimental.needToSetDimensionsForUploadedImages ?? props.needToSetDimensionsForUploadedImages; @@ -54,7 +55,7 @@ export function useMarkdownEditor( return true; }, mdBreaks: breaks, - fileUploadHandler: props.fileUploadHandler, + fileUploadHandler: uploadFile, needToSetDimensionsForUploadedImages, }); { @@ -84,7 +85,7 @@ export function useMarkdownEditor( }, handlers: { ...handlers, - uploadFile: handlers.uploadFile ?? props.fileUploadHandler, + uploadFile, }, experimental: { ...experimental,