Add reader text selection popup annotation mode toggle pref

Fixes #3352
This commit is contained in:
Martynas Bagdonas 2024-07-15 15:39:59 +03:00
parent 06741ceb62
commit abad33116b
3 changed files with 11 additions and 1 deletions

View file

@ -200,6 +200,7 @@ class ReaderInstance {
...Zotero.Intl.getPrefixedStrings('pdfReader.')
},
showAnnotations: true,
textSelectionAnnotationMode: Zotero.Prefs.get('reader.textSelectionAnnotationMode'),
useDarkModeForContent: Zotero.Prefs.get('reader.contentDarkMode'),
fontFamily: Zotero.Prefs.get('reader.ebookFontFamily'),
hyphenation: Zotero.Prefs.get('reader.ebookHyphenate'),
@ -518,6 +519,9 @@ class ReaderInstance {
iframe.browsingContext.textZoom = 1;
iframe.browsingContext.fullZoom = zoom;
},
onTextSelectionAnnotationModeChange: (mode) => {
Zotero.Prefs.set('reader.textSelectionAnnotationMode', mode);
}
}, this._iframeWindow, { cloneFunctions: true }));
this._resolveInitPromise();
@ -527,6 +531,7 @@ class ReaderInstance {
this._prefObserverIDs = [
Zotero.Prefs.registerObserver('fontSize', this._handleFontSizeChange),
Zotero.Prefs.registerObserver('tabs.title.reader', this._handleTabTitlePrefChange),
Zotero.Prefs.registerObserver('reader.textSelectionAnnotationMode', this._handleTextSelectionAnnotationModeChange),
Zotero.Prefs.registerObserver('reader.contentDarkMode', this._handleContentDarkModeChange),
Zotero.Prefs.registerObserver('reader.ebookFontFamily', this._handleEbookPrefChange),
Zotero.Prefs.registerObserver('reader.ebookHyphenate', this._handleEbookPrefChange),
@ -856,6 +861,10 @@ class ReaderInstance {
await this.updateTitle();
};
_handleTextSelectionAnnotationModeChange = () => {
this._internalReader.setTextSelectionAnnotationMode(Zotero.Prefs.get('reader.textSelectionAnnotationMode'));
};
_handleContentDarkModeChange = () => {
this._internalReader.useDarkModeForContent(Zotero.Prefs.get('reader.contentDarkMode'));
};

View file

@ -222,6 +222,7 @@ pref("extensions.zotero.scaffold.eslint.enabled", true);
pref("extensions.zotero.tabs.title.reader", "titleCreatorYear");
// Reader
pref("extensions.zotero.reader.textSelectionAnnotationMode", "highlight");
pref("extensions.zotero.reader.contentDarkMode", true);
pref("extensions.zotero.reader.ebookFontFamily", "Georgia, serif");
pref("extensions.zotero.reader.ebookHyphenate", true);

2
reader

@ -1 +1 @@
Subproject commit 4b37e0e23ae5749421acf46dc3bb73525622ae45
Subproject commit 58b304032aba2e2372cc7ee3f588225db0e70ad6