Set fullscreen mode by default

Switching Gutenberg to fullscreen mode requires setting to TRUE fullscreenMode from the core/edit-post package. To enqueue appropriate script, you use enqueue_block_editor_assets action hook.

function se337302_fullscreen_editor()
{
    $js_code = "jQuery(document).ready(function(){" .
            "   var isFullScreenMode = wp.data.select('core/edit-post').isFeatureActive('fullscreenMode');" .
            "   if ( !isFullScreenMode )" .
            "       wp.data.dispatch('core/edit-post').toggleFeature('fullscreenMode');" .
            "});";
    wp_add_inline_script( 'wp-blocks', $js_code );

}
add_action( 'enqueue_block_editor_assets', 'se337302_fullscreen_editor' );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)