Opened 17 years ago

Closed 16 years ago

Last modified 13 years ago

#439 closed New Feature (fixed)

IE: CTRL+Click to open links in a new window

Reported by: Duncan Owned by: Martin Kou
Priority: Normal Milestone: FCKeditor 2.6.3
Component: General Version: 3.3.2
Keywords: Confirmed IE Review- Cc:

Description

It does not seem possible to follow a link using IE7. For example, the "You are using FCKeditor" link in the Demo pages. NOTE: IE6 and Firefox work fine, ctrl-click and shift-click open the window.

I've had a search of the existing tickets and can't find anything relevant. However, this seems such a fundamental problem I can't believe it hasn't already been reported. Fingers crossed you've already investigated this and know of a workaround.

If there is no workaround, might I suggest adding an "Open Link" menu item to the link context menu and an "Open Link" button to the Link Editor dialog.

I had a look at the problem and I suspect the event model is incorrect for contenteditable elements. I think this event is bypassing the normal event handlers and cannot be caught.

Attachments (4)

439.patch (6.7 KB) - added by Martin Kou 16 years ago.
439.2.patch (10.3 KB) - added by Martin Kou 16 years ago.
439_3.patch (10.2 KB) - added by Martin Kou 16 years ago.
439_4.patch (76.2 KB) - added by Martin Kou 16 years ago.

Download all attachments as: .zip

Change History (23)

comment:1 Changed 17 years ago by Alfonso Martínez de Lizarrondo

Keywords: IE7 Link URL removed

I don't see any difference between IE6 and IE7.

I think that there's already a request about an option to open the link in a new window, maybe it's still in sourceforge.

comment:2 Changed 17 years ago by Duncan

You are right, it does work in IE6! Gotta admit I kind of assumed it wouldn't because I have had my fingers burnt on something very similar to this a while back. See http://www.quirksmode.org/bugreports/archives/2007/02/Ctrl_Click_event_lost_on_IE7_hyperlinks.html

Bizarrely, ctrl and shift clicking the link works fine in Firefox.

Do you know any way my users can open the link target in IE6 and IE7. That would be most helpful. Thanks - Duncan

comment:3 Changed 17 years ago by Alfonso Martínez de Lizarrondo

It should be possible to write a plugin that provides that option in the context menu of a link. The only problem that I can foresee are relative links, I'm not sure if they will work fine or they will open based on the location of the editor files.

comment:4 Changed 17 years ago by Frederico Caldeira Knabben

Summary: Cannot follow a link in IE7IE: CTRL+Click to open links in a new window
Type: BugNew Feature

For now, in the way you want it, this is a Firefox only feature.

IE instead has also a unique feature for the CTRL+Click: select the entire paragraph. So, others may say that this is also a nice feature.

Probably the plugin solution is much more indicated, putting a "Open link" option in the context menu.

comment:6 Changed 16 years ago by Wojciech Olchawa

Keywords: Confirmed IE added

comment:7 Changed 16 years ago by Frederico Caldeira Knabben

Milestone: FCKeditor 2.6.1

I confirm that current we have this feature natively on Firefox. No luck for us with IE, Safari and Opera.

I've just investigated this feature a bit and find out several issues.

I'm supposing the only way to do that is:

  1. Take the link href.
  2. Call window.open to open it.

Sounds simple, but then the troubles.

  • Popup blockers just hate window.open.
  • Everything is ok with full URLs.
  • Absolute URLs (like "/path/page.html") will be always relative to the site running the editor. No lucky to open www pages from a backoffice in a different URL.
  • Relative URLs (like "path.page.html" or "../path/page.html") are a big trouble. They will be always relative to the "fckeditor/editor" folder. I've tried opening it from several different windows, but it will always be relative to "fckeditor/editor".

So, things are not that simple. The correct approach would be:

  • If BaseHref is set, combine absolute and relative URLs with it. The base href value should be taken from the page because of FullPage=true.
  • If BaseHref is empty, combine absolute and relative URLs with the main page URL (the page containing the editor).

Other then that, I've also tested the CTRL+Click and SHIFT+Click. In IE, clicks with control (at least on editing mode) are not passed to the "click" or "mousedown" events. So there is no way to catch them. I was able to make it work with SHIFT with "good enough" results. But, it seems that CTRL is more accepted for that (Word uses it for instance). So, much probably the context menu option is the right approach for it.

To conclude, this is doable with some effort, but the popup blockers issue will always be a problem for us.

comment:8 Changed 16 years ago by Martin Kou

Owner: set to Martin Kou
Status: newassigned

Changed 16 years ago by Martin Kou

Attachment: 439.patch added

comment:9 Changed 16 years ago by Martin Kou

Keywords: Review? added

A new icon for the new context menu item may be needed.

Changed 16 years ago by Martin Kou

Attachment: 439.2.patch added

comment:10 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed
  1. The patch assumes that _fcksavedurl will be always available, which is not true (paste). The correct way to retrieve the URL should be:
var url = el.getAttribute( '_fcksavedurl' ) || el.getAttribute( 'href' , 2 ) ; 
  1. I understand all the RFC stuff, but /:\/\// should be also enough to check for a full URL, as well as /^.*:\/\/+[^\/]+/ to retrieve the "until host" part of the base href.
  1. There is no need to pass 'FCKVisitLink' to window.open. It would just limit the links to open in the same window, which is not needed here.

Changed 16 years ago by Martin Kou

Attachment: 439_3.patch added

comment:11 Changed 16 years ago by Martin Kou

Keywords: Review? added; Review- removed

comment:12 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed

The code looks good. There are still two small details:

  • As there are additions to the language files, update_lang.bat must be run to include the new entries into all files.
  • It is not a good idea to use the same icon as for the link command. If no icon is available it is better to have no icon there, which would be ok in this case.
  • The first and the last positions in the context menu are to be used by the entries more often used. I know it sounds strange, but the last entries are in the lower boundary which is visually easier and quicker to find. So, the correct order would be "Open Link, -, Edit Link, Remove Link".

A Review+ will definitely come after those changes.

comment:13 Changed 16 years ago by Martin Kou

Keywords: Review? added; Review- removed

comment:14 Changed 16 years ago by Martin Kou

Keywords: Review? removed

Oops, the new patch was polluted with changes in other tickets, retracting the review request.

Changed 16 years ago by Martin Kou

Attachment: 439_4.patch added

comment:15 Changed 16 years ago by Martin Kou

Keywords: Review? added

comment:16 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed

We are almost there... just the change at line 303 of fck_othercommands.js is not needed. Everything is ok for the rest.

comment:17 Changed 16 years ago by Martin Kou

Resolution: fixed
Status: assignedclosed

I've removed that line and committed to SVN in [2143].

comment:18 Changed 13 years ago by qgo

Version: 3.3.2

Will this context menu item be also added to CKEditor? I'm using version 3.3.2 and it's not available

comment:19 Changed 13 years ago by Duncan Simey

@qgo - I've raised a new ticket to request this functionality gets added back in. #8251 - Open Link functionality needed for IE9

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