Many TinyMCE editors, displayed in jQuery tabs, each editor is for a specific language.
I need a plugin with a button, that when pressed will retrieve some html (via ajax) based on the language of the textbox. The best ideea I could come up with is to put am attribute on the textarea containing the language and then in the plugin, get the value of the attribute and based on that make the ajax request to the right url.
How do I get a reference to the original textarea from inside the TinyMCE plugin.
Any info/reference is welcomed... I find the TinyMCE API page really hard to follow.
You can do this using the getContent() API method. Let's say you have initialized the editor on a textarea with id=”myTextarea”. This will return the content in the editor marked up as HTML.
Selector engine, enables you to select controls by using CSS like expressions. We currently only support basic CSS expressions to reduce the size of the core and the ones we support should be enough for most cases.
Hello, To save the page, you have to insert TinyMCE in a HTML form and add a submit button. Then you'll have to handle the submitted form with a language like PHP. A call to the file_put_contents() function should do it.
Try
tinyMCE.get(editorId).getElement();
This will return the textarea element that got replaced by TinyMCE - see the docs.
For your specific needs, if you need to target a certain editor with your externally fetched data, simply loop through all editor instances and select the right one by id or name attribute.
for (editorId in tinyMCE.editors) {
var orig_element = $(tinyMCE.get(editorId).getElement());
var name = orig_element.attr('name');
if (name === 'my_field_name') {
// do your stuff here
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With