Don't add 'Web Page" to new item menu by accident
And ignore it if it's there
This commit is contained in:
parent
3c500b8ebf
commit
0d34e34a3a
2 changed files with 18 additions and 16 deletions
|
@ -273,7 +273,7 @@ Zotero.ItemTypes = new function() {
|
|||
mru = mru.split(',').slice(0, limit);
|
||||
for (var i=0, len=mru.length; i<len; i++) {
|
||||
var id = parseInt(mru[i]);
|
||||
if (!isNaN(id)) {
|
||||
if (!isNaN(id) && id != 13) { // ignore 'webpage' item type
|
||||
params.push(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ var ZoteroPane = new function()
|
|||
menuitem.setAttribute("label", itemTypes[i].localized);
|
||||
menuitem.setAttribute("tooltiptext", "");
|
||||
let type = itemTypes[i].id;
|
||||
menuitem.addEventListener("command", function() { ZoteroPane_Local.newItem(type); }, false);
|
||||
menuitem.addEventListener("command", function() { ZoteroPane_Local.newItem(type, {}, null, true); }, false);
|
||||
moreMenu.appendChild(menuitem);
|
||||
}
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ var ZoteroPane = new function()
|
|||
menuitem.setAttribute("label", itemTypes[i].localized);
|
||||
menuitem.setAttribute("tooltiptext", "");
|
||||
let type = itemTypes[i].id;
|
||||
menuitem.addEventListener("command", function() { ZoteroPane_Local.newItem(type); }, false);
|
||||
menuitem.addEventListener("command", function() { ZoteroPane_Local.newItem(type, {}, null, true); }, false);
|
||||
menuitem.className = "zotero-tb-add";
|
||||
addMenu.insertBefore(menuitem, separator);
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ var ZoteroPane = new function()
|
|||
*
|
||||
* _data_ is an optional object with field:value for itemData
|
||||
*/
|
||||
function newItem(typeID, data, row)
|
||||
function newItem(typeID, data, row, manual)
|
||||
{
|
||||
if (!Zotero.stateCheck()) {
|
||||
this.displayErrorMessage(true);
|
||||
|
@ -682,7 +682,7 @@ var ZoteroPane = new function()
|
|||
}
|
||||
}
|
||||
|
||||
if (row !== undefined) {
|
||||
if (row !== undefined && row !== null) {
|
||||
var itemGroup = this.collectionsView._getItemAtRow(row);
|
||||
var libraryID = itemGroup.ref.libraryID;
|
||||
}
|
||||
|
@ -710,19 +710,21 @@ var ZoteroPane = new function()
|
|||
document.getElementById('zotero-view-item').selectedIndex = 0;
|
||||
|
||||
// Update most-recently-used list for New Item menu
|
||||
var mru = Zotero.Prefs.get('newItemTypeMRU');
|
||||
if (mru) {
|
||||
var mru = mru.split(',');
|
||||
var pos = mru.indexOf(typeID + '');
|
||||
if (pos != -1) {
|
||||
mru.splice(pos, 1);
|
||||
if (manual) {
|
||||
var mru = Zotero.Prefs.get('newItemTypeMRU');
|
||||
if (mru) {
|
||||
var mru = mru.split(',');
|
||||
var pos = mru.indexOf(typeID + '');
|
||||
if (pos != -1) {
|
||||
mru.splice(pos, 1);
|
||||
}
|
||||
mru.unshift(typeID);
|
||||
}
|
||||
mru.unshift(typeID);
|
||||
else {
|
||||
var mru = [typeID + ''];
|
||||
}
|
||||
Zotero.Prefs.set('newItemTypeMRU', mru.slice(0, 5).join(','));
|
||||
}
|
||||
else {
|
||||
var mru = [typeID + ''];
|
||||
}
|
||||
Zotero.Prefs.set('newItemTypeMRU', mru.slice(0, 5).join(','));
|
||||
|
||||
return Zotero.Items.get(itemID);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue