Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: Moving the editor in the DOM
Re: Moving the editor in the DOM
06-17-2009, 8:48 PM
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: Moving the editor in the DOM
Reply
Quote
Hi
Megabeans
,
Try this way
<%@ Page Language=
"C#"
%>
<%@ Register TagPrefix=
"CE"
Namespace=
"CuteEditor"
Assembly=
"CuteEditor"
%>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<script runat=
"server"
>
</script>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head runat=
"server"
>
<title>Untitled Page</title>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<div>
<div id=
"placeholder1"
onclick=
"edit('placeholder1')"
>
editable content 1</div>
<div id=
"placeholder2"
onclick=
"edit('placeholder2')"
>
editable content 2</div>
<CE:Editor ID=
"ceDynamic"
runat=
"server"
EnableStripScriptTags=
"false"
Style=
"visibility: hidden"
/>
</div>
</form>
</body>
</html>
<script>
function edit(instance)
{
var placeholder = document.getElementById(instance);
//cache content
var cache = placeholder.innerHTML;
//clear element
placeholder.innerHTML =
''
;
var dynEdit = document.getElementById(
'<%= ceDynamic.ClientID %>'
);
dynEdit.style.visibility=
"visible"
;
//append the text editor instance to the cleared placeholder !!! This seems to remove the event handlers !!!
placeholder.appendChild(dynEdit);
//set the text of the cuteeditor to the snapshot we took earlier
dynEdit.setHTML(cache);
//set focus to the cuteeditor control
dynEdit.FocusDocument();
}
</script>
Regards,
Ken
View Complete Thread