mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Merge pull request #1608 from hmhealey/safarifonts
Changed font changing code to use jquery to fix Safari weirdness
This commit is contained in:
@@ -695,15 +695,19 @@ export function applyTheme(theme) {
|
||||
}
|
||||
|
||||
export function applyFont(fontName) {
|
||||
const body = document.querySelector('body');
|
||||
const keys = Object.getOwnPropertyNames(body.classList);
|
||||
keys.forEach((k) => {
|
||||
const className = body.classList[k];
|
||||
if (className && className.lastIndexOf('font') === 0) {
|
||||
body.classList.remove(className);
|
||||
const body = $('body');
|
||||
|
||||
for (const key of Reflect.ownKeys(Constants.FONTS)) {
|
||||
const className = Constants.FONTS[key];
|
||||
|
||||
if (fontName === key) {
|
||||
if (!body.hasClass(className)) {
|
||||
body.addClass(className);
|
||||
}
|
||||
} else {
|
||||
body.removeClass(className);
|
||||
}
|
||||
});
|
||||
body.classList.add(Constants.FONTS[fontName]);
|
||||
}
|
||||
}
|
||||
|
||||
export function changeCss(className, classValue, classRepeat) {
|
||||
@@ -1238,4 +1242,4 @@ export function getPostTerm(post) {
|
||||
|
||||
export function isFeatureEnabled(feature) {
|
||||
return PreferenceStore.getPreference(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, Constants.FeatureTogglePrefix + feature.label, {value: 'false'}).value === 'true';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user