I have a problem like this:
I am using TinyMCE v6. whenever I am using:
tinymce.get("html").getContent()
It always adds a <br>
tag after a line break.
So can someone help me disable the auto add <br>
tag after line break?
I have tried:
forced_root_block: false,
force_br_newlines: false,
force_p_newlines: false,
But it does not work in v6.
HERE IS MY CODE
tinymce.init({
selector: 'textarea#html',
plugins: 'anchor autolink charmap codesample emoticons image media code link lists searchreplace table visualblocks wordcount',
imagetools_cors_hosts: ['picsum.photos'],
menubar: 'file edit view insert format tools table help',
toolbar: 'undo redo | blocks fontfamily fontsize | bold italic underline strikethrough highlight custom | link image media code ruby table mergetags | align lineheight | tinycomments | numlist bullist indent outdent | emoticons charmap removeformat',
toolbar_sticky: true,
// toolbar_mode: 'floating',
toolbar_mode: 'wrap',
autosave_ask_before_unload: true,
paste_data_images: true,
autosave_interval: '30s',
autosave_retention: '2m',
height: 800,
statusbar: false,
forced_root_block: false,
force_br_newlines: false,
force_p_newlines: false,
extended_valid_elements: 'script[language|type|src]',
content_css: ['/dist/css/adminlte.min.css'],
content_css_cors: true,
importcss_append: true,
convert_urls: false
});
Really sorry for my bad English!!!
disable auto add <br>
tag after linebreak in TinyMCE v6
2
Answers
It seem that i have a missing a point in the question. I have copy code html then paste to tinymce like
But when i submit form and using getContent it still auto add
tag into my code. Anyone can help me
Set the newline behavior option to “block” to prevent any new line breaks from appearing in the editor when presssing the enter key:
you can use this option.
newline_behavior: ‘block’,
for more help check this documentation help page.
https://www.tiny.cloud/blog/remove-line-breaks/