Closed KimDongUk93 closed 2 months ago
Summernote and no other HTML tool ever generate the code
<p></p><br>
However, there is generally a possibility that a picture insert happens outside of the editable area. There should be a test, and your given code is a simple, reproducible test case.
The content isn't added outside the editor, it's added outside of the editable area. Not sure why though, it's definitely something to investigate.
We added the following check to createFromSelection
:
if(!$(sc).closest(".note-editable").length) {return null;}
Summernote and no other HTML tool ever generate the code
<p></p><br>
However, there is generally a possibility that a picture insert happens outside of the editable area. There should be a test, and your given code is a simple, reproducible test case.
<p></p>
<br>
<img src=“…”>
<p></p>
here is my customer code
i think the reason of this error is p tag is duplicated isnt?
The p tag should have content.
@1der1 is correct, the <p/>
being empty isn't helping the issue. You can have images outside of the paragraph tag, and ideally, within a <figure/>
parent element, it's not paramount, but rather good practise, as it helps screen readers distinguish between different content elements for accessibility.
Also, to note, some of the placement, or rather changing of placement, like auto closing tags, is handled via the Browser, more so than the Summernote API, which explains why we often have inconsistencies between behaviours depending on the Browser being used.
Checklist
Steps to reproduce
https://summernote.org/
<p></p>{enter}<br>
2 image
4 image
Expected behavior
image must be in .note-editable
Current behavior
image is not insert .note-editable
Minimal example reproducing the issue
No response
Environment