plugin.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. * @fileOverview Horizontal Page Break.
  7. */
  8. // Register a plugin named "newpage".
  9. CKEDITOR.plugins.add( 'newpage', {
  10. // jscs:disable maximumLineLength
  11. 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%
  12. // jscs:enable maximumLineLength
  13. icons: 'newpage,newpage-rtl', // %REMOVE_LINE_CORE%
  14. hidpi: true, // %REMOVE_LINE_CORE%
  15. init: function( editor ) {
  16. editor.addCommand( 'newpage', { modes: { wysiwyg: 1, source: 1 },
  17. exec: function( editor ) {
  18. var command = this;
  19. editor.setData( editor.config.newpage_html || '', function() {
  20. editor.focus();
  21. // Save the undo snapshot after all document changes are affected. (#4889)
  22. setTimeout( function() {
  23. editor.fire( 'afterCommandExec', {
  24. name: 'newpage',
  25. command: command
  26. } );
  27. editor.selectionChange();
  28. }, 200 );
  29. } );
  30. },
  31. async: true
  32. } );
  33. editor.ui.addButton && editor.ui.addButton( 'NewPage', {
  34. label: editor.lang.newpage.toolbar,
  35. command: 'newpage',
  36. toolbar: 'document,20'
  37. } );
  38. }
  39. } );
  40. /**
  41. * The HTML to load in the editor when the "new page" command is executed.
  42. *
  43. * config.newpage_html = '<p>Type your text here.</p>';
  44. *
  45. * @cfg {String} [newpage_html='']
  46. * @member CKEDITOR.config
  47. */