feat(ShortcutKey): 增加快捷键配置能力 Closes #571 #832
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
现在你可以自定义hook的快捷键啦!
For User
点击设置按钮->点击快捷键配置即可,跟
vscode
一样,双击快捷键即可编辑For Dev
先查看对应hook的快捷键,API为:
cherry.toolbar.menus.hooks['header'].shortcutKeyMap
把header
换成你的即可API更新快捷键:
cherry.toolbar.menus.hooks['header'].updateShortcutKeyMap(旧的快捷键, 新的快捷键)
注:旧的快捷键可以通过上面的API来获取,但新的API一定要按照旧的快捷键来,如果你不知道规则,请先查看 https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values,或者参考上面的编辑方法,观察
localStorage
的变化来实现对了,如果你在一个页面需要打开多个
cherry
,他们的快捷键配置互不影响