From 5bef61b7487354b7e3bf0c072d129ac677c1fc85 Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:27:45 +0800 Subject: [PATCH] fx115: fix element width/height persist --- chrome/content/zotero/elements/itemPane.js | 2 +- chrome/content/zotero/zoteroPane.js | 10 +++++++--- scss/elements/_itemDetails.scss | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/elements/itemPane.js b/chrome/content/zotero/elements/itemPane.js index c2a79c489c..e602e9fa6e 100644 --- a/chrome/content/zotero/elements/itemPane.js +++ b/chrome/content/zotero/elements/itemPane.js @@ -27,7 +27,7 @@ { class ItemPane extends XULElementBase { content = MozXULElement.parseXULToFragment(` - + diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 795018660b..c73625ab4e 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -6030,7 +6030,7 @@ var ZoteroPane = new function() this.unserializePersist = function () { _unserialized = true; var serializedValues = Zotero.Prefs.get("pane.persist"); - if(!serializedValues) return; + if (!serializedValues) return; serializedValues = JSON.parse(serializedValues); for (var id in serializedValues) { @@ -6041,7 +6041,7 @@ var ZoteroPane = new function() } 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 // people close them by accident and don't know how to get them back // TODO: Add a hidden pref to allow them to stay closed if people really want that? @@ -6050,6 +6050,9 @@ var ZoteroPane = new function() && Zotero.Prefs.get('reopenPanesOnRestart')) { continue; } + if (["width", "height"].includes(attr)) { + el.style[attr] = `${elValues[attr]}px`; + } el.setAttribute(attr, elValues[attr]); } } @@ -6058,7 +6061,8 @@ var ZoteroPane = new function() // may not yet be initialized try { this.itemsView.sort(); - } catch(e) {}; + } + catch (e) {} } }; diff --git a/scss/elements/_itemDetails.scss b/scss/elements/_itemDetails.scss index 2a26f57417..29fa03faee 100644 --- a/scss/elements/_itemDetails.scss +++ b/scss/elements/_itemDetails.scss @@ -13,6 +13,7 @@ min-height: 0; flex: 1; width: auto !important; + height: auto !important; min-width: $min-width-item-pane; /* Need a min height to prevent layout issues in stacked mode */ min-height: 168px;