From 2e7451f2833848c7706ff712a20b6549f4e7d8ee Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 3 May 2022 15:49:38 +0200 Subject: [PATCH] Mail: Fix htmlEditor does not include styling on each tag causing mail content sent with no styling --- api/js/etemplate/et2_widget_htmlarea.js | 10 +++++++--- api/js/etemplate/et2_widget_htmlarea.ts | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/api/js/etemplate/et2_widget_htmlarea.js b/api/js/etemplate/et2_widget_htmlarea.js index 52fe25423f..58ce0d5fa4 100644 --- a/api/js/etemplate/et2_widget_htmlarea.js +++ b/api/js/etemplate/et2_widget_htmlarea.js @@ -137,9 +137,10 @@ var et2_htmlarea = /** @class */ (function (_super) { fontsize_formats: '8pt 10pt 12pt 14pt 18pt 24pt 36pt', setup: function (ed) { ed.on('init', function () { - this.getDoc().body.style.fontSize = egw.preference('rte_font_size', 'common') - + egw.preference('rte_font_unit', 'common'); - this.getDoc().body.style.fontFamily = egw.preference('rte_font', 'common'); + this.focus(); + this.execCommand('fontName', false, egw.preference('rte_font', 'common')); + this.execCommand('fontSize', false, egw.preference('rte_font_size', 'common') + + egw.preference('rte_font_unit', 'common')); }); } }; @@ -154,6 +155,9 @@ var et2_htmlarea = /** @class */ (function (_super) { if (self.editor && self.editor.editorContainer) { self.editor.formatter.toggle(egw.preference('rte_formatblock', 'common')); jQuery(self.editor.editorContainer).height(self.options.height); + self.editor.execCommand('fontName', false, egw.preference('rte_font', 'common')); + self.editor.execCommand('fontSize', false, egw.preference('rte_font_size', 'common') + + egw.preference('rte_font_unit', 'common')); jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function () { if (jQuery('#dragover-tinymce').length < 1) jQuery("").appendTo('head'); diff --git a/api/js/etemplate/et2_widget_htmlarea.ts b/api/js/etemplate/et2_widget_htmlarea.ts index b7b54b224e..f06a992a99 100644 --- a/api/js/etemplate/et2_widget_htmlarea.ts +++ b/api/js/etemplate/et2_widget_htmlarea.ts @@ -269,9 +269,10 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable { ed.on('init', function() { - this.getDoc().body.style.fontSize = egw.preference('rte_font_size', 'common') - + egw.preference('rte_font_unit', 'common'); - this.getDoc().body.style.fontFamily = egw.preference('rte_font', 'common'); + this.focus(); + this.execCommand('fontName', false, egw.preference('rte_font', 'common')); + this.execCommand('fontSize', false, egw.preference('rte_font_size', 'common') + + egw.preference('rte_font_unit', 'common')); }); } }; @@ -288,6 +289,9 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable { self.editor.formatter.toggle(egw.preference('rte_formatblock', 'common')); jQuery(self.editor.editorContainer).height(self.options.height); + self.editor.execCommand('fontName', false, egw.preference('rte_font', 'common')); + self.editor.execCommand('fontSize', false, egw.preference('rte_font_size', 'common') + + egw.preference('rte_font_unit', 'common')); jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function(){ if (jQuery('#dragover-tinymce').length < 1) jQuery("").appendTo('head'); });