I have the following Editor declaration:
<ce:editor ID="Editor" Runat="server"
AutoConfigure="Full"
AutoParseClasses="true"
BorderWidth="0"
DisableAutoFormatting="false"
EnableStripScriptTags="false"
FilesPath="/sitecore/Shell/Editor"
Focus="false"
FrameStyle="margin:0"
Height="100%"
ShowDecreaseButton="false"
ShowEnlargeButton="false"
ThemeType="Office2003"
Width="100%"
UseRelativeLinks="true"
UseSimpleAmpersand="true">
</ce:editor>
When I try to get a selected text via JScript code:
var editor1 = document.getElementById('CE_Editor_ID');
var editselection=editor1.GetSelection();
if(editselection.rangeCount > 0)
{
var r=sel.getRangeAt(0);
var clonedSelection = r.cloneContents();
var div = document.createElement('div');
div.appendChild(clonedSelection);
r.collapse(true);
alert(div.innerHTML);
}
I can not get property editselection.rangeCount worked. It looks like this property does not exist. Where I was wrong?
How can I get a selected HTML text and replace it with my own?