This commit is contained in:
OVSharova 2022-04-20 16:58:28 +03:00
parent 579066ca77
commit 1b76671d18
3 changed files with 24 additions and 6 deletions

View file

@ -244,6 +244,7 @@ define([
onMenuItemClick: function (menu, item) { onMenuItemClick: function (menu, item) {
if (!this._navigationObject && !this._viewerNavigationObject) return; if (!this._navigationObject && !this._viewerNavigationObject) return;
var index = parseInt(menu.cmpEl.attr('data-value'));
if (item.value == 'promote') { if (item.value == 'promote') {
this._navigationObject.promote(index); this._navigationObject.promote(index);
} else if (item.value == 'demote') { } else if (item.value == 'demote') {
@ -262,6 +263,7 @@ define([
this.panelNavigation.viewNavigationList.collapseAll(); this.panelNavigation.viewNavigationList.collapseAll();
} }
}, },
onMenuSettingsItemClick: function (menu, item){ onMenuSettingsItemClick: function (menu, item){
switch (item.value){ switch (item.value){
case 'expand': case 'expand':

View file

@ -54,7 +54,7 @@ define([
'<div id="navigation-btn-close" style="float:right;margin-left: 4px;"></div>', '<div id="navigation-btn-close" style="float:right;margin-left: 4px;"></div>',
'<div id="navigation-btn-settings" style="float:right;"></div>', '<div id="navigation-btn-settings" style="float:right;"></div>',
'</div>', '</div>',
'<div id="navigation-list" class="medium">', '<div id="navigation-list" class="">',
'</div>', '</div>',
'</div>' '</div>'
].join('')), ].join('')),
@ -67,8 +67,11 @@ define([
render: function(el) { render: function(el) {
el = el || this.el; el = el || this.el;
$(el).html(this.template({scope: this})); $(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.$el = $(el);
this.fontSizeClass = 'medium';
this.btnClose = new Common.UI.Button({ this.btnClose = new Common.UI.Button({
parentEl: $('#navigation-btn-close', this.$el), parentEl: $('#navigation-btn-close', this.$el),
cls: 'btn-toolbar', cls: 'btn-toolbar',
@ -99,7 +102,7 @@ define([
caption: this.txtExpandToLevel, caption: this.txtExpandToLevel,
value: 'expand-level', value: 'expand-level',
menu: new Common.UI.Menu({ menu: new Common.UI.Menu({
menuAlign: 'tl-br', menuAlign: 'tl-tr',
style: 'min-width: auto;', style: 'min-width: auto;',
items: [{ caption : '1', value: 1 }, { caption : '2', value: 2 }, { caption : '3', value: 3 }, 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 : '4', value: 4 }, { caption : '5', value: 5 }, { caption : '6', value: 6 },
@ -114,25 +117,27 @@ define([
caption: this.txtFontSize, caption: this.txtFontSize,
value: 'font-size', value: 'font-size',
menu: new Common.UI.Menu({ menu: new Common.UI.Menu({
menuAlign: 'tl-br', menuAlign: 'tl-tr',
style: 'min-width: auto;', style: 'min-width: auto;',
items: [ items: [
{ {
caption: this.txtSmall, caption: this.txtSmall,
checkable: true, checkable: true,
value: 'small', value: 'small',
checked: fontSizeClass == 'small',
toggleGroup: 'fontsize' toggleGroup: 'fontsize'
}, },
{ {
caption: this.txtMedium, caption: this.txtMedium,
checkable: true, checkable: true,
value: 'medium', value: 'medium',
checked: true, checked: fontSizeClass == 'medium',
toggleGroup: 'fontsize' toggleGroup: 'fontsize'
}, },
{ {
caption: this.txtLarge, caption: this.txtLarge,
checkable: true, checkable: true,
checked: fontSizeClass == 'large',
value: 'large', value: 'large',
toggleGroup: 'fontsize' toggleGroup: 'fontsize'
} }
@ -146,6 +151,7 @@ define([
{ {
caption: this.txtWrapHeadings, caption: this.txtWrapHeadings,
checkable: true, checkable: true,
checked: isWrap,
value: 'wrap' value: 'wrap'
} }
] ]
@ -165,6 +171,8 @@ define([
}); });
this.viewNavigationList.cmpEl.off('click'); this.viewNavigationList.cmpEl.off('click');
this.viewNavigationList.$el.addClass( fontSizeClass);
isWrap && this.viewNavigationList.$el.addClass( 'wrap');
this.navigationMenu = new Common.UI.Menu({ this.navigationMenu = new Common.UI.Menu({
cls: 'shifted-right', cls: 'shifted-right',
items: [{ items: [{
@ -226,7 +234,6 @@ define([
} }
] ]
}); });
this.trigger('render:after', this); this.trigger('render:after', this);
return this; return this;
}, },
@ -242,17 +249,25 @@ define([
}, },
changeWrapHeadings: function(){ changeWrapHeadings: function(){
Common.localStorage.setBool("de-outline-wrap", this.btnSettingsMenu.items[6].checked);
if(!this.btnSettingsMenu.items[6].checked) if(!this.btnSettingsMenu.items[6].checked)
this.viewNavigationList.$el.removeClass('wrap'); this.viewNavigationList.$el.removeClass('wrap');
else else
this.viewNavigationList.$el.addClass('wrap'); this.viewNavigationList.$el.addClass('wrap');
}, },
changeFontSize: function (value){ changeFontSize: function (value){
Common.localStorage.setItem("de-outline-fontsize", value);
this.viewNavigationList.$el.removeClass(); this.viewNavigationList.$el.removeClass();
this.viewNavigationList.$el.addClass( value); this.viewNavigationList.$el.addClass( value);
this.changeWrapHeadings(); this.changeWrapHeadings();
}, },
ChangeSettings: function(props) { ChangeSettings: function(props) {
this.btnSettingsMenu.items[4].menu.items.forEach(function (item){
item.checked = (item.value==fontsize);
});
}, },
txtPromote: 'Promote', txtPromote: 'Promote',

View file

@ -10,6 +10,7 @@
top: 0; top: 0;
width: 100%; width: 100%;
padding: 10px 12px; padding: 10px 12px;
marging-top: 2px;
overflow: hidden; overflow: hidden;
border-bottom: @scaled-one-px-value-ie solid @border-toolbar-ie; border-bottom: @scaled-one-px-value-ie solid @border-toolbar-ie;
border-bottom: @scaled-one-px-value solid @border-toolbar; border-bottom: @scaled-one-px-value solid @border-toolbar;