Opened 6 months ago
Closed 2 months ago
#64544 closed enhancement (fixed)
Core GB backport - individual block custom CSS
| Reported by: | glendaviesnz | Owned by: | ellatrix |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.0 |
| Component: | General | Version: | 7.0 |
| Severity: | normal | Keywords: | has-patch gutenberg-merge fixed-major dev-reviewed |
| Cc: | Focuses: |
Description
Custom CSS for individual blocks is about to be merged to the Gutenberg plugin via https://github.com/WordPress/gutenberg/pull/73959 which involves updates to lib php files which need to be included in the next WP release.
Change History (32)
This ticket was mentioned in PR #10777 on WordPress/wordpress-develop by @glendaviesnz.
6 months ago
#1
- Keywords has-patch added; needs-patch removed
@glendaviesnz commented on PR #10777:
5 months ago
#3
@Mamaduka I have added the change from https://github.com/WordPress/gutenberg/pull/74969
@Mamaduka commented on PR #10777:
5 months ago
#4
Thank you, @glendaviesnz!
@glendaviesnz commented on PR #10777:
5 months ago
#5
@scruffian, @aaronrobertshaw I am not sure why all the tests are failing - it seems unrelated to this PR - have tried a rebase.
@scruffian commented on PR #10777:
5 months ago
#6
A couple of reasons!
- Change WP_Theme_JSON_Gutenberg to WP_Theme_JSON in src/wp-includes/block-supports/custom-css.php:43
- Add static keyword to the method signature in src/wp-includes/class-wp-theme-json.php:1514
@aaronrobertshaw commented on PR #10777:
5 months ago
#7
@scruffian is on the money regarding the test failures.
One other nit is that I believe core tests required a @ticket XXXX annotation so it is easier to see when a specific test was added.
@shimotomoki commented on PR #10777:
5 months ago
#8
@glendaviesnz Could you please also add these changes?🙏
https://github.com/WordPress/gutenberg/pull/75052
@glendaviesnz commented on PR #10777:
5 months ago
#9
@glendaviesnz Could you please also add these changes?🙏 WordPress/gutenberg#75052
@glendaviesnz commented on PR #10777:
5 months ago
#10
@scruffian, @aaronrobertshaw I think it is ready for another review
#13
@
5 months ago
@glendaviesnz [61678] re-introduces some behavior around CSS restrictions that was improved in [61486] (#64418) (source):
<?php // Validate CSS doesn't contain HTML markup (same validation as global styles REST API). if ( preg_match( '#</?\w+#', $custom_css ) ) { return $parsed_block; }
Restrictions on CSS (style tag contents) were relaxed to allow more content. It would be nice to maintain that consistency. The previous restrictions referred to in the comment were unnecessarily restrictive and rejected many safe and valid CSS strings.
This CSS validation logic is duplicated in client-side logic in Gutenberg that disallows many valid CSS strings.
#14
follow-up:
↓ 15
@
5 months ago
- Resolution fixed
- Status closed → reopened
Reopening based on this comment, that may be considered follow-up, but I want to prevent it from being overlooked.
#15
in reply to: ↑ 14
;
follow-up:
↓ 16
@
5 months ago
Replying to jonsurrell:
Reopening based on this comment, that may be considered follow-up, but I want to prevent it from being overlooked.
It looks like that changed after the original GB PR was merged. I think this can be a follow-up, it only affects the new block-level custom CSS. I won't have time to take a look for about 2 weeks, so if anyone thinks it should be fixed earlier to get into 7.0 feel free to open a PR.
#16
in reply to: ↑ 15
@
5 months ago
Replying to glendaviesnz:
I think this can be a follow-up, it only affects the new block-level custom CSS.
Thanks, that seems fine. This problems addressed in [61486] are not as typical in CSS for a specific block.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
4 months ago
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
4 months ago
#20
@
4 months ago
- Resolution → fixed
- Status reopened → closed
Closing this, as the bug is tracked in #64771.
This ticket was mentioned in PR #11686 on WordPress/wordpress-develop by @mukesh27.
2 months ago
#21
Performance regression for #10777
Trac ticket: https://core.trac.wordpress.org/ticket/64544
By checking $block['attrs']['className'] first, it ensure that for the 90% of blocks that don't have custom CSS, the function returns in microseconds without ever triggering the preg_match.
## Use of AI Tools
N/A
@westonruter commented on PR #11686:
2 months ago
#22
@mukeshpanchal27 please review my additions
#23
@
2 months ago
Performance follow-up in https://github.com/WordPress/wordpress-develop/pull/11686
@mukesh27 commented on PR #11686:
2 months ago
#24
@mukeshpanchal27 please review my additions
Thanks @westonruter, The changes look good to me.
@westonruter commented on PR #11686:
2 months ago
#25
Corresponding Gutenberg PR: https://github.com/WordPress/gutenberg/pull/78217
#27
follow-up:
↓ 32
@
2 months ago
- Keywords fixed-major dev-feedback added
- Resolution fixed
- Status closed → reopened
Re-opening for merging r62359 into the 7.0 branch.
@westonruter commented on PR #11686:
2 months ago
#28
Committed in 20b5d10 (62359)
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This is a backport of https://github.com/WordPress/gutenberg/pull/73959 which adds block level custom CSS support.
Trac ticket: [](https://core.trac.wordpress.org/ticket/64544)