[FIX] mass_mailing: clean oe_edited_link

Task-2729195

closes odoo/odoo#90722

X-original-commit: 99210fc58f7ed35c2c066b6aaba8efc94bcd2931
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2022-05-06 13:30:25 +02:00
parent d8365e7898
commit fc26cc1789
3 changed files with 13 additions and 16 deletions
@@ -61,9 +61,7 @@ var MassMailingFieldHtml = FieldHtml.extend({
}
var $editable = this.wysiwyg.getEditable();
if (this.wysiwyg.snippetsMenu) {
await this.wysiwyg.snippetsMenu.cleanForSave();
}
await this.wysiwyg.cleanForSave();
return this.wysiwyg.saveModifiedImages(this.$content).then(async function () {
self._isDirty = self.wysiwyg.isDirty();
self._doAction();
@@ -94,15 +94,14 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
*
* @override
*/
commitChanges: function () {
commitChanges: async function () {
if (this.mode == "readonly" || !this.isRendered) {
return this._super();
}
var _super = this._super.bind(this);
this.wysiwyg.odooEditor.clean();
await this.wysiwyg.cleanForSave();
this._setValue(this._getValue());
return this.wysiwyg.saveModifiedImages(this.$content).then(async () => {
await this.wysiwyg.preSavePromise;
return this.wysiwyg.saveModifiedImages(this.$content).then(() => {
this._isDirty = this.wysiwyg.isDirty();
_super();
});
@@ -809,11 +809,7 @@ const Wysiwyg = Widget.extend({
this.trigger_up('ready_to_save', {defs: defs});
await Promise.all(defs);
this._cleanForSave();
if (this.snippetsMenu) {
await this.snippetsMenu.cleanForSave();
}
await this.cleanForSave();
const editables = this.options.getContentEditableAreas();
await this.saveModifiedImages(editables.length ? $(editables) : this.$editable);
@@ -937,6 +933,14 @@ const Wysiwyg = Widget.extend({
closestElement(...args) {
return closestElement(...args);
},
cleanForSave: async function () {
this.odooEditor.clean();
this.$editable.find('.oe_edited_link').removeClass('oe_edited_link');
if (this.snippetsMenu) {
await this.snippetsMenu.cleanForSave();
}
},
/**
* Start or resume the Odoo field changes muation observers.
*
@@ -1755,10 +1759,6 @@ const Wysiwyg = Widget.extend({
});
}
},
_cleanForSave: function () {
this.odooEditor.clean();
this.$editable.find('.oe_edited_link').removeClass('oe_edited_link');
},
_getCommands: function () {
const options = this._editorOptions();
const commands = [