You could use PluginPrePublishPanel
to check for the title and lock publishing if it’s empty. Have a look at the accepted answer here for an example of locking the post – Add pre-publish conditions to the block editor
For your example you could modify the checking portion as follows:
const { registerPlugin } = wp.plugins;
const { PluginPrePublishPanel } = wp.editPost;
const { select, dispatch } = wp.data;
const { count } = wp.wordcount;
const { serialize } = wp.blocks;
const { PanelBody } = wp.components;
const PrePublishCheckList = () => {
let lockPost = false;
let message="";
// Get title
const postTitle = select( 'core/editor' ).getEditedPostAttribute( 'title' );
if ( postTitle === '' ) {
lockPost = true;
message="Post Title is required!";
}
// Do we need to lock the post?
if ( lockPost === true ) {
dispatch( 'core/editor' ).lockPostSaving();
} else {
dispatch( 'core/editor' ).unlockPostSaving();
}
return (
<PluginPrePublishPanel title={ 'Publish Checklist' }>
<p>{message}</p>
</PluginPrePublishPanel>
)
};
registerPlugin( 'pre-publish-checklist', { render: PrePublishCheckList }
Hope this helps!