No TinyMCE appears in gutenberg block but appears in sidebar edition
Foorinto opened this issue · 2 comments
Foorinto commented
Version
- Carbon Fields: 3.6
- WordPress: 6.5.2
- PHP: 8.3
Expected Behavior
TinyMCE displayed in the gutenberg block
Actual Behavior
TinyMCE is not displaying in the gutenberg block, I get no error, neither conflict but this warning in the console:
carbon-fields-core-css was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.
<link rel="stylesheet" id="carbon-fields-core-css" href="[pathToTheme]/vendor/htmlburger/carbon-fields/build/gutenberg/core.min.css?ver=3.6.3" media="all">
But it works in the sidebar when you visualize the block (eye icon)
Container definition
add_action('carbon_fields_register_fields', 'crb_attach_gutenberg_options');
function crb_attach_gutenberg_options() {
Block::make( __( 'My Shiny Gutenberg Block' ) )
->add_fields( array(
Field::make( 'text', 'heading', __( 'Block Heading' ) ),
Field::make( 'image', 'image', __( 'Block Image' ) ),
Field::make( 'rich_text', 'content', __( 'Block Content' ) ),
) )
->set_render_callback( function ( $fields, $attributes, $inner_blocks ) {
?>
<div class="block">
<div class="block__heading">
<h1><?php echo esc_html( $fields['heading'] ); ?></h1>
</div><!-- /.block__heading -->
<div class="block__image">
<?php echo wp_get_attachment_image( $fields['image'], 'full' ); ?>
</div><!-- /.block__image -->
<div class="block__content">
<?php echo apply_filters( 'the_content', $fields['content'] ); ?>
</div><!-- /.block__content -->
</div><!-- /.block -->
<?php
} );
}
Steps to Reproduce the Problem
- Intall carbon fields (composer require htmlburger/carbon-fields)
- Use rich_text in functions.php
Comments
Hello,
Maybe I'm missing something, but I can't find it. Can anyone help me ?
I also get the same issue than this threand on the forum:
https://community.carbonfields.net/t/adding-a-cf-block-to-a-core-group-block-removed-the-preview-button-from-toolbar/2140
Thanks in advance.