Ticket #7959: 7959.patch

File 7959.patch, 1.4 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/table/dialogs/table.js

     
    106106                        onOk : function()
    107107                        {
    108108                                var selection = editor.getSelection(),
    109                                         bms = selection.createBookmarks();
     109                                        bms = this._.selectedElement && selection.createBookmarks();
    110110
    111111                                var table = this._.selectedElement || makeElement( 'table' ),
    112112                                        me = this,
     
    222222
    223223                                // Insert the table element if we're creating one.
    224224                                if ( !this._.selectedElement )
     225                                {
    225226                                        editor.insertElement( table );
    226 
     227                                        // Override the default cursor position after insertElement to place
     228                                        // cursor inside the first cell (#7959), IE needs a while.
     229                                        setTimeout( function()
     230                                                {
     231                                                        var firstCell = new CKEDITOR.dom.element( table.$.rows[ 0 ].cells[ 0 ] );
     232                                                        var range = new CKEDITOR.dom.range( editor.document );
     233                                                        range.moveToPosition( firstCell, CKEDITOR.POSITION_AFTER_START );
     234                                                        range.select( 1 );
     235                                                }, 0 );
     236                                }
    227237                                // Properly restore the selection, (#4822) but don't break
    228238                                // because of this, e.g. updated table caption.
    229                                 try { selection.selectBookmarks( bms ); } catch( er ){}
    230 
    231                                 return true;
     239                                else
     240                                        try { selection.selectBookmarks( bms ); } catch( er ){}
    232241                        },
    233242                        contents : [
    234243                                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy