Fx60: Fix keyboard handling in items list

nsIDOMWindowUtils::sendKeyEvent() was removed
This commit is contained in:
Dan Stillman 2019-10-24 14:56:34 -04:00
parent ba15c2b53e
commit 742d7793d1

View file

@ -220,31 +220,10 @@ Zotero.ItemTreeView.prototype.setTree = async function (treebox) {
// event comes in. I see no way this could go wrong... // event comes in. I see no way this could go wrong...
tree.disableKeyNavigation = false; tree.disableKeyNavigation = false;
self._skipKeyPress = true; self._skipKeyPress = true;
var nsIDWU = Components.interfaces.nsIDOMWindowUtils; var clonedEvent = new this.window.KeyboardEvent("keypress", event);
var domWindowUtils = event.originalTarget.ownerDocument.defaultView event.explicitOriginalTarget.dispatchEvent(clonedEvent);
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(nsIDWU);
var modifiers = 0;
if (event.altKey) {
modifiers |= nsIDWU.MODIFIER_ALT;
}
if (event.ctrlKey) {
modifiers |= nsIDWU.MODIFIER_CONTROL;
}
if (event.shiftKey) {
modifiers |= nsIDWU.MODIFIER_SHIFT;
}
if (event.metaKey) {
modifiers |= nsIDWU.MODIFIER_META;
}
domWindowUtils.sendKeyEvent(
'keypress',
event.keyCode,
event.charCode,
modifiers
);
tree.disableKeyNavigation = true; tree.disableKeyNavigation = true;
}) }.bind(this))
.catch(function (e) { .catch(function (e) {
Zotero.logError(e); Zotero.logError(e);
}) })