This commit is contained in:
James
2022-08-15 18:41:34 -07:00
parent f8365abf1b
commit a3edbf4fef

View File

@@ -10,7 +10,6 @@ const ELEMENT_TAGS = {
H4: () => ({ type: 'h4' }),
H5: () => ({ type: 'h5' }),
H6: () => ({ type: 'h6' }),
IMG: (el) => ({ type: 'image', url: el.getAttribute('src') }),
LI: () => ({ type: 'li' }),
OL: () => ({ type: 'ol' }),
P: () => ({ type: 'p' }),
@@ -47,10 +46,15 @@ const deserialize = (el) => {
) {
[parent] = el.childNodes;
}
const children = Array.from(parent.childNodes)
let children = Array.from(parent.childNodes)
.map(deserialize)
.flat();
if (children.length === 0) {
children = [{ text: '' }];
}
if (el.nodeName === 'BODY') {
return jsx('fragment', {}, children);
}