Fix copying links
Copy hashtag, username
This commit is contained in:
parent
4fa9e33bd5
commit
318035e971
@ -36,6 +36,7 @@ export default class ChatContextMenu {
|
||||
private isTargetAGroupedItem: boolean;
|
||||
private isTextSelected: boolean;
|
||||
private isAnchorTarget: boolean;
|
||||
private isUsernameTarget: boolean;
|
||||
private peerId: number;
|
||||
private mid: number;
|
||||
private message: any;
|
||||
@ -89,7 +90,11 @@ export default class ChatContextMenu {
|
||||
//this.msgID = msgID;
|
||||
this.target = e.target as HTMLElement;
|
||||
this.isTextSelected = !isSelectionEmpty();
|
||||
this.isAnchorTarget = this.target.tagName === 'A' && (this.target as HTMLAnchorElement).target === '_blank';
|
||||
this.isAnchorTarget = this.target.tagName === 'A' && (
|
||||
(this.target as HTMLAnchorElement).target === '_blank' ||
|
||||
this.target.classList.contains('anchor-url')
|
||||
);
|
||||
this.isUsernameTarget = this.target.tagName === 'A' && this.target.classList.contains('mention');
|
||||
|
||||
const groupedItem = findUpClassName(this.target, 'grouped-item');
|
||||
this.isTargetAGroupedItem = !!groupedItem;
|
||||
@ -231,6 +236,22 @@ export default class ChatContextMenu {
|
||||
onClick: this.onCopyAnchorLinkClick,
|
||||
verify: () => this.isAnchorTarget,
|
||||
withSelection: true
|
||||
}, {
|
||||
icon: 'copy',
|
||||
text: 'Text.Context.Copy.Username',
|
||||
onClick: () => {
|
||||
copyTextToClipboard(this.target.innerHTML);
|
||||
},
|
||||
verify: () => this.isUsernameTarget,
|
||||
withSelection: true
|
||||
}, {
|
||||
icon: 'copy',
|
||||
text: 'Text.Context.Copy.Hashtag',
|
||||
onClick: () => {
|
||||
copyTextToClipboard(this.target.innerHTML);
|
||||
},
|
||||
verify: () => this.target.classList.contains('anchor-hashtag'),
|
||||
withSelection: true
|
||||
}, {
|
||||
icon: 'link',
|
||||
text: 'MessageContext.CopyMessageLink1',
|
||||
|
@ -793,6 +793,8 @@ const lang = {
|
||||
//"Schedule.SendWhenOnline": "Send When Online",
|
||||
"Stickers.Recent": "Recent",
|
||||
//"Stickers.Favorite": "Favorite",
|
||||
"Text.Context.Copy.Username": "Copy Username",
|
||||
"Text.Context.Copy.Hashtag": "Copy Hashtag",
|
||||
"Time.TomorrowAt": "tomorrow at %@",
|
||||
"TwoStepAuth.SetPasswordHelp": "You can set a password that will be required when you log in on a new device in addition to the code you get in the SMS.",
|
||||
"TwoStepAuth.GenericHelp": "You have enabled Two-Step verification.\nYou'll need the password you set up here to log in to your Telegram account.",
|
||||
|
Loading…
Reference in New Issue
Block a user