From 3d83325afc5cd2497452802430bc591726dd5c3f Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Tue, 1 Aug 2017 21:39:13 -0400 Subject: [PATCH] add node type check to avoid errors in rte --- src/components/Widgets/Markdown/serializers/remarkSlate.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Widgets/Markdown/serializers/remarkSlate.js b/src/components/Widgets/Markdown/serializers/remarkSlate.js index 0064365e..321f0e89 100644 --- a/src/components/Widgets/Markdown/serializers/remarkSlate.js +++ b/src/components/Widgets/Markdown/serializers/remarkSlate.js @@ -69,14 +69,15 @@ function convertMarkNode(node, parentMarks = []) { * Add the current node's mark type to the marks collected from parent * 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. */ 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