I am facing a complex requirement
How can I detect the pressing of the
ENTER
key within a text box with the following conditions:
- If the cursor is at the end of a sentence, it should create a new text box on the next row.
- If the cursor is in the middle of a sentence, it should move the text from that point to the end of the sentence into a new input box on the next row.
Currently, I am able to add a new input field to the next row using this code snippet:
if $event.keyCode == ENTER_KEY //13
newRow = initializeNewRowObject()
$scope.list.splice(index, 0, newRow)
setFocusOnNewRow(index)
Does anyone have any suggestions on how to achieve this goal?