Showing
4 changed files
with
112 additions
and
65 deletions
... | @@ -206,24 +206,9 @@ const Home = ({history}) => { | ... | @@ -206,24 +206,9 @@ const Home = ({history}) => { |
206 | } | 206 | } |
207 | }, | 207 | }, |
208 | }, | 208 | }, |
209 | + | ||
209 | { | 210 | { |
210 | - title: 'Mathcha', | 211 | + title: 'Editing Image', |
211 | - dataIndex: 'mathcharFileName', | ||
212 | - render: (value, row) => { | ||
213 | - if(value){ | ||
214 | - return ( | ||
215 | - <a href={`${host}/mathchaDownload/${value}`}> | ||
216 | - <DownloadOutlined/> | ||
217 | - </a> | ||
218 | - | ||
219 | - ); | ||
220 | - }else{ | ||
221 | - return <span>-</span> | ||
222 | - } | ||
223 | - }, | ||
224 | - }, | ||
225 | - { | ||
226 | - title: 'TikZ', | ||
227 | dataIndex: 'tex', | 212 | dataIndex: 'tex', |
228 | render:(value, row) => { | 213 | render:(value, row) => { |
229 | if(value){ | 214 | if(value){ | ... | ... |
... | @@ -218,8 +218,8 @@ const Html = ({ visible, onCancel, callback }) => { | ... | @@ -218,8 +218,8 @@ const Html = ({ visible, onCancel, callback }) => { |
218 | }, | 218 | }, |
219 | ]}> | 219 | ]}> |
220 | <Select onChange={onChangeTypeSol}> | 220 | <Select onChange={onChangeTypeSol}> |
221 | - <Option value="오지선다형">JPEG</Option> | 221 | + <Option value="JPEG">JPEG</Option> |
222 | - <Option value="단답형">PNG</Option> | 222 | + <Option value="PNG">PNG</Option> |
223 | 223 | ||
224 | </Select> | 224 | </Select> |
225 | </Form.Item> | 225 | </Form.Item> | ... | ... |
... | @@ -4,7 +4,8 @@ import { UploadOutlined, RetweetOutlined } from '@ant-design/icons'; | ... | @@ -4,7 +4,8 @@ import { UploadOutlined, RetweetOutlined } from '@ant-design/icons'; |
4 | import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css'; | 4 | import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css'; |
5 | import { getTexToSvg, checkQno, saveFileAndQno } from '../lib/api/tikz'; // Request api | 5 | import { getTexToSvg, checkQno, saveFileAndQno } from '../lib/api/tikz'; // Request api |
6 | import TikzForm from '../component/tikzForm'; | 6 | import TikzForm from '../component/tikzForm'; |
7 | - | 7 | +import 'tui-image-editor/dist/tui-image-editor.css' |
8 | +import ImageEditor from '@toast-ui/react-image-editor' | ||
8 | 9 | ||
9 | 10 | ||
10 | const fetchTexToSvg = async (data) => { | 11 | const fetchTexToSvg = async (data) => { |
... | @@ -187,7 +188,7 @@ const fetchCheckQno = async(qno) => { | ... | @@ -187,7 +188,7 @@ const fetchCheckQno = async(qno) => { |
187 | console.log(values); | 188 | console.log(values); |
188 | console.log(qnoCheck); | 189 | console.log(qnoCheck); |
189 | if(!qnoCheck){ | 190 | if(!qnoCheck){ |
190 | - message.warning("문제 번호를 확인해 주세요.") | 191 | + message.warning("그림 번호를 확인해 주세요.") |
191 | return; | 192 | return; |
192 | }else{ | 193 | }else{ |
193 | const creator = sessionStorage.getItem('id'); | 194 | const creator = sessionStorage.getItem('id'); |
... | @@ -223,9 +224,84 @@ const fetchCheckQno = async(qno) => { | ... | @@ -223,9 +224,84 @@ const fetchCheckQno = async(qno) => { |
223 | setFields([...fields, {name:['typeQue'],value:value}]) | 224 | setFields([...fields, {name:['typeQue'],value:value}]) |
224 | } | 225 | } |
225 | 226 | ||
227 | + const myTheme = { | ||
228 | + 'common.bi.image': 'https://uicdn.toast.com/toastui/img/tui-image-editor-bi.png', | ||
229 | +'common.bisize.width': '251px', | ||
230 | +'common.bisize.height': '21px', | ||
231 | +'common.backgroundImage': 'none', | ||
232 | +'common.backgroundColor': '#1e1e1e', | ||
233 | +'common.border': '0px', | ||
234 | + | ||
235 | +// header | ||
236 | +'header.backgroundImage': 'none', | ||
237 | +'header.backgroundColor': 'transparent', | ||
238 | +'header.border': '0px', | ||
239 | + | ||
240 | +// load button | ||
241 | +'loadButton.backgroundColor': '#fff', | ||
242 | +'loadButton.border': '1px solid #ddd', | ||
243 | +'loadButton.color': '#222', | ||
244 | +'loadButton.fontFamily': 'NotoSans, sans-serif', | ||
245 | +'loadButton.fontSize': '12px', | ||
246 | + | ||
247 | +// download button | ||
248 | +'downloadButton.backgroundColor': '#fdba3b', | ||
249 | +'downloadButton.border': '1px solid #fdba3b', | ||
250 | +'downloadButton.color': '#fff', | ||
251 | +'downloadButton.fontFamily': 'NotoSans, sans-serif', | ||
252 | +'downloadButton.fontSize': '12px', | ||
253 | + | ||
254 | +// icons default | ||
255 | +'menu.normalIcon.color': '#8a8a8a', | ||
256 | +'menu.activeIcon.color': '#555555', | ||
257 | +'menu.disabledIcon.color': '#434343', | ||
258 | +'menu.hoverIcon.color': '#e9e9e9', | ||
259 | +'submenu.normalIcon.color': '#8a8a8a', | ||
260 | +'submenu.activeIcon.color': '#e9e9e9', | ||
261 | + | ||
262 | +'menu.iconSize.width': '24px', | ||
263 | +'menu.iconSize.height': '24px', | ||
264 | +'submenu.iconSize.width': '32px', | ||
265 | +'submenu.iconSize.height': '32px', | ||
266 | + | ||
267 | +// submenu primary color | ||
268 | +'submenu.backgroundColor': '#1e1e1e', | ||
269 | +'submenu.partition.color': '#858585', | ||
270 | + | ||
271 | +// submenu labels | ||
272 | +'submenu.normalLabel.color': '#858585', | ||
273 | +'submenu.normalLabel.fontWeight': 'lighter', | ||
274 | +'submenu.activeLabel.color': '#fff', | ||
275 | +'submenu.activeLabel.fontWeight': 'lighter', | ||
276 | + | ||
277 | +// checkbox style | ||
278 | +'checkbox.border': '1px solid #ccc', | ||
279 | +'checkbox.backgroundColor': '#fff', | ||
280 | + | ||
281 | +// rango style | ||
282 | +'range.pointer.color': '#fff', | ||
283 | +'range.bar.color': '#666', | ||
284 | +'range.subbar.color': '#d1d1d1', | ||
285 | + | ||
286 | +'range.disabledPointer.color': '#414141', | ||
287 | +'range.disabledBar.color': '#282828', | ||
288 | +'range.disabledSubbar.color': '#414141', | ||
289 | + | ||
290 | +'range.value.color': '#fff', | ||
291 | +'range.value.fontWeight': 'lighter', | ||
292 | +'range.value.fontSize': '11px', | ||
293 | +'range.value.border': '1px solid #353535', | ||
294 | +'range.value.backgroundColor': '#151515', | ||
295 | +'range.title.color': '#fff', | ||
296 | +'range.title.fontWeight': 'lighter', | ||
297 | + | ||
298 | +// colorpicker style | ||
299 | +'colorpicker.button.border': '1px solid #1e1e1e', | ||
300 | +'colorpicker.title.color': '#fff' | ||
301 | +}; | ||
226 | return ( | 302 | return ( |
227 | <Drawer | 303 | <Drawer |
228 | - title={'Tikz Editor'} | 304 | + title={'Image Editor'} |
229 | placement={'bottom'} | 305 | placement={'bottom'} |
230 | closable={true} | 306 | closable={true} |
231 | height={'90vh'} | 307 | height={'90vh'} |
... | @@ -245,6 +321,30 @@ const fetchCheckQno = async(qno) => { | ... | @@ -245,6 +321,30 @@ const fetchCheckQno = async(qno) => { |
245 | onChangeTypeQue={onChangeTypeQue} | 321 | onChangeTypeQue={onChangeTypeQue} |
246 | qno={qno}> | 322 | qno={qno}> |
247 | </TikzForm> | 323 | </TikzForm> |
324 | + <ImageEditor | ||
325 | + includeUI={{ | ||
326 | + loadImage: { | ||
327 | + path: 'img/sampleImage.jpg', | ||
328 | + name: 'SampleImage' | ||
329 | + }, | ||
330 | + theme: myTheme, | ||
331 | + menu: ['shape', 'filter'], | ||
332 | + initMenu: 'filter', | ||
333 | + uiSize: { | ||
334 | + width: '1000px', | ||
335 | + height: '700px' | ||
336 | + }, | ||
337 | + menuBarPosition: 'bottom' | ||
338 | + }} | ||
339 | + cssMaxHeight={500} | ||
340 | + cssMaxWidth={700} | ||
341 | + selectionStyle={{ | ||
342 | + cornerSize: 20, | ||
343 | + rotatingPointOffset: 70 | ||
344 | + }} | ||
345 | + usageStatistics={true} | ||
346 | + /> | ||
347 | + | ||
248 | </Drawer> | 348 | </Drawer> |
249 | ); | 349 | ); |
250 | }; | 350 | }; | ... | ... |
... | @@ -47,61 +47,23 @@ console.log(fields); | ... | @@ -47,61 +47,23 @@ console.log(fields); |
47 | 47 | ||
48 | <Form.Item | 48 | <Form.Item |
49 | name="typeQue" | 49 | name="typeQue" |
50 | - label="문제/풀이 구분" | 50 | + label="그림 형식 구분" |
51 | rules={[ | 51 | rules={[ |
52 | { | 52 | { |
53 | required: true, | 53 | required: true, |
54 | - message: '문제/풀이 구분을 선택해 주세요.', | 54 | + message: '그림 파일 유형을 선택해 주세요.', |
55 | }, | 55 | }, |
56 | ]} | 56 | ]} |
57 | wrapperCol={{span: 2 }} | 57 | wrapperCol={{span: 2 }} |
58 | > | 58 | > |
59 | <Select onChange={onChangeTypeQue}> | 59 | <Select onChange={onChangeTypeQue}> |
60 | - <Option value="문제">문제</Option> | 60 | + <Option value="JPEG">JPEG</Option> |
61 | - <Option value="풀이">풀이</Option> | 61 | + <Option value="PNG">PNG</Option> |
62 | </Select> | 62 | </Select> |
63 | </Form.Item> | 63 | </Form.Item> |
64 | - | ||
65 | - | ||
66 | - | ||
67 | - <Row justify="space-between" align="middle"> | ||
68 | - <Col span={11}> | ||
69 | - <Form.Item name="tikzCode" rules={[{ required: true, message: 'tikz 코드를 입력해 주세요.' }]} initialValue={tikzcode}> | ||
70 | - <TextArea | ||
71 | - style={{ width: '44vw', height: '70vh' }} | ||
72 | - onChange={onChangeTikz} | ||
73 | - /> | ||
74 | - </Form.Item> | ||
75 | - </Col> | ||
76 | 64 | ||
77 | - <Col span={2} style={{textAlign:'center'}} > | ||
78 | - <Tooltip title={'tikz 미리보기'}> | ||
79 | - <Button type="ghost" icon={<RetweetOutlined />} onClick={onClickEvent}></Button> | ||
80 | - </Tooltip> | ||
81 | - </Col> | ||
82 | 65 | ||
83 | - <Col span={11} > | 66 | + <Form.Item> |
84 | - <IFrame | ||
85 | - style={{ | ||
86 | - width: '44vw', | ||
87 | - height: '70vh', | ||
88 | - marginTop: '-15px', | ||
89 | - border: '1px solid #d9d9d9', | ||
90 | - }}> | ||
91 | - <PanZoom | ||
92 | - style={{ | ||
93 | - display: 'block', | ||
94 | - outline: 'none', | ||
95 | - width: '44vw', | ||
96 | - height: '70vh', | ||
97 | - margin: '0px', | ||
98 | - }}> | ||
99 | - <div dangerouslySetInnerHTML={{ __html: svg }} /> | ||
100 | - </PanZoom> | ||
101 | - </IFrame> | ||
102 | - </Col> | ||
103 | - </Row> | ||
104 | - <Form.Item> | ||
105 | <Button type="primary" htmlType="submit"> | 67 | <Button type="primary" htmlType="submit"> |
106 | 저장하기 | 68 | 저장하기 |
107 | </Button> | 69 | </Button> | ... | ... |
-
Please register or login to post a comment