Ticket #4829: 4829.patch

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

     
    105105                        editor.on( 'contentDom', function()
    106106                                {
    107107                                        var doc = editor.document,
     108                                                win = editor.window.$,
    108109                                                body = doc.getBody();
    109110
    110111                                        if ( CKEDITOR.env.ie )
     
    143144                                                                }
    144145                                                        });
    145146
    146                                                 editor.window.on( 'focus', function()
     147                                                body.on( 'focus', function()
    147148                                                        {
    148149                                                                // Enable selections to be saved.
    149150                                                                saveEnabled = true;
     
    189190                                                // event.
    190191                                                doc.on( 'selectionchange', saveSelection );
    191192
     193                                                // IE doesn't fire "selectionchange" when manipulate selection manually,
     194                                                // compensate the native function with selection saving logic. (#4829)
     195                                                win.TextRange.prototype.select =
     196                                                        CKEDITOR.tools.override( win.TextRange.prototype.select, function( org )
     197                                                        {
     198                                                                return function()
     199                                                                {
     200                                                                        org.apply( this, arguments );
     201                                                                        saveSelection();
     202                                                                };
     203                                                        });
     204
    192205                                                function disableSave()
    193206                                                {
    194207                                                        saveEnabled = false;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy