WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#32323 closed defect (bug) (fixed)

Empty "link text" tag in link does not add the link

Reported by: Zoker Owned by: iseulde
Milestone: 4.3 Priority: normal
Severity: normal Version: 4.2.2
Component: Editor Keywords: good-first-bug has-patch
Focuses: Cc:

Description

When I want to insert a link into a page, but leave the "link text" field empty, the link is not added.

Here is an example:
http://fs2.directupload.net/images/150509/ugkckpyj.png

Expected behavior:

  • Add the link itself into the link text, if link text is empty
  • Or show a error message, that this field is required

Attachments (4)

32323.diff (406 bytes) - added by bcole808 6 years ago.
32323.2.diff (395 bytes) - added by bcole808 6 years ago.
Alternate version which changes one line
32323.patch (365 bytes) - added by iseulde 6 years ago.
32323.3.diff (353 bytes) - added by rommelxcastro 6 years ago.
simplified code

Download all attachments as: .zip

Change History (13)

#1 @iseulde
6 years ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to 4.3

Add the link itself into the link text, if link text is empty

Sounds good to me.

@bcole808
6 years ago

#2 @bcole808
6 years ago

Attached a fix for this issue which implements:

Add the link itself into the link text, if link text is empty

PS: This is my first patch submission, done from WordCamp in Orange County''

#3 @iseulde
6 years ago

  • Keywords has-patch added; needs-patch removed

@bcole808 That's awesome! It could be a little bit simpler though. :) You only need to change one line.

@bcole808
6 years ago

Alternate version which changes one line

#4 @bcole808
6 years ago

I uploaded a possible second version which changes only one line. This second version seems a little bit harder to read though.

@iseulde
6 years ago

#5 @iseulde
6 years ago

What about the above? :)

#6 @bcole808
6 years ago

That does indeed also do the trick. I could have sworn I tried that and it was failing for some reason, but I tested again now and it does work.

This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.


6 years ago

#8 @iseulde
6 years ago

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

In 32705:

Editor: link modal: use link as fallback for text

If there is no link text provided, use the link as the text. This is better than silently failing.

Props bcole808.
Fixes #32323.

#9 @rommelxcastro
6 years ago

Hey guys, here is an even more simplified solution (:

@rommelxcastro
6 years ago

simplified code

Note: See TracTickets for help on using tickets.