KeyboardWidget: don't trap keyboard shortcut if actions and message are empty and invokeActions isn't handled (#4971)

* KeyboardWidget: don't trap keyboard shortcut if actions are empty

* Update keyboard.js

* Update keyboard.js
optimising-macrocalls
Simon Huber 2020-11-06 18:32:26 +01:00 zatwierdzone przez GitHub
rodzic 15e8772170
commit d51975b183
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -46,13 +46,15 @@ KeyboardWidget.prototype.render = function(parent,nextSibling) {
// Add a keyboard event handler
domNode.addEventListener("keydown",function (event) {
if($tw.keyboardManager.checkKeyDescriptors(event,self.keyInfoArray)) {
self.invokeActions(self,event);
var handled = self.invokeActions(self,event);
if(self.actions) {
self.invokeActionString(self.actions,self,event);
}
self.dispatchMessage(event);
event.preventDefault();
event.stopPropagation();
if(handled || self.actions || self.message) {
event.preventDefault();
event.stopPropagation();
}
return true;
}
return false;