commit be4901078396f43683973412f870bc0617c33584 parent bcc7a4ae860e9d3d24df3063952858a288dbf31f Author: Dan Stillman <dstillman@zotero.org> Date: Mon, 23 Jun 2014 23:36:36 -0400 Use 11 instead of 6 on invalid note font size Also don't validate font size until after pref field is blurred, to allow numbers to be typed in properly Diffstat:
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml @@ -441,13 +441,17 @@ // Add CSS rules to notes if (self.mode == 'note') { + let fontSize = Zotero.Prefs.get('note.fontSize'); + // Fix empty old font prefs before a value was enforced + if (fontSize < 6) { + fontSize = 11; + } var css = "body#zotero-tinymce-note.mceContentBody, " + "body#zotero-tinymce-note.mceContentBody p, " + "body#zotero-tinymce-note.mceContentBody th, " + "body#zotero-tinymce-note.mceContentBody td, " + "body#zotero-tinymce-note.mceContentBody pre { " - + "font-size: " - + Math.max(6, Zotero.Prefs.get('note.fontSize')) + "px; " + + "font-size: " + fontSize + "px; " + "} " + "body#zotero-tinymce-note.mceContentBody, " + "body#zotero-tinymce-note.mceContentBody p { " diff --git a/chrome/content/zotero/preferences/preferences_general.js b/chrome/content/zotero/preferences/preferences_general.js @@ -42,6 +42,8 @@ Zotero_Preferences.General = { statusBarRow.hidden = false; } } + + document.getElementById('noteFontSize').value = Zotero.Prefs.get('note.fontSize'); }, /** diff --git a/chrome/content/zotero/preferences/preferences_general.xul b/chrome/content/zotero/preferences/preferences_general.xul @@ -32,7 +32,6 @@ <preferences id="zotero-prefpane-general-preferences"> <preference id="pref-fontSize" name="extensions.zotero.fontSize" type="string"/> - <preference id="pref-noteFontSize" name="extensions.zotero.note.fontSize" type="string"/> <preference id="pref-automaticScraperUpdates" name="extensions.zotero.automaticScraperUpdates" type="bool"/> <preference id="pref-reportTranslationFailure" name="extensions.zotero.reportTranslationFailure" type="bool"/> <preference id="pref-automaticSnapshots" name="extensions.zotero.automaticSnapshots" type="bool"/> @@ -73,7 +72,8 @@ <label value="&zotero.preferences.fontSize.notes;" control="noteFontSize"/> </hbox> <hbox> - <menulist id="noteFontSize" preference="pref-noteFontSize" editable="true"> + <menulist id="noteFontSize" editable="true" + onblur="Zotero.Prefs.set('note.fontSize', this.value); this.value = Zotero.Prefs.get('note.fontSize');"> <menupopup> <menuitem label="11"/> <menuitem label="12"/> diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js @@ -2346,7 +2346,7 @@ Zotero.Prefs = new function(){ case "note.fontSize": var val = this.get('note.fontSize'); if (val < 6) { - this.set('note.fontSize', 6); + this.set('note.fontSize', 11); } break;