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.45k stars 319 forks source link

Is there a way to cancel the keyboard shortcut for h1 only? #354

Open userofit123 opened 3 years ago

userofit123 commented 3 years ago

My post titles are not part of the post content textarea, there is a dedicated input for them. The titles are the posts h1, so I only allowed h2 and h3 to be added through the buttons toolbar, but pressing ctrl+h allows people to add h1s.

Is there a way to cancel only the h1 from that shortcut, or to redefine that shortcut to set only h2 and h3 by reconfiguring it?

Zignature commented 2 years ago

Use the shortcuts option/parameter to alter the keyboard shortcuts.

This will disable the Ctrl-H and the Shift-Ctrl-H shortcuts:

const easyMDE = new EasyMDE({
  shortcuts: {
    "toggleHeadingSmaller" : null  // unbind Ctrl-H
    "toggleHeadingBigger"  : null  // unbind Shift-Ctrl-H
  }
});