mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Added ability to provide field style to EditLinkBox.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user