Add a different pluginKey

This commit is contained in:
Austin Chen 2022-09-15 14:28:51 -07:00
parent f21d0c6ecf
commit 5d3290600b
2 changed files with 6 additions and 2 deletions

View File

@ -255,7 +255,10 @@ export function RichContent(props: {
smallImage ? DisplayImage : Image,
DisplayLink.configure({ openOnClick: false }), // stop link opening twice (browser still opens)
DisplayMention,
DisplayContractMention,
DisplayContractMention.configure({
// Needed to set a different PluginKey for Prosemirror
suggestion: contractMentionSuggestion,
}),
Iframe,
TiptapTweet,
],

View File

@ -4,8 +4,8 @@ import { searchInAny } from 'common/util/parse'
import { orderBy } from 'lodash'
import tippy from 'tippy.js'
import { getCachedContracts } from 'web/hooks/use-contracts'
// import { getCachedUsers } from 'web/hooks/use-users'
import { MentionList } from './contract-mention-list'
import { PluginKey } from 'prosemirror-state'
type Suggestion = MentionOptions['suggestion']
@ -17,6 +17,7 @@ const beginsWith = (text: string, query: string) =>
export const contractMentionSuggestion: Suggestion = {
char: '%',
allowSpaces: true,
pluginKey: new PluginKey('contract-mention'),
items: async ({ query }) =>
orderBy(
(await getCachedContracts()).filter((c) =>