chore: using StringUtils.plainText consistently
There were two version of plainText - one exposed from the backend, another, backend-independent in StringUtils. The latter one is now used in all cases.
This commit is contained in:
parent
17be3bfb2c
commit
9f9dcefcf8
|
@ -23,9 +23,6 @@ SplitView {
|
|||
|
||||
property bool ready: false
|
||||
property var globalUtils: QtObject {
|
||||
function plainText(htmlText) {
|
||||
return htmlText.replace(/(?:<style[^]+?>[^]+?<\/style>|[\n]|<script[^]+?>[^]+?<\/script>|<(?:!|\/?[a-zA-Z]+).*?\/?>)/g,'')
|
||||
}
|
||||
function isCompressedPubKey(publicKey) {
|
||||
return false
|
||||
}
|
||||
|
@ -104,7 +101,7 @@ SplitView {
|
|||
|
||||
onSendMessage: {
|
||||
logs.logEvent("StatusChatInput::sendMessage", ["MessageWithPk"], [chatInput.getTextWithPublicKeys()])
|
||||
logs.logEvent("StatusChatInput::sendMessage", ["PlainText"], [globalUtilsMock.globalUtils.plainText(chatInput.getTextWithPublicKeys())])
|
||||
logs.logEvent("StatusChatInput::sendMessage", ["PlainText"], [SQUtils.StringUtils.plainText(chatInput.getTextWithPublicKeys())])
|
||||
logs.logEvent("StatusChatInput::sendMessage", ["RawText"], [chatInput.textInput.text])
|
||||
}
|
||||
onEnableLinkPreviewForThisMessage: {
|
||||
|
|
|
@ -695,10 +695,6 @@ Item {
|
|||
QtObject {
|
||||
id: globalUtilsMock
|
||||
|
||||
function plainText(htmlText) {
|
||||
return TextUtils.htmlToPlainText(htmlText)
|
||||
}
|
||||
|
||||
function isCompressedPubKey(publicKey) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -103,10 +103,6 @@ QtObject {
|
|||
return "OPT"
|
||||
}
|
||||
|
||||
function plainText(htmlFragment) {
|
||||
return SQUtils.StringUtils.plainText(htmlFragment)
|
||||
}
|
||||
|
||||
function prepareTransactionsForAddress(address) {
|
||||
console.log("prepareTransactionsForAddress:", address)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import QtQuick 2.13
|
||||
import utils 1.0
|
||||
import QtQuick 2.15
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||
|
||||
Item {
|
||||
id: suggestionsPanelRoot
|
||||
|
@ -95,7 +95,7 @@ Item {
|
|||
return
|
||||
}
|
||||
|
||||
return Utils.plainText(this.filter)
|
||||
return SQUtils.StringUtils.plainText(this.filter)
|
||||
}
|
||||
|
||||
function shouldShowAll(filter) {
|
||||
|
|
|
@ -233,7 +233,7 @@ QtObject {
|
|||
}
|
||||
|
||||
function cleanMessageText(formattedMessage) {
|
||||
const text = globalUtilsInst.plainText(StatusQUtils.Emoji.deparse(formattedMessage))
|
||||
const text = StatusQUtils.StringUtils.plainText(StatusQUtils.Emoji.deparse(formattedMessage))
|
||||
return interpretMessage(text)
|
||||
}
|
||||
|
||||
|
@ -427,10 +427,6 @@ QtObject {
|
|||
return globalUtilsInst.generateAlias(pk);
|
||||
}
|
||||
|
||||
function plainText(text) {
|
||||
return globalUtilsInst.plainText(text)
|
||||
}
|
||||
|
||||
function removeCommunityChat(chatId) {
|
||||
chatCommunitySectionModule.removeCommunityChat(chatId)
|
||||
}
|
||||
|
|
|
@ -193,10 +193,6 @@ QtObject {
|
|||
communitiesModuleInst.cancelRequestToJoinCommunity(id)
|
||||
}
|
||||
|
||||
function plainText(text) {
|
||||
return globalUtils.plainText(text);
|
||||
}
|
||||
|
||||
function generateAlias(pk) {
|
||||
return globalUtils.generateAlias(pk);
|
||||
}
|
||||
|
|
|
@ -455,7 +455,7 @@ Item {
|
|||
|
||||
function onOpenLink(link: string) {
|
||||
// Qt sometimes inserts random HTML tags; and this will break on invalid URL inside QDesktopServices::openUrl(link)
|
||||
link = appMain.rootStore.plainText(link)
|
||||
link = SQUtils.StringUtils.plainText(link)
|
||||
Qt.openUrlExternally(link)
|
||||
}
|
||||
|
||||
|
|
|
@ -111,8 +111,9 @@ Loader {
|
|||
}
|
||||
|
||||
function evaluateAndSetPreferredChains() {
|
||||
let address = !!root.item.input && !!root.store.plainText(root.item.input.text) ? root.store.plainText(root.item.input.text): ""
|
||||
let result = root.store.splitAndFormatAddressPrefix(address, !root.isBridgeTx && !root.isCollectiblesTransfer)
|
||||
const plainText = StatusQUtils.StringUtils.plainText(root.item.input.text)
|
||||
const address = !!root.item.input && !!plainText ? plainText: ""
|
||||
const result = root.store.splitAndFormatAddressPrefix(address, !root.isBridgeTx && !root.isCollectiblesTransfer)
|
||||
if(!!result.address) {
|
||||
root.addressText = result.address
|
||||
if(!!root.item.input) {
|
||||
|
@ -193,7 +194,7 @@ Loader {
|
|||
text: root.addressText
|
||||
|
||||
function validateInput() {
|
||||
const plainText = store.plainText(text)
|
||||
const plainText = StatusQUtils.StringUtils.plainText(text)
|
||||
root.isLoading()
|
||||
if (Utils.isValidEns(plainText)) {
|
||||
d.isPending = true
|
||||
|
|
|
@ -481,7 +481,7 @@ Rectangle {
|
|||
validateImagesAndShowImageArea([clipboardImage])
|
||||
event.accepted = true
|
||||
} else if (ClipboardUtils.hasText) {
|
||||
const clipboardText = Utils.plainText(ClipboardUtils.text)
|
||||
const clipboardText = StatusQUtils.StringUtils.plainText(ClipboardUtils.text)
|
||||
// prevent repetitive & huge clipboard paste, where huge is total char count > than messageLimitHard
|
||||
const selectionLength = messageInputField.selectionEnd - messageInputField.selectionStart;
|
||||
if ((messageLength + clipboardText.length - selectionLength) > control.messageLimitHard)
|
||||
|
@ -498,7 +498,7 @@ Rectangle {
|
|||
d.copyTextStart = messageInputField.cursorPosition
|
||||
messageInputField.readOnly = true
|
||||
|
||||
const copiedText = Utils.plainText(d.copiedTextPlain)
|
||||
const copiedText = StatusQUtils.StringUtils.plainText(d.copiedTextPlain)
|
||||
if (copiedText === clipboardText) {
|
||||
if (d.copiedTextPlain.includes("@")) {
|
||||
d.copiedTextFormatted = d.copiedTextFormatted.replace(/span style="/g, "span style=\" text-decoration:none;")
|
||||
|
@ -622,7 +622,7 @@ Rectangle {
|
|||
|
||||
const deparsedEmoji = StatusQUtils.Emoji.deparse(textWithoutMention);
|
||||
|
||||
return Utils.plainText(deparsedEmoji)
|
||||
return StatusQUtils.StringUtils.plainText(deparsedEmoji)
|
||||
}
|
||||
|
||||
function removeMentions(currentText) {
|
||||
|
|
|
@ -80,10 +80,6 @@ QtObject {
|
|||
return globalUtils.wei2Eth(wei, decimals)
|
||||
}
|
||||
|
||||
function plainText(text) {
|
||||
return globalUtils.plainText(text)
|
||||
}
|
||||
|
||||
function getAsset(assetsList, symbol) {
|
||||
for(var i=0; i< assetsList.rowCount();i++) {
|
||||
let asset = assetsList.get(i)
|
||||
|
|
|
@ -660,7 +660,7 @@ Loader {
|
|||
return
|
||||
}
|
||||
|
||||
const message = root.rootStore.plainText(StatusQUtils.Emoji.deparse(newMessageText))
|
||||
const message = StatusQUtils.StringUtils.plainText(StatusQUtils.Emoji.deparse(newMessageText))
|
||||
|
||||
if (message.length <= 0)
|
||||
return;
|
||||
|
|
|
@ -942,10 +942,6 @@ QtObject {
|
|||
return getElidedPk(compressedPk)
|
||||
}
|
||||
|
||||
function plainText(text) {
|
||||
return globalUtilsInst.plainText(text)
|
||||
}
|
||||
|
||||
function parseContactUrl(link) {
|
||||
let index = link.lastIndexOf("/u/")
|
||||
|
||||
|
|
Loading…
Reference in New Issue