为什么ckeditor插件选项卡不起作用?

时间:2019-05-27 17:38:48

标签: tabs ckeditor

嗨,

我需要tab功能在Ckeditor中工作,并将“ tab”插件放在plugin文件夹中,然后我告诉编辑器,但是当我按键盘上的tab时,焦点离开了编辑器。我究竟做错了什么?我的脚本:

        <script>
            CKEDITOR.replace( 'editor', { 
                width: 795, height: 642,
                enterMode: CKEDITOR.ENTER_DIV,
                shiftEnterMode: CKEDITOR.ENTER_BR
            }
            );
            CKEDITOR.editorConfig = function( config ) {
                config.toolbarGroups = [
                    { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
                    { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
                    { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
                    { name: 'forms', groups: [ 'forms' ] },
                    '/',
                    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
                    { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] },
                    { name: 'links', groups: [ 'links' ] },
                    { name: 'insert', groups: [ 'insert' ] },
                    '/',
                    { name: 'styles', groups: [ 'styles' ] },
                    { name: 'colors', groups: [ 'colors' ] },
                    { name: 'tools', groups: [ 'tools' ] },
                    { name: 'others', groups: [ 'others' ] },
                    { name: 'about', groups: [ 'about' ] }
                ];

                config.removeButtons = 'Source,Save,Templates,NewPage,Preview,Print,Flash,HorizontalRule,Smiley,PageBreak,Iframe,ShowBlocks,Maximize,About,Link,Unlink,Anchor,Language,CreateDiv';
                config.extraPlugins = 'tab';    };

        </script>

2 个答案:

答案 0 :(得分:0)

如果希望在按Tab键时移动文本,则需要将tabSpaces配置设置设置为大于0的值,例如

var editor = CKEDITOR.replace( 'editor1', {
    tabSpaces : 4
});

另请参阅:https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-tabSpaces

答案 1 :(得分:0)

谢谢,但这仅适用于第一行。当我按Tab键时,焦点移出文档。