@pie-element/math-templated 3.4.6-next.2 → 3.4.6-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "2.9.5",
11
+ "@pie-lib/pie-toolbox": "2.10.0",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "prop-types": "^15.6.2",
@@ -7,7 +7,7 @@
7
7
  "module": "src/index.js",
8
8
  "dependencies": {
9
9
  "@pie-framework/math-validation": "^1.2.3",
10
- "@pie-lib/pie-toolbox": "2.9.5",
10
+ "@pie-lib/pie-toolbox": "2.10.0",
11
11
  "debug": "^3.1.0",
12
12
  "lodash": "^4.17.15"
13
13
  },
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.4/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@5.10.4/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.5/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@5.10.5/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -126201,7 +126201,7 @@ const require$$11$4 = _dll_prop_types;
126201
126201
  }
126202
126202
  _this = _super.call.apply(_super, [this].concat(args));
126203
126203
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "parsedText", function (text) {
126204
- var autoplayAudioEnabled = _this.props.autoplayAudioEnabled;
126204
+ var customAudioButton = _this.props.customAudioButton;
126205
126205
  var div = document.createElement('div');
126206
126206
  div.innerHTML = text;
126207
126207
  var audio = div.querySelector('audio');
@@ -126210,25 +126210,101 @@ const require$$11$4 = _dll_prop_types;
126210
126210
  source.setAttribute('type', 'audio/mp3');
126211
126211
  source.setAttribute('src', audio.getAttribute('src'));
126212
126212
  audio.removeAttribute('src');
126213
- if (autoplayAudioEnabled) {
126214
- audio.setAttribute('autoplay', 'autoplay');
126215
- }
126213
+ audio.setAttribute('id', 'pie-prompt-audio-player');
126216
126214
  audio.appendChild(source);
126215
+ if (customAudioButton) {
126216
+ audio.style.display = 'none';
126217
+ var playButton = document.createElement('div');
126218
+ playButton.id = 'play-audio-button';
126219
+ Object.assign(playButton.style, {
126220
+ cursor: 'pointer',
126221
+ display: 'block',
126222
+ width: '128px',
126223
+ height: '128px',
126224
+ backgroundImage: ("url(").concat(customAudioButton.pauseImage, ")"),
126225
+ backgroundSize: 'cover',
126226
+ borderRadius: '50%',
126227
+ border: '1px solid #326295'
126228
+ });
126229
+ audio.parentNode.insertBefore(playButton, audio);
126230
+ }
126217
126231
  }
126218
126232
  return div.innerHTML;
126219
126233
  });
126220
126234
  return _this;
126221
126235
  }
