Have max and min font configured in settings
This commit is contained in:
parent
98799611cf
commit
f5d6590751
3 changed files with 17 additions and 6 deletions
|
@ -266,7 +266,7 @@ export default createReactClass({
|
|||
|
||||
this.dispatcherRef = dis.register(this.onAction);
|
||||
this._themeWatcher = new ThemeWatcher();
|
||||
this._fontWatcher = new FontWatcher(10, 20);
|
||||
this._fontWatcher = new FontWatcher();
|
||||
this._themeWatcher.start();
|
||||
this._fontWatcher.start();
|
||||
|
||||
|
|
|
@ -18,9 +18,7 @@ import dis from './dispatcher';
|
|||
import SettingsStore, {SettingLevel} from './settings/SettingsStore';
|
||||
|
||||
export class FontWatcher {
|
||||
constructor(minSize, maxSize) {
|
||||
this._min_size = minSize;
|
||||
this._max_size = maxSize;
|
||||
constructor() {
|
||||
this._dispatcherRef = null;
|
||||
}
|
||||
|
||||
|
@ -40,8 +38,11 @@ export class FontWatcher {
|
|||
};
|
||||
|
||||
_setRootFontSize = size => {
|
||||
let fontSize = this._min_size < size ? size : this._min_size;
|
||||
fontSize = fontSize < this._max_size ? fontSize : this._max_size;
|
||||
const min = SettingsStore.getValue("font_size_min");
|
||||
const max = SettingsStore.getValue("font_size_max");
|
||||
|
||||
const fontSize = Math.max(Math.min(max, size), min);
|
||||
|
||||
if (fontSize != size) {
|
||||
SettingsStore.setValue("font_size", null, SettingLevel.Device, fontSize);
|
||||
}
|
||||
|
|
|
@ -177,6 +177,16 @@ export const SETTINGS = {
|
|||
default: 16,
|
||||
controller: new FontSizeController(),
|
||||
},
|
||||
"font_size_min": {
|
||||
displayName: _td("Min font size"),
|
||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||
default: 14,
|
||||
},
|
||||
"font_size_max": {
|
||||
displayName: _td("Max font size"),
|
||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||
default: 24,
|
||||
},
|
||||
"MessageComposerInput.suggestEmoji": {
|
||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||
displayName: _td('Enable Emoji suggestions while typing'),
|
||||
|
|
Loading…
Reference in a new issue