Fix arrows and other keys not working in sendbox

This commit is contained in:
miruka 2019-07-05 03:16:52 -04:00
parent ecba7c47ec
commit 57577ba8b8
2 changed files with 17 additions and 17 deletions

View File

@ -27,7 +27,6 @@ ScrollView {
color: HStyle.controls.textArea.background color: HStyle.controls.textArea.background
} }
Keys.forwardTo: [scrollView] //Keys.forwardTo: [scrollView]
} }
} }

View File

@ -52,25 +52,26 @@ HRectangle {
} }
} }
Keys.onReturnPressed: { Component.onCompleted: {
event.accepted = true area.Keys.onReturnPressed.connect(function (event) {
event.accepted = true
if (event.modifiers & Qt.ShiftModifier || if (event.modifiers & Qt.ShiftModifier ||
event.modifiers & Qt.ControlModifier || event.modifiers & Qt.ControlModifier ||
event.modifiers & Qt.AltModifier) { event.modifiers & Qt.AltModifier) {
textArea.insert(textArea.cursorPosition, "\n") textArea.insert(textArea.cursorPosition, "\n")
return return
} }
if (textArea.text === "") { return } if (textArea.text === "") { return }
var args = [chatPage.roomId, textArea.text] var args = [chatPage.roomId, textArea.text]
py.callClientCoro(chatPage.userId, "send_markdown", args) py.callClientCoro(chatPage.userId, "send_markdown", args)
area.clear() area.clear()
})
area.Keys.onEnterPressed.connect(area.Keys.onReturnPressed)
} }
// Numpad enter
Keys.onEnterPressed: Keys.onReturnPressed(event)
} }
} }
} }