| import { Extension } from "@tiptap/core"; |
| import Suggestion from "@tiptap/suggestion"; |
| import { slashMenuSuggestion } from "../SlashMenu"; |
|
|
| export const SlashCommands = Extension.create({ |
| name: "slashCommands", |
|
|
| addOptions() { |
| return { |
| suggestion: { |
| char: "/", |
| command: ({ |
| editor, |
| range, |
| props, |
| }: { |
| editor: any; |
| range: any; |
| props: any; |
| }) => { |
| editor.chain().focus().deleteRange(range).run(); |
| props.command(editor); |
| }, |
| ...slashMenuSuggestion(), |
| }, |
| }; |
| }, |
|
|
| addProseMirrorPlugins() { |
| return [ |
| Suggestion({ |
| editor: this.editor, |
| ...this.options.suggestion, |
| }), |
| ]; |
| }, |
| }); |
|
|