Comment #55 on issue 395318 by
pouli...@gmail.com: HtmlEditorExtender in
I have a workaround, use the function wrote up but in another function,
like this :
function PatchHtmlEditor()
{
if (Sys.Extended && Sys.Extended.UI &&
Sys.Extended.UI.HtmlEditorExtenderBehavior &&
Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype &&
Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype._editableDiv_submit)
{
Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype._editableDiv_submit
= function ()
{
//html encode
var char = 3;
var sel = null;
setTimeout(function ()
{
if (this._editableDiv != null)
this._editableDiv.focus();
}, 0);
if (Sys.Browser.agent != Sys.Browser.Firefox)
{
if (document.selection)
{
sel = document.selection.createRange();
sel.moveStart('character', char);
sel.select();
}
else
{
if (this._editableDiv.firstChild != null &&
this._editableDiv.firstChild != undefined)
{
sel = window.getSelection();
sel.collapse(this._editableDiv.firstChild, char);
}
}
}
//Encode html tags
this._textbox._element.value = this._encodeHtml();
}
}
}
In the onload of the page call that function with a RegisterStartupScript
with Page.ClientScript or ScriptManager if it is in callback. In my project
I added that function to my BasePage to help me to register the script in
the good context:
public void RegisterStartupScript(Control control, Type type, string key,
string script, bool addScriptTags)
{
if (_currentScriptManager != null)
ScriptManager.RegisterStartupScript(control, type, key,
script, addScriptTags);
else
this.ClientScript.RegisterStartupScript(type, key, script,
addScriptTags);