gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Gutenberg / Wordpress adding <br> element when enter is pressed

Open Armadur opened this issue 8 years ago • 8 comments

Describe the bug When pressing enter and "formatting" code Gutenberg adds new element as represents as
When editing code, that element is not visible, but somehow, browser compiles it and element is there, in DOM

To Reproduce

  1. Add some html
  2. format code with adding space between and pressing "Enter" button
  3. Update

Expected behavior Just format code, don't add anything

Screenshots image

Desktop (please complete the following information):

  • OS: windows 10
  • Browser Chrome
  • Version 69

Additional context Versions: Wordpress 4.9.8 Gutenberg 4.1.0

Armadur avatar Oct 25 '18 09:10 Armadur

Can you be more clear on the steps to reproduce?

What do you mean by "Add some html"?

  • What specific HTML did you add?
  • Are you using the Custom HTML block?
  • Are you using the Class block in HTML mode?

What do you mean by "format code with adding space between"? Did you add the br tags to the html inside the span/etc? Or did those show up on their own somehow?

I notice the span has the class hidden-xs. Is this part of a theme or plugin? Which one? Is it custom? Perhaps the hidden-xs class is defined in a css file that is only loaded in the admin. In this case, it would hide things in the admin but show them on the frontend.

ideadude avatar Oct 28 '18 19:10 ideadude

There doesn't seem to be an issue here. <br> tags are HTML's representation of a line break, inserted upon pressing Enter.

Closing issue. Please comment with more details if needed.

mcsf avatar Nov 26 '18 15:11 mcsf

This is a problem for anyone using the Amazon Associates program (tens or even hundreds of thousands of people?)

WP5 added br tags at the end of each line in the Amazon ad code. This breaks it and it won't display. It doesn't just do it on new posts, it did it on every post. So anyone using the Amazon Native ads in their post has lost them all. For me it is hundreds and hundreds of ads.

Here is an example of the issue. Without those br tags the ads used to display just fine. Now they are all broken.

`


`

I did find mention of this some time back by someone else, but it looks like it wasn't taken into account.

I can't even begin to imagine how much money this is going to cost some people who rely on these ads. As far as I can see, there's no way to get them to work. I tried putting them in a code block, in a classic bock etc. etc. Every time the tags get added and the ad breaks.

shuttermuse avatar Jan 04 '19 10:01 shuttermuse

@shuttermuse did you find a solution for this? Just noticed that some older articles of mine have the same issue.

Ruud-Mens avatar Apr 23 '19 08:04 Ruud-Mens

No real solution other than going back in and manually fixing it. To do that you have to take all your code and place it into an HTML block, then manually delete all the extra br> tags.

On Tue, Apr 23, 2019 at 1:03 AM Ruud [email protected] wrote:

@shuttermuse https://github.com/shuttermuse did you find a solution for this? Just noticed that some older articles of mine have the same issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/WordPress/gutenberg/issues/11048#issuecomment-485688155, or mute the thread https://github.com/notifications/unsubscribe-auth/ADW5SW2CIFAV7CI27L3FX63PR27F5ANCNFSM4F7HVGJA .

shuttermuse avatar Apr 24 '19 17:04 shuttermuse

No real solution other than going back in and manually fixing it. To do that you have to take all your code and place it into an HTML block, then manually delete all the extra br> tags.

I had the same problem with a

Owner


Other Repo Issues