1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-19 23:40:07 +00:00

fix: publish widget mentions (#1198)

This commit is contained in:
patak 2023-01-16 06:10:33 +01:00 committed by GitHub
parent d24c1da35e
commit bb2e3ab44f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,5 @@
<template>
<p flex="~ gap-1" items-center text-sm class="zen-none">
<p flex="~ gap-1 wrap" items-center text-sm class="zen-none">
<span i-ri-arrow-right-line ml--1 text-secondary-light /><slot />
</p>
</template>

View file

@ -133,9 +133,9 @@ defineExpose({
:class="[isSending ? 'pointer-events-none' : '', isOverDropZone ? '!border-primary' : '']"
>
<ContentMentionGroup v-if="draft.mentions?.length && shouldExpanded">
<div v-for="m of draft.mentions" :key="m" text-primary>
@{{ m }}
</div>
<button v-for="m, i of draft.mentions" :key="m" text-primary hover:color-red @click="draft.mentions?.splice(i, 1)">
{{ acctToShortHandle(m) }}
</button>
</ContentMentionGroup>
<div v-if="draft.params.sensitive">

View file

@ -7,10 +7,14 @@ export function getDisplayName(account: mastodon.v1.Account, options?: { rich?:
return displayName.replace(/:([\w-]+?):/g, '')
}
export function acctToShortHandle(acct: string) {
return `@${acct.includes('@') ? acct.split('@')[0] : acct}`
}
export function getShortHandle({ acct }: mastodon.v1.Account) {
if (!acct)
return ''
return `@${acct.includes('@') ? acct.split('@')[0] : acct}`
return acctToShortHandle(acct)
}
export function getServerName(account: mastodon.v1.Account) {