feat: enables inserting emojis and mentions using Tab as well
This commit is contained in:
parent
dc313e200a
commit
94f1267ea9
|
@ -92,18 +92,25 @@ Rectangle {
|
||||||
return (event.key === Qt.Key_U) && (event.modifiers & Qt.ControlModifier) && imageBtn.visible && !imageDialog.visible
|
return (event.key === Qt.Key_U) && (event.modifiers & Qt.ControlModifier) && imageBtn.visible && !imageDialog.visible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkTextInsert() {
|
||||||
|
if (emojiSuggestions.visible) {
|
||||||
|
emojiSuggestions.addEmoji();
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (suggestionsBox.visible) {
|
||||||
|
suggestionsBox.selectCurrentItem();
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
function onKeyPress(event){
|
function onKeyPress(event){
|
||||||
if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
|
if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
|
||||||
if (emojiSuggestions.visible) {
|
if (checkTextInsert()) {
|
||||||
emojiSuggestions.addEmoji();
|
|
||||||
event.accepted = true;
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (suggestionsBox.visible) {
|
|
||||||
suggestionsBox.selectCurrentItem();
|
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (control.isStatusUpdateInput) {
|
if (control.isStatusUpdateInput) {
|
||||||
return // Status update require the send button to be clicked
|
return // Status update require the send button to be clicked
|
||||||
}
|
}
|
||||||
|
@ -116,6 +123,13 @@ Rectangle {
|
||||||
messageTooLongDialog.open()
|
messageTooLongDialog.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Tab) {
|
||||||
|
if (checkTextInsert()) {
|
||||||
|
event.accepted = true;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const message = control.extrapolateCursorPosition();
|
const message = control.extrapolateCursorPosition();
|
||||||
|
|
||||||
// handle new line in blockquote
|
// handle new line in blockquote
|
||||||
|
|
Loading…
Reference in New Issue