Add hyphenation and text appearance options for EPUBs (#4256)

And remove duplicate string
This commit is contained in:
Abe Jellinek 2024-06-27 06:02:47 -04:00 committed by GitHub
parent 7f372fdd42
commit 5a6b1a9f76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 23 additions and 4 deletions

View file

@ -189,6 +189,13 @@
<menupopup/> <menupopup/>
</menulist> </menulist>
</hbox> </hbox>
<checkbox
class="indented-pref"
preference="extensions.zotero.reader.ebookHyphenate"
data-l10n-id="preferences-reader-ebook-hyphenate"
native="true"
/>
</groupbox> </groupbox>
<groupbox id="zotero-prefpane-locate-groupbox"> <groupbox id="zotero-prefpane-locate-groupbox">

View file

@ -202,6 +202,7 @@ class ReaderInstance {
showAnnotations: true, showAnnotations: true,
useDarkModeForContent: Zotero.Prefs.get('reader.contentDarkMode'), useDarkModeForContent: Zotero.Prefs.get('reader.contentDarkMode'),
fontFamily: Zotero.Prefs.get('reader.ebookFontFamily'), fontFamily: Zotero.Prefs.get('reader.ebookFontFamily'),
hyphenation: Zotero.Prefs.get('reader.ebookHyphenate'),
onOpenContextMenu: () => { onOpenContextMenu: () => {
// Functions can only be passed over wrappedJSObject (we call back onClick for context menu items) // Functions can only be passed over wrappedJSObject (we call back onClick for context menu items)
this._openContextMenu(this._iframeWindow.wrappedJSObject.contextMenuParams); this._openContextMenu(this._iframeWindow.wrappedJSObject.contextMenuParams);
@ -527,7 +528,8 @@ class ReaderInstance {
Zotero.Prefs.registerObserver('fontSize', this._handleFontSizeChange), Zotero.Prefs.registerObserver('fontSize', this._handleFontSizeChange),
Zotero.Prefs.registerObserver('tabs.title.reader', this._handleTabTitlePrefChange), Zotero.Prefs.registerObserver('tabs.title.reader', this._handleTabTitlePrefChange),
Zotero.Prefs.registerObserver('reader.contentDarkMode', this._handleContentDarkModeChange), Zotero.Prefs.registerObserver('reader.contentDarkMode', this._handleContentDarkModeChange),
Zotero.Prefs.registerObserver('reader.ebookFontFamily', this._handleFontFamilyChange), Zotero.Prefs.registerObserver('reader.ebookFontFamily', this._handleEbookPrefChange),
Zotero.Prefs.registerObserver('reader.ebookHyphenate', this._handleEbookPrefChange),
]; ];
return true; return true;
@ -858,8 +860,9 @@ class ReaderInstance {
this._internalReader.useDarkModeForContent(Zotero.Prefs.get('reader.contentDarkMode')); this._internalReader.useDarkModeForContent(Zotero.Prefs.get('reader.contentDarkMode'));
}; };
_handleFontFamilyChange = () => { _handleEbookPrefChange = () => {
this._internalReader.setFontFamily(Zotero.Prefs.get('reader.ebookFontFamily')); this._internalReader.setFontFamily(Zotero.Prefs.get('reader.ebookFontFamily'));
this._internalReader.setHyphenate(Zotero.Prefs.get('reader.ebookHyphenate'));
}; };
_dataURLtoBlob(dataurl) { _dataURLtoBlob(dataurl) {

View file

@ -24,6 +24,8 @@ preferences-reader-open-snapshots-using = Open snapshots using
preferences-reader-open-in-new-window = preferences-reader-open-in-new-window =
.label = Open files in new windows instead of tabs .label = Open files in new windows instead of tabs
preferences-reader-ebook-font = Ebook font: preferences-reader-ebook-font = Ebook font:
preferences-reader-ebook-hyphenate =
.label = Enable automatic hyphenation
preferences-color-scheme = Color Scheme: preferences-color-scheme = Color Scheme:
preferences-color-scheme-auto = preferences-color-scheme-auto =

View file

@ -1438,7 +1438,6 @@ pdfReader.phraseNotFound = Phrase not found
pdfReader.find = Find pdfReader.find = Find
pdfReader.close = Close pdfReader.close = Close
pdfReader.showThumbnails = Show Thumbnails pdfReader.showThumbnails = Show Thumbnails
pdfReader.showAnnotations = Show Annotations
pdfReader.showOutline = Show Outline pdfReader.showOutline = Show Outline
pdfReader.findPrevious = Find the previous occurrence of the phrase pdfReader.findPrevious = Find the previous occurrence of the phrase
pdfReader.findNext = Find the next occurrence of the phrase pdfReader.findNext = Find the next occurrence of the phrase
@ -1448,6 +1447,13 @@ pdfReader.toggleContextPane = Toggle Context Pane
pdfReader.highlightAll = Highlight all pdfReader.highlightAll = Highlight all
pdfReader.matchCase = Match case pdfReader.matchCase = Match case
pdfReader.wholeWords = Whole words pdfReader.wholeWords = Whole words
pdfReader.epubAppearance = Appearance
pdfReader.epubAppearance.lineHeight = Line height
pdfReader.epubAppearance.wordSpacing = Word spacing
pdfReader.epubAppearance.letterSpacing = Letter spacing
pdfReader.epubAppearance.lineHeight.revert = Use default line height
pdfReader.epubAppearance.wordSpacing.revert = Use default word spacing
pdfReader.epubAppearance.letterSpacing.revert = Use default letter spacing
spellCheck.checkSpelling = Check Spelling spellCheck.checkSpelling = Check Spelling
spellCheck.addRemoveDictionaries = Add/Remove Dictionaries… spellCheck.addRemoveDictionaries = Add/Remove Dictionaries…

View file

@ -224,6 +224,7 @@ pref("extensions.zotero.tabs.title.reader", "titleCreatorYear");
// Reader // Reader
pref("extensions.zotero.reader.contentDarkMode", true); pref("extensions.zotero.reader.contentDarkMode", true);
pref("extensions.zotero.reader.ebookFontFamily", "Georgia, serif"); pref("extensions.zotero.reader.ebookFontFamily", "Georgia, serif");
pref("extensions.zotero.reader.ebookHyphenate", true);
// Set color scheme to auto by default // Set color scheme to auto by default
pref("browser.theme.toolbar-theme", 2); pref("browser.theme.toolbar-theme", 2);

2
reader

@ -1 +1 @@
Subproject commit d90650c9125ef68488ffadfe737c9d9715555d73 Subproject commit be7deca7cebdb6d14a9bb4440b5b09edc456338b