article block: more core block styles

This commit is contained in:
2026-02-05 11:59:32 +00:00
parent 9deb4a8f73
commit fccfad2c55
17 changed files with 85 additions and 27 deletions

View File

@@ -31,6 +31,11 @@ add_filter( 'block_categories_all' , __NAMESPACE__ . '\\add_categories' );
add_filter( 'badegg_block_types_allow', __NAMESPACE__ . '\\allowed_list' );
add_action( 'init', __NAMESPACE__ . '\\auto_register' );
/**
* Core Blocks
*/
add_filter( 'render_block_core/details', __NAMESPACE__ . '\\core_details_modified', 10, 2 );
function remove_action_block_inline()
{
@@ -251,3 +256,11 @@ function render_acf($block, $content = '', $is_preview = false, $post_id = 0, $w
<?php echo ob_get_clean();
}
}
function core_details_modified($content, $block)
{
$content = str_replace('</summary>', '</summary><div class="wp-block-details__inner inner inner-zero-x wysiwyg">', $content);
$content = str_replace('</details>', '</div></details>', $content);
return $content;
}

View File

@@ -1,4 +1,4 @@
@use "../global/fonts";
@use "../global/variables/fonts";
@use "../global/variables/colours";
button {

View File

@@ -1,4 +1,4 @@
@use "../global/fonts";
@use "../global/variables/fonts";
@use "../global/variables/breakpoints";
@use "../global/variables/colours";

View File

@@ -1,6 +1,3 @@
$font: "Ubuntu", Helvetica, Arial, sans-serif;
$blockquote: serif;
/*
* Roots Fonts Setup
* https://roots.io/sage/docs/fonts-setup/

View File

@@ -1,4 +1,4 @@
@use "fonts";
@use "variables/fonts";
@use "variables/breakpoints";
@use "variables/colours";
@use "variables/spacing";

View File

@@ -1,3 +1,4 @@
@use "variables/fonts";
@use "variables/colours";
@use "variables/breakpoints";
@use "variables/spacing";

View File

@@ -32,6 +32,11 @@ img {
transition: all 300ms ease;
}
video {
max-width: 100%;
height: auto;
}
img.lazy,
.lazy-bg,
.lazy-loaded {

View File

@@ -0,0 +1,2 @@
$font: "Ubuntu", Helvetica, Arial, sans-serif;
$blockquote: serif;

View File

@@ -12,16 +12,20 @@ domReady(() => {
return settings
}
wp.hooks.addFilter(
'blocks.registerBlockType',
'badegg/restrict-parent-blocks',
restrictEditorParentBlocks
);
const coreInnerBlocks = (settings, name) => {
if (['core/media-text', 'core/details', 'core/quote'].includes(name)) {
settings.allowedBlocks = [
'core/paragraph',
'core/heading',
'core/list',
];
}
return settings;
}
wp.hooks.addFilter( 'blocks.registerBlockType', 'badegg/restrict-parent-blocks', restrictEditorParentBlocks );
wp.hooks.addFilter( 'blocks.registerBlockType', 'badegg/core-inner-blocks', coreInnerBlocks );
// find blocks styles
wp.blocks.getBlockTypes().forEach((block) => {
if (_.isArray(block['styles'])) {
console.log('editor.js ' + block.name, _.pluck(block['styles'], 'name'));
}
});
});

View File

@@ -7,17 +7,16 @@
"core/media-text",
"core/audio",
"core/video",
"core/embed",
"core/footnotes",
"core/heading",
"core/list",
"core/code",
"core/details",
"core/list-item",
"core/missing",
"core/paragraph",
"core/quote",
"core/pullquote",
"core/table",
"core/verse"
]

View File

@@ -1,7 +1,4 @@
[
"core/media-text",
"core/details",
"core/quote",
"acf/badegg-editor",
"badegg/article"
]

View File

@@ -3,7 +3,6 @@
@use "../../../../css/global/variables/breakpoints";
@use "../../../../css/global/variables/spacing";
@use "../../../../css/global/variables/colours";
@use "../../../../css/global/fonts";
.wp-block-badegg-article {
container-name: BadEggArticle;

View File

@@ -0,0 +1,17 @@
@use "../../../../css/global/variables/colours";
@use "../../../../css/global/variables/fonts";
.wp-block-details {
summary {
font-family: fonts.$font;
font-weight: bold;
}
@media screen {
.knockout & {
summary {
color: colours.$white;
}
}
}
}

View File

@@ -0,0 +1,10 @@
.wp-block-badegg-article {
.is-type-video {
iframe {
display: block;
width: 100%;
height: auto;
aspect-ratio: 16 / 9;
}
}
}

View File

@@ -1,7 +1,7 @@
@use "../../../../css/global/variables/breakpoints";
@use "../../../../css/global/variables/spacing";
@use "../../../../css/global/variables/colours";
@use "../../../../css/global/fonts";
@use "../../../../css/global/variables/fonts";
.wp-block-badegg-article {
.wp-block-pullquote blockquote,

View File

@@ -0,0 +1,14 @@
@use "../../../../css/global/variables/colours";
@use "../../../../css/global/variables/fonts";
.wp-block-verse {
font-family: fonts.$font;
line-height: 2;
word-wrap: normal;
@media screen {
.knockout & {
color: colours.$white;
}
}
}

View File

@@ -1,8 +1,8 @@
@use 'css/base';
@use 'css/image';
@use 'css/gallery';
@use 'css/media-text';
@use 'css/quote';
@use 'css/embed';
@use 'css/verse';
@use 'css/details';