X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fscayt%2Fplugin.js;h=b789c5bc7ca0df14822655e13304628a4badd372;hb=614511639979907ceb0da3614122a4d8eb963ad4;hp=2076207b0136532a64e975c22bd62bf2d44421e8;hpb=8665a7c6c60586526e32e8941fe2896739b6ebfb;p=ckeditor.git diff --git a/_source/plugins/scayt/plugin.js b/_source/plugins/scayt/plugin.js index 2076207..b789c5b 100644 --- a/_source/plugins/scayt/plugin.js +++ b/_source/plugins/scayt/plugin.js @@ -10,18 +10,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license (function() { - var commandName = 'scaytcheck', - openPage = ''; + var commandName = 'scaytcheck', + openPage = ''; // Checks if a value exists in an array - function in_array(needle, haystack) + function in_array( needle, haystack ) { - var found = false, key; - for (key in haystack) + var found = 0, + key; + for ( key in haystack ) { - if ((haystack[key] === needle) || ( haystack[key] == needle)) + if ( haystack[ key ] == needle ) { - found = true; + found = 1; break; } } @@ -34,16 +35,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var createInstance = function() // Create new instance every time Document is created. { + var config = editor.config; // Initialise Scayt instance. var oParams = {}; // Get the iframe. oParams.srcNodeRef = editor.document.getWindow().$.frameElement; // 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'; + oParams.customerid = config.scayt_customerid || '1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2'; + oParams.customDictionaryIds = config.scayt_customDictionaryIds || ''; + oParams.userDictionaryName = config.scayt_userDictionaryName || ''; + oParams.sLang = config.scayt_sLang || 'en_US'; // Introduce SCAYT onLoad callback. (#5632) oParams.onLoad = function() @@ -62,20 +64,18 @@ For licensing, see LICENSE.html or http://ckeditor.com/license oParams.onBeforeChange = function() { if ( plugin.getScayt( editor ) && !editor.checkDirty() ) - setTimeout( function(){ editor.resetDirty(); } ); + setTimeout( function(){ editor.resetDirty(); }, 0 ); }; var scayt_custom_params = window.scayt_custom_params; - if ( typeof scayt_custom_params == 'object') + if ( typeof scayt_custom_params == 'object' ) { for ( var k in scayt_custom_params ) - { oParams[ k ] = scayt_custom_params[ k ]; - } } // needs for restoring a specific scayt control settings - if ( plugin.getControlId(editor) ) - oParams.id = plugin.getControlId(editor); + if ( plugin.getControlId( editor ) ) + oParams.id = plugin.getControlId( editor ); var scayt_control = new window.scayt( oParams ); @@ -85,7 +85,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } ); // Copy config. - var lastInstance = plugin.instances[ editor.name ]; + var lastInstance = plugin.instances[ editor.name ]; if ( lastInstance ) { scayt_control.sLang = lastInstance.sLang; @@ -100,7 +100,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var uiTabs = window.scayt.uiTags; var fTabs = []; - for (var i = 0,l=4; i= 0 ) // Load first time + else if ( !editor.config.scayt_autoStartup && plugin.engineLoaded >= 0 ) // Load first time { this.setState( CKEDITOR.TRISTATE_DISABLED ); plugin.loadEngine( editor ); @@ -494,23 +494,18 @@ CKEDITOR.plugins.scayt = if ( items_order && items_order.length ) { - for ( var pos in items_order ) + for ( var pos = 0 ; pos < items_order.length ; pos++ ) items_order_str += 'scayt_' + items_order[ pos ] + ( items_order.length != parseInt( pos, 10 ) + 1 ? ',' : '' ); } - // Register scayt rbc menu group. - if ( editor.config.scayt_contextMenuOntop ) - // Put it on top of all context menu items - editor.config.menu_groups = items_order_str + ',' + editor.config.menu_groups; - else - // Put it down - editor.config.menu_groups = editor.config.menu_groups + ',' +items_order_str; + // Put it on top of all context menu items (#5717) + editor.config.menu_groups = items_order_str + ',' + editor.config.menu_groups; }, init : function( editor ) { - var moreSuggestions = {}; - var mainSuggestions = {}; + var moreSuggestions = {}, + mainSuggestions = {}; // Scayt command. var command = editor.addCommand( commandName, commandDefinition ); @@ -523,9 +518,9 @@ CKEDITOR.plugins.scayt = // string to array convert confuiTabs = confuiTabs.split( ',' ); // check array length ! always must be 3 filled with 1 or 0 - for (var i=0,l=3; i