WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#31890 closed defect (bug) (fixed)

Link to existing content added in Text Editor disappear after switch to Visual editor and back

Reported by: beda69 Owned by: azaozz
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Editor Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

Links (to existing content) created in Text Editor are not shown in Text Editor after switch once to Visual Editor and back
To reproduce:
Open Post in Visual Editor.
Switch to Text Editor
Add Link to existing content with the Editor Bar "link" button
Save / Update Post/Page
Switch once to Visual Editor and back to Text Editor
Link is disappeared
Link does not render in front end.

Tested with Theme 2014 / No plugins / Clean new WP Install / New Database

Attachments (3)

31890-label-text-field.diff (380 bytes) - added by Tmeister 4 years ago.
31890.1.patch (591 bytes) - added by azaozz 4 years ago.
31890.2.patch (1.2 KB) - added by azaozz 4 years ago.

Download all attachments as: .zip

Change History (22)

#1 @Tmeister
4 years ago

Not sure that this is a bug.

When you use the Add Link Button (in text mode) and you select an existing content the link in the editor is something like this:

<a href="http://src.wordpress-develop.dev/?p=5"></a>

The anchor text is empty and if you do not add an anchor text the link disappears.

I think that we need to add an anchor text field in the dialog window.

http://g.recordit.co/cCulRYd5yJ.gif

#2 @beda69
4 years ago

hmm
OK; so far I see it works.
(if we add anchor text)

Not sure though if this wasn't different before.

And it would perhaps be good to add a option directly in the window where we set "already existent link" :
"Add Anchor Text"
or even better, include the anchor text automatically?

This workflow as is, will (and currently does), confuse users.
It's not 100% user friendly

My bad I declared it as bug and did not recognize the mistake I did...

#3 follow-ups: @Tmeister
4 years ago

  • Keywords has-patch needs-testing added

For what I can see, the "Link Text" field is hidden for some reason when the dialog window is trigger from text mode view.

I don't know if there is a special reason for that, anyway the patch removes that line and now the label text field is visible and working.

#4 in reply to: ↑ 3 @SergeyBiryukov
4 years ago

  • Component changed from General to Editor
  • Milestone changed from Awaiting Review to 4.2

Replying to Tmeister:

For what I can see, the "Link Text" field is hidden for some reason when the dialog window is trigger from text mode view.

Introduced in [31713].

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


4 years ago

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

Replying to Tmeister:

...the "Link Text" field is hidden for some reason when the dialog window is trigger from text mode view.

The reason is that the Text editor is targeted at more advanced users that are able (and willing) to type HTML by hand. There the benefit of using the Link dialog is to quickly find a permalink to an existing post. The linked text can be added/removed/edited easily directly in the textarea.

Suggesting wontfix.

#7 @beda69
4 years ago

  • Keywords 2nd-opinion added

Agreed so far.

Just a observation:

  1. Create link WITHOUT typing the "link text"
  2. Update
  3. Switch once Visual/text
  4. Link disappeared
  5. Logout/login
  6. Link is back in text-editor

IF we keep this as is, perhaps there is still something wrong with the logout/login steps mentioned above.
EITHER the link should disappear (also after logout/login)
OR it should always stays visible in the Text Editor

Also "wiling"/"skilled" users could get confused by this "behavior"

#8 @iseulde
4 years ago

  • Version 4.1.1 deleted

#9 @Tmeister
4 years ago

As I said in the first comment this is not really a bug is more about usability but I'm agree, if this has been the default behavior there is no reason to fix it.

#10 @iseulde
4 years ago

  • Milestone changed from 4.2 to Awaiting Review

This ticket was mentioned in Slack in #core by sergeybiryukov. View the logs.


4 years ago

#12 follow-up: @netweb
4 years ago

  • Milestone changed from Awaiting Review to 4.2
  • Version set to trunk

Replying to azaozz:

The reason is that the Text editor is targeted at more advanced users that are able (and willing) to type HTML by hand. There the benefit of using the Link dialog is to quickly find a permalink to an existing post. The linked text can be added/removed/edited easily directly in the textarea.

Suggesting wontfix.

When I created #28206 it was based on the use case of bbPress where we use the Text editor for topics and replies:

Quoting netweb:
As we start moving the Rosetta (International WordPress.org forums) sites to bbPress 2.x and "down the road" WordPress.org support forums to bbPress 2.x we need the "text editor" to be friendly for all users, not just advanced users who know HTML.

Per a discussion just now in Slack #core with Helen and rather than open another ticket moving into 4.2

I haven't tested the patch here yet but will do so soonishly :)

#13 in reply to: ↑ 12 @azaozz
4 years ago

Replying to netweb:

The logic for showing the text field when opened from the Visual editor is: no selection or only text selected. No text field when a linked image is selected.

The patch works partially. To always show the Link text field, it needs to be changed to inputs.wrap.addClass( 'has-text-field' );, not removed. It currently doesn't load selected text in the Link Text field and cannot "edit" a link, i.e. load both the text and URL when the caret is in a place wrapped in an <a> tag.

In that terms, not sure if this is a desirable change. We can add all these features to match the Visual editor, but not in RC. Also that will be quite different from the rest of the Text editor.

#14 @DrewAPicture
4 years ago

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

This ticket was mentioned in Slack in #core by drew. View the logs.


4 years ago

@azaozz
4 years ago

#16 @azaozz
4 years ago

  • Keywords needs-testing removed

I'm 50/50 on whether we should leave this as-is or make the "Link Text" field always visible when using the Text editor. 31890.1.patch makes it always visible.

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

@azaozz
4 years ago

#17 @azaozz
4 years ago

In 31890.2.patch: also load any selected text in the "Link Text" field when opening the modal from the Text editor. Tested in Chrome, Firefox, IE11 and IE8.

#18 @helen
4 years ago

I think it's better to have the link modal work the same in the text editor - it's already a different experience from other tags, so I don't see that it's a terrible thing. I would say that it would also be better on touch devices, except that with the zooming + keyboard fly-up, text mode is basically unusable on iOS right now. Will test and get 31890.2.patch in.

#19 @helen
4 years ago

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

In 32242:

wpLink: Make the text editor experience the same as in the visual editor.

props azaozz.
fixes #31890.

Note: See TracTickets for help on using tickets.