[DE PE] Fix view tab

This commit is contained in:
JuliaSvinareva 2021-12-12 16:46:42 +03:00
parent be3619a340
commit 0e75d15d57
2 changed files with 35 additions and 32 deletions

View file

@ -116,37 +116,38 @@ define([
onAppReady: function (config) { onAppReady: function (config) {
var me = this; var me = this;
(new Promise(function (accept, reject) { if (me.view) {
accept(); (new Promise(function (accept, reject) {
})).then(function(){ accept();
me.view.setEvents(); })).then(function(){
}); me.view.setEvents();
if (me.view.btnNavigation) { });
me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function(btn, state){
me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function (btn, state) {
if (state !== me.view.btnNavigation.pressed) if (state !== me.view.btnNavigation.pressed)
me.view.turnNavigation(state); me.view.turnNavigation(state);
}); });
}
var menuItems = [], var menuItems = [],
currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
for (var t in Common.UI.Themes.map()) { for (var t in Common.UI.Themes.map()) {
menuItems.push({ menuItems.push({
value: t, value: t,
caption: Common.UI.Themes.get(t).text, caption: Common.UI.Themes.get(t).text,
checked: t === currentTheme, checked: t === currentTheme,
checkable: true, checkable: true,
toggleGroup: 'interface-theme' toggleGroup: 'interface-theme'
}); });
} }
if ( menuItems.length ) { if (menuItems.length) {
this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems}));
this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
var value = item.value; var value = item.value;
Common.UI.Themes.setTheme(value); Common.UI.Themes.setTheme(value);
this.view.btnDarkDocument.setDisabled(value !== 'theme-dark'); this.view.btnDarkDocument.setDisabled(value !== 'theme-dark');
}, this)); }, this));
}
} }
}, },

View file

@ -135,11 +135,13 @@ define([
onAppReady: function (config) { onAppReady: function (config) {
var me = this; var me = this;
(new Promise(function (accept, reject) { if (me.view) {
accept(); (new Promise(function (accept, reject) {
})).then(function(){ accept();
me.view.setEvents(); })).then(function () {
}); me.view.setEvents();
});
}
}, },
onChangeZoomValue: function (value) { onChangeZoomValue: function (value) {
@ -172,7 +174,7 @@ define([
this.api.asc_ShowNotes(checked); this.api.asc_ShowNotes(checked);
Common.localStorage.setBool('pe-hidden-notes', !checked); Common.localStorage.setBool('pe-hidden-notes', !checked);
this.view.fireEvent('notes:hide', [!checked]); this.view.fireEvent('notes:hide', [!checked]);
Common.NotificationCenter.trigger('edit:complete', me.view); Common.NotificationCenter.trigger('edit:complete', this.view);
} }
}, PE.Controllers.ViewTab || {})); }, PE.Controllers.ViewTab || {}));