[REM] mass_mailing: remove the mass_mailing_sizing_x snippet option
mass_mailing had a special snippet option just for resizing images horizontally. Since this exists in the website builder as well, there is no need for a separate snippet with a different behavior for mass_mailing. task-2615373 closes odoo/odoo#84061 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -17,82 +17,6 @@ const {
|
||||
// Options
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Snippet option for resizing image and column width inline like excel
|
||||
options.registry.mass_mailing_sizing_x = options.Class.extend({
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
start: function () {
|
||||
var def = this._super.apply(this, arguments);
|
||||
|
||||
this.containerWidth = this.$target.parent().closest("td, table, div").width();
|
||||
|
||||
var self = this;
|
||||
var offset, sib_offset, target_width, sib_width;
|
||||
|
||||
this.$overlay.find(".o_handle.e, .o_handle.w").removeClass("readonly");
|
||||
this.isIMG = this.$target.is("img");
|
||||
if (this.isIMG) {
|
||||
this.$overlay.find(".o_handle.w").addClass("readonly");
|
||||
}
|
||||
|
||||
var $body = $(this.ownerDocument.body);
|
||||
this.$overlay.find(".o_handle").on('mousedown', function (event) {
|
||||
event.preventDefault();
|
||||
var $handle = $(this);
|
||||
var compass = false;
|
||||
|
||||
_.each(['n', 's', 'e', 'w'], function (handler) {
|
||||
if ($handle.hasClass(handler)) { compass = handler; }
|
||||
});
|
||||
if (self.isIMG) { compass = "image"; }
|
||||
|
||||
$body.on("mousemove.mass_mailing_width_x", function (event) {
|
||||
event.preventDefault();
|
||||
offset = self.$target.offset().left;
|
||||
target_width = self.get_max_width(self.$target);
|
||||
if (compass === 'e' && self.$target.next().offset()) {
|
||||
sib_width = self.get_max_width(self.$target.next());
|
||||
sib_offset = self.$target.next().offset().left;
|
||||
self.change_width(event, self.$target, target_width, offset, true);
|
||||
self.change_width(event, self.$target.next(), sib_width, sib_offset, false);
|
||||
}
|
||||
if (compass === 'w' && self.$target.prev().offset()) {
|
||||
sib_width = self.get_max_width(self.$target.prev());
|
||||
sib_offset = self.$target.prev().offset().left;
|
||||
self.change_width(event, self.$target, target_width, offset, false);
|
||||
self.change_width(event, self.$target.prev(), sib_width, sib_offset, true);
|
||||
}
|
||||
if (compass === 'image') {
|
||||
self.change_width(event, self.$target, target_width, offset, true);
|
||||
}
|
||||
});
|
||||
$body.one("mouseup", function () {
|
||||
$body.off('.mass_mailing_width_x');
|
||||
});
|
||||
});
|
||||
|
||||
return def;
|
||||
},
|
||||
change_width: function (event, target, target_width, offset, grow) {
|
||||
target.css("width", Math.round(grow ? (event.pageX - offset) : (offset + target_width - event.pageX)));
|
||||
this.trigger_up('cover_update');
|
||||
},
|
||||
get_int_width: function (el) {
|
||||
return parseInt($(el).css("width"), 10);
|
||||
},
|
||||
get_max_width: function ($el) {
|
||||
return this.containerWidth - _.reduce(_.map($el.siblings(), this.get_int_width), function (memo, w) { return memo + w; });
|
||||
},
|
||||
onFocus: function () {
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
if (this.$target.is("td, th")) {
|
||||
this.$overlay.find(".o_handle.e, .o_handle.w").toggleClass("readonly", this.$target.siblings().length === 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// Adding compatibility for the outlook compliance of mailings.
|
||||
// Commit of such compatibility : a14f89c8663c9cafecb1cc26918055e023ecbe42
|
||||
options.registry.MassMailingBackgroundImage = options.registry.BackgroundImage.extend({
|
||||
|
||||
@@ -430,9 +430,6 @@
|
||||
<we-button data-select-class="o_height_800" title="800px">100%</we-button>
|
||||
</we-button-group>
|
||||
</div>
|
||||
<div data-js="mass_mailing_sizing_x"
|
||||
data-selector="img, .mv, .col_mv, td, th"
|
||||
data-exclude=".o_mail_no_resize, .o_mail_no_options"/>
|
||||
|
||||
<div data-js="table_row"
|
||||
data-selector="tr:has(> .row), tr:has(> .col_mv)"
|
||||
|
||||
Reference in New Issue
Block a user