#2022 closed defect (bug) (fixed)
2.0 RC1 WYSIWYG inserting headers destroys next paragrah
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.0 |
Component: | General | Keywords: | bg|has-patch bg|commit wysiwyg has-patch has-unit-tests |
Focuses: | Cc: |
Description (last modified by )
I want to use the new WYSIWYG functionality, but this bug makes it so I cant.
Steps to produce:
- Begin new post with WYSIWYG editor.
- Enter a paragrah, a header, then a paragraph. For example, try this text
<p>A test paragraph.</p> <h3>A header.</h3> <p>A test paragraph.</p>
- Publish post.
- Visit post and look at output.
For the above code sample, this will be what makes it into the post:
<p>A test paragraph.</p> <h3>A header.</h3> A test paragraph. </p>
It is missing the opening paragraph tag.
Trying the same code without the WYSIWYG editor works.
Attachments (1)
Change History (27)
#1
@
19 years ago
- Priority changed from high to lowest
- Resolution set to invalid
- Status changed from new to closed
#2
@
19 years ago
- Description modified (diff)
- Resolution invalid deleted
- Status changed from closed to reopened
Well, this brings into play the question on whether TinyMCE should allow you to post your own HTML while in WYSIWYG mode. Either way, even if it means that we replace with HTML entity codes, everything that you put into the box should still be there when you publish.
#3
@
19 years ago
- Priority changed from lowest to normal
I forgot to mention, but the headers were inserted with the HTML button popup, not typed directly into the editor.
Type some text and it automatically makes paragraphs. Pop open the HTML dialogue to add a header between any two paragraphs, and the paragraph after the header gets its opening paragraph tag deleted.
#4
@
19 years ago
- Milestone set to 2.0
- Owner changed from anonymous to ryan
- Severity changed from major to normal
- Status changed from reopened to new
This behavior is fixed in the patch for #1991, which includes TinyMCE 2.0 Final and some new RegEx cleanups. Changeset is pending review.
There is no guarantee that everything you type in the RTE will be there on the blog. The paragraphs are stripped and text is stored as "A test paragraph.\n\n" unless the <p> has attributes. The <h3> is stored as-is. The default filters put the <p> tags back in on display but plugins can change this behavior. This design pattern makes it possible to switch off the RTE and still be able to edit the post in a natural format, as well as to switch on the RTE and edit old posts without cluttering them with paragraph markup.
#5
@
19 years ago
- Owner changed from ryan to skeltoac
- Status changed from new to assigned
Okay, now I see your message of 00:11:37. Behavior still exists in that case. It is a problem in wpautop. I'll see to a fix.
#6
@
19 years ago
- Keywords bg|has-patch bg|commit added; 2.0 removed
- Owner changed from skeltoac to ryan
- Status changed from assigned to new
Block element closing tags followed by text, not a newline, would cause wpautop to chop a <p> while leaving its </p> in place. The attached diff resolves this issue.
The issue was made apparent by a faulty regex in the TinyMCE editor plugin, which functioned to format the source for readability by adding a newline after every block element. The regex missed h[1-6] tags due to an unescaped backslash. This is also fixed by the attached diff.
This ticket was mentioned in PR #2129 on WordPress/wordpress-develop by oandregal.
3 years ago
#9
- Keywords has-patch added
For themes without theme.json support, we only enqueue the default styles provided by WordPress, such as the preset classes
(font sizes, colors, gradients). These classes should be always present as they may be used by old content and patterns.
For themes with theme.json support, we also enqueue the theme styles.
## More context
In WordPress 5.8 the preset classes (font sizes, colors, gradients) were provided via a CSS stylesheet that we enqueued to all themes plus the global stylesheet for the themes that supported theme.json
. To avoid this duplication, in WordPress 5.9 the preset classes were removed from the common stylesheet (see https://github.com/WordPress/gutenberg/pull/35182 and https://github.com/WordPress/gutenberg/pull/34510) and are now provided by the global stylesheet, which is enabled to all themes as of https://github.com/WordPress/gutenberg/pull/34334
Related devnote, see "Changes to the global stylesheet" section.
## How to test
- Load the TwentyTwenty theme.
- Go to the front end and verify that there's a stylesheet called
global-styles-inline-css
.
oandregal commented on PR #2129:
3 years ago
#10
Related issue at https://core.trac.wordpress.org/ticket/54782
I have a fix for TwentyTwenty at https://github.com/WordPress/wordpress-develop/pull/2130 TwentyNineteen and TwentyTwentyone still need a patch.
oandregal commented on PR #2129:
3 years ago
#11
noisysocks commented on PR #2129:
3 years ago
#12
Thanks @oandregal!
This ticket was mentioned in PR #2962 on WordPress/wordpress-develop by Luc45.
3 years ago
#13
This PR is a proof-of-concept to prove that there is no technical reason to hold back Yoda withdrawal from the codebase.
Uses 100% automated tooling to swap Yoda conditions in the entire codebase:
### How this was done
Considering that your src
folder is in: /home/some-user/wordpress-develop/src
cd tools/php-cs-fixer
composer install
./vendor/bin/php-cs-fixer /home/some-user/wordpress-develop/src
./vendor/bin/php-cs-fixer /home/some-user/wordpress-develop/tests
### How to test
- Unit tests should continue to pass
- E2E tests should continue to pass
- PHPCS should pass once Yoda is no longer enforced
3 years ago
#14
I had to ignore:
src/wp-includes/class-wp-block-parser.php
src/wp-includes/blocks
Otherwise E2E tests would fail in the check Ensure version-controlled files are not modified or deleted.
Any insight on why these files cannot be modified? I figured they might be a subversion coming from another repo?
This ticket was mentioned in PR #5333 on WordPress/wordpress-develop by @swissspidy.
18 months ago
#16
- Keywords has-unit-tests added
As per https://make.wordpress.org/core/2022/03/23/migrating-wordpress-e2e-tests-to-playwright/, this migrates all Puppeteer usage in core to Playwright.
E2E tests
- [ ]
tests/e2e/specs/profile/applications-passwords.test.js
- [x]
tests/e2e/specs/cache-control-headers-directives.test.js
- [ ]
tests/e2e/specs/dashboard.test.js
- [ ]
tests/e2e/specs/edit-posts.test.js
- [x]
tests/e2e/specs/empty-trash-restore-trashed-posts.test.js
- [x]
tests/e2e/specs/gutenberg-plugin.test.js
- [x]
tests/e2e/specs/hello.test.js
Performance tests
- [x]
tests/performance/specs/home-block-theme.test.js
- [x]
tests/performance/specs/home-classic-theme.test.js
Visual regression tests
- [ ]
tests/visual-regression/specs/visual-snapshots.test.js
Note: Can conveniently use toHaveScreenshot()
Other to-dos:
- [ ] Ensure browsers are correctly installed and only when necessary (
wp-scripts
should handle that, but let's double check)- [ ] Remove
PUPPETEER_SKIP_DOWNLOAD
usage in GitHub Actions workflows (or usePLAYWRIGHT_SKIP_BROWSER_DOWNLOAD
if needed)
- [ ] Remove
- [ ] Update documentation
Trac ticket:
@Mamaduka commented on PR #5333:
18 months ago
#17
Fantastic work, @swissspidy! 🦸
I'll start going through the tests and change the code into an a11y locator where possible.
A general note regarding the Gutenberg plugin test: Maybe we should handle installation via wp-env
. As far as I can tell, it doesn't need to test installation; just that activation doesn't cause fatal errors.
Cc-ing @kevin940726 and @WunderBart, in case they've any notes regarding the setup.
@swissspidy commented on PR #5333:
18 months ago
#18
A general note regarding the Gutenberg plugin test: Maybe we should handle installation via
wp-env
. As far as I can tell, it doesn't need to test installation; just that activation doesn't cause fatal errors.
Core doesn't use wp-env. But yes, I don't like how the test is doing a fresh install. It takes a long time and is brittle and difficult to clean up if one of the steps fails. But that's just how it was before, I didn't change any of the logic.
What we could do is downloading Gutenberg separately in the CI step, but that would mean you can't easily run the test locally. So right now I don't see a good solution.
@Mamaduka commented on PR #5333:
18 months ago
#19
Sounds good. We can improve this in follow-up. It doesn't need to be a blocker here.
@swissspidy commented on PR #5333:
18 months ago
#20
Hmm getting Error: Cannot find module '@playwright/test/cli'
errors on CI right now, coming from node_modules/@wordpress/scripts/scripts/test-playwright.js
🤔
@Mamaduka commented on PR #5333:
18 months ago
#21
Locally or on CI?
@Mamaduka commented on PR #5333:
18 months ago
#22
@WunderBart, I'm working on best practices updates, so that test standards match what we have for Gutenberg.
@swissspidy commented on PR #5333:
18 months ago
#23
Locally or on CI?
That was only on CI so far
WunderBart commented on PR #5333:
18 months ago
#24
Thanks for working on this, @swissspidy!
I've started submitting some suggestions, but I'll stop now since I can see this is actively being addressed as I scroll through the files. The few suggestions I submitted can be treated more generally because they apply to other files as well - I just didn't want to copy-paste the same comment. Hope it's OK!
@Mamaduka commented on PR #5333:
18 months ago
#25
Thank you, @WunderBart!
@swissspidy commented on PR #5333:
17 months ago
#26
Committed in https://core.trac.wordpress.org/changeset/56926 🎉
Thanks y'all!
the TinyMCE editor doesnt convert html to text in the main box. if you want to use html you click on the HTML button and type your html and hit ok.