mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 11:52:58 +00:00
Insert AI-generated blocks into the page
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user