mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-22 14:18:09 +00:00
feat(ui/scripts/Utils/utils): encodeTextToQmlRichFormat supports tab/spaces correctly
This commit is contained in:
parent
1a32b3972e
commit
14aa6a9cf1
2 changed files with 3 additions and 5 deletions
|
|
@ -59,7 +59,7 @@ Item {
|
|||
// See http://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop
|
||||
// and http://doc.qt.io/qt-5/richtext-html-subset.html
|
||||
textFormat: Text.RichText // To supports links and imgs.
|
||||
wrapMode: TextEdit.Wrap
|
||||
wrapMode: TextEdit.WordWrap
|
||||
|
||||
onCursorRectangleChanged: Logic.ensureVisible(cursorRectangle)
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
|
|
|
|||
|
|
@ -50,9 +50,7 @@ function encodeTextToQmlRichFormat (text, options) {
|
|||
|
||||
var formattedText = execAll(UriTools.URI_REGEX, text, function (str, valid) {
|
||||
if (!valid) {
|
||||
return unscapeHtml(str).replace(/\r\n|\n/g, '<br/>')
|
||||
.replace(/\t/g, ' ')
|
||||
.replace(/ /g, ' ')
|
||||
return unscapeHtml(str)
|
||||
}
|
||||
|
||||
var uri = startsWith(str, 'www.') ? 'http://' + str : str
|
||||
|
|
@ -76,7 +74,7 @@ function encodeTextToQmlRichFormat (text, options) {
|
|||
images = '<div>' + images + '</div>'
|
||||
}
|
||||
|
||||
return images.concat('<p>' + formattedText + '</p>')
|
||||
return images.concat('<p style="white-space:pre-wrap;">' + formattedText + '</p>')
|
||||
}
|
||||
|
||||
function extractFirstUri (str) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue