Advices for developing a TinyMCE Plugin

Advices for developing a TinyMCE Plugin

by Giosuè Suriano -
Number of replies: 7

Hello everyone,

I would like to ask to you some advices about developing a TinyMCE plugin.

I have HTML (HTML has some classes/id related to CSS and JS), CSS and Javascript.

How I should structure my plugin to implement everything? Should I put the HTML into a mustache file? What about my functions on JS?


I just want to learn to build better my plugin :D


Thank you!

Average of ratings: -
In reply to Giosuè Suriano

Re: Advices for developing a TinyMCE Plugin

by Rajneel Totaram -
Picture of Moodle HQ

Have you looked at the Creating TinyMCE Plugins course on Moodle Academy?

In reply to Rajneel Totaram

Ri: Re: Advices for developing a TinyMCE Plugin

by Giosuè Suriano -
Hi Rajneel,
Of course, I looked the course, but I'm having problem to add customized JavaScript and I don't understand how I can make it work.
In reply to Giosuè Suriano

Re: Ri: Re: Advices for developing a TinyMCE Plugin

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
What parts of the developer documentation have you read through (so people don't duplicate what you already know)
In reply to Giosuè Suriano

Re: Ri: Re: Advices for developing a TinyMCE Plugin

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Can you please describe what problem you're trying to solve. There is more than one way to do these things and it's hard to talk about this in the complete abstract.

What is the HTML used for?
What are the JS functions doing?

Typically you cannot insert JS into the user _content_ -- it is stripped out for security.
Average of ratings: Useful (1)
In reply to Andrew Lyons

Ri: Re: Ri: Re: Advices for developing a TinyMCE Plugin

by Giosuè Suriano -
Well, I need to integrate:
HTML (which is my template)
JavaScript (with some functions)

My principal problem is how I can integrate the JavaScript related to HTML.

To make it clear, I'm developing a new button for the editor that opens a dialog which let the user insert some parameters
In reply to Giosuè Suriano

Re: Advices for developing a TinyMCE Plugin

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
I wonder, are you looking for a way for a teacher to insert some predefined html into a text area (which might include css and javascript)?
If you are, then javascript tends to get removed when you save the text area. I would suggest using a pair of plugins 1. to manage the templates/js/css (tiny_generico) 2. output the code (filter_generico)