From 7ca9e7879502a234371d19d5ad4d49455067cdcb Mon Sep 17 00:00:00 2001 From: Ramon Mi Date: Tue, 10 Mar 2026 15:25:27 +0800 Subject: [PATCH] feat(notes): add content width prefs for note and note tab --- .../zotero/preferences/preferences_general.xhtml | 16 ++++++++++++++++ chrome/content/zotero/xpcom/editorInstance.js | 6 ++++-- chrome/locale/en-US/zotero/preferences.ftl | 6 ++++++ defaults/preferences/zotero.js | 2 ++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_general.xhtml b/chrome/content/zotero/preferences/preferences_general.xhtml index 8f9abc4e30..a9fa9c011e 100644 --- a/chrome/content/zotero/preferences/preferences_general.xhtml +++ b/chrome/content/zotero/preferences/preferences_general.xhtml @@ -224,6 +224,22 @@ preference="extensions.zotero.openNoteInNewWindow" native="true" /> + + diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index 4d10d37834..f27f2c1eb6 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -92,6 +92,8 @@ class EditorInstance { Zotero.Prefs.registerObserver('note.fontSize', this._handleFontChange), Zotero.Prefs.registerObserver('note.tabFontSize', this._handleFontChange), Zotero.Prefs.registerObserver('note.fontFamily', this._handleFontChange), + Zotero.Prefs.registerObserver('note.contentViewMode', this._handleContentViewModeChange), + Zotero.Prefs.registerObserver('note.tabContentViewMode', this._handleContentViewModeChange), Zotero.Prefs.registerObserver('note.css', this._handleStyleChange), Zotero.Prefs.registerObserver('layout.spellcheckDefault', this._handleSpellCheckChange, true) ]; @@ -375,8 +377,8 @@ class EditorInstance { } _getContentViewMode() { - // TODO: Use prefs - return this._tabID ? 'comfortable' : 'wide'; + let contentViewModePrefKey = this._tabID ? 'note.tabContentViewMode' : 'note.contentViewMode'; + return Zotero.Prefs.get(contentViewModePrefKey) || 'wide'; } _handleFontChange = () => { diff --git a/chrome/locale/en-US/zotero/preferences.ftl b/chrome/locale/en-US/zotero/preferences.ftl index 8f94229d67..3e26a93dfb 100644 --- a/chrome/locale/en-US/zotero/preferences.ftl +++ b/chrome/locale/en-US/zotero/preferences.ftl @@ -31,6 +31,12 @@ preferences-reader-ebook-hyphenate = preferences-note-title = Notes preferences-note-open-in-new-window = .label = Open notes in new windows instead of tabs +preferences-note-content-view = Note content width +preferences-note-tab-content-view = Note tab content width +preferences-note-content-view-wide = + .label = Full width +preferences-note-content-view-comfortable = + .label = Readable width preferences-color-scheme = Color Scheme: preferences-color-scheme-auto = diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index 6e3edba9ff..e036ee528b 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -207,6 +207,8 @@ pref("extensions.zotero.fileHandler.snapshot", ""); pref("extensions.zotero.openReaderInNewWindow", false); pref("extensions.zotero.openNoteInNewWindow", false); +pref("extensions.zotero.note.contentViewMode", "wide"); +pref("extensions.zotero.note.tabContentViewMode", "comfortable"); // File/URL opening executable if launch() fails pref("extensions.zotero.fallbackLauncher.unix", "/usr/bin/xdg-open");