diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 07a94cb51..4f8f3eb0d 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -816,6 +816,11 @@ define([ this.leftMenu.panelThumbnails.hide(); this.leftMenu.onBtnMenuClick(this.leftMenu.btnThumbnails); } + else if (this.leftMenu.btnNavigation.isActive()) { + this.leftMenu.btnNavigation.toggle(false); + this.leftMenu.panelNavigation.hide(); + this.leftMenu.onBtnMenuClick(this.leftMenu.btnNavigation); + } } } }, diff --git a/apps/documenteditor/main/app/controller/Navigation.js b/apps/documenteditor/main/app/controller/Navigation.js index fa2f2b980..31daa23b5 100644 --- a/apps/documenteditor/main/app/controller/Navigation.js +++ b/apps/documenteditor/main/app/controller/Navigation.js @@ -118,6 +118,10 @@ define([ panelNavigation.viewNavigationList.on('item:add', _.bind(this.onItemAdd, this)); panelNavigation.navigationMenu.on('item:click', _.bind(this.onMenuItemClick, this)); panelNavigation.navigationMenu.items[11].menu.on('item:click', _.bind(this.onMenuLevelsItemClick, this)); + panelNavigation.btnSettingsMenu.on('item:click', _.bind(this.onMenuSettingsItemClick, this)); + panelNavigation.btnSettingsMenu.items[2].menu.on('item:click', _.bind(this.onMenuLevelsItemClick, this)); + panelNavigation.btnSettingsMenu.items[4].menu.on('item:click', _.bind(this.onMenuFontSizeClick, this)); + panelNavigation.btnClose.on('click', _.bind(this.onClickClosePanel, this)); var viewport = this.getApplication().getController('Viewport').getView('Viewport'); viewport.hlayout.on('layout:resizedrag', function () { @@ -245,7 +249,6 @@ define([ onMenuItemClick: function (menu, item) { if (!this._navigationObject && !this._viewerNavigationObject) return; - var index = parseInt(menu.cmpEl.attr('data-value')); if (item.value == 'promote') { this._navigationObject.promote(index); @@ -265,11 +268,32 @@ define([ this.panelNavigation.viewNavigationList.collapseAll(); } }, + onClickClosePanel: function() { + Common.NotificationCenter.trigger('leftmenu:change', 'hide'); + }, + + onMenuSettingsItemClick: function (menu, item){ + switch (item.value){ + case 'expand': + this.panelNavigation.viewNavigationList.expandAll(); + break; + case 'collapse': + this.panelNavigation.viewNavigationList.collapseAll(); + break; + case 'wrap': + this.panelNavigation.changeWrapHeadings(); + break; + } + }, onMenuLevelsItemClick: function (menu, item) { this.panelNavigation.viewNavigationList.expandToLevel(item.value-1); }, + onMenuFontSizeClick: function (menu, item){ + this.panelNavigation.changeFontSize(item.value); + }, + SetDisabled: function(state) { this._isDisabled = state; }, diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index a6ad60492..a51a96b0e 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -154,7 +154,7 @@ define([ this.btnNavigation = new Common.UI.Button({ el: $markup.elementById('#left-btn-navigation'), - hint: this.tipNavigation, + hint: this.tipOutline, enableToggle: true, disabled: true, toggleGroup: 'leftMenuGroup' @@ -501,6 +501,7 @@ define([ txtTrial: 'TRIAL MODE', txtTrialDev: 'Trial Developer Mode', tipNavigation: 'Navigation', + tipOutline: 'Headings', txtLimit: 'Limit Access' }, DE.Views.LeftMenu || {})); }); diff --git a/apps/documenteditor/main/app/view/Navigation.js b/apps/documenteditor/main/app/view/Navigation.js index 6bf35e380..83b41c226 100644 --- a/apps/documenteditor/main/app/view/Navigation.js +++ b/apps/documenteditor/main/app/view/Navigation.js @@ -49,7 +49,11 @@ define([ storeNavigation: undefined, template: _.template([ '
' @@ -63,8 +67,97 @@ define([ render: function(el) { el = el || this.el; $(el).html(this.template({scope: this})); + var isWrap = Common.localStorage.getBool("de-outline-wrap",true); + var fontSizeClass = Common.localStorage.getItem("de-outline-fontsize"); + if(!fontSizeClass) fontSizeClass = 'medium'; this.$el = $(el); + this.btnClose = new Common.UI.Button({ + parentEl: $('#navigation-btn-close', this.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-close', + hint: this.txtClosePanel, + }); + + this.btnSettings = new Common.UI.Button({ + parentEl: $('#navigation-btn-settings', this.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-settings', + hint: this.txtSettings, + menu: new Common.UI.Menu({ + menuAlign: 'tr-br', + style: 'min-width: auto;', + items: [ + { + caption: this.txtExpand, + value: 'expand', + iconCls : 'menu__icon expand-all' + }, + { + caption: this.txtCollapse, + value: 'collapse', + iconCls : 'menu__icon collapse-all' + }, + { + caption: this.txtExpandToLevel, + value: 'expand-level', + menu: new Common.UI.Menu({ + menuAlign: 'tl-tr', + style: 'min-width: auto;', + items: [{ caption : '1', value: 1 }, { caption : '2', value: 2 }, { caption : '3', value: 3 }, + { caption : '4', value: 4 }, { caption : '5', value: 5 }, { caption : '6', value: 6 }, + { caption : '7', value: 7 }, { caption : '8', value: 8 }, { caption : '9', value: 9 }]}) + }, + { + caption: '--', + visible: true + }, + { + caption: this.txtFontSize, + value: 'font-size', + menu: new Common.UI.Menu({ + menuAlign: 'tl-tr', + style: 'min-width: auto;', + items: [ + { + caption: this.txtSmall, + checkable: true, + value: 'small', + checked: fontSizeClass == 'small', + toggleGroup: 'fontsize' + }, + { + caption: this.txtMedium, + checkable: true, + value: 'medium', + checked: fontSizeClass == 'medium', + toggleGroup: 'fontsize' + }, + { + caption: this.txtLarge, + checkable: true, + checked: fontSizeClass == 'large', + value: 'large', + toggleGroup: 'fontsize' + } + ]}) + + }, + { + caption: '--', + visible: true + }, + { + caption: this.txtWrapHeadings, + checkable: true, + checked: isWrap, + value: 'wrap' + } + ] + }) + }); + this.btnSettingsMenu = this.btnSettings.menu; + this.viewNavigationList = new Common.UI.TreeView({ el: $('#navigation-list'), store: this.storeNavigation, @@ -75,7 +168,10 @@ define([ delayRenderTips: true, minScrollbarLength: 25 }); + this.viewNavigationList.cmpEl.off('click'); + this.viewNavigationList.$el.addClass( fontSizeClass); + isWrap && this.viewNavigationList.$el.addClass( 'wrap'); this.navigationMenu = new Common.UI.Menu({ cls: 'shifted-right', items: [{ @@ -137,7 +233,6 @@ define([ } ] }); - this.trigger('render:after', this); return this; }, @@ -152,6 +247,21 @@ define([ this.fireEvent('hide', this ); }, + changeWrapHeadings: function(){ + Common.localStorage.setBool("de-outline-wrap", this.btnSettingsMenu.items[6].checked); + if(!this.btnSettingsMenu.items[6].checked) + this.viewNavigationList.$el.removeClass('wrap'); + else + this.viewNavigationList.$el.addClass('wrap'); + }, + + changeFontSize: function (value){ + Common.localStorage.setItem("de-outline-fontsize", value); + this.viewNavigationList.$el.removeClass(); + this.viewNavigationList.$el.addClass( value); + this.changeWrapHeadings(); + }, + ChangeSettings: function(props) { }, @@ -166,7 +276,15 @@ define([ txtExpandToLevel: 'Expand to level...', txtEmpty: 'There are no headings in the document.