-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Only disable wpautop
on the main TinyMCE instance for the page
#8229
Conversation
Adding e2e tests |
await page.keyboard.type( original ); | ||
|
||
// Save the post so that TinyMCE loads with wpautop disabled. | ||
await page.click( '#save-post' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tofumatt Could I get your help debugging this e2e test failure? My intent is to save the Classic Editor post, and then inspect TinyMCE behavior after the post is reloaded. However, it seems the test is progressing before the post is reloaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, I should be able to have a look in maybe... thirty-ish minutes 😄
await page.type( '#content', original ); | ||
|
||
const initialTextEditorContent = await page.$eval( '.wp-editor-area', ( element ) => element.value ); | ||
expect( initialTextEditorContent ).toEqual( original ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tofumatt I made a little bit of progress with f93f875d4
At this point, the assertion is failing with:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also tried:
await page.type( '#content', '<!-- wp:paragraph -->' );
await page.keyboard.press( 'Enter' );
await page.type( '#content', '<p>Foo bar four five six</p>' );
await page.keyboard.press( 'Enter' );
await page.type( '#content', '<!-- /wp:paragraph -->' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.type( '#content', 'This is another set of text' );
But it fails with the same error.
578b479
to
5ae19e1
Compare
I figured this out! Ran So the content in the editor stays the same between tests. We should probably change Should have a fix in a second. I think it's useful to have this test and to have to change it when the modal merges. |
Cool, sounds good. |
As mentioned in Slack I was way too optimistic. I thought it was just the lack of navigation causing issues but something is super weird and I don't think it's your tests. I dunno, they are a good spec for what should happen so I wonder about keeping them but skipping them and noting that it seems to be the test suite that's causing issues. Anyway, I don't think I can get them fixed for now, sorry. 😢 |
Ok, no worries. Build seems to be failing intermittently now. I've restarted it a few times and am getting different test failures. |
Deleting the build cache seems to have done the trick. Good to go now. |
`_content_editor_dfw` is a private TinyMCE setting we can use to identify this main TinyMCE instance. We don't want to disable `wpautop` on _all_ editor instances on the page, because plugins could be dependent on it.
bc03138
to
59cd86c
Compare
@WordPress/gutenberg-core This is ready to land now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Description
content
is a TinyMCE editor id we can use to identify this main TinyMCE instance. We don't want to disablewpautop
on all editor instances on the page, because plugins could bedependent on it.
From #2708
Related #4672 (comment)
How has this been tested?
This expected output reflects the expected behavior when
wpautop
is disabled. When TinyMCEwpautop
is disabled, TinyMCE forces a root node (<p>
) on the individual line of text. Ifwpautop
were to be enabled, thenremovep
would be run on the switch back to Text Mode and both instances of<p>
tags would be removed.See #4672 (comment) for more background.
Types of changes
Bug fix.
Checklist: