fix(client): return an empty string for empty sections

This commit is contained in:
Valeriy S
2019-02-18 12:43:09 +03:00
committed by Stuart Taylor
parent cd501ee4c5
commit 6d5e3865e7
3 changed files with 15 additions and 10 deletions

View File

@ -62,7 +62,12 @@ function textToData(sectionIds) {
}
}
});
const textArray = toHTML({ ...node, children: newChildren });
const hasData = newChildren.some(
node => node.type !== 'text' || !/^\s*$/.test(node.value)
);
const textArray = hasData
? toHTML({ ...node, children: newChildren })
: '';
file.data = {
...file.data,
[sectionId]: textArray