From 5a004b0aab0befa155c75b50d80a0e74f62a4a0d Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 11 May 2022 15:51:26 +0200 Subject: [PATCH] cleaning up the TinyMCE code a bit now --- api/js/etemplate/et2_widget_htmlarea.ts | 12 ------------ api/tinymce.php | 19 +++++++++---------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/api/js/etemplate/et2_widget_htmlarea.ts b/api/js/etemplate/et2_widget_htmlarea.ts index ef57a4573e..f4b84b21d8 100644 --- a/api/js/etemplate/et2_widget_htmlarea.ts +++ b/api/js/etemplate/et2_widget_htmlarea.ts @@ -274,15 +274,6 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable btoa(egw.preference('rte_font', 'common')+':'+ egw.preference('rte_font_size', 'common')+':'+ egw.preference('rte_font_unit', 'common')), - /*setup : function(ed) - { - ed.on('init', function() - { - 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')); - }); - }*/ }; const rte_formatblock = (egw.preference('rte_formatblock', 'common') || 'p'); if (rte_formatblock !== 'p') @@ -302,9 +293,6 @@ 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'); }); diff --git a/api/tinymce.php b/api/tinymce.php index 791289727f..a4a31267a1 100644 --- a/api/tinymce.php +++ b/api/tinymce.php @@ -1,19 +1,16 @@ + * @author Ralf Becker * @package api - * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @version $Id$ + * @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ use EGroupware\Api; -// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression +// switch evtl. set output-compression off, as we can't calculate a Content-Length header with transparent compression ini_set('zlib.output_compression', 0); $GLOBALS['egw_info'] = array( @@ -29,9 +26,9 @@ include '../header.inc.php'; // release session, as we don't need it, and it blocks parallel requests $GLOBALS['egw']->session->commit_session(); -// use an etag over output -$content = Api\Etemplate\Widget\HtmlArea::contentCss(); -$etag = '"'.md5($content).'"'; +// use an etag over user prefs and modification time of HtmlArea +$etag = '"'.md5(json_encode(array_intersect_key($GLOBALS['egw_info']['user']['preferences']['common'], + array_flip(['rtf_font', 'rtf_font_size', 'rtf_font_unit']))).filemtime(__DIR__.'/src/Etemplate/Widget/HtmlArea.php')).'"'; // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header Api\Session::cache_control(86400); // cache for 1 day @@ -45,6 +42,8 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] === exit; } +$content = Api\Etemplate\Widget\HtmlArea::contentCss(); + // we run our own gzip compression, to set a correct Content-Length of the encoded content if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) {