explorer sekection range problem

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.
 
D

David Mark

Hi at all

I have MSIE problem using seleection and text range

Don't feel bad. I recently finished work on a text range add-on for
My Library (for use with the upcoming editor) and it was a major pain
in the neck (and virtually all of the problems were due to IE).
First I have an internet web site studing an old dialect language.

You are a glutton for punishment. :)
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

Oh boy.
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;

Use contentDocument when available.
range=cDoc.selection.createRange();

range.text=str;

You know, I've never tried that. I guess I've always been preoccupied
with injecting HTML.
cDoc.selection.empty();

Odd choice after an insert.
cDoc.focus();

} else if (window.getSelection) {

cWin = document.getElementById(rteName).contentWindow;

This is an unnecessary repeat.
userSelection = cWin.getSelection();

userSelection=str;

Why did you bother to get the selection if you were just going to
throw it away?
cWin.document.execCommand('insertHTML',false,userSelection);

}
}

Character must be inserted at cursor position or they must replace a
selection text selected by the user.

That would be the norm.
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?

Focus the editor before insertion:-

cWin.focus();
You are more and more expert then me and I hope you'll help me in few
minutes.

You must be leading a charmed life. :)
Best regards and thank you in advance.

You are welcome and best of luck!
 
S

Steel

"David Mark" <[email protected]

wrote
Hi at all


Don't feel bad. I recently finished work on a text range add-on for
My Library (for use with the upcoming editor) and it was a major pain
in the neck (and virtually all of the problems were due to IE).
First I have an internet web site studing an old dialect language.

You are a glutton for punishment. :)
To do that I modify the
"FreeRichTextEditor"http://www.freerichtexteditor.com/adding a lot of
buttons

Oh boy.


Do you know an other editor most easy to modify, powerfull and with hidden
var ready to save?You are welcome and best of luck!

Good by
 
D

David Mark

Do you know an other editor most easy to modify, powerfull and with hidden
var ready to save?

I haven't looked at the one you are using, but most editors found on
the Web are pretty bad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top