RichTextEditor_OnLoader event automatically receives an asynchronous loader object. A loader is responsible for loading editor necessary libraries, layout information and asynchronously save data into cache. You can get _config object from the loader, so can execute custom actions to change the configuration.

Event Description
OnLoad This event is invoked immediately after the RichTextEditor is fully loaded.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config=loader._config;
	config.OnLoad=function(editor)
	{
	}
}
</script>
OnDispose This event occurs immediately when a RichTextEditor is removed successfully.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config=loader._config;
	config.OnDispose=function(editor)
	{
	}
}
</script>
OnTextChanged This event is raised if the content of RichTextEditor is changed.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config=loader._config;
	config.OnTextChanged=function(editor)
	{
	}
}
</script>
SelectionChanged This event is raised if the actual selection in the editor area changes.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config=loader._config;
	config.SelectionChanged=function(editor)
	{
	}
}
</script>
OnTabModeChanged This event is raised when switching between edit, code, and preview mode.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config=loader._config;
	config.OnTabModeChanged=function(editor)
	{
	}
}
</script>
OnUpdateUI This event is raised when the editor updates the user interface state.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config=loader._config;
	config.OnUpdateUI=function(editor)
	{
	}
}
</script>
OnPasteFilter This event is raised before the data is pasted into RichTextEditor. It allows you intercept the paste function and filter the content being pasted.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader) 
{
	var config = loader._config;
	config.OnPasteFilter = function (editor, info) 
	{
		var html = info.Arguments[0];
		var cmd = info.Arguments[1];
		//filter html here
		info.ReturnValue = html;
	}
}
</script>
OnInitEvent This event is raised after the iframe document of the editor is reset. You can use it to initialize the iframe document or attach events to the DOM in iframe.

Example:

<script type='text/javascript'>
var globaleditor = null;
function RichTextEditor_OnLoader(loader) 
{
	var config = loader._config;
	config.OnInitEvent = function (argeditor, argevent) 
	{
		globaleditor = argeditor;
		var win = argeditor.GetWindow();
		var doc = win.document;
		if (doc.addEventListener) 
		{
			doc.addEventListener("mouseover", editor_document_onmouseover, false);
			doc.addEventListener("mouseout", editor_document_onmouseout, false);
		}
		else 
		{
			doc.attachEvent("onmouseover", editor_document_onmouseover);
			doc.attachEvent("onmouseout", editor_document_onmouseout);
		}
	}
}

function editor_document_onmouseover(e) 
{
	if (!e) e = globaleditor.GetWindow().event;
	var domnode = e.target || e.srcElement;
	var rtenode = globaleditor.GetNodeFromDom(domnode);
	if (rtenode) rtenode.SetRuntimeAttribute("style", "text-decoration:underline", "mybehavior");
}
function editor_document_onmouseout(e) 
{
	if (!e) e = globaleditor.GetWindow().event;
	var domnode = e.target || e.srcElement;
	var rtenode = globaleditor.GetNodeFromDom(domnode);
	if (rtenode) rtenode.SetRuntimeAttribute("style", null, "mybehavior");
}
</script>
OnUninitEvent This event is raised before the iframe document of the editor is reset. You can use it to dispose all registered DOM elements before OnInitEvent occurs.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader) 
{
	var config = loader._config;	
	config.OnUninitEvent = function (argeditor, argevent) 
	{
		globaleditor = argeditor;
		var win = argeditor.GetWindow();
		var doc = win.document;
		if (doc.removeEventListener) 
		{
			doc.removeEventListener("mouseover", editor_document_onmouseover, false);
			doc.removeEventListener("mouseout", editor_document_onmouseout, false);
		}
		else
		{
			doc.detachEvent("onmouseover", editor_document_onmouseover);
			doc.detachEvent("onmouseout", editor_document_onmouseout);
		}
	}
}

function editor_document_onmouseover(e) 
{
	if (!e) e = globaleditor.GetWindow().event;
	var domnode = e.target || e.srcElement;
	var rtenode = globaleditor.GetNodeFromDom(domnode);
	if (rtenode) rtenode.SetRuntimeAttribute("style", "text-decoration:underline", "mybehavior");
}
function editor_document_onmouseout(e) 
{
	if (!e) e = globaleditor.GetWindow().event;
	var domnode = e.target || e.srcElement;
	var rtenode = globaleditor.GetNodeFromDom(domnode);
	if (rtenode) rtenode.SetRuntimeAttribute("style", null, "mybehavior");
}

</script>
OnPreCut This event is raised when starting to copy content in the editor. If ReturnValue=false, the action is canceled.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config = loader._config;
	config.OnPreCut = function (editor, info)
	{
		//set info.ReturnValue to false to cancel cut
		//info.ReturnValue = false;
	}
}
</script>
OnPreCopy This event is raised when starting to cut content in the editor. If ReturnValue=false, the action is canceled.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config = loader._config;
	config.OnPreCopy = function (editor, info) 
	{
		//set info.ReturnValue to false to cancel copy
		//info.ReturnValue = false;
	}
}
</script>
OnExecCommand This event is raised when ExecCommand is executed.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config = loader._config;
	config.OnExecCommand = function (editor, info) 
	{
		var commandname = info.Arguments[0];
	}
}
</script>
OnExecUICommand This event is raised when ExecUICommand is executed.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config = loader._config;
	config.OnExecUICommand = function (editor, info) 
	{
		var commandname = info.Arguments[1];
	}
}
</script>
OnFullScreenChanged This event is raised when switching to fullscreen mode.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader) 
{
	var config = loader._config;
	config.OnFullScreenChanged = function ()
	{
		
	}
}
</script>
OnFocus This event is raised when the editor receives focus.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config = loader._config;
	config.OnFocus = function () 
	{
	}
}
</script>
OnBlur This event is raised when the editor loses focus.

Example:

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader) 
{
	var config = loader._config;
	config.OnBlur = function () 
	{
	}
}
</script>

Send feedback about this topic to CuteSoft. © 2003 - 2014 CuteSoft Components Inc. All rights reserved.