[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) { setMoreButton: function(tab, panel) {
var me = this;
if (!btnsMore[tab]) { if (!btnsMore[tab]) {
var box = $('<div class="more-box" style="position: absolute;right: 0; padding-left: 12px;padding-right: 6px;display: none;">' + 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>' + '<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].render(box.find('.slot-btn-more'));
btnsMore[tab].on('toggle', function(btn, state, e) { 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>'); var moreContainer = $('<div class="dropdown-menu more-container"><div style="display: inline;"></div></div>');
optsFold.$bar.append(moreContainer); 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() { hideMoreBtns: function() {
for (var btn in btnsMore) { for (var btn in btnsMore) {
btnsMore[btn] && btnsMore[btn].toggle(false); btnsMore[btn] && btnsMore[btn].toggle(false);

View file

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

View file

@ -364,7 +364,6 @@ define([
Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this)); Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this));
$('#id-toolbar-menu-new-control-color').on('click', _.bind(this.onNewControlsColor, this)); $('#id-toolbar-menu-new-control-color').on('click', _.bind(this.onNewControlsColor, this));
toolbar.listStylesAdditionalMenuItem.on('click', this.onMenuSaveStyle.bind(this)); toolbar.listStylesAdditionalMenuItem.on('click', this.onMenuSaveStyle.bind(this));
Common.NotificationCenter.on('more:toggle', _.bind(this.onMoreToggle, this));
this.onSetupCopyStyleButton(); this.onSetupCopyStyleButton();
this.onBtnChangeState('undo:disabled', toolbar.btnUndo, toolbar.btnUndo.isDisabled()); this.onBtnChangeState('undo:disabled', toolbar.btnUndo, toolbar.btnUndo.isDisabled());
@ -3327,32 +3326,6 @@ define([
})).show(); })).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.', textEmptyImgUrl : 'You need to specify image URL.',
textWarning : 'Warning', textWarning : 'Warning',
textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 300', textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 300',