Ticket #4073: 4073_3.patch

File 4073_3.patch, 1.9 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/templates/dialogs/templates.js

     
    8181
    8282                if( isInsert )
    8383                {
     84                        // Everything should happen after the document is loaded (#4073).
     85                        editor.on( 'contentDom', function( evt )
     86                        {
     87                                evt.removeListener();
     88                                dialog.hide();
     89
     90                                // Place the cursor at the first editable place.
     91                                var range = new CKEDITOR.dom.range( editor.document );
     92                                range.moveToElementEditStart( editor.document.getBody() );
     93                                range.select( true );
     94                        } );
    8495                        editor.setData( html );
    8596                }
    8697                else
    8798                {
    8899                        editor.insertHtml( html );
    89                 }
    90 
    91                 dialog.hide();
    92         }
     100                        dialog.hide();
     101                }
     102        }
    93103
    94104        CKEDITOR.dialog.add( 'templates', function( editor )
    95105                {
  • _source/plugins/dialog/plugin.js

     
    592592                 */
    593593                show : function()
    594594                {
    595                         if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
    596                                 this._.editor.getSelection().lock();
     595                        var editor = this._.editor;
     596                        if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
     597                        {
     598                                var selection = editor.getSelection();
     599                                selection && selection.lock();
     600                        }
    597601
    598602                        // Insert the dialog's element to the root document.
    599603                        var element = this._.element;
     
    779783                                editor.focus();
    780784
    781785                                if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
    782                                         editor.getSelection().unlock( true );
    783                         }
     786                                {
     787                                        var selection = editor.getSelection();
     788                                        selection && selection.unlock( true );
     789                                }
     790                        }
    784791                        else
    785792                                CKEDITOR.dialog._.currentZIndex -= 10;
    786793
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy