cleaning up the TinyMCE code a bit now

This commit is contained in:
ralf 2022-05-11 15:51:26 +02:00
parent 176c0c3822
commit 5a004b0aab
2 changed files with 9 additions and 22 deletions

View File

@ -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, <string><unknown>egw.preference('rte_font_size', 'common')
+ egw.preference('rte_font_unit', 'common'));
});
}*/
};
const rte_formatblock = <string>(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(<string><unknown>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, <string><unknown>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("<style id='dragover-tinymce'>.dragover:after {height:calc(100% - "+jQuery(this).height()+"px) !important;}</style>").appendTo('head');
});

View File

@ -1,19 +1,16 @@
<?php
/**
* API: loading user preferences and data
*
* Usage: /egroupware/api/user.php?user=123
* API: loading styles for TinyMCE incl. users preferred font and -size
*
* @link www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @author Ralf Becker <rb-at-egroupware.org>
* @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'))
{