groups: wrap bare link in list-item in p node for better typography

This commit is contained in:
André Fincato 2022-04-30 13:03:58 +02:00
parent 2f7bc1e847
commit 4d80c3f2cd

View File

@ -187,8 +187,20 @@ function stitchInline(a: any, b: any) {
if (!a?.children) {
throw new Error('Bad stitchInline call: missing root');
}
const lastParaIdx = a.children.length - 1;
const last = a.children[lastParaIdx];
// wrap bare link in list-item inside a p node
// for better typography consistency
if (last?.type === 'listItem') {
if (last?.children.length === 0) {
last.children.push({
type: 'paragraph',
children: []
})
}
}
if (last?.children) {
const ros = {
...a,