JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0
[ckeditor.git] / _source / plugins / newpage / plugin.js
diff --git a/_source/plugins/newpage/plugin.js b/_source/plugins/newpage/plugin.js
new file mode 100644 (file)
index 0000000..2c76877
--- /dev/null
@@ -0,0 +1,65 @@
+/*\r
+Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+\r
+/**\r
+ * @file Horizontal Page Break\r
+ */\r
+\r
+// Register a plugin named "newpage".\r
+CKEDITOR.plugins.add( 'newpage',\r
+{\r
+       init : function( editor )\r
+       {\r
+               editor.addCommand( 'newpage',\r
+                       {\r
+                               modes : { wysiwyg:1, source:1 },\r
+\r
+                               exec : function( editor )\r
+                               {\r
+                                       var command = this;\r
+                                       function afterCommand()\r
+                                       {\r
+                                               // Defer to happen after 'selectionChange'.\r
+                                               setTimeout( function()\r
+                                               {\r
+                                                       editor.fire( 'afterCommandExec',\r
+                                                       {\r
+                                                               name: command.name,\r
+                                                               command: command\r
+                                                       } );\r
+                                               }, 500 );\r
+                                       }\r
+                                       if ( editor.mode == 'wysiwyg')\r
+                                               editor.on( 'contentDom', function( evt ){\r
+\r
+                                                       evt.removeListener();\r
+                               afterCommand();\r
+                                               } );\r
+\r
+                                       editor.setData( editor.config.newpage_html );\r
+                                       editor.focus();\r
+\r
+                                       if( editor.mode == 'source' )\r
+                                               afterCommand();\r
+\r
+                               },\r
+                               async : true\r
+                       });\r
+\r
+               editor.ui.addButton( 'NewPage',\r
+                       {\r
+                               label : editor.lang.newPage,\r
+                               command : 'newpage'\r
+                       });\r
+       }\r
+});\r
+/**\r
+ * The HTML to load in the editor when the "new page" command is executed.\r
+ * @type String\r
+ * @default ''\r
+ * @example\r
+ * config.newpage_html = '<p>Type your text here.</p>';\r
+ */\r
+CKEDITOR.config.newpage_html = '';\r