From 1ea9faa0730d458cb91e60136d4e77e6c979a48b Mon Sep 17 00:00:00 2001 From: Robert Peek Date: Wed, 1 Sep 2021 09:48:12 +0100 Subject: [PATCH] Fixes #20 --- README.md | 2 +- bower.json | 2 +- js/textEntryAudioView.js | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ffea0f..98888e4 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Several elements of **Text Entry** have been assigned a label using the [aria-la No known limitations. ---------------------------- -**Version number:** 4.3.0 +**Version number:** 4.3.1 **Framework versions supported:** 4+ **Author / maintainer:** DeltaNet with [contributors](https://github.com/deltanet/adapt-textEntry-audio/graphs/contributors) **Accessibility support:** yes diff --git a/bower.json b/bower.json index a962544..3ea99e5 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "adapt-textEntry-audio", - "version": "4.3.0", + "version": "4.3.1", "framework": ">=4", "homepage": "https://github.com/deltanet/adapt-textEntry-audio", "issues": "https://github.com/deltanet/adapt-textEntry-audio/issues", diff --git a/js/textEntryAudioView.js b/js/textEntryAudioView.js index 0c97063..cc6c67f 100644 --- a/js/textEntryAudioView.js +++ b/js/textEntryAudioView.js @@ -16,6 +16,8 @@ define([ initialize: function() { ComponentView.prototype.initialize.call(this); this.setUpViewData(); + + this.listenTo(Adapt.config, 'change:_activeLanguage', this.resetUserAnswers); }, setUpViewData: function() { @@ -118,6 +120,29 @@ define([ this.updateCounter(); }, + resetUserAnswers: function() { + this.model.set('userAnswer', ""); + + this.$('.textEntry-audio-item-textbox').val(this.model.get('userAnswer')); + + this.model.set('_isSubmitted', false); + + this.$('.buttons-action').removeClass('disabled').attr('disabled', false); + this.$('.buttons-action-fullwidth').removeClass('disabled').attr('disabled', false); + + this.$('.textEntry-audio-item-textbox').attr('disabled', false); + + if (this.model.get('_canShowFeedback')) { + this.$('.buttons-feedback').attr('disabled', true); + } + + this.updateCounter(); + + this.model.reset(true); + + Adapt.offlineStorage.set(this.model.get('_id'), this.model.get("userAnswer")); + }, + onInputChanged: function(event) { if (event) event.preventDefault();