How to get the content of a Tinymce textarea with JavaScript

I solved it with code: // Get the HTML contents of the currently active editor tinyMCE.activeEditor.getContent(); // Get the raw contents of the currently active editor tinyMCE.activeEditor.getContent({format : ‘raw’}); // Get content of a specific editor: tinyMCE.get(‘content id’).getContent() the activeEditor is current editor,but i use tinyMCE.get(‘editor1’).getContent() can not get the value of my editor, hope … Read more

tinymce adding p tags automatically?

TinyMce automatically add “<p>” in new lines. You can set this option in tinyMce initialization like this: tinyMCE.init({ mode : “textareas”, theme : “advanced”, force_br_newlines : false, force_p_newlines : false, forced_root_block : ”, }); Hope it will help Fonski

What are all the possible settings attributes in TinyMCE’s addButton() function?

autofocus: True if the control should be focused when rendered border: Border box values example: 1 1 1 1 classes: Space separated list of classes to add disabled: Is the control disabled by default hidden: Is the control hidden by default icon: Icon to use for button image: Image to use for icon margin: Margin … Read more

TinyMCE is removing tags

Since style tags are not valid XHTML, TinyMCE disabled the ability to add them outside of the tags. You have to add style tags to the valid children configuration valid_children : “+body[style]” Edit: This solution applies to version 3.4.2 Source

Remove style attribute from HTML tags

The pragmatic regex (<[^>]+) style=”.*?” will solve this problem in all reasonable cases. The part of the match that is not the first captured group should be removed, like this: $output = preg_replace(‘/(<[^>]+) style=”.*?”/i’, ‘$1’, $input); Match a < followed by one or more “not >” until we come to space and the style=”…” part. … Read more

make readonly/disable tinymce textarea

Use the configuration parameter readonly tinyMCE.init({ … theme : “advanced”, readonly : 1 }); Here is a link to a demo. Update: What you can do to prevent users from editing content in your editor is to set the contenteditable attribute of the editors iframe body to false: tinymce.activeEditor.getBody().setAttribute(‘contenteditable’, false);

TinyMCE Paths, How to specify where to load things like editor_plugin.js

I had the same issue, and it could have been solved easily if we were able to specify the base url using the document_base_url. Alternatively, I was able to specify the base url before initializing tinymce. tinyMCE.baseURL = “URL_TO/tinymce/jscripts/tiny_mce/”;// trailing slash important tinyMCE.init({ mode : “textareas”, theme : “simple” }); TinyMCE is working fine now.

Getting the value from a TinyMCE textarea

TinyMce has an api for accessing content from the editor. This code will grab the html from the active editor: // Get the HTML contents of the currently active editor tinyMCE.activeEditor.getContent(); // Get the raw contents of the currently active editor tinyMCE.activeEditor.getContent({format : ‘raw’}); // Get content of a specific editor: tinyMCE.get(‘content id’).getContent()