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
This commit is contained in:
Dan Stillman 2014-06-23 23:36:36 -04:00
parent bcc7a4ae86
commit be49010783
4 changed files with 11 additions and 5 deletions

View file

@ -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 { "

View file

@ -42,6 +42,8 @@ Zotero_Preferences.General = {
statusBarRow.hidden = false;
}
}
document.getElementById('noteFontSize').value = Zotero.Prefs.get('note.fontSize');
},
/**

View file

@ -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"/>

View file

@ -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;