Hi Ken,
I don't know what is changed in the version I have downloaded now. But my previous code has stopped working after it.
I am storing the position's of cute editor as I am inserting the HTML on button click. And also in the example the code does not work the first time the window is opened.Later on when the window is open, and I put my cursor there in the editor then it is pasted correctly.But in my real applucation that POPUp is modal popup and there will be no orpion user can add cursor at that time after the pop up is open.
Hope I am able to explain my problem. Right now I have changed my storing the cursor postion function to as below:
function storeSelection() {
var editor1 = EditorArea;
var editdoc = editor1.GetDocument();
var range = editdoc.selection.createRange();
var pos = document.selection.createRange();
if (editdoc.selection.type == 'Control') {
var element = range.item(0);
if (element.tagName.toString().toLowerCase() == 'input') {
window.range = pos;
}
else {
window.range = range;
}
}
else if (editdoc.selection.type == 'None') {
window.range = pos;
}
else {
window.range = range;
}
}
Which previously was something like this:
getSelection = function() {
var c = document.getElementById(EmailVariables.Editor1);
if (c) {
return c.GetSelection();
}
}
createRange = function() {
var selection = getSelection();
if (selection) {
if (selection.createRange) {
return selection.createRange();
}
if (selection.rangeCount && selection.getRangeAt) {
return selection.getRangeAt(0);
}
}
return null;
}
select = function(range) {
if (range.select) {
if (range.select() != undefined) {
range.select();
}
}
else {
var selection = getSelection();
if (selection.removeAllRanges && selection.addRange) {
selection.removeAllRanges();
selection.addRange(range);
}
}
}
restoreSelection = function() {
try {
if (window.range)
select(window.range);
} catch (e) { }
}
storeSelection = function() {
window.range = createRange();
}
Thanks and Regards
Yuvika