From 1a32b3972e8f1929d08e54f000e2397252b03dee Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 9 Mar 2017 16:27:33 +0100 Subject: [PATCH] feat(ui/modules/Linphone/Chat/Message): wrap correctly messages --- linphone-desktop/ui/modules/Linphone/Chat/Message.qml | 7 ++++++- linphone-desktop/ui/scripts/Utils/utils.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/linphone-desktop/ui/modules/Linphone/Chat/Message.qml b/linphone-desktop/ui/modules/Linphone/Chat/Message.qml index b567c81a7..64a138649 100644 --- a/linphone-desktop/ui/modules/Linphone/Chat/Message.qml +++ b/linphone-desktop/ui/modules/Linphone/Chat/Message.qml @@ -46,6 +46,7 @@ Item { left: container.left right: container.right } + clip: true padding: ChatStyle.entry.message.padding readOnly: true @@ -58,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.WordWrap + wrapMode: TextEdit.Wrap onCursorRectangleChanged: Logic.ensureVisible(cursorRectangle) onLinkActivated: Qt.openUrlExternally(link) @@ -77,6 +78,10 @@ Item { } } + // --------------------------------------------------------------------------- + // Extra content. + // --------------------------------------------------------------------------- + Item { id: content diff --git a/linphone-desktop/ui/scripts/Utils/utils.js b/linphone-desktop/ui/scripts/Utils/utils.js index 0b92f6831..62a2e3e5e 100644 --- a/linphone-desktop/ui/scripts/Utils/utils.js +++ b/linphone-desktop/ui/scripts/Utils/utils.js @@ -51,8 +51,8 @@ function encodeTextToQmlRichFormat (text, options) { var formattedText = execAll(UriTools.URI_REGEX, text, function (str, valid) { if (!valid) { return unscapeHtml(str).replace(/\r\n|\n/g, '
') - .replace(/\t/g, '    ') - .replace(/ /g, ' ') + .replace(/\t/g, '     ') + .replace(/ /g, '  ') } var uri = startsWith(str, 'www.') ? 'http://' + str : str