Update mentionSuggestions with new type
This commit is contained in:
parent
b79f25bb0f
commit
01d121ef0f
1 changed files with 7 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ import {
|
||||||
} from '~components/MentionList'
|
} from '~components/MentionList'
|
||||||
import api from '~utils/api'
|
import api from '~utils/api'
|
||||||
import { numberToElement } from '~utils/elements'
|
import { numberToElement } from '~utils/elements'
|
||||||
import { get } from 'http'
|
import { SuggestionOptions } from '~extensions/CustomSuggestion'
|
||||||
|
|
||||||
interface RawSearchResponse {
|
interface RawSearchResponse {
|
||||||
searchable_type: string
|
searchable_type: string
|
||||||
|
|
@ -44,8 +44,8 @@ function transform(object: RawSearchResponse) {
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
//
|
||||||
export const mentionSuggestionOptions: MentionOptions['suggestion'] = {
|
export const mentionSuggestionOptions: Omit<SuggestionOptions, 'editor'> = {
|
||||||
items: async ({ query }): Promise<MentionSuggestion[]> => {
|
items: async ({ query }): Promise<MentionSuggestion[]> => {
|
||||||
const locale = getCookie('NEXT_LOCALE')
|
const locale = getCookie('NEXT_LOCALE')
|
||||||
? (getCookie('NEXT_LOCALE') as string)
|
? (getCookie('NEXT_LOCALE') as string)
|
||||||
|
|
@ -105,6 +105,10 @@ export const mentionSuggestionOptions: MentionOptions['suggestion'] = {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (props.event.key === 'Tab') {
|
||||||
|
popup?.hide()
|
||||||
|
}
|
||||||
|
|
||||||
if (!component?.ref) {
|
if (!component?.ref) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue