2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Copy text with expanded links only to external.

Paste valid custom links in message field if copied from messages.
This commit is contained in:
John Preston
2019-04-08 19:10:06 +04:00
parent 0f0c3b7461
commit b5be6df5e2
64 changed files with 772 additions and 647 deletions

View File

@@ -486,8 +486,7 @@ DeleteMessagesBox::DeleteMessagesBox(
void DeleteMessagesBox::prepare() {
auto details = TextWithEntities();
const auto appendDetails = [&](TextWithEntities &&text) {
TextUtilities::Append(details, { "\n\n" });
TextUtilities::Append(details, std::move(text));
details.append(qstr("\n\n")).append(std::move(text));
};
auto deleteKey = lng_box_delete;
auto deleteStyle = &st::defaultBoxButton;
@@ -648,7 +647,7 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
if (const auto user = peer->asUser()) {
auto boldName = TextWithEntities{ user->firstName };
boldName.entities.push_back(
EntityInText(EntityInTextBold, 0, boldName.text.size()));
{ EntityType::Bold, 0, boldName.text.size() });
if (canRevokeOutgoingCount == 1) {
result.description = lng_selected_unsend_about_user_one__generic<TextWithEntities>(
lt_user,

View File

@@ -229,7 +229,7 @@ void ConfirmPhoneBox::prepare() {
aboutText.text = lng_confirm_phone_about(lt_phone, formattedPhone);
auto phonePosition = aboutText.text.indexOf(formattedPhone);
if (phonePosition >= 0) {
aboutText.entities.push_back(EntityInText(EntityInTextBold, phonePosition, formattedPhone.size()));
aboutText.entities.push_back({ EntityType::Bold, phonePosition, formattedPhone.size() });
}
_about->setMarkedText(aboutText);

View File

@@ -627,11 +627,11 @@ void Controller::refreshEditInviteLink() {
if (text.text.startsWith(remove)) {
text.text.remove(0, remove.size());
}
text.entities.push_back(EntityInText(
EntityInTextCustomUrl,
text.entities.push_back({
EntityType::CustomUrl,
0,
text.text.size(),
link));
link });
}
_controls.inviteLink->setMarkedText(text);