summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web_editor/static')
-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);