Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classic: Infinite content duplication loop when wrapping with anchor tag #29338

Closed
WunderBart opened this issue Feb 25, 2021 · 3 comments
Closed
Labels
[Block] Classic Affects the Classic Editor Block [Type] Bug An existing feature does not function as intended

Comments

@WunderBart
Copy link
Member

WunderBart commented Feb 25, 2021

Description

Using the Classic block, when manually wrapping a captioned image with an anchor tag via the Code Editor, the anchor starts duplicating indefinitely after exiting the Code Editor and toggling back in. This can potentially lead to running out of RAM and making the post completely uneditable.

Step-by-step reproduction instructions

  1. Add a Classic block
  2. Inside that block, add an image with a caption
  3. Go to Code Editor
  4. Wrap the whole content with an anchor tag manually
  5. Exit the Code Editor
  6. Enter the Code Editor back in
  7. See how the content duplicates.

Expected behaviour

Content never duplicates itself.

Screenshots or screen recording

Screen.Recording.2021-02-25.at.13.39.49.mov

WordPress information

  • Gutenberg version: latest

Device information

  • Browser: Chrome
@WunderBart WunderBart added [Type] Bug An existing feature does not function as intended [Block] Classic Affects the Classic Editor Block labels Feb 25, 2021
@ramonjd
Copy link
Member

ramonjd commented Feb 26, 2021

I can reproduce this in Gutenberg 10.1.0-rc.1 in Chrome

Wrapping the shortcode in a tag that has an attribute seems to affect the code editor.

So, for example. wrapping with an <a href=""></a>

Feb-26-2021 13-47-43

Or wrapping with a <p align="left"></p> seems to do a quick replace when you blur out of the code editor.

So this:

<p align="left">


[caption id="attachment_11" align="alignnone" width="289"]<img class="wp-image-11 size-medium" src="http://localhost:4759/wp-content/uploads/2021/02/Screenshot-2021-01-29-at-4.50.07-PM-289x300.png" alt="t-shirt" width="289" height="300"> t-shirt[/caption]
</p>

Becomes this:

<p align="left"></p>


[caption id="attachment_11" align="alignnone" width="289"]<img class="wp-image-11 size-medium" src="http://localhost:4759/wp-content/uploads/2021/02/Screenshot-2021-01-29-at-4.50.07-PM-289x300.png" alt="t-shirt" width="289" height="300"> t-shirt[/caption]

The magic happens in autop().

Maybe some of the regexs need to take the presence of attributes into account ?

@avivalk
Copy link

avivalk commented Mar 22, 2021

I have this same issue! Any ideas how to get around it? My entire page is unusable because its just stuck in the infinite loop. How can I stop the loop and restructure the html so it doesn't start again?

OR is an update going to come out soon that will fix it?

@mcsf
Copy link
Contributor

mcsf commented Apr 5, 2021

Closing as duplicate of #29988.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Classic Affects the Classic Editor Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants