Function: isImageTag()
isImageTag(
node,options):string|boolean
Defined in: packages/core/src/dom/index.ts:141
Checks if the provided node is an valid image tag
This function expects to be used with DOMNode objects from html-react-parser, which is
the underlying parser used by BlocksRenderer.
Usage
import { isImageTag, ImageBlock } from '@headstartwp/core';
import { ImageComponent } from '@10up/headless-next';
<BlocksRenderer html={html}>
<ImageBlock
test={(node) => isImageTag(node, { hasDimensions: true})}
component={ImageComponent}
/>
</BlocksRenderer>
Parameters
node
The node to test
options
isImageTagOptions = {}
Supported options.
Returns
string | boolean
Whether it's an image tag or not according to the options passed