summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-03-26 10:33:26 +0100
committerChristophe Simonis <chs@odoo.com>2019-03-26 10:33:26 +0100
commit5dbf7bf357f8f76a9e36f4707bd9e9bfc77e3436 (patch)
treefecaa70fd89a26938b03ad124cb326b6523f47bc /addons/web_editor/static/src
parent02f5b654c385772649534fe205d3328fb21354ba (diff)
parentf00c490be8688d80f211f6755b5ada541eefd602 (diff)
[MERGE] forward port branch saas-12.1 up to f00c490be86
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/backend/convert_inline.js2
-rw-r--r--addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js14
-rw-r--r--addons/web_editor/static/src/scss/web_editor.common.scss2
3 files changed, 15 insertions, 3 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();
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 6f83dc28524..76f167e0a7d 100644
--- a/addons/web_editor/static/src/scss/web_editor.common.scss
+++ b/addons/web_editor/static/src/scss/web_editor.common.scss
@@ -203,7 +203,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);