diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-03-26 10:33:26 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-03-26 10:33:26 +0100 |
| commit | 5dbf7bf357f8f76a9e36f4707bd9e9bfc77e3436 (patch) | |
| tree | fecaa70fd89a26938b03ad124cb326b6523f47bc /addons/web_editor/static/src/js | |
| parent | 02f5b654c385772649534fe205d3328fb21354ba (diff) | |
| parent | f00c490be8688d80f211f6755b5ada541eefd602 (diff) | |
[MERGE] forward port branch saas-12.1 up to f00c490be86
Diffstat (limited to 'addons/web_editor/static/src/js')
| -rw-r--r-- | addons/web_editor/static/src/js/backend/convert_inline.js | 2 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/backend/convert_inline.js b/addons/web_editor/static/src/js/backend/convert_inline.js index b6b36a388ef..0c985ba761f 100644 --- a/addons/web_editor/static/src/js/backend/convert_inline.js +++ b/addons/web_editor/static/src/js/backend/convert_inline.js @@ -175,7 +175,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/js/wysiwyg_snippets/snippets.editor.js b/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js index b4e783a5f6d..b8c6057bb0e 100644 --- a/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js +++ b/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js @@ -392,6 +392,7 @@ var SnippetEditor = Widget.extend({ */ _onDragAndDropStart: function () { var self = this; + this.dropped = false; self.size = { width: self.$target.width(), height: self.$target.height() @@ -439,10 +440,21 @@ var SnippetEditor = Widget.extend({ * 'move' button. * * @private + * @param {Event} ev + * @param {Object} ui */ - _onDragAndDropStop: function () { + _onDragAndDropStop: function (ev, ui) { this.$editable.find('.oe_drop_zone').droppable('destroy').remove(); + // 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; + } + } + var prev = this.$target.first()[0].previousSibling; var next = this.$target.last()[0].nextSibling; var $parent = this.$target.parent(); |
