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

Entire toolbar becomes disabled during Preview when using custom icon for Preview button #231

Open elixirgraphics opened 4 years ago

elixirgraphics commented 4 years ago

Describe the bug When using a custom icon for the Preview button in the toolbar the entire set of toolbar icons becomes disabled, including the Preview toggle.

To Reproduce Create a custom Preview button, like the one below. When the Preview button is clicked all buttons in the toolbar are disabled, including the Preview button, which makes it impossible to switch out of preview mode.

toolbar: [{
                name: "preview",
                action: EasyMDE.togglePreview,
                className: "icon-preview",
                title: "Preview",
            }],

Expected behavior All buttons except the Preview, Side-By-Side and Full Screen view buttons should be disabled.

Ionaru commented 4 years ago

There is a noDisable option you can add to the custom button, set it to true. Have a look at https://github.com/Ionaru/easy-markdown-editor/blob/master/types/easymde.d.ts for all available options.

elixirgraphics commented 4 years ago

Thanks. You rock. Appreciate that. I'd think the default wouldn't be to disable the preview button at a minimum.

Ionaru commented 4 years ago

By default the preview button won't be disabled, but you defined a custom button. If you'd like to inherit everything from the normal preview button, just create the toolbar like this: toolbar: ['preview']