mirror of
https://github.com/zotero/zotero.git
synced 2026-10-08 03:08:19 +00:00
Fix library tab fields not refreshing (#5697)
Previously, fields and the abstract in the library tab did not refresh after updates were made in the Reader’s context pane.
This commit is contained in:
parent
e899012e5e
commit
c37a79e066
3 changed files with 37 additions and 3 deletions
|
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
|
||||
init() {
|
||||
this._notifierID = Zotero.Notifier.registerObserver(this, ['item'], 'abstractBox');
|
||||
this._notifierID = Zotero.Notifier.registerObserver(this, ['item', 'tab'], 'abstractBox');
|
||||
|
||||
this.initCollapsibleSection();
|
||||
|
||||
|
|
@ -86,6 +86,9 @@
|
|||
if (action == 'modify' && this.item && ids.includes(this.item.id)) {
|
||||
this._forceRenderAll();
|
||||
}
|
||||
if (action === 'select' && type === 'tab' && ids.length > 0) {
|
||||
this._handleTabSelect(ids[0]);
|
||||
}
|
||||
}
|
||||
|
||||
async save() {
|
||||
|
|
@ -203,6 +206,20 @@
|
|||
_handleFieldBlur = () => {
|
||||
this.save();
|
||||
};
|
||||
|
||||
_handleTabSelect = (tabID) => {
|
||||
if (!this.tabID || typeof Zotero_Tabs === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (tabID !== this.tabID) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._syncRenderPending) {
|
||||
this._syncRenderPending = false;
|
||||
this.render();
|
||||
}
|
||||
};
|
||||
}
|
||||
customElements.define("abstract-box", AbstractBox);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
// Ensure no button is forced to stay visible once the menu is closed
|
||||
this.addEventListener('popuphidden', this._handlePopupHidden);
|
||||
|
||||
this._notifierID = Zotero.Notifier.registerObserver(this, ['item', 'infobox'], 'itemBox');
|
||||
this._notifierID = Zotero.Notifier.registerObserver(this, ['item', 'infobox', 'tab'], 'itemBox');
|
||||
this._prefsObserverID = Zotero.Prefs.registerObserver('fontSize', () => {
|
||||
this._forceRenderAll();
|
||||
});
|
||||
|
|
@ -403,6 +403,9 @@
|
|||
if (event == 'modify' && this.item?.id && ids.includes(this.item.id)) {
|
||||
this._forceRenderAll();
|
||||
}
|
||||
if (event === 'select' && type === 'tab' && ids.length > 0) {
|
||||
this._handleTabSelect(ids[0]);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
@ -2967,6 +2970,20 @@
|
|||
this.removeUnsavedCreatorRow(true);
|
||||
}
|
||||
};
|
||||
|
||||
_handleTabSelect = (tabID) => {
|
||||
if (!this.tabID || typeof Zotero_Tabs === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (tabID !== this.tabID) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._syncRenderPending) {
|
||||
this._syncRenderPending = false;
|
||||
this.render();
|
||||
}
|
||||
};
|
||||
}
|
||||
customElements.define("info-box", InfoBox);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,12 +167,12 @@ class ItemPaneSectionElementBase extends XULElementBase {
|
|||
}
|
||||
|
||||
async _forceRenderAll() {
|
||||
this._resetRenderedFlags();
|
||||
if (this.hidden || this.skipRender) {
|
||||
this._syncRenderPending = true;
|
||||
this._asyncRenderPending = true;
|
||||
return;
|
||||
}
|
||||
this._resetRenderedFlags();
|
||||
if (this.render) this.render();
|
||||
if (this.asyncRender) await this.asyncRender();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue