Refactor block highlight to be managed fully by highlight behavior

[MAILPOET-1819]
This commit is contained in:
Rostislav Wolny
2019-02-27 17:26:27 +01:00
committed by M. Shull
parent c526ba97e0
commit d69e0dea9e
5 changed files with 50 additions and 47 deletions

View File

@@ -190,22 +190,16 @@ Module.ContainerBlockView = base.BlockView.extend({
this.$('> .mailpoet_container').attr('class',
'mailpoet_container mailpoet_container_' + this.model.get('orientation') + ' ' + classIrregular);
},
showTools: function (mouseEvent) {
// Skip if user is dragging/resizing
if (mouseEvent && mouseEvent.buttons > 0) {
addHighlight: function addHighlight() {
if (this.renderOptions.depth !== 1 || this.$el.hasClass('mailpoet_container_layer_active')) {
return;
}
if (this.renderOptions.depth === 1 && !this.$el.hasClass('mailpoet_container_layer_active')) {
this.$(this.ui.tools).addClass('mailpoet_display_tools');
this.$el.addClass('mailpoet_highlight');
this.toolsView.triggerMethod('showTools');
}
this.$(this.ui.tools).addClass('mailpoet_display_tools');
this.$el.addClass('mailpoet_highlight');
this.toolsView.triggerMethod('showTools');
},
hideTools: function () {
if (this.renderOptions.depth !== 1
|| this.$el.hasClass('mailpoet_container_layer_active')
|| this._isBeingEdited
) {
removeHighlight: function removeHighlight() {
if (this.renderOptions.depth !== 1 || this.$el.hasClass('mailpoet_container_layer_active')) {
return;
}
this.$(this.ui.tools).removeClass('mailpoet_display_tools');