#1934: Selection.EnsureSelection is broken for object selections
---------------------------+------------------------------------------------
Reporter: fredck | Owner: martinkou
Type: Bug | Status: assigned
Priority: Normal | Milestone: FCKeditor 2.6
Component: UI : Dialogs | Version: FCKeditor 2.6 Beta
Resolution: | Keywords: Confirmed IE Discussion
---------------------------+------------------------------------------------
Changes (by martinkou):
* keywords: Confirmed IE Review- => Confirmed IE Discussion
Comment:
I've done some more tests but now it seems the fix in fck_specialchar.html
doesn't make sense at all, nor is any Selection.ResetSelectionData()
needed. It seems adding an error check to EnsureSelection() is already
sufficient.
If you look at the sequence of events that happens when the special
character dialog is being closed, you'll see why the fix doesn't make
sense:
1. User chooses a special character.
1. EnsureSelection() is called to restore the selection in the editor
window. (note that the dialog layout is not closed at this time)
1. FCK.InsertHtml() is called to insert a special character, replacing
any selected content, and move the caret after the inserted character.
1. Cancel() in fckdialog.html is called.
1. CloseDialog() in fckdialog.html is called.
1. CloseDialog() calls Selection.EnsureSelection() to restore the
selection in the editor window.
The current issue is, step 6 may fail and prevent the dialog from being
closed. What happens if we just override the error (with a try{...}
catch(e){}) at step 6? There will be no error, and the selection position
after dialog closure would still be correct because step 3 has already
moved the caret to the correct position. Adding a reset selection step
(which saves the new selection position for the next EnsureSelection()
call) just before step 6 has no real effect because the caret position is
already at the correct place, and it assumes the caret is already at the
correct place - so why bother restoring something that's already correct?
I've tested with just the error override fix in EnsureSelection() with
other dialogs (e.g. button dialog, table dialog, image dialog, anchor
dialog, etc.) and they all worked perfectly without ResetSelectionData().
The only real use I can think of for ResetSelectionData() is when we have
a dialog which would do multiple modification to the editor document and
wishes to save one of the resulting selections for IE - but I don't think
there's such a case in our existing dialogs?
--
Ticket URL: <https://dev.fckeditor.net/ticket/1934#comment:5>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac