2018-08-20 00:23:40 +02: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 04:31:54 +02:00
|
|
|
import { emojifyText } from '../../_utils/emojifyText'
|
2018-08-20 00:23:40 +02:00
|
|
|
import { store } from '../../_store/store'
|
|
|
|
import escapeHtml from 'escape-html'
|
2018-08-20 04:31:54 +02:00
|
|
|
import { removeEmoji } from '../../_utils/removeEmoji'
|
2018-08-20 00:23:40 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
store: () => store,
|
|
|
|
computed: {
|
|
|
|
emojis: ({ account }) => (account.emojis || []),
|
|
|
|
accountName: ({ account }) => (account.display_name || account.username),
|
2018-08-20 03:03:26 +02:00
|
|
|
massagedAccountName: ({ accountName, emojis, $autoplayGifs, $omitEmojiInDisplayNames }) => {
|
2018-08-20 00:23:40 +02:00
|
|
|
accountName = escapeHtml(accountName)
|
2018-08-20 03:03:26 +02:00
|
|
|
|
|
|
|
if ($omitEmojiInDisplayNames) { // display name emoji are annoying to some screenreader users
|
2018-08-20 04:31:54 +02:00
|
|
|
let emojiFreeDisplayName = removeEmoji(accountName, emojis)
|
|
|
|
if (emojiFreeDisplayName) {
|
|
|
|
return emojiFreeDisplayName
|
2018-08-20 03:03:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-20 00:23:40 +02:00
|
|
|
return emojifyText(accountName, emojis, $autoplayGifs)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|