Make WordPress Core

Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#19992 closed enhancement (fixed)

Auto-fill URL field on Insert/edit link popup

Reported by: tillkruess's profile tillkruess Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.3.1
Component: Editor Keywords: has-patch
Focuses: Cc:

Description

I'd like to see the following behavior: When I select a plain URL or email address in the editor and click on "Insert/edit link" the URL field is already populated with either the URL or with a "mailto:<email-address>". Any thoughts? I'd more than happy to write a patch.

Attachments (5)

19992.patch (2.8 KB) - added by tillkruess 13 years ago.
19992.diff (3.0 KB) - added by wonderboymusic 11 years ago.
19992.2.diff (2.9 KB) - added by SergeyBiryukov 10 years ago.
19992.3.diff (2.6 KB) - added by SergeyBiryukov 10 years ago.
19992.4.diff (943 bytes) - added by azaozz 10 years ago.

Download all attachments as: .zip

Change History (28)

#2 @nacin
13 years ago

Sounds good to me.

#3 @DrewAPicture
13 years ago

  • Cc xoodrew@… added

@tillkruess
13 years ago

#4 @tillkruess
13 years ago

The regular expressions used in the attached patch where taken from jquery.validate.js. Not sure if there are better ones out there or maybe even already in WP?

#5 @sabreuse
13 years ago

  • Cc sabreuse@… added

#6 @SergeyBiryukov
13 years ago

  • Keywords has-patch added

#7 @tillkruess
13 years ago

  • Version changed from 3.3.1 to 3.4

#8 @DrewAPicture
13 years ago

  • Version changed from 3.4 to 3.3.1

The version field is used to track when an issue was first reported.

#9 @ryansatterfield
12 years ago

Why does the patch include ftp on line 290? I was going to submit a ticket for mailto: support since I just had a client complain about not being able to link to their email address and only to their site. I am glad there is a patch :).

Last edited 12 years ago by ryansatterfield (previous) (diff)

#10 @tillkruess
12 years ago

The script catches not only email addresses, it also handles HTTP and FTP URLs.

#11 @ryansatterfield
12 years ago

Cool. I am always for keeping WordPress as simple as possible and not confusing end-users. Do you agree that it would be easier for most users just to have http, https and mailto? How many people need to link to FTP? If you know about FTP, you probably can add it into the HTML.

#12 @wonderboymusic
11 years ago

  • Milestone changed from Awaiting Review to 4.0

19992.diff refreshes so it applies against modern-day trunk

#13 @wonderboymusic
11 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 28705:

When a plain URL or email address is selected in the editor and "Insert/edit link" is clicked, pre-populate the URL field with the URL or mailto:<email-address>.

Props tillkruess.
Fixes #19992.

#14 @SergeyBiryukov
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

These regexes should be put into variables, as suggested in IRC.

#15 @azaozz
10 years ago

Do we want this to work in the Text editor too? Also, why the "super bulky" regexp? We are not validating user input, just suggesting. Maybe can use something much smaller/faster?

#16 @azaozz
10 years ago

In [28750]:

wpLink: use the proper instance of the editor when looking at the selection. Move the email and URL regexp to variables. See #19992

This ticket was mentioned in IRC in #wordpress-dev by azaozz. View the logs.


10 years ago

#19 @SergeyBiryukov
10 years ago

In 28751:

wpLink: use simpler expressions to detect email address or URL. We are not validating user input here, just suggesting.

see #19992.

#20 @SergeyBiryukov
10 years ago

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

@azaozz
10 years ago

#21 follow-up: @azaozz
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The last patch was limiting the URLs only to the domain. 19992.4.diff matches whole URLs including query/fragment and fixes double encoding of &. It still excludes IDNs and the new(er) TLDs that are longer than 4 letters. Should we support these?

Last edited 10 years ago by azaozz (previous) (diff)

#22 @azaozz
10 years ago

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

In 28828:

wpLink: support whole URLs including query/fragment when pre-filling the URL field. Fixes #19992

#23 in reply to: ↑ 21 @SergeyBiryukov
10 years ago

Replying to azaozz:

It still excludes IDNs and the new(er) TLDs that are longer than 4 letters. Should we support these?

I think it's OK to exclude those for now for the sake of simplicity.

Note: See TracTickets for help on using tickets.