Skip to content

Commit

Permalink
fix(bundle): file upload handler is not passed in wysiwyg mode (#453)
Browse files Browse the repository at this point in the history
`useMarkdownEditor()`: Take file upload handler from `props.handlers.uploadFile` with fallback from `props.fileUploadHandler`
  • Loading branch information
d3m1d0v authored Nov 2, 2024
1 parent 3579a20 commit 46fbe46
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bundle/useMarkdownEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function useMarkdownEditor<T extends object = {}>(
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;
Expand All @@ -54,7 +55,7 @@ export function useMarkdownEditor<T extends object = {}>(
return true;
},
mdBreaks: breaks,
fileUploadHandler: props.fileUploadHandler,
fileUploadHandler: uploadFile,
needToSetDimensionsForUploadedImages,
});
{
Expand Down Expand Up @@ -84,7 +85,7 @@ export function useMarkdownEditor<T extends object = {}>(
},
handlers: {
...handlers,
uploadFile: handlers.uploadFile ?? props.fileUploadHandler,
uploadFile,
},
experimental: {
...experimental,
Expand Down

0 comments on commit 46fbe46

Please sign in to comment.