Hi team,
Currently I'm working on a module where i need to capture the key press event in radeditor. That will be caught when I've clicked on spacebar. The internal script will capture the text in the editor and sends the text to the server side method i.e .cs method. On recieving the text I'll do some manipulations and return back a new text to the editor.
The above 2-way operation is working fine both getting text from rad editor and setting text to radeditor. But problem is that whenever I'm returning the text to editor the cursor position is always set to the start of the word instead of at the end of word.
For ex: If I return text as HELLO then the cursor should be placed after word (HELLO cursor) but the cursor is coming before the word(cursor HELLO).
Kindly give me a solution to my problem
I'm also pasting the script which I've used to get and set
getting value of editor:
function OnClientLoad(editor, args) {
editor.attachEventHandler("onkeydown", function (e) {
if (e.keyCode == 32) {
setTimeout(function () {
var v = $find("<%=Editor1.ClientID %>").get_text();
//alert(v);
document.getElementById('<%= HiddenField4.ClientID %>').value = v;
var s = document.getElementById('<%= HiddenField4.ClientID %>').value;
//alert(s);
CallServer(s, "");
}, 0);
}
});
Setting value to editor:
function ReceiveServerData(rValue) {
//var editor = ("<%=Editor1.ClientID%>");
$find("<%=Editor1.ClientID%>").set_html(" " + rValue + " ");
}
Currently I'm working on a module where i need to capture the key press event in radeditor. That will be caught when I've clicked on spacebar. The internal script will capture the text in the editor and sends the text to the server side method i.e .cs method. On recieving the text I'll do some manipulations and return back a new text to the editor.
The above 2-way operation is working fine both getting text from rad editor and setting text to radeditor. But problem is that whenever I'm returning the text to editor the cursor position is always set to the start of the word instead of at the end of word.
For ex: If I return text as HELLO then the cursor should be placed after word (HELLO cursor) but the cursor is coming before the word(cursor HELLO).
Kindly give me a solution to my problem
I'm also pasting the script which I've used to get and set
getting value of editor:
function OnClientLoad(editor, args) {
editor.attachEventHandler("onkeydown", function (e) {
if (e.keyCode == 32) {
setTimeout(function () {
var v = $find("<%=Editor1.ClientID %>").get_text();
//alert(v);
document.getElementById('<%= HiddenField4.ClientID %>').value = v;
var s = document.getElementById('<%= HiddenField4.ClientID %>').value;
//alert(s);
CallServer(s, "");
}, 0);
}
});
Setting value to editor:
function ReceiveServerData(rValue) {
//var editor = ("<%=Editor1.ClientID%>");
$find("<%=Editor1.ClientID%>").set_html(" " + rValue + " ");
}