mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-02 15:35:51 +00:00
Added draft menu to EditCaptionBox to open photo editor.
This commit is contained in:
@@ -621,33 +621,12 @@ void SendFilesBox::pushBlock(int from, int till) {
|
||||
|
||||
block.itemModifyRequest(
|
||||
) | rpl::start_with_next([=, controller = _controller](int index) {
|
||||
auto &file = _list.files[index];
|
||||
if (file.type != Ui::PreparedFile::Type::Photo) {
|
||||
return;
|
||||
}
|
||||
using ImageInfo = Ui::PreparedFileInformation::Image;
|
||||
const auto image = std::get_if<ImageInfo>(&file.information->media);
|
||||
if (!image) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto callback = [=](const Editor::PhotoModifications &mods) {
|
||||
image->modifications = mods;
|
||||
Storage::UpdateImageDetails(
|
||||
_list.files[index],
|
||||
st::sendMediaPreviewSize);
|
||||
refreshAllAfterChanges(from);
|
||||
};
|
||||
auto copy = image->data;
|
||||
const auto fileImage = std::make_shared<Image>(std::move(copy));
|
||||
controller->showLayer(
|
||||
std::make_unique<Editor::LayerWidget>(
|
||||
this,
|
||||
&controller->window(),
|
||||
fileImage,
|
||||
image->modifications,
|
||||
std::move(callback)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
Editor::OpenWithPreparedFile(
|
||||
this,
|
||||
controller,
|
||||
&_list.files[index],
|
||||
st::sendMediaPreviewSize,
|
||||
[=] { refreshAllAfterChanges(from); });
|
||||
}, widget->lifetime());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user