From 590679f868234c07e7f263171f3fa2c6fa9eea8b Mon Sep 17 00:00:00 2001 From: Anshuman Sharma Date: Thu, 12 Jul 2018 11:33:28 +0530 Subject: [PATCH] [IMP] mass_mailing: removed font-family from plain text Purpose behind this commit is to remove font-family from all elements in plaintext theme. So mail receiver will see this mail in default system font. This is inspired by new Gmail and suggested by FP As we want to show system's default font in the mail sent with the basic theme. And so we remove font-family from basic theme while saving. But by doing so in readonly mode is not getting proper font in odoo as we don't having any assets in readonly mail editor. So we added stylesheet just for display purpose. --- .../mass_mailing/static/src/css/basic_theme_readonly.css | 7 +++++++ addons/mass_mailing/static/src/js/mass_mailing_editor.js | 8 ++++++++ addons/mass_mailing/views/editor_field_html.xml | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 addons/mass_mailing/static/src/css/basic_theme_readonly.css diff --git a/addons/mass_mailing/static/src/css/basic_theme_readonly.css b/addons/mass_mailing/static/src/css/basic_theme_readonly.css new file mode 100644 index 00000000000..340eec95a68 --- /dev/null +++ b/addons/mass_mailing/static/src/css/basic_theme_readonly.css @@ -0,0 +1,7 @@ +/* We want to show system's default font in the mail sent with the basic theme. + And so we remove font-family from basic theme while saving. But by doing so + in readonly mode is not getting proper font in odoo. So we added if from here. + */ +#wrapwrap .o_layout.o_basic_theme { + font-family: -apple-system, "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; +} 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 ec7f01bbc25..b5bc4915918 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_editor.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_editor.js @@ -366,6 +366,14 @@ snippets_editor.Class.include({ self._disableUndroppableSnippets(); } }, + cleanForSave: function () { + this._super.apply(this, arguments); + // remove font-family from all elements for plain text theme (just like gmail) + var $basicTheme = this.$editable.find('.o_basic_theme'); + if($basicTheme.length && this.$editable.data('oe-model') === 'mail.mass_mailing') { + this.$editable.find('*').css('font-family', ''); + } + } }); var callback = window ? window["callback"] : undefined; diff --git a/addons/mass_mailing/views/editor_field_html.xml b/addons/mass_mailing/views/editor_field_html.xml index 8a1a8845aa8..513be80933a 100644 --- a/addons/mass_mailing/views/editor_field_html.xml +++ b/addons/mass_mailing/views/editor_field_html.xml @@ -13,6 +13,9 @@ + + +