Reputation: 21
I've been looking around for a fair while today, and i cant seem to get it working.
As i want to use the .remove() functions and its likes from jQuery, i thought it would be a "easy transition" over.
Currently on Joomla 2.5.9, and trying to access TinyMCE in the article-editor.
Anyone been able to do this?
I would need to load the content of that editor into a temporary div or var, then use somethign like $('#tmp').remove('...');
and finally put it back in to the active editor.
Problem is i keep getting null in return, regardless of what i try :(
Upvotes: 0
Views: 392
Reputation: 1643
You will need to go through the TinyMCE Javascript API to accomplish this. I have performed a similar task for a recent project and I can recommend the following approach:
tinyMCE.onAddEditor.add( function() {
tinyMCE.activeEditor.onChange.add( function( ed ) {
var content = ed.getContent();
// process the content here
// ...
ed.setContent( content );
});
});
The getContent()
method returns the entire text in the editor frame, including the HTML tags. You could afterwards load it dynamically as HTML and manipulate it:
$( content ).remove( '...' );
Upvotes: 1