Expose normalized bindings on keydownHandler fn #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "expose-normalized-keybindings"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'd like to support two use cases that are made easier by having access to the normalized key bindings:
With this change, I can loop over my editor's plugins and build the platform-specific version of the keyboard shortcut from the
props.handleKeyDownfunction itself.Sorry, but I don't like this at all. It seems too specific to a use case, and too surprising in terms of interface design. I think your best bet for doing what you want is to either ensure your key bindings are pre-normalized, or define your own normalization function to map bindings to whatever you want the user-readable strings to look like—this could be a one-line regexp replace.
Fair enough. Would you accept a PR that exposes the
normalizeKeysfunction and the inner function inkeydownHandler, so people can build this functionality in userland? Or are you thinking you don’t want to be tied down to supporting that in the public interface forever?The normalized format is an internal thing. I'm suggesting you write your own—it's simple enough, and that way you have actual control over the way you present the key names.
Pull request closed