mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Added ability to provide field style to EditLinkBox.
This commit is contained in:
parent
cf55f1a7cd
commit
309d4ea702
2 changed files with 18 additions and 7 deletions
|
@ -95,15 +95,17 @@ void EditLinkBox(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const QString &startText,
|
const QString &startText,
|
||||||
const QString &startLink,
|
const QString &startLink,
|
||||||
Fn<void(QString, QString)> callback) {
|
Fn<void(QString, QString)> callback,
|
||||||
|
const style::InputField *fieldStyle) {
|
||||||
Expects(callback != nullptr);
|
Expects(callback != nullptr);
|
||||||
|
|
||||||
|
const auto &fieldSt = fieldStyle ? *fieldStyle : st::defaultInputField;
|
||||||
const auto content = box->verticalLayout();
|
const auto content = box->verticalLayout();
|
||||||
|
|
||||||
const auto text = content->add(
|
const auto text = content->add(
|
||||||
object_ptr<Ui::InputField>(
|
object_ptr<Ui::InputField>(
|
||||||
content,
|
content,
|
||||||
st::defaultInputField,
|
fieldSt,
|
||||||
tr::lng_formatting_link_text(),
|
tr::lng_formatting_link_text(),
|
||||||
startText),
|
startText),
|
||||||
st::markdownLinkFieldPadding);
|
st::markdownLinkFieldPadding);
|
||||||
|
@ -114,7 +116,7 @@ void EditLinkBox(
|
||||||
box->getDelegate()->outerContainer(),
|
box->getDelegate()->outerContainer(),
|
||||||
text,
|
text,
|
||||||
session);
|
session);
|
||||||
InitSpellchecker(std::move(show), session, text);
|
InitSpellchecker(std::move(show), session, text, fieldStyle != nullptr);
|
||||||
|
|
||||||
const auto placeholder = content->add(
|
const auto placeholder = content->add(
|
||||||
object_ptr<Ui::RpWidget>(content),
|
object_ptr<Ui::RpWidget>(content),
|
||||||
|
@ -124,7 +126,7 @@ void EditLinkBox(
|
||||||
content,
|
content,
|
||||||
object_ptr<Ui::InputField>(
|
object_ptr<Ui::InputField>(
|
||||||
content,
|
content,
|
||||||
st::defaultInputField,
|
fieldSt,
|
||||||
tr::lng_formatting_link_url(),
|
tr::lng_formatting_link_url(),
|
||||||
startLink.trimmed()));
|
startLink.trimmed()));
|
||||||
url->heightValue(
|
url->heightValue(
|
||||||
|
@ -243,7 +245,8 @@ Fn<bool(
|
||||||
EditLinkAction action)> DefaultEditLinkCallback(
|
EditLinkAction action)> DefaultEditLinkCallback(
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
not_null<Ui::InputField*> field) {
|
not_null<Ui::InputField*> field,
|
||||||
|
const style::InputField *fieldStyle) {
|
||||||
const auto weak = Ui::MakeWeak(field);
|
const auto weak = Ui::MakeWeak(field);
|
||||||
return [=](
|
return [=](
|
||||||
EditLinkSelection selection,
|
EditLinkSelection selection,
|
||||||
|
@ -260,7 +263,14 @@ Fn<bool(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
show->showBox(
|
show->showBox(
|
||||||
Box(EditLinkBox, show, session, text, link, std::move(callback)),
|
Box(
|
||||||
|
EditLinkBox,
|
||||||
|
show,
|
||||||
|
session,
|
||||||
|
text,
|
||||||
|
link,
|
||||||
|
std::move(callback),
|
||||||
|
fieldStyle),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,8 @@ Fn<bool(
|
||||||
Ui::InputField::EditLinkAction action)> DefaultEditLinkCallback(
|
Ui::InputField::EditLinkAction action)> DefaultEditLinkCallback(
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
not_null<Ui::InputField*> field);
|
not_null<Ui::InputField*> field,
|
||||||
|
const style::InputField *fieldStyle = nullptr);
|
||||||
void InitMessageField(
|
void InitMessageField(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<Ui::InputField*> field);
|
not_null<Ui::InputField*> field);
|
||||||
|
|
Loading…
Add table
Reference in a new issue