1 /* 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 /** 7 * @file Print Plugin 8 */ 9 10 CKEDITOR.plugins.add( 'print', 11 { 12 init : function( editor ) 13 { 14 var pluginName = 'print'; 15 16 // Register the command. 17 var command = editor.addCommand( pluginName, CKEDITOR.plugins.print ); 18 19 // It is imposible to print the inner document in Opera. 20 if ( CKEDITOR.env.opera ) 21 command.state = CKEDITOR.TRISTATE_DISABLED; 22 23 // Register the toolbar button. 24 editor.ui.addButton( 'Print', 25 { 26 label : editor.lang.print, 27 command : pluginName 28 }); 29 } 30 } ); 31 32 CKEDITOR.plugins.print = 33 { 34 exec : function( editor ) 35 { 36 if ( CKEDITOR.env.opera ) 37 return; 38 else if ( CKEDITOR.env.gecko ) 39 editor.window.$.print(); 40 else 41 editor.document.$.execCommand( "Print" ); 42 } 43 }; 44