MDL-14741: Make tinymce loading simpler, and makes it work on pages with multiple instances.

This commit is contained in:
scyrma
2008-07-18 04:24:53 +00:00
parent 5c0700a604
commit 4644313b7c
2 changed files with 9 additions and 17 deletions
+4 -4
View File
@@ -148,7 +148,7 @@ EOF;
echo <<<EOF
tinyMCE.init({
mode: "none",
mode: "textareas",
relative_urls: false,
editor_selector: "form-textarea-simple",
document_base_url: "$CFG->httpswwwroot",
@@ -162,7 +162,7 @@ echo <<<EOF
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",
@@ -195,9 +195,9 @@ EOF;
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({
+5 -13
View File
@@ -4027,16 +4027,6 @@ function print_container_end($return=false) {
$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 {
@@ -4796,9 +4786,9 @@ function print_recent_activity_note($time, $user, $text, $link, $return=false, $
* @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.
@@ -4850,9 +4840,11 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
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 {