1 /* 2 * CKEditor - The text editor for Internet - http://ckeditor.com 3 * Copyright (C) 2003-2008 Frederico Caldeira Knabben 4 * 5 * == BEGIN LICENSE == 6 * 7 * Licensed under the terms of any of the following licenses at your 8 * choice: 9 * 10 * - GNU General Public License Version 2 or later (the "GPL") 11 * http://www.gnu.org/licenses/gpl.html 12 * 13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 14 * http://www.gnu.org/licenses/lgpl.html 15 * 16 * - Mozilla Public License Version 1.1 or later (the "MPL") 17 * http://www.mozilla.org/MPL/MPL-1.1.html 18 * 19 * == END LICENSE == 20 */ 21 22 CKEDITOR.plugins.add( 'basicstyles', 23 { 24 init : function( editor, pluginPath ) 25 { 26 var basicstyles = CKEDITOR.plugins.basicstyles, 27 commands = basicstyles.commands, 28 ui = basicstyles.ui; 29 30 editor.addCommand( 'bold', commands.bold ); 31 editor.addCommand( 'italic', commands.italic ); 32 33 editor.ui.addButton( 'Bold', ui.bold ); 34 editor.ui.addButton( 'Italic', ui.italic ); 35 } 36 }); 37 38 CKEDITOR.plugins.basicstyles = 39 { 40 commands : 41 { 42 bold : 43 { 44 exec : function( editor ) 45 { 46 editor.focus(); 47 48 var doc = editor.document; 49 if ( doc ) 50 return doc.$.execCommand( 'bold', false, null ); 51 return false; 52 } 53 }, 54 55 italic : 56 { 57 exec : function( editor ) 58 { 59 editor.focus(); 60 61 var doc = editor.document; 62 if ( doc ) 63 return doc.$.execCommand( 'italic', false, null ); 64 return false; 65 } 66 } 67 }, 68 69 ui : 70 { 71 bold : 72 { 73 label : 'Bold', 74 command : 'bold' 75 }, 76 77 italic : 78 { 79 label : 'Italic', 80 command : 'italic' 81 } 82 } 83 }; 84