I’m creating a module and would like the to use the default RTE in it.
Here’s some code I have, but it only make a textarea box and doesn’t use the RTE..
<div class="MODX_RichTextWidget">
<textarea id="postContent" name="postContent" style="width: 100%; height: 400px"></textarea>
</div>
<?php
// New post
// Get access to template variable function (to output the RTE)
include_once($modx->config['base_path'].'manager/includes/tmplvars.inc.php');
// invoke OnRichTextEditorInit event
$replace_richtexteditor = array('postContent',);
if(is_array($replace_richtexteditor))
{
$evtOut = $modx->invokeEvent('OnRichTextEditorInit',
array('editor' => $modx->config['which_editor'],
'elements' => $replace_richtexteditor));
print_r($evtOut);
if(is_array($evtOut))
{
echo implode("", $evtOut);
}
}
?>
It download the RTE’s javascript, but just doen’t convert the area to an rte..