cleaning up the TinyMCE code a bit now

This commit is contained in:
ralf 2022-05-11 15:51:26 +02:00
parent 6d57d81faa
commit 53d9abcbd9
2 changed files with 9 additions and 22 deletions

View File

@ -281,15 +281,6 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
btoa(egw.preference('rte_font', 'common')+':'+ btoa(egw.preference('rte_font', 'common')+':'+
egw.preference('rte_font_size', 'common')+':'+ egw.preference('rte_font_size', 'common')+':'+
egw.preference('rte_font_unit', '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, <string><unknown>egw.preference('rte_font_size', 'common')
+ egw.preference('rte_font_unit', 'common'));
});
}*/
}; };
const rte_formatblock = <string>(egw.preference('rte_formatblock', 'common') || 'p'); const rte_formatblock = <string>(egw.preference('rte_formatblock', 'common') || 'p');
if (rte_formatblock !== 'p') if (rte_formatblock !== 'p')
@ -309,9 +300,6 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
{ {
self.editor.formatter.toggle(<string><unknown>egw.preference('rte_formatblock', 'common')); self.editor.formatter.toggle(<string><unknown>egw.preference('rte_formatblock', 'common'));
jQuery(self.editor.editorContainer).height(self.options.height); jQuery(self.editor.editorContainer).height(self.options.height);
/*self.editor.execCommand('fontName', false, egw.preference('rte_font', 'common'));
self.editor.execCommand('fontSize', false, <string><unknown>egw.preference('rte_font_size', 'common')
+ egw.preference('rte_font_unit', 'common'));*/
jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function(){ jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function(){
if (jQuery('#dragover-tinymce').length < 1) jQuery("<style id='dragover-tinymce'>.dragover:after {height:calc(100% - "+jQuery(this).height()+"px) !important;}</style>").appendTo('head'); if (jQuery('#dragover-tinymce').length < 1) jQuery("<style id='dragover-tinymce'>.dragover:after {height:calc(100% - "+jQuery(this).height()+"px) !important;}</style>").appendTo('head');
}); });

View File

@ -1,19 +1,16 @@
<?php <?php
/** /**
* API: loading user preferences and data * API: loading styles for TinyMCE incl. users preferred font and -size
*
* Usage: /egroupware/api/user.php?user=123
* *
* @link www.egroupware.org * @link www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de> * @author Ralf Becker <rb-at-egroupware.org>
* @package api * @package api
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/ */
use EGroupware\Api; 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); ini_set('zlib.output_compression', 0);
$GLOBALS['egw_info'] = array( $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 // release session, as we don't need it, and it blocks parallel requests
$GLOBALS['egw']->session->commit_session(); $GLOBALS['egw']->session->commit_session();
// use an etag over output // use an etag over user prefs and modification time of HtmlArea
$content = Api\Etemplate\Widget\HtmlArea::contentCss(); $etag = '"'.md5(json_encode(array_intersect_key($GLOBALS['egw_info']['user']['preferences']['common'],
$etag = '"'.md5($content).'"'; 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 // 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 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; exit;
} }
$content = Api\Etemplate\Widget\HtmlArea::contentCss();
// we run our own gzip compression, to set a correct Content-Length of the encoded content // 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')) if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
{ {