add node type check to avoid errors in rte

This commit is contained in:
Shawn Erquhart
2017-08-01 21:39:13 -04:00
parent 2bb67321f9
commit 3d83325afc

View File

@ -69,14 +69,15 @@ function convertMarkNode(node, parentMarks = []) {
* Add the current node's mark type to the marks collected from parent * Add the current node's mark type to the marks collected from parent
* mark nodes, if any. * mark nodes, if any.
*/ */
const marks = [...parentMarks, { type: markMap[node.type] }]; const markType = markMap[node.type];
const marks = markType ? [...parentMarks, { type: markMap[node.type] }] : parentMarks;
/** /**
* Set an array to collect sections of text. * Set an array to collect sections of text.
*/ */
const ranges = []; const ranges = [];
node.children.forEach(childNode => { node.children && node.children.forEach(childNode => {
/** /**
* If a text node is a direct child of the current node, it should be * If a text node is a direct child of the current node, it should be