mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +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),
|
||||
st::markdownLinkFieldPadding);
|
||||
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(
|
||||
content,
|
||||
object_ptr<Ui::InputField>(
|
||||
content,
|
||||
fieldSt,
|
||||
tr::lng_formatting_link_url(),
|
||||
startLink.trimmed()));
|
||||
link));
|
||||
url->heightValue(
|
||||
) | rpl::start_with_next([placeholder](int height) {
|
||||
placeholder->resize(placeholder->width(), height);
|
||||
|
|
Loading…
Add table
Reference in a new issue