mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Support modern blockquote/pre display.
This commit is contained in:
parent
501cae2200
commit
c1f36d43d0
4 changed files with 39 additions and 27 deletions
|
@ -989,8 +989,33 @@ historyUnreadReactions: TwoIconButton(historyToDown) {
|
||||||
}
|
}
|
||||||
historyUnreadThingsSkip: 4px;
|
historyUnreadThingsSkip: 4px;
|
||||||
|
|
||||||
|
historyQuoteStyle: QuoteStyle(defaultQuoteStyle) {
|
||||||
|
padding: margins(10px, 2px, 4px, 2px);
|
||||||
|
verticalSkip: 4px;
|
||||||
|
outline: 3px;
|
||||||
|
outlineShift: 2px;
|
||||||
|
radius: 5px;
|
||||||
|
}
|
||||||
|
historyTextStyle: TextStyle(defaultTextStyle) {
|
||||||
|
blockquote: QuoteStyle(historyQuoteStyle) {
|
||||||
|
padding: margins(10px, 2px, 20px, 2px);
|
||||||
|
icon: icon{{ "chat/mini_quote", windowFg }};
|
||||||
|
iconPosition: point(4px, 4px);
|
||||||
|
expand: icon{{ "intro_country_dropdown", windowFg }};
|
||||||
|
expandPosition: point(6px, 4px);
|
||||||
|
collapse: icon{{ "intro_country_dropdown-flip_vertical", windowFg }};
|
||||||
|
collapsePosition: point(6px, 4px);
|
||||||
|
}
|
||||||
|
pre: QuoteStyle(historyQuoteStyle) {
|
||||||
|
header: 20px;
|
||||||
|
headerPosition: point(10px, 2px);
|
||||||
|
scrollable: true;
|
||||||
|
icon: icon{{ "chat/mini_copy", windowFg }};
|
||||||
|
iconPosition: point(4px, 2px);
|
||||||
|
}
|
||||||
|
}
|
||||||
historyComposeField: InputField(defaultInputField) {
|
historyComposeField: InputField(defaultInputField) {
|
||||||
style: defaultTextStyle;
|
style: historyTextStyle;
|
||||||
textMargins: margins(0px, 0px, 0px, 0px);
|
textMargins: margins(0px, 0px, 0px, 0px);
|
||||||
textAlign: align(left);
|
textAlign: align(left);
|
||||||
textFg: historyComposeAreaFg;
|
textFg: historyComposeAreaFg;
|
||||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/qthelp_regex.h"
|
#include "base/qthelp_regex.h"
|
||||||
#include "base/qthelp_url.h"
|
#include "base/qthelp_url.h"
|
||||||
#include "base/event_filter.h"
|
#include "base/event_filter.h"
|
||||||
|
#include "ui/chat/chat_style.h"
|
||||||
#include "ui/layers/generic_box.h"
|
#include "ui/layers/generic_box.h"
|
||||||
#include "ui/rect.h"
|
#include "ui/rect.h"
|
||||||
#include "core/shortcuts.h"
|
#include "core/shortcuts.h"
|
||||||
|
@ -344,6 +345,15 @@ void InitMessageFieldHandlers(
|
||||||
DefaultEditLinkCallback(show, field, fieldStyle));
|
DefaultEditLinkCallback(show, field, fieldStyle));
|
||||||
InitSpellchecker(show, field, fieldStyle != nullptr);
|
InitSpellchecker(show, field, fieldStyle != nullptr);
|
||||||
}
|
}
|
||||||
|
const auto style = field->lifetime().make_state<Ui::ChatStyle>(
|
||||||
|
session->colorIndicesValue());
|
||||||
|
field->setPreCache([=] {
|
||||||
|
return style->messageStyle(false, false).preCache.get();
|
||||||
|
});
|
||||||
|
field->setBlockquoteCache([=] {
|
||||||
|
const auto colorIndex = session->user()->colorIndex();
|
||||||
|
return style->coloredQuoteCache(false, colorIndex).get();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool IsGoodFactcheckUrl(QStringView url) {
|
[[nodiscard]] bool IsGoodFactcheckUrl(QStringView url) {
|
||||||
|
|
|
@ -54,31 +54,8 @@ msgDateDelta: point(2px, 5px);
|
||||||
msgDateImgDelta: 4px;
|
msgDateImgDelta: 4px;
|
||||||
msgDateImgPadding: point(8px, 2px);
|
msgDateImgPadding: point(8px, 2px);
|
||||||
|
|
||||||
messageQuoteStyle: QuoteStyle(defaultQuoteStyle) {
|
messageQuoteStyle: historyQuoteStyle;
|
||||||
padding: margins(10px, 2px, 4px, 2px);
|
messageTextStyle: historyTextStyle;
|
||||||
verticalSkip: 4px;
|
|
||||||
outline: 3px;
|
|
||||||
outlineShift: 2px;
|
|
||||||
radius: 5px;
|
|
||||||
}
|
|
||||||
messageTextStyle: TextStyle(defaultTextStyle) {
|
|
||||||
blockquote: QuoteStyle(messageQuoteStyle) {
|
|
||||||
padding: margins(10px, 2px, 20px, 2px);
|
|
||||||
icon: icon{{ "chat/mini_quote", windowFg }};
|
|
||||||
iconPosition: point(4px, 4px);
|
|
||||||
expand: icon{{ "intro_country_dropdown", windowFg }};
|
|
||||||
expandPosition: point(6px, 4px);
|
|
||||||
collapse: icon{{ "intro_country_dropdown-flip_vertical", windowFg }};
|
|
||||||
collapsePosition: point(6px, 4px);
|
|
||||||
}
|
|
||||||
pre: QuoteStyle(messageQuoteStyle) {
|
|
||||||
header: 20px;
|
|
||||||
headerPosition: point(10px, 2px);
|
|
||||||
scrollable: true;
|
|
||||||
icon: icon{{ "chat/mini_copy", windowFg }};
|
|
||||||
iconPosition: point(4px, 2px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
historyPagePreview: QuoteStyle(messageQuoteStyle) {
|
historyPagePreview: QuoteStyle(messageQuoteStyle) {
|
||||||
padding: margins(10px, 5px, 7px, 7px);
|
padding: margins(10px, 5px, 7px, 7px);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 924301cd62d918ef25ab81d758ed4b2fff903f2e
|
Subproject commit d4d51136cd5ff54b84b2863a7ece39693b5ce522
|
Loading…
Add table
Reference in a new issue