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.
我有一个使用CKEditor的非常基本的文本编辑器。默认的CKEditor工具栏是隐藏的,因为对于编辑我只需要图像上传(完全是自定义的)和公式的公式编辑器插件。
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:
我的目标是使用公式编辑器的自定义按钮,然后单击调用插件。所以,在编辑器的UI中的某个地方,我会这样:
<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.
注意:我在页面上有多个CKEditor实例。
1 个解决方案
#1
2
You should use CKEDITOR.editor.execCommand()
like this
您应该像这样使用CKEDITOR.editor.execCommand()
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.
您可以通过浏览CKEDITOR.instances.myEditorInstance.commands对象列出CKEditor实例的可用命令。
#1
2
You should use CKEDITOR.editor.execCommand()
like this
您应该像这样使用CKEDITOR.editor.execCommand()
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.
您可以通过浏览CKEDITOR.instances.myEditorInstance.commands对象列出CKEditor实例的可用命令。