(editor: CustomEditor, data: MentionData, target?: Range | null)
| 26 | }; |
| 27 | |
| 28 | export 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 |
| 44 | export function word( |