[DE] Add settings for hiding left/right panels to view tab
This commit is contained in:
parent
b9c5b2b014
commit
62aa5cffed
|
@ -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...',
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,14 @@ define([
|
|||
'<span class="btn-slot text" id="slot-chk-statusbar"></span>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="group small">' +
|
||||
'<div class="elset">' +
|
||||
'<span class="btn-slot text" id="slot-chk-leftmenu"></span>' +
|
||||
'</div>' +
|
||||
'<div class="elset">' +
|
||||
'<span class="btn-slot text" id="slot-chk-rightmenu"></span>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="separator long separator-rulers"></div>' +
|
||||
'<div class="group small">' +
|
||||
'<div class="elset">' +
|
||||
|
@ -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 || {}));
|
||||
});
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue