ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.61k stars 336 forks source link

Two keymap improvement suggestions #1342

Closed PRR24 closed 1 year ago

PRR24 commented 1 year ago

Two suggestions:

  1. Currently keymap is case sensitive, that is different how shortcuts typically work. While it is no big deal to add extra line of code for the command (like Mod-b and Mod-B for strong), it is still error-prone. For example, prosemirror-example-setup has forgotten to add Mod-Z binding for undo. As there is a support for Mod-Shift-* for shift-key-separation, please consider making the keymap case insensitive. Currently Mod-b (or any other letter) is case-insensitive on Mac, but case sensitive on Win and Lin.

  2. Mac detection is generally needed for platform-specific keymap implementation (for example for the redo command). Please export Mac-detection function from prosemirror-keymap module (or from some other shared module), so that it should not be duplicated (like prosemirror-example-setup does) avoiding potential out-of sync implementations in future versions.

Thank you.

marijnh commented 1 year ago

please consider making the keymap case insensitive

This is not going to happen. It'd be a breaking change, and I don't think it's a good idea in general.

Please export Mac-detection function from prosemirror-keymap module

You can do baseKeymap == macBaseKeymap if you want to find out whether prosemirror-commands detected a Mac platform.