Ticket #5145: 5101.patch

File 5101.patch, 12.6 KB (added by WebSpellChecker.net, 13 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                               
     108                                if ( (ev.data.name == 'removeFormat' ) && editor.mode == 'wysiwyg' )
     109                                {
     110                                        if ( plugin.isScaytEnabled( editor ) )
     111                                                        plugin.getScayt( editor ).refresh();
     112                                }
    106113                                if ( (ev.data.name == 'source' ||  ev.data.name == 'newpage') && editor.mode == 'wysiwyg' )
    107114                                {
    108115                                        var scayt_instanse = plugin.getScayt( editor );
    109116                                        if ( scayt_instanse )
    110117                                        {
    111118                                                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                                               
    114122                                        }
    115123                                }
    116124                        });
     
    118126
    119127                editor.on( 'destroy', function()
    120128                        {
    121                                 plugin.getScayt( editor ).destroy();
     129                                plugin.getScayt( editor ).destroy(true);
    122130                        });
    123131                // Listen to data manipulation to reflect scayt markup.
    124132                editor.on( 'afterSetData', function()
    125133                        {
    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                                }
    128141                        });
    129142
    130143                // Reload spell-checking for current word after insertion completed.
     
    218231                },
    219232                loadEngine : function( editor )
    220233                {
     234                        if (CKEDITOR.env.opera)
     235                                return;
    221236                        if ( this.engineLoaded === true )
    222237                                return onEngineLoad.apply( editor );    // Add new instance.
    223238                        else if ( this.engineLoaded == -1 )                     // We are waiting.
     
    238253                        var protocol = document.location.protocol;
    239254                        // Default to 'http' for unknown.
    240255                        protocol = protocol.search( /https?:/) != -1? protocol : 'http:';
    241                         var baseUrl  = "svc.spellchecker.net/spellcheck3/lf/scayt/scayt21.js";
     256                        var baseUrl  = "svc.spellchecker.net/spellcheck3/lf/scayt/scayt22.js";
    242257
    243258                        var scaytUrl  =  editor.config.scayt_srcUrl || ( protocol + "//" + baseUrl );
    244259                        var scaytConfigBaseUrl =  plugin.parseUrl( scaytUrl ).path +  "/";
     
    457472                        // If the "contextmenu" plugin is loaded, register the listeners.
    458473                        if ( editor.contextMenu && editor.addMenuItems )
    459474                        {
    460                                 editor.contextMenu.addListener( function( element )
     475                                editor.contextMenu.addListener( function( )
    461476                                        {
    462                                                 if ( !( plugin.isScaytEnabled( editor ) && element ) )
     477                                               
     478                                                if (!plugin.isScaytEnabled(editor))
     479                                                {                                                       
    463480                                                        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 );
    464490
    465                                                 var scayt_control = plugin.getScayt( editor ),
    466                                                         word = scayt_control.getWord( element.$ );
    467 
    468                                                 if ( !word )
     491                                                if (!word)
     492                                                {
    469493                                                        return null;
    470 
     494                                                }
    471495                                                var sLang = scayt_control.getLang(),
    472496                                                        _r = {},
    473497                                                        items_suggestion = window.scayt.getSuggestion( word, sLang );
    474                                                 if (!items_suggestion || !items_suggestion.length )
     498                                                if (!items_suggestion || !items_suggestion.length)
     499                                                {                                                       
    475500                                                        return null;
     501                                                }
    476502                                                // Remove unused commands and menuitems
    477503                                                for ( i in moreSuggestions )
    478504                                                {
     
    508534                                                                                        scayt_control.replace(el, s);
    509535                                                                                }
    510536                                                                        };
    511                                                                 })( element.$, items_suggestion[i] );
     537                                                                })( node, items_suggestion[i] );
    512538
    513539                                                        if ( i < maxSuggestions )
    514540                                                        {
     
    546572                                                {
    547573                                                        var ignore_command = {
    548574                                                                exec: function(){
    549                                                                         scayt_control.ignore(element.$);
     575                                                                        scayt_control.ignore(node);
    550576                                                                }
    551577                                                        };
    552578                                                        addButtonCommand(editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1);
     
    557583                                                {
    558584                                                        var ignore_all_command = {
    559585                                                                exec: function(){
    560                                                                         scayt_control.ignoreAll(element.$);
     586                                                                        scayt_control.ignoreAll(node);
    561587                                                                }
    562588                                                        };
    563589                                                        addButtonCommand(editor, 'ignore_all', editor.lang.scayt.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2);
     
    568594                                                {
    569595                                                        var addword_command = {
    570596                                                                exec: function(){
    571                                                                         window.scayt.addWordToUserDictionary(element.$);
     597                                                                        window.scayt.addWordToUserDictionary(node);
    572598                                                                }
    573599                                                        };
    574600                                                        addButtonCommand(editor, 'add_word', editor.lang.scayt.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3);
     
    598624        });
    599625})();
    600626
    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 */
     636CKEDITOR.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 */
     652CKEDITOR.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 */
     675CKEDITOR.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 */
     694CKEDITOR.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 */
     705CKEDITOR.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 */
     718CKEDITOR.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 */
     729CKEDITOR.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 */
     740CKEDITOR.config.scayt_userDictionaryName = "";
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy