diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-09-13 11:02:54 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-09-13 11:02:54 +0300 |
commit | bf4d559523e956523a617213fa1cc3c36fab24e4 (patch) | |
tree | 58155f4efbb364dab13245313d742a846ed6f51e /src/timeline/TimelineView.cpp | |
parent | Use <em></em> for m.emote messages (diff) | |
download | nheko-bf4d559523e956523a617213fa1cc3c36fab24e4.tar.xz |
Strip paragraph tags
fixes #438
Diffstat (limited to 'src/timeline/TimelineView.cpp')
-rw-r--r-- | src/timeline/TimelineView.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/timeline/TimelineView.cpp b/src/timeline/TimelineView.cpp index 08d506bf..90e116c1 100644 --- a/src/timeline/TimelineView.cpp +++ b/src/timeline/TimelineView.cpp @@ -1236,8 +1236,10 @@ toRoomMessage<mtx::events::msg::Emote>(const PendingMessage &m) auto html = utils::markdownToHtml(m.body); mtx::events::msg::Emote emote; - emote.body = utils::stripHtml(html); - emote.formatted_body = html.toStdString(); + emote.body = m.body.trimmed().toStdString(); + + if (html != m.body.trimmed().toHtmlEscaped()) + emote.formatted_body = html.toStdString(); return emote; } @@ -1261,8 +1263,10 @@ toRoomMessage<mtx::events::msg::Text>(const PendingMessage &m) auto html = utils::markdownToHtml(m.body); mtx::events::msg::Text text; - text.body = utils::stripHtml(html); - text.formatted_body = html.toStdString(); + text.body = m.body.trimmed().toStdString(); + + if (html != m.body.trimmed().toHtmlEscaped()) + text.formatted_body = html.toStdString(); return text; } |