| 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 | |
| 189 | void OpenRichMessageChannel( |
| 190 | not_null<Main::Session*> session, |
no test coverage detected