diff --git a/Telegram/SourceFiles/boxes/create_ai_box.cpp b/Telegram/SourceFiles/boxes/create_ai_box.cpp index 4c8db6b16f..05c47bf5ba 100644 --- a/Telegram/SourceFiles/boxes/create_ai_box.cpp +++ b/Telegram/SourceFiles/boxes/create_ai_box.cpp @@ -423,6 +423,7 @@ void CreateAiBox(not_null box, CreateAiBoxArgs &&args) { if (state->applyToPage) { state->applyToPage(state->page); } + box->closeBox(); }); pill->setFullRadius(true); diff --git a/Telegram/SourceFiles/iv/editor/iv_editor_box.cpp b/Telegram/SourceFiles/iv/editor/iv_editor_box.cpp index c49acd43d3..c3c6f6014b 100644 --- a/Telegram/SourceFiles/iv/editor/iv_editor_box.cpp +++ b/Telegram/SourceFiles/iv/editor/iv_editor_box.cpp @@ -1553,9 +1553,15 @@ void WindowHost::Impl::setupWindow(ShowWindowDescriptor &&descriptor) { u"rich_message"_q); return; } + const auto editor = _editor; ShowCreateAiBox(_show, { .session = session, - .applyToPage = [](std::shared_ptr) {}, + .applyToPage = [editor](std::shared_ptr page) { + if (!editor || !page || page->blocks.empty()) { + return; + } + editor->insertPreparedBlocks(page->blocks); + }, }); }); addBottomAiStar(button, session);