diff --git a/composables/tiptap.ts b/composables/tiptap.ts
index 964a1e7e..a3e294ef 100644
--- a/composables/tiptap.ts
+++ b/composables/tiptap.ts
@@ -44,9 +44,11 @@ export function useTiptap(options: UseTiptapOptions) {
Mention.configure({
suggestion: MentionSuggestion,
}),
- Mention.configure({
- suggestion: HashSuggestion,
- }),
+ Mention
+ .extend({ name: 'hastag' })
+ .configure({
+ suggestion: HashSuggestion,
+ }),
Placeholder.configure({
placeholder,
}),
diff --git a/composables/tiptap/suggestion.ts b/composables/tiptap/suggestion.ts
index 48d9f675..f88d2422 100644
--- a/composables/tiptap/suggestion.ts
+++ b/composables/tiptap/suggestion.ts
@@ -8,11 +8,14 @@ import TiptapMentionList from '~/components/tiptap/TiptapMentionList.vue'
export const MentionSuggestion: Partial = {
pluginKey: new PluginKey('mention'),
char: '@',
- items({ query }) {
- // TODO: query
- return [
- 'TODO MENTION QUERY', 'Lea Thompson', 'Cyndi Lauper', 'Tom Cruise', 'Madonna', 'Jerry Hall', 'Joan Collins', 'Winona Ryder', 'Christina Applegate', 'Alyssa Milano', 'Molly Ringwald', 'Ally Sheedy', 'Debbie Harry', 'Olivia Newton-John', 'Elton John', 'Michael J. Fox', 'Axl Rose', 'Emilio Estevez', 'Ralph Macchio', 'Rob Lowe', 'Jennifer Grey', 'Mickey Rourke', 'John Cusack', 'Matthew Broderick', 'Justine Bateman', 'Lisa Bonet',
- ].filter(item => item.toLowerCase().startsWith(query.toLowerCase())).slice(0, 5)
+ async items({ query }) {
+ if (query.length === 0)
+ return []
+
+ const mentionPaginator = masto.search({ q: query, type: 'accounts', limit: 25, resolve: true })
+ const results = await mentionPaginator.next()
+
+ return results.value.accounts
},
render: createSuggestionRenderer(),
}
diff --git a/styles/tiptap.css b/styles/tiptap.css
index adafdc30..dcc6d3b5 100644
--- a/styles/tiptap.css
+++ b/styles/tiptap.css
@@ -5,3 +5,7 @@
height: 0;
opacity: 0.4;
}
+
+span[data-type="mention"] {
+ --at-apply: text-primary
+}