pinafore/routes/_components/profile/AccountDisplayName.html
Nolan Lawson 350667e5df
allow user display names to contain custom emoji (#448)
* allow user display names to contain custom emoji

fixes #445

* fix tests

* fix focus issue
2018-08-19 15:23:40 -07:00

23 lines
761 B
HTML

<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>
import { emojifyText } from '../../_utils/emojifyText'
import { store } from '../../_store/store'
import escapeHtml from 'escape-html'
export default {
store: () => store,
computed: {
emojis: ({ account }) => (account.emojis || []),
accountName: ({ account }) => (account.display_name || account.username),
massagedAccountName: ({ accountName, emojis, $autoplayGifs }) => {
accountName = escapeHtml(accountName)
return emojifyText(accountName, emojis, $autoplayGifs)
}
}
}
</script>