diff --git a/packages/boilerplate-item-type/configure/package.json b/packages/boilerplate-item-type/configure/package.json index 8e6334e6ec..7c22df4782 100644 --- a/packages/boilerplate-item-type/configure/package.json +++ b/packages/boilerplate-item-type/configure/package.json @@ -8,7 +8,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "prop-types": "^15.6.2", diff --git a/packages/boilerplate-item-type/controller/package.json b/packages/boilerplate-item-type/controller/package.json index 1bc56a5e74..ad345e08d9 100644 --- a/packages/boilerplate-item-type/controller/package.json +++ b/packages/boilerplate-item-type/controller/package.json @@ -6,7 +6,7 @@ "main": "lib/index.js", "module": "src/index.js", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15" }, diff --git a/packages/boilerplate-item-type/package.json b/packages/boilerplate-item-type/package.json index 75054109df..2612987120 100644 --- a/packages/boilerplate-item-type/package.json +++ b/packages/boilerplate-item-type/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "prop-types": "^15.6.1", "react": "^16.8.1", "react-dom": "^16.8.1" diff --git a/packages/calculator/configure/package.json b/packages/calculator/configure/package.json index 70a87538ef..7791877415 100644 --- a/packages/calculator/configure/package.json +++ b/packages/calculator/configure/package.json @@ -7,7 +7,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "react": "^16.8.1", "react-dom": "^16.8.1" }, diff --git a/packages/categorize/configure/package.json b/packages/categorize/configure/package.json index 8baca2233e..bcc3d7cf5a 100644 --- a/packages/categorize/configure/package.json +++ b/packages/categorize/configure/package.json @@ -12,7 +12,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^3.1.0", "lodash": "^4.17.15", diff --git a/packages/categorize/controller/package.json b/packages/categorize/controller/package.json index 457ab1e202..1e89b6f26f 100644 --- a/packages/categorize/controller/package.json +++ b/packages/categorize/controller/package.json @@ -2,7 +2,7 @@ "name": "@pie-element/categorize-controller", "private": true, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15" }, "version": "7.8.3", diff --git a/packages/categorize/package.json b/packages/categorize/package.json index afaa40d567..801241df9d 100644 --- a/packages/categorize/package.json +++ b/packages/categorize/package.json @@ -11,7 +11,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash": "^4.17.15", diff --git a/packages/categorize/src/categorize/choice.jsx b/packages/categorize/src/categorize/choice.jsx index 7b089a2565..d6be61cbc9 100644 --- a/packages/categorize/src/categorize/choice.jsx +++ b/packages/categorize/src/categorize/choice.jsx @@ -2,8 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import classNames from 'classnames'; -import { DragSource, DndProvider } from 'react-dnd'; -import HTML5Backend from 'react-dnd-html5-backend'; +import { DragSource } from 'react-dnd'; import { uid } from '@pie-lib/pie-toolbox/drag'; import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; @@ -160,10 +159,4 @@ const DraggableChoice = DragSource( }), )(Choice); -const DraggableChoiceWithProvider = (props) => ( - - - -); - -export default uid.withUid(DraggableChoiceWithProvider); \ No newline at end of file +export default uid.withUid(DraggableChoice); diff --git a/packages/categorize/src/index.js b/packages/categorize/src/index.js index e013406b19..86f5e86efe 100644 --- a/packages/categorize/src/index.js +++ b/packages/categorize/src/index.js @@ -11,6 +11,9 @@ export default class Categorize extends HTMLElement { this.eliminateBlindAnswersFromSession(); this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.isComplete(), !!this._model)); + // reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio + this._audioInitialized = false; + this.render(); } @@ -110,6 +113,7 @@ export default class Categorize extends HTMLElement { const observer = new MutationObserver((mutationsList, observer) => { mutationsList.forEach((mutation) => { if (mutation.type === 'childList') { + if (this._audioInitialized) return; const audio = this.querySelector('audio'); const isInsidePrompt = audio && audio.closest('#preview-prompt'); @@ -180,6 +184,8 @@ export default class Categorize extends HTMLElement { this._handlePlaying = handlePlaying; this._handleEnded = handleEnded; this._enableAudio = enableAudio; + // set to true to prevent multiple initializations + this._audioInitialized = true; observer.disconnect(); } diff --git a/packages/charting/configure/package.json b/packages/charting/configure/package.json index 34fc9b12b2..4674f42a9f 100644 --- a/packages/charting/configure/package.json +++ b/packages/charting/configure/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "prop-types": "^15.6.2", diff --git a/packages/charting/controller/package.json b/packages/charting/controller/package.json index 030617e087..0685071adc 100644 --- a/packages/charting/controller/package.json +++ b/packages/charting/controller/package.json @@ -9,7 +9,7 @@ "test": "./node_modules/.bin/jest" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1", "lodash": "^4.17.15" }, diff --git a/packages/charting/package.json b/packages/charting/package.json index 2518123d1b..62261be5ad 100644 --- a/packages/charting/package.json +++ b/packages/charting/package.json @@ -12,7 +12,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash": "^4.17.15", diff --git a/packages/complex-rubric/controller/package.json b/packages/complex-rubric/controller/package.json index 093e9f046e..a307b84309 100644 --- a/packages/complex-rubric/controller/package.json +++ b/packages/complex-rubric/controller/package.json @@ -7,7 +7,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15" }, "author": "", diff --git a/packages/drag-in-the-blank/configure/package.json b/packages/drag-in-the-blank/configure/package.json index 551e252d79..fcbc7e3a03 100644 --- a/packages/drag-in-the-blank/configure/package.json +++ b/packages/drag-in-the-blank/configure/package.json @@ -8,7 +8,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "prop-types": "^15.6.2", diff --git a/packages/drag-in-the-blank/controller/package.json b/packages/drag-in-the-blank/controller/package.json index bdced0ff53..37a3afda33 100644 --- a/packages/drag-in-the-blank/controller/package.json +++ b/packages/drag-in-the-blank/controller/package.json @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "type-of": "^2.0.1" diff --git a/packages/drag-in-the-blank/package.json b/packages/drag-in-the-blank/package.json index 9d046351b8..8980b04775 100644 --- a/packages/drag-in-the-blank/package.json +++ b/packages/drag-in-the-blank/package.json @@ -12,7 +12,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "lodash": "^4.17.10", "prop-types": "^15.6.1", diff --git a/packages/drag-in-the-blank/src/index.js b/packages/drag-in-the-blank/src/index.js index 6ef9a97e72..0a078fec8a 100644 --- a/packages/drag-in-the-blank/src/index.js +++ b/packages/drag-in-the-blank/src/index.js @@ -24,13 +24,15 @@ export default class DragInTheBlank extends HTMLElement { super(); this._model = null; this._session = null; + this._audioInitialized = false; this.audioComplete = false; } set model(m) { this._model = m; this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), isComplete(this._session, this._model, this.audioComplete), !!this._model)); - + // reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio + this._audioInitialized = false; this._render(); } @@ -105,6 +107,7 @@ export default class DragInTheBlank extends HTMLElement { const observer = new MutationObserver((mutationsList, observer) => { mutationsList.forEach((mutation) => { if (mutation.type === 'childList') { + if (this._audioInitialized) return; const audio = this.querySelector('audio'); const isInsidePrompt = audio && audio.closest('#preview-prompt'); @@ -174,6 +177,8 @@ export default class DragInTheBlank extends HTMLElement { this._handlePlaying = handlePlaying; this._handleEnded = handleEnded; this._enableAudio = enableAudio; + // set to true to prevent multiple initializations + this._audioInitialized = true; observer.disconnect(); } diff --git a/packages/drag-in-the-blank/src/main.js b/packages/drag-in-the-blank/src/main.js index 19c7bf0e9f..29cff1f115 100644 --- a/packages/drag-in-the-blank/src/main.js +++ b/packages/drag-in-the-blank/src/main.js @@ -29,6 +29,14 @@ export class Main extends React.Component { this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer }); }; + UNSAFE_componentWillReceiveProps(nextProps) { + const { model: nextModel } = nextProps; + + if(nextModel && !nextModel.correctResponse && this.state.showCorrectAnswer !== false){ + this.setState({ showCorrectAnswer: false }); + } + } + render() { const { showCorrectAnswer } = this.state; const { model, onChange, value, classes } = this.props; diff --git a/packages/drawing-response/configure/package.json b/packages/drawing-response/configure/package.json index 64d8bd446a..4848132d20 100644 --- a/packages/drawing-response/configure/package.json +++ b/packages/drawing-response/configure/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.6", "debug": "^3.1.0", "lodash": "^4.17.15", diff --git a/packages/drawing-response/package.json b/packages/drawing-response/package.json index c5774a1519..0d88885922 100644 --- a/packages/drawing-response/package.json +++ b/packages/drawing-response/package.json @@ -11,7 +11,7 @@ "@mdi/js": "^3.6.95", "@mdi/react": "^1.1.1", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.6", "enzyme-to-json": "^3.3.5", "konva": "^3.4.1", diff --git a/packages/ebsr/configure/package.json b/packages/ebsr/configure/package.json index 5170fa0faa..5a1e74756b 100644 --- a/packages/ebsr/configure/package.json +++ b/packages/ebsr/configure/package.json @@ -10,7 +10,7 @@ "@material-ui/core": "^3.9.2", "@pie-element/multiple-choice": "^9.15.3", "@pie-framework/pie-configure-events": "^1.2.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15", "prop-types": "^15.6.2", "react": "^16.8.1", diff --git a/packages/ebsr/controller/package.json b/packages/ebsr/controller/package.json index 60195dbb16..618fbd1ae4 100644 --- a/packages/ebsr/controller/package.json +++ b/packages/ebsr/controller/package.json @@ -7,7 +7,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15" }, "author": "", diff --git a/packages/ebsr/package.json b/packages/ebsr/package.json index d8eb01b25b..ff579608af 100644 --- a/packages/ebsr/package.json +++ b/packages/ebsr/package.json @@ -9,7 +9,7 @@ "dependencies": { "@pie-element/multiple-choice": "^9.15.3", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash": "^4.17.11" diff --git a/packages/explicit-constructed-response/configure/package.json b/packages/explicit-constructed-response/configure/package.json index 80390c4ad5..2db567990a 100644 --- a/packages/explicit-constructed-response/configure/package.json +++ b/packages/explicit-constructed-response/configure/package.json @@ -8,7 +8,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.6", "debug": "^3.1.0", "lodash": "^4.17.15", diff --git a/packages/explicit-constructed-response/controller/package.json b/packages/explicit-constructed-response/controller/package.json index 205f9a6d0b..2c246c4eef 100644 --- a/packages/explicit-constructed-response/controller/package.json +++ b/packages/explicit-constructed-response/controller/package.json @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "he": "^1.2.0", "lodash": "^4.17.15", diff --git a/packages/explicit-constructed-response/package.json b/packages/explicit-constructed-response/package.json index f9d64fd6aa..0f783fcee8 100644 --- a/packages/explicit-constructed-response/package.json +++ b/packages/explicit-constructed-response/package.json @@ -12,7 +12,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "he": "^1.2.0", "lodash": "^4.17.10", diff --git a/packages/extended-text-entry/configure/package.json b/packages/extended-text-entry/configure/package.json index be39131c76..05eeaf1e5b 100644 --- a/packages/extended-text-entry/configure/package.json +++ b/packages/extended-text-entry/configure/package.json @@ -10,7 +10,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15", "prop-types": "^15.6.2", "react": "^16.8.1", diff --git a/packages/extended-text-entry/controller/package.json b/packages/extended-text-entry/controller/package.json index c8351dee70..30019ff3c8 100644 --- a/packages/extended-text-entry/controller/package.json +++ b/packages/extended-text-entry/controller/package.json @@ -6,7 +6,7 @@ "main": "lib/index.js", "module": "src/index.js", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3" + "@pie-lib/pie-toolbox": "2.14.5" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/packages/extended-text-entry/package.json b/packages/extended-text-entry/package.json index e9f176a963..414accc580 100644 --- a/packages/extended-text-entry/package.json +++ b/packages/extended-text-entry/package.json @@ -12,7 +12,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash.throttle": "^4.1.1", diff --git a/packages/fraction-model/configure/package.json b/packages/fraction-model/configure/package.json index 91b53686cf..0324873e31 100644 --- a/packages/fraction-model/configure/package.json +++ b/packages/fraction-model/configure/package.json @@ -8,7 +8,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "prop-types": "^15.6.2", diff --git a/packages/fraction-model/controller/package.json b/packages/fraction-model/controller/package.json index d458928675..e059f23ea2 100644 --- a/packages/fraction-model/controller/package.json +++ b/packages/fraction-model/controller/package.json @@ -6,7 +6,7 @@ "main": "lib/index.js", "module": "src/index.js", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15" }, diff --git a/packages/fraction-model/package.json b/packages/fraction-model/package.json index ebc18fcc87..abaed9b1c0 100644 --- a/packages/fraction-model/package.json +++ b/packages/fraction-model/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "prop-types": "^15.6.1", "react": "^16.8.1", "react-dom": "^16.8.1", diff --git a/packages/graphing-solution-set/configure/package.json b/packages/graphing-solution-set/configure/package.json index 534578f4f6..e2711ff1b4 100644 --- a/packages/graphing-solution-set/configure/package.json +++ b/packages/graphing-solution-set/configure/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "prop-types": "^15.6.2", diff --git a/packages/graphing-solution-set/controller/package.json b/packages/graphing-solution-set/controller/package.json index 9340a909ea..3e69fff407 100644 --- a/packages/graphing-solution-set/controller/package.json +++ b/packages/graphing-solution-set/controller/package.json @@ -9,7 +9,7 @@ "test": "./node_modules/.bin/jest" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1" }, "devDependencies": { diff --git a/packages/graphing-solution-set/package.json b/packages/graphing-solution-set/package.json index 5abd9dff38..15b9897038 100644 --- a/packages/graphing-solution-set/package.json +++ b/packages/graphing-solution-set/package.json @@ -13,7 +13,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "react": "^16.8.1", diff --git a/packages/graphing/configure/package.json b/packages/graphing/configure/package.json index 3f21f3c1fb..42dbd9bf7d 100644 --- a/packages/graphing/configure/package.json +++ b/packages/graphing/configure/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash": "^4.17.15", diff --git a/packages/graphing/configure/src/correct-response.jsx b/packages/graphing/configure/src/correct-response.jsx index 99b0acf4fa..962a9b06e6 100644 --- a/packages/graphing/configure/src/correct-response.jsx +++ b/packages/graphing/configure/src/correct-response.jsx @@ -437,7 +437,7 @@ export class CorrectResponse extends React.Component { !mark.building)} coordinatesOnHover={coordinatesOnHover} disabledLabels={true} disabledTitle={true} diff --git a/packages/graphing/configure/src/index.js b/packages/graphing/configure/src/index.js index 498fd15e5f..187d7e7893 100644 --- a/packages/graphing/configure/src/index.js +++ b/packages/graphing/configure/src/index.js @@ -2,11 +2,11 @@ import React from 'react'; import ReactDOM from 'react-dom'; import Configure from './configure'; import { - ModelUpdatedEvent, DeleteImageEvent, + DeleteSoundEvent, InsertImageEvent, InsertSoundEvent, - DeleteSoundEvent, + ModelUpdatedEvent, } from '@pie-framework/pie-configure-events'; import debug from 'debug'; import defaultValues from './defaults'; @@ -99,7 +99,10 @@ export default class GraphLinesConfigure extends HTMLElement { } set configuration(c) { - this._configuration = c; + this._configuration = { + ...defaultValues.configuration, + ...c, + }; this.resetModelAfterConfigurationIsSet(); diff --git a/packages/graphing/controller/package.json b/packages/graphing/controller/package.json index bb879d98fb..24b59a6bf5 100644 --- a/packages/graphing/controller/package.json +++ b/packages/graphing/controller/package.json @@ -9,7 +9,7 @@ "test": "./node_modules/.bin/jest" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1" }, "devDependencies": { diff --git a/packages/graphing/package.json b/packages/graphing/package.json index 99b8ea315a..8498b2b149 100644 --- a/packages/graphing/package.json +++ b/packages/graphing/package.json @@ -12,7 +12,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "react": "^16.8.1", diff --git a/packages/graphing/src/main.jsx b/packages/graphing/src/main.jsx index c354541f46..f04fae741c 100644 --- a/packages/graphing/src/main.jsx +++ b/packages/graphing/src/main.jsx @@ -75,7 +75,7 @@ export class Main extends React.Component { !mark.building)} coordinatesOnHover={coordinatesOnHover} disabled={true} disabledLabels={true} @@ -96,7 +96,7 @@ export class Main extends React.Component { !mark.building)} coordinatesOnHover={coordinatesOnHover} defaultTool={defaultTool} disabled={disabled} diff --git a/packages/hotspot/configure/package.json b/packages/hotspot/configure/package.json index 2edc21086f..8a2a18fdd3 100644 --- a/packages/hotspot/configure/package.json +++ b/packages/hotspot/configure/package.json @@ -10,7 +10,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.6", "debug": "^3.1.0", "konva": "^3.2.4", diff --git a/packages/hotspot/controller/package.json b/packages/hotspot/controller/package.json index baddd4cda4..d13b64be40 100644 --- a/packages/hotspot/controller/package.json +++ b/packages/hotspot/controller/package.json @@ -11,7 +11,7 @@ "main": "lib/index.js", "module": "src/index.js", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1", "lodash": "^4.17.15" } diff --git a/packages/hotspot/package.json b/packages/hotspot/package.json index a541b4b98f..bf6964a467 100644 --- a/packages/hotspot/package.json +++ b/packages/hotspot/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.3", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "konva": "^3.2.5", "prop-types": "^15.6.1", "react": "^16.8.1", diff --git a/packages/hotspot/src/index.js b/packages/hotspot/src/index.js index 62b4b17716..5a85df4416 100644 --- a/packages/hotspot/src/index.js +++ b/packages/hotspot/src/index.js @@ -12,6 +12,7 @@ export default class Hotspot extends HTMLElement { super(); this._model = null; this._session = null; + this._audioInitialized = false; this.audioComplete = false; } @@ -19,6 +20,7 @@ export default class Hotspot extends HTMLElement { this._model = m; this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.isComplete(), !!this._model)); + this._audioInitialized = false; this._render(); } @@ -96,6 +98,7 @@ export default class Hotspot extends HTMLElement { const observer = new MutationObserver((mutationsList, observer) => { mutationsList.forEach((mutation) => { if (mutation.type === 'childList') { + if (this._audioInitialized) return; const audio = this.querySelector('audio'); const isInsidePrompt = audio && audio.closest('#preview-prompt'); @@ -166,6 +169,8 @@ export default class Hotspot extends HTMLElement { this._handlePlaying = handlePlaying; this._handleEnded = handleEnded; this._enableAudio = enableAudio; + // set to true to prevent multiple initializations + this._audioInitialized = true; observer.disconnect(); } diff --git a/packages/image-cloze-association/configure/package.json b/packages/image-cloze-association/configure/package.json index 4bbef6effd..dd67a39555 100644 --- a/packages/image-cloze-association/configure/package.json +++ b/packages/image-cloze-association/configure/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "prop-types": "^15.7.2", "react": "^16.8.6", diff --git a/packages/image-cloze-association/controller/package.json b/packages/image-cloze-association/controller/package.json index 0c3f88b4b0..77583f8539 100644 --- a/packages/image-cloze-association/controller/package.json +++ b/packages/image-cloze-association/controller/package.json @@ -11,7 +11,7 @@ "main": "lib/index.js", "module": "src/index.js", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1", "humps": "^2.0.1", "lodash": "^4.17.15" diff --git a/packages/image-cloze-association/package.json b/packages/image-cloze-association/package.json index 588d94b5bc..5e999a2f55 100644 --- a/packages/image-cloze-association/package.json +++ b/packages/image-cloze-association/package.json @@ -10,7 +10,7 @@ "@material-ui/core": "^3.9.3", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.6", "humps": "^2.0.1", "prop-types": "^15.6.1", diff --git a/packages/image-cloze-association/src/evaluation-icon.jsx b/packages/image-cloze-association/src/evaluation-icon.jsx index 2c6d2807fc..66d6f74299 100644 --- a/packages/image-cloze-association/src/evaluation-icon.jsx +++ b/packages/image-cloze-association/src/evaluation-icon.jsx @@ -6,10 +6,10 @@ import Close from '@material-ui/icons/Close'; import { color } from '@pie-lib/pie-toolbox/render-ui'; const getCorrectnessClass = (isCorrect, filled) => { - if (filled) { - return isCorrect ? 'correctFilled' : 'incorrectFilled'; - } - return isCorrect ? 'correctEmpty' : 'incorrectEmpty'; + const correctness = isCorrect ? 'correct' : 'incorrect'; + const fillState = filled ? 'Filled' : 'Empty'; + + return `${correctness}${fillState}`; }; const EvaluationIcon = ({ classes, containerStyle, isCorrect, filled }) => { diff --git a/packages/image-cloze-association/src/possible-response.jsx b/packages/image-cloze-association/src/possible-response.jsx index c7c23a13de..8843703ef5 100644 --- a/packages/image-cloze-association/src/possible-response.jsx +++ b/packages/image-cloze-association/src/possible-response.jsx @@ -4,10 +4,10 @@ import classNames from 'classnames'; import { withStyles } from '@material-ui/core/styles'; import { DragSource } from '@pie-lib/pie-toolbox/drag'; import { color } from '@pie-lib/pie-toolbox/render-ui'; -import { PreviewPrompt } from '@pie-lib/pie-toolbox/render-ui'; import EvaluationIcon from './evaluation-icon'; import c from './constants'; +import StaticHTMLSpan from './static-html-span'; export class PossibleResponse extends React.Component { render() { @@ -40,11 +40,7 @@ export class PossibleResponse extends React.Component { return connectDragSource(
- +
, ); diff --git a/packages/image-cloze-association/src/root.jsx b/packages/image-cloze-association/src/root.jsx index 107745649a..37b34af2cb 100644 --- a/packages/image-cloze-association/src/root.jsx +++ b/packages/image-cloze-association/src/root.jsx @@ -86,18 +86,8 @@ export class ImageClozeAssociationComponent extends React.Component { }); }; - filterPossibleAnswers = (possibleResponses, answer) => { - const index = possibleResponses.findIndex((response) => response.value === answer.value); - - if (index >= 0) { - return [ - ...possibleResponses.slice(0, index), // Elements before the found item - ...possibleResponses.slice(index + 1), // Elements after the found item - ]; - } - - return possibleResponses; - }; + filterPossibleAnswers = (possibleResponses, answer) => + possibleResponses.filter(response => response.value !== answer.value); handleOnAnswerSelect = (answer, responseContainerIndex) => { const { @@ -108,10 +98,18 @@ export class ImageClozeAssociationComponent extends React.Component { let { possibleResponses } = this.state; let answersToStore; - if (maxResponsePerZone === answers.filter((a) => a.containerIndex === responseContainerIndex).length) { - const answersInThisContainer = answers.filter((a) => a.containerIndex === responseContainerIndex); - const answersInOtherContainers = answers.filter((b) => b.containerIndex !== responseContainerIndex); + const answersInThisContainer = []; + const answersInOtherContainers = []; + answers.forEach((a) => { + if (a.containerIndex === responseContainerIndex) { + answersInThisContainer.push(a); + } else { + answersInOtherContainers.push(a); + } + }); + + if (maxResponsePerZone === answersInThisContainer.length) { const shiftedItem = answersInThisContainer[0]; if (maxResponsePerZone === 1) { answersInThisContainer.shift(); // FIFO @@ -270,6 +268,55 @@ export class ImageClozeAssociationComponent extends React.Component { answersToShow = [...answersToShow, ...getUnansweredAnswers(answersToShow, validation)]; } + const sharedImageProps = { + draggingElement, + duplicateResponses, + image, + onAnswerSelect: this.handleOnAnswerSelect, + onDragAnswerBegin: this.beginDrag, + onDragAnswerEnd: this.handleOnDragEnd, + responseContainers, + showDashedBorder, + responseAreaFill, + responseContainerPadding, + imageDropTargetPadding, + maxResponsePerZone, + }; + + const renderImage = () => ( + + ); + + const renderPossibleResponses = () => { + if (showCorrect && showToggle) return null; + + return ( + + {maxResponsePerZoneWarning && } + + + ); + }; + return ( {teacherInstructions && hasText(teacherInstructions) && ( @@ -300,62 +347,13 @@ export class ImageClozeAssociationComponent extends React.Component { language={language} /> - {showCorrect && showToggle ? ( - - - - ) : ( - - - - {maxResponsePerZoneWarning && } - - - - )} + + {renderImage()} + {renderPossibleResponses()} + {rationale && hasText(rationale) && ( + ); + } +} + +StaticHTMLSpan.propTypes = { + html: PropTypes.string.isRequired, + className: PropTypes.string, +}; + +StaticHTMLSpan.defaultProps = { + className: '', +}; + +export default StaticHTMLSpan; diff --git a/packages/inline-dropdown/configure/package.json b/packages/inline-dropdown/configure/package.json index 2d295b8dee..066b8f4378 100644 --- a/packages/inline-dropdown/configure/package.json +++ b/packages/inline-dropdown/configure/package.json @@ -8,7 +8,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.6", "debug": "^3.1.0", "lodash": "^4.17.15", diff --git a/packages/inline-dropdown/configure/src/__tests__/__snapshots__/main.test.jsx.snap b/packages/inline-dropdown/configure/src/__tests__/__snapshots__/main.test.jsx.snap index 487e6f987c..21ec374310 100644 --- a/packages/inline-dropdown/configure/src/__tests__/__snapshots__/main.test.jsx.snap +++ b/packages/inline-dropdown/configure/src/__tests__/__snapshots__/main.test.jsx.snap @@ -512,18 +512,14 @@ There should be at most 10 choices defined per response area." - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + - + + /> + ({ paddingTop: theme.spacing.unit * 2, marginBottom: theme.spacing.unit * 2, }, + choiceRationaleHolder: { + width: '100%', + paddingTop: theme.spacing.unit / 2, + marginBottom: theme.spacing.unit * 2, + }, markup: { minHeight: '100px', width: '100%', @@ -47,7 +54,12 @@ const styles = (theme) => ({ }, rationaleLabel: { display: 'flex', + alignItems: 'center', whiteSpace: 'break-spaces', + color: color.disabled(), + padding: 0, + fontSize: theme.typography.fontSize - 2, + lineHeight: 1, }, rationaleChoices: { marginBottom: theme.spacing.unit * 2.5, @@ -380,30 +392,27 @@ export class Main extends React.Component { {(choices[key] || []).map((choice) => ( - - } - className={classes.promptHolder} - > - this.onChoiceRationaleChanged(key, { ...choice, rationale: c })} - imageSupport={imageSupport} - maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth} - maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight} - uploadSoundSupport={uploadSoundSupport} - mathMlOptions={mathMlOptions} + + - + + this.onChoiceRationaleChanged(key, { ...choice, rationale: c })} + imageSupport={imageSupport} + maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth} + maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight} + uploadSoundSupport={uploadSoundSupport} + mathMlOptions={mathMlOptions} + /> + + ))} diff --git a/packages/inline-dropdown/controller/package.json b/packages/inline-dropdown/controller/package.json index c388f574c4..26a3ef5b11 100644 --- a/packages/inline-dropdown/controller/package.json +++ b/packages/inline-dropdown/controller/package.json @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "type-of": "^2.0.1" diff --git a/packages/inline-dropdown/package.json b/packages/inline-dropdown/package.json index da06c71c87..4d90fca0d3 100644 --- a/packages/inline-dropdown/package.json +++ b/packages/inline-dropdown/package.json @@ -12,7 +12,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "lodash": "^4.17.10", "prop-types": "^15.6.1", diff --git a/packages/likert/configure/package.json b/packages/likert/configure/package.json index 10d0397a01..3e45df7122 100644 --- a/packages/likert/configure/package.json +++ b/packages/likert/configure/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1", "prop-types": "^15.6.2", "react": "^16.8.1", diff --git a/packages/likert/package.json b/packages/likert/package.json index 3fd78bc48d..5d9178c5e5 100644 --- a/packages/likert/package.json +++ b/packages/likert/package.json @@ -12,7 +12,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash": "^4.17.10", diff --git a/packages/match-list/controller/package.json b/packages/match-list/controller/package.json index f35e1afec0..a09cc02ee1 100644 --- a/packages/match-list/controller/package.json +++ b/packages/match-list/controller/package.json @@ -9,7 +9,7 @@ "test": "./node_modules/.bin/jest" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15" }, diff --git a/packages/match-list/package.json b/packages/match-list/package.json index cf344914b6..89287dc558 100644 --- a/packages/match-list/package.json +++ b/packages/match-list/package.json @@ -14,7 +14,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash": "^4.17.10", diff --git a/packages/match/configure/package.json b/packages/match/configure/package.json index 80a2bcf7b5..29b38ca932 100644 --- a/packages/match/configure/package.json +++ b/packages/match/configure/package.json @@ -10,7 +10,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^3.1.0", "lodash": "^4.17.15", diff --git a/packages/match/controller/package.json b/packages/match/controller/package.json index 7e2b71406b..55d86a6cd6 100644 --- a/packages/match/controller/package.json +++ b/packages/match/controller/package.json @@ -9,7 +9,7 @@ "test": "./node_modules/.bin/jest" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0" }, "devDependencies": { diff --git a/packages/match/package.json b/packages/match/package.json index 235445c377..79b062608f 100644 --- a/packages/match/package.json +++ b/packages/match/package.json @@ -13,7 +13,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash": "^4.17.10", diff --git a/packages/math-inline/configure/package.json b/packages/math-inline/configure/package.json index 7202e2f641..556a3d01ed 100644 --- a/packages/math-inline/configure/package.json +++ b/packages/math-inline/configure/package.json @@ -11,7 +11,7 @@ "@material-ui/icons": "^3.0.1", "@pie-framework/mathquill": "^1.1.3", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^3.1.0", "prop-types": "^15.6.2", diff --git a/packages/math-inline/controller/package.json b/packages/math-inline/controller/package.json index d50a26a254..81157844d6 100644 --- a/packages/math-inline/controller/package.json +++ b/packages/math-inline/controller/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@pie-framework/math-validation": "^1.2.3", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15" }, diff --git a/packages/math-inline/package.json b/packages/math-inline/package.json index 3730159905..36da905e27 100644 --- a/packages/math-inline/package.json +++ b/packages/math-inline/package.json @@ -14,7 +14,7 @@ "@material-ui/core": "^3.9.2", "@pie-framework/mathquill": "^1.1.3", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "lodash": "^4.17.10", diff --git a/packages/math-templated/configure/package.json b/packages/math-templated/configure/package.json index 1715265865..b925c87b9a 100644 --- a/packages/math-templated/configure/package.json +++ b/packages/math-templated/configure/package.json @@ -8,7 +8,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "prop-types": "^15.6.2", diff --git a/packages/math-templated/controller/package.json b/packages/math-templated/controller/package.json index 582f57faf9..de4a9fa649 100644 --- a/packages/math-templated/controller/package.json +++ b/packages/math-templated/controller/package.json @@ -7,7 +7,7 @@ "module": "src/index.js", "dependencies": { "@pie-framework/math-validation": "^1.2.3", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15" }, diff --git a/packages/math-templated/package.json b/packages/math-templated/package.json index d6caa1c3ef..c4fc522ca0 100644 --- a/packages/math-templated/package.json +++ b/packages/math-templated/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "prop-types": "^15.6.1", "react": "^16.8.1", "react-dom": "^16.8.1" diff --git a/packages/matrix/configure/package.json b/packages/matrix/configure/package.json index 366f4509dc..fa968d41f3 100644 --- a/packages/matrix/configure/package.json +++ b/packages/matrix/configure/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1", "prop-types": "^15.6.2", "react": "^16.8.1", diff --git a/packages/matrix/package.json b/packages/matrix/package.json index 5db3e2328a..ba0f1638cf 100644 --- a/packages/matrix/package.json +++ b/packages/matrix/package.json @@ -12,7 +12,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1", "prop-types": "^15.6.1", "react": "^16.8.1", diff --git a/packages/multi-trait-rubric/configure/package.json b/packages/multi-trait-rubric/configure/package.json index 9c70c67512..26ea620607 100644 --- a/packages/multi-trait-rubric/configure/package.json +++ b/packages/multi-trait-rubric/configure/package.json @@ -8,7 +8,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "prop-types": "^15.6.2", diff --git a/packages/multi-trait-rubric/controller/package.json b/packages/multi-trait-rubric/controller/package.json index 1c01739772..c834426d02 100644 --- a/packages/multi-trait-rubric/controller/package.json +++ b/packages/multi-trait-rubric/controller/package.json @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15" } diff --git a/packages/multi-trait-rubric/package.json b/packages/multi-trait-rubric/package.json index 008cae6219..e0d26fb2e5 100644 --- a/packages/multi-trait-rubric/package.json +++ b/packages/multi-trait-rubric/package.json @@ -8,7 +8,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "clsx": "^1.1.1", "enzyme-to-json": "^3.3.5", "prop-types": "^15.6.1", diff --git a/packages/multiple-choice/configure/package.json b/packages/multiple-choice/configure/package.json index 65049b6789..005e4d9e4f 100644 --- a/packages/multiple-choice/configure/package.json +++ b/packages/multiple-choice/configure/package.json @@ -8,7 +8,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "prop-types": "^15.6.2", diff --git a/packages/multiple-choice/controller/package.json b/packages/multiple-choice/controller/package.json index d445e902a2..70c6aa3fcc 100644 --- a/packages/multiple-choice/controller/package.json +++ b/packages/multiple-choice/controller/package.json @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15" } diff --git a/packages/multiple-choice/package.json b/packages/multiple-choice/package.json index 8ac8e2fc5a..9ff3cc6764 100644 --- a/packages/multiple-choice/package.json +++ b/packages/multiple-choice/package.json @@ -8,7 +8,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "debug": "^4.1.1", "enzyme-to-json": "^3.3.3", diff --git a/packages/multiple-choice/src/choice-input.jsx b/packages/multiple-choice/src/choice-input.jsx index a8b73dbec3..b3269dbc92 100644 --- a/packages/multiple-choice/src/choice-input.jsx +++ b/packages/multiple-choice/src/choice-input.jsx @@ -52,7 +52,8 @@ const styleSheet = (theme) => ({ display: 'flex', alignItems: 'center', '& > span': { - paddingLeft: 0, + // visually reduce right padding, but maintain accessibility padding for checkbox indicators to be circles + marginLeft: `-${theme.spacing.unit}px`, }, }, }); diff --git a/packages/multiple-choice/src/index.js b/packages/multiple-choice/src/index.js index d062887298..ebddfbe184 100644 --- a/packages/multiple-choice/src/index.js +++ b/packages/multiple-choice/src/index.js @@ -43,6 +43,7 @@ export default class MultipleChoice extends HTMLElement { this.audioComplete = false; this._boundHandleKeyDown = this.handleKeyDown.bind(this); this._keyboardEventsEnabled = false; + this._audioInitialized = false; this._rerender = debounce( () => { @@ -112,6 +113,8 @@ export default class MultipleChoice extends HTMLElement { set model(s) { this._model = s; this._rerender(); + // reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio + this._audioInitialized = false; this._dispatchModelSet(); } @@ -168,6 +171,8 @@ export default class MultipleChoice extends HTMLElement { const observer = new MutationObserver((mutationsList, observer) => { mutationsList.forEach((mutation) => { if (mutation.type === 'childList') { + if (this._audioInitialized) return; + const audio = this.querySelector('audio'); const isInsidePrompt = audio && audio.closest('#preview-prompt'); @@ -228,6 +233,8 @@ export default class MultipleChoice extends HTMLElement { this._handlePlaying = handlePlaying; this._handleEnded = handleEnded; this._enableAudio = enableAudio; + // set to true to prevent multiple initializations + this._audioInitialized = true; observer.disconnect(); } diff --git a/packages/number-line/configure/package.json b/packages/number-line/configure/package.json index bafdc46d49..4112933a4b 100644 --- a/packages/number-line/configure/package.json +++ b/packages/number-line/configure/package.json @@ -7,7 +7,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15", "react": "^16.8.1", "react-dom": "^16.8.1" diff --git a/packages/number-line/controller/package.json b/packages/number-line/controller/package.json index b8e9ed5c8d..c1c1a4b960 100644 --- a/packages/number-line/controller/package.json +++ b/packages/number-line/controller/package.json @@ -14,7 +14,7 @@ "access": "public" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15", "mathjs": "^7.5.1" }, diff --git a/packages/number-line/package.json b/packages/number-line/package.json index abdd15baa9..f067aff7c2 100644 --- a/packages/number-line/package.json +++ b/packages/number-line/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "@material-ui/core": "^3.9.2", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "d3-scale": "^3.2.1", "d3-selection": "^1.4.1", diff --git a/packages/passage/configure/package.json b/packages/passage/configure/package.json index 326b55ddcb..e8e9419838 100644 --- a/packages/passage/configure/package.json +++ b/packages/passage/configure/package.json @@ -10,7 +10,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15", "prop-types": "^15.6.2", "react": "^16.8.1", diff --git a/packages/passage/package.json b/packages/passage/package.json index e50534ec78..8404a7b4b1 100644 --- a/packages/passage/package.json +++ b/packages/passage/package.json @@ -11,7 +11,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "prop-types": "^15.6.1", "react": "^16.8.1", diff --git a/packages/placement-ordering/configure/package.json b/packages/placement-ordering/configure/package.json index 36c2de13f0..54d936670b 100644 --- a/packages/placement-ordering/configure/package.json +++ b/packages/placement-ordering/configure/package.json @@ -8,7 +8,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.1", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "nested-property": "^0.0.7", diff --git a/packages/placement-ordering/controller/package.json b/packages/placement-ordering/controller/package.json index f9665d2589..dc7b1372c9 100644 --- a/packages/placement-ordering/controller/package.json +++ b/packages/placement-ordering/controller/package.json @@ -5,7 +5,7 @@ "main": "lib/index.js", "module": "src/index.js", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "js-combinatorics": "^0.5.4", "lodash": "^4.17.19" diff --git a/packages/placement-ordering/package.json b/packages/placement-ordering/package.json index 7b852098b2..c6008fec43 100644 --- a/packages/placement-ordering/package.json +++ b/packages/placement-ordering/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1", "decimal.js": "^10.0.0", "lodash": "^4.17.10", diff --git a/packages/protractor/package.json b/packages/protractor/package.json index 5bfed398df..3c44d791fc 100644 --- a/packages/protractor/package.json +++ b/packages/protractor/package.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "@material-ui/core": "^3.9.2", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "classnames": "^2.2.5", "react": "^16.8.1", "react-dom": "^16.8.1" diff --git a/packages/rubric/configure/package.json b/packages/rubric/configure/package.json index 64b8d34b27..57486f7866 100644 --- a/packages/rubric/configure/package.json +++ b/packages/rubric/configure/package.json @@ -8,7 +8,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^4.1.1", "react": "^16.8.6", "react-dom": "^16.8.6" diff --git a/packages/rubric/controller/package.json b/packages/rubric/controller/package.json index 6fe7fd87bd..ec200a3f0c 100644 --- a/packages/rubric/controller/package.json +++ b/packages/rubric/controller/package.json @@ -7,7 +7,7 @@ "test": "./node_modules/.bin/jest" }, "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "lodash": "^4.17.15" } } diff --git a/packages/rubric/package.json b/packages/rubric/package.json index 28130a2ea6..bb75be2f60 100644 --- a/packages/rubric/package.json +++ b/packages/rubric/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@material-ui/core": "^3.9.2", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "prop-types": "^15.7.2" }, "author": "pie framework developers", diff --git a/packages/ruler/configure/package.json b/packages/ruler/configure/package.json index 7325874c6b..c1333f3e9a 100644 --- a/packages/ruler/configure/package.json +++ b/packages/ruler/configure/package.json @@ -7,7 +7,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3" + "@pie-lib/pie-toolbox": "2.14.5" }, "author": "", "license": "ISC" diff --git a/packages/ruler/package.json b/packages/ruler/package.json index 3826c4d352..a897cedd82 100644 --- a/packages/ruler/package.json +++ b/packages/ruler/package.json @@ -11,7 +11,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "prop-types": "^15.6.1", "react": "^16.8.1", "react-dom": "^16.8.1" diff --git a/packages/select-text/configure/package.json b/packages/select-text/configure/package.json index 114a297d22..64d8e16b16 100644 --- a/packages/select-text/configure/package.json +++ b/packages/select-text/configure/package.json @@ -8,7 +8,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-configure-events": "^1.3.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15", "prop-types": "^15.6.2", diff --git a/packages/select-text/controller/package.json b/packages/select-text/controller/package.json index 8f1d37ff72..f4839d0f77 100644 --- a/packages/select-text/controller/package.json +++ b/packages/select-text/controller/package.json @@ -6,7 +6,7 @@ "main": "lib/index.js", "module": "src/index.js", "dependencies": { - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "debug": "^3.1.0", "lodash": "^4.17.15" }, diff --git a/packages/select-text/package.json b/packages/select-text/package.json index 6501848747..3cc7ee725b 100644 --- a/packages/select-text/package.json +++ b/packages/select-text/package.json @@ -9,7 +9,7 @@ "dependencies": { "@material-ui/core": "^3.9.2", "@pie-framework/pie-player-events": "^0.1.0", - "@pie-lib/pie-toolbox": "2.14.3", + "@pie-lib/pie-toolbox": "2.14.5", "prop-types": "^15.6.1", "react": "^16.8.1", "react-dom": "^16.8.1" diff --git a/pslb/pslb.config.js b/pslb/pslb.config.js index 75c8a7bb39..934be0d810 100644 --- a/pslb/pslb.config.js +++ b/pslb/pslb.config.js @@ -46,7 +46,7 @@ module.exports = { libs: { repository: 'pie-framework/pie-elements', packages: [ - { name: '@pie-lib/pie-toolbox-module', version: '6.0.3' } + { name: '@pie-lib/pie-toolbox-module', version: '6.1.0' } ], }, }; diff --git a/yarn.lock b/yarn.lock index be2645a55d..efbe3df049 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2276,10 +2276,10 @@ resolved "https://registry.yarnpkg.com/@pie-framework/pie-player-events/-/pie-player-events-0.1.0.tgz#0150904118fd604559982ab658967811c053ffe3" integrity sha512-6H1tlRGmcZ3Wt+8HMqu5KugVcwwyNrMylfI5rIpvOSt0T82QDmjRj+2sPgQG5zos/w6MtwUqn/QZ+8Rq2EXSOA== -"@pie-lib/pie-toolbox@2.14.3": - version "2.14.3" - resolved "https://registry.yarnpkg.com/@pie-lib/pie-toolbox/-/pie-toolbox-2.14.3.tgz#26cdf7e19e229fe6a91772979d1c8827c91b5dfe" - integrity sha512-Nj9OXIqAabW+9stE6hh12EXC55xSnd0bcK7yIr8ETCPv8ByUMZcyiUzTeP55I/PY5iTom0/5g2b5jc9sTEfxgA== +"@pie-lib/pie-toolbox@2.14.5": + version "2.14.5" + resolved "https://registry.yarnpkg.com/@pie-lib/pie-toolbox/-/pie-toolbox-2.14.5.tgz#cdd1e213ef2c37d2325af5acdd690e489effe9a8" + integrity sha512-qHKZH8L9i8Z+e5xZA3TdEzgn9aVe91eSqcZZMQRmcoT5NZA3WKgLSpdahnpCI3Yo30DcaJUKDtIMHf9qbNKlsQ== dependencies: "@mapbox/point-geometry" "^0.1.0" "@material-ui/core" "^3.8.3"