mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Correct bug in how questions are split
Allow for multiple blank lines at start of editor without an error
This commit is contained in:
parent
d62b398de7
commit
e5f01ab889
1 changed files with 5 additions and 1 deletions
|
|
@ -118,7 +118,11 @@ const QuizForm: React.FC = () => {
|
||||||
setValue(value);
|
setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const linesArray = value.split(/(?<=^|[^\\]}.*)[\n]+/);
|
// split value when there is at least one blank line
|
||||||
|
const linesArray = value.split(/\n{2,}/);
|
||||||
|
|
||||||
|
// if the first item in linesArray is blank, remove it
|
||||||
|
if (linesArray[0] === '') linesArray.shift();
|
||||||
|
|
||||||
if (linesArray[linesArray.length - 1] === '') linesArray.pop();
|
if (linesArray[linesArray.length - 1] === '') linesArray.pop();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue