fx-compat: initKeyEvent()
→ new KeyboardEvent()
Quick Format change is untested
This commit is contained in:
parent
587ae6ba7e
commit
f827b9ef50
2 changed files with 29 additions and 28 deletions
|
@ -180,11 +180,16 @@ var Zotero_QuickFormat = new function () {
|
|||
// load citation data
|
||||
if (io.citation.citationItems.length) {
|
||||
// hack to get spacing right
|
||||
var evt = qfiDocument.createEvent("KeyboardEvent");
|
||||
evt.initKeyEvent("keypress", true, true, qfiWindow,
|
||||
0, 0, 0, 0,
|
||||
0, " ".charCodeAt(0));
|
||||
qfe.dispatchEvent(evt);
|
||||
let event = new KeyboardEvent(
|
||||
"keypress",
|
||||
{
|
||||
key: " ",
|
||||
code: "Space",
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
}
|
||||
);
|
||||
qfe.dispatchEvent(event);
|
||||
await resizePromise;
|
||||
var node = qfe.firstChild;
|
||||
node.nodeValue = "";
|
||||
|
|
|
@ -465,18 +465,15 @@ describe("ZoteroPane", function() {
|
|||
var promise = waitForDialog();
|
||||
var modifyPromise = waitForItemEvent('modify');
|
||||
|
||||
var event = doc.createEvent("KeyboardEvent");
|
||||
event.initKeyEvent(
|
||||
var event = new KeyboardEvent(
|
||||
"keypress",
|
||||
true,
|
||||
true,
|
||||
window,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
DELETE_KEY_CODE,
|
||||
0
|
||||
{
|
||||
key: 'Delete',
|
||||
code: 'Delete',
|
||||
keyCode: DELETE_KEY_CODE,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}
|
||||
);
|
||||
tree.dispatchEvent(event);
|
||||
yield promise;
|
||||
|
@ -506,18 +503,17 @@ describe("ZoteroPane", function() {
|
|||
var promise = waitForDialog();
|
||||
var modifyPromise = waitForItemEvent('modify');
|
||||
|
||||
var event = doc.createEvent("KeyboardEvent");
|
||||
event.initKeyEvent(
|
||||
var event = new KeyboardEvent(
|
||||
"keypress",
|
||||
true,
|
||||
true,
|
||||
window,
|
||||
false,
|
||||
false,
|
||||
!Zotero.isMac, // shift
|
||||
Zotero.isMac, // meta
|
||||
DELETE_KEY_CODE,
|
||||
0
|
||||
{
|
||||
key: 'Delete',
|
||||
code: 'Delete',
|
||||
keyCode: DELETE_KEY_CODE,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
shiftKey: !Zotero.isMac,
|
||||
metaKey: Zotero.isMac,
|
||||
}
|
||||
);
|
||||
tree.dispatchEvent(event);
|
||||
yield promise;
|
||||
|
@ -588,9 +584,9 @@ describe("ZoteroPane", function() {
|
|||
{
|
||||
key: 'Delete',
|
||||
code: 'Delete',
|
||||
keyCode: DELETE_KEY_CODE,
|
||||
metaKey: Zotero.isMac,
|
||||
shiftKey: !Zotero.isMac,
|
||||
keyCode: DELETE_KEY_CODE,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue