0

I have a very basic text editor that uses CKEditor. The default CKEditor toolbar is hidden because for editing I need only image upload (which is completely custom) and Equation Editor plugin for formulas.

My goal is to use a custom button for the Equation Editor and call the plugin on click. So, somewhere in the UI of the editor, I would have this:

<a href="#" class="custom-formula-button">Insert formula</a>

Clicking on the button should open the Equation Editor.

How do I achieve this?

Note: I have multiple CKEditor instances on the page.

lesssugar
  • 14,485
  • 17
  • 62
  • 106
  • Please see ["Should questions include “tags” in their titles?"](http://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles), where the consensus is "no, they should not"! –  Apr 13 '15 at 11:12
  • @AndreasNiedermair Thanks, will do. – lesssugar Apr 13 '15 at 11:17

1 Answers1

2

You should use CKEDITOR.editor.execCommand() like this

CKEDITOR.instances.myEditorInstance.execCommand( 'mathjax' )

And this is where you'll find how to do this.

You can list available commands of the CKEditor instance by browsing CKEDITOR.instances.myEditorInstance.commands object.

Community
  • 1
  • 1
oleq
  • 17,373
  • 2
  • 35
  • 64