Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#23114 closed defect (bug) (duplicate)

Links created in Visual Editor are removed by Text Editor

Reported by: bgom9021msncom's profile bgom9021@… Owned by:
Milestone: Priority: normal
Severity: major Version: 3.5
Component: Editor Keywords:
Focuses: Cc:

Description

Links created in Visual Editor are not shown in Text Editor and any editing in Text mode cause links to be removed.

To reproduce:

  1. Open Post in Visual Editor.
  2. Select text to which link is to be added and click on Insert/Edit Link tool.
  3. Add the link.
  4. Switch to Text Editor. At this point you will notice that some extraneous   have been added, and the link is not present.
  5. Remove an unwanted   - or modify some HTML.
  6. Switch back to Visual Editor.

You will see that that the previously added link is no longer there.

Change History (13)

#1 @SergeyBiryukov
11 years ago

  • Keywords reporter-feedback added

Could not reproduce on a clean install.

Does this still happen with all plugins deactivated and using Twenty Twelve?

#2 @bgom9021@…
11 years ago

  • Keywords reporter-feedback removed

YES -

  1. Setup WP 3.5 base installation at test.smallbusinesswebspot.com.
  2. Made no changes to WP Settings.
  3. Added New Post. See My First Post on front page.
  4. Select text "Link to Sample page" and clicked on insert/edit link icon, and linked to Sample page.
  5. Switched to Text editor. No problems are evident.
  6. Switched to Visual editor and removed link.
  7. Selected ALL text and linked to Sample page as in step 4 above.
  8. Switched to Text editor. No problems are evident. Anchor appropriately wraps all text.

NOW THIS IS WHERE IT GETS INTERESTING

  1. Switched to Visual editor. Now only first line of text is underlined indicating that only the first line now has anchor. Switching back to Text editor confirms this. A closing anchor tag has been added after the first text line, and an NBSP has replaced the closing anchor tag after the last line.
  2. Removed anchor from first line.
  3. Selected first line and changed format from Paragraph to H3.
  4. Selected all text and linked to Sample page.
  5. Switched to Text editor. Anchor is present.
  6. Switched to Visual editor. Anchor has been removed and tags replaced with NBSP's.

Let me know if you need access to this test install.

#3 @jacopo.vip
11 years ago

  • Cc jacopo.tarantino@… added
  • Keywords reporter-feedback added

I couldn't reproduce this either.
What browser are you using? Have you tried turning off all browser plugins?

#4 @bgom9021@…
11 years ago

  • Keywords reporter-feedback removed

I was using Chrome on a Mac.
I've now downloaded a clean Firefox and tried again with the same results.
I then tried with IE on Windows 7 with the same results.

This is a clean install of WP 3.5 with no changes to the settings.

I am beginning to think that it takes a new-be to screw up like a new-be. What is now clear to me is that the Visual editor is, probably by design, removing anchors that span block elements, and replacing their opening and closing tags with " ". This coding practice was also considered invalid HTML prior to HTML5. If you have been unable to reproduce this, my guess is this is because you knew better than to try to span block elements in the first place.

Am I right?

#5 @jacopo.vip
11 years ago

  • Keywords reporter-feedback added

Oh, are you saying you're having the link open and close in different blocks? I think that would definitely be something the editor would correct. Something like the following?

<p> <a href="blah"> foo </p> <p> bar </a> </p>

#6 @bgom9021@…
11 years ago

  • Keywords reporter-feedback removed

No No. That would be invalid syntax at any level of HTML. What I am doing is valid HTML5 as follows...

<a href="#"><h3> title </h3><p> stuff </p></a>

All blocks are fully contained within the anchor. This is valid syntax in HTML5, but apparently not yet supported in WP. This is done when one wants a larger anchor target area.

#7 @jacopo.vip
11 years ago

I still can't reproduce this bug. Adding large blocks of text for me and then linking them(in the visual editor) actually produces the following:
<h3><a href="#">blah</a></h3>
<a href="#">more blah</a>

<p> tags are added later.
I'm sure something's not sitting right here but I don't know what. This is not expected behavior.

#8 @bgom9021@…
11 years ago

I can't help but think that if you do what I am doing exactly as I am doing it, you should see the same result. We've already established that we're all using a clean install of WP 3.5 with no changes to the installed settings.

Create a Post. In the Visual editor, enter:

Heading

Paragraph text


Select line 1 and set format to Heading 2.
Select all text and link to the Sample Page.

Now switch to the text editor. If you have done what I did exactly as I've described it, you should indeed see what I see as follows.

<a title="Sample Page" href="http://test.smallbusinesswebspot.com/?page_id=2">
<h2>Heading</h2>

Paragraph text

&nbsp;

</a>


Now switch back to the Visual editor. You should now see that none of the text is underlined indicating that the anchor has been removed completely.

Now switch to the Text editor again. You should see this.

&nbsp;

<h2>Heading</h2>

Paragraph text


&nbsp;


&nbsp;


There is no anchor.

Next steps. If you do not see this then we must focus on why we are seeing something different. I suggest something like the following steps.

  1. You could log into my test WP to confirm my observations.
  2. We could then focus on identifying what is different between our environments.

Let me know what you think... and thank you for your kind attention and patience.

#10 @jacopo.vip
11 years ago

  • Cc jacopo.tarantino@… removed

#11 @mikezielonka
11 years ago

  • Cc mikezielonka@… added
  • Severity changed from normal to major

Hi All.

I duplicated this on a clean install and recorded it for ya so you can follow the same steps. I even included a little audio lol

http://cloud.tunas.co/242f1T2p143z

Mike

#12 @azaozz
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #22888 (already fixed for 3.5.1). If that still happens in trunk, please reopen with steps to reproduce.

#13 @bgom9021@…
11 years ago

Confirmed fixed in 3.5.1 consistent with pre-HTML5 standards.

NOTE: HTML5 permits anchors to wrap whole blocks. WP still removes such an anchor and replaces it with a separate anchor is inside each included block.

Note: See TracTickets for help on using tickets.