2018-08-19 22:23:40 +00:00
|
|
|
<span class="account-display-name">{@html massagedAccountName }</span>
|
|
|
|
<style>
|
|
|
|
.account-display-name {
|
|
|
|
pointer-events: none; /* allows focus to work correctly, focus on the parent only */
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
2018-08-20 02:31:54 +00:00
|
|
|
import { emojifyText } from '../../_utils/emojifyText'
|
2018-08-19 22:23:40 +00:00
|
|
|
import { store } from '../../_store/store'
|
|
|
|
import escapeHtml from 'escape-html'
|
2018-08-20 02:31:54 +00:00
|
|
|
import { removeEmoji } from '../../_utils/removeEmoji'
|
2018-08-19 22:23:40 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
store: () => store,
|
|
|
|
computed: {
|
|
|
|
emojis: ({ account }) => (account.emojis || []),
|
|
|
|
accountName: ({ account }) => (account.display_name || account.username),
|
2018-08-20 01:03:26 +00:00
|
|
|
massagedAccountName: ({ accountName, emojis, $autoplayGifs, $omitEmojiInDisplayNames }) => {
|
2018-08-19 22:23:40 +00:00
|
|
|
accountName = escapeHtml(accountName)
|
2018-08-20 01:03:26 +00:00
|
|
|
|
|
|
|
if ($omitEmojiInDisplayNames) { // display name emoji are annoying to some screenreader users
|
2018-08-20 02:31:54 +00:00
|
|
|
let emojiFreeDisplayName = removeEmoji(accountName, emojis)
|
|
|
|
if (emojiFreeDisplayName) {
|
|
|
|
return emojiFreeDisplayName
|
2018-08-20 01:03:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-19 22:23:40 +00:00
|
|
|
return emojifyText(accountName, emojis, $autoplayGifs)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|