MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / insertMention

Function insertMention

packages/web/src/features/chat/utils.ts:28–41  ·  view source on GitHub ↗
(editor: CustomEditor, data: MentionData, target?: Range | null)

Source from the content-addressed store, hash-verified

26};
27
28export const insertMention = (editor: CustomEditor, data: MentionData, target?: Range | null) => {
29 const mention: MentionElement = {
30 type: 'mention',
31 data,
32 children: [{ text: '' }],
33 }
34
35 if (target) {
36 Transforms.select(editor, target)
37 }
38
39 Transforms.insertNodes(editor, mention)
40 Transforms.move(editor)
41}
42
43// @see: https://github.com/ianstormtaylor/slate/issues/4162#issuecomment-1127062098
44export function word(

Callers 1

ChatBoxComponentFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected