this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Quietly handle hashtag links

No follow/unfollow yet.

+15 -8
+2 -2
src/components/account.jsx
··· 4 4 5 5 import emojifyText from '../utils/emojify-text'; 6 6 import enhanceContent from '../utils/enhance-content'; 7 - import handleAccountLinks from '../utils/handle-account-links'; 7 + import handleContentLinks from '../utils/handle-content-links'; 8 8 import shortenNumber from '../utils/shorten-number'; 9 9 import states from '../utils/states'; 10 10 import store from '../utils/store'; ··· 186 186 )} 187 187 <div 188 188 class="note" 189 - onClick={handleAccountLinks()} 189 + onClick={handleContentLinks()} 190 190 dangerouslySetInnerHTML={{ 191 191 __html: enhanceContent(note, { emojis }), 192 192 }}
+2 -2
src/components/status.jsx
··· 20 20 import Modal from '../components/modal'; 21 21 import NameText from '../components/name-text'; 22 22 import enhanceContent from '../utils/enhance-content'; 23 - import handleAccountLinks from '../utils/handle-account-links'; 23 + import handleContentLinks from '../utils/handle-content-links'; 24 24 import htmlContentLength from '../utils/html-content-length'; 25 25 import shortenNumber from '../utils/shorten-number'; 26 26 import states, { saveStatus } from '../utils/states'; ··· 346 346 lang={language} 347 347 ref={contentRef} 348 348 data-read-more={readMoreText} 349 - onClick={handleAccountLinks({ mentions })} 349 + onClick={handleContentLinks({ mentions })} 350 350 dangerouslySetInnerHTML={{ 351 351 __html: enhanceContent(content, { 352 352 emojis,
+1 -2
src/components/timeline.jsx
··· 91 91 <Icon icon="home" size="l" /> 92 92 </Link> 93 93 </div> 94 - {uiState !== 'loading' && 95 - (titleComponent ? titleComponent : <h1>{title}</h1>)} 94 + {title && (titleComponent ? titleComponent : <h1>{title}</h1>)} 96 95 <div class="header-side"> 97 96 <Loader hidden={uiState !== 'loading'} /> 98 97 </div>
+10 -2
src/utils/handle-account-links.js src/utils/handle-content-links.js
··· 1 1 import states from './states'; 2 2 3 - function handleAccountLinks(opts) { 3 + function handleContentLinks(opts) { 4 4 const { mentions = [] } = opts || {}; 5 5 return (e) => { 6 6 let { target } = e; ··· 33 33 const href = target.getAttribute('href'); 34 34 states.showAccount = href; 35 35 } 36 + } else if ( 37 + target.tagName.toLowerCase() === 'a' && 38 + target.classList.contains('hashtag') 39 + ) { 40 + e.preventDefault(); 41 + e.stopPropagation(); 42 + const tag = target.innerText.replace(/^#/, '').trim(); 43 + location.hash = `#/t/${tag}`; 36 44 } 37 45 }; 38 46 } 39 47 40 - export default handleAccountLinks; 48 + export default handleContentLinks;