Insert AI-generated blocks into the page

This commit is contained in:
John Preston
2026-06-30 18:28:00 +04:00
parent 6f142f3dad
commit a02f441e5d
2 changed files with 8 additions and 1 deletions
@@ -423,6 +423,7 @@ void CreateAiBox(not_null<Ui::GenericBox*> box, CreateAiBoxArgs &&args) {
if (state->applyToPage) {
state->applyToPage(state->page);
}
box->closeBox();
});
pill->setFullRadius(true);
@@ -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<const RichPage>) {},
.applyToPage = [editor](std::shared_ptr<const RichPage> page) {
if (!editor || !page || page->blocks.empty()) {
return;
}
editor->insertPreparedBlocks(page->blocks);
},
});
});
addBottomAiStar(button, session);