Commit a3e49588 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Common/Form/DroppableTextArea): add a shortcut to insert new lines

parent 70b4e4cc
...@@ -54,6 +54,12 @@ Item { ...@@ -54,6 +54,12 @@ Item {
TextArea.flickable: TextArea { TextArea.flickable: TextArea {
id: textArea id: textArea
function handleValidation () {
if (text.length !== 0) {
validText(text)
}
}
background: Rectangle { background: Rectangle {
color: DroppableTextAreaStyle.backgroundColor color: DroppableTextAreaStyle.backgroundColor
} }
...@@ -65,7 +71,14 @@ Item { ...@@ -65,7 +71,14 @@ Item {
wrapMode: TextArea.Wrap wrapMode: TextArea.Wrap
Component.onCompleted: forceActiveFocus() Component.onCompleted: forceActiveFocus()
Keys.onReturnPressed: text.length !== 0 && validText(text)
Keys.onPressed: {
if (event.matches(StandardKey.InsertLineSeparator)) {
insert(cursorPosition, '')
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
handleValidation()
}
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment