Skip to content

Commit 5ba6816

Browse files
author
정호석
committed
mobile margin removed
1 parent 43e140e commit 5ba6816

File tree

5 files changed

+37
-18
lines changed

5 files changed

+37
-18
lines changed

Diff for: package-lock.json

+8-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
"@material-ui/core": "^3.9.3",
1010
"@material-ui/icons": "^3.0.2",
1111
"apexcharts": "^3.6.6",
12+
"classnames": "^2.2.6",
1213
"dompurify": "^1.0.10",
1314
"insert-text-at-cursor": "^0.1.2",
1415
"katex": "^0.10.1",
1516
"markdown-it": "^8.4.2",
1617
"markdown-it-anchor": "^5.0.2",
17-
"markdown-it-apexcharts": "^0.1.3",
18+
"markdown-it-apexcharts": "^0.2.1",
1819
"markdown-it-footnote": "^3.0.1",
20+
"mdi-material-ui": "^5.11.0",
1921
"react": "^16.8.6",
2022
"react-app-polyfill": "^1.0.0",
2123
"react-dom": "^16.8.6",

Diff for: src/component/PreviewArea.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
1-
import React, {useEffect} from 'react';
1+
import React, { useEffect } from 'react';
22
import MarkdownIt from 'markdown-it';
33
import MarkdownItKatex from '@liradb2000/markdown-it-katex';
44
import MarkdownItAnchor from 'markdown-it-anchor';
55
import MarkdownItToc from '@liradb2000/markdown-it-toc-done-right';
66
import uslug from 'uslug';
7-
import MarkdownItApexCharts , {ApexRender} from 'markdown-it-apexcharts';
7+
import MarkdownItApexCharts, { ApexRender } from 'markdown-it-apexcharts';
88
import MarkdownItMermaid from '@liradb2000/markdown-it-mermaid';
99
import '../css/MarkDown.css';
1010
import DOMPurify from 'dompurify';
1111
import MarkdownItFootnote from 'markdown-it-footnote';
1212

13-
13+
import { withStyles } from '@material-ui/core/styles';
14+
import classNames from 'classnames'
1415

1516

1617
const uslugify = s => uslug(s);
1718

19+
const styles = theme => ({
20+
preview: {
21+
margin: "50px 100px",
22+
[theme.breakpoints.down('xs')]: {
23+
margin: "0px 0px",
24+
},
25+
},
26+
});
27+
1828
const renderMarkdown = (text) => {
1929

20-
30+
2131
var md = MarkdownIt({
2232
html: false,
2333
linkify: true,
2434
typographer: true,
2535
breaks: true,
2636
xhtmlOut: false,
2737
});
28-
md.use(MarkdownItKatex).use(MarkdownItAnchor,{
38+
md.use(MarkdownItKatex).use(MarkdownItAnchor, {
2939
level: [1, 2, 3],
3040
slugify: uslugify,
3141
permalink: true,
@@ -34,26 +44,27 @@ const renderMarkdown = (text) => {
3444
permalinkSymbol: 'link',
3545
permalinkBefore: false,
3646
}).use(MarkdownItToc, {
37-
level: [1,2],
47+
level: [1, 2],
3848
slugify: uslugify,
3949
}).use(MarkdownItMermaid).use(MarkdownItFootnote).use(MarkdownItApexCharts)
4050
//.use(MarkdownItApex).use(MarkdownItMarkvis);
4151
//return md.render(text? (text): "", {d3})
42-
43-
return md.render(text? (text): "")
52+
53+
return md.render(text ? (text) : "")
4454
}
4555

4656
const PreviewArea = props => {
47-
48-
useEffect(()=>{
49-
ApexRender();
57+
const { classes } = props;
58+
59+
useEffect(() => {
60+
ApexRender();
5061
})
5162

5263

5364
return (
54-
<div className="markdown-body" dangerouslySetInnerHTML={{__html:DOMPurify.sanitize(renderMarkdown(props.text))}}></div>
65+
<div className={classNames("markdown-body", classes.preview)} dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(renderMarkdown(props.text)) }}></div>
5566
// <div className="markdown-body" dangerouslySetInnerHTML={{__html:renderMarkdown(props.text)}}></div>
5667
)
5768
}
5869

59-
export default PreviewArea;
70+
export default withStyles(styles)(PreviewArea);

Diff for: src/component/TextArea.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import TextField from '@material-ui/core/TextField';
3-
import Resizable from 're-resizable';
3+
44
import { withStyles } from '@material-ui/core/styles';
55

66
const SouthEastArrow = () => (

Diff for: src/css/MarkDown.css

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
font-size: 16px;
3636
line-height: 1.5;
3737
word-wrap: break-word;
38+
/* for mobile support , below code is moved to component style ... */
3839
margin: 50px 100px;
3940
}
4041

0 commit comments

Comments
 (0)