source: trunk/admin/inc/ckeditor/_source/plugins/horizontalrule/plugin.js@ 239

Last change on this file since 239 was 239, checked in by luc, 9 years ago

Admin: correzione visulaizzazione immissione dati spoglio per Chrome e Safari - Aggiornamento dell'editor da FCKeditor a CKeditor , accessibili anche a Chrome e Safari.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1/*
2Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3For licensing, see LICENSE.html or http://ckeditor.com/license
4*/
5
6/**
7 * @file Horizontal Rule plugin.
8 */
9
10(function()
11{
12 var horizontalruleCmd =
13 {
14 canUndo : false, // The undo snapshot will be handled by 'insertElement'.
15 exec : function( editor )
16 {
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();
30 }
31 };
32
33 var pluginName = 'horizontalrule';
34
35 // Register a plugin named "horizontalrule".
36 CKEDITOR.plugins.add( pluginName,
37 {
38 init : function( editor )
39 {
40 editor.addCommand( pluginName, horizontalruleCmd );
41 editor.ui.addButton( 'HorizontalRule',
42 {
43 label : editor.lang.horizontalrule,
44 command : pluginName
45 });
46 }
47 });
48})();
Note: See TracBrowser for help on using the repository browser.