META-INF.resources.frontend.react-syntax-highlighter-prism.tsx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of syntax-highlighter-addon Show documentation
Show all versions of syntax-highlighter-addon Show documentation
Syntax Highlighter Add-on for Vaadin Flow
The newest version!
import {type ReactElement} from 'react';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import * as styles from 'react-syntax-highlighter/dist/esm/styles/prism';
import {ReactAdapterElement, type RenderHooks} from "Frontend/generated/flow/ReactAdapter";
import React from 'react';
class SyntaxHighlighterPrismElement extends ReactAdapterElement {
protected override render(hooks: RenderHooks): ReactElement | null {
const [language] = hooks.useState("language");
const [content] = hooks.useState("content");
const [stylename] = hooks.useState("stylename");
const [showLineNumbers] = hooks.useState("showLineNumbers");
const [wrapLongLines] = hooks.useState("wrapLongLines");
return
{content}
;
}
}
customElements.define("syntax-highlighter-prism",SyntaxHighlighterPrismElement);