✨ Closes #127
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user