質問

I'm using SCAYT plugin for ckeditor with multiple languages.I have enabled scayt automatically on startup. via code I want to disable spell check when the user chooses language as Chinese/Japanese in the dropdown through the code. How can I do this ?

役に立ちましたか?

解決

Use editor.execCommand to do enable/disable SCAYT manually (via code):

CKEDITOR.instances.yourInstance.execCommand( 'scaytcheck' );

If you want to decide whether to enable SCAT or not on the startup, use pluginsLoaded event to override the config option (see: fiddle):

CKEDITOR.replace( 'editor', {
    plugins: 'wysiwygarea,sourcearea,basicstyles,toolbar,scayt',
    // Turn on SCAYT automatically
    scayt_autoStartup: true,
    on: {
        configLoaded: function() {
            // Disable SCAYT when japanese.
            if ( this.config.language == 'ja' )
                this.config.scayt_autoStartup = false;
        }
    }
} );

他のヒント

I just wanted to post what I had found because I didn't find anywhere in the forums that had the answer to the question "How do I enable/disable SCAYT dynamically?". This is how you can do it:

CKEDITOR.instances.editorId_1.getCommand('scaytcheck').exec()

This will run the command that gets called when clicking the "Enable/Disable" button.

As an update to this answer: I'm running CKEditor 4.6 and could only get this working with

    CKEDITOR.instances[i].execCommand('scaytToggle');

So to iterate through all editors and toggle the scyat:

    for (var i in CKEDITOR.instances) {
        CKEDITOR.instances[i].execCommand('scaytToggle');
    }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top