When using tinyMce in WordPress, In the visual editor, I’f I’m entering content in an element and press return the classes from the parent element are copied over, i would want simply to create a new <p>
element.
For example, I’m editing
<p class="blip blip--gray one-sixth push-huge--top push--bottom">d aasdas d</p>
Then i press return and the following is added:
<p class="blip blip--gray one-sixth push-huge--top push--bottom"></p>
where i would want only to add
<p></p>
I have forced_root_block
option set to p
This is tinymce default behaviour.
You could add a tinymce handler to your editor that gets triggered by the
keyup
event. Testing forcharCode 13
you can detect if ENTER has been pressed. If so you could remove the classes from the actual paragraph in the editor:This might be the solution to this problem:
tinymce – content filtering docs
The complete answer, based on @thariama post is