zotero/chrome/content/zotero/commonDialog.js
Dan Stillman 3743c179e1 Add missing commonDialog.js from dictionary manager
Currently provides close-on-Esc functionality
2022-06-21 01:39:07 -04:00

14 lines
No EOL
297 B
JavaScript

window.addEventListener('keypress', function (event) {
if (event.key == 'Escape') {
try {
let elem = document.querySelector('button[dlgtype="cancel"]');
if (!elem) {
elem = document.getElementById('cancel-button');
}
elem.click();
}
catch (e) {
window.close();
}
}
});