diff options
Diffstat (limited to 'sources/plugins/newpage/plugin.js')
-rw-r--r-- | sources/plugins/newpage/plugin.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sources/plugins/newpage/plugin.js b/sources/plugins/newpage/plugin.js new file mode 100644 index 00000000..3a4e3e33 --- /dev/null +++ b/sources/plugins/newpage/plugin.js | |||
@@ -0,0 +1,53 @@ | |||
1 | /** | ||
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | ||
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | ||
4 | */ | ||
5 | |||
6 | /** | ||
7 | * @fileOverview Horizontal Page Break. | ||
8 | */ | ||
9 | |||
10 | // Register a plugin named "newpage". | ||
11 | CKEDITOR.plugins.add( 'newpage', { | ||
12 | // jscs:disable maximumLineLength | ||
13 | lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE% | ||
14 | // jscs:enable maximumLineLength | ||
15 | icons: 'newpage,newpage-rtl', // %REMOVE_LINE_CORE% | ||
16 | hidpi: true, // %REMOVE_LINE_CORE% | ||
17 | init: function( editor ) { | ||
18 | editor.addCommand( 'newpage', { modes: { wysiwyg: 1, source: 1 }, | ||
19 | |||
20 | exec: function( editor ) { | ||
21 | var command = this; | ||
22 | editor.setData( editor.config.newpage_html || '', function() { | ||
23 | editor.focus(); | ||
24 | // Save the undo snapshot after all document changes are affected. (#4889) | ||
25 | setTimeout( function() { | ||
26 | editor.fire( 'afterCommandExec', { | ||
27 | name: 'newpage', | ||
28 | command: command | ||
29 | } ); | ||
30 | editor.selectionChange(); | ||
31 | |||
32 | }, 200 ); | ||
33 | } ); | ||
34 | }, | ||
35 | async: true | ||
36 | } ); | ||
37 | |||
38 | editor.ui.addButton && editor.ui.addButton( 'NewPage', { | ||
39 | label: editor.lang.newpage.toolbar, | ||
40 | command: 'newpage', | ||
41 | toolbar: 'document,20' | ||
42 | } ); | ||
43 | } | ||
44 | } ); | ||
45 | |||
46 | /** | ||
47 | * The HTML to load in the editor when the "new page" command is executed. | ||
48 | * | ||
49 | * config.newpage_html = '<p>Type your text here.</p>'; | ||
50 | * | ||
51 | * @cfg {String} [newpage_html=''] | ||
52 | * @member CKEDITOR.config | ||
53 | */ | ||