S
Steel
Hi at all
I have MSIE problem using seleection and text range
First I have an internet web site studing an old dialect language.
To write properly our dialect we must use special ACCENTED characters like
üÜöôóòëêéè that are not into our keyboard .
To do that I modify the "FreeRichTextEditor"
http://www.freerichtexteditor.com/ adding a lot of buttons
Clicking one of these buttons I call this function:
function insert_accented_char(str)//str parameter is the accented character
that I want to insert
{
if(document.selection){
cDoc = document.getElementById(rteName).contentWindow.document;
range=cDoc.selection.createRange();
range.text=str;
cDoc.selection.empty();
cDoc.focus();
} else if (window.getSelection) {
cWin = document.getElementById(rteName).contentWindow;
userSelection = cWin.getSelection();
userSelection=str;
cWin.document.execCommand('insertHTML',false,userSelection);
}
}
Character must be inserted at cursor position or they must replace a
selection text selected by the user.
FireFox, opera and safari work properly but MSIE (8) replace best a
selection range of text but if text is not selected it do not insert
character at cursor position but it insert them into the calling button
(that user clicked)
How can I solve problem?
You are more and more expert then me and I hope you'll help me in few
minutes.
Best regards and thank you in advance.
I have MSIE problem using seleection and text range
First I have an internet web site studing an old dialect language.
To write properly our dialect we must use special ACCENTED characters like
üÜöôóòëêéè that are not into our keyboard .
To do that I modify the "FreeRichTextEditor"
http://www.freerichtexteditor.com/ adding a lot of buttons
Clicking one of these buttons I call this function:
function insert_accented_char(str)//str parameter is the accented character
that I want to insert
{
if(document.selection){
cDoc = document.getElementById(rteName).contentWindow.document;
range=cDoc.selection.createRange();
range.text=str;
cDoc.selection.empty();
cDoc.focus();
} else if (window.getSelection) {
cWin = document.getElementById(rteName).contentWindow;
userSelection = cWin.getSelection();
userSelection=str;
cWin.document.execCommand('insertHTML',false,userSelection);
}
}
Character must be inserted at cursor position or they must replace a
selection text selected by the user.
FireFox, opera and safari work properly but MSIE (8) replace best a
selection range of text but if text is not selected it do not insert
character at cursor position but it insert them into the calling button
(that user clicked)
How can I solve problem?
You are more and more expert then me and I hope you'll help me in few
minutes.
Best regards and thank you in advance.