3eac31915ed66cf8655c116c89568eb9da3db6be
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
7 * @file Horizontal Rule plugin.
12 var horizontalruleCmd
=
14 canUndo
: false, // The undo snapshot will be handled by 'insertElement'.
15 exec : function( editor
)
17 var hr
= editor
.document
.createElement( 'hr' ),
18 range
= new CKEDITOR
.dom
.range( editor
.document
);
20 editor
.insertElement( hr
);
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' );
33 var pluginName
= 'horizontalrule';
35 // Register a plugin named "horizontalrule".
36 CKEDITOR
.plugins
.add( pluginName
,
38 init : function( editor
)
40 editor
.addCommand( pluginName
, horizontalruleCmd
);
41 editor
.ui
.addButton( 'HorizontalRule',
43 label
: editor
.lang
.horizontalrule
,