Hallo!
I have a question about the automatic joining of paragraphs when deleting text. The schema I use is something like the following:
paragraph: {
content: 'inline*',
group: 'block',
// ...
},
customBlock: {
content: 'block+',
group: 'block',
// ...
toDOM: function toDOM(node) {
return ['div', node.attrs, 0]
},
},
The schema allows for free paragraphs as well as paragraphs nested inside the customBlock.
While playing around with the editor I noticed the following behavior: if I have a free paragraph followed by a customBlock with a single nested paragraph and I select text from both the first and the nested paragraphs and hit the delete button then the remaining text of the first paragraph is joined with the remaining text of the nested paragraph and the customBlock is completely removed in the process. So let’s say that [
and ]
brackets mark the beginning and the end of a selection.
<p>one [two</p>
<div>
<p>three ]four</p>
</div>
“Delete” ->
<p>one four</p>
My question is: is there a way to keep the customBlock from being removed? Is it possible when hitting “Delete” to get this structure instead?
<p>one </p>
<div>
<p>four</p>
</div>
I tried setting defining: true
and isolating: true
to the customBlock node in the schema but it did not changed the behavior of the node so I guess they are used for different scenarios.
Best regards,
Ivan