diff --git a/src/qml/RichLabel.qml b/src/qml/RichLabel.qml index 82902d039..097f84b11 100644 --- a/src/qml/RichLabel.qml +++ b/src/qml/RichLabel.qml @@ -67,6 +67,18 @@ table td { border: 1px solid black; padding: 3px; } +blockquote { + margin: 0; +} +blockquote table { + width: 100%; + border-width: 0; + background-color:" + Kirigami.Theme.alternateBackgroundColor + "; +} +blockquote td { + width: 100%; + padding: " + Kirigami.Units.largeSpacing + "; +} pre { white-space: pre-wrap } diff --git a/src/texthandler.cpp b/src/texthandler.cpp index c5a9147ee..c228f43bf 100644 --- a/src/texthandler.cpp +++ b/src/texthandler.cpp @@ -134,6 +134,10 @@ QString TextHandler::handleRecieveRichText(Qt::TextFormat inputFormat, const Neo nextTokenType(); } + // Apply user style to blockquotes + // Unfortunately some attributes can be only be used on table cells, so we need to wrap the content in one. + outputString.replace(TextRegex::blockQuote, QStringLiteral(R"(
“\1”
)")); + // If the message is an emote add the user pill to the front of the message. if (event != nullptr) { auto e = eventCast(event); diff --git a/src/texthandler.h b/src/texthandler.h index 20df7926c..eac83e0f9 100644 --- a/src/texthandler.h +++ b/src/texthandler.h @@ -19,6 +19,8 @@ static const QRegularExpression removeReply{QStringLiteral("> <.*?>.*?\\n\\n"), static const QRegularExpression removeRichReply{QStringLiteral(".*?"), QRegularExpression::DotMatchesEverythingOption}; static const QRegularExpression codePill{QStringLiteral("
]*>(.*?)
"), QRegularExpression::DotMatchesEverythingOption}; static const QRegularExpression userPill{QStringLiteral("(.*?)"), QRegularExpression::DotMatchesEverythingOption}; +static const QRegularExpression blockQuote{QStringLiteral("
\n?(?:

)?(.*?)(?:

)?\n?
"), + QRegularExpression::DotMatchesEverythingOption}; static const QRegularExpression strikethrough{QStringLiteral("(.*?)"), QRegularExpression::DotMatchesEverythingOption}; static const QRegularExpression mxcImage{QStringLiteral(R"AAA()AAA")}; static const QRegularExpression plainUrl(