diff options
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.editor.js | 16 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.options.js | 8 |
2 files changed, 19 insertions, 5 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 6599000d245..e731ec0fd99 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -84,6 +84,16 @@ var SnippetEditor = Widget.extend({ }); } + this.$target.on('transitionstart.snippet_editor, animationstart.snippet_editor', function () { + self._targetIsAnimated = true; + }); + this.$target.on('transitionend.snippet_editor, animationend.snippet_editor', function () { + self._targetIsAnimated = false; + if (self.$el.is('.oe_active')) { + self.cover(); + } + }); + return $.when.apply($, defs); }, /** @@ -92,6 +102,7 @@ var SnippetEditor = Widget.extend({ destroy: function () { this._super.apply(this, arguments); this.$target.removeData('snippet-editor'); + this.$target.off('.snippet_editor'); }, //-------------------------------------------------------------------------- @@ -123,6 +134,11 @@ var SnippetEditor = Widget.extend({ * Makes the editor overlay cover the associated snippet. */ cover: function () { + if (this._targetIsAnimated) { + // Do not cover a target being animated, it will be covered once the + // animation is completed. + return; + } var offset = this.$target.offset(); var manipulatorOffset = this.$el.parent().offset(); offset.top -= manipulatorOffset.top; diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 49285986240..e7580a4aa3b 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -289,13 +289,11 @@ var SnippetOption = Widget.extend({ .addClass('active'); _processSelectClassElements(this.$el); - _.each(this.$el.find('.dropdown-menu'), function (group) { - _processSelectClassElements($(group).children()); - }); - function _processSelectClassElements($elements) { + function _processSelectClassElements($el) { var maxNbClasses = -1; - $elements.filter('[data-select-class]') + $el.find('[data-select-class]') + .addBack('[data-select-class]') .removeClass('active') .filter(function () { var className = $(this).data('selectClass'); |
