diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-03-25 19:45:26 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-03-25 19:45:26 +0100 |
| commit | f00c490be8688d80f211f6755b5ada541eefd602 (patch) | |
| tree | 39fad5136327db80653801f8a40f3c5c807c65d0 /addons/web_editor/static/src | |
| parent | 28a1371035fae9892e1ceeb6c9edd7ddda806ed5 (diff) | |
| parent | 11b1e12cde37cc002e475d11793be61d9d108290 (diff) | |
[MERGE] forward port branch 12.0 up to 11b1e12cde3
Diffstat (limited to 'addons/web_editor/static/src')
3 files changed, 15 insertions, 3 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 6a7b9397206..651e71f63a5 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -373,6 +373,7 @@ var SnippetEditor = Widget.extend({ */ _onDragAndDropStart: function () { var self = this; + this.dropped = false; self.size = { width: self.$target.width(), height: self.$target.height() @@ -418,10 +419,21 @@ var SnippetEditor = Widget.extend({ * 'move' button. * * @private + * @param {Event} ev + * @param {Object} ui */ - _onDragAndDropStop: function () { + _onDragAndDropStop: function (ev, ui) { var self = this; + // TODO lot of this is duplicated code of the d&d feature of snippets + if (!this.dropped) { + var $el = $.nearest({x: ui.position.left, y: ui.position.top}, '.oe_drop_zone').first(); + if ($el.length) { + $el.after(this.$target); + this.dropped = true; + } + } + $('.oe_drop_zone').droppable('destroy').remove(); var prev = this.$target.first()[0].previousSibling; diff --git a/addons/web_editor/static/src/js/editor/transcoder.js b/addons/web_editor/static/src/js/editor/transcoder.js index 85903f6b4eb..745e8492b11 100644 --- a/addons/web_editor/static/src/js/editor/transcoder.js +++ b/addons/web_editor/static/src/js/editor/transcoder.js @@ -174,7 +174,7 @@ function getMatchedCSSRules(a) { break; } $el = $el.parent(); - } while (!$el.is('html')); + } while ($el.length && !$el.is('html')); } return style; diff --git a/addons/web_editor/static/src/scss/web_editor.common.scss b/addons/web_editor/static/src/scss/web_editor.common.scss index c082e823cc0..a1de126b4e4 100644 --- a/addons/web_editor/static/src/scss/web_editor.common.scss +++ b/addons/web_editor/static/src/scss/web_editor.common.scss @@ -159,7 +159,7 @@ ul.oe_menu_editor { @mixin o-spacing-all($factor: 1) { // Generate vertical margin/padding classes used by the editor @for $i from 0 through (256 / 8) { - @include o-vspacing($i * 8); + @include o-vspacing($i * 8, $factor); } @include o-vspacing(4, $factor); |
