Skip to content

Commit

Permalink
JI-5448 Prevent storing state if user has not interacted
Browse files Browse the repository at this point in the history
  • Loading branch information
otacke committed Sep 15, 2023
1 parent 55f5bb7 commit 03785a6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/scripts/h5p-sort-paragraphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,16 @@ export default class SortParagraphs extends H5P.Question {
return;
}

/*
* H5P integrations may (for instance) show a restart button if there is
* a previous state set, so here not storing the state if no answer has been
* given by the user and there's no order stored previously - preventing
* to show up that restart button without the need to.
*/
if (!this.getAnswerGiven() && !this.previousState.order) {
return;
}

return {
order: this.content.getDraggablesOrder(),
viewState: this.viewState,
Expand Down

0 comments on commit 03785a6

Please sign in to comment.