]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed javascript bug. Clicking on a template tag now inserts the tag into the
authorvyshane <vyshane>
Tue, 14 Mar 2006 05:56:14 +0000 (05:56 +0000)
committervyshane <vyshane>
Tue, 14 Mar 2006 05:56:14 +0000 (05:56 +0000)
textarea in both wysiwyg and non-wysiwyg modes.

mod/data/templates.php

index c81910d8d1b6ed3c5fed3b5b66a5d120fdee11a0..11241600903eb50348cc9610038ab1949f0e043b 100755 (executable)
     
     echo '<select name="fields1[]" size="10" ';
     echo 'onclick="';
-    //echo 'alert(editor._editMode); ';
-    echo 'if (editor._editMode == \'wysiwyg\') {';
+    echo 'if (typeof(editor) != \'undefined\' && editor._editMode == \'wysiwyg\') {';
     echo '    editor.insertHTML(this.options[selectedIndex].value); ';     // HTMLArea-specific.
     echo '} else {';
-    echo 'insertAtCursor(\'document.tempform.template\', this.options[selectedIndex].value);';   // Hack for inserting when in HTMLArea code view or for normal textareas.
+    echo 'insertAtCursor(document.tempform.template, this.options[selectedIndex].value);';   // Hack for inserting when in HTMLArea code view or for normal textareas.
     echo '}">';
     
     foreach ($fields as $field) {