diff options
| author | jackyzha0 <[email protected]> | 2020-05-22 23:53:55 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-05-22 23:53:55 -0700 |
| commit | 418fbb8817dc22c6235811d256137139c70023b6 (patch) | |
| tree | c38ad0af5f4814072ca7dcd0ce8f49ebdd5eb23f /frontend/src/components | |
| parent | add preview panel (diff) | |
| download | ctrl-v-418fbb8817dc22c6235811d256137139c70023b6.tar.xz ctrl-v-418fbb8817dc22c6235811d256137139c70023b6.zip | |
latex live preview
Diffstat (limited to 'frontend/src/components')
| -rw-r--r-- | frontend/src/components/NewPaste.js | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/frontend/src/components/NewPaste.js b/frontend/src/components/NewPaste.js index e1075c4..615dc2a 100644 --- a/frontend/src/components/NewPaste.js +++ b/frontend/src/components/NewPaste.js @@ -7,6 +7,7 @@ import PasteModal from './modals/PasteModal' import { LANGS } from './renderers/Code' import styled from 'styled-components' import CodeRenderer from './renderers/Code' +import Latex from './renderers/Latex' const Button = styled.button` margin-right: 0 !important; @@ -29,6 +30,11 @@ const FlexRight = styled.div` margin-left: 2em; ` +const LatexWrapper = styled.div` + margin-top: 2em; + margin-bottom: 2em; +` + class NewPaste extends React.Component { constructor(props) { super(props); @@ -103,10 +109,22 @@ class NewPaste extends React.Component { maxLength="100000" id="pasteInput" /> - const preview = <CodeRenderer - lang={this.state.language} - theme='atom' - content={this.state.content} /> + var preview + switch (this.state.language) { + case 'latex': + preview = + <LatexWrapper> + <Latex + content={this.state.content} /> + </LatexWrapper> + break + default: + preview = + <CodeRenderer + lang={this.state.language} + theme='atom' + content={this.state.content} /> + } if (this.state.preview) { return ( |