[FIX] mass_mailing, *: duplicating two-columns snippets
* web_editor, website
This commit fixes a bug with table duplication in mailing template:
- Click on a snippet with two columns
- Duplicate it
-> the snippet is duplicated but the two columns are transformed in two
rows.
This was because there is an implemented behavior for column
duplication: if we duplicate a column which was alone on its row, we
duplicate the row instead. This code should however be triggered when
duplicating the column alone to be working, not the snippet that
contains it.
Note: this required a backport of a33ec972ab
which was fixing a non-critical "bug" for 11.0. This non-critical "bug" is
therefor fixed here too.
opw-807105
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user