This repository was archived by the owner on Jun 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -3132,6 +3132,28 @@ class ParsonsInput {
31323132 }
31333133 newBlock.style.display = 'inline-block';
31343134 newBlock.classList.add('parsons-block');
3135+ newBlock.onclick = () => {
3136+ // adding the block to the input area
3137+ if (newBlock.parentElement == this._dragArea) {
3138+ let endPosition;
3139+ if (this.reusable) {
3140+ const newBlockCopy = newBlock.cloneNode(true);
3141+ this._dropArea.appendChild(newBlockCopy);
3142+ endPosition = this._getBlockPosition(newBlockCopy);
3143+ }
3144+ else {
3145+ this._dropArea.appendChild(newBlock);
3146+ endPosition = this._getBlockPosition(newBlock);
3147+ }
3148+ const inputEvent = {
3149+ 'event-type': 'parsons-input',
3150+ action: 'add',
3151+ position: [-1, endPosition],
3152+ answer: this._getTextArray(),
3153+ };
3154+ this.parentElement.logEvent(inputEvent);
3155+ }
3156+ };
31353157 }
31363158 this._initSortable();
31373159 };
@@ -3311,6 +3333,7 @@ class ParsonsInput {
33113333 }
33123334 }
33133335 };
3336+ // TODO: not used for now, not sure if is working correctly
33143337 restoreAnswer(type, answer) {
33153338 if (type != 'parsons' || !Array.isArray(answer)) {
33163339 return;
You can’t perform that action at this time.
0 commit comments