Feb 20, 2005, 8:51 PM
Post #1 of 1
I am now modifying htmlarea for our CMS. I found and fix a lot of bugs (some fix I have already posted here - some I will post later - for verifying it).
[BUG CVS] Strange bug with (Control) range
Yesterday I found very strange bug(s) (IE), but I dont know how to fix it. So, I will try you introduce it and I hope someone can help me :)
So, most of us hear about following bug (already fixed in forum): When you try to make a link on image an error accur. There was issue with checking sel.type == Control/Text.
Bug I am now trying introduce is also problem with "Control" and "Text" element.
So now, I will try to explain it really :)
1) Open IE and get htmlrea :)
2) Insert some image
3) Click on Image
4) Insert charater from CharacterMap or try InsertTable (Insert horizontal rule is working right because is using special execCommand)
5) An error accur :)
I analyze the code and I discovered (I hope), that there is a problem in _createRange method, because when image (or other "Control" element) is selected, than is created not textRange but ControlRange (see MSDN http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/createrange.asp)
And here is a problem - ControlRange has not same method as textRange - there is missing pasteHTML (and htmlText) method - and this is the problem.
1) Try "convert" ControlRange to textRange or get range another way, how?
2) Add some try/catch statement?
3) Highlight image similar as text - not by clicking on it (its not friedly for users :) )
4) Try using updateToolbar method when selection is changed and disable the buttons which cause this error (InsertImage, Table, CharMap etc) - its not great solution :)
5) Any other solution(s)? Post it :) !
In Gecko is all working right (the code is different). Thanks for any headups or solutions.
(This post was edited by iRAY on Feb 21, 2005, 7:05 AM)