diff --git a/addons/mass_mailing/static/src/js/mass_mailing_editor.js b/addons/mass_mailing/static/src/js/mass_mailing_editor.js index 9e62986b383..c84981e6a06 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_editor.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_editor.js @@ -87,11 +87,11 @@ options.registry["width-x"] = options.Class.extend({ }); options.registry.table_item = options.Class.extend({ - on_clone: function ($clone) { + on_clone: function ($clone, options) { this._super.apply(this, arguments); // If we cloned a td or th element... - if (this.$target.is("td, th")) { + if (options.isCurrent && this.$target.is("td, th")) { // ... and that the td or th element was alone on its row ... if (this.$target.siblings().length === 1) { var $tr = $clone.parent(); diff --git a/addons/web_editor/static/src/js/snippets.editor.js b/addons/web_editor/static/src/js/snippets.editor.js index 91269285235..97830d2ae8e 100644 --- a/addons/web_editor/static/src/js/snippets.editor.js +++ b/addons/web_editor/static/src/js/snippets.editor.js @@ -1010,7 +1010,9 @@ data.Editor = Class.extend({ this.$target.after($clone); this.buildingBlock.call_for_all_snippets($clone, function (editor, $snippet) { for (var i in editor.styles) { - editor.styles[i].on_clone($snippet); + editor.styles[i].on_clone($snippet, { + isCurrent: ($snippet.is($clone)), + }); } }); return false; diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index ff41acfc677..4f9e66943e5 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -263,9 +263,13 @@ options.registry["margin-x"] = options.registry.marginAndResize.extend({ return this.grid; }, - on_clone: function ($clone) { - var _class = $clone.attr("class").replace(/\s*(col-lg-offset-|col-md-offset-)([0-9-]+)/g, ''); - $clone.attr("class", _class); + on_clone: function ($clone, options) { + // Below condition is added to remove offset of target element only + // and not its children to avoid design alteration of a container / block. + if (options.isCurrent) { + var _class = $clone.attr("class").replace(/\s*(col-lg-offset-|col-md-offset-)([0-9-]+)/g, ''); + $clone.attr("class", _class); + } return false; }, on_resize: function (compass, beginClass, current) {