mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Slightly improved box for link creation when user has link in clipboard.
This commit is contained in:
parent
c93f047056
commit
6f71d21bb7
1 changed files with 12 additions and 1 deletions
|
@ -147,13 +147,24 @@ void EditLinkBox(
|
||||||
object_ptr<Ui::RpWidget>(content),
|
object_ptr<Ui::RpWidget>(content),
|
||||||
st::markdownLinkFieldPadding);
|
st::markdownLinkFieldPadding);
|
||||||
placeholder->setAttribute(Qt::WA_TransparentForMouseEvents);
|
placeholder->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
const auto link = [&] {
|
||||||
|
if (!startLink.trimmed().isEmpty()) {
|
||||||
|
return startLink.trimmed();
|
||||||
|
}
|
||||||
|
const auto clipboard = QGuiApplication::clipboard()->text().trimmed();
|
||||||
|
if (clipboard.startsWith("http://")
|
||||||
|
|| clipboard.startsWith("https://")) {
|
||||||
|
return clipboard;
|
||||||
|
}
|
||||||
|
return QString();
|
||||||
|
}();
|
||||||
const auto url = Ui::AttachParentChild(
|
const auto url = Ui::AttachParentChild(
|
||||||
content,
|
content,
|
||||||
object_ptr<Ui::InputField>(
|
object_ptr<Ui::InputField>(
|
||||||
content,
|
content,
|
||||||
fieldSt,
|
fieldSt,
|
||||||
tr::lng_formatting_link_url(),
|
tr::lng_formatting_link_url(),
|
||||||
startLink.trimmed()));
|
link));
|
||||||
url->heightValue(
|
url->heightValue(
|
||||||
) | rpl::start_with_next([placeholder](int height) {
|
) | rpl::start_with_next([placeholder](int height) {
|
||||||
placeholder->resize(placeholder->width(), height);
|
placeholder->resize(placeholder->width(), height);
|
||||||
|
|
Loading…
Add table
Reference in a new issue