split using regex supporting both crlf and lf types

This commit is contained in:
Luck
2021-05-21 13:46:26 +01:00
parent 7258088b56
commit 63053c276e

View File

@@ -10,7 +10,7 @@ export default function EditorTextArea({ code, setCode, language, fontSize }) {
function highlightWithLineNumbers(input, grammar) { function highlightWithLineNumbers(input, grammar) {
return highlight(input, grammar) return highlight(input, grammar)
.split('\n') .split(/\r?\n/)
.map((line, i) => ( .map((line, i) => (
<span key={i}> <span key={i}>
<LineNumber <LineNumber