aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/renderers
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/renderers')
-rw-r--r--frontend/src/components/renderers/Code.js4
-rw-r--r--frontend/src/components/renderers/Dispatch.js56
-rw-r--r--frontend/src/components/renderers/Latex.js15
3 files changed, 17 insertions, 58 deletions
diff --git a/frontend/src/components/renderers/Code.js b/frontend/src/components/renderers/Code.js
index 0c601b3..7c32c39 100644
--- a/frontend/src/components/renderers/Code.js
+++ b/frontend/src/components/renderers/Code.js
@@ -36,14 +36,14 @@ export const LANGS = Object.freeze({
})
const StyledPre = styled.pre`
- padding: 0 !important;
+ padding: calc(0.8em - 1px) !important;
margin: 0;
`
const CodeBlock = styled.div`
width: 100%;
font-size: 0.8em;
- padding: calc(0.8em - 1px) !important;
+ min-height: 1.2em;
border-radius: 3px;
border: 1px solid #565656;
outline: none;
diff --git a/frontend/src/components/renderers/Dispatch.js b/frontend/src/components/renderers/Dispatch.js
deleted file mode 100644
index fc80a47..0000000
--- a/frontend/src/components/renderers/Dispatch.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import React from 'react';
-import { FetchPaste } from '../../helpers/httpHelper'
-
-class Raw extends React.Component {
-
- constructor(props) {
- super(props);
- this.state = {
- content: '',
- };
- }
-
- render() {
- const styles = {
- wordWrap: "break-word",
- whiteSpace: "pre-wrap",
- lineHeight: "initial",
- fontSize: "0.8em",
- padding: "0 1em"
- }
-
- return (
- <pre style={styles}>
- {this.state.content}
- </pre>
- );
- }
-
- componentDidMount() {
- FetchPaste(this.props.hash)
- .then((response) => {
- const data = response.data
- this.setState({ content: data.content })
- }).catch((error) => {
- const resp = error.response
-
- // catch 401 unauth (password protected)
- if (resp.status === 401) {
- this.setState({ content: 'err: password protected' })
- return
- }
-
- // some weird err
- if (resp !== undefined) {
- const errTxt = `${resp.statusText}: ${resp.data}`
- this.setState({ content: errTxt })
- return
- }
-
- // some weird err (e.g. network)
- this.setState({ content: error })
- })
- }
-}
-
-export default Raw \ No newline at end of file
diff --git a/frontend/src/components/renderers/Latex.js b/frontend/src/components/renderers/Latex.js
index e69de29..299432e 100644
--- a/frontend/src/components/renderers/Latex.js
+++ b/frontend/src/components/renderers/Latex.js
@@ -0,0 +1,15 @@
+import React from 'react';
+import { BlockMath } from 'react-katex';
+import 'katex/dist/katex.min.css';
+
+class Latex extends React.Component {
+ render() {
+ return (
+ <BlockMath>
+ {this.props.content}
+ </BlockMath>
+ );
+ }
+}
+
+export default Latex \ No newline at end of file