MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / PreparedContentHasAnchor

Function PreparedContentHasAnchor

Telegram/SourceFiles/iv/iv_instance.cpp:168–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168[[nodiscard]] bool PreparedContentHasAnchor(
169 const Markdown::MarkdownArticleContent &content,
170 const QString &anchorId) {
171 if (anchorId.isEmpty()) {
172 return false;
173 }
174 auto article = Markdown::MarkdownArticle(st::defaultMarkdown);
175 article.setContent(content);
176 const auto width = article.maxWidth();
177 static_cast<void>(article.resizeGetHeight(width));
178 auto top = article.anchorTop(anchorId);
179 if (top < 0) {
180 const auto expansion = article.expandDetailsToAnchor(anchorId);
181 if (expansion.changed) {
182 static_cast<void>(article.resizeGetHeight(width));
183 }
184 top = article.anchorTop(anchorId);
185 }
186 return (top >= 0);
187}
188
189void OpenRichMessageChannel(
190 not_null<Main::Session*> session,

Callers 1

showRichMessageMethod · 0.85

Calls 7

MarkdownArticleClass · 0.85
isEmptyMethod · 0.45
setContentMethod · 0.45
maxWidthMethod · 0.45
resizeGetHeightMethod · 0.45
anchorTopMethod · 0.45
expandDetailsToAnchorMethod · 0.45

Tested by

no test coverage detected