From 1b76671d1886b1a6456d2f07e32ecc727cd42783 Mon Sep 17 00:00:00 2001 From: OVSharova Date: Wed, 20 Apr 2022 16:58:28 +0300 Subject: [PATCH] fix bugs --- .../main/app/controller/Navigation.js | 2 ++ .../main/app/view/Navigation.js | 27 ++++++++++++++----- .../main/resources/less/navigation.less | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Navigation.js b/apps/documenteditor/main/app/controller/Navigation.js index 1ce213486..0fc01e300 100644 --- a/apps/documenteditor/main/app/controller/Navigation.js +++ b/apps/documenteditor/main/app/controller/Navigation.js @@ -244,6 +244,7 @@ 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); } else if (item.value == 'demote') { @@ -262,6 +263,7 @@ define([ this.panelNavigation.viewNavigationList.collapseAll(); } }, + onMenuSettingsItemClick: function (menu, item){ switch (item.value){ case 'expand': diff --git a/apps/documenteditor/main/app/view/Navigation.js b/apps/documenteditor/main/app/view/Navigation.js index a9a6ce818..fefe7978e 100644 --- a/apps/documenteditor/main/app/view/Navigation.js +++ b/apps/documenteditor/main/app/view/Navigation.js @@ -54,7 +54,7 @@ define([ '', '', '', - '' ].join('')), @@ -67,8 +67,11 @@ 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"); this.$el = $(el); - this.fontSizeClass = 'medium'; + + this.btnClose = new Common.UI.Button({ parentEl: $('#navigation-btn-close', this.$el), cls: 'btn-toolbar', @@ -99,7 +102,7 @@ define([ caption: this.txtExpandToLevel, value: 'expand-level', menu: new Common.UI.Menu({ - menuAlign: 'tl-br', + 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 }, @@ -114,25 +117,27 @@ define([ caption: this.txtFontSize, value: 'font-size', menu: new Common.UI.Menu({ - menuAlign: 'tl-br', + 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: true, + checked: fontSizeClass == 'medium', toggleGroup: 'fontsize' }, { caption: this.txtLarge, checkable: true, + checked: fontSizeClass == 'large', value: 'large', toggleGroup: 'fontsize' } @@ -146,6 +151,7 @@ define([ { caption: this.txtWrapHeadings, checkable: true, + checked: isWrap, value: 'wrap' } ] @@ -165,6 +171,8 @@ define([ }); 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: [{ @@ -226,7 +234,6 @@ define([ } ] }); - this.trigger('render:after', this); return this; }, @@ -242,17 +249,25 @@ define([ }, 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) { + + this.btnSettingsMenu.items[4].menu.items.forEach(function (item){ + item.checked = (item.value==fontsize); + }); }, txtPromote: 'Promote', diff --git a/apps/documenteditor/main/resources/less/navigation.less b/apps/documenteditor/main/resources/less/navigation.less index b874f3456..5ac2ab41a 100644 --- a/apps/documenteditor/main/resources/less/navigation.less +++ b/apps/documenteditor/main/resources/less/navigation.less @@ -10,6 +10,7 @@ top: 0; width: 100%; padding: 10px 12px; + marging-top: 2px; overflow: hidden; border-bottom: @scaled-one-px-value-ie solid @border-toolbar-ie; border-bottom: @scaled-one-px-value solid @border-toolbar;