forked from extern/egroupware
enable toggling of plain to CKEDITOR in felamimail; documenting changes to ckeditor with phpgwapi/js/ckeditor3/egw_integration.txt
This commit is contained in:
parent
818f57ebcf
commit
226908f7ab
@ -584,7 +584,13 @@ class html
|
|||||||
}
|
}
|
||||||
// run content through htmlpurifier
|
// run content through htmlpurifier
|
||||||
if ($_purify && !empty($_content)) $_content = self::purify($_content);
|
if ($_purify && !empty($_content)) $_content = self::purify($_content);
|
||||||
|
$oCKeditor = self::initCKEditor($_height, $_mode);
|
||||||
|
|
||||||
|
return $oCKeditor->editor($_name, $_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function &initCKEditor($_height, $_mode)
|
||||||
|
{
|
||||||
include_once(EGW_INCLUDE_ROOT."/phpgwapi/js/ckeditor3/ckeditor.php");
|
include_once(EGW_INCLUDE_ROOT."/phpgwapi/js/ckeditor3/ckeditor.php");
|
||||||
|
|
||||||
//Get the ckeditor base url
|
//Get the ckeditor base url
|
||||||
@ -592,12 +598,8 @@ class html
|
|||||||
|
|
||||||
$oCKeditor = new CKeditor($basePath);
|
$oCKeditor = new CKeditor($basePath);
|
||||||
$oCKeditor->returnOutput = true;
|
$oCKeditor->returnOutput = true;
|
||||||
|
|
||||||
//Only heights with "px" set are supported
|
|
||||||
$pxheight = (strpos('px', $_height) === false) ? 400 : str_replace('px', '', $_height);
|
|
||||||
|
|
||||||
$oCKeditor->config['customConfig'] = 'ckeditor.egwconfig.js';
|
$oCKeditor->config['customConfig'] = 'ckeditor.egwconfig.js';
|
||||||
$oCKeditor->config['height'] = $pxheight;
|
|
||||||
|
|
||||||
$oCKeditor->config['resize_enabled'] = false;
|
$oCKeditor->config['resize_enabled'] = false;
|
||||||
//switching the encoding as html entities off, as we correctly handle charsets and it messes up the wiki totally
|
//switching the encoding as html entities off, as we correctly handle charsets and it messes up the wiki totally
|
||||||
@ -609,6 +611,9 @@ class html
|
|||||||
$oCKeditor->config['filebrowserBrowseUrl'] = 'index.php?menuaction=filemanager.filemanager_select.select&mode=open&method=ckeditor_return&path='.urlencode($_start_path);
|
$oCKeditor->config['filebrowserBrowseUrl'] = 'index.php?menuaction=filemanager.filemanager_select.select&mode=open&method=ckeditor_return&path='.urlencode($_start_path);
|
||||||
$oCKeditor->config['filebrowserWindowWidth'] = 640;
|
$oCKeditor->config['filebrowserWindowWidth'] = 640;
|
||||||
$oCKeditor->config['filebrowserWindowHeight'] = 580;
|
$oCKeditor->config['filebrowserWindowHeight'] = 580;
|
||||||
|
//Only heights with "px" set are supported
|
||||||
|
$pxheight = (strpos('px', $_height) === false) ? 400 : str_replace('px', '', $_height);
|
||||||
|
$oCKeditor->config['height'] = $pxheight;
|
||||||
|
|
||||||
// By default the editor start expanded
|
// By default the editor start expanded
|
||||||
if ($_options['toolbar_expanded'] == 'false')
|
if ($_options['toolbar_expanded'] == 'false')
|
||||||
@ -630,13 +635,13 @@ class html
|
|||||||
switch ($GLOBALS['egw_info']['user']['preferences']['common']['rte_enter_mode'])
|
switch ($GLOBALS['egw_info']['user']['preferences']['common']['rte_enter_mode'])
|
||||||
{
|
{
|
||||||
case 'p':
|
case 'p':
|
||||||
$oCKeditor->config['enterMode'] = '@@CKEDITOR.ENTER_P';
|
$oCKeditor->config['enterMode'] = 1;//'@@CKEDITOR.ENTER_P';
|
||||||
break;
|
break;
|
||||||
case 'br':
|
case 'br':
|
||||||
$oCKeditor->config['enterMode'] = '@@CKEDITOR.ENTER_BR';
|
$oCKeditor->config['enterMode'] = 2;//'@@CKEDITOR.ENTER_BR';
|
||||||
break;
|
break;
|
||||||
case 'div':
|
case 'div':
|
||||||
$oCKeditor->config['enterMode'] = '@@CKEDITOR.ENTER_DIV';
|
$oCKeditor->config['enterMode'] = 3;//'@@CKEDITOR.ENTER_DIV';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -680,8 +685,7 @@ class html
|
|||||||
$oCKeditor->config['toolbar'] = 'egw_advanced';
|
$oCKeditor->config['toolbar'] = 'egw_advanced';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return $oCKeditor;
|
||||||
return $oCKeditor->editor($_name, $_content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -431,7 +431,7 @@ class CKEditor
|
|||||||
/**
|
/**
|
||||||
* Initializes CKEditor (executed only once).
|
* Initializes CKEditor (executed only once).
|
||||||
*/
|
*/
|
||||||
private function init()
|
public function init()
|
||||||
{
|
{
|
||||||
static $initComplete;
|
static $initComplete;
|
||||||
$out = "";
|
$out = "";
|
||||||
@ -522,7 +522,7 @@ class CKEditor
|
|||||||
* @param mixed $val
|
* @param mixed $val
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function jsEncode($val)
|
public function jsEncode($val)
|
||||||
{
|
{
|
||||||
if (is_null($val)) {
|
if (is_null($val)) {
|
||||||
return 'null';
|
return 'null';
|
||||||
|
30
phpgwapi/js/ckeditor3/egw_integration.txt
Normal file
30
phpgwapi/js/ckeditor3/egw_integration.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
--------------- step 1 --------------------------------------
|
||||||
|
removed _samples directory
|
||||||
|
--------------- step 2 --------------------------------------
|
||||||
|
making functions init() and jsEncode Public
|
||||||
|
(used in felamimail/inc/class.uicompose.inc.php to initalize the ckeditor in any case (plaintext/html))
|
||||||
|
see patch below:
|
||||||
|
|
||||||
|
Index: phpgwapi/js/ckeditor3/ckeditor_php5.php
|
||||||
|
===================================================================
|
||||||
|
--- phpgwapi/js/ckeditor3/ckeditor_php5.php (Revision 30397)
|
||||||
|
+++ phpgwapi/js/ckeditor3/ckeditor_php5.php (Arbeitskopie)
|
||||||
|
@@ -431,7 +431,7 @@
|
||||||
|
/**
|
||||||
|
* Initializes CKEditor (executed only once).
|
||||||
|
*/
|
||||||
|
- private function init()
|
||||||
|
+ public function init()
|
||||||
|
{
|
||||||
|
static $initComplete;
|
||||||
|
$out = "";
|
||||||
|
@@ -522,7 +522,7 @@
|
||||||
|
* @param mixed $val
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
- private function jsEncode($val)
|
||||||
|
+ public function jsEncode($val)
|
||||||
|
{
|
||||||
|
if (is_null($val)) {
|
||||||
|
return 'null';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user