diff --git a/apps/common/main/lib/component/Mixtbar.js b/apps/common/main/lib/component/Mixtbar.js index f3e4ba840..74b785c60 100644 --- a/apps/common/main/lib/component/Mixtbar.js +++ b/apps/common/main/lib/component/Mixtbar.js @@ -374,20 +374,67 @@ define([ if ( $active && $active.length ) { var _maxright = $active.parents('.box-controls').width(); var data = $active.data(), - _rightedge = data.rightedge; + _rightedge = data.rightedge, + _btns = data.buttons, + _flex = data.flex; if ( !_rightedge ) { _rightedge = $active.get(0).getBoundingClientRect().right; } + if ( !_btns ) { + _btns = []; + _.each($active.find('.btn-slot .x-huge'), function(item) { + _btns.push($(item).closest('.btn-slot')); + }); + data.buttons = _btns; + } + if (!_flex) { + _flex = []; + _.each($active.find('.group.flex'), function(item) { + _flex.push($(item)); + }); + data.flex = _flex; + } - if ( _rightedge > _maxright ) { - if ( !$active.hasClass('compactwidth') ) { - $active.addClass('compactwidth'); - data.rightedge = _rightedge; + if ( _rightedge > _maxright) { + if (_flex.length>0) { + for (var i=0; i<_flex.length; i++) { + var item = _flex[i]; + if (item.outerWidth() > parseInt(item.css('min-width'))) + return; + else + item.css('width', item.css('min-width')); + } } + for (var i=_btns.length-1; i>=0; i--) { + var btn = _btns[i]; + if ( !btn.hasClass('compactwidth') ) { + btn.addClass('compactwidth'); + _rightedge = $active.get(0).getBoundingClientRect().right; + if (_rightedge <= _maxright) + break; + } + } + data.rightedge = _rightedge; } else { - if ($active.hasClass('compactwidth')) { - $active.removeClass('compactwidth'); + for (var i=0; i<_btns.length; i++) { + var btn = _btns[i]; + if ( btn.hasClass('compactwidth') ) { + btn.removeClass('compactwidth'); + _rightedge = $active.get(0).getBoundingClientRect().right; + if ( _rightedge > _maxright) { + btn.addClass('compactwidth'); + _rightedge = $active.get(0).getBoundingClientRect().right; + break; + } + } + } + data.rightedge = _rightedge; + if (_flex.length>0 && $active.find('.btn-slot.compactwidth').length<1) { + for (var i=0; i<_flex.length; i++) { + var item = _flex[i]; + item.css('width', item.css('max-width')); + } } } } diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 96a098cbb..ccdff0f1b 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -175,7 +175,7 @@ } /* ##adopt-panel-width */ - .panel.compactwidth:not(#plugns-panel) { + .panel:not(#plugns-panel) .compactwidth { .btn-group, .btn-toolbar { &.x-huge { .caption { diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index 56b59459a..abbc6ad38 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -96,7 +96,7 @@ -
+
diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index d25c0832e..9c1c7dc6d 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -87,7 +87,7 @@ define([ '' + '
' + '' + - '
' + + '
' + '
' + '
';