Adjust PDF reader and context pane UI based on font size pref
Fixes #2809
(cherry picked from commit 64897455f4
)
This commit is contained in:
parent
94392fce96
commit
20aa40c5d2
5 changed files with 19 additions and 1 deletions
|
@ -230,6 +230,7 @@ Zotero.Prefs = new function(){
|
|||
Zotero.setFontSize(
|
||||
Zotero.getActiveZoteroPane().document.getElementById('zotero-pane')
|
||||
);
|
||||
Zotero.setFontSize(Zotero.getActiveZoteroPane().document.getElementById('zotero-context-pane'));
|
||||
Zotero.getActiveZoteroPane().collectionsView && Zotero.getActiveZoteroPane().collectionsView.updateFontSize();
|
||||
Zotero.getActiveZoteroPane().itemsView && Zotero.getActiveZoteroPane().itemsView.updateFontSize();
|
||||
}],
|
||||
|
|
|
@ -85,6 +85,7 @@ class ReaderInstance {
|
|||
sidebarOpen: this._sidebarOpen,
|
||||
bottomPlaceholderHeight: this._bottomPlaceholderHeight,
|
||||
rtl: Zotero.rtl,
|
||||
fontSize: Zotero.Prefs.get('fontSize'),
|
||||
localizedStrings: {
|
||||
...Zotero.Intl.getPrefixedStrings('general.'),
|
||||
...Zotero.Intl.getPrefixedStrings('pdfReader.')
|
||||
|
@ -92,8 +93,17 @@ class ReaderInstance {
|
|||
}, [buf]);
|
||||
// Set title once again, because `ReaderWindow` isn't loaded the first time
|
||||
this.updateTitle();
|
||||
|
||||
this._prefObserverIDs = [
|
||||
Zotero.Prefs.registerObserver('fontSize', this._handleFontSizeChange)
|
||||
];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uninit() {
|
||||
this._prefObserverIDs.forEach(id => Zotero.Prefs.unregisterObserver(id));
|
||||
}
|
||||
|
||||
get itemID() {
|
||||
return this._itemID;
|
||||
|
@ -499,6 +509,10 @@ class ReaderInstance {
|
|||
|| item.parentItem && item.parentItem.deleted;
|
||||
}
|
||||
|
||||
_handleFontSizeChange = () => {
|
||||
this._postMessage({ action: 'setFontSize', fontSize: Zotero.Prefs.get('fontSize') });
|
||||
};
|
||||
|
||||
_dataURLtoBlob(dataurl) {
|
||||
let parts = dataurl.split(',');
|
||||
let mime = parts[0].match(/:(.*?);/)[1];
|
||||
|
@ -1369,6 +1383,7 @@ class Reader {
|
|||
for (let id of ids) {
|
||||
let reader = Zotero.Reader.getByTabID(id);
|
||||
if (reader) {
|
||||
reader.uninit();
|
||||
this._readers.splice(this._readers.indexOf(reader), 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ var ZoteroPane = new function()
|
|||
|
||||
var zp = document.getElementById('zotero-pane');
|
||||
Zotero.setFontSize(zp);
|
||||
Zotero.setFontSize(document.getElementById('zotero-context-pane'));
|
||||
ZoteroPane_Local.updateLayout();
|
||||
ZoteroPane_Local.updateToolbarPosition();
|
||||
this.updateWindow();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#zotero-context-pane-inner {
|
||||
width: 0;
|
||||
font: message-box;
|
||||
font-size: inherit;
|
||||
min-height: 100px;
|
||||
height: 100%;
|
||||
pointer-events: auto;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2ee130e0ecbbfe34807a5d5e2b3500ad6d99a57e
|
||||
Subproject commit d391b6bb33a496c21f29cc4ebc737cd2dac29b8f
|
Loading…
Add table
Add a link
Reference in a new issue