JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
12de07d2d691715dc0c0eb2939f54b475e5f9e09
[ckeditor.git] / _source / plugins / newpage / plugin.js
1 /*\r
2 Copyright (c) 2003-2011, 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                                                         editor.selectionChange();\r
33 \r
34                                                 }, 200 );\r
35                                         } );\r
36                                         editor.focus();\r
37                                 },\r
38                                 async : true\r
39                         });\r
40 \r
41                 editor.ui.addButton( 'NewPage',\r
42                         {\r
43                                 label : editor.lang.newPage,\r
44                                 command : 'newpage'\r
45                         });\r
46         }\r
47 });\r
48 /**\r
49  * The HTML to load in the editor when the "new page" command is executed.\r
50  * @type String\r
51  * @default ''\r
52  * @example\r
53  * config.newpage_html = '<p>Type your text here.</p>';\r
54  */\r