diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 4f6d347c2..5d4badd36 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -314,7 +314,8 @@ void InitMessageField( } void InitSpellchecker( - not_null controller, + std::shared_ptr show, + not_null session, not_null field) { #ifndef TDESKTOP_DISABLE_SPELLCHECK const auto s = Ui::CreateChild( @@ -322,15 +323,21 @@ void InitSpellchecker( Core::App().settings().spellcheckerEnabledValue(), Spellchecker::SpellingHighlighter::CustomContextMenuItem{ tr::lng_settings_manage_dictionaries(tr::now), - [=] { - controller->show( - Box(&controller->session())); - } + [=] { show->showBox(Box(session)); } }); field->setExtendedContextMenu(s->contextMenuCreated()); #endif // TDESKTOP_DISABLE_SPELLCHECK } +void InitSpellchecker( + not_null controller, + not_null field) { + InitSpellchecker( + std::make_shared(controller), + &controller->session(), + field); +} + bool HasSendText(not_null field) { const auto &text = field->getTextWithTags().text; for (const auto &ch : text) { diff --git a/Telegram/SourceFiles/chat_helpers/message_field.h b/Telegram/SourceFiles/chat_helpers/message_field.h index 72c737dd4..4d579897d 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.h +++ b/Telegram/SourceFiles/chat_helpers/message_field.h @@ -28,6 +28,7 @@ class SessionController; namespace Ui { class PopupMenu; +class Show; } // namespace Ui QString PrepareMentionTag(not_null user); @@ -44,6 +45,10 @@ void InitMessageField( not_null controller, not_null field); +void InitSpellchecker( + std::shared_ptr show, + not_null session, + not_null field); void InitSpellchecker( not_null controller, not_null field);