mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
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.dispatcherRef = dis.register(this.onAction);
|
||||||
this._themeWatcher = new ThemeWatcher();
|
this._themeWatcher = new ThemeWatcher();
|
||||||
this._fontWatcher = new FontWatcher(10, 20);
|
this._fontWatcher = new FontWatcher();
|
||||||
this._themeWatcher.start();
|
this._themeWatcher.start();
|
||||||
this._fontWatcher.start();
|
this._fontWatcher.start();
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,7 @@ import dis from './dispatcher';
|
||||||
import SettingsStore, {SettingLevel} from './settings/SettingsStore';
|
import SettingsStore, {SettingLevel} from './settings/SettingsStore';
|
||||||
|
|
||||||
export class FontWatcher {
|
export class FontWatcher {
|
||||||
constructor(minSize, maxSize) {
|
constructor() {
|
||||||
this._min_size = minSize;
|
|
||||||
this._max_size = maxSize;
|
|
||||||
this._dispatcherRef = null;
|
this._dispatcherRef = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +38,11 @@ export class FontWatcher {
|
||||||
};
|
};
|
||||||
|
|
||||||
_setRootFontSize = size => {
|
_setRootFontSize = size => {
|
||||||
let fontSize = this._min_size < size ? size : this._min_size;
|
const min = SettingsStore.getValue("font_size_min");
|
||||||
fontSize = fontSize < this._max_size ? fontSize : this._max_size;
|
const max = SettingsStore.getValue("font_size_max");
|
||||||
|
|
||||||
|
const fontSize = Math.max(Math.min(max, size), min);
|
||||||
|
|
||||||
if (fontSize != size) {
|
if (fontSize != size) {
|
||||||
SettingsStore.setValue("font_size", null, SettingLevel.Device, fontSize);
|
SettingsStore.setValue("font_size", null, SettingLevel.Device, fontSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,6 +177,16 @@ export const SETTINGS = {
|
||||||
default: 16,
|
default: 16,
|
||||||
controller: new FontSizeController(),
|
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": {
|
"MessageComposerInput.suggestEmoji": {
|
||||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||||
displayName: _td('Enable Emoji suggestions while typing'),
|
displayName: _td('Enable Emoji suggestions while typing'),
|
||||||
|
|
Loading…
Reference in a new issue