Merge branch 'master' of git.openprivacy.ca:cwtch.im/ui into ebf2019011411

This commit is contained in:
erinn 2019-01-30 11:58:33 -08:00
commit 99c0889a88
3 changed files with 14 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import "fonts/Twemoji.js" as T
import "overlays"
import "panes"
import "widgets"
import "utils.js" as Utils
Item {
id: windowItem
@ -27,7 +28,7 @@ Item {
T.twemoji.ext = ".png"
T.twemoji.size = "72x72"
T.twemoji.className = "\" height=\""+size+"\" width=\""+size
return T.twemoji.parse(text)
return T.twemoji.parse(Utils.htmlEscaped(text))
}
function restoreEmoji(text) { // REPLACE <IMG> TAGS WITH EMOJI

View File

@ -7,6 +7,7 @@ import QtQuick.Layouts 1.3
import "../widgets"
import "../widgets/controls" as Awesome
import "../fonts/Twemoji.js" as T
import "../utils.js" as Utils
ColumnLayout {
Layout.fillWidth: true
@ -46,7 +47,7 @@ ColumnLayout {
"_handle": handle,
"_from": from,
"_displayName": displayName,
"_message": parse(msg.d, 12),
"_message":parse(msg.d, 12),
"_image": image,
"_mid": mid,
"_fromMe": fromMe,

10
qml/utils.js Normal file
View File

@ -0,0 +1,10 @@
.pragma library
function htmlEscaped(str) {
str = str.replace(/&/g, "&amp;");
str = str.replace(/</g, "&lt;");
str = str.replace(/>/g, "&gt;");
str = str.replace(/"/g, "&quot;");
str = str.replace(/'/g, "&apos;");
return str
}