Ticket #5145: 5101_2.patch

File 5101_2.patch, 12.7 KB (added by WebSpellChecker.net, 14 years ago)
  • _source/plugins/elementspath/plugin.js

     
    7070                                                        name = element.getAttribute( '_cke_real_element_type' );
    7171                                                else
    7272                                                        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                                                }
    107105                                                element = element.getParent();
    108106                                        }
    109107
  • _source/plugins/scayt/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    1010
    1111(function()
    1212{
     13 
    1314        var commandName         = 'scaytcheck',
    1415                openPage                = '',
    1516                scayt_paused    = null;
     
    4445                        oParams.customDictionaryIds = editor.config.scayt_customDictionaryIds;
    4546                        oParams.userDictionaryName = editor.config.scayt_userDictionaryName;
    4647                        oParams.sLang = editor.config.scayt_sLang || "en_US";
    47 
    48                         if ( CKEDITOR._scaytParams )
     48                       
     49                        if ( CKEDITOR.config._scaytParams )
    4950                        {
    50                                 for ( var k in CKEDITOR._scaytParams )
     51                                for ( var k in CKEDITOR.config._scaytParams )
    5152                                {
    52                                         oParams[ k ] = CKEDITOR._scaytParams[ k ];
     53                                        oParams[ k ] = CKEDITOR.config._scaytParams[ k ];
    5354                                }
    5455                        }
    5556
     
    103104
    104105                editor.on( 'beforeCommandExec', function( ev )          // Disable SCAYT before Source command execution.
    105106                        {
     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                                }
    106114                                if ( (ev.data.name == 'source' ||  ev.data.name == 'newpage') && editor.mode == 'wysiwyg' )
    107115                                {
    108116                                        var scayt_instanse = plugin.getScayt( editor );
    109117                                        if ( scayt_instanse )
    110118                                        {
    111119                                                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                                               
    114123                                        }
    115124                                }
    116125                        });
     
    118127
    119128                editor.on( 'destroy', function()
    120129                        {
    121                                 plugin.getScayt( editor ).destroy();
     130                                plugin.getScayt( editor ).destroy(true);
    122131                        });
    123132                // Listen to data manipulation to reflect scayt markup.
    124133                editor.on( 'afterSetData', function()
    125134                        {
    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                                }
    128142                        });
    129143
    130144                // Reload spell-checking for current word after insertion completed.
     
    218232                },
    219233                loadEngine : function( editor )
    220234                {
     235                        if (CKEDITOR.env.opera)
     236                                return;
    221237                        if ( this.engineLoaded === true )
    222238                                return onEngineLoad.apply( editor );    // Add new instance.
    223239                        else if ( this.engineLoaded == -1 )                     // We are waiting.
     
    238254                        var protocol = document.location.protocol;
    239255                        // Default to 'http' for unknown.
    240256                        protocol = protocol.search( /https?:/) != -1? protocol : 'http:';
    241                         var baseUrl  = "svc.spellchecker.net/spellcheck3/lf/scayt/scayt21.js";
     257                        var baseUrl  = "svc.spellchecker.net/spellcheck3/lf/scayt/scayt22.js";
    242258
    243259                        var scaytUrl  =  editor.config.scayt_srcUrl || ( protocol + "//" + baseUrl );
    244260                        var scaytConfigBaseUrl =  plugin.parseUrl( scaytUrl ).path +  "/";
     
    457473                        // If the "contextmenu" plugin is loaded, register the listeners.
    458474                        if ( editor.contextMenu && editor.addMenuItems )
    459475                        {
    460                                 editor.contextMenu.addListener( function( element )
     476                                editor.contextMenu.addListener( function( )
    461477                                        {
    462                                                 if ( !( plugin.isScaytEnabled( editor ) && element ) )
     478                                               
     479                                                if (!plugin.isScaytEnabled(editor))
     480                                                {                                                       
    463481                                                        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 );
    464491
    465                                                 var scayt_control = plugin.getScayt( editor ),
    466                                                         word = scayt_control.getWord( element.$ );
    467 
    468                                                 if ( !word )
     492                                                if (!word)
     493                                                {
    469494                                                        return null;
    470 
     495                                                }
    471496                                                var sLang = scayt_control.getLang(),
    472497                                                        _r = {},
    473498                                                        items_suggestion = window.scayt.getSuggestion( word, sLang );
    474                                                 if (!items_suggestion || !items_suggestion.length )
     499                                                if (!items_suggestion || !items_suggestion.length)
     500                                                {                                                       
    475501                                                        return null;
     502                                                }
    476503                                                // Remove unused commands and menuitems
    477504                                                for ( i in moreSuggestions )
    478505                                                {
     
    508535                                                                                        scayt_control.replace(el, s);
    509536                                                                                }
    510537                                                                        };
    511                                                                 })( element.$, items_suggestion[i] );
     538                                                                })( node, items_suggestion[i] );
    512539
    513540                                                        if ( i < maxSuggestions )
    514541                                                        {
     
    546573                                                {
    547574                                                        var ignore_command = {
    548575                                                                exec: function(){
    549                                                                         scayt_control.ignore(element.$);
     576                                                                        scayt_control.ignore(node);
    550577                                                                }
    551578                                                        };
    552579                                                        addButtonCommand(editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1);
     
    557584                                                {
    558585                                                        var ignore_all_command = {
    559586                                                                exec: function(){
    560                                                                         scayt_control.ignoreAll(element.$);
     587                                                                        scayt_control.ignoreAll(node);
    561588                                                                }
    562589                                                        };
    563590                                                        addButtonCommand(editor, 'ignore_all', editor.lang.scayt.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2);
     
    568595                                                {
    569596                                                        var addword_command = {
    570597                                                                exec: function(){
    571                                                                         window.scayt.addWordToUserDictionary(element.$);
     598                                                                        window.scayt.addWordToUserDictionary(node);
    572599                                                                }
    573600                                                        };
    574601                                                        addButtonCommand(editor, 'add_word', editor.lang.scayt.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3);
     
    598625        });
    599626})();
    600627
    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 */
     637CKEDITOR.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 */
     653CKEDITOR.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 */
     676CKEDITOR.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 */
     695CKEDITOR.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 */
     706CKEDITOR.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 */
     719CKEDITOR.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 */
     730CKEDITOR.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 */
     741CKEDITOR.config.scayt_userDictionaryName = "";
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy