HTML editor : how to order and to add icons ?

HTML editor : how to order and to add icons ?

by Piero Fornoni -
Number of replies: 2

hi

How can I add icons to HTML editor and change their order ?

 

Thanks

Piero

Average of ratings: -
In reply to Piero Fornoni

Re: HTML editor : how to order and to add icons ?

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Piero,

Changing the icon order is easy. Adding one is also easy, IF it is for a tool that has just been left off, such as 'Justify.' Adding a tool icon for something entirely new to the editor, such as Nanogong, is another matter entirely as you have to create the whole plugin from scratch. Read through the documentation for that.

Since you did not say which Moodle editor you have, this is how you would add or re-order icons for my Moodle 2.3.1+.

Open the file yourmoodle/lib/editor/tinymce/lib.php and look at lines 146 and 147. They define row one of the tools. Notice it is simple list of tool names seperated by commas and vertical bars for grouping.

146 'theme_advanced_buttons1' => "{$fontbutton}fontsizeselect,formatselect",
147 'theme_advanced_buttons1_add' => "|,undo,redo,|,search,replace,|,fullscreen",

Lines 148 and 149 define the second row of tools. In line 148, right after the word justifyright, if you add a comma and the word justifyfull, you will add the missing Justify toolbutton. (If you try this, don't foget to reload your browser to make it update and show the new tool button.)

148 'theme_advanced_buttons2' => "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull",
149 'theme_advanced_buttons2_add' => "|,cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl",

Lines 150 and 151 define the third row of tools. (I left them out.)

To change the order of tools, just change the order of the tool names listed in those lines. Be careful as if you forget a comma or do the _add incorrectly, your tools may not show up. Of course it would be best if you made a backup copy of the file first...just in case.

Visit http://www.tinymce.com/tryit/full.php and you can see other missing tools to try out.

Hope this helps,

AL