@hedgedoc/html-to-react
Version:
Parse HTML into React components
19 lines • 632 B
JavaScript
import React from 'react';
import { generatePropsFromAttributes } from '../utils/generatePropsFromAttributes.js';
import { isText } from 'domhandler';
import { isTag } from 'domhandler';
export function processStyleNode(node, index) {
if (!isTag(node)) {
return null;
}
let styles;
if (node.children.length > 0) {
const subNode = node.children[0];
if (isText(subNode)) {
styles = subNode.data;
}
}
const props = generatePropsFromAttributes(node.attribs, index);
return React.createElement('style', props, styles);
}
//# sourceMappingURL=ProcessStyleNode.js.map