How to reproduce:
- in javascript console, set html to
asdf. My code is something like:editor.setEditorValue('asdf') - toggle into source mode
- I see
<p>asdf</p>. I expect to see onlyasdf.
Attempted solutions
- Configure
enter: 'br'
This does actually work, solves the problem. But introduces a new problem, which is I want the HTML to be <p></p> when the user creates a new paragraph.
- Configure
enter: 'br'withenterBlock: 'p'
doesn't change anything from #1.
I think I solved it. Maybe someone can help me verify.
I initialized editor with
enter: 'br'. This prevents the editor from adding 'p' to every non-p wrapped element.Then when I set the HTML of the editor, I make sure to edit the options
editor.options.enter = 'p'so that new blocks are paragraphs.Weirdly, when I set the HTML again (even with enter = 'p'), Jodit respects the HTML and doesn't add extra paragraph tags to elements without a wrapper