Ticket #5438: 5438.patch
File 5438.patch, 10.4 KB (added by , 14 years ago) |
---|
-
_source/plugins/scayt/plugin.js
41 41 // Get the iframe. 42 42 oParams.srcNodeRef = editor.document.getWindow().$.frameElement; 43 43 // syntax : AppName.AppVersion@AppRevision 44 oParams.assocApp = "CKEDITOR." + CKEDITOR.version + "@"+ CKEDITOR.revision;45 oParams.customerid = editor.config.scayt_customerid || "1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2";44 oParams.assocApp = 'CKEDITOR.' + CKEDITOR.version + '@' + CKEDITOR.revision; 45 oParams.customerid = editor.config.scayt_customerid || '1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2'; 46 46 oParams.customDictionaryIds = editor.config.scayt_customDictionaryIds || ''; 47 47 oParams.userDictionaryName = editor.config.scayt_userDictionaryName || ''; 48 oParams.sLang = editor.config.scayt_sLang || "en_US";48 oParams.sLang = editor.config.scayt_sLang || 'en_US'; 49 49 50 50 oParams.onBeforeChange = function() 51 51 { … … 61 61 oParams[ k ] = scayt_custom_params[ k ]; 62 62 } 63 63 } 64 64 65 65 if ( scayt_control_id ) 66 66 oParams.id = scayt_control_id; 67 67 68 68 var scayt_control = new window.scayt( oParams ); 69 69 70 70 // Copy config. … … 117 117 { 118 118 if ( (ev.data.name == 'source' || ev.data.name == 'newpage') && editor.mode == 'wysiwyg' ) 119 119 { 120 var scayt_instan se = plugin.getScayt( editor );121 if ( scayt_instan se )120 var scayt_instance = plugin.getScayt( editor ); 121 if ( scayt_instance ) 122 122 { 123 scayt_paused = scayt_instan se.paused = !scayt_instanse.disabled;124 scayt_control_id = scayt_instan se.id;125 scayt_instan se.destroy( true );123 scayt_paused = scayt_instance.paused = !scayt_instance.disabled; 124 scayt_control_id = scayt_instance.id; 125 scayt_instance.destroy( true ); 126 126 delete plugin.instances[ editor.name ]; 127 127 } 128 128 } 129 129 }); 130 130 131 editor.on( 'destroy', function( ev ) 132 { 133 var editor = ev.editor, 134 scayt_instance = plugin.getScayt( editor ); 131 135 132 editor.on( 'destroy', function() 133 { 134 scayt_control_id = scayt_instanse.id; 135 plugin.getScayt( editor ).destroy( true ); 136 scayt_control_id = null; 137 scayt_instance.destroy( true ); 138 delete plugin.instances[ editor.name ]; 136 139 }); 140 137 141 // Listen to data manipulation to reflect scayt markup. 138 142 editor.on( 'afterSetData', function() 139 143 { 140 144 if ( plugin.isScaytEnabled( editor ) ) { 141 window.setTimeout( function(){ plugin.getScayt( editor ).refresh() }, 10 );145 window.setTimeout( function(){ plugin.getScayt( editor ).refresh(); }, 10 ); 142 146 } 143 147 }); 144 148 … … 154 158 editor.getSelection().unlock( true ); 155 159 156 160 // Swallow any SCAYT engine errors. 157 window.setTimeout( function(){ scayt_instance.refresh() }, 10 );161 window.setTimeout( function(){ scayt_instance.refresh(); }, 10 ); 158 162 } 159 163 }, this, null, 50 ); 160 164 161 165 editor.on( 'insertHtml', function() 162 166 { 163 164 167 var scayt_instance = plugin.getScayt( editor ); 165 168 if ( plugin.isScaytEnabled( editor ) ) 166 169 { … … 170 173 editor.getSelection().unlock( true ); 171 174 172 175 // Swallow any SCAYT engine errors. 173 174 window.setTimeout( function(){ scayt_instance.refresh() },10 ); 175 176 window.setTimeout( function(){ scayt_instance.refresh(); },10 ); 176 177 } 177 178 }, this, null, 50 ); 178 179 … … 186 187 187 188 var dataProcessor = editor.dataProcessor, 188 189 htmlFilter = dataProcessor && dataProcessor.htmlFilter; 190 189 191 if ( htmlFilter ) 190 192 { 191 193 htmlFilter.addRules( … … 224 226 }, 225 227 isScaytEnabled : function( editor ) 226 228 { 227 var scayt_instan se = this.getScayt( editor );228 return ( scayt_instan se ) ? scayt_instanse.disabled === false : false;229 var scayt_instance = this.getScayt( editor ); 230 return ( scayt_instance ) ? scayt_instance.disabled === false : false; 229 231 }, 230 232 loadEngine : function( editor ) 231 233 { … … 244 246 }, 245 247 this, 246 248 null, 247 0 249 0 248 250 ); // First to run. 249 251 250 252 this.engineLoaded = -1; // Loading in progress. … … 253 255 var protocol = document.location.protocol; 254 256 // Default to 'http' for unknown. 255 257 protocol = protocol.search( /https?:/) != -1? protocol : 'http:'; 256 var baseUrl = "svc.spellchecker.net/spellcheck31/lf/scayt/scayt22.js";258 var baseUrl = 'svc.spellchecker.net/spellcheck31/lf/scayt/scayt22.js'; 257 259 258 var scaytUrl = editor.config.scayt_srcUrl || ( protocol + "//"+ baseUrl );259 var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + "/";260 var scaytUrl = editor.config.scayt_srcUrl || ( protocol + '//' + baseUrl ); 261 var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + '/'; 260 262 261 263 CKEDITOR._djScaytConfig = 262 264 { … … 265 267 [ 266 268 function() 267 269 { 268 CKEDITOR.fireOnce( "scaytReady");270 CKEDITOR.fireOnce( 'scaytReady' ); 269 271 } 270 272 ], 271 273 isDebug: false … … 365 367 // Add Options dialog. 366 368 CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) ); 367 369 // read ui tags 368 var confuiTabs = editor.config.scayt_uiTabs || "1,1,1";370 var confuiTabs = editor.config.scayt_uiTabs || '1,1,1'; 369 371 var uiTabs =[]; 370 // string t parray convert371 confuiTabs = confuiTabs.split( ",");372 // check array length ! al lwaays must be 3 filled with 1 or 0372 // string to array convert 373 confuiTabs = confuiTabs.split( ',' ); 374 // check array length ! always must be 3 filled with 1 or 0 373 375 for (var i=0,l=3; i<l; i++) 374 376 { 375 var flag = parseInt(confuiTabs[i] || "1",10);376 uiTabs.push( flag);377 var flag = parseInt(confuiTabs[i] || '1' ,10); 378 uiTabs.push( flag ); 377 379 } 378 380 379 381 var menuGroup = 'scaytButton'; … … 381 383 // combine menu items to render 382 384 var uiMuneItems = {}; 383 385 384 // al lways added386 // always added 385 387 uiMuneItems.scaytToggle = 386 388 { 387 389 label : editor.lang.scayt.enable, … … 423 425 editor.openDialog( commandName ); 424 426 } 425 427 }; 426 // al lways added428 // always added 427 429 uiMuneItems.scaytAbout = 428 430 { 429 431 label : editor.lang.scayt.about, … … 436 438 } 437 439 ; 438 440 439 uiTabs[3] = 1; // about us tab is al lways on441 uiTabs[3] = 1; // about us tab is always on 440 442 plugin.uiTabs = uiTabs; 441 443 442 444 editor.addMenuItems( uiMuneItems ); … … 480 482 481 483 var scayt_control = plugin.getScayt( editor ), 482 484 node = scayt_control.getScaytNode(); 483 485 484 486 if ( !node ) 485 487 return null; 486 488 … … 508 510 moreSuggestions = {}; // Reset items. 509 511 mainSuggestions = {}; 510 512 511 var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || "on";513 var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || 'on'; 512 514 var moreSuggestionsUnableAdded = false; 513 515 514 516 var maxSuggestions = editor.config.scayt_maxSuggestions; 515 517 ( typeof maxSuggestions != 'number' ) && ( maxSuggestions = 5 ); 516 518 !maxSuggestions && ( maxSuggestions = items_suggestion.length ); 517 519 518 var contextCommands = editor.config.scayt_contextCommands || "all";519 contextCommands = contextCommands.split( "|");520 var contextCommands = editor.config.scayt_contextCommands || 'all'; 521 contextCommands = contextCommands.split( '|' ); 520 522 521 523 for ( var i = 0, l = items_suggestion.length; i < l; i += 1 ) 522 524 { … … 538 540 _r[ commandName ] = CKEDITOR.TRISTATE_OFF; 539 541 mainSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF; 540 542 } 541 else if ( moreSuggestionsUnable == "on")543 else if ( moreSuggestionsUnable == 'on' ) 542 544 { 543 545 addButtonCommand( editor, 'button_' + commandName, items_suggestion[i], 544 546 commandName, exec, 'scayt_moresuggest', i + 1 ); … … 547 549 } 548 550 } 549 551 550 if ( moreSuggestionsUnableAdded ){ 551 // Rgister the More suggestions group; 552 if ( moreSuggestionsUnableAdded ) 553 { 554 // Register the More suggestions group; 552 555 editor.addMenuItem( 'scayt_moresuggest', 553 556 { 554 557 label : editor.lang.scayt.moreSuggestions, … … 560 563 } 561 564 }); 562 565 mainSuggestions[ 'scayt_moresuggest' ] = CKEDITOR.TRISTATE_OFF; 563 564 566 } 565 567 566 if ( in_array( "all",contextCommands ) || in_array("ignore",contextCommands) )568 if ( in_array( 'all', contextCommands ) || in_array( 'ignore', contextCommands) ) 567 569 { 568 570 var ignore_command = { 569 571 exec: function(){ 570 572 scayt_control.ignore( node ); 571 573 } 572 574 }; 573 addButtonCommand( editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1);574 mainSuggestions[ 'scayt_ignore'] = CKEDITOR.TRISTATE_OFF;575 addButtonCommand( editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1 ); 576 mainSuggestions[ 'scayt_ignore' ] = CKEDITOR.TRISTATE_OFF; 575 577 } 576 578 577 if ( in_array( "all",contextCommands ) || in_array("ignoreall",contextCommands))579 if ( in_array( 'all', contextCommands ) || in_array( 'ignoreall', contextCommands ) ) 578 580 { 579 581 var ignore_all_command = { 580 582 exec: function(){ … … 585 587 mainSuggestions['scayt_ignore_all'] = CKEDITOR.TRISTATE_OFF; 586 588 } 587 589 588 if ( in_array( "all",contextCommands ) || in_array("add",contextCommands))590 if ( in_array( 'all', contextCommands ) || in_array( 'add', contextCommands ) ) 589 591 { 590 592 var addword_command = { 591 593 exec: function(){ … … 664 666 */ 665 667 666 668 /** 667 * Sets the customer ID for SCAYT. Required for migration from free version 669 * Sets the customer ID for SCAYT. Required for migration from free version 668 670 * with banner to paid version. 669 671 * @name CKEDITOR.config.scayt_customerid 670 672 * @type String … … 740 742 741 743 /** 742 744 * Links SCAYT to custom dictionaries. It's a string containing dictionary ids 743 * separared by commas (","). Available only for licensed version. 745 * separared by commas (","). Available only for licensed version. 744 746 * Further details at http://wiki.spellchecker.net/doku.php?id=custom_dictionary_support . 745 747 * @name CKEDITOR.config.scayt_customDictionaryIds 746 748 * @type String