Commit 14aa6a9c authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/scripts/Utils/utils): `encodeTextToQmlRichFormat` supports tab/spaces correctly

parent 1a32b397
......@@ -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, '&nbsp;&nbsp;&nbsp;&nbsp; ')
.replace(/ /g, '&nbsp; ')
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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment