2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Added ability to use EditLinkBox without SessionController.

This commit is contained in:
23rd
2022-03-03 19:44:42 +03:00
parent 87bdfaf731
commit cf55f1a7cd
7 changed files with 32 additions and 19 deletions

View File

@@ -851,7 +851,10 @@ not_null<Ui::InputField*> CreatePollBox::setupSolution(
Core::App().settings().replaceEmojiValue());
solution->setMarkdownReplacesEnabled(rpl::single(true));
solution->setEditLinkCallback(
DefaultEditLinkCallback(_controller, solution));
DefaultEditLinkCallback(
std::make_shared<Window::Show>(_controller),
session,
solution));
solution->customTab(true);
const auto warning = CreateWarningLabel(

View File

@@ -238,6 +238,8 @@ void EditCaptionBox::rebuildPreview() {
}
void EditCaptionBox::setupField() {
const auto show = std::make_shared<Window::Show>(_controller);
const auto session = &_controller->session();
_field->setMaxLength(
_controller->session().serverConfig().captionLengthMax);
_field->setSubmitSettings(
@@ -247,10 +249,10 @@ void EditCaptionBox::setupField() {
Core::App().settings().replaceEmojiValue());
_field->setMarkdownReplacesEnabled(rpl::single(true));
_field->setEditLinkCallback(
DefaultEditLinkCallback(_controller, _field));
DefaultEditLinkCallback(show, session, _field));
_field->setMaxHeight(st::confirmCaptionArea.heightMax);
InitSpellchecker(_controller, _field);
InitSpellchecker(show, session, _field);
connect(_field, &Ui::InputField::submitted, [=] { save(); });
connect(_field, &Ui::InputField::cancelled, [=] { closeBox(); });

View File

@@ -706,18 +706,21 @@ void SendFilesBox::setupCaption() {
}
Unexpected("action in MimeData hook.");
});
const auto show = std::make_shared<Window::Show>(_controller);
const auto session = &_controller->session();
_caption->setInstantReplaces(Ui::InstantReplaces::Default());
_caption->setInstantReplacesEnabled(
Core::App().settings().replaceEmojiValue());
_caption->setMarkdownReplacesEnabled(rpl::single(true));
_caption->setEditLinkCallback(
DefaultEditLinkCallback(_controller, _caption));
DefaultEditLinkCallback(show, session, _caption));
Ui::Emoji::SuggestionsController::Init(
getDelegate()->outerContainer(),
_caption,
&_controller->session());
session);
InitSpellchecker(_controller, _caption);
InitSpellchecker(show, session, _caption);
updateCaptionPlaceholder();
setupEmojiPanel();

View File

@@ -258,7 +258,8 @@ void ShareBox::prepareCommentField() {
} else if (_descriptor.navigation) {
field->setEditLinkCallback(
DefaultEditLinkCallback(
_descriptor.navigation->parentController(),
std::make_shared<Window::Show>(_descriptor.navigation),
_descriptor.session,
field));
}
field->setSubmitSettings(Core::App().settings().sendSubmitWay());