🐛 Fixed crash if switched from Range to Multiple-Choice
This commit is contained in:
@@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
export let selected_question: number;
|
export let selected_question: number;
|
||||||
export let data: EditorData;
|
export let data: EditorData;
|
||||||
|
if (!Array.isArray(data.questions[selected_question].answers)) {
|
||||||
|
data.questions[selected_question].answers = [];
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-4 w-full px-10">
|
<div class="grid grid-cols-2 gap-4 w-full px-10">
|
||||||
|
|||||||
@@ -181,7 +181,7 @@
|
|||||||
<div class="grid grid-cols-2 gap-2">
|
<div class="grid grid-cols-2 gap-2">
|
||||||
{#each question.answers as answer}
|
{#each question.answers as answer}
|
||||||
<span
|
<span
|
||||||
class="whitespace-nowrap truncate rounded-lg p-0.5 text-sm text-center"
|
class="whitespace-nowrap truncate rounded-lg p-0.5 text-sm text-center border border-gray-700"
|
||||||
class:bg-green-500={answer.right}
|
class:bg-green-500={answer.right}
|
||||||
class:bg-red-500={!answer.right}
|
class:bg-red-500={!answer.right}
|
||||||
class:bg-yellow-500={!reach(ABCDQuestionSchema, 'answer').isValidSync(
|
class:bg-yellow-500={!reach(ABCDQuestionSchema, 'answer').isValidSync(
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<div
|
<div
|
||||||
class="bg-white shadow rounded-lg h-40 p-2 mb-6 hover:cursor-pointer drop-shadow-2xl border border-gray-500"
|
class="bg-white shadow rounded-lg h-40 p-2 mb-6 hover:cursor-pointer drop-shadow-2xl border border-gray-500 dark:bg-gray-600"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
Reference in New Issue
Block a user