Skip to content

Commit

Permalink
feat: distinguish between rendered embedded and others
Browse files Browse the repository at this point in the history
Non-rendered embedded such as `svg` will now be translated to TEmpty,
causing a warning in the logbox.
  • Loading branch information
jsamr committed Jun 4, 2021
1 parent 7b34d1d commit 02024e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/render-html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
]
},
"dependencies": {
"@native-html/transient-render-engine": "3.9.1",
"@native-html/transient-render-engine": "4.0.0",
"@types/ramda": "^0.27.32",
"ramda": "^0.27.1",
"stringify-entities": "^3.1.0"
Expand Down
14 changes: 10 additions & 4 deletions packages/render-html/src/TNodeRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ const TNodeRenderer: React.FunctionComponent<TNodeRendererProps<
childrenProps as TNodeGenericRendererProps<TText>
);
}
if (tnode instanceof TEmpty && tnode.isUnregistered && __DEV__) {
console.warn(
`There is no custom renderer registered for tag "${tnode.tagName}". The tag will not be rendered.`
);
if (tnode instanceof TEmpty && __DEV__) {
if (tnode.isUnregistered) {
console.warn(
`There is no custom renderer registered for tag "${tnode.tagName}" which is not part of the HTML5 standard. The tag will not be rendered.`
);
} else {
console.warn(
`The "${tnode.tagName}" tag is a valid HTML element but is not handled by this library. You must register a custom renderer or plugin and make sure its content model is not set to "none".`
);
}
}
return null;
};
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2922,9 +2922,9 @@ __metadata:
languageName: node
linkType: hard

"@native-html/transient-render-engine@npm:3.9.1":
version: 3.9.1
resolution: "@native-html/transient-render-engine@npm:3.9.1"
"@native-html/transient-render-engine@npm:4.0.0":
version: 4.0.0
resolution: "@native-html/transient-render-engine@npm:4.0.0"
dependencies:
"@native-html/css-processor": 1.6.1
"@types/ramda": ^0.27.32
Expand All @@ -2933,7 +2933,7 @@ __metadata:
peerDependencies:
"@types/react-native": "*"
react-native: ^0.63.0
checksum: b79a3a0952dd1178fee2394a51ce782d938b080c76e1ca64d8369fbf8fa597cef279fdc6b37cea422a0fa5df77b1ebe9d79a6663ce6df8cee914cb89d3ce14cf
checksum: c6e43f0474ae405258616bb1ea78a24d6ac5a166ee812cda6ca2026edcd51e126ec68aa768a2a5999f9552cf5e5a485d359ee33e52a39f7541cd7a184397e76a
languageName: node
linkType: hard

Expand Down Expand Up @@ -14287,7 +14287,7 @@ fsevents@^1.2.7:
"@babel/preset-react": ^7.12.7
"@babel/preset-typescript": ^7.12.1
"@babel/runtime": ^7.12.5
"@native-html/transient-render-engine": 3.9.1
"@native-html/transient-render-engine": 4.0.0
"@react-native-community/bob": ^0.16.2
"@release-it/conventional-changelog": ^2.0.0
"@types/jest": ^26.0.14
Expand Down

0 comments on commit 02024e3

Please sign in to comment.