diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index a35b548d9..a0304e2e2 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -100,7 +100,8 @@ define([ 'collaboration:chat': _.bind(this.onShowHideChat, this) }, 'ViewTab': { - 'viewtab:navigation': _.bind(this.onShowHideNavigation, this) + 'viewtab:navigation': _.bind(this.onShowHideNavigation, this), + 'leftmenu:hide': _.bind(this.onLeftMenuHide, this) }, 'SearchBar': { 'search:show': _.bind(this.onShowHideSearch, this) @@ -916,6 +917,17 @@ define([ } }, + onLeftMenuHide: function (view, status) { + if (this.leftMenu) { + !status && this.leftMenu.close(); + status ? this.leftMenu.show() : this.leftMenu.hide(); + Common.localStorage.setBool('de-hidden-leftmenu', !status); + } + + Common.NotificationCenter.trigger('layout:changed', 'main'); + Common.NotificationCenter.trigger('edit:complete', this.leftMenu); + }, + textNoTextFound : 'Text not found', newDocumentTitle : 'Unnamed document', requestEditRightsText : 'Requesting editing rights...', diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index d1c2f29ef..ebb992593 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1667,6 +1667,8 @@ define([ toolbarController.setMode(this.appOptions); documentHolder.setMode(this.appOptions); + viewport.applyCommonMode(); + this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this)); this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this)); diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index eb0403860..1261c0156 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -65,6 +65,9 @@ define([ this.addListeners({ 'RightMenu': { 'rightmenuclick': this.onRightMenuClick + }, + 'ViewTab': { + 'rightmenu:hide': _.bind(this.onRightMenuHide, this) } }); @@ -491,6 +494,17 @@ define([ this.onFocusObject(selectedElements); } } + }, + + onRightMenuHide: function (view, status) { + if (this.rightmenu) { + !status && this.rightmenu.clearSelection(); + status ? this.rightmenu.show() : this.rightmenu.hide(); + Common.localStorage.setBool('de-hidden-rightmenu', !status); + } + + Common.NotificationCenter.trigger('layout:changed', 'main'); + Common.NotificationCenter.trigger('edit:complete', this.rightmenu); } }); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 2c83c6d2e..921db2e4a 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -131,18 +131,35 @@ define([ me.view.btnInterfaceTheme.$el.closest('.group').remove(); me.view.$el.find('.separator-theme').remove(); } + var emptyGroup = []; if (config.canBrandingExt && config.customization && config.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) { + emptyGroup.push(me.view.chStatusbar.$el.closest('.elset')); me.view.chStatusbar.$el.remove(); - var slotChkRulers = me.view.chRulers.$el, - groupRulers = slotChkRulers.closest('.group'), - groupToolbar = me.view.chToolbar.$el.closest('.group'); - groupToolbar.find('.elset')[1].append(slotChkRulers[0]); - groupRulers.remove(); - me.view.$el.find('.separator-rulers').remove(); } - if (!config.isEdit) { // if view tab will be visible in view/restricted-editing mode - me.view.chRulers.hide(); + if (config.canBrandingExt && config.customization && config.customization.leftMenu === false || !Common.UI.LayoutManager.isElementVisible('leftMenu')) { + emptyGroup.push(me.view.chLeftMenu.$el.closest('.elset')); + me.view.chLeftMenu.$el.remove(); + } else if (emptyGroup.length>0) { + emptyGroup.push(me.view.chLeftMenu.$el.closest('.elset')); + emptyGroup.shift().append(me.view.chLeftMenu.$el[0]); + } + + if (!config.isEdit || config.canBrandingExt && config.customization && config.customization.rightMenu === false || !Common.UI.LayoutManager.isElementVisible('rightMenu')) { + emptyGroup.push(me.view.chRightMenu.$el.closest('.elset')); + me.view.chRightMenu.$el.remove(); + } else if (emptyGroup.length>0) { + emptyGroup.push(me.view.chRightMenu.$el.closest('.elset')); + emptyGroup.shift().append(me.view.chRightMenu.$el[0]); + } + + if (emptyGroup.length>1) { // remove empty group + emptyGroup[emptyGroup.length-1].closest('.group').remove(); + } + + if (!config.isEdit) { + me.view.chRulers.$el.closest('.group').remove(); + me.view.chRulers.$el.remove(); me.view.$el.find('.separator-rulers').remove(); } diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index fb300ead9..b8974a153 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -82,6 +82,14 @@ define([ '' + '' + '' + + '
' + + '
' + + '' + + '
' + + '
' + + '' + + '
' + + '
' + '
' + '
' + '
' + @@ -114,6 +122,12 @@ define([ me.chRulers.on('change', _.bind(function (checkbox, state) { me.fireEvent('rulers:change', [me.chRulers, state === 'checked']); }, me)); + me.chLeftMenu.on('change', _.bind(function (checkbox, state) { + me.fireEvent('leftmenu:hide', [me.chLeftMenu, state === 'checked']); + }, me)); + me.chRightMenu.on('change', _.bind(function (checkbox, state) { + me.fireEvent('rightmenu:hide', [me.chRightMenu, state === 'checked']); + }, me)); me.btnDarkDocument.on('click', _.bind(function () { me.fireEvent('darkmode:change'); }, me)); @@ -237,6 +251,26 @@ define([ }); this.lockedControls.push(this.chToolbar); + this.chRightMenu = new Common.UI.CheckBox({ + lock: [_set.lostConnect, _set.disableOnStart], + labelText: this.textRightMenu, + value: !Common.localStorage.getBool("de-hidden-rightmenu"), + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chRightMenu); + + this.chLeftMenu = new Common.UI.CheckBox({ + lock: [_set.lostConnect, _set.disableOnStart], + labelText: this.textLeftMenu, + value: !Common.localStorage.getBool("de-hidden-leftmenu"), + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chLeftMenu); + this.chRulers = new Common.UI.CheckBox({ lock: [_set.lostConnect, _set.disableOnStart], labelText: this.textRulers, @@ -271,6 +305,8 @@ define([ this.chStatusbar.render($host.find('#slot-chk-statusbar')); this.chToolbar.render($host.find('#slot-chk-toolbar')); this.chRulers.render($host.find('#slot-chk-rulers')); + this.chLeftMenu.render($host.find('#slot-chk-leftmenu')); + this.chRightMenu.render($host.find('#slot-chk-rightmenu')); return this.$el; }, @@ -327,7 +363,9 @@ define([ tipFitToPage: 'Fit to page', tipFitToWidth: 'Fit to width', tipInterfaceTheme: 'Interface theme', - tipDarkDocument: 'Dark document' + tipDarkDocument: 'Dark document', + textLeftMenu: 'Left panel', + textRightMenu: 'Right panel' } }()), DE.Views.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/Viewport.js b/apps/documenteditor/main/app/view/Viewport.js index a90ad6f6b..0f908a02d 100644 --- a/apps/documenteditor/main/app/view/Viewport.js +++ b/apps/documenteditor/main/app/view/Viewport.js @@ -141,9 +141,16 @@ define([ rightMenuView = DE.getController('RightMenu').getView('RightMenu'); me._rightMenu = rightMenuView.render(this.mode); + if ( Common.localStorage.getBool('de-hidden-rightmenu') ) + me._rightMenu.hide(); + }, + applyCommonMode: function() { if ( Common.localStorage.getBool('de-hidden-status') ) DE.getController('Statusbar').getView('Statusbar').setVisible(false); + + if ( Common.localStorage.getBool('de-hidden-leftmenu') ) + DE.getController('LeftMenu').getView('LeftMenu').hide(); }, setMode: function(mode) {