Mimimum syndical pour en faire un produit zope / cmf.
[ckeditor.git] / skins / ckeditor / _source / plugins / horizontalrule / plugin.js
diff --git a/skins/ckeditor/_source/plugins/horizontalrule/plugin.js b/skins/ckeditor/_source/plugins/horizontalrule/plugin.js
new file mode 100644 (file)
index 0000000..3eac319
--- /dev/null
@@ -0,0 +1,48 @@
+/*\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+\r
+/**\r
+ * @file Horizontal Rule plugin.\r
+ */\r
+\r
+(function()\r
+{\r
+       var horizontalruleCmd =\r
+       {\r
+               canUndo : false,    // The undo snapshot will be handled by 'insertElement'.\r
+               exec : function( editor )\r
+               {\r
+                       var hr = editor.document.createElement( 'hr' ),\r
+                               range = new CKEDITOR.dom.range( editor.document );\r
+\r
+                       editor.insertElement( hr );\r
+\r
+                       // If there's nothing or a non-editable block followed by, establish a new paragraph\r
+                       // to make sure cursor is not trapped.\r
+                       range.moveToPosition( hr, CKEDITOR.POSITION_AFTER_END );\r
+                       var next = hr.getNext();\r
+                       if ( !next || next.type == CKEDITOR.NODE_ELEMENT && !next.isEditable() )\r
+                               range.fixBlock( true, editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p'  );\r
+\r
+                       range.select();\r
+               }\r
+       };\r
+\r
+       var pluginName = 'horizontalrule';\r
+\r
+       // Register a plugin named "horizontalrule".\r
+       CKEDITOR.plugins.add( pluginName,\r
+       {\r
+               init : function( editor )\r
+               {\r
+                       editor.addCommand( pluginName, horizontalruleCmd );\r
+                       editor.ui.addButton( 'HorizontalRule',\r
+                               {\r
+                                       label : editor.lang.horizontalrule,\r
+                                       command : pluginName\r
+                               });\r
+               }\r
+       });\r
+})();\r