Skip to content

Commit

Permalink
Merge pull request #4181 from Jaspreet-singh-1032/fixes-4079-add-new-…
Browse files Browse the repository at this point in the history
…question-should-show-question-type

removed scroll on adding new question
  • Loading branch information
vkWeb authored Aug 1, 2023
2 parents 212b46b + 68dbb7f commit d401e85
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<transition-group name="list-complete" tag="div">
<VCard
v-for="(item, idx) in sortedItems"
ref="questionCardRef"
:key="`question-${item.assessment_id}`"
pa-1
class="elevation-4 list-complete-item"
Expand Down Expand Up @@ -333,6 +334,17 @@
this.$analytics.trackAction('exercise_editor', 'Add', {
eventLabel: 'Question',
});
this.$nextTick(() => {
const questionCards = this.$refs['questionCardRef'];
if (questionCards?.length >= 1) {
const lastQuestionCard = questionCards[questionCards.length - 1].$el;
const editorDiv = document.getElementById('editViewId');
editorDiv.scrollTo({
top: lastQuestionCard.offsetTop,
behavior: 'smooth',
});
}
});
},
async deleteItem(itemToDelete) {
if (this.isItemActive(itemToDelete)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,6 @@
if (!this.question) {
this.openQuestion();
}
// Assessments are nested inside of a scrolling panel.
// Instead of propagating an event all the way back to
// the scrolling panel, just use scrollIntoView
// (supported by most major browsers)
if (this.$el.scrollIntoView) {
this.$el.scrollIntoView({ behaviour: 'smooth' });
}
},
methods: {
updateItem(payload) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<VContainer ref="editview" fluid class="pa-0 wrapper" @scroll="scroll">
<VContainer id="editViewId" ref="editview" fluid class="pa-0 wrapper" @scroll="scroll">
<VContainer v-if="!nodeIds.length" fluid>
<VLayout justify-center align-center fill-height>
<VFlex grow class="grey--text text-xs-center title">
Expand Down

0 comments on commit d401e85

Please sign in to comment.