I would like to create a custom schema that allows to wrap all kinds of nodes. It should be possible to insert both inline nodes and block nodes without inserting additional empty lines. My previous definition looks like this:
{
content: 'inline*',
attrs: extra.defaults(),
parseDOM: [
{
tag: 'tb',
getAttrs: (node) => ({
...extra.parse(node),
}),
},
],
toDOM: (node) => ['tb', extra.dom(node), 0],
}
The biggest problem with this definition is that nodes like the following do work:
<tb><p>This is inline</p></tb>
(also possible without
tags)
but the display of multiline texts fails:
<tb><p>first line</p><p>second line</p></tb>
The result looks like:
first linesecondline
instead of the desired outcome:
first line line break
second line
I already tried to replace the content: ‘inline*’ with ‘(text | hardBreak)*’ as both tags are marked as an inline node. My input dom looks like <tb><text>first line</text><br><text>second line</text></tb>
. In this case only the first line is part of the output.