I have been trying to work with TinyMCE version 6 and I am struggling to prevent the addition of <br>
after each paragraph.
Whenever I insert a line of text and press enter, a new paragraph is created but there is always a <br>
added between them.
In the previous versions of TinyMCE, I used to include these two parameters:
- force_p_newlines = true;
- forced_root_block = false;
However, both of these parameters are now deprecated and I cannot find a way to achieve the same outcome.
The documentation states that force_p_newlines is no longer supported and that forced_root_block should be used instead. Even when setting forced_root_block: "p" (which should already be default), I see no changes.
I attempted to change the default tag from <p>
to <div>
, yet I still notice the presence of <br>
nested between the various <div>
in the output.
Here is my current initialization code:
tinymce.init({
selector:'#myTextarea',
plugins: "link",
toolbar: "undo redo | bold italic link ",
menubar: false,
forced_root_block: "p",
forced_root_block_attrs: {
class: "m-0",
},
force_br_newlines: false,
});
Additionally, I am utilizing bootstrap 5 and have utilized the forced_root_block_attrs attribute to remove margin from paragraphs by assigning the class "m-0" to all <p>
tags