refactory-id / bootstrap-markdown

Bootstrap plugin for markdown editing
Apache License 2.0
1.99k stars 370 forks source link

Hotkeys still working on disabled buttons #238

Open sergiocerrutti opened 8 years ago

sergiocerrutti commented 8 years ago

Since I cannot rewrite default buttons without editing the core, I've disabled default link button and created a new one, but the problem is the hotkey is still triggering the disabled link button (and the new one too of course).

Also I cannot unbind any specific hotkey because events are not namespaced (for example: 'keydown.cmdUrl'), so the only way is to unbind all hotkeys and bind them again.

A quick hack is to remove that button from the DOM inside the onShow callback: $('[data-handler="bootstrap-markdown-cmdUrl"]', e.$editor).remove();

Thank you @toopay!

sergiocerrutti commented 8 years ago

I see the preview is also still working with Ctrl+p even if preview is disabled. You can test it in the Twitter footer editor you have in you demo page. Once you trigger the hotkey, you cannot even go back to the editor.