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

Editor: Conflict with Calypso and Gutenberg and paragraph tags #21973

Closed
mkaz opened this issue Jan 30, 2018 · 17 comments
Closed

Editor: Conflict with Calypso and Gutenberg and paragraph tags #21973

mkaz opened this issue Jan 30, 2018 · 17 comments
Assignees
Labels
[Feature] Post/Page Editor The editor for editing posts and pages. [Goal] Gutenberg Working towards full integration with Gutenberg [Pri] High [Type] Bug

Comments

@mkaz
Copy link
Contributor

mkaz commented Jan 30, 2018

Steps to reproduce

  1. Create a new post in Gutenberg (Jetpack site)
  2. Edit post in Calypso and Save.
  3. View post and P tags are removed.
  4. Open post in Gutenberg paragraph blocks are modified

What I expected

Calypso editor is stripping out the <p> tags, which in turn is breaking the Gutenberg blocks. The Gutenberg error of blocks being modified is correct, since Calypso is modifying the blocks by running removep filter over post content.

Solution

A potential solution would be for Calypso to detect if Gutenberg blocks exists and to not apply the autop filter if they do.

@designsimply designsimply added [Type] Bug [Feature] Post/Page Editor The editor for editing posts and pages. labels Jan 30, 2018
@mkaz
Copy link
Contributor Author

mkaz commented Jan 31, 2018

I initially thought this was applied on API Side, which it still might be. However, looking at the API, the paragraph tags do not even reach the endpoint. This can be confirmed by adding in paragraph tags in HTML mode, and then switching to Visual and back to HTML and the tags are removed.

@apeatling apeatling modified the milestones: Product Quality, Product Quality: Editor Flows Jan 31, 2018
@austinginder
Copy link

austinginder commented Feb 14, 2018

I believe there is a conflict between Gutenberg 2.1.0 and Jetpack 5.8. Downgrading Gutenberg to 2.0.0 resolves. Also deactivating Jetpack 5.8 resolves. To reproduce:

  • Installed Gutenberg 2.1.0 and Jetpack 5.8 and create a post with content blocks.
  • Reload the editor and see the P tags removed.

See quick screencast walkthrough: https://vimeo.com/255795293/bd24079e24

@austinginder
Copy link

WordPress/gutenberg#3922

@mkaz
Copy link
Contributor Author

mkaz commented Mar 3, 2018

@austinginder thanks, that issue was hopefully fixed in Gutenberg 2.3.0 which was released yesterday. Please try it out and let me know if it fixes the issue for you.

Here is the relevant Gutenberg PR WordPress/gutenberg#5288

@oandregal
Copy link
Contributor

Not sure if related or not, but here's what I see when I try to edit with Calypso a post created with Gutenberg in a Jetpack site:

In Gutenberg everything looks like the published post:

gutenberg-post-dotorg

In Calypso there are some formatting issues and some paragraphs are split

gutenberg-post-calypso

@kristarella
Copy link

I think this issue may be related: WordPress/gutenberg#10376

I'm closing the other as it seems to be calypso-specific

@gwwar
Copy link
Contributor

gwwar commented Oct 23, 2018

A potential solution would be for Calypso to detect if Gutenberg blocks exists and to not apply the autop filter if they do.

Re missing p tags, @mkaz Isn't the issue that we're not running wpautop for the published view when published from the classic Calypso editor, and there is a html comment block tag?

How Paragraphs are Serialized

For more context, classic posts made in the WordPress wp-admin editor and Calypso, stores content in a simpler format:

Classic

On the server we'll see paragraphs noted by two line breaks:

My Paragraph 1\n\nMy Paragraph 2

When the editor loads, it runs content through this function which adds p tags:

this.editor.setContent( wpautop( initialValue ) );

And likewise before save on the client, we remove them again:

e.content = removep( e.content );

The server will also run wpautop:

So we'll see the following in the published view:

<p>My Paragraph 1</p>
<p>My Paragraph 2</p>

Gutenberg

But what do Gutenberg paragraphs look like? The client and server both show and store the following:

<!-- wp:paragraph -->
<p>My Paragraph 1</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>My Paragraph 1</p>
<!-- /wp:paragraph -->

The published view does not display these HTML comments:

<p>My Paragraph 1</p>
<p>My Paragraph 2</p>

@supernovia
Copy link
Contributor

I also ran into this; wrote a post in Gutenberg wp-admin, edited in Calypso (because that's what the edit link leads to), then paragraphs were gone.

Only, if I view the HTML in the Gutenberg editor, the paragraph tags are all still there. :/ They don't show up in the revisions, though.

@lancewillett
Copy link
Contributor

I've been running into this for weeks but assumed I was an early adopter. 😄 Right now I avoid it by only using one editor experience for each P2 post (not switching between contexts or editors).

@gwwar gwwar self-assigned this Oct 26, 2018
@gwwar
Copy link
Contributor

gwwar commented Oct 26, 2018

note to self: potentially related D18636-code

@gwwar
Copy link
Contributor

gwwar commented Oct 26, 2018

Verified the issue. Also verified that removing all Gutenberg comments in the classic editor will re-instate the p tag behavior as expected.

@gwwar
Copy link
Contributor

gwwar commented Oct 31, 2018

Folks can't reproduce on master anymore so, something must have fixed the issue in the last few days. Closing this out for now. If folks see other compatibility issues please file a new issue instead of resurrecting this one.

@gwwar gwwar closed this as completed Oct 31, 2018
@vindl
Copy link
Member

vindl commented Oct 31, 2018

Just wanted to confirm that I wasn't able to reproduce this both for Simple and Jetpack sites on current master. We suspect that something in 4.1 update resolved it, but we are still not certain what.

@vindl
Copy link
Member

vindl commented Nov 14, 2018

Not sure if this is relevant yet, but there was an autop related change in 4.2 that might have caused a regression? D20219-code

@tyxla
Copy link
Member

tyxla commented Nov 15, 2018

@jjchrisdiehl
Copy link
Contributor

Just wanted to note that I am seeing this issue on the WordPress.com support theme, see: https://en.support.wordpress.com/wordpress-editor/blocks/common-blocks/

@gwwar
Copy link
Contributor

gwwar commented Nov 26, 2018

@tyxla @jjchrisdiehl if folks are seeing new reports, can we please open new issues with specific steps? autop misbehavior will trigger in various ways, and this will help us fix specific cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Post/Page Editor The editor for editing posts and pages. [Goal] Gutenberg Working towards full integration with Gutenberg [Pri] High [Type] Bug
Projects
None yet
Development

No branches or pull requests