Don't destroy formatting when editing previous messages

Adds a few new methods to grab the markdown/slightly rich text from the
message, and will intelligently re-insert user mentions as needed.

(cherry picked from commit e2eb6ab33c)
This commit is contained in:
Joshua Goins
2024-03-14 19:22:31 -04:00
parent 18d14446bf
commit afba8430f7
6 changed files with 122 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ private Q_SLOTS:
void genericBody_data();
void genericBody();
void nullGenericBody();
void markdownBody();
void subtitle();
void nullSubtitle();
void mediaInfo();
@@ -346,6 +347,13 @@ void EventHandlerTest::nullGenericBody()
QCOMPARE(noEventHandler.getGenericBody(), QString());
}
void EventHandlerTest::markdownBody()
{
eventHandler.setEvent(room->messageEvents().at(0).get());
QCOMPARE(eventHandler.getMarkdownBody(), QStringLiteral("This is an example\ntext message"));
}
void EventHandlerTest::subtitle()
{
auto event = room->messageEvents().at(0).get();