import { Tooltip } from '@blueprintjs/core'; import type { Spectrum } from '@zakodium/nmrium-core'; import dlv from 'dlv'; import type { HTMLAttributes } from 'react'; interface RenderAsHTMLProps { data: Spectrum; jpath: string | string[]; } interface HTMLContentProps extends HTMLAttributes { html: string; } function HTMLContent({ html }: HTMLContentProps) { return ( // eslint-disable-next-line @eslint-react/dom-no-dangerously-set-innerhtml
); } export function RenderAsHTML(props: RenderAsHTMLProps) { const { data, jpath } = props; const value = dlv(data, jpath); if (typeof value !== 'string') { return value; } const formattedHTML = formatValueAsHTML(value); return ( } renderTarget={({ isOpen, ...targetProps }) => { return (
); }} /> ); } function formatValueAsHTML(value: string) { return value.replaceAll(/(?\d+)/g, '$'); }