Don't restore persisted attributes that are no longer valid

This commit is contained in:
Dan Stillman 2024-04-18 07:58:41 -04:00 committed by Dan Stillman
parent 5bef61b748
commit 9d49d4623d
3 changed files with 8 additions and 3 deletions

View file

@ -6040,6 +6040,8 @@ var ZoteroPane = new function()
continue; continue;
} }
let allowedAttributes = (el.getAttribute('zotero-persist') || '').split(/[\s,]+/);
var elValues = serializedValues[id]; var elValues = serializedValues[id];
for (var attr in elValues) { for (var attr in elValues) {
// Ignore persisted collapsed state for collection and item pane splitters, since // Ignore persisted collapsed state for collection and item pane splitters, since
@ -6050,6 +6052,11 @@ var ZoteroPane = new function()
&& Zotero.Prefs.get('reopenPanesOnRestart')) { && Zotero.Prefs.get('reopenPanesOnRestart')) {
continue; continue;
} }
// Ignore attributes that are no longer persisted for the element
if (!allowedAttributes.includes(attr)) {
Zotero.debug(`Not restoring '${attr}' for #${id}`);
continue;
}
if (["width", "height"].includes(attr)) { if (["width", "height"].includes(attr)) {
el.style[attr] = `${elValues[attr]}px`; el.style[attr] = `${elValues[attr]}px`;
} }

View file

@ -1228,7 +1228,7 @@
</hbox> </hbox>
</toolbar> </toolbar>
<hbox id="zotero-items-pane" class="virtualized-table-container" zotero-persist="width height" flex="1" clickthrough="never"> <hbox id="zotero-items-pane" class="virtualized-table-container" flex="1" clickthrough="never">
<html:div id="zotero-items-tree"></html:div> <html:div id="zotero-items-tree"></html:div>
</hbox> </hbox>
</vbox> </vbox>

View file

@ -12,8 +12,6 @@
.zotero-item-pane-content { .zotero-item-pane-content {
min-height: 0; min-height: 0;
flex: 1; flex: 1;
width: auto !important;
height: auto !important;
min-width: $min-width-item-pane; min-width: $min-width-item-pane;
/* Need a min height to prevent layout issues in stacked mode */ /* Need a min height to prevent layout issues in stacked mode */
min-height: 168px; min-height: 168px;