mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-23 11:28:49 +03:00
Compare commits
4 commits
9668ef4322
...
f6fb1b0fe1
Author | SHA1 | Date | |
---|---|---|---|
|
f6fb1b0fe1 | ||
|
1a00d91316 | ||
|
b7a5d714c6 | ||
|
c7e1c554bb |
2 changed files with 13 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
import ".."
|
import ".."
|
||||||
import im.nheko
|
import im.nheko
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ MatrixText {
|
||||||
property string copyText: selectedText ? getText(selectionStart, selectionEnd) : body
|
property string copyText: selectedText ? getText(selectionStart, selectionEnd) : body
|
||||||
property int metadataWidth: 100
|
property int metadataWidth: 100
|
||||||
property bool fitsMetadata: false //positionAt(width,height-4) == positionAt(width-metadataWidth-10, height-4)
|
property bool fitsMetadata: false //positionAt(width,height-4) == positionAt(width-metadataWidth-10, height-4)
|
||||||
|
property bool showSpoilers: false
|
||||||
|
|
||||||
// table border-collapse doesn't seem to work
|
// table border-collapse doesn't seem to work
|
||||||
text: `
|
text: `
|
||||||
|
@ -33,11 +35,12 @@ MatrixText {
|
||||||
padding: ` + Math.ceil(fontMetrics.lineSpacing/2) + `px;
|
padding: ` + Math.ceil(fontMetrics.lineSpacing/2) + `px;
|
||||||
}
|
}
|
||||||
blockquote { margin-left: 1em; }
|
blockquote { margin-left: 1em; }
|
||||||
` + (!Settings.mobileMode ? `span[data-mx-spoiler] {
|
span[data-mx-spoiler] {` + (!showSpoilers ? `
|
||||||
color: transparent;
|
color: transparent;
|
||||||
background-color: ` + palette.text + `;
|
background-color: ` + palette.text + `;` : `
|
||||||
}` : "") + // TODO(Nico): Figure out how to support mobile
|
background-color: ` + palette.alternateBase + ';') + `
|
||||||
`</style>
|
}
|
||||||
|
</style>
|
||||||
` + formatted.replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>")
|
` + formatted.replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>")
|
||||||
|
|
||||||
enabled: !isReply
|
enabled: !isReply
|
||||||
|
@ -49,4 +52,7 @@ MatrixText {
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TapHandler {
|
||||||
|
onTapped: showSpoilers = !showSpoilers
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <QVideoFrame>
|
#include <QVideoFrame>
|
||||||
#include <QVideoSink>
|
#include <QVideoSink>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include <mtx/responses/common.hpp>
|
#include <mtx/responses/common.hpp>
|
||||||
|
@ -578,8 +580,7 @@ InputBar::message(const QString &msg, MarkdownOverride useMarkdown, bool rainbow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text.body =
|
text.body = fmt::format("{}\n{}", body.toStdString(), text.body);
|
||||||
QStringLiteral("%1\n%2").arg(body, QString::fromStdString(text.body)).toStdString();
|
|
||||||
|
|
||||||
// NOTE(Nico): rich replies always need a formatted_body!
|
// NOTE(Nico): rich replies always need a formatted_body!
|
||||||
text.format = "org.matrix.custom.html";
|
text.format = "org.matrix.custom.html";
|
||||||
|
|
Loading…
Reference in a new issue