initial commit

This commit is contained in:
Luck
2021-03-26 22:00:12 +00:00
commit bbbece5b3b
16 changed files with 11936 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import ReactEditor from 'react-simple-code-editor';
import { getHighlighter } from '../highlighting';
import 'prismjs/themes/prism.css';
export default function EditorTextArea({ code, setCode, language }) {
const highlight = getHighlighter(language);
function highlightWithLineNumbers(input, grammar) {
return highlight(input, grammar)
.split('\n')
.map((line, i) => `<span class='editorLineNumber'>${i + 1}</span>${line}`)
.join('\n');
}
return (
<main>
<ReactEditor
value={code}
onValueChange={setCode}
highlight={highlightWithLineNumbers}
placeholder={'Type some code...'}
padding={10}
textareaId='code-area'
className='editor'
/>
</main>
)
}