mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 18:13:29 +02:00
Don't allow tabs or newlines
This commit is contained in:
parent
9bde9f5a4f
commit
eb29bdf5d2
1 changed files with 7 additions and 1 deletions
|
@ -947,8 +947,14 @@ Item {
|
|||
wrapMode: TextEdit.Wrap;
|
||||
activeFocusOnPress: true;
|
||||
activeFocusOnTab: true;
|
||||
// Workaround for no max length on TextAreas
|
||||
onTextChanged: {
|
||||
// Don't allow tabs or newlines
|
||||
if ((/[\n\r\t]/g).test(text)) {
|
||||
var cursor = cursorPosition;
|
||||
text = text.replace(/[\n\r\t]/g, '');
|
||||
cursorPosition = cursor-1;
|
||||
}
|
||||
// Workaround for no max length on TextAreas
|
||||
if (text.length > maximumLength) {
|
||||
var cursor = cursorPosition;
|
||||
text = previousText;
|
||||
|
|
Loading…
Reference in a new issue