Skip to content

Commit

Permalink
fix : 에디터 클릭을 통한 단일 이미지 삽입 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
teawon committed Nov 23, 2023
1 parent f8e4c13 commit 545abe0
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ const WriteEditor = ({
}
};

const onUploadImage = async (
blob: File,
callback: (imageUrl: string, fileName: string) => void,
) => {
uploadImageMutation(blob, {
onSuccess: (data) => {
callback(data.imageUrl, blob.name);
},
});
return false;
};

const {
mutate: uploadImageMutation,
isLoading: isImageUploading,
Expand Down Expand Up @@ -158,6 +170,9 @@ const WriteEditor = ({
<Editor
ref={editorRef}
placeholder="내용을 입력해 주세요"
hooks={{
addImageBlobHook: onUploadImage,
}}
onChange={handleEditorChange}
previewStyle="tab"
height="100%"
Expand Down

0 comments on commit 545abe0

Please sign in to comment.