diff --git a/packages/flux-editor/src/flux-editor.ts b/packages/flux-editor/src/flux-editor.ts index 51d530566..20bf779b0 100644 --- a/packages/flux-editor/src/flux-editor.ts +++ b/packages/flux-editor/src/flux-editor.ts @@ -300,10 +300,16 @@ export default class MyElement extends LitElement { } async getMentionSuggestions(query: string) { - const matches = this.members + // Protocol-level group mentions + const groupMentions: Suggestion[] = [ + { id: 'ad4m://everyone', label: 'everyone' }, + ].filter((m) => m.label.toLowerCase().startsWith(query.toLowerCase())); + + const memberMatches = this.members .filter((m) => this.getSafeString(m.username).toLowerCase().startsWith(query.toLowerCase())) - .map((m) => ({ id: m.did, label: m.username || 'anonymous' })) - .slice(0, 10) as Suggestion[]; + .map((m) => ({ id: m.did, label: m.username || 'anonymous' })); + + const matches = [...groupMentions, ...memberMatches].slice(0, 10) as Suggestion[]; this.suggestions = matches; return matches; diff --git a/packages/flux-editor/src/mention.ts b/packages/flux-editor/src/mention.ts index 0d9b06af8..7c69059ae 100644 --- a/packages/flux-editor/src/mention.ts +++ b/packages/flux-editor/src/mention.ts @@ -18,7 +18,7 @@ export default Node.create({ return { HTMLAttributes: {}, renderLabel({ node }) { - const isMention = node.attrs.id.startsWith('did:'); + const isMention = node.attrs.id.startsWith('did:') || node.attrs.id.startsWith('ad4m://'); return `${isMention ? '@' : '#'}${node.attrs.label ?? node.attrs.id}`; }, suggestion: {