I am trying to write a custom function that replaces text in the document. The following code is supposed to replace highlighted text with the string 'xxx' but instead just inserts 'xxx' into the document. In other words, it is supposed to replace the selected text -- but instead just inserts before it.
Help! The pasteHtml method is doing an insert, rather than a replace.
Thank you,
Ken Williams
------
<!-- #include virtual = "/CuteEditor/include_CuteEditor.asp" -->
<html><body>
<script language="JavaScript" type="text/javascript" >
function Paste_Html(editorID,value)
{
EditorID = editorID+"_editBox";
var editor = document.getElementById(EditorID);
editor.focus();
//editor.document.selection.clear();
var sel = editor.document.selection.createRange();
// don't try to insert HTML into a control selection (ie. image or table)
if (editor.document.selection.type == 'Control') {
return;
}
sel.pasteHTML(value);
}
</script>
<%
Dim editor
Set editor = New CuteEditor
editor.ID = "Editor1"
editor.Text = "..." //feed the editor with data
editor.FilesPath = "/CuteEditor/CuteEditor_Files"
editor.ImageGalleryPath = "/Uploads"
editor.MaxImageSize = 50
editor.CustomAddons = "<span title=""Custom Addons"" class=""button"" onclick=""javascript:Paste_Html('Editor1','xxx');"" type=""btn"" border=""0""> Custom button </span>"
editor.Draw()
%>
</body></html>