X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fhorizontalrule%2Fplugin.js;h=3eac31915ed66cf8655c116c89568eb9da3db6be;hb=refs%2Ftags%2Fv3.6.1;hp=d4ec65a6eb40a06aa7e7f717652d5232357ba805;hpb=48b1db88210b4160dce439c6e3e32e14af8c106b;p=ckeditor.git diff --git a/_source/plugins/horizontalrule/plugin.js b/_source/plugins/horizontalrule/plugin.js index d4ec65a..3eac319 100644 --- a/_source/plugins/horizontalrule/plugin.js +++ b/_source/plugins/horizontalrule/plugin.js @@ -14,7 +14,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license canUndo : false, // The undo snapshot will be handled by 'insertElement'. exec : function( editor ) { - editor.insertElement( editor.document.createElement( 'hr' ) ); + var hr = editor.document.createElement( 'hr' ), + range = new CKEDITOR.dom.range( editor.document ); + + editor.insertElement( hr ); + + // If there's nothing or a non-editable block followed by, establish a new paragraph + // to make sure cursor is not trapped. + range.moveToPosition( hr, CKEDITOR.POSITION_AFTER_END ); + var next = hr.getNext(); + if ( !next || next.type == CKEDITOR.NODE_ELEMENT && !next.isEditable() ) + range.fixBlock( true, editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' ); + + range.select(); } };