WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 7 months ago

#37970 closed defect (bug) (worksforme)

Editing anchor link after copying adds admin url

Reported by: philliproth Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords:
Focuses: Cc:
PR Number:

Description

I have a small image e.g. an arrow with an anchor link on it e.g. "#section1". I copy this image and want to edit the link. Then it adds the complete admin url to the link like this: http://www.someboringsite.com/wp-admin/post.php?post=12&action=edit#section2

Attachments (1)

screenshot.jpg (10.9 KB) - added by philliproth 3 years ago.
Screenshot

Download all attachments as: .zip

Change History (6)

@philliproth
3 years ago

Screenshot

#1 @flixos90
3 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Version 4.6 deleted

Thanks for the ticket @philliproth! Replicating this problem, it happens on any kind of link, not related to the image. I couldn't quite figure out where this problem comes from as I'm not familiar with the editor functionality, but the problem has been around for a while. I tested it on 4.4 (happens there as well) and 3.7 (doesn't happen there, but we didn't have the inline link popover back then).

It might be a bug on the paste plugin for TinyMCE since the content reaches the wplink plugin already in the incorrect way, but this is mostly me guessing.

#2 follow-up: @flixos90
3 years ago

Actually I just noticed the link is incorrect when you paste it, but it turns into the expected correct link after you hit Publish / Update on the post.

#3 @azaozz
3 years ago

  • Component changed from Editor to TinyMCE

This is a problem (or is it a "feature") in the browsers when pasting HTML in contentEditable. As far as I remember it used to happen only in Firefox, years ago. It is fixed when inserting links in TinyMCE, but seems it is happening on pasting in some cases.

Passing upstream for more investigation.

#4 in reply to: ↑ 2 @azaozz
3 years ago

Replying to flixos90:

Actually I just noticed the link is incorrect when you paste it

Looking a bit more, I think the rest of the absolute URL is added on copying the link. Try to copy such link from another site/domain.

This appears to be the way the browsers work when you copy a link whose href consist only of a fragment, i.e. <a href="#something">test</a>. Not really sure we or the TinyMCE devs can do much about that. It "looks like" a standard URL on pasting.

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

#5 @desrosj
7 months ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I'm going to close this out. I am currently unable to reproduce this in the Classic Editor, or the block editor. It was probably fixed in another ticket.

Note: See TracTickets for help on using tickets.