1

So I understand that the visual editor uses something called TinyMCE. How do I retrieve the html that the user selects from the visual editor? I am basically trying to create a button that gets the selected html and replaces it.

2

The visual editor (TinyMCE) has its own API and since its a JavaScript Based editor you can get the selection using JavaScript very easily

tinyMCE.activeEditor.selection.getContent();
  • And just for ppl to note, you can replace the selected content using tinyMCE.activeEditor.selection.setContent('<div>sample content</div>'); – Shaan Sep 27 '11 at 2:26
  • So, you could use this as a replacement to send_to_editor, could you not? – Manny Fleurmond Mar 20 '13 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.