fix(message): removed extra markup when typing before mention
Closes #8495
This commit is contained in:
parent
7a1c768898
commit
7f2563edf4
|
@ -54,7 +54,7 @@ Item {
|
|||
return
|
||||
|
||||
this.lastAtPosition = -1
|
||||
for (let c = cursorPosition; c >= 0; c--) {
|
||||
for (let c = cursorPosition === 0 ? 0 : (cursorPosition-1); c >= 0; c--) {
|
||||
if (filter.charAt(c) === "@") {
|
||||
this.lastAtPosition = c
|
||||
break
|
||||
|
@ -119,12 +119,12 @@ Item {
|
|||
if (properties.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
let filterWithoutAt = filter.substring(this.lastAtPosition + 1, this.cursorPosition)
|
||||
filterWithoutAt = filterWithoutAt.replace(/\*/g, "")
|
||||
suggestionsPanelRoot.formattedFilter = filterWithoutAt
|
||||
|
||||
return !properties.every(p => item[p].toLowerCase().match(filterWithoutAt.toLowerCase()) === null)
|
||||
&& (lastAtPosition > -1)
|
||||
}
|
||||
|
||||
function isFilteringPropertyOk() {
|
||||
|
|
|
@ -367,7 +367,7 @@ Rectangle {
|
|||
event.key !== Qt.Key_Backspace &&
|
||||
event.key !== Qt.Key_Delete &&
|
||||
event.key !== Qt.Key_Escape
|
||||
if (mentionsPos.length > 0 && symbolPressed) {
|
||||
if ((mentionsPos.length > 0) && symbolPressed && (messageInputField.selectedText.length === 0)) {
|
||||
for (var i = 0; i < mentionsPos.length; i++) {
|
||||
if (messageInputField.cursorPosition === mentionsPos[i].leftIndex) {
|
||||
d.leftOfMentionIndex = i
|
||||
|
@ -1223,6 +1223,7 @@ Rectangle {
|
|||
|
||||
TextArea {
|
||||
id: messageInputField
|
||||
|
||||
objectName: "messageInputField"
|
||||
|
||||
property var lastClick: 0
|
||||
|
@ -1260,21 +1261,21 @@ Rectangle {
|
|||
}
|
||||
|
||||
onCursorPositionChanged: {
|
||||
if(mentionsPos.length > 0) {
|
||||
if(mentionsPos.length > 0 && ((keyEvent.key === Qt.Key_Left) || (keyEvent.key === Qt.Key_Right)
|
||||
|| (selectedText.length>0))) {
|
||||
const mention = d.getMentionAtPosition(cursorPosition)
|
||||
if(mention) {
|
||||
const cursorMovingLeft = cursorPosition < previousCursorPosition
|
||||
if (mention) {
|
||||
const cursorMovingLeft = (cursorPosition < previousCursorPosition);
|
||||
const newCursorPosition = cursorMovingLeft ?
|
||||
mention.leftIndex :
|
||||
mention.rightIndex
|
||||
const isSelection = selectionStart != selectionEnd
|
||||
mention.leftIndex :
|
||||
mention.rightIndex
|
||||
const isSelection = (selectedText.length>0);
|
||||
isSelection ? moveCursorSelection(newCursorPosition, TextEdit.SelectCharacters) :
|
||||
cursorPosition = newCursorPosition
|
||||
}
|
||||
}
|
||||
|
||||
inputScrollView.ensureVisible(cursorRectangle)
|
||||
|
||||
previousCursorPosition = cursorPosition
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue