/* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview Spell Check As You Type (SCAYT). * Button name : Scayt. */ (function() { var commandName = 'scaytcheck', openPage = '', scayt_paused = null; // Checks if a value exists in an array function in_array(needle, haystack) { var found = false, key; for (key in haystack) { if ((haystack[key] === needle) || ( haystack[key] == needle)) { found = true; break; } } return found; } var onEngineLoad = function() { var editor = this; var createInstance = function() // Create new instance every time Document is created. { // Initialise Scayt instance. var oParams = {}; oParams.srcNodeRef = editor.document.getWindow().$.frameElement; // Get the iframe. // syntax : AppName.AppVersion@AppRevision oParams.assocApp = "CKEDITOR." + CKEDITOR.version + "@" + CKEDITOR.revision; oParams.customerid = editor.config.scayt_customerid || "1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2"; oParams.customDictionaryIds = editor.config.scayt_customDictionaryIds; oParams.userDictionaryName = editor.config.scayt_userDictionaryName; oParams.sLang = editor.config.scayt_sLang || "en_US"; if ( CKEDITOR._scaytParams ) { for ( var k in CKEDITOR._scaytParams ) { oParams[ k ] = CKEDITOR._scaytParams[ k ]; } } var scayt_control = new window.scayt( oParams ); // Copy config. var lastInstance = plugin.instances[ editor.name ]; if ( lastInstance ) { scayt_control.sLang = lastInstance.sLang; scayt_control.option( lastInstance.option() ); scayt_control.paused = lastInstance.paused; } plugin.instances[ editor.name ] = scayt_control; //window.scayt.uiTags var menuGroup = 'scaytButton'; var uiTabs = window.scayt.uiTags; var fTabs = []; for (var i = 0,l=4; i= 0 ) // Load first time { this.setState( CKEDITOR.TRISTATE_DISABLED ); editor.on( 'showScaytState', function() { this.removeListener(); this.setState( plugin.isScaytEnabled( editor ) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF ); }, this); plugin.loadEngine( editor ); } } }; // Add scayt plugin. CKEDITOR.plugins.add( 'scayt', { requires : [ 'menubutton' ], beforeInit : function( editor ) { // Register own rbc menu group. editor.config.menu_groups = 'scayt_suggest,scayt_moresuggest,scayt_control,' + editor.config.menu_groups; }, init : function( editor ) { var moreSuggestions = {}; var mainSuggestions = {}; // Scayt command. var command = editor.addCommand( commandName, commandDefinition ); // Add Options dialog. CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) ); // read ui tags var confuiTabs = editor.config.scayt_uiTabs || "1,1,1"; var uiTabs =[]; // string tp array convert confuiTabs = confuiTabs.split(","); // check array length ! allwaays must be 3 filled with 1 or 0 for (var i=0,l=3; i