Thursday, May 3, 2012

Salesforce Rich Text Editor – Adding Full Mode Features

I ran across Dan Peter's blog  when I was trying expand on the Salesforce Rich Text Field WYSIWYG and I noticed that if you use firebug and look at the iframe used for the WYSIWYG editor there is a parameter in the url, "&Toolbar=SalesforceBasic" that if you REMOVE it, it will unleash additional functionality from the CKeditor. (see image)

I created some javascript that will do this automaticaly and the only thing you have to do is replace the iframe id i used, "textAreaDelegate_Content__c___Frame" with your iFrame id.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
   <script>
    //Removing the &Toolbar=SalesforceBasic url parameter from the iFrame Source  
    $(document).ready(function(){  
     var richtextid = '[id$=textAreaDelegate_Content__c___Frame]';  
     var iframesrc = jQuery(richtextid).attr("src").replace('&Toolbar=SalesforceBasic','');  
     jQuery(richtextid).attr("src",iframesrc);  
    });  
</script>  

Note : "textAreaDelegate_Content__c___Frame" - view source code and change corresponding "rich text field ID".
for Ex: richText ID - 00NW0000000KgEPMA0 then replace like '00NW0000000KgEPMA0___Frame'
its achieve in the standard pages new/edit alone, so that add above code into Home page component and provide the access to corresponding profile and check it. 
its working for me :)

No comments:

Post a Comment