mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
[common] refactoring
This commit is contained in:
@ -186,9 +186,6 @@ define([
|
||||
},
|
||||
}
|
||||
|
||||
var id_default_light_theme = 'theme-white',
|
||||
id_default_dark_theme = 'theme-dark';
|
||||
|
||||
var name_colors = [
|
||||
"toolbar-header-document",
|
||||
"toolbar-header-spreadsheet",
|
||||
@ -514,7 +511,7 @@ define([
|
||||
}
|
||||
const get_system_default_theme = function () {
|
||||
const id = get_system_theme_type() == THEME_TYPE_DARK ?
|
||||
id_default_dark_theme : id_default_light_theme;
|
||||
window.uitheme.DEFAULT_DARK_THEME_ID : window.uitheme.DEFAULT_LIGHT_THEME_ID;
|
||||
|
||||
return {id: id, info: themes_map[id]};
|
||||
};
|
||||
@ -677,7 +674,7 @@ define([
|
||||
},
|
||||
|
||||
currentThemeId: function () {
|
||||
return !!themes_map[window.uitheme.id] ? window.uitheme.id : id_default_light_theme;
|
||||
return !!themes_map[window.uitheme.id] ? window.uitheme.id : window.uitheme.DEFAULT_LIGHT_THEME_ID;
|
||||
},
|
||||
|
||||
currentThemeColor: function (token) {
|
||||
@ -685,7 +682,7 @@ define([
|
||||
},
|
||||
|
||||
defaultThemeId: function (type) {
|
||||
return type == 'dark' ? id_default_dark_theme : id_default_light_theme;
|
||||
return type == 'dark' ? window.uitheme.DEFAULT_LIGHT_THEME_ID : window.uitheme.DEFAULT_LIGHT_THEME_ID;
|
||||
},
|
||||
|
||||
defaultTheme: function (type) {
|
||||
@ -747,7 +744,7 @@ define([
|
||||
},
|
||||
|
||||
toggleTheme: function () {
|
||||
this.setTheme( this.isDarkTheme() ? id_default_light_theme : id_default_dark_theme );
|
||||
// this.setTheme( this.isDarkTheme() ? id_default_light_theme : id_default_dark_theme );
|
||||
},
|
||||
|
||||
getThemeColors: function() {
|
||||
|
||||
@ -167,11 +167,7 @@ if ( !window.uitheme.id && !!params.uitheme ) {
|
||||
}
|
||||
|
||||
if ( !window.uitheme.id ) {
|
||||
// TODO: because there are no new dark theme, default theme is "theme-white"
|
||||
// for all system color scheme
|
||||
// window.uitheme.adapt_to_system_theme();
|
||||
window.uitheme.id = "theme-white";
|
||||
window.uitheme.type = "light";
|
||||
window.uitheme.adapt_to_system_theme();
|
||||
} else {
|
||||
!window.uitheme.type && params.uitheme && (window.uitheme.type = params.uithemetype);
|
||||
}
|
||||
|
||||
@ -46,6 +46,9 @@
|
||||
|
||||
!window.uitheme && (window.uitheme = {});
|
||||
|
||||
window.uitheme.DEFAULT_LIGHT_THEME_ID = 'theme-white';
|
||||
window.uitheme.DEFAULT_DARK_THEME_ID = 'theme-night';
|
||||
|
||||
window.uitheme.set_id = function (id) {
|
||||
if ( id == 'theme-system' )
|
||||
this.adapt_to_system_theme();
|
||||
@ -63,7 +66,7 @@
|
||||
|
||||
window.uitheme.relevant_theme_id = function () {
|
||||
if ( this.is_theme_system() )
|
||||
return this.is_system_theme_dark() ? 'theme-night' : 'theme-white';
|
||||
return this.is_system_theme_dark() ? window.uitheme.DEFAULT_DARK_THEME_ID : window.uitheme.DEFAULT_LIGHT_THEME_ID;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user