How do I customize a ckeditor 4.2 builtin plugin like links?

社会主义新天地 提交于 2019-11-27 04:43:18

You got to observe dialogDefinition event to do this:

CKEDITOR.on( 'dialogDefinition', function( evt ) {
    var dialog = evt.data;

    if ( dialog.name == 'link' ) {
        // Get dialog definition.
        var def = evt.data.definition;

        // Add some stuff to definition.
        def.addContents( {
            id: 'custom',
            label: 'My custom tab',
            elements: [
                {
                    id: 'myField1',
                    type: 'text',
                    label: 'My Text Field'
                },
                {
                    id: 'myField2',
                    type: 'text',
                    label: 'Another Text Field'
                }
            ]
        });

    }
} );

CKEDITOR.replace( 'editor1' );

You can also remove existing fields:

var someTab = def.getContents( 'someTab' );
someTab.remove( 'someField' );

Or modify them:

var input = someTab.get( 'input' );
input[ 'default' ] = 'www.example.com';

Or event remove the whole tab:

def.removeContents( 'anotherTab' );
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!