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.38k stars 314 forks source link

Add missed "upload-image" icon #486

Closed hlf20010508 closed 2 years ago

hlf20010508 commented 2 years ago

Once I set uploadImage: true, the browse-file window didn't raise, which confused me for a long time. After I check the source code, I found there are two button for image.

The default one is image. I thinks upload-image should be written in doc, cause not everyone likes to check source code.

By the way, I think the examples you provided are not adequate, especially for those custom functions like imageUploadFunction. You should write some simple examples for them, not just provide a big project to let others understand.

imageUploadFunction: (file, onSuccess, onError) => {
                let form = new FormData
                form.append('file', file)
                axios({
                    method: 'post',
                    url: '/admin/upload',
                    data: form,
                }).then((res)=>{
                    if(res.data.success){
                        onSuccess(res.data.url)
                    }
                    else{
                        onError(res.data.error)
                    }
                })
            },

This is my example. To figure it out, I searched issues, and found #376 which mentioned a project, and searched a lot to understand it.

But no one need to understand big project. A simple example is concise and easy to understand. Maybe I'm a noob. But there are a lot of noobs.

But still, thanks for your project. I really enjoy it in my blog.

Ionaru commented 2 years ago

Thank you for the fix in the README.

The editor is long due for a big update/rewrite (#447), part of my plan for it is to provide guides and examples kinda like CodeMirror has them. But for this older version of the editor I do not think it is still worth the effort.