From 21e90888393e6eb7aa8d80ca94889f652d6f2585 Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Tue, 28 Sep 2021 10:07:49 +0000 Subject: [PATCH] [FIX] web_editor: save codeview changes Before this commit, if there were a change in the codeview of the field html and the record was saved while the codeview was still open, the changes made in the codeview were not saved. closes odoo/odoo#77367 X-original-commit: d8a9d23a66d3662fc1c5e4e07e35a1de6800ffa5 Signed-off-by: David Monjoie (dmo) --- .../web_editor/static/src/js/backend/field_html.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/web_editor/static/src/js/backend/field_html.js b/addons/web_editor/static/src/js/backend/field_html.js index e2f8f4c31e9..9e0e8d7c165 100644 --- a/addons/web_editor/static/src/js/backend/field_html.js +++ b/addons/web_editor/static/src/js/backend/field_html.js @@ -146,7 +146,12 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, { * @override */ _getValue: function () { - var value = this.wysiwyg.getValue(); + let value; + if (!this._$codeview || this._$codeview.hasClass('d-none')) { + value = this.wysiwyg.getValue(); + } else { + value = this._$codeview.val(); + } if (this.nodeOptions.wrapper) { return this._unWrap(value); } @@ -520,10 +525,10 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, { `); - const $codeview = $('