Custom plugin for TinyMCE in Moodle2.4

Custom plugin for TinyMCE in Moodle2.4

by Richard Oelmann -
Number of replies: 3
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi everyone,

Following a discussion in the themes forum, I decided to look more into adapting some of the TinyMCE plugins for the new format in 2.4, but I am obviously doing something wrong in the process.

I wanted to add the pwd toolbar toggle plugin (I want to adapt it and take it further, but I want to get the basic one working first) and I started by looking at the Moodle Doc and by using one of the existing Moodle plugins (moodlenolink) as a starting point.

The plugin appears to load ok through the administration/notifications page and my page loads ok. The TinyMCE editor loads up initially with the html content in the editor box for a second or so and normally this would then be swiftly followed by that being replaced by the toolbars and the wysiwyg content of the editor. However, at that point my editor simply goes blank - there is no error message (I have moodle debugging turned on to Developer level) and if I use the chrome tools it shows that the textarea object is still there with visibility hidden, but the wysiwyg editor does not load.

I have no doubt I have missed something, but would appreciate some help and guidance if anyone has the time to take a quick look at what I have done/messed up smile

Many thanks

Richard

Average of ratings: -
In reply to Richard Oelmann

Re: Custom plugin for TinyMCE in Moodle2.4

by Mauno Korpelainen -

I downloaded your plugin but did not check yet what's wrong. Instead of that I made a quick version of moodle 2.4 tinymce plugin and attached files (folder pdw) should go (unzipped) to lib/editor/tinymce/plugins/

You should also add to lib/editor/tinymce/lib.php

            'plugins' => 'pdw, ...

and after list of plugins for example

                'pdw_toggle_on' => "1",
                'pdw_toggle_toolbars' => "2,3",   

to show first toolbar row 1 and after toggle rows 1,2,3

Next go to your site administration and check that pdw is installed in settings of tinymce.

HTH,

Mauno

In reply to Mauno Korpelainen

Re: Custom plugin for TinyMCE in Moodle2.4

by Mauno Korpelainen -

Or you could as well use

                'pdw_toggle_on' => 1,
or               
                'pdw_toggle_on' => true,

If editor init code breaks it might mean that you have some comma missing or some extra character somewhere... just a long shot...

In reply to Mauno Korpelainen

Re: Custom plugin for TinyMCE in Moodle2.4

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Mauno,

Thank you very much for your help - that works perfectly and now I have a working example to continue my learning curve smile

I'll take a look at what I did wrong and make progress from there and feed back here when (if) I have something worth sharing with the community

Much appreciated Yes

Richard

Average of ratings: Useful (1)