[DE] Resize refactoring

This commit is contained in:
Julia Radzhabova 2021-12-22 21:39:04 +03:00
parent 44562bd7d4
commit 5329959449
3 changed files with 26 additions and 29 deletions

View file

@ -497,6 +497,7 @@ define([
},
setMoreButton: function(tab, panel) {
var me = this;
if (!btnsMore[tab]) {
var box = $('<div class="more-box" style="position: absolute;right: 0; padding-left: 12px;padding-right: 6px;display: none;">' +
'<div class="separator long" style="position: relative;display: table-cell;"></div>' +
@ -511,7 +512,7 @@ define([
});
btnsMore[tab].render(box.find('.slot-btn-more'));
btnsMore[tab].on('toggle', function(btn, state, e) {
Common.NotificationCenter.trigger('more:toggle', btn, state);
(state) ? me.onMoreShow(btn, e) : me.onMoreHide(btn, e);
});
var moreContainer = $('<div class="dropdown-menu more-container"><div style="display: inline;"></div></div>');
optsFold.$bar.append(moreContainer);
@ -734,6 +735,29 @@ define([
}
},
onMoreHide: function(btn, e) {
var moreContainer = btn.panel.parent();
if (btn.pressed) {
btn.toggle(false, true);
}
if (moreContainer.is(':visible')) {
moreContainer.hide();
Common.NotificationCenter.trigger('edit:complete', this.toolbar, btn);
}
},
onMoreShow: function(btn, e) {
var moreContainer = btn.panel.parent(),
parentxy = moreContainer.parent().offset(),
target = btn.$el,
showxy = target.offset(),
right = Common.Utils.innerWidth() - (showxy.left - parentxy.left + target.width()),
top = showxy.top - parentxy.top + target.height() + 10;
moreContainer.css({right: right, left: 'auto', top : top});
moreContainer.show();
},
hideMoreBtns: function() {
for (var btn in btnsMore) {
btnsMore[btn] && btnsMore[btn].toggle(false);

View file

@ -204,7 +204,7 @@
background-color: @background-toolbar-ie;
background-color: @background-toolbar;
min-width:auto;
padding: 5px 10px 5px 0;
padding: 10px 10px 5px 0;
border-radius: 0;
z-index:999;
.compactwidth {

View file

@ -364,7 +364,6 @@ define([
Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this));
$('#id-toolbar-menu-new-control-color').on('click', _.bind(this.onNewControlsColor, this));
toolbar.listStylesAdditionalMenuItem.on('click', this.onMenuSaveStyle.bind(this));
Common.NotificationCenter.on('more:toggle', _.bind(this.onMoreToggle, this));
this.onSetupCopyStyleButton();
this.onBtnChangeState('undo:disabled', toolbar.btnUndo, toolbar.btnUndo.isDisabled());
@ -3327,32 +3326,6 @@ define([
})).show();
},
onMoreToggle: function(btn, state, e) {
(state) ? this.onMoreShow(btn, e) : this.onMoreHide(btn, e);
},
onMoreHide: function(btn, e) {
var moreContainer = btn.panel.parent();
if (btn.pressed) {
btn.toggle(false, true);
}
if (moreContainer.is(':visible')) {
moreContainer.hide();
Common.NotificationCenter.trigger('edit:complete', this.toolbar, btn);
}
},
onMoreShow: function(btn, e) {
var moreContainer = btn.panel.parent();
var target = btn.$el,
showxy = target.offset(),
right = Common.Utils.innerWidth() - showxy.left - target.width(),
top = showxy.top + target.height();
moreContainer.css({right: right, left: 'auto', top : top});
moreContainer.show();
},
textEmptyImgUrl : 'You need to specify image URL.',
textWarning : 'Warning',
textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 300',