无法在CKEditor中添加启用工具栏中的scayt

时间:2015-08-03 05:53:20

标签: javascript ckeditor

我的config.js如下

    CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here.
    // For complete reference see:
    // http://docs.ckeditor.com/#!/api/CKEDITOR.config
    config.height='10em';
    // The toolbar groups arrangement, optimized for a single toolbar row.
    config.toolbarGroups = [
        { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
        { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
        { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
        { name: 'forms' },
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
        /*{ name: 'links' },*/
        { name: 'insert' },
        { name: 'styles' },
        { name: 'colors' },
        { name: 'tools' },
        { name: 'others' }
        /*{ name: 'about' }*/
    ];
    config.enterMode = CKEDITOR.ENTER_BR;
    // The default plugins included in the basic setup define some buttons that
    // are not needed in a basic editor. They are removed here.
    config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript';

    // Dialog windows are also simplified.
    config.removeDialogTabs = 'link:advanced';
    config.extraPlugins = 'scayt';
};

添加config.extraPlugins = 'scayt';我的Ckeditor被禁用我将scayt文件夹放在CKEditor的plugins文件夹中。如果你知道我做错了,请帮忙。我想在CKeditor中添加拼写检查器。

2 个答案:

答案 0 :(得分:1)

我也在为此苦苦挣扎。 对我来说,解决方案是工具栏选项必须以大写字母“ S”开头 所以我不得不使用“ Scayt”代替“ scayt”

CKEDITOR.config.toolbar_MA = [
    ['Scayt', '-', 'Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo', 'Source'],
];
CKEDITOR.config.disableNativeSpellChecker = false;
CKEDITOR.config.defaultLanguage = 'fr';
CKEDITOR.config.language = 'fr';

// Turn on SCAYT automatically
CKEDITOR.config.scayt_autoStartup = true;
CKEDITOR.config.scayt_sLang = 'fr_FR';

答案 1 :(得分:0)

尝试添加此内容:

config.scayt_autoStartup = true;

我没有定义:

config.extraPlugins = 'scayt';

它正在运作

修改

你也可以尝试在这里开始javascript:http://jsfiddle.net/ddan/usz40fb5/

var editor;

function createEditor( lang ) {
    editor && editor.destroy();

    editor = CKEDITOR.replace( 'editor', {
        plugins: 'wysiwygarea,sourcearea,basicstyles,toolbar,scayt',
        // Turn on SCAYT automatically
        scayt_autoStartup: true,
        language: lang,
    } );
}

createEditor( 'en' );

修改

根据您的评论:

这一定必须奏效。使用版本4.4.3。我给出的例子是使用CDN for ckeditor。如果要替换为本地j,请随意包含您自己的脚本或下载该脚本并从本地库加载。

<!-- CKeditor 4.4.3  -->
<script src="http://cdn.ckeditor.com/4.4.3/standard/ckeditor.js"></script>
<textarea  id="editor"> worng spelling</textarea>

<script>
// Shorthand for $( document ).ready()
$(function() {
    CKEDITOR.replace( 'editor', {
            scayt_autoStartup: true
    });
});
</script>

参见工作示例:http://jsfiddle.net/ddan/KS3p4/8/