mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +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,
|
||||
const QString &startText,
|
||||
const QString &startLink,
|
||||
Fn<void(QString, QString)> callback) {
|
||||
Fn<void(QString, QString)> callback,
|
||||
const style::InputField *fieldStyle) {
|
||||
Expects(callback != nullptr);
|
||||
|
||||
const auto &fieldSt = fieldStyle ? *fieldStyle : st::defaultInputField;
|
||||
const auto content = box->verticalLayout();
|
||||
|
||||
const auto text = content->add(
|
||||
object_ptr<Ui::InputField>(
|
||||
content,
|
||||
st::defaultInputField,
|
||||
fieldSt,
|
||||
tr::lng_formatting_link_text(),
|
||||
startText),
|
||||
st::markdownLinkFieldPadding);
|
||||
|
@ -114,7 +116,7 @@ void EditLinkBox(
|
|||
box->getDelegate()->outerContainer(),
|
||||
text,
|
||||
session);
|
||||
InitSpellchecker(std::move(show), session, text);
|
||||
InitSpellchecker(std::move(show), session, text, fieldStyle != nullptr);
|
||||
|
||||
const auto placeholder = content->add(
|
||||
object_ptr<Ui::RpWidget>(content),
|
||||
|
@ -124,7 +126,7 @@ void EditLinkBox(
|
|||
content,
|
||||
object_ptr<Ui::InputField>(
|
||||
content,
|
||||
st::defaultInputField,
|
||||
fieldSt,
|
||||
tr::lng_formatting_link_url(),
|
||||
startLink.trimmed()));
|
||||
url->heightValue(
|
||||
|
@ -243,7 +245,8 @@ Fn<bool(
|
|||
EditLinkAction action)> DefaultEditLinkCallback(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
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);
|
||||
return [=](
|
||||
EditLinkSelection selection,
|
||||
|
@ -260,7 +263,14 @@ Fn<bool(
|
|||
}
|
||||
};
|
||||
show->showBox(
|
||||
Box(EditLinkBox, show, session, text, link, std::move(callback)),
|
||||
Box(
|
||||
EditLinkBox,
|
||||
show,
|
||||
session,
|
||||
text,
|
||||
link,
|
||||
std::move(callback),
|
||||
fieldStyle),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -41,7 +41,8 @@ Fn<bool(
|
|||
Ui::InputField::EditLinkAction action)> DefaultEditLinkCallback(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<Main::Session*> session,
|
||||
not_null<Ui::InputField*> field);
|
||||
not_null<Ui::InputField*> field,
|
||||
const style::InputField *fieldStyle = nullptr);
|
||||
void InitMessageField(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::InputField*> field);
|
||||
|
|
Loading…
Add table
Reference in a new issue