plugin.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 Rule plugin.
  7. */
  8. ( function() {
  9. var horizontalruleCmd = {
  10. canUndo: false, // The undo snapshot will be handled by 'insertElement'.
  11. exec: function( editor ) {
  12. var hr = editor.document.createElement( 'hr' );
  13. editor.insertElement( hr );
  14. },
  15. allowedContent: 'hr',
  16. requiredContent: 'hr'
  17. };
  18. var pluginName = 'horizontalrule';
  19. // Register a plugin named "horizontalrule".
  20. CKEDITOR.plugins.add( pluginName, {
  21. // jscs:disable maximumLineLength
  22. 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%
  23. // jscs:enable maximumLineLength
  24. icons: 'horizontalrule', // %REMOVE_LINE_CORE%
  25. hidpi: true, // %REMOVE_LINE_CORE%
  26. init: function( editor ) {
  27. if ( editor.blockless )
  28. return;
  29. editor.addCommand( pluginName, horizontalruleCmd );
  30. editor.ui.addButton && editor.ui.addButton( 'HorizontalRule', {
  31. label: editor.lang.horizontalrule.toolbar,
  32. command: pluginName,
  33. toolbar: 'insert,11'
  34. } );
  35. }
  36. } );
  37. } )();