[all] added "dark theme" item in button "Options"
This commit is contained in:
parent
b84b3ccbdd
commit
db3a344760
|
@ -43,6 +43,10 @@ define([
|
|||
return Common.localStorage.getItem('ui-theme', 'theme-light');
|
||||
},
|
||||
|
||||
isDarkTheme: function () {
|
||||
return this.current() == 'theme-dark';
|
||||
},
|
||||
|
||||
setTheme: function (name) {
|
||||
if ( sdk_themes_relation.contains(name) ) {
|
||||
var classname = document.documentElement.className.replace(/theme-\w+\s?/, '');
|
||||
|
@ -51,6 +55,7 @@ define([
|
|||
this.api.asc_setSkin(sdk_themes_relation[name]);
|
||||
$(':root').addClass(name);
|
||||
Common.localStorage.setItem('ui-theme', name);
|
||||
Common.NotificationCenter.trigger('uitheme:change', name);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -768,6 +768,7 @@ define([
|
|||
textAdvSettings: 'Advanced Settings',
|
||||
tipViewSettings: 'View Settings',
|
||||
textRemoveFavorite: 'Remove from Favorites',
|
||||
textDarkTheme: 'Dark theme',
|
||||
textAddFavorite: 'Mark as favorite'
|
||||
}
|
||||
}(), Common.Views.Header || {}))
|
||||
|
|
|
@ -387,6 +387,7 @@ define([
|
|||
this.appOptions.canFeatureComparison = !!this.api.asc_isSupportFeature("comparison");
|
||||
this.appOptions.canFeatureContentControl = !!this.api.asc_isSupportFeature("content-controls");
|
||||
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
|
||||
this.appOptions.canChangeUITheme = true;
|
||||
|
||||
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
|
||||
|
||||
|
|
|
@ -313,6 +313,22 @@ define([
|
|||
cls : 'btn-toolbar'
|
||||
})).on('click', _on_btn_zoom.bind(me, 'up'));
|
||||
|
||||
if ( config.canChangeUITheme ) {
|
||||
var mnuitemDarkTheme = new Common.UI.MenuItem({
|
||||
caption: me.header.textDarkTheme,
|
||||
checked: Common.UI.Themes.isDarkTheme(),
|
||||
checkable: true,
|
||||
value: 'theme:dark'
|
||||
});
|
||||
|
||||
|
||||
me.header.btnOptions.menu.insertItem(7, mnuitemDarkTheme);
|
||||
me.header.btnOptions.menu.insertItem(7, {caption:'--'});
|
||||
Common.NotificationCenter.on('uitheme:change', function (name) {
|
||||
mnuitemDarkTheme.setChecked(Common.UI.Themes.isDarkTheme());
|
||||
});
|
||||
}
|
||||
|
||||
me.header.btnOptions.menu.on('item:click', me.onOptionsItemClick.bind(this));
|
||||
}
|
||||
},
|
||||
|
@ -400,6 +416,10 @@ define([
|
|||
Common.NotificationCenter.trigger('edit:complete', me.header);
|
||||
break;
|
||||
case 'advanced': me.header.fireEvent('file:settings', me.header); break;
|
||||
case 'theme:dark':
|
||||
if ( item.isChecked() != Common.UI.Themes.isDarkTheme() )
|
||||
Common.UI.Themes.toggleTheme();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -271,6 +271,7 @@
|
|||
"Common.Views.Header.tipViewUsers": "View users and manage document access rights",
|
||||
"Common.Views.Header.txtAccessRights": "Change access rights",
|
||||
"Common.Views.Header.txtRename": "Rename",
|
||||
"Common.Views.Header.textDarkTheme": "Dark theme",
|
||||
"Common.Views.History.textCloseHistory": "Close History",
|
||||
"Common.Views.History.textHide": "Collapse",
|
||||
"Common.Views.History.textHideAll": "Hide detailed changes",
|
||||
|
|
|
@ -345,6 +345,7 @@ define([
|
|||
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
|
||||
this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings;
|
||||
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
|
||||
this.appOptions.canChangeUITheme = true;
|
||||
|
||||
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
|
||||
|
||||
|
|
|
@ -316,6 +316,22 @@ define([
|
|||
cls : 'btn-toolbar'
|
||||
})).on('click', _on_btn_zoom.bind(me, 'up'));
|
||||
|
||||
if ( config.canChangeUITheme ) {
|
||||
var mnuitemDarkTheme = new Common.UI.MenuItem({
|
||||
caption: me.header.textDarkTheme,
|
||||
checked: Common.UI.Themes.isDarkTheme(),
|
||||
checkable: true,
|
||||
value: 'theme:dark'
|
||||
});
|
||||
|
||||
|
||||
me.header.btnOptions.menu.insertItem(7, mnuitemDarkTheme);
|
||||
me.header.btnOptions.menu.insertItem(7, {caption:'--'});
|
||||
Common.NotificationCenter.on('uitheme:change', function (name) {
|
||||
mnuitemDarkTheme.setChecked(Common.UI.Themes.isDarkTheme());
|
||||
});
|
||||
}
|
||||
|
||||
me.header.btnOptions.menu.on('item:click', me.onOptionsItemClick.bind(this));
|
||||
}
|
||||
},
|
||||
|
@ -443,6 +459,10 @@ define([
|
|||
Common.NotificationCenter.trigger('edit:complete', me.header);
|
||||
break;
|
||||
case 'advanced': me.header.fireEvent('file:settings', me.header); break;
|
||||
case 'theme:dark':
|
||||
if ( item.isChecked() != Common.UI.Themes.isDarkTheme() )
|
||||
Common.UI.Themes.toggleTheme();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -168,6 +168,7 @@
|
|||
"Common.Views.Header.tipViewUsers": "View users and manage document access rights",
|
||||
"Common.Views.Header.txtAccessRights": "Change access rights",
|
||||
"Common.Views.Header.txtRename": "Rename",
|
||||
"Common.Views.Header.textDarkTheme": "Dark theme",
|
||||
"Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:",
|
||||
"Common.Views.ImageFromUrlDialog.txtEmpty": "This field is required",
|
||||
"Common.Views.ImageFromUrlDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format",
|
||||
|
|
|
@ -374,6 +374,7 @@ define([
|
|||
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
|
||||
this.appOptions.canFeaturePivot = true;
|
||||
this.appOptions.canFeatureViews = !!this.api.asc_isSupportFeature("sheet-views");
|
||||
this.appOptions.canChangeUITheme = true;
|
||||
|
||||
if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge)
|
||||
Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
|
||||
|
|
|
@ -327,6 +327,22 @@ define([
|
|||
cls : 'btn-toolbar'
|
||||
})).on('click', _on_btn_zoom.bind(me, 'up'));
|
||||
|
||||
if ( config.canChangeUITheme ) {
|
||||
var mnuitemDarkTheme = new Common.UI.MenuItem({
|
||||
caption: me.header.textDarkTheme,
|
||||
checked: Common.UI.Themes.isDarkTheme(),
|
||||
checkable: true,
|
||||
value: 'theme:dark'
|
||||
});
|
||||
|
||||
|
||||
me.header.btnOptions.menu.insertItem(10, mnuitemDarkTheme);
|
||||
me.header.btnOptions.menu.insertItem(10, {caption:'--'});
|
||||
Common.NotificationCenter.on('uitheme:change', function (name) {
|
||||
mnuitemDarkTheme.setChecked(Common.UI.Themes.isDarkTheme());
|
||||
});
|
||||
}
|
||||
|
||||
me.header.btnOptions.menu.on('item:click', me.onOptionsItemClick.bind(this));
|
||||
}
|
||||
},
|
||||
|
@ -490,6 +506,10 @@ define([
|
|||
Common.localStorage.setBool('sse-freeze-shadow', item.isChecked());
|
||||
break;
|
||||
case 'advanced': me.header.fireEvent('file:settings', me.header); break;
|
||||
case 'theme:dark':
|
||||
if ( item.isChecked() != Common.UI.Themes.isDarkTheme() )
|
||||
Common.UI.Themes.toggleTheme();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@
|
|||
"Common.Views.Header.tipViewUsers": "View users and manage document access rights",
|
||||
"Common.Views.Header.txtAccessRights": "Change access rights",
|
||||
"Common.Views.Header.txtRename": "Rename",
|
||||
"Common.Views.Header.textDarkTheme": "Dark theme",
|
||||
"Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:",
|
||||
"Common.Views.ImageFromUrlDialog.txtEmpty": "This field is required",
|
||||
"Common.Views.ImageFromUrlDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format",
|
||||
|
|
Loading…
Reference in a new issue