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

@@ -159,6 +159,14 @@ public:
*/
bool isHidden();
/**
* @brief Output a string for the room message content without any formatting.
*
* This is the content of the formatted_body key if present or the body key if
* not.
*/
static QString rawMessageBody(const Quotient::RoomMessageEvent &event);
/**
* @brief Output a string for the message content ready for display in a rich text field.
*
@@ -191,6 +199,13 @@ public:
*/
QString getPlainBody(bool stripNewlines = false) const;
/**
* @brief Output the original body for the message content, useful for editing the original message.
*
* The event type must be a room message event.
*/
QString getMarkdownBody() const;
/**
* @brief Output a generic string for the message content ready for display.
*