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