JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.1
[ckeditor.git] / _source / plugins / newpage / plugin.js
1 /*\r
2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 /**\r
7  * @file Horizontal Page Break\r
8  */\r
9 \r
10 // Register a plugin named "newpage".\r
11 CKEDITOR.plugins.add( 'newpage',\r
12 {\r
13         init : function( editor )\r
14         {\r
15                 editor.addCommand( 'newpage',\r
16                         {\r
17                                 modes : { wysiwyg:1, source:1 },\r
18 \r
19                                 exec : function( editor )\r
20                                 {\r
21                                         var command = this;\r
22                                         editor.setData( editor.config.newpage_html, function()\r
23                                         {\r
24                                                 // Save the undo snapshot after all document changes are affected. (#4889)\r
25                                                 setTimeout( function ()\r
26                                                 {\r
27                                                         editor.fire( 'afterCommandExec',\r
28                                                         {\r
29                                                                 name: command.name,\r
30                                                                 command: command\r
31                                                         } );\r
32 \r
33                                                 }, 200 );\r
34                                         } );\r
35                                         editor.focus();\r
36                                 },\r
37                                 async : true\r
38                         });\r
39 \r
40                 editor.ui.addButton( 'NewPage',\r
41                         {\r
42                                 label : editor.lang.newPage,\r
43                                 command : 'newpage'\r
44                         });\r
45         }\r
46 });\r
47 /**\r
48  * The HTML to load in the editor when the "new page" command is executed.\r
49  * @type String\r
50  * @default ''\r
51  * @example\r
52  * config.newpage_html = '<p>Type your text here.</p>';\r
53  */\r
54 CKEDITOR.config.newpage_html = '';\r