Disable switching to the classic dialog when inserting a note

This commit is contained in:
Adomas Venčkauskas 2020-09-30 09:50:12 +03:00 committed by Dan Stillman
parent 393807f487
commit 52f3945aa4

View file

@ -773,14 +773,17 @@ var Zotero_QuickFormat = new function () {
Zotero.getString('integration.cannotInsertItemWithNote')); Zotero.getString('integration.cannotInsertItemWithNote'));
return false; return false;
} }
if (item && item.isNote() && nodes.length) { if (item && item.isNote()) {
if (!ps.confirm(null, document.getElementById('classic-view').hidden = true;
if (nodes.length) {
if (!ps.confirm(null,
Zotero.getString('general.warning'), Zotero.getString('general.warning'),
Zotero.getString('integration.noteCiteItemsRemoved'))) { Zotero.getString('integration.noteCiteItemsRemoved'))) {
return false; return false;
}
_clearCitation();
citationItem.isNote = true;
} }
_clearCitation();
citationItem.isNote = true;
} }
if (typeof citationItem.id === "string" && citationItem.id.indexOf("/") !== -1) { if (typeof citationItem.id === "string" && citationItem.id.indexOf("/") !== -1) {
citationItem.uris = item.cslURIs; citationItem.uris = item.cslURIs;
@ -1122,14 +1125,19 @@ var Zotero_QuickFormat = new function () {
/** /**
* Handle escape for entire window * Handle escape for entire window
*/ */
this.onKeyPress = function(event) { this.onKeyPress = function (event) {
var keyCode = event.keyCode; var keyCode = event.keyCode;
if(keyCode === event.DOM_VK_ESCAPE && !accepted) { if (keyCode === event.DOM_VK_ESCAPE && !accepted) {
accepted = true; accepted = true;
io.citation.citationItems = []; io.citation.citationItems = [];
io.accept(); io.accept();
} }
} else if (['Backspace', 'Delete'].includes(event.key)) {
var nodes = Array.from(qfe.childNodes).filter(node => node.tagName == 'span');
document.getElementById('classic-view').hidden =
nodes[0] && nodes[0].dataset && JSON.parse(nodes[0].dataset.citationItem).isNote;
}
};
/** /**
* Get bubbles within the current selection * Get bubbles within the current selection