mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed CMD+F and multiple post selection
fixes https://github.com/TryGhost/Team/issues/2939 When using CMD+F, the multiple selection list still thinks CMD is pressed because the keyup event is not fired. This is fixed by clearing the pressed keys when the window is blurred.
This commit is contained in:
parent
ee216038e9
commit
114a6eb953
1 changed files with 10 additions and 0 deletions
|
@ -27,6 +27,7 @@ export default class ListComponent extends Component {
|
|||
window.removeEventListener('keydown', this.onKeyDow, {passive: true});
|
||||
window.removeEventListener('keyup', this.onKeyUp, {passive: true});
|
||||
window.removeEventListener('click', this.onWindowClicked, {passive: true});
|
||||
window.removeEventListener('blur', this.onWindowBlur, {passive: true});
|
||||
}
|
||||
|
||||
@action
|
||||
|
@ -34,6 +35,7 @@ export default class ListComponent extends Component {
|
|||
window.addEventListener('keydown', this.onKeyDown, {passive: false});
|
||||
window.addEventListener('keyup', this.onKeyUp, {passive: true});
|
||||
window.addEventListener('click', this.onWindowClicked, {passive: true});
|
||||
window.addEventListener('blur', this.onWindowBlur, {passive: true});
|
||||
}
|
||||
|
||||
@action
|
||||
|
@ -44,6 +46,14 @@ export default class ListComponent extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
@action
|
||||
onWindowBlur() {
|
||||
// This is required because the keyup event won't be fired again
|
||||
this.ctrlPressed = false;
|
||||
this.metaPressed = false;
|
||||
this.shiftPressed = false;
|
||||
}
|
||||
|
||||
@action
|
||||
onKeyDown(event) {
|
||||
if (event.key === 'Control') {
|
||||
|
|
Loading…
Add table
Reference in a new issue