1

I'm building a plugin for Craft CMS. This plugin will load on the edit/content page, where the standard Redactor WYSIWYG editor will be loaded too (by CraftCMS). I want to get the HTML/text contents of the Redactor editor.

For example tinymce.activeEditor.getContent() will get the HTML contents of the TinyMCE editor in WordPress.

How do I achieve this in Craft CMS?

The API documentation says var text = this.clean.getPlainText(html);. But how do I know reference to this.

2

I'm not 100% sure I follow, but I think this is what you are looking for.

In your javascript file, you'll want code.set

API Reference

...

$('#yourTextArea').redactor('code.set', your.data);
  • Ignore my last example in the question. I actually wanted to get the code/text out the the editor/textarea, not set the code. But this works too. – iNalgiev Oct 8 '16 at 11:33

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.