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,7 +773,9 @@ 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()) {
document.getElementById('classic-view').hidden = true;
if (nodes.length) {
if (!ps.confirm(null, if (!ps.confirm(null,
Zotero.getString('general.warning'), Zotero.getString('general.warning'),
Zotero.getString('integration.noteCiteItemsRemoved'))) { Zotero.getString('integration.noteCiteItemsRemoved'))) {
@ -782,6 +784,7 @@ var Zotero_QuickFormat = new function () {
_clearCitation(); _clearCitation();
citationItem.isNote = true; 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;
citationItem.itemData = item.cslItemData; citationItem.itemData = item.cslItemData;
@ -1129,7 +1132,12 @@ var Zotero_QuickFormat = new function () {
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