From 62ab853605ee7447fd2a06ed61b8771e102eb7c8 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 12 Aug 2024 12:46:38 +0530 Subject: [PATCH] feat: quiz creation from lesson form --- .../src/components/Controls/Autocomplete.vue | 2 +- frontend/src/components/Controls/Link.vue | 1 + frontend/src/components/LessonPlugins.vue | 38 ++++++++++++------- frontend/src/pages/LessonForm.vue | 8 +++- frontend/src/utils/index.js | 4 +- 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/Controls/Autocomplete.vue b/frontend/src/components/Controls/Autocomplete.vue index 4b7d4a0d..0563dd61 100644 --- a/frontend/src/components/Controls/Autocomplete.vue +++ b/frontend/src/components/Controls/Autocomplete.vue @@ -91,7 +91,7 @@
{{ option.label }}
-
diff --git a/frontend/src/components/Controls/Link.vue b/frontend/src/components/Controls/Link.vue index c5f6f63f..f7730380 100644 --- a/frontend/src/components/Controls/Link.vue +++ b/frontend/src/components/Controls/Link.vue @@ -77,6 +77,7 @@ const valuePropPassed = computed(() => 'value' in attrs) const value = computed({ get: () => (valuePropPassed.value ? attrs.value : props.modelValue), set: (val) => { + console.log(valuePropPassed.value) return ( val?.value && emit(valuePropPassed.value ? 'change' : 'update:modelValue', val?.value) diff --git a/frontend/src/components/LessonPlugins.vue b/frontend/src/components/LessonPlugins.vue index ccaa17cf..e5a4e5af 100644 --- a/frontend/src/components/LessonPlugins.vue +++ b/frontend/src/components/LessonPlugins.vue @@ -2,7 +2,7 @@
{{ __('Components') }}
-
+
-
+
- + + +
-
+
{{ __('Add an image, video, pdf or audio.') }}
@@ -68,7 +76,7 @@
-
+
{{ __( @@ -112,11 +120,13 @@ const props = defineProps({ }, }) -const addQuiz = () => { +const addQuiz = (value) => { + console.log("here") + console.log(value) getCurrentEditor().caret.setToLastBlock('end', 0) - if (quiz.value) { + if (value) { getCurrentEditor().blocks.insert('quiz', { - quiz: quiz.value, + quiz: value, }) quiz.value = null } diff --git a/frontend/src/pages/LessonForm.vue b/frontend/src/pages/LessonForm.vue index b92ea7d9..b16d4f4d 100644 --- a/frontend/src/pages/LessonForm.vue +++ b/frontend/src/pages/LessonForm.vue @@ -70,7 +70,7 @@