Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.39k stars 316 forks source link

Custom Toolbar for "upload-image" doesn't appear to work #230

Open elixirgraphics opened 4 years ago

elixirgraphics commented 4 years ago

Describe the bug I'm working to set a custom icon for the Upload Image button. When I do so the button no longer functions. Since the action was not documented I dug around and sussed out that it should be EasyMDE.drawUploadedImage and set it as such.

My custom toolbar code is as follows:

toolbar: [{
                name: "upload-image",
                action: EasyMDE.drawUploadedImage,
                className: "icon-photo",
                title: "Upload Image",
            }],

Expected behavior Should trigger the file chooser to find a local file to upload.

elixirgraphics commented 4 years ago

Looks like the binding for Upload Image is missing:

EasyMDE.drawUploadedImage = drawUploadedImage;
Ionaru commented 4 years ago

Yes, the drawUploadedImage function is missing from the exports.

You can also use the upload-image button like this: toolbar: ['upload-image'].

elixirgraphics commented 4 years ago

Thanks. I have definitely gotten the Upload Image to work with your suggested method. I wanted to customize all of the icons with a different font icon set so it was necessary for me to add the above binding to get it to work. Thanks for your help! 😄

Ionaru commented 4 years ago

Added in b4619790671876fce3689b84d5f0e65e033b7c9b.