echo <<<EOF
tinyMCE.init({
- mode: "none",
+ mode: "textareas",
relative_urls: false,
editor_selector: "form-textarea-simple",
document_base_url: "$CFG->httpswwwroot",
plugins: "spellchecker,emoticons,paste,standardmenu,directionality,contextmenu"
});
tinyMCE.init({
- mode: "none",
+ mode: "textareas",
relative_urls: false,
editor_selector: "form-textarea-advanced",
document_base_url: "$CFG->httpswwwroot",
readfile('tinymce/xhtml_ruleset.txt');
echo <<<EOF
});
+
function toggleEditor(id) {
- var elm = document.getElementById(id);
- tinyMCE.execCommand('mceToggleEditor',false,elm);
+ tinyMCE.execCommand('mceToggleEditor',false,id);
}
function moodlefilemanager(field_name, url, type, win) {
tinyMCE.activeEditor.windowManager.open({
$output = '</div>';
}
- if ($idbase == 'footer' and !empty($THEME->htmleditors)) {
- $output .= "\n".'<script type="text/javascript">'."\n";
- $output .= "\n//<![CDATA[\n";
- foreach ($THEME->htmleditors as $editorid) {
- $output .= 'tinyMCE.execCommand("mceToggleEditor", false, document.getElementById(\''. $editorid .'\'))'."\n";
- }
- $output .= "//]]>\n";
- $output .= '</script>'."\n";
- }
-
if ($return) {
return $output;
} else {
* @param int $courseid Course ID to pass to the file manager (defaults to global $COURSE->id).
* @param bool $return If false, will output string. If true, will return string value.
* @param string $id CSS ID to add to the textarea element.
- * @param string $class CSS classes to add to the textarea element. Use 'form-textarea-simple' to get a basic editor. Defaults to 'form-textarea-advanced' (complete editor).
+ * @param string $editorclass CSS classes to add to the textarea element when using the htmleditor. Use 'form-textarea-simple' to get a basic editor. Defaults to 'form-textarea-advanced' (complete editor). If this is null or invalid, the htmleditor will not show for this field.
*/
-function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $courseid=0, $return=false, $id='', $class='form-textarea-advanced') {
+function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $courseid=0, $return=false, $id='', $editorclass='form-textarea-advanced') {
/// $width and height are legacy fields and no longer used as pixels like they used to be.
/// However, you can set them to zero to override the mincols and minrows values below.
if ($usehtmleditor) {
$THEME->htmleditors[] = $id;
+ } else {
+ $editorclass = '';
}
- $str .= "\n".'<textarea class="form-textarea '. $class .'" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">'."\n";
+ $str .= "\n".'<textarea class="form-textarea '. $editorclass .'" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">'."\n";
if ($usehtmleditor) {
$str .= htmlspecialchars($value); // needed for editing of cleaned text!
} else {