Ticket #439 (closed New Feature: fixed)

Opened 7 years ago

Last modified 3 years ago

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

Reported by: Duncan Owned by: martinkou
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

439.patch (6.7 KB) - added by martinkou 6 years ago.
439.2.patch (10.3 KB) - added by martinkou 6 years ago.
439_3.patch (10.2 KB) - added by martinkou 6 years ago.
439_4.patch (76.2 KB) - added by martinkou 6 years ago.

Change History

comment:1 Changed 7 years ago by alfonsoml

  • 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 7 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 7 years ago by alfonsoml

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 7 years ago by fredck

  • Type changed from Bug to New Feature
  • Summary changed from Cannot follow a link in IE7 to IE: CTRL+Click to open links in a new window

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

  • Keywords Confirmed IE added

comment:7 Changed 6 years ago by fredck

  • Milestone set to 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 6 years ago by martinkou

  • Status changed from new to assigned
  • Owner set to martinkou

Changed 6 years ago by martinkou

comment:9 Changed 6 years ago by martinkou

  • Keywords Review? added

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

Changed 6 years ago by martinkou

comment:10 Changed 6 years ago by fredck

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

comment:11 Changed 6 years ago by martinkou

  • Keywords Review? added; Review- removed

comment:12 Changed 6 years ago by fredck

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

  • Keywords Review? added; Review- removed

comment:14 Changed 6 years ago by martinkou

  • Keywords Review? removed

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

Changed 6 years ago by martinkou

comment:15 Changed 6 years ago by martinkou

  • Keywords Review? added

comment:16 Changed 6 years ago by fredck

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

  • Status changed from assigned to closed
  • Resolution set to fixed

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

comment:18 Changed 4 years ago by qgo

  • Version set to 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 3 years ago by duncansimey

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