Opened 16 years ago

Closed 16 years ago

#2071 closed Bug (invalid)

FCK.EditorDocument.selection.createRange().text does not return selected text

Reported by: Bert Hankes Owned by:
Priority: Normal Milestone: FCKeditor 2.6.3
Component: General Version: FCKeditor 2.6.2
Keywords: Pending Cc: Exception, e

Description

I made a few plugins that make use of the functionality to read the current selection with FCK.EditorDocument.selection.createRange().text In FCKeditor 2.5.1 (and backwards) it is working. in FCKeditor 2.6RC I noticed that it is not working anymore. The object 'FCK.EditorDocument.selection' is created but createRange().text does not return the selected text (empty).

The browser involved is IE 6 and 7

Change History (8)

comment:1 Changed 16 years ago by Bert Hankes

Sorry about the Miltestone/version/keywords in het ticket.

I made a few plugins that make use of the functionality to read the current selection with FCK.EditorDocument.selection.createRange().text In FCKeditor 2.5.1 (and backwards) it is working. in FCKeditor 2.6RC I noticed that it is not working anymore. The object 'FCK.EditorDocument.selection' is created but createRange().text does not return the selected text (empty). I also checked the 18555 (nightly build) and the problem still exists.

comment:2 Changed 16 years ago by Bert Hankes

Sorry about the Miltestone/version/keywords in het ticket.

I made a few plugins that make use of the functionality to read the current selection with FCK.EditorDocument.selection.createRange().text In FCKeditor 2.5.1 (and backwards) it is working. in FCKeditor 2.6RC I noticed that it is not working anymore.
The object 'FCK.EditorDocument.selection' is created but createRange().text does not return the selected text (empty).

I also checked the 18555 (nightly build) and the problem still exists.

The browser involved is IE 6 and 7. OS: winxp

comment:3 Changed 16 years ago by Martin Kou

Keywords: selection IE removed
Milestone: FCKeditor 2.6

I guess you're trying to read the selected text when a floating dialog has opened, am I correct?

If yes, then FCK.EditorDocument.selection wouldn't return a selection object inside the editing document, but rather the selection object inside the floating dialog iframe. This is an IE bug in which it is limited to having only one selection per browser window, and that it can return a selection object from another iframe document even though you asked for document.selection.

We've included an updated API in FCKeditor 2.6 to workaround this problem. Try to use FCKSelection.GetSelection() in place of FCK.EditorDocument.selection - it should always give you the selection object inside the editing iframe.

I'm leaving this ticket for a little while in case the suggested solution doesn't work.

comment:4 Changed 16 years ago by Wojciech Olchawa

Keywords: Pending added

comment:5 Changed 16 years ago by Bert Hankes

Indeed.. I'm using floating dialog (one of the best new features!!!) And your suggestion works! Thanks a lot!

It would be great to mention this bug in IE7 for other users who make plugins!

Keep up this great work!

comment:6 Changed 16 years ago by Martin Kou

Resolution: invalid
Status: newclosed

Thanks for the reply and suggestion. :)

Closing the ticket since it is not a bug.

comment:7 Changed 16 years ago by Exception e

Cc: Exception e added
Milestone: FCKeditor 2.6.3
Resolution: invalid
Status: closedreopened
Version: FCKeditor 2.6 RCFCKeditor 2.6.2

It seems that this is broken again in 2.6.2: insertHtml works fine in ff3, but in IE7 it is broken. See also this thread: http://www.fckeditor.net/forums/viewtopic.php?f=6&t=10373&st=0&sk=t&sd=a

comment:8 Changed 16 years ago by Martin Kou

Resolution: invalid
Status: reopenedclosed

The original concern of this ticket is only about calling FCK.InsertHtml() when a floating dialog is opened. The forum thread is concerned about the generic case when the user clicks on somewhere outside of FCKeditor's control. We've already fixed the problem with floating dialogs, the forum thread is talking about another bug.

I've opened a new ticket at https://dev.fckeditor.net/ticket/2376 for the forum thread bug. This ticket should remain closed.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy