Ticket #7637: 7637.patch

File 7637.patch, 1.0 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/horizontalrule/plugin.js

     
    1414                canUndo : false,    // The undo snapshot will be handled by 'insertElement'.
    1515                exec : function( editor )
    1616                {
    17                         editor.insertElement( editor.document.createElement( 'hr' ) );
     17                        var hr = editor.document.createElement( 'hr' ),
     18                                range = new CKEDITOR.dom.range( editor.document );
     19
     20                        editor.insertElement( hr );
     21
     22                        // If there's nothing or a non-editable block followed by, establish a new paragraph
     23                        // to make sure cursor is not trapped.
     24                        range.moveToPosition( hr, CKEDITOR.POSITION_AFTER_END );
     25                        var next = hr.getNext();
     26                        if ( !next || next.type == CKEDITOR.NODE_ELEMENT && !next.isEditable() )
     27                                range.fixBlock( true, editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p'  );
     28
     29                        range.select();
    1830                }
    1931        };
    2032
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy