Report abuse

/*
	Implements tinyMCE for available textareas. The tinyMCE.init call can be
	extended with further buttons/configuration options. For details, see:

	http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
*/

function stripHTML(s) {
	var re= /<\S[^>]*>/g; 
	s = s.replace(re,""); 
	return s;
}

tinyMCE.init({
	cleanup_on_startup			   : true,
	inline_styles				   : false,
	mode                           : "textareas",
	theme                          : "advanced",
	editor_selector                : "tinymce",
	theme_advanced_toolbar_location: "top",
	theme_advanced_toolbar_align   : "left",
	theme_advanced_buttons1        : "bold,italic,|,bullist,|,link,unlink,|,cleanup",
	theme_advanced_buttons2        : "",
	theme_advanced_buttons3        : "",
	entities                       : "",
	setup						   : function(ed){
		ed.onPaste.add(function(ed, e, o){
            ed.selection.setContent(stripHTML(o.text));
            ed.setContent(ed.getContent());

			// ed.execCommand('mcePasteText', true);
			// return tinymce.dom.Event.cancel(e);
		});
	}
});

/*
	DOM.Event.addListener(window, "load", function() {
		DOM.select("div[class^=mceeditor]").forEach(function(div) {
			div.style.marginTop = "2px"; // Fix styles
		});
	});
*/