plugin.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 Print Plugin
  7. */
  8. CKEDITOR.plugins.add( 'print', {
  9. // jscs:disable maximumLineLength
  10. 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%
  11. // jscs:enable maximumLineLength
  12. icons: 'print,', // %REMOVE_LINE_CORE%
  13. hidpi: true, // %REMOVE_LINE_CORE%
  14. init: function( editor ) {
  15. // Print plugin isn't available in inline mode yet.
  16. if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE )
  17. return;
  18. var pluginName = 'print';
  19. // Register the command.
  20. editor.addCommand( pluginName, CKEDITOR.plugins.print );
  21. // Register the toolbar button.
  22. editor.ui.addButton && editor.ui.addButton( 'Print', {
  23. label: editor.lang.print.toolbar,
  24. command: pluginName,
  25. toolbar: 'document,50'
  26. } );
  27. }
  28. } );
  29. CKEDITOR.plugins.print = {
  30. exec: function( editor ) {
  31. if ( CKEDITOR.env.gecko ) {
  32. editor.window.$.print();
  33. } else {
  34. editor.document.$.execCommand( 'Print' );
  35. }
  36. },
  37. canUndo: false,
  38. readOnly: 1,
  39. modes: { wysiwyg: 1 }
  40. };