Reopen closed reader and note tabs at their original position

The undo-close hooks read the index from the wrong object, so reopened
reader and note tabs were always appended at the end.
This commit is contained in:
Dan Stillman 2026-09-04 14:18:38 -04:00
parent 4d94810def
commit b3b6e7f33d

View file

@ -202,12 +202,12 @@ var Zotero_Tabs = new function () {
}
},
undoClose: {
reader: async (tab, _tabIndex) => {
reader: async (tab, tabIndex) => {
if (Zotero.Items.exists(tab.data.itemID)) {
await Zotero.Reader.open(tab.data.itemID,
null,
{
tabIndex: tab.index,
tabIndex,
openInBackground: true,
allowDuplicate: true
}
@ -216,12 +216,12 @@ var Zotero_Tabs = new function () {
}
return false;
},
note: async (tab, _tabIndex) => {
note: async (tab, tabIndex) => {
if (Zotero.Items.exists(tab.data.itemID)) {
await Zotero.Notes.open(tab.data.itemID,
null,
{
tabIndex: tab.index,
tabIndex,
openInBackground: true,
allowDuplicate: true
}