Skip to content

Commit

Permalink
provide reasonable defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
jasperhuangg committed Nov 8, 2023
1 parent 01759d1 commit 97d9087
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/HTMLEngineProvider/htmlEngineUtils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import lodashGet from 'lodash/get';

const MAX_IMG_DIMENSIONS = 512;

/**
Expand Down Expand Up @@ -52,7 +54,7 @@ function isChildOfNode(tnode, predicate) {
* @returns {Boolean}
*/
function isChildOfComment(tnode) {
return isChildOfNode(tnode, (node) => isCommentTag(node.domNode.name));
return isChildOfNode(tnode, (node) => isCommentTag(lodashGet(node, 'domNode.name', '')));
}

/**
Expand All @@ -62,7 +64,7 @@ function isChildOfComment(tnode) {
* @returns {Boolean}
*/
function isChildOfH1(tnode) {
return isChildOfNode(tnode, (node) => node.domNode.name.toLowerCase() === 'h1');
return isChildOfNode(tnode, (node) => lodashGet(node, 'domNode.name', '').toLowerCase() === 'h1');
}

export {computeEmbeddedMaxWidth, isChildOfComment, isCommentTag, isChildOfH1};

0 comments on commit 97d9087

Please sign in to comment.