繁体   English   中英

CKEditor Mathjax插件中的预定义按钮

[英]Predefined buttons in CKEditor Mathjax plugin

CKEditor的Mathjax插件在对话框中包含多个元素:一个textarea(标识:方程)和一个div(标识:预览)。

https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/mathjax/dialogs/mathjax.js

当在文本区域中输入一些mathjax代码时,公式将写入div中。 我正在尝试添加几个预定义的按钮,这些按钮将常用的公式mathjax文本添加到textarea,因此用户只需填充这些公式。

在元素中添加按钮效果很好,但是我只能访问以更改div元素。 访问textarea不起作用,似乎在任何范围内根本都不可用。

id: 'info',
elements: [
    {
        id: 'testButton',
        type: 'button',
        button: 'aaaa',

        onClick: function() {
            // Changing the ID value does work
                preview.setValue('Test');
            // but changing the textarea does not.
                // equation.setValue('Test');
                // document.getElementById('equation').setValue('Test');

        }
    },
    {
        id: 'equation',
        type: 'textarea',
        label: lang.dialogInput,

        onLoad: function() {
            var that = this;

            if ( !( CKEDITOR.env.ie && CKEDITOR.env.version == 8 ) ) {
                this.getInputElement().on( 'keyup', function() {
                    // Add \( and \) for preview.
                    preview.setValue( '\\(' + that.getInputElement().getValue() + '\\)' );
                } );
            }
        },

抱歉,如果这是一个简单的问题,但是如何访问方程式textarea?

经过大量阅读后,看来这是一种方法,但不确定是否是最佳方法。

onClick: function() {
this._.dialog.setValueOf("info","equation","TEST");
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM