Skip to content

Commit

Permalink
Added the $THEME->htmleditorpostprocess option. When the DOM tree of …
Browse files Browse the repository at this point in the history
…Moodle pages needs to be changed then the HTMLEditor must be applied after the DOM changes. With $THEME->htmleditorpostprocess developers get control when to render the HTMLEditor. They have to call the rendering function within their scripts.
  • Loading branch information
urs_hunkler committed Aug 12, 2007
1 parent 22c22fe commit 95dfead
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/weblib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3940,6 +3940,8 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
* @param string $name Form element to replace with HTMl editor by name * @param string $name Form element to replace with HTMl editor by name
*/ */
function use_html_editor($name='', $editorhidebuttons='', $id='') { function use_html_editor($name='', $editorhidebuttons='', $id='') {
global $THEME;

$editor = 'editor_'.md5($name); //name might contain illegal characters $editor = 'editor_'.md5($name); //name might contain illegal characters
if ($id === '') { if ($id === '') {
$id = 'edit-'.$name; $id = 'edit-'.$name;
Expand All @@ -3950,11 +3952,20 @@ function use_html_editor($name='', $editorhidebuttons='', $id='') {
echo "var config = $editor.config;\n"; echo "var config = $editor.config;\n";


echo print_editor_config($editorhidebuttons); echo print_editor_config($editorhidebuttons);


if (empty($name)) { if (empty($THEME->htmleditorpostprocess)) {
echo "\nHTMLArea.replaceAll($editor.config);\n"; if (empty($name)) {
echo "\nHTMLArea.replaceAll($editor.config);\n";
} else {
echo "\n$editor.generate();\n";
}
} else { } else {
echo "\n$editor.generate();\n"; if (empty($name)) {
echo "\nvar HTML_name = '';";
} else {
echo "\nvar HTML_name = \"$name;\"";
}
echo "\nvar HTML_editor = $editor;";
} }
echo '//]]>'."\n"; echo '//]]>'."\n";
echo '</script>'."\n"; echo '</script>'."\n";
Expand Down

0 comments on commit 95dfead

Please sign in to comment.