chore(Utils): remove backend-dependent escapeHtml method from Utils

StringUtils::escapeHtml from StatusQ is used istead
This commit is contained in:
Michał Cieślak 2023-08-18 13:12:46 +02:00 committed by Michał
parent 79a195b7c9
commit 988e7ac8d0
5 changed files with 8 additions and 9 deletions

View File

@ -2,6 +2,7 @@ import QtQuick 2.13
import QtQuick.Controls 1.0 as QQC1
import utils 1.0
import StatusQ.Core.Utils 0.1 as SQUtils
import "../controls/styles"
@ -32,7 +33,7 @@ QQC1.TabView {
tabTitle = qsTr("New Tab")
}
return Utils.escapeHtml(tabTitle);
return SQUtils.StringUtils.escapeHtml(tabTitle);
})
if (createAsStartPage) {

View File

@ -2,6 +2,7 @@ import QtQuick 2.13
import QtQuick.Layouts 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1 as SQUtils
import StatusQ.Controls 0.1
import utils 1.0
@ -32,7 +33,7 @@ RowLayout {
icon.height: 24
// Limit long named tabs. StatusFlatButton is not well-behaved control
// implicitWidth doesn't work. Also avoid breaking visualization by escaping HTML
text: Utils.escapeHtml(Utils.elideIfTooLong(name, 40))
text: SQUtils.StringUtils.escapeHtml(Utils.elideIfTooLong(name, 40))
MouseArea {
anchors.fill: parent

View File

@ -3,9 +3,10 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import QtQml.Models 2.14
import StatusQ.Controls 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Core.Utils 0.1 as SQUtils
import StatusQ.Popups.Dialog 0.1
import shared.controls 1.0
@ -159,7 +160,7 @@ StatusDialog {
visible: !d.responseText
enabled: verificationResponse.text !== ""
onClicked: {
root.responseSent(d.senderPublicKey, Utils.escapeHtml(verificationResponse.text))
root.responseSent(d.senderPublicKey, SQUtils.StringUtils.escapeHtml(verificationResponse.text))
d.responseText = verificationResponse.text
d.responseTimestamp = Date.now()
}

View File

@ -467,7 +467,7 @@ Rectangle {
d.copiedTextFormatted = ""
d.copiedMentionsPos = []
messageInputField.insert(d.copyTextStart, ((d.nbEmojisInClipboard === 0) ?
("<div style='white-space: pre-wrap'>" + Utils.escapeHtml(QClipboardProxy.text) + "</div>")
("<div style='white-space: pre-wrap'>" + StatusQUtils.StringUtils.escapeHtml(QClipboardProxy.text) + "</div>")
: StatusQUtils.Emoji.deparse(QClipboardProxy.html)));
}
}

View File

@ -572,10 +572,6 @@ QtObject {
return (str.length > maxLength) ? str.substr(0, maxLength-4) + '...' : str;
}
function escapeHtml(unsafeStr) {
return globalUtilsInst.escapeHtml(unsafeStr)
}
function plainText(text) {
return globalUtilsInst.plainText(text)
}