fix: fix being unable to put multiple spaces in a row
This commit is contained in:
parent
6c0fce5b0c
commit
a01e851070
|
@ -17,7 +17,7 @@ proc mention(self: ChatMessageList, pubKey: string): string =
|
||||||
|
|
||||||
# See render-inline in status-react/src/status_im/ui/screens/chat/message/message.cljs
|
# See render-inline in status-react/src/status_im/ui/screens/chat/message/message.cljs
|
||||||
proc renderInline(self: ChatMessageList, elem: TextItem): string =
|
proc renderInline(self: ChatMessageList, elem: TextItem): string =
|
||||||
let value = escape_html(elem.literal).multiReplace(("\r\n", "<br/>")).multiReplace(("\n", "<br/>"))
|
let value = escape_html(elem.literal).multiReplace(("\r\n", "<br/>")).multiReplace(("\n", "<br/>")).multiReplace((" ", " "))
|
||||||
case elem.textType:
|
case elem.textType:
|
||||||
of "": result = value
|
of "": result = value
|
||||||
of "code": result = fmt("<code>{value}</code>")
|
of "code": result = fmt("<code>{value}</code>")
|
||||||
|
|
|
@ -335,7 +335,6 @@ StackLayout {
|
||||||
chatInput.textInput.textFormat = TextEdit.PlainText;
|
chatInput.textInput.textFormat = TextEdit.PlainText;
|
||||||
chatInput.textInput.textFormat = TextEdit.RichText;
|
chatInput.textInput.textFormat = TextEdit.RichText;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,14 +146,14 @@ Rectangle {
|
||||||
// handle new line in blockquote
|
// handle new line in blockquote
|
||||||
if ((event.key === Qt.Key_Enter || event.key === Qt.Key_Return) && (event.modifiers & Qt.ShiftModifier) && message.data.startsWith(">")) {
|
if ((event.key === Qt.Key_Enter || event.key === Qt.Key_Return) && (event.modifiers & Qt.ShiftModifier) && message.data.startsWith(">")) {
|
||||||
if(message.data.startsWith(">") && !message.data.endsWith("\n\n")) {
|
if(message.data.startsWith(">") && !message.data.endsWith("\n\n")) {
|
||||||
let newMessage = ""
|
let newMessage1 = ""
|
||||||
if (message.data.endsWith("\n> ")) {
|
if (message.data.endsWith("\n> ")) {
|
||||||
newMessage = message.data.substr(0, message.data.lastIndexOf("> ")) + "\n\n"
|
newMessage1 = message.data.substr(0, message.data.lastIndexOf("> ")) + "\n\n"
|
||||||
} else {
|
} else {
|
||||||
newMessage = message.data + "\n> ";
|
newMessage1 = message.data + "\n> ";
|
||||||
}
|
}
|
||||||
messageInputField.remove(0, messageInputField.cursorPosition);
|
messageInputField.remove(0, messageInputField.cursorPosition);
|
||||||
insertInTextInput(0, Emoji.parse(newMessage));
|
insertInTextInput(0, Emoji.parse(newMessage1));
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ Rectangle {
|
||||||
const posBeforeEnd = messageInputField.length - messageInputField.cursorPosition;
|
const posBeforeEnd = messageInputField.length - messageInputField.cursorPosition;
|
||||||
const plainText = getPlainText()
|
const plainText = getPlainText()
|
||||||
const formatted = parseBackText(plainText)
|
const formatted = parseBackText(plainText)
|
||||||
messageInputField.text = formatted
|
messageInputField.text = formatted.replace(/ /g, ' ')
|
||||||
messageInputField.cursorPosition = messageInputField.length - posBeforeEnd;
|
messageInputField.cursorPosition = messageInputField.length - posBeforeEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue