Skip to content

Commit

Permalink
Merge pull request #42 from oat-sa/release/0.4.13
Browse files Browse the repository at this point in the history
Release/0.4.13
  • Loading branch information
lecosson authored Dec 27, 2019
2 parents 357a332 + 89ca8a6 commit 235c4e8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oat-sa/tao-item-runner-qti",
"version": "0.4.12",
"version": "0.4.13",
"displayName": "TAO Item Runner QTI",
"description": "TAO QTI Item Runner modules",
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ var inputLimiter = function userInputLimier(interaction) {
newValue = e.originalEvent.clipboardData
? e.originalEvent.clipboardData.getData('text')
: e.originalEvent.dataTransfer.getData('text') ||
e.originalEvent.dataTransfer.getData('text/plain') ||
'';
e.originalEvent.dataTransfer.getData('text/plain') ||
'';
}

// prevent insertion of non-limited data
Expand All @@ -523,10 +523,21 @@ var inputLimiter = function userInputLimier(interaction) {
if (isCke) {
_getCKEditor(interaction).insertHtml(newValue);
} else {
containerHelper
.get(interaction)
.find('textarea')
.val(oldValue + newValue);
let elements = containerHelper.get(interaction).find('textarea');
let el = elements[0];
let {
selectionStart: start,
selectionEnd: end,
value: text
} = el;
elements.val(
text.substring(0, start) +
newValue +
text.substring(end, text.length)
);
el.focus();
el.selectionStart = start + newValue.length;
el.selectionEnd = el.selectionStart;
}

_.defer(function() {
Expand Down

0 comments on commit 235c4e8

Please sign in to comment.