Ticket #6438: 6438.patch

File 6438.patch, 1.7 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/selection/plugin.js

     
    249249                                                        });
    250250
    251251                                                body.on( 'keydown', disableSave );
    252                                                 body.on( 'keyup',
    253                                                         function()
    254                                                         {
    255                                                                 saveEnabled = true;
    256                                                                 saveSelection();
    257                                                         });
     252                                                // Frequency control on the saving of selection when typing too fast. (#6438)
     253                                                body.on( 'keyup', CKEDITOR.tools.periodical( 1000, function()
     254                                                {
     255                                                        saveEnabled = true;
     256                                                        saveSelection();
     257                                                } ));
    258258
    259259
    260260                                                // IE is the only to provide the "selectionchange"
  • _source/core/tools.js

     
    459459                                milliseconds || 0 );
    460460                },
    461461
     462                /*
     463                 * Make sure the passed function executes with at least {@param delay} of interval.
     464                 * @param delay The minimum period of time between two consequent function call.
     465                 * @param func The function on subject.
     466                 * @param [scope] The invocation scope of the passed function.
     467                 */
     468                periodical : function ( delay, func, scope )
     469                {
     470                        var timer,
     471                                args = Array.prototype.slice.call( arguments, 3 );
     472                        return function ()
     473                        {
     474                                !timer && ( timer = setTimeout( function ()
     475                                {
     476                                        clearTimeout( timer );
     477                                        timer = 0;
     478                                        func.apply( scope, args );
     479                                }, delay ) );
     480                        };
     481                },
     482
    462483                /**
    463484                 * Remove spaces from the start and the end of a string. The following
    464485                 * characters are removed: space, tab, line break, line feed.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy