Ticket #2071 (closed Bug: invalid)

Opened 6 years ago

Last modified 6 years ago

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

Reported by: ayh 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

comment:1 Changed 6 years ago by ayh

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 6 years ago by ayh

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 6 years ago by martinkou

  • Keywords selection IE removed
  • Milestone FCKeditor 2.6 deleted

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 6 years ago by w.olchawa

  • Keywords Pending added

comment:5 Changed 6 years ago by ayh

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 6 years ago by martinkou

  • Status changed from new to closed
  • Resolution set to invalid

Thanks for the reply and suggestion. :)

Closing the ticket since it is not a bug.

comment:7 Changed 6 years ago by Exception e

  • Status changed from closed to reopened
  • Cc Exception, e added
  • Version changed from FCKeditor 2.6 RC to FCKeditor 2.6.2
  • Resolution invalid deleted
  • Milestone set to FCKeditor 2.6.3

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 6 years ago by martinkou

  • Status changed from reopened to closed
  • Resolution set to invalid

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 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy