-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Macro: #3713 - Hot keys for toolbar buttons are not implemented in Macromoleculas view #3836
Conversation
- implemented toolbar btn highlighting
…acromolecules # Conflicts: # packages/ketcher-polymer-editor-react/src/Editor.tsx
const hotKeys = initHotKeys(keySettings); | ||
const shortcutKey = keyNorm.lookup(hotKeys, event); | ||
|
||
if (keySettings[shortcutKey] && keySettings[shortcutKey].handler) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify
if (keySettings[shortcutKey]?.handler)
|
||
setupHotKeysEvents() { | ||
this.hotKeyEventHandler = (event) => this.handleHotKeyEvents(event); | ||
document.addEventListener('keydown', this.hotKeyEventHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just simply?
setupHotKeysEvents() {
document.addEventListener('keydown', this. handleHotKeyEvents);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, because we need to bind 'this' to hotKeyEventHandler method. And this.hotKeyEventHandler.bind(this) also didn't work because it returns another function and it did not clear event listener in this case.
How the feature works? / How did you fix the issue?
(Screenshots, videos, or GIFs, if applicable)
Check list
#1234 – issue name