1 <apex:component> 2 <apex:attribute name="accountId" type="string" description="passed account id"/> 3 <script src="{!URLFOR($Resource.ckeditor,'ckeditor/jquery-1.4.2.min.js')}"></script> 4 <script> 5 //Event Handler for ShowContacts button 6 //Fetch and prepares the contact table in editor 7 function showContacts(){ 8 // invoke your sfdc method here 9 } 10 11 //Event Handler for ShowOpportunities button 12 //Fetch and show the opportunities in RTE 13 function showOpportunities(){ 14 // invoke your sfdc method here 15 } 16 17 /**** 18 Custom buttons configuration 19 Provide name, label, command (js function), and Image for the button 20 */ 21 var config = { 22 "Buttons": [ 23 { 24 "Name" : "Contacts", 25 "Label" : "Show Contacts", 26 "Command": "showContacts", 27 "Image": "{!URLFOR($Resource.ckeditor,'ckeditor/plugins/timestamp/images/16-cube-green.png')}" 28 }, 29 {"Name" : "Opportunities", 30 "Label" : "Show Opportunities", 31 "Command": "showOpportunities", 32 "Image": "{!URLFOR($Resource.ckeditor,'ckeditor/plugins/timestamp/images/contact.png')}" 33 } 34 ] 35 } 36 37 38 function initialize(){ 39 for(var i=0; i<config.Buttons.length;i++){ 40 addButton(config.Buttons[i].Name, 41 config.Buttons[i].Image, 42 config.Buttons[i].Command, 43 config.Buttons[i].Label); 44 } 45 } 46 function addButton(name,image,command,label){ 47 $('#cke_21').append('<span class="cke_toolbar_start"></span>'+ 48 '<span role="presentation" class="cke_toolgroup">'+ 49 '<span class="cke_button">'+ 50 '<a onclick="'+command+'();" onblur="this.style.cssText = this.style.cssText;" role="button" hidefocus="true" title="'+label+'" class="cke_button_outdent cke_disabled" id="'+name+'" aria-disabled="true">'+ 51 '<span class="cke_icon" style="background-image:url('+image+');background-position:center;">&nbsp;</span>'+ 52 '<span class="cke_label" id="'+name+'">'+label+'</span>'+ 53 '</a>'+ 54 '</span>'+ 55 '</span>'+ 56 '<span class="cke_toolbar_end"></span>' 57 ); 58 } 59 60 61 var defaultFunc = window.onload; 62 window.onload = function() { 63 if(defaultFunc) 64 defaultFunc (); 65 setTimeout("initialize()",1000); 66 } 67 </script> 68 </apex:component>