Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Plugins by
I want to use an editor instead of textarea in a plugin I developed. How can I add the editor to the form?
Q2A version: 1.8.5

2 Answers

+3 votes
selected by
Best answer
+3 votes

In order to use an editor, you need to:

  • Include the editor script (usually you put the javascript file(s) between the <head> tags).
  • Your field (here in this case is the textarea field) must contain ID and name values.
  • Another script to "connect" the field' ID with the editor.

Q2A editors, by default, only works if your field contains id="content" name="content"

If your plugin's field isn't "content". You have to make a custom script to "connect" the editor and the field ID.

I once used original CKeditor 4 scripts (downloaded from CKeditor website), and one of the scripts will let you define which textarea field can be integrated with CKeditor.

The easiest trick:

<!DOCTYPE html>
                <meta charset="utf-8">
                <script src="https://cdn.ckeditor.com/4.15.0/standard/ckeditor.js"></script>
                <textarea name="editor1"></textarea>
                        CKEDITOR.replace( 'editor1' );