X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fscayt%2Fplugin.js;h=967767fda6422e3bc21e0b318a31b55cfe44c773;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=8486ad9e36aafb84a2b942663e6699bc2bb1ee3c;hpb=e371ddf8abcb89013e20e6d0dd746adec344d0e5;p=ckeditor.git diff --git a/_source/plugins/scayt/plugin.js b/_source/plugins/scayt/plugin.js index 8486ad9..967767f 100644 --- a/_source/plugins/scayt/plugin.js +++ b/_source/plugins/scayt/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -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; @@ -95,15 +95,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license 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 @@ -492,58 +505,62 @@ 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 = {}; + // Delete span[data-scaytid] when text pasting in editor (#6921) + var dataFilter = editor.dataProcessor && editor.dataProcessor.dataFilter; + var dataFilterRules = + { + elements : + { + span : function( element ) + { + var attrs = element.attributes; + if ( attrs && attrs[ 'data-scaytid' ] ) + delete element.name; + } + } + }; + dataFilter && dataFilter.addRules( dataFilterRules ); + + var moreSuggestions = {}, + 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 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