Prevent Sending Blank Messages, fix htmlescape & bug
This commit is contained in:
parent
e7d4cc298d
commit
35778ae4ae
|
@ -226,8 +226,11 @@ ColumnLayout {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (txtMessage.text != "") {
|
if (txtMessage.text != "") {
|
||||||
txtHidden.text = restoreEmoji(txtMessage.text)
|
txtHidden.text = restoreEmoji(txtMessage.text)
|
||||||
var msg = JSON.stringify({"o":1, "d":txtHidden.getText(0, txtHidden.text.length)})
|
var txt = txtHidden.getText(0, txtHidden.text.length).trim()
|
||||||
gcd.sendMessage(msg, nextMessageID++)
|
if (txt.length > 0) {
|
||||||
|
var msg = JSON.stringify({"o":1, "d":txtHidden.getText(0, txtHidden.text.length)})
|
||||||
|
gcd.sendMessage(msg, nextMessageID++)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
txtMessage.text = ""
|
txtMessage.text = ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
.pragma library
|
.pragma library
|
||||||
|
|
||||||
function htmlEscaped(str) {
|
function htmlEscaped(str) {
|
||||||
str = str.replace(/&/g, "&");
|
|
||||||
str = str.replace(/</g, "<");
|
str = str.replace(/</g, "<");
|
||||||
str = str.replace(/>/g, ">");
|
str = str.replace(/>/g, ">");
|
||||||
str = str.replace(/"/g, """);
|
|
||||||
str = str.replace(/'/g, "'");
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Reference in New Issue