CKEditor 4.3 Widget Richcombo

时间:2014-10-20 22:29:56

标签: javascript ckeditor

如果单击Richcombo中的某个下拉菜单,我如何插入小部件?我已阅读小部件教程here和API文档here

我尝试过类似的东西,但它不起作用

CKEDITOR.plugins.add('my_plugin', {

    init: function(editor) {

        editor.ui.addRichCombo('my_plugin', {
            label: 'plugin1',

            init: function() {
                this.add('FIRST_NAME', 'FIRST NAME', 'Insert FIRST NAME');
            },

            onclick: function(value) {
                editor.focus();
                editor.widgets.add('widget1', {
                    upcast: function( element ) {
                        // Defines which elements will become widgets.
                        if ( element.hasClass( 'widget1' ) )
                            return true;
                    },    
                });

                editor.setData( '<div class="widget1">foo</div>' );      
            }
        )};
    }
});

0 个答案:

没有答案