import { NamedPage } from 'vj/misc/Page'; import load from 'vj/components/wastyle/index'; import code from 'vj/components/highlighter/code-example'; import i18n from 'vj/utils/i18n'; import tpl from 'vj/utils/tpl'; const page = new NamedPage('home_preference', async () => { async function mountComponent() { const [{ default: prismjs }, [success, format], React, { render }] = await Promise.all([ import('vj/components/highlighter/prismjs'), load(), import('react'), import('react-dom'), ]); class AstylePreview extends React.PureComponent { constructor(props) { super(props); this.state = { value: UserContext.astyleOptions }; [this.success, this.preview] = format(code, `${this.state.value.trim()} mode=c`); this.state.highlight = this.success ? prismjs.highlight(this.preview, prismjs.Prism.languages.cpp, 'C++') : prismjs.highlight(this.preview, prismjs.Prism.languages.cpp, 'C++'); } render() { return ( <>