126222
126236
  (0, _createClass2["default"])(PreviewPrompt, [{
126237
+ key: "addCustomAudioButtonControls",
126238
+ value: function addCustomAudioButtonControls() {
126239
+ var _this$props = this.props, autoplayAudioEnabled = _this$props.autoplayAudioEnabled, customAudioButton = _this$props.customAudioButton;
126240
+ var playButton = document.getElementById('play-audio-button');
126241
+ var audio = document.getElementById('pie-prompt-audio-player');
126242
+ if (autoplayAudioEnabled && audio) {
126243
+ audio.play().then(function () {
126244
+ if (playButton && customAudioButton) {
126245
+ audio.addEventListener('ended', handleAudioEnded);
126246
+ }
126247
+ })["catch"](function (error) {
126248
+ console.error('Error playing audio', error);
126249
+ });
126250
+ }
126251
+ if (!playButton || !audio || !customAudioButton) return;
126252
+ var handlePlayClick = function handlePlayClick() {
126253
+ if (!audio.paused) return;
126254
+ if (playButton.style.backgroundImage.includes(customAudioButton.pauseImage)) return;
126255
+ audio.play();
126256
+ };
126257
+ var handleAudioEnded = function handleAudioEnded() {
126258
+ playButton.style.backgroundImage = ("url(").concat(customAudioButton.playImage, ")");
126259
+ };
126260
+ var handleAudioPlay = function handleAudioPlay() {
126261
+ Object.assign(playButton.style, {
126262
+ backgroundImage: ("url(").concat(customAudioButton.pauseImage, ")"),
126263
+ border: '1px solid #ccc'
126264
+ });
126265
+ };
126266
+ var handleAudioPause = function handleAudioPause() {
126267
+ Object.assign(playButton.style, {
126268
+ backgroundImage: ("url(").concat(customAudioButton.playImage, ")"),
126269
+ border: '1px solid #326295'
126270
+ });
126271
+ };
126272
+ playButton.addEventListener('click', handlePlayClick);
126273
+ audio.addEventListener('play', handleAudioPlay);
126274
+ audio.addEventListener('pause', handleAudioPause);
126275
+ audio.addEventListener('ended', handleAudioEnded);
126276
+ this._handlePlayClick = handlePlayClick;
126277
+ this._handleAudioPlay = handleAudioPlay;
126278
+ this._handleAudioPause = handleAudioPause;
126279
+ this._handleAudioEnded = handleAudioEnded;
126280
+ }
126281
+ }, {
126282
+ key: "removeCustomAudioButtonListeners",
126283
+ value: function removeCustomAudioButtonListeners() {
126284
+ var playButton = document.getElementById('play-audio-button');
126285
+ var audio = document.querySelector('audio');
126286
+ if (!playButton || !audio) return;
126287
+ playButton.removeEventListener('click', this._handlePlayClick);
126288
+ audio.removeEventListener('play', this._handleAudioPlay);
126289
+ audio.removeEventListener('pause', this._handleAudioPause);
126290
+ audio.removeEventListener('ended', this._handleAudioEnded);
126291
+ }
126292
+ }, {
126223
126293
  key: "componentDidMount",
126224
126294
  value: function componentDidMount() {
126225
126295
  this.alignImages();
126296
+ this.addCustomAudioButtonControls();
126226
126297
  }
126227
126298
  }, {
126228
126299
  key: "componentDidUpdate",
126229
126300
  value: function componentDidUpdate() {
126230
126301
  this.alignImages();
126231
126302
  }
126303
+ }, {
126304
+ key: "componentWillUnmount",
126305
+ value: function componentWillUnmount() {
126306
+ this.removeCustomAudioButtonListeners();
126307
+ }
126232
126308
  }, {
126233
126309
  key: "alignImages",
126234
126310
  value: function alignImages() {
@@ -126263,7 +126339,7 @@ const require$$11$4 = _dll_prop_types;
126263
126339
  }, {
126264
126340
  key: "render",
126265
126341
  value: function render() {
126266
- var _this$props = this.props, prompt = _this$props.prompt, classes = _this$props.classes, tagName = _this$props.tagName, className = _this$props.className, onClick = _this$props.onClick, defaultClassName = _this$props.defaultClassName;
126342
+ var _this$props2 = this.props, prompt = _this$props2.prompt, classes = _this$props2.classes, tagName = _this$props2.tagName, className = _this$props2.className, onClick = _this$props2.onClick, defaultClassName = _this$props2.defaultClassName;
126267
126343
  var CustomTag = tagName || 'div';
126268
126344
  var legendClass = tagName === 'legend' ? 'legend' : '';
126269
126345
  var customClasses = ("").concat(classes.promptTable, " ").concat(classes[className] || '', " ").concat(defaultClassName || '', " ").concat(classes[legendClass] || '');
@@ -126287,7 +126363,11 @@ const require$$11$4 = _dll_prop_types;
126287
126363
  className: _propTypes["default"].string,
126288
126364
  onClick: _propTypes["default"].func,
126289
126365
  defaultClassName: _propTypes["default"].string,
126290
- autoplayAudioEnabled: _propTypes["default"].bool
126366
+ autoplayAudioEnabled: _propTypes["default"].bool,
126367
+ customAudioButton: {
126368
+ playImage: _propTypes["default"].string,
126369
+ pauseImage: _propTypes["default"].string
126370
+ }
126291
126371
  });
126292
126372
  (0, _defineProperty2["default"])(PreviewPrompt, "defaultProps", {
126293
126373
  onClick: function onClick() {}
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.4/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.10.4/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.5/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.10.5/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -142322,7 +142322,7 @@ const require$$11$r = _dll_prop_types;
142322
142322
  }
142323
142323
  _this = _super.call.apply(_super, [this].concat(args));
142324
142324
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "parsedText", function (text) {
142325
- var autoplayAudioEnabled = _this.props.autoplayAudioEnabled;
142325
+ var customAudioButton = _this.props.customAudioButton;
142326
142326
  var div = document.createElement('div');
142327
142327
  div.innerHTML = text;
142328
142328
  var audio = div.querySelector('audio');
@@ -142331,25 +142331,101 @@ const require$$11$r = _dll_prop_types;
142331
142331
  source.setAttribute('type', 'audio/mp3');
142332
142332
  source.setAttribute('src', audio.getAttribute('src'));
142333
142333
  audio.removeAttribute('src');
142334
- if (autoplayAudioEnabled) {
142335
- audio.setAttribute('autoplay', 'autoplay');
142336
- }
142334
+ audio.setAttribute('id', 'pie-prompt-audio-player');
142337
142335
  audio.appendChild(source);
142336
+ if (customAudioButton) {
142337
+ audio.style.display = 'none';
142338
+ var playButton = document.createElement('div');
142339
+ playButton.id = 'play-audio-button';
142340
+ Object.assign(playButton.style, {
142341
+ cursor: 'pointer',
142342
+ display: 'block',
142343
+ width: '128px',
142344
+ height: '128px',
142345
+ backgroundImage: ("url(").concat(customAudioButton.pauseImage, ")"),
142346
+ backgroundSize: 'cover',
142347
+ borderRadius: '50%',
142348
+ border: '1px solid #326295'
142349
+ });
142350
+ audio.parentNode.insertBefore(playButton, audio);
142351
+ }
142338
142352
  }
142339
142353
  return div.innerHTML;
142340
142354
  });
142341
142355
  return _this;
142342
142356
  }
142343
142357
  (0, _createClass2["default"])(PreviewPrompt, [{
142358
+ key: "addCustomAudioButtonControls",
142359
+ value: function addCustomAudioButtonControls() {
142360
+ var _this$props = this.props, autoplayAudioEnabled = _this$props.autoplayAudioEnabled, customAudioButton = _this$props.customAudioButton;
142361
+ var playButton = document.getElementById('play-audio-button');
142362
+ var audio = document.getElementById('pie-prompt-audio-player');
142363
+ if (autoplayAudioEnabled && audio) {
142364
+ audio.play().then(function () {
142365
+ if (playButton && customAudioButton) {
142366
+ audio.addEventListener('ended', handleAudioEnded);
142367
+ }
142368
+ })["catch"](function (error) {
142369
+ console.error('Error playing audio', error);
142370
+ });
142371
+ }
142372
+ if (!playButton || !audio || !customAudioButton) return;
142373
+ var handlePlayClick = function handlePlayClick() {
142374
+ if (!audio.paused) return;
142375
+ if (playButton.style.backgroundImage.includes(customAudioButton.pauseImage)) return;
142376
+ audio.play();
142377
+ };
142378
+ var handleAudioEnded = function handleAudioEnded() {
142379
+ playButton.style.backgroundImage = ("url(").concat(customAudioButton.playImage, ")");
142380
+ };
142381
+ var handleAudioPlay = function handleAudioPlay() {
142382
+ Object.assign(playButton.style, {
142383
+ backgroundImage: ("url(").concat(customAudioButton.pauseImage, ")"),
142384
+ border: '1px solid #ccc'
142385
+ });
142386
+ };
142387
+ var handleAudioPause = function handleAudioPause() {
142388
+ Object.assign(playButton.style, {
142389
+ backgroundImage: ("url(").concat(customAudioButton.playImage, ")"),
142390
+ border: '1px solid #326295'
142391
+ });
142392
+ };
142393
+ playButton.addEventListener('click', handlePlayClick);
142394
+ audio.addEventListener('play', handleAudioPlay);
142395
+ audio.addEventListener('pause', handleAudioPause);
142396
+ audio.addEventListener('ended', handleAudioEnded);
142397
+ this._handlePlayClick = handlePlayClick;
142398
+ this._handleAudioPlay = handleAudioPlay;
142399
+ this._handleAudioPause = handleAudioPause;
142400
+ this._handleAudioEnded = handleAudioEnded;
142401
+ }
142402
+ }, {
142403
+ key: "removeCustomAudioButtonListeners",
142404
+ value: function removeCustomAudioButtonListeners() {
142405
+ var playButton = document.getElementById('play-audio-button');
142406
+ var audio = document.querySelector('audio');
142407
+ if (!playButton || !audio) return;
142408
+ playButton.removeEventListener('click', this._handlePlayClick);
142409
+ audio.removeEventListener('play', this._handleAudioPlay);
142410
+ audio.removeEventListener('pause', this._handleAudioPause);
142411
+ audio.removeEventListener('ended', this._handleAudioEnded);
142412
+ }
142413
+ }, {
142344
142414
  key: "componentDidMount",
142345
142415
  value: function componentDidMount() {
142346
142416
  this.alignImages();
142417
+ this.addCustomAudioButtonControls();
142347
142418
  }
142348
142419
  }, {
142349
142420
  key: "componentDidUpdate",
142350
142421
  value: function componentDidUpdate() {
142351
142422
  this.alignImages();
142352
142423
  }
142424
+ }, {
142425
+ key: "componentWillUnmount",
142426
+ value: function componentWillUnmount() {
142427
+ this.removeCustomAudioButtonListeners();
142428
+ }
142353
142429
  }, {
142354
142430
  key: "alignImages",
142355
142431
  value: function alignImages() {
@@ -142384,7 +142460,7 @@ const require$$11$r = _dll_prop_types;
142384
142460
  }, {
142385
142461
  key: "render",
142386
142462
  value: function render() {
142387
- var _this$props = this.props, prompt = _this$props.prompt, classes = _this$props.classes, tagName = _this$props.tagName, className = _this$props.className, onClick = _this$props.onClick, defaultClassName = _this$props.defaultClassName;
142463
+ var _this$props2 = this.props, prompt = _this$props2.prompt, classes = _this$props2.classes, tagName = _this$props2.tagName, className = _this$props2.className, onClick = _this$props2.onClick, defaultClassName = _this$props2.defaultClassName;
142388
142464
  var CustomTag = tagName || 'div';
142389
142465
  var legendClass = tagName === 'legend' ? 'legend' : '';
142390
142466
  var customClasses = ("").concat(classes.promptTable, " ").concat(classes[className] || '', " ").concat(defaultClassName || '', " ").concat(classes[legendClass] || '');
@@ -142408,7 +142484,11 @@ const require$$11$r = _dll_prop_types;
142408
142484
  className: _propTypes["default"].string,
142409
142485
  onClick: _propTypes["default"].func,
142410
142486
  defaultClassName: _propTypes["default"].string,
142411
- autoplayAudioEnabled: _propTypes["default"].bool
142487
+ autoplayAudioEnabled: _propTypes["default"].bool,
142488
+ customAudioButton: {
142489
+ playImage: _propTypes["default"].string,
142490
+ pauseImage: _propTypes["default"].string
142491
+ }
142412
142492
  });
142413
142493
  (0, _defineProperty2["default"])(PreviewPrompt, "defaultProps", {
142414
142494
  onClick: function onClick() {}
@@ -4,11 +4,11 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "3.3.4"
7
+ "version": "3.3.5"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "5.10.4"
11
+ "version": "5.10.5"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.4/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.10.4/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.3.5/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.10.5/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -142285,7 +142285,7 @@ const require$$11$r = _dll_prop_types;
142285
142285
  }
142286
142286
  _this = _super.call.apply(_super, [this].concat(args));
142287
142287
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "parsedText", function (text) {
142288
- var autoplayAudioEnabled = _this.props.autoplayAudioEnabled;
142288
+ var customAudioButton = _this.props.customAudioButton;
142289
142289
  var div = document.createElement('div');
142290
142290
  div.innerHTML = text;
142291
142291
  var audio = div.querySelector('audio');
@@ -142294,25 +142294,101 @@ const require$$11$r = _dll_prop_types;
142294
142294
  source.setAttribute('type', 'audio/mp3');
142295
142295
  source.setAttribute('src', audio.getAttribute('src'));
142296
142296
  audio.removeAttribute('src');
142297
- if (autoplayAudioEnabled) {
142298
- audio.setAttribute('autoplay', 'autoplay');
142299
- }
142297
+ audio.setAttribute('id', 'pie-prompt-audio-player');
142300
142298
  audio.appendChild(source);
142299
+ if (customAudioButton) {
142300
+ audio.style.display = 'none';
142301
+ var playButton = document.createElement('div');
142302
+ playButton.id = 'play-audio-button';
142303
+ Object.assign(playButton.style, {
142304
+ cursor: 'pointer',
142305
+ display: 'block',
142306
+ width: '128px',
142307
+ height: '128px',
142308
+ backgroundImage: ("url(").concat(customAudioButton.pauseImage, ")"),
142309
+ backgroundSize: 'cover',
142310
+ borderRadius: '50%',
142311
+ border: '1px solid #326295'
142312
+ });
142313
+ audio.parentNode.insertBefore(playButton, audio);
142314
+ }
142301
142315
  }
142302
142316
  return div.innerHTML;
142303
142317
  });
142304
142318
  return _this;
142305
142319
  }
142306
142320
  (0, _createClass2["default"])(PreviewPrompt, [{
142321
+ key: "addCustomAudioButtonControls",
142322
+ value: function addCustomAudioButtonControls() {
142323
+ var _this$props = this.props, autoplayAudioEnabled = _this$props.autoplayAudioEnabled, customAudioButton = _this$props.customAudioButton;
142324
+ var playButton = document.getElementById('play-audio-button');
142325
+ var audio = document.getElementById('pie-prompt-audio-player');
142326
+ if (autoplayAudioEnabled && audio) {
142327
+ audio.play().then(function () {
142328
+ if (playButton && customAudioButton) {
142329
+ audio.addEventListener('ended', handleAudioEnded);
142330
+ }
142331
+ })["catch"](function (error) {
142332
+ console.error('Error playing audio', error);
142333
+ });
142334
+ }
142335
+ if (!playButton || !audio || !customAudioButton) return;
142336
+ var handlePlayClick = function handlePlayClick() {
142337
+ if (!audio.paused) return;
142338
+ if (playButton.style.backgroundImage.includes(customAudioButton.pauseImage)) return;
142339
+ audio.play();
142340
+ };
142341
+ var handleAudioEnded = function handleAudioEnded() {
142342
+ playButton.style.backgroundImage = ("url(").concat(customAudioButton.playImage, ")");
142343
+ };
142344
+ var handleAudioPlay = function handleAudioPlay() {
142345
+ Object.assign(playButton.style, {
142346
+ backgroundImage: ("url(").concat(customAudioButton.pauseImage, ")"),
142347
+ border: '1px solid #ccc'
142348
+ });
142349
+ };
142350
+ var handleAudioPause = function handleAudioPause() {
142351
+ Object.assign(playButton.style, {
142352
+ backgroundImage: ("url(").concat(customAudioButton.playImage, ")"),
142353
+ border: '1px solid #326295'
142354
+ });
142355
+ };
142356
+ playButton.addEventListener('click', handlePlayClick);
142357
+ audio.addEventListener('play', handleAudioPlay);
142358
+ audio.addEventListener('pause', handleAudioPause);
142359
+ audio.addEventListener('ended', handleAudioEnded);
142360
+ this._handlePlayClick = handlePlayClick;
142361
+ this._handleAudioPlay = handleAudioPlay;
142362
+ this._handleAudioPause = handleAudioPause;
142363
+ this._handleAudioEnded = handleAudioEnded;
142364
+ }
142365
+ }, {
142366
+ key: "removeCustomAudioButtonListeners",
142367
+ value: function removeCustomAudioButtonListeners() {
142368
+ var playButton = document.getElementById('play-audio-button');
142369
+ var audio = document.querySelector('audio');
142370
+ if (!playButton || !audio) return;
142371
+ playButton.removeEventListener('click', this._handlePlayClick);
142372
+ audio.removeEventListener('play', this._handleAudioPlay);
142373
+ audio.removeEventListener('pause', this._handleAudioPause);
142374
+ audio.removeEventListener('ended', this._handleAudioEnded);
142375
+ }
142376
+ }, {
142307
142377
  key: "componentDidMount",
142308
142378
  value: function componentDidMount() {
142309
142379
  this.alignImages();
142380
+ this.addCustomAudioButtonControls();
142310
142381
  }
142311
142382
  }, {
142312
142383
  key: "componentDidUpdate",
142313
142384
  value: function componentDidUpdate() {
142314
142385
  this.alignImages();
142315
142386
  }
142387
+ }, {
142388
+ key: "componentWillUnmount",
142389
+ value: function componentWillUnmount() {
142390
+ this.removeCustomAudioButtonListeners();
142391
+ }
142316
142392
  }, {
142317
142393
  key: "alignImages",
142318
142394
  value: function alignImages() {
@@ -142347,7 +142423,7 @@ const require$$11$r = _dll_prop_types;
142347
142423
  }, {
142348
142424
  key: "render",
142349
142425
  value: function render() {
142350
- var _this$props = this.props, prompt = _this$props.prompt, classes = _this$props.classes, tagName = _this$props.tagName, className = _this$props.className, onClick = _this$props.onClick, defaultClassName = _this$props.defaultClassName;
142426
+ var _this$props2 = this.props, prompt = _this$props2.prompt, classes = _this$props2.classes, tagName = _this$props2.tagName, className = _this$props2.className, onClick = _this$props2.onClick, defaultClassName = _this$props2.defaultClassName;
142351
142427
  var CustomTag = tagName || 'div';
142352
142428
  var legendClass = tagName === 'legend' ? 'legend' : '';
142353
142429
  var customClasses = ("").concat(classes.promptTable, " ").concat(classes[className] || '', " ").concat(defaultClassName || '', " ").concat(classes[legendClass] || '');
@@ -142371,7 +142447,11 @@ const require$$11$r = _dll_prop_types;
142371
142447
  className: _propTypes["default"].string,
142372
142448
  onClick: _propTypes["default"].func,
142373
142449
  defaultClassName: _propTypes["default"].string,
142374
- autoplayAudioEnabled: _propTypes["default"].bool
142450
+ autoplayAudioEnabled: _propTypes["default"].bool,
142451
+ customAudioButton: {
142452
+ playImage: _propTypes["default"].string,
142453
+ pauseImage: _propTypes["default"].string
142454
+ }
142375
142455
  });
142376
142456
  (0, _defineProperty2["default"])(PreviewPrompt, "defaultProps", {
142377
142457
  onClick: function onClick() {}
package/package.json CHANGED
@@ -4,19 +4,19 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "3.4.6-next.2+959a39e31",
7
+ "version": "3.4.6-next.6+843584110",
8
8
  "description": "",
9
9
  "dependencies": {
10
10
  "@material-ui/core": "^3.9.2",
11
11
  "@pie-framework/pie-player-events": "^0.1.0",
12
- "@pie-lib/pie-toolbox": "2.9.5",
12
+ "@pie-lib/pie-toolbox": "2.10.0",
13
13
  "prop-types": "^15.6.1",
14
14
  "react": "^16.8.1",
15
15
  "react-dom": "^16.8.1"
16
16
  },
17
17
  "author": "",
18
18
  "license": "ISC",
19
- "gitHead": "959a39e31af790462a237b9e533f66cee138c1ba",
19
+ "gitHead": "843584110d234c09778612f3c9607ec3c7531900",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },