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

Revert from Gutenberg to Classic leaves empty tags #11160

Closed
Mocha365 opened this issue Oct 27, 2018 · 5 comments
Closed

Revert from Gutenberg to Classic leaves empty tags #11160

Mocha365 opened this issue Oct 27, 2018 · 5 comments
Labels
[Status] Not Implemented Issue/PR we will (likely) not implement.

Comments

@Mocha365
Copy link

Mocha365 commented Oct 27, 2018

Describe the bug
Testing the editor version 4.1.1, I noticed that when going back to the Classic editor, we get tags remaining. For example: <p><!-- wp:paragraph --></p>

With the empty paragraph tag existing in the front-end source, it applies the theme's margin that is set for paragraphs. I have not tested yet the other blocks after reverting, but this one is an important one because it effects the front-view with many empty tags.

To Reproduce
Steps to reproduce the behavior:

  1. With the classic editor, create seveal paragraphs in a page/post.
  2. Enable Gutenberg and convert the paragraphs to blocks.
  3. After saving, disable Gutenberg.
  4. Look at the front-end source code and you will see several <p><!-- wp:paragraph --></p>

Expected behavior
Switching back to Classic, should remove all front-end tags related to blocks.

Desktop (please complete the following information):

  • OS: Win 10
  • Browser: Chrome, Firefox, Edge
  • Version the latest
@freddiemixell
Copy link

freddiemixell commented Oct 28, 2018

Confirmed

Running WordPress 5.1-alpha-20181028.144258 Gutenberg v4.1.1

After disabling Gutenberg the paragraph blocks are converted to normal

tags but under those tags you'll see this...
screen shot 2018-10-28 at 3 18 18 pm

@Mocha365
Copy link
Author

Mocha365 commented Oct 28, 2018

Thanks for confirming.... which also means that the paragraph tags are in the front-end source code and inherits the <p> styles (such as paragraph bottom margins) that affects the content. It will of course depend on how a person has styled their <p> though, but most of the time it's a margin.

@earnjam
Copy link
Contributor

earnjam commented Oct 28, 2018

This is sort of related to #9167 where we don't remove empty paragraph blocks on save.

I'm not sure this is a bug. We can't remove empty paragraphs purposefully because we can't know whether they were added intentionally or not. We don't strip extraneous paragraph tags in the classic editor either. Some users use them for content spacing.

I'm closing this as a won't fix for now, but feel free to add more comments if you have more information, or other ideas about how this could be better handled.

@earnjam earnjam closed this as completed Oct 28, 2018
@earnjam earnjam added the [Status] Not Implemented Issue/PR we will (likely) not implement. label Oct 28, 2018
@Mocha365
Copy link
Author

Not really a good solution to ignore the issue as described; the empty paragraphs left behind on the editor switch up have bottom margins which affects the front layout/style of a page or post.

The fact that these are generated by switching from Gutenberg to Classic means that they should not be generated (with the comment tag between them) in the first place. All aspects or remnants of the GB editor should be removed upon switching back to Classic.

I read some of the other posts that talk about this, and it means there's a problem if elements are left behind as residue from the GB editor.

@earnjam
Copy link
Contributor

earnjam commented Oct 28, 2018

We are not ignoring the issue, so I apologize if it comes across that way.

These paragraph tags are not generated by switching from Gutenberg to Classic. These are generated by a user entering content into an editor. If you open a post in the Classic Editor and hit return 2 times, it will create 3 paragraphs with &nbsp; in them. These paragraphs add that same margin that you're referring to. This isn't exclusive to Gutenberg.

If you then activate Gutenberg and convert them to paragraph blocks, they will add the extra HTML comments to the elements as a way to hold extra data if required, but that's it.

If you then deactivate Gutenberg, the HTML comments remain, but they have no effect on the appearance of the site to a visitor. We have to leave those there because there is no way to know whether removing them will result in data loss.

If a user no longer wants the empty paragraphs they added, they can simply remove the empty paragraphs. Regardless of the editor in use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Not Implemented Issue/PR we will (likely) not implement.
Projects
None yet
Development

No branches or pull requests

3 participants