This commit is contained in:
Mawoka
2023-10-21 21:44:06 +02:00
parent 43c0dd41fe
commit 384204eb10
2 changed files with 9 additions and 2 deletions
@@ -14,6 +14,8 @@ SPDX-License-Identifier: MPL-2.0
export let questions: Question[];
export let open: boolean;
export let selected_question: number;
const { t } = getLocalization();
onMount(() => {
document.body.addEventListener('keydown', close_start_game_if_esc_is_pressed);
@@ -87,6 +89,7 @@ SPDX-License-Identifier: MPL-2.0
answers: question_types[index].answers
};
questions = [...questions, { ...empty_question }];
selected_question = questions.length - 1;
open = false;
};
</script>
+6 -2
View File
@@ -156,7 +156,7 @@ SPDX-License-Identifier: MPL-2.0
type="button"
on:click={() => {
if (confirm('Do you really want to delete this Question?')) {
selected_question = selected_question - 1;
selected_question = -1;
data.questions.splice(index, 1);
data.questions = data.questions;
}
@@ -323,5 +323,9 @@ SPDX-License-Identifier: MPL-2.0
</div>
</div>
{#if add_new_question_popup_open}
<AddNewQuestionPopup bind:questions={data.questions} bind:open={add_new_question_popup_open} />
<AddNewQuestionPopup
bind:questions={data.questions}
bind:open={add_new_question_popup_open}
bind:selected_question
/>
{/if}