Reputation: 15271
I'm trying to extend RemoveFormat
command to make it remove <br>
tags.
I've tried altering removefromat
format:
formats: {
removeformat: [
{
selector: 'br',
remove: 'all'
}
]
}
The code above for some reason removes
from blank lines <p> </p>
, this is not acceptable.
My second try was adding plugin and using editor.selection.getContent
/editor.selection.setContent
, but I can not find information how to restore selection with this approach.
Upvotes: 4
Views: 415
Reputation: 1046
When I configure my TinyMCE Editor like this it works for me:
valid_elements : '*[*]',
remove_trailing_brs: false,
formats: {
removeformat: [
{ selector: 'br', remove: 'all' }
]
}
Here is a codepen example for this: https://codepen.io/jonas_weinhardt/pen/oNwmpaz
Maybe its helps you with your problem.
Upvotes: 2