|
@@ -155,6 +155,10 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
return tr;
|
|
return tr;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function createRowAfter(_tr) {
|
|
|
|
+ return newRow().insertAfter(_tr);
|
|
|
|
+ }
|
|
|
|
+
|
|
function newRow() {
|
|
function newRow() {
|
|
return $('<tr><td class="align-middle text-center bg-light"><a href="#" class="delete-line"><i class="fa fa-trash-alt on-hover-opaque text-danger"></i></a></td>' +
|
|
return $('<tr><td class="align-middle text-center bg-light"><a href="#" class="delete-line"><i class="fa fa-trash-alt on-hover-opaque text-danger"></i></a></td>' +
|
|
'<td><textarea rows="1" key="S"></textarea></td>' +
|
|
'<td><textarea rows="1" key="S"></textarea></td>' +
|
|
@@ -162,6 +166,11 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
'<td><textarea rows="1" key="P"></textarea></td></tr>');
|
|
'<td><textarea rows="1" key="P"></textarea></td></tr>');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function createAndMoveToNextRowInput(_td) {
|
|
|
|
+ let tr = createRowAfter(_td.closest('tr'));
|
|
|
|
+ tr.find('td:eq(' + _td.index() + ') textarea').first().focus();
|
|
|
|
+ }
|
|
|
|
+
|
|
function moveToNextRowInput(_td, _forceCreate = false) {
|
|
function moveToNextRowInput(_td, _forceCreate = false) {
|
|
let tr = _forceCreate ? getOrCreateRowAfter(_td.closest('tr')) : getRowAfter(_td.closest('tr'));
|
|
let tr = _forceCreate ? getOrCreateRowAfter(_td.closest('tr')) : getRowAfter(_td.closest('tr'));
|
|
if(tr.length) {
|
|
if(tr.length) {
|
|
@@ -221,13 +230,15 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
parentSegment
|
|
parentSegment
|
|
.off('keydown', '.stag-sheet textarea')
|
|
.off('keydown', '.stag-sheet textarea')
|
|
.on('keydown', '.stag-sheet textarea', function(_e) {
|
|
.on('keydown', '.stag-sheet textarea', function(_e) {
|
|
- console.log(_e.which);
|
|
|
|
- console.log(this.selectionStart, this.selectionEnd);
|
|
|
|
- console.log(this.value.length);
|
|
|
|
switch (_e.which) {
|
|
switch (_e.which) {
|
|
case 13: // ENTER: If shift NOT pressed, move to next row same column
|
|
case 13: // ENTER: If shift NOT pressed, move to next row same column
|
|
if (!_e.shiftKey) {
|
|
if (!_e.shiftKey) {
|
|
- moveToNextRowInput($(this).closest('td'), $(this).closest('.stag-sheet').is('.allow-row-addition'));
|
|
|
|
|
|
+ if($(this).closest('.stag-sheet').is('.allow-row-addition')) {
|
|
|
|
+ createAndMoveToNextRowInput($(this).closest('td'), );
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ moveToNextRowInput($(this).closest('td'), false);
|
|
|
|
+ }
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
break;
|
|
break;
|