Ticket #5145: 5101.patch
File 5101.patch, 12.6 KB (added by , 13 years ago) |
---|
-
_source/plugins/elementspath/plugin.js
70 70 name = element.getAttribute( '_cke_real_element_type' ); 71 71 else 72 72 name = element.getName(); 73 74 // Use this variable to add conditional stuff to the 75 // HTML (because we are doing it in reverse order... unshift). 76 var extra = ''; 77 78 // Some browsers don't cancel key events in the keydown but in the 79 // keypress. 80 // TODO: Check if really needed for Gecko+Mac. 81 if ( env.opera || ( env.gecko && env.mac ) ) 82 extra += ' onkeypress="return false;"'; 83 84 // With Firefox, we need to force the button to redraw, otherwise it 85 // will remain in the focus state. 86 if ( env.gecko ) 87 extra += ' onblur="this.style.cssText = this.style.cssText;"'; 88 89 html.unshift( 90 '<a' + 91 ' id="', idBase, index, '"' + 92 ' href="javascript:void(\'', name, '\')"' + 93 ' tabindex="-1"' + 94 ' title="', editor.lang.elementsPath.eleTitle.replace( /%1/, name ), '"' + 95 ( ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ? 96 ' onfocus="event.preventBubble();"' : '' ) + 97 ' hidefocus="true" ' + 98 ' onkeydown="return CKEDITOR._.elementsPath.keydown(\'', this.name, '\',', index, ', event);"' + 99 extra , 100 ' onclick="return CKEDITOR._.elementsPath.click(\'', this.name, '\',', index, ');">', 101 name, 102 '</a>' ); 103 104 if ( name == 'body' ) 105 break; 106 73 74 // scayt murkup should not be presented in ElementPath 75 if ( !element.getAttribute("scaytid")) 76 { 77 // Use this variable to add conditional stuff to the 78 // HTML (because we are doing it in reverse order... unshift). 79 var extra = ''; 80 81 // Some browsers don't cancel key events in the keydown but in the 82 // keypress. 83 // TODO: Check if really needed for Gecko+Mac. 84 if (env.opera || (env.gecko && env.mac)) 85 extra += ' onkeypress="return false;"'; 86 87 // With Firefox, we need to force the button to redraw, otherwise it 88 // will remain in the focus state. 89 if (env.gecko) 90 extra += ' onblur="this.style.cssText = this.style.cssText;"'; 91 92 html.unshift('<a' + 93 ' id="', idBase, index, '"' + 94 ' href="javascript:void(\'', name, '\')"' + 95 ' tabindex="-1"' + 96 ' title="', editor.lang.elementsPath.eleTitle.replace(/%1/, name), '"' + 97 ((CKEDITOR.env.gecko && CKEDITOR.env.version < 10900) ? ' onfocus="event.preventBubble();"' : '') + 98 ' hidefocus="true" ' + 99 ' onkeydown="return CKEDITOR._.elementsPath.keydown(\'', this.name, '\',', index, ', event);"' + 100 extra, ' onclick="return CKEDITOR._.elementsPath.click(\'', this.name, '\',', index, ');">', name, '</a>'); 101 102 if (name == 'body') 103 break; 104 } 107 105 element = element.getParent(); 108 106 } 109 107 -
_source/plugins/scayt/plugin.js
1 /*1 /* 2 2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ … … 10 10 11 11 (function() 12 12 { 13 13 14 var commandName = 'scaytcheck', 14 15 openPage = '', 15 16 scayt_paused = null; … … 44 45 oParams.customDictionaryIds = editor.config.scayt_customDictionaryIds; 45 46 oParams.userDictionaryName = editor.config.scayt_userDictionaryName; 46 47 oParams.sLang = editor.config.scayt_sLang || "en_US"; 47 48 if ( CKEDITOR. _scaytParams )48 49 if ( CKEDITOR.config._scaytParams ) 49 50 { 50 for ( var k in CKEDITOR. _scaytParams )51 for ( var k in CKEDITOR.config._scaytParams ) 51 52 { 52 oParams[ k ] = CKEDITOR. _scaytParams[ k ];53 oParams[ k ] = CKEDITOR.config._scaytParams[ k ]; 53 54 } 54 55 } 55 56 … … 103 104 104 105 editor.on( 'beforeCommandExec', function( ev ) // Disable SCAYT before Source command execution. 105 106 { 107 108 if ( (ev.data.name == 'removeFormat' ) && editor.mode == 'wysiwyg' ) 109 { 110 if ( plugin.isScaytEnabled( editor ) ) 111 plugin.getScayt( editor ).refresh(); 112 } 106 113 if ( (ev.data.name == 'source' || ev.data.name == 'newpage') && editor.mode == 'wysiwyg' ) 107 114 { 108 115 var scayt_instanse = plugin.getScayt( editor ); 109 116 if ( scayt_instanse ) 110 117 { 111 118 scayt_paused = scayt_instanse.paused = !scayt_instanse.disabled; 112 scayt_instanse.destroy(); 113 delete plugin.instances[ editor.name ]; 119 scayt_instanse.destroy(true); 120 delete plugin.instances[editor.name]; 121 114 122 } 115 123 } 116 124 }); … … 118 126 119 127 editor.on( 'destroy', function() 120 128 { 121 plugin.getScayt( editor ).destroy( );129 plugin.getScayt( editor ).destroy(true); 122 130 }); 123 131 // Listen to data manipulation to reflect scayt markup. 124 132 editor.on( 'afterSetData', function() 125 133 { 126 if ( plugin.isScaytEnabled( editor ) ) 127 plugin.getScayt( editor ).refresh(); 134 if (plugin.isScaytEnabled(editor)) { 135 plugin.getScayt(editor).refresh(); 136 137 if( !editor.checkDirty() ) 138 setTimeout( function(){ editor.resetDirty(); } ); 139 140 } 128 141 }); 129 142 130 143 // Reload spell-checking for current word after insertion completed. … … 218 231 }, 219 232 loadEngine : function( editor ) 220 233 { 234 if (CKEDITOR.env.opera) 235 return; 221 236 if ( this.engineLoaded === true ) 222 237 return onEngineLoad.apply( editor ); // Add new instance. 223 238 else if ( this.engineLoaded == -1 ) // We are waiting. … … 238 253 var protocol = document.location.protocol; 239 254 // Default to 'http' for unknown. 240 255 protocol = protocol.search( /https?:/) != -1? protocol : 'http:'; 241 var baseUrl = "svc.spellchecker.net/spellcheck3/lf/scayt/scayt2 1.js";256 var baseUrl = "svc.spellchecker.net/spellcheck3/lf/scayt/scayt22.js"; 242 257 243 258 var scaytUrl = editor.config.scayt_srcUrl || ( protocol + "//" + baseUrl ); 244 259 var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + "/"; … … 457 472 // If the "contextmenu" plugin is loaded, register the listeners. 458 473 if ( editor.contextMenu && editor.addMenuItems ) 459 474 { 460 editor.contextMenu.addListener( function( element)475 editor.contextMenu.addListener( function( ) 461 476 { 462 if ( !( plugin.isScaytEnabled( editor ) && element ) ) 477 478 if (!plugin.isScaytEnabled(editor)) 479 { 463 480 return null; 481 } 482 var scayt_control = plugin.getScayt( editor ); 483 var node = scayt_control.getScaytNode(); 484 485 if (!node) 486 { 487 return null; 488 } 489 word = scayt_control.getWord( node ); 464 490 465 var scayt_control = plugin.getScayt( editor ), 466 word = scayt_control.getWord( element.$ ); 467 468 if ( !word ) 491 if (!word) 492 { 469 493 return null; 470 494 } 471 495 var sLang = scayt_control.getLang(), 472 496 _r = {}, 473 497 items_suggestion = window.scayt.getSuggestion( word, sLang ); 474 if (!items_suggestion || !items_suggestion.length ) 498 if (!items_suggestion || !items_suggestion.length) 499 { 475 500 return null; 501 } 476 502 // Remove unused commands and menuitems 477 503 for ( i in moreSuggestions ) 478 504 { … … 508 534 scayt_control.replace(el, s); 509 535 } 510 536 }; 511 })( element.$, items_suggestion[i] );537 })( node, items_suggestion[i] ); 512 538 513 539 if ( i < maxSuggestions ) 514 540 { … … 546 572 { 547 573 var ignore_command = { 548 574 exec: function(){ 549 scayt_control.ignore( element.$);575 scayt_control.ignore(node); 550 576 } 551 577 }; 552 578 addButtonCommand(editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1); … … 557 583 { 558 584 var ignore_all_command = { 559 585 exec: function(){ 560 scayt_control.ignoreAll( element.$);586 scayt_control.ignoreAll(node); 561 587 } 562 588 }; 563 589 addButtonCommand(editor, 'ignore_all', editor.lang.scayt.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2); … … 568 594 { 569 595 var addword_command = { 570 596 exec: function(){ 571 window.scayt.addWordToUserDictionary( element.$);597 window.scayt.addWordToUserDictionary(node); 572 598 } 573 599 }; 574 600 addButtonCommand(editor, 'add_word', editor.lang.scayt.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3); … … 598 624 }); 599 625 })(); 600 626 601 // TODO: Documentation 602 // CKEDITOR.config.scayt_maxSuggestions 603 // CKEDITOR.config.scayt_autoStartup 627 /** 628 * turn on/off SCAYT autostartup 629 * possible values: false || true 630 * @type boolean 631 * @default false 632 * @example 633 * // SCAYT turn on after editor is loaded 634 * CKEDITOR.config.scayt_autoStartup = true; 635 */ 636 CKEDITOR.config.scayt_autoStartup = CKEDITOR.config.scayt_autoStartup || false; 637 638 /** 639 * allows to set main context menu suggestions count 640 * possiblevalues 641 * 0 - all suggestions should be shown in context menu 642 * >0 (1, 2, etc.)- number of suggestions should be shown in context menu - others should 643 * be shown in "More Suggestions" sub menu 644 * <0 (-1, -2, etc.)- no suggestions should be shown in context menu - all should be shown 645 * in "More Suggestions" sub menu and it (sub-menu) should have caption "Suggestions" 646 * @type int 647 * @default 5 648 * @example 649 * // will show 3 suggestions in right mouse button menu 650 * CKEDITOR.config.scayt_maxSuggestions = 3; 651 */ 652 CKEDITOR.config.scayt_maxSuggestions = CKEDITOR.config.scayt_maxSuggestions || 5; 653 654 655 /** 656 * allows to set encrypted customer id 657 * required to migrate from trial paid hosted service 658 * @type string 659 * 660 * @example 661 * // will load SCAYT from your custom url 662 * CKEDITOR.config.scayt_customerid = "your-encrypted-customer-id"; 663 */ 664 //CKEDITOR.config.scayt_customerid = ""; 665 666 /** 667 * enable or disable "More Suggestions" sub menu in context menu 668 * possible values: "on" or "off" 669 * @type string 670 * @default "on" 671 * @example 672 * // More Suggestion menu will enable 673 * CKEDITOR.config.scayt_moreSuggestions = "on"; 674 */ 675 CKEDITOR.config.scayt_moreSuggestions = "on"; 676 677 678 /** 679 * allows to customize SCAYT context menu commands (Add word, Ignore , Ignore all) 680 * string with "|" delimiter and combination of words "add", "ignore", "ignoreall", e.g. "add|ignoreall" 681 * posible values: 682 * "off" - disable all buttons 683 * "all" - enable all buttons 684 * "ignore" - "ingnore" button 685 * "ignoreall" - "ignore all" button 686 * "add" - "add word" button 687 * 688 * @type string 689 * @default "all" 690 * @example 691 * // show 2 SCAYT buttons in context menu - Add Word and Ignore All 692 * CKEDITOR.config.scayt_contextCommands = "add|ignoreall"; 693 */ 694 CKEDITOR.config.scayt_contextCommands = "all"; 695 696 /** 697 * set up spellchecking language for SCAYT 698 * possible values "en_US", "en_GB", "en_AU"... - 699 * @type string 700 * @default "on" 701 * @example 702 * // set up German language as prior for spellchecking 703 * CKEDITOR.config.scayt_sLang = "de_DE"; 704 */ 705 CKEDITOR.config.scayt_sLang = "en_US"; 706 707 /** 708 * allows to cutomise SCAYT options tags 709 * possible values: string with "," delimiter and combination of "0" or "1" 710 * all 3 values are required in order of tabs following in UI: 711 * options,languages,dictionary 712 * @type string 713 * @default "1,1,1" 714 * @example 715 * // Languages tab will ont rendered 716 * CKEDITOR.config.scayt_uiTabs = "1,0,1"; 717 */ 718 CKEDITOR.config.scayt_uiTabs = "1,1,1"; 719 720 /** 721 * allows to link up custom dictionaries (only for licensed users) 722 * possible values: string with "," delimiter and combination of dictionaries ids 723 * @type string 724 * @default "" 725 * @example 726 * // set up German language as prior for spellchecking 727 * CKEDITOR.config.scayt_customDictionaryIds ="3021,3456,3478" 728 */ 729 CKEDITOR.config.scayt_customDictionaryIds = ""; 730 731 /** 732 * allows to turn on your own dictionary 733 * possible values: alpha numeric name of dictionary 734 * @type string 735 * @default "" 736 * @example 737 * // set up German language as prior for spellchecking 738 * CKEDITOR.config.scayt_userDictionaryName = "MyDictionary" 739 */ 740 CKEDITOR.config.scayt_userDictionaryName = "";