I am trying to make a component and I need to add the already installed Tinymce editor of Joomla! in that component.
I looked on the Internet but I didn’t find any example. Until now the only thing I managed to do is download the js files of tinymce and install it in my component.
But I know that Joomla already has build in the files for tinymce. So how can I use it In my components code without downloading the files again?
You do not need to add any tinymce files to your component; in your template, add these lines:
To retrieve the text from the input without it being stripped down, use one of the following:
or
or, starting with 1.6, the methods above seem to be deprecated (see here, also the source for below code) the new method would be:
In my code, just before submitting the form, I also call
JEditor::save; I have no idea anymore if this is really necessary or not; after some research I didn’t really find the use of that, so if it works for you without it, I would leave it out.There are some similar questions (e.g. this one) and forum posts (e.g. this one) but no comprehensive answer as far as I could tell, I was struggling with that at one point too, that’s why my answer got rather long.