-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathindex.tsx
More file actions
43 lines (39 loc) · 1.09 KB
/
index.tsx
File metadata and controls
43 lines (39 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from 'react';
import ReactDOM from 'react-dom';
import { Button, Grid } from 'rsuite';
import CodeView from '../src';
import './styles/index.less';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const example = require('./example.md');
const App = () => {
return (
<Grid>
<CodeView
editable
theme="dark"
dependencies={{ Button }}
editor={{
buttonClassName: 'rs-btn rs-btn-sm rs-btn-icon'
}}
afterCompile={(code: string) => {
return code.replace(/import\ [\*\w\,\{\}\ ]+\ from\ ?[\."'@/\w-]+;/gi, '');
}}
onOpenEditor={() => {
console.log('open editor');
}}
onCloseEditor={() => {
console.log('close editor');
}}
renderExtraFooter={() => {
return <div>Footer</div>;
}}
copyButtonProps={{
className: 'rs-btn-icon rs-btn-icon-circle rs-btn rs-btn-subtle rs-btn-xs'
}}
>
{example}
</CodeView>
</Grid>
);
};
ReactDOM.render(<App />, document.getElementById('app'));