P
pbreah
I'm doing a Rich Text Editor (WYSIWYG) in javascript for a game for
kids. I'm doing a special case in with every keystroke from A-Z creates
a background and foreground color for that letter, witch is the same.
The problem is editing doesn't work that well.
For example when I type: ABCDFG , I get this code generated and
displayed by the Rich Text Editor:
<P><FONT style="BACKGROUND-COLOR: #ffff00" color=#ffff00>a<FONT
style="BACKGROUND-COLOR: #3399cc" color=#3399cc>b<FONT
style="BACKGROUND-COLOR: #ffccff" color=#ffccff>c<FONT
style="BACKGROUND-COLOR: #cccccc" color=#cccccc>d<FONT
style="BACKGROUND-COLOR: #ffcc99" color=#ffcc99>f<FONT
style="BACKGROUND-COLOR: #d21894"
color=#d21894>g</FONT></FONT></FONT></FONT></FONT></FONT></P>
The markup looks ugly but it works.
If I put my cursor between the "D" and "F", for example, and try to
insert the letter "E" I get this code:
<P><FONT style="BACKGROUND-COLOR: #ff9900"
color=#ff9900>abcdefg</FONT></P>
I just want the letter "E" inserted in its own tag without overwriting
the other letters. The whole line ends with the color of "E". :-(
By the way, I'm using execCommand wih IE6 sp2. If you think or know a
better way of solving this without execCommand or anything, please help
:~(
Any ideas, suggestions, code samples?
Thank you...
kids. I'm doing a special case in with every keystroke from A-Z creates
a background and foreground color for that letter, witch is the same.
The problem is editing doesn't work that well.
For example when I type: ABCDFG , I get this code generated and
displayed by the Rich Text Editor:
<P><FONT style="BACKGROUND-COLOR: #ffff00" color=#ffff00>a<FONT
style="BACKGROUND-COLOR: #3399cc" color=#3399cc>b<FONT
style="BACKGROUND-COLOR: #ffccff" color=#ffccff>c<FONT
style="BACKGROUND-COLOR: #cccccc" color=#cccccc>d<FONT
style="BACKGROUND-COLOR: #ffcc99" color=#ffcc99>f<FONT
style="BACKGROUND-COLOR: #d21894"
color=#d21894>g</FONT></FONT></FONT></FONT></FONT></FONT></P>
The markup looks ugly but it works.
If I put my cursor between the "D" and "F", for example, and try to
insert the letter "E" I get this code:
<P><FONT style="BACKGROUND-COLOR: #ff9900"
color=#ff9900>abcdefg</FONT></P>
I just want the letter "E" inserted in its own tag without overwriting
the other letters. The whole line ends with the color of "E". :-(
By the way, I'm using execCommand wih IE6 sp2. If you think or know a
better way of solving this without execCommand or anything, please help
:~(
Any ideas, suggestions, code samples?
Thank you...