]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14741: make tinymce toggle editor icon work as it should
authorscyrma <scyrma>
Tue, 15 Jul 2008 09:00:23 +0000 (09:00 +0000)
committerscyrma <scyrma>
Tue, 15 Jul 2008 09:00:23 +0000 (09:00 +0000)
lib/editor/tinymce.js.php
lib/weblib.php
theme/standard/styles_layout.css

index 1f6c48e27d6b7ccc453d2611ce7477b44e9130be..a63feed85a3339e8182ee32a3092f18877596818 100644 (file)
@@ -197,10 +197,7 @@ echo <<<EOF
     });
     function toggleEditor(id) {
         var elm = document.getElementById(id);
-        if (tinyMCE.getInstanceById(id) == null)
-                   tinyMCE.execCommand('mceAddControl', false, id);
-           else
-                   tinyMCE.execCommand('mceRemoveControl', false, id);
+        tinyMCE.execCommand('mceToggleEditor',false,elm);
     }
     function moodlefilemanager(field_name, url, type, win) {
         tinyMCE.activeEditor.windowManager.open({
index 52620b1a3063986f6813b652a6214b16714d81ee..fe5bdc611b756c1de7ae04ffbf76b0158bbe23c0 100644 (file)
@@ -4846,14 +4846,16 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
     $str .= '</textarea>'."\n";
 
     if ($usehtmleditor) {
+        $str_toggle = '<span class="helplink"><a href="javascript:toggleEditor(\''. $id .'\');"><img width="50" height="17" src="'. $CFG->httpswwwroot .'/lib/editor/tinymce/images/toggle.gif" alt="'. get_string('editortoggle') .'" title="'. get_string('editortoggle') .'" class="icontoggle" /></a></span>';
         // Show shortcuts button if HTML editor is in use, but only if JavaScript is enabled (MDL-9556)
-        $str .= '';
-        $str .= '<a href="javascript:toggleEditor(\''. $id .'\');"><img width="50" height="17" src="'. $CFG->httpswwwroot .'/lib/editor/tinymce/images/toggle.gif" alt="'. get_string('editortoggle') .'" title="'. get_string('editortoggle') .'" /></a>';
+        $str .= '<div class="textareaicons">';
         $str .= '<script type="text/javascript">
 //<![CDATA[
+document.write(\''.addslashes_js($str_toggle).'\');
 document.write(\''.addslashes_js(editorshortcutshelpbutton()).'\');
 //]]>
 </script>';
+        $str .= '</div>';
     }
 
     if ($return) {
index 416fa34bf311ea75bd8d7a2729d40eda2cc82122..741f6180c317261c1a89e84d485142ac607b6bf1 100644 (file)
@@ -489,6 +489,13 @@ img.iconkbhelp {
   border:0px;
 }
 
+img.icontoggle {
+  width:50px;
+  height:17px;
+  border:0px;
+  vertical-align:middle;
+}
+
 /*Accessibility: text 'seen' by screen readers but not visual users. Fixed for RTL languages, example Farsi. */
 .accesshide {
   position:absolute;