-
Notifications
You must be signed in to change notification settings - Fork 58
fix: prevent content-gate editor.scss styles from getting chunked into the common.css file #4716
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
base: release
Are you sure you want to change the base?
Changes from all commits
edbbfac
283c05d
1c9859b
4d466c6
e5a95b5
15c6a2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| @use "~@wordpress/base-styles/variables" as wp-vars; | ||
|
|
||
| .newspack-access-control-block-visibility-panel { | ||
| .components-base-control, | ||
| .components-form-token-field { | ||
| width: 100%; | ||
| } | ||
| // Gutenberg's `.block-editor-block-inspector p:not(.components-base-control__help)` rule | ||
| // strips the emotion margin-top on FormTokenField's help text. Nested here to bump | ||
| // specificity above Gutenberg's and restore the gap. | ||
| .components-form-token-field .components-form-token-field__help { | ||
| margin-top: wp-vars.$grid-unit-10; | ||
| } | ||
| .components-toggle-control { | ||
| margin-top: wp-vars.$grid-unit-10; | ||
| width: 100%; | ||
| .components-base-control__field { | ||
| margin-bottom: wp-vars.$grid-unit-05; | ||
| } | ||
| .components-base-control__help { | ||
| margin-top: 0; | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,8 @@ | |
| display: none; | ||
| } | ||
|
|
||
| .components-base-control { | ||
| margin-bottom: 16px; | ||
| .newspack-content-gate-panel .components-base-control { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Scoping this rule under
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed that this got cozy on the Metering Settings - before:
Should look like this now:
Best I can tell Access control settings looks the same in either case, likely because they just have the one toggle right now -- adding the class doesn't hurt, either:
Classes added to both in e5a95b5. |
||
| margin-bottom: wp-vars.$grid-unit-20; | ||
| &:last-child { | ||
| margin-bottom: 0; | ||
| } | ||
|
|
@@ -58,28 +58,3 @@ | |
| display: none; | ||
| } | ||
|
|
||
| /** | ||
| * Access control block visibility panel. | ||
| */ | ||
| .newspack-access-control-block-visibility-panel { | ||
| .components-base-control, | ||
| .components-form-token-field { | ||
| width: 100%; | ||
| } | ||
| // Gutenberg's `.block-editor-block-inspector p:not(.components-base-control__help)` rule | ||
| // strips the emotion margin-top on FormTokenField's help text. Nested here to bump | ||
| // specificity above Gutenberg's and restore the gap. | ||
| .components-form-token-field .components-form-token-field__help { | ||
| margin-top: wp-vars.$grid-unit-10; | ||
| } | ||
| .components-toggle-control { | ||
| margin-top: wp-vars.$grid-unit-10; | ||
| width: 100%; | ||
| .components-base-control__field { | ||
| margin-bottom: wp-vars.$grid-unit-05; | ||
| } | ||
| .components-base-control__help { | ||
| margin-top: 0; | ||
| } | ||
| } | ||
| } | ||



Uh oh!
There was an error while loading. Please reload this page.
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.
Blocker: Moving these styles into a dedicated
block-visibility.scssmakes this the only importer, so Webpack now emitsdist/content-gate-block-visibility.cssinstead of folding the rules intocommons.css. ButBlock_Visibility(includes/content-gate/class-block-visibility.php) onlywp_enqueue_scriptscontent-gate-block-visibility.js— there's no matchingwp_enqueue_style.Verified in a built env: on the post editor the script loads but the stylesheet does not, so the Access Control panel loses its
width: 100%, FormTokenField help spacing, and ToggleControl spacing. Addwp_enqueue_style( 'newspack-content-gate-block-visibility', Newspack::plugin_url() . '/dist/content-gate-block-visibility.css', [], $asset['version'] );next to the script enqueue.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.
🤦♀️ Helps to actually enqueue the CSS to have it used. Thanks @adekbadek! This should be fixed in 4d466c6.