josdejong / josdejong/jsoneditor

Add ability to customize key shortcuts

Open
#148 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.3k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

I'm not really a huge fan of the keyboard shortcuts. The most obvious to me -- create a new node after current and move to it -- is one of the most awkward to use ("ctrl+shift+insert").

I can see that allowing this to be customized might not be that difficult to do, I can open a pull request if we can agree on a basic strategy before I attempt it.

What jumps out to me is to have a keybinds parameter as an option, which is a map of shortcut names to key codes. Instead of hard coding the keycodes, the different modes would look up the shortcut from `this.options.keybinds[THE_KEYBIND_NAME]` and the different elements (Node, Searchbox, etc) would look it up from `this.editor.options.keybinds[THE_KEYBIND_NAME]`. Then document all of the keybind names. A default keybinds object would exist, and any passed in keybinds would simply overwrite the default setting where a property was present.

What do you think?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.