diff --git a/components/tiptap/TiptapMentionList.vue b/components/tiptap/TiptapMentionList.vue index d60ef70a..6a3adb5e 100644 --- a/components/tiptap/TiptapMentionList.vue +++ b/components/tiptap/TiptapMentionList.vue @@ -4,6 +4,7 @@ import type { Account } from 'masto' const { items, command } = defineProps<{ items: Account[] command: Function + isPending?: boolean }>() let selectedIndex = $ref(0) @@ -41,7 +42,13 @@ defineExpose({ diff --git a/composables/masto.ts b/composables/masto.ts index 9872ddfa..54e1de02 100644 --- a/composables/masto.ts +++ b/composables/masto.ts @@ -48,6 +48,8 @@ export function getDisplayName(account?: Account, options?: { rich?: boolean }) } export function getShortHandle({ acct }: Account) { + if (!acct) + return '' return `@${acct.includes('@') ? acct.split('@')[0] : acct}` } diff --git a/composables/tiptap/suggestion.ts b/composables/tiptap/suggestion.ts index a0084ea1..c5694aa9 100644 --- a/composables/tiptap/suggestion.ts +++ b/composables/tiptap/suggestion.ts @@ -58,8 +58,12 @@ function createSuggestionRenderer(): SuggestionOptions['render'] { }) }, + onBeforeUpdate(props) { + component.updateProps({ ...props, isPending: true }) + }, + onUpdate(props) { - component.updateProps(props) + component.updateProps({ ...props, isPending: false }) if (!props.clientRect) return