Ticket #5145: 5101_2.patch
File 5101_2.patch, 12.7 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 if ( ev.data.name == 'removeFormat' && editor.mode == 'wysiwyg' ) 108 { 109 110 if (plugin.isScaytEnabled(editor)) 111 window.setTimeout(function(){plugin.getScayt(editor).refresh()},10); 112 113 } 106 114 if ( (ev.data.name == 'source' || ev.data.name == 'newpage') && editor.mode == 'wysiwyg' ) 107 115 { 108 116 var scayt_instanse = plugin.getScayt( editor ); 109 117 if ( scayt_instanse ) 110 118 { 111 119 scayt_paused = scayt_instanse.paused = !scayt_instanse.disabled; 112 scayt_instanse.destroy(); 113 delete plugin.instances[ editor.name ]; 120 scayt_instanse.destroy(true); 121 delete plugin.instances[editor.name]; 122 114 123 } 115 124 } 116 125 }); … … 118 127 119 128 editor.on( 'destroy', function() 120 129 { 121 plugin.getScayt( editor ).destroy( );130 plugin.getScayt( editor ).destroy(true); 122 131 }); 123 132 // Listen to data manipulation to reflect scayt markup. 124 133 editor.on( 'afterSetData', function() 125 134 { 126 if ( plugin.isScaytEnabled( editor ) ) 127 plugin.getScayt( editor ).refresh(); 135 if (plugin.isScaytEnabled(editor)) { 136 plugin.getScayt(editor).refresh(); 137 138 if( !editor.checkDirty() ) 139 setTimeout( function(){ editor.resetDirty(); } ); 140 141 } 128 142 }); 129 143 130 144 // Reload spell-checking for current word after insertion completed. … … 218 232 }, 219 233 loadEngine : function( editor ) 220 234 { 235 if (CKEDITOR.env.opera) 236 return; 221 237 if ( this.engineLoaded === true ) 222 238 return onEngineLoad.apply( editor ); // Add new instance. 223 239 else if ( this.engineLoaded == -1 ) // We are waiting. … … 238 254 var protocol = document.location.protocol; 239 255 // Default to 'http' for unknown. 240 256 protocol = protocol.search( /https?:/) != -1? protocol : 'http:'; 241 var baseUrl = "svc.spellchecker.net/spellcheck3/lf/scayt/scayt2 1.js";257 var baseUrl = "svc.spellchecker.net/spellcheck3/lf/scayt/scayt22.js"; 242 258 243 259 var scaytUrl = editor.config.scayt_srcUrl || ( protocol + "//" + baseUrl ); 244 260 var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + "/"; … … 457 473 // If the "contextmenu" plugin is loaded, register the listeners. 458 474 if ( editor.contextMenu && editor.addMenuItems ) 459 475 { 460 editor.contextMenu.addListener( function( element)476 editor.contextMenu.addListener( function( ) 461 477 { 462 if ( !( plugin.isScaytEnabled( editor ) && element ) ) 478 479 if (!plugin.isScaytEnabled(editor)) 480 { 463 481 return null; 482 } 483 var scayt_control = plugin.getScayt( editor ); 484 var node = scayt_control.getScaytNode(); 485 486 if (!node) 487 { 488 return null; 489 } 490 word = scayt_control.getWord( node ); 464 491 465 var scayt_control = plugin.getScayt( editor ), 466 word = scayt_control.getWord( element.$ ); 467 468 if ( !word ) 492 if (!word) 493 { 469 494 return null; 470 495 } 471 496 var sLang = scayt_control.getLang(), 472 497 _r = {}, 473 498 items_suggestion = window.scayt.getSuggestion( word, sLang ); 474 if (!items_suggestion || !items_suggestion.length ) 499 if (!items_suggestion || !items_suggestion.length) 500 { 475 501 return null; 502 } 476 503 // Remove unused commands and menuitems 477 504 for ( i in moreSuggestions ) 478 505 { … … 508 535 scayt_control.replace(el, s); 509 536 } 510 537 }; 511 })( element.$, items_suggestion[i] );538 })( node, items_suggestion[i] ); 512 539 513 540 if ( i < maxSuggestions ) 514 541 { … … 546 573 { 547 574 var ignore_command = { 548 575 exec: function(){ 549 scayt_control.ignore( element.$);576 scayt_control.ignore(node); 550 577 } 551 578 }; 552 579 addButtonCommand(editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1); … … 557 584 { 558 585 var ignore_all_command = { 559 586 exec: function(){ 560 scayt_control.ignoreAll( element.$);587 scayt_control.ignoreAll(node); 561 588 } 562 589 }; 563 590 addButtonCommand(editor, 'ignore_all', editor.lang.scayt.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2); … … 568 595 { 569 596 var addword_command = { 570 597 exec: function(){ 571 window.scayt.addWordToUserDictionary( element.$);598 window.scayt.addWordToUserDictionary(node); 572 599 } 573 600 }; 574 601 addButtonCommand(editor, 'add_word', editor.lang.scayt.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3); … … 598 625 }); 599 626 })(); 600 627 601 // TODO: Documentation 602 // CKEDITOR.config.scayt_maxSuggestions 603 // CKEDITOR.config.scayt_autoStartup 628 /** 629 * turn on/off SCAYT autostartup 630 * possible values: false || true 631 * @type boolean 632 * @default false 633 * @example 634 * // SCAYT turn on after editor is loaded 635 * CKEDITOR.config.scayt_autoStartup = true; 636 */ 637 CKEDITOR.config.scayt_autoStartup = CKEDITOR.config.scayt_autoStartup || false; 638 639 /** 640 * allows to set main context menu suggestions count 641 * possiblevalues 642 * 0 - all suggestions should be shown in context menu 643 * >0 (1, 2, etc.)- number of suggestions should be shown in context menu - others should 644 * be shown in "More Suggestions" sub menu 645 * <0 (-1, -2, etc.)- no suggestions should be shown in context menu - all should be shown 646 * in "More Suggestions" sub menu and it (sub-menu) should have caption "Suggestions" 647 * @type int 648 * @default 5 649 * @example 650 * // will show 3 suggestions in right mouse button menu 651 * CKEDITOR.config.scayt_maxSuggestions = 3; 652 */ 653 CKEDITOR.config.scayt_maxSuggestions = CKEDITOR.config.scayt_maxSuggestions || 5; 654 655 656 /** 657 * allows to set encrypted customer id 658 * required to migrate from trial paid hosted service 659 * @type string 660 * 661 * @example 662 * // will load SCAYT from your custom url 663 * CKEDITOR.config.scayt_customerid = "your-encrypted-customer-id"; 664 */ 665 //CKEDITOR.config.scayt_customerid = ""; 666 667 /** 668 * enable or disable "More Suggestions" sub menu in context menu 669 * possible values: "on" or "off" 670 * @type string 671 * @default "on" 672 * @example 673 * // More Suggestion menu will enable 674 * CKEDITOR.config.scayt_moreSuggestions = "on"; 675 */ 676 CKEDITOR.config.scayt_moreSuggestions = "on"; 677 678 679 /** 680 * allows to customize SCAYT context menu commands (Add word, Ignore , Ignore all) 681 * string with "|" delimiter and combination of words "add", "ignore", "ignoreall", e.g. "add|ignoreall" 682 * posible values: 683 * "off" - disable all buttons 684 * "all" - enable all buttons 685 * "ignore" - "ingnore" button 686 * "ignoreall" - "ignore all" button 687 * "add" - "add word" button 688 * 689 * @type string 690 * @default "all" 691 * @example 692 * // show 2 SCAYT buttons in context menu - Add Word and Ignore All 693 * CKEDITOR.config.scayt_contextCommands = "add|ignoreall"; 694 */ 695 CKEDITOR.config.scayt_contextCommands = "all"; 696 697 /** 698 * set up spellchecking language for SCAYT 699 * possible values "en_US", "en_GB", "en_AU"... - 700 * @type string 701 * @default "on" 702 * @example 703 * // set up German language as prior for spellchecking 704 * CKEDITOR.config.scayt_sLang = "de_DE"; 705 */ 706 CKEDITOR.config.scayt_sLang = "en_US"; 707 708 /** 709 * allows to cutomise SCAYT options tags 710 * possible values: string with "," delimiter and combination of "0" or "1" 711 * all 3 values are required in order of tabs following in UI: 712 * options,languages,dictionary 713 * @type string 714 * @default "1,1,1" 715 * @example 716 * // Languages tab will ont rendered 717 * CKEDITOR.config.scayt_uiTabs = "1,0,1"; 718 */ 719 CKEDITOR.config.scayt_uiTabs = "1,1,1"; 720 721 /** 722 * allows to link up custom dictionaries (only for licensed users) 723 * possible values: string with "," delimiter and combination of dictionaries ids 724 * @type string 725 * @default "" 726 * @example 727 * // set up German language as prior for spellchecking 728 * CKEDITOR.config.scayt_customDictionaryIds ="3021,3456,3478" 729 */ 730 CKEDITOR.config.scayt_customDictionaryIds = ""; 731 732 /** 733 * allows to turn on your own dictionary 734 * possible values: alpha numeric name of dictionary 735 * @type string 736 * @default "" 737 * @example 738 * // set up German language as prior for spellchecking 739 * CKEDITOR.config.scayt_userDictionaryName = "MyDictionary" 740 */ 741 CKEDITOR.config.scayt_userDictionaryName = "";