Added cashtag support for statuses

• Added:
- cashtag support for statuses

Ref: e23931b255
This commit is contained in:
mgabdev
2020-10-30 14:01:55 -05:00
parent 9f712198dc
commit 6db1cf421b
6 changed files with 67 additions and 18 deletions

View File

@@ -50,7 +50,7 @@ class StatusContent extends ImmutablePureComponent {
link.addEventListener('click', this.onMentionClick.bind(this, mention), false)
link.setAttribute('title', mention.get('acct'))
link.removeAttribute('target')
} else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) {
} else if (['#', '$'].includes(link.textContent[0]) || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) {
link.addEventListener('click', this.onHashtagClick.bind(this, link.text), false)
link.removeAttribute('target')
} else {
@@ -85,7 +85,7 @@ class StatusContent extends ImmutablePureComponent {
}
onHashtagClick = (hashtag, e) => {
hashtag = hashtag.replace(/^#/, '').toLowerCase()
hashtag = hashtag.replace(/^(#|\$)/, '').toLowerCase()
if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault()