Use ENTER, not SHIFT+ENTER to Insert Line Break in WP editor

I would like to use ENTER button to insert line break, not SHIFT + ENTER by default. I added this code into function.php. It works but the problem is the text-align buttons are not working. When I click on any text align button, nothing happens. The text align buttons in Both Wordpress editor and TinyMCE Advance plugin editor are not working. But when I remove the code, it comes back normal. How can I solve this issue?

 /* Filter Tiny MCE Default Settings */
 add_filter( 'tiny_mce_before_init', 'my_switch_tinymce_p_br' );
 /**
     Switch Default Behaviour in TinyMCE to use "br"
     On Enter instead of "p"
     @link https://shellcreeper.com/?p=1041
     @link http://codex.wordpress.org/Plugin_API/Filter_Reference/tiny_mce_before_init
     @link http://www.tinymce.com/wiki.php/Configuration:forced_root_block
 */
 function my_switch_tinymce_p_br( $settings ) {
     $settings['forced_root_block'] = false;
     return $settings;
 }

Topic wp-editor line-breaks Wordpress

Category Web


While i didn't exactly look into TinyMCEs code, my assumption is the following: Without using the above code, TinyMCE closes the active p-tag and opens another one on pressing Enter. When you use the above code, this is replaced by NOT opening any p-tags and just inserting
tags when you press Enter.

The Alignment-Buttons probably try to find the p-tag, which encase the current text and add an style-tag (text-align:left). As there is no p-tag, the style can not be added and the text-align buttons "do not work".

IF it is like this, there is no way of "repairing" this behaviour without pretty much editing TinyMCE.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.