How can I add plugins to the editor?

How can I add plugins to the editor?

by Clarence Prudhoe -
Number of replies: 2

I have read several forum posts about the current configuration of the Editor Plug-ins, and I agree that the student version of the Editor should be simplified.

 However, I need some of the 1.9 plug-ins to facilitate course building.  It seems to me that there should be an editor for students and another for course builders.  For example, I need to be able to translate course content to different languages.  The language plug-in is not included in the 2.0 editor.  I can do the job in HTML, but it is very tedious.

Can someone tell me how to add plugins to the 2.0 editor?  I looked at the source code and it appears that the code is there, it is not being used.

Thanks,
Clarence

Average of ratings: -
In reply to Clarence Prudhoe

Re: How can I add plugins to the editor?

by Mauno Korpelainen -

In the current version of core editor it is still a little tricky but basicly you can for example place your custom plugins to your moodle 2 folder lib/editor/tinymce/tiny_mce/3.3.9.2/plugins and edit init code in file lib/editor/tinymce/lib.php

For example if you want to show plugin dragmath only for those people who can manage system files you can add some capability check like this:

        if (has_capability('moodle/course:managefiles', get_system_context())){if (array_key_exists('filter/tex', $filters)) {
            $xdragmath = 'dragmath,';
        }
  } else {
            $xdragmath = '';
        }

and it will show dragmath button most likely only for system administrators (if tex filter is enabled)

It is also possible to create totally different editor configurations for students or totally different editors for students (inside lib/editor) but it's takes more time and effort...

I am not sure what is the best way to separate students and teachers in that moodle 2 capability checking - there might be some function for that purpose too...

In the actual init code you need to add new plugins to row starting with

'plugins' =>

and add the button to some of the given toolbar rows like

'theme_advanced_buttons3_add' =>

In reply to Mauno Korpelainen

Re: How can I add plugins to the editor?

by Clarence Prudhoe -

Hello Mauno,

Thanks for the information.  I have looked at the code and I will try to implement some additional plugins in the next few days.

It will be nice when the Core developers get time to create a utility to customize the editor.

Clarence