@pie-element/ebsr 10.3.4-next.0 → 10.3.4-next.13
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.
- package/module/element.js +56 -17
- package/module/print.js +56 -17
- package/package.json +3 -3
package/module/element.js
CHANGED
|
@@ -12719,6 +12719,8 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12719
12719
|
this.handleChange = event => {
|
|
12720
12720
|
const {value, checked} = event.target;
|
|
12721
12721
|
const {maxSelections, onChoiceChanged, session} = this.props;
|
|
12722
|
+
const {detail} = event.nativeEvent;
|
|
12723
|
+
let selector = detail ? 'Mouse' : 'Keyboard';
|
|
12722
12724
|
if (session.value && session.value.length >= maxSelections) {
|
|
12723
12725
|
this.setState({
|
|
12724
12726
|
maxSelectionsErrorState: checked
|
|
@@ -12729,7 +12731,8 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12729
12731
|
}
|
|
12730
12732
|
onChoiceChanged({
|
|
12731
12733
|
value,
|
|
12732
|
-
selected: checked
|
|
12734
|
+
selected: checked,
|
|
12735
|
+
selector
|
|
12733
12736
|
});
|
|
12734
12737
|
};
|
|
12735
12738
|
}
|
|
@@ -12813,14 +12816,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12813
12816
|
__self: this,
|
|
12814
12817
|
__source: {
|
|
12815
12818
|
fileName: _jsxFileName$1,
|
|
12816
|
-
lineNumber:
|
|
12819
|
+
lineNumber: 214
|
|
12817
12820
|
}
|
|
12818
12821
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
12819
12822
|
className: classes.srOnly,
|
|
12820
12823
|
__self: this,
|
|
12821
12824
|
__source: {
|
|
12822
12825
|
fileName: _jsxFileName$1,
|
|
12823
|
-
lineNumber:
|
|
12826
|
+
lineNumber: 216
|
|
12824
12827
|
}
|
|
12825
12828
|
}, "Multiple Select Question");
|
|
12826
12829
|
}
|
|
@@ -12833,6 +12836,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12833
12836
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
12834
12837
|
} : undefined;
|
|
12835
12838
|
const selections = session.value && session.value.length || 0;
|
|
12839
|
+
const addAutoplayAudio = autoplayAudioEnabled && !((/Safari|Firefox|Edg/).test(navigator.userAgent) && !(/Chrome/).test(navigator.userAgent));
|
|
12836
12840
|
const teacherInstructionsDiv = React$2.createElement(PreviewPrompt, {
|
|
12837
12841
|
tagName: "div",
|
|
12838
12842
|
className: "prompt",
|
|
@@ -12841,7 +12845,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12841
12845
|
__self: this,
|
|
12842
12846
|
__source: {
|
|
12843
12847
|
fileName: _jsxFileName$1,
|
|
12844
|
-
lineNumber:
|
|
12848
|
+
lineNumber: 251
|
|
12845
12849
|
}
|
|
12846
12850
|
});
|
|
12847
12851
|
const getMultipleChoiceMinSelectionErrorMessage = () => {
|
|
@@ -12868,21 +12872,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12868
12872
|
__self: this,
|
|
12869
12873
|
__source: {
|
|
12870
12874
|
fileName: _jsxFileName$1,
|
|
12871
|
-
lineNumber:
|
|
12875
|
+
lineNumber: 274
|
|
12872
12876
|
}
|
|
12873
12877
|
}, partLabel && React$2.createElement('h3', {
|
|
12874
12878
|
className: classes.partLabel,
|
|
12875
12879
|
__self: this,
|
|
12876
12880
|
__source: {
|
|
12877
12881
|
fileName: _jsxFileName$1,
|
|
12878
|
-
lineNumber:
|
|
12882
|
+
lineNumber: 275
|
|
12879
12883
|
}
|
|
12880
12884
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
12881
12885
|
className: classes.teacherInstructions,
|
|
12882
12886
|
__self: this,
|
|
12883
12887
|
__source: {
|
|
12884
12888
|
fileName: _jsxFileName$1,
|
|
12885
|
-
lineNumber:
|
|
12889
|
+
lineNumber: 280
|
|
12886
12890
|
}
|
|
12887
12891
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
12888
12892
|
labels: {
|
|
@@ -12892,25 +12896,25 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12892
12896
|
__self: this,
|
|
12893
12897
|
__source: {
|
|
12894
12898
|
fileName: _jsxFileName$1,
|
|
12895
|
-
lineNumber:
|
|
12899
|
+
lineNumber: 282
|
|
12896
12900
|
}
|
|
12897
12901
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
12898
12902
|
className: classes.fieldset,
|
|
12899
12903
|
__self: this,
|
|
12900
12904
|
__source: {
|
|
12901
12905
|
fileName: _jsxFileName$1,
|
|
12902
|
-
lineNumber:
|
|
12906
|
+
lineNumber: 296
|
|
12903
12907
|
}
|
|
12904
12908
|
}, React$2.createElement(PreviewPrompt, {
|
|
12905
12909
|
className: "prompt",
|
|
12906
12910
|
defaultClassName: "prompt",
|
|
12907
12911
|
prompt: prompt,
|
|
12908
12912
|
tagName: 'legend',
|
|
12909
|
-
autoplayAudioEnabled:
|
|
12913
|
+
autoplayAudioEnabled: addAutoplayAudio,
|
|
12910
12914
|
__self: this,
|
|
12911
12915
|
__source: {
|
|
12912
12916
|
fileName: _jsxFileName$1,
|
|
12913
|
-
lineNumber:
|
|
12917
|
+
lineNumber: 297
|
|
12914
12918
|
}
|
|
12915
12919
|
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
12916
12920
|
show: showCorrectAnswerToggle,
|
|
@@ -12920,7 +12924,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12920
12924
|
__self: this,
|
|
12921
12925
|
__source: {
|
|
12922
12926
|
fileName: _jsxFileName$1,
|
|
12923
|
-
lineNumber:
|
|
12927
|
+
lineNumber: 306
|
|
12924
12928
|
}
|
|
12925
12929
|
}), React$2.createElement('div', {
|
|
12926
12930
|
className: classNames({
|
|
@@ -12931,7 +12935,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12931
12935
|
__self: this,
|
|
12932
12936
|
__source: {
|
|
12933
12937
|
fileName: _jsxFileName$1,
|
|
12934
|
-
lineNumber:
|
|
12938
|
+
lineNumber: 314
|
|
12935
12939
|
}
|
|
12936
12940
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
12937
12941
|
choicesLayout: this.props.choicesLayout,
|
|
@@ -12954,21 +12958,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12954
12958
|
__self: this,
|
|
12955
12959
|
__source: {
|
|
12956
12960
|
fileName: _jsxFileName$1,
|
|
12957
|
-
lineNumber:
|
|
12961
|
+
lineNumber: 322
|
|
12958
12962
|
}
|
|
12959
12963
|
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12960
12964
|
className: classes.errorText,
|
|
12961
12965
|
__self: this,
|
|
12962
12966
|
__source: {
|
|
12963
12967
|
fileName: _jsxFileName$1,
|
|
12964
|
-
lineNumber:
|
|
12968
|
+
lineNumber: 346
|
|
12965
12969
|
}
|
|
12966
12970
|
}, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
|
|
12967
12971
|
className: classes.errorText,
|
|
12968
12972
|
__self: this,
|
|
12969
12973
|
__source: {
|
|
12970
12974
|
fileName: _jsxFileName$1,
|
|
12971
|
-
lineNumber:
|
|
12975
|
+
lineNumber: 351
|
|
12972
12976
|
}
|
|
12973
12977
|
}, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12974
12978
|
lng: language,
|
|
@@ -13079,6 +13083,7 @@ function updateSessionValue(session, choiceMode, data) {
|
|
|
13079
13083
|
session.value = [];
|
|
13080
13084
|
}
|
|
13081
13085
|
}
|
|
13086
|
+
session.selector = data.selector;
|
|
13082
13087
|
}
|
|
13083
13088
|
const React = _dll_react;
|
|
13084
13089
|
const ReactDOM = _dll_react_dom;
|
|
@@ -13125,6 +13130,9 @@ class MultipleChoice extends HTMLElement {
|
|
|
13125
13130
|
log$1('render complete - render math');
|
|
13126
13131
|
renderMath(this);
|
|
13127
13132
|
});
|
|
13133
|
+
if (this._model.keyboardEventsEnabled === true) {
|
|
13134
|
+
this.enableKeyboardEvents();
|
|
13135
|
+
}
|
|
13128
13136
|
} else {
|
|
13129
13137
|
log$1('skip');
|
|
13130
13138
|
}
|
|
@@ -13194,7 +13202,9 @@ class MultipleChoice extends HTMLElement {
|
|
|
13194
13202
|
const observer = new MutationObserver((mutationsList, observer) => {
|
|
13195
13203
|
mutationsList.forEach(mutation => {
|
|
13196
13204
|
if (mutation.type === 'childList') {
|
|
13197
|
-
const audio = this.querySelector('audio
|
|
13205
|
+
const audio = this.querySelector('audio');
|
|
13206
|
+
const isInsidePrompt = audio && audio.closest('#preview-prompt');
|
|
13207
|
+
if (audio && !isInsidePrompt) return;
|
|
13198
13208
|
if (!audio) return;
|
|
13199
13209
|
const info = this._createAudioInfoToast();
|
|
13200
13210
|
const enableAudio = () => {
|
|
@@ -13208,6 +13218,8 @@ class MultipleChoice extends HTMLElement {
|
|
|
13208
13218
|
if (audio.paused && !this.querySelector('#play-audio-info')) {
|
|
13209
13219
|
this.appendChild(info);
|
|
13210
13220
|
document.addEventListener('click', enableAudio);
|
|
13221
|
+
} else {
|
|
13222
|
+
document.removeEventListener('click', enableAudio);
|
|
13211
13223
|
}
|
|
13212
13224
|
}, 500);
|
|
13213
13225
|
const handlePlaying = () => {
|
|
@@ -13233,6 +13245,33 @@ class MultipleChoice extends HTMLElement {
|
|
|
13233
13245
|
subtree: true
|
|
13234
13246
|
});
|
|
13235
13247
|
}
|
|
13248
|
+
enableKeyboardEvents() {
|
|
13249
|
+
window.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
13250
|
+
}
|
|
13251
|
+
disconnectedCallback() {
|
|
13252
|
+
window.removeEventListener('keydown', this.handleKeyDown.bind(this));
|
|
13253
|
+
}
|
|
13254
|
+
handleKeyDown(event) {
|
|
13255
|
+
if (!this._model || !this._session) {
|
|
13256
|
+
return;
|
|
13257
|
+
}
|
|
13258
|
+
const keyToIndex = key => {
|
|
13259
|
+
const numOffset = key >= '1' && key <= '9' ? key - '1' : key === '0' ? 9 : -1;
|
|
13260
|
+
const letterOffset = (/^[a-jA-J]$/).test(key) ? key.toLowerCase().charCodeAt(0) - ('a').charCodeAt(0) : -1;
|
|
13261
|
+
return numOffset >= 0 ? numOffset : letterOffset;
|
|
13262
|
+
};
|
|
13263
|
+
const choiceIndex = keyToIndex(event.key);
|
|
13264
|
+
if (choiceIndex === undefined || choiceIndex >= this._model.choices.length) {
|
|
13265
|
+
return;
|
|
13266
|
+
}
|
|
13267
|
+
const currentValue = this._session.value || [];
|
|
13268
|
+
const choiceId = this._model.choices[choiceIndex].value;
|
|
13269
|
+
const newValue = {
|
|
13270
|
+
value: choiceId,
|
|
13271
|
+
selected: !currentValue.includes(choiceId)
|
|
13272
|
+
};
|
|
13273
|
+
this._onChange(newValue);
|
|
13274
|
+
}
|
|
13236
13275
|
}
|
|
13237
13276
|
const {get: get} = _dll_lodash;
|
|
13238
13277
|
const debug = _dll_debug;
|
package/module/print.js
CHANGED
|
@@ -12682,6 +12682,8 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12682
12682
|
this.handleChange = event => {
|
|
12683
12683
|
const {value, checked} = event.target;
|
|
12684
12684
|
const {maxSelections, onChoiceChanged, session} = this.props;
|
|
12685
|
+
const {detail} = event.nativeEvent;
|
|
12686
|
+
let selector = detail ? 'Mouse' : 'Keyboard';
|
|
12685
12687
|
if (session.value && session.value.length >= maxSelections) {
|
|
12686
12688
|
this.setState({
|
|
12687
12689
|
maxSelectionsErrorState: checked
|
|
@@ -12692,7 +12694,8 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12692
12694
|
}
|
|
12693
12695
|
onChoiceChanged({
|
|
12694
12696
|
value,
|
|
12695
|
-
selected: checked
|
|
12697
|
+
selected: checked,
|
|
12698
|
+
selector
|
|
12696
12699
|
});
|
|
12697
12700
|
};
|
|
12698
12701
|
}
|
|
@@ -12776,14 +12779,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12776
12779
|
__self: this,
|
|
12777
12780
|
__source: {
|
|
12778
12781
|
fileName: _jsxFileName$1,
|
|
12779
|
-
lineNumber:
|
|
12782
|
+
lineNumber: 214
|
|
12780
12783
|
}
|
|
12781
12784
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
12782
12785
|
className: classes.srOnly,
|
|
12783
12786
|
__self: this,
|
|
12784
12787
|
__source: {
|
|
12785
12788
|
fileName: _jsxFileName$1,
|
|
12786
|
-
lineNumber:
|
|
12789
|
+
lineNumber: 216
|
|
12787
12790
|
}
|
|
12788
12791
|
}, "Multiple Select Question");
|
|
12789
12792
|
}
|
|
@@ -12796,6 +12799,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12796
12799
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
12797
12800
|
} : undefined;
|
|
12798
12801
|
const selections = session.value && session.value.length || 0;
|
|
12802
|
+
const addAutoplayAudio = autoplayAudioEnabled && !((/Safari|Firefox|Edg/).test(navigator.userAgent) && !(/Chrome/).test(navigator.userAgent));
|
|
12799
12803
|
const teacherInstructionsDiv = React$2.createElement(PreviewPrompt, {
|
|
12800
12804
|
tagName: "div",
|
|
12801
12805
|
className: "prompt",
|
|
@@ -12804,7 +12808,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12804
12808
|
__self: this,
|
|
12805
12809
|
__source: {
|
|
12806
12810
|
fileName: _jsxFileName$1,
|
|
12807
|
-
lineNumber:
|
|
12811
|
+
lineNumber: 251
|
|
12808
12812
|
}
|
|
12809
12813
|
});
|
|
12810
12814
|
const getMultipleChoiceMinSelectionErrorMessage = () => {
|
|
@@ -12831,21 +12835,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12831
12835
|
__self: this,
|
|
12832
12836
|
__source: {
|
|
12833
12837
|
fileName: _jsxFileName$1,
|
|
12834
|
-
lineNumber:
|
|
12838
|
+
lineNumber: 274
|
|
12835
12839
|
}
|
|
12836
12840
|
}, partLabel && React$2.createElement('h3', {
|
|
12837
12841
|
className: classes.partLabel,
|
|
12838
12842
|
__self: this,
|
|
12839
12843
|
__source: {
|
|
12840
12844
|
fileName: _jsxFileName$1,
|
|
12841
|
-
lineNumber:
|
|
12845
|
+
lineNumber: 275
|
|
12842
12846
|
}
|
|
12843
12847
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
12844
12848
|
className: classes.teacherInstructions,
|
|
12845
12849
|
__self: this,
|
|
12846
12850
|
__source: {
|
|
12847
12851
|
fileName: _jsxFileName$1,
|
|
12848
|
-
lineNumber:
|
|
12852
|
+
lineNumber: 280
|
|
12849
12853
|
}
|
|
12850
12854
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
12851
12855
|
labels: {
|
|
@@ -12855,25 +12859,25 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12855
12859
|
__self: this,
|
|
12856
12860
|
__source: {
|
|
12857
12861
|
fileName: _jsxFileName$1,
|
|
12858
|
-
lineNumber:
|
|
12862
|
+
lineNumber: 282
|
|
12859
12863
|
}
|
|
12860
12864
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
12861
12865
|
className: classes.fieldset,
|
|
12862
12866
|
__self: this,
|
|
12863
12867
|
__source: {
|
|
12864
12868
|
fileName: _jsxFileName$1,
|
|
12865
|
-
lineNumber:
|
|
12869
|
+
lineNumber: 296
|
|
12866
12870
|
}
|
|
12867
12871
|
}, React$2.createElement(PreviewPrompt, {
|
|
12868
12872
|
className: "prompt",
|
|
12869
12873
|
defaultClassName: "prompt",
|
|
12870
12874
|
prompt: prompt,
|
|
12871
12875
|
tagName: 'legend',
|
|
12872
|
-
autoplayAudioEnabled:
|
|
12876
|
+
autoplayAudioEnabled: addAutoplayAudio,
|
|
12873
12877
|
__self: this,
|
|
12874
12878
|
__source: {
|
|
12875
12879
|
fileName: _jsxFileName$1,
|
|
12876
|
-
lineNumber:
|
|
12880
|
+
lineNumber: 297
|
|
12877
12881
|
}
|
|
12878
12882
|
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
12879
12883
|
show: showCorrectAnswerToggle,
|
|
@@ -12883,7 +12887,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12883
12887
|
__self: this,
|
|
12884
12888
|
__source: {
|
|
12885
12889
|
fileName: _jsxFileName$1,
|
|
12886
|
-
lineNumber:
|
|
12890
|
+
lineNumber: 306
|
|
12887
12891
|
}
|
|
12888
12892
|
}), React$2.createElement('div', {
|
|
12889
12893
|
className: classNames({
|
|
@@ -12894,7 +12898,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12894
12898
|
__self: this,
|
|
12895
12899
|
__source: {
|
|
12896
12900
|
fileName: _jsxFileName$1,
|
|
12897
|
-
lineNumber:
|
|
12901
|
+
lineNumber: 314
|
|
12898
12902
|
}
|
|
12899
12903
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
12900
12904
|
choicesLayout: this.props.choicesLayout,
|
|
@@ -12917,21 +12921,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12917
12921
|
__self: this,
|
|
12918
12922
|
__source: {
|
|
12919
12923
|
fileName: _jsxFileName$1,
|
|
12920
|
-
lineNumber:
|
|
12924
|
+
lineNumber: 322
|
|
12921
12925
|
}
|
|
12922
12926
|
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12923
12927
|
className: classes.errorText,
|
|
12924
12928
|
__self: this,
|
|
12925
12929
|
__source: {
|
|
12926
12930
|
fileName: _jsxFileName$1,
|
|
12927
|
-
lineNumber:
|
|
12931
|
+
lineNumber: 346
|
|
12928
12932
|
}
|
|
12929
12933
|
}, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
|
|
12930
12934
|
className: classes.errorText,
|
|
12931
12935
|
__self: this,
|
|
12932
12936
|
__source: {
|
|
12933
12937
|
fileName: _jsxFileName$1,
|
|
12934
|
-
lineNumber:
|
|
12938
|
+
lineNumber: 351
|
|
12935
12939
|
}
|
|
12936
12940
|
}, translator$1.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12937
12941
|
lng: language,
|
|
@@ -13079,6 +13083,7 @@ function updateSessionValue(session, choiceMode, data) {
|
|
|
13079
13083
|
session.value = [];
|
|
13080
13084
|
}
|
|
13081
13085
|
}
|
|
13086
|
+
session.selector = data.selector;
|
|
13082
13087
|
}
|
|
13083
13088
|
const React = _dll_react;
|
|
13084
13089
|
const ReactDOM = _dll_react_dom;
|
|
@@ -13125,6 +13130,9 @@ class MultipleChoice extends HTMLElement {
|
|
|
13125
13130
|
log$1('render complete - render math');
|
|
13126
13131
|
renderMath(this);
|
|
13127
13132
|
});
|
|
13133
|
+
if (this._model.keyboardEventsEnabled === true) {
|
|
13134
|
+
this.enableKeyboardEvents();
|
|
13135
|
+
}
|
|
13128
13136
|
} else {
|
|
13129
13137
|
log$1('skip');
|
|
13130
13138
|
}
|
|
@@ -13194,7 +13202,9 @@ class MultipleChoice extends HTMLElement {
|
|
|
13194
13202
|
const observer = new MutationObserver((mutationsList, observer) => {
|
|
13195
13203
|
mutationsList.forEach(mutation => {
|
|
13196
13204
|
if (mutation.type === 'childList') {
|
|
13197
|
-
const audio = this.querySelector('audio
|
|
13205
|
+
const audio = this.querySelector('audio');
|
|
13206
|
+
const isInsidePrompt = audio && audio.closest('#preview-prompt');
|
|
13207
|
+
if (audio && !isInsidePrompt) return;
|
|
13198
13208
|
if (!audio) return;
|
|
13199
13209
|
const info = this._createAudioInfoToast();
|
|
13200
13210
|
const enableAudio = () => {
|
|
@@ -13208,6 +13218,8 @@ class MultipleChoice extends HTMLElement {
|
|
|
13208
13218
|
if (audio.paused && !this.querySelector('#play-audio-info')) {
|
|
13209
13219
|
this.appendChild(info);
|
|
13210
13220
|
document.addEventListener('click', enableAudio);
|
|
13221
|
+
} else {
|
|
13222
|
+
document.removeEventListener('click', enableAudio);
|
|
13211
13223
|
}
|
|
13212
13224
|
}, 500);
|
|
13213
13225
|
const handlePlaying = () => {
|
|
@@ -13233,6 +13245,33 @@ class MultipleChoice extends HTMLElement {
|
|
|
13233
13245
|
subtree: true
|
|
13234
13246
|
});
|
|
13235
13247
|
}
|
|
13248
|
+
enableKeyboardEvents() {
|
|
13249
|
+
window.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
13250
|
+
}
|
|
13251
|
+
disconnectedCallback() {
|
|
13252
|
+
window.removeEventListener('keydown', this.handleKeyDown.bind(this));
|
|
13253
|
+
}
|
|
13254
|
+
handleKeyDown(event) {
|
|
13255
|
+
if (!this._model || !this._session) {
|
|
13256
|
+
return;
|
|
13257
|
+
}
|
|
13258
|
+
const keyToIndex = key => {
|
|
13259
|
+
const numOffset = key >= '1' && key <= '9' ? key - '1' : key === '0' ? 9 : -1;
|
|
13260
|
+
const letterOffset = (/^[a-jA-J]$/).test(key) ? key.toLowerCase().charCodeAt(0) - ('a').charCodeAt(0) : -1;
|
|
13261
|
+
return numOffset >= 0 ? numOffset : letterOffset;
|
|
13262
|
+
};
|
|
13263
|
+
const choiceIndex = keyToIndex(event.key);
|
|
13264
|
+
if (choiceIndex === undefined || choiceIndex >= this._model.choices.length) {
|
|
13265
|
+
return;
|
|
13266
|
+
}
|
|
13267
|
+
const currentValue = this._session.value || [];
|
|
13268
|
+
const choiceId = this._model.choices[choiceIndex].value;
|
|
13269
|
+
const newValue = {
|
|
13270
|
+
value: choiceId,
|
|
13271
|
+
selected: !currentValue.includes(choiceId)
|
|
13272
|
+
};
|
|
13273
|
+
this._onChange(newValue);
|
|
13274
|
+
}
|
|
13236
13275
|
}
|
|
13237
13276
|
const {cloneDeep: cloneDeep} = _dll_lodash;
|
|
13238
13277
|
const {get: get} = _dll_lodash;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr",
|
|
3
|
-
"version": "10.3.4-next.
|
|
3
|
+
"version": "10.3.4-next.13+8f1cd9aed",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@pie-element/multiple-choice": "^9.10.1-next.
|
|
10
|
+
"@pie-element/multiple-choice": "^9.10.1-next.13+8f1cd9aed",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
12
|
"@pie-lib/pie-toolbox": "2.9.0",
|
|
13
13
|
"classnames": "^2.2.5",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"author": "pie framework developers",
|
|
18
18
|
"license": "ISC",
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "8f1cd9aed27ed09ad7726699012ce3060cf3416a",
|
|
20
20
|
"scripts": {
|
|
21
21
|
"postpublish": "../../scripts/postpublish"
|
|
22
22
|
},
|