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