Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Adding Javascript Rich Text editor to CRM 2011

$
0
0

Hi All,

I am trying to use YUI Simple Text editor on a textarea. I am using following code for same

function createEditor(nameOfField){
	$("<link/>", {
	   rel: "stylesheet",
	   type: "text/css",
	   href: "https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/fonts/fonts-min.css"
	}).appendTo("head");
	$("<link/>", {
	   rel: "stylesheet",
	   type: "text/css",
	   href: "https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/editor/assets/skins/sam/simpleeditor.css"
	}).appendTo("head");
	$.getScript('https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js', function(){
		$.getScript('https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/element/element-min.js', function(){
			$.getScript('https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/container/container_core-min.js', function() {
				$.getScript('https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/editor/simpleeditor-min.js', function (){
					onReadyOfDocument();
				});
			});
		});
	});

	function onReadyOfDocument() {
		$('#'+nameOfField).parent().addClass('yui-skin-sam');
		var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event;

		var myConfig = {
			height: '100%',
			width: '100%',
			dompath: true,
			focusAtStart: true
		};

		var myEditor = new YAHOO.widget.SimpleEditor(nameOfField, myConfig);
		myEditor.render();
	}
}
createEditor('TextareaIDgoesHere');

The above code works fine if I add it to a HTML with a textbox in it and Jquery-min included in the page.  But when I add it to a CRM 2011 page it executes without any problem but then Rich text editor is never displayed.

I am not sure if I am missing something here?


-Devashish
http://thecrmworld.wordpress.com
http://ebizartisans.com


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>