
<input class="modx-richtext" . . ..
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode: "exact",
elements : "elm1",
theme_advanced_toolbar_location : "top",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,"
+ "justifyleft,justifycenter,justifyright,justifyfull,formatselect,"
+ "bullist,numlist,outdent,indent",
theme_advanced_buttons2 : "link,unlink,anchor,image,separator,"
+"undo,redo,cleanup,code,separator,sub,sup,charmap",
theme_advanced_buttons3 : "",
height:"350px",
width:"600px"
});
</script><?php
$props = $scriptProperties;
/* set rich text content placeholders and includes necessary js files */
$tinyPath = $modx->getOption('core_path') . 'components/tinymce/';
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/ext3/adapter/ext/ext-base.js');
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/ext3/ext-all.js');
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/modext/core/modx.js');
$whichEditor = $modx->getOption('which_editor', null, '');
$plugin = $modx->getObject('modPlugin', array('name' => $whichEditor));
if ($whichEditor == 'TinyMCE') {
//$tinyUrl = $this->modx->getOption('assets_url').'components/tinymcefe/';
$tinyUrl = $modx->getOption('assets_url') . 'components/tinymce/';
/* OnRichTextEditorInit */
$tinyproperties = $plugin->getProperties();
require_once $tinyPath . 'tinymce.class.php';
$tiny = new TinyMCE($modx, $tinyproperties, $tinyUrl);
// if (isset($this->props['forfrontend']) || $this->modx->isFrontend()) {
if (isset($props['forfrontend']) || $modx->context->get('key') !=
'mgr') {
$def = $modx->getOption('cultureKey', null, $modx->getOption('manager_language', null,
'en'));
$tinyproperties['language'] = $modx->getOption('fe_editor_lang', array(),
$def);
$tinyproperties['frontend'] = true;
unset($def);
}
$tinyproperties['cleanup'] = true;
/* prevents "bogus" bug */
$tinyproperties['width'] = empty($props['tinywidth']) ? '95%' : $props['tinywidth'];
$tinyproperties['height'] = empty($props['tinyheight']) ? '400px' : $props['tinyheight'];
//$tinyproperties['tiny.custom_buttons1'] = 'image';
//$tinyproperties['tiny.custom_buttons2'] = '';
$tiny->setProperties($tinyproperties);
$html = $tiny->initialize();
$modx->regClientStartupScript($tiny->config['assetsUrl'] .
'jscripts/tiny_mce/langs/' . $tiny->properties['language'] . '.js');
$modx->regClientStartupScript($tiny->config['assetsUrl'] .
'tiny.browser.js');
//mod by Bruno
if ($props['hasimagetv']) {
$rt_configs = array("selector" => "rt_imagetv", "width" => $props['imageTvWidth'],
"height" => $props['imageTvHeight'], "buttons1" => "image", "buttons2" => "",
"theme_advanced_buttons1" => "image", "theme_advanced_buttons2" => "", );
$cfg = '';
foreach ($rt_configs as $cf_key => $cf_value) {
$cfg .= 'Tiny.config.' . $cf_key . ' = "' . $cf_value . '";';
}
$js .= $cfg . ' MODx.loadRTE();';
}
$modx->regClientStartupHTMLBlock('<script type="text/javascript">
Ext.onReady(function() {
MODx.loadRTE();
' . $js . '
});
</script>');
}
/* end if ($whichEditor == 'TinyMCE') */
[[!tinymceFe]] <textarea name="content" class="modx-richtext"> </textarea>