tfrere's picture
tfrere HF Staff
chore: initial commit
561e6f0
Raw
History Blame Contribute Delete
761 Bytes
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,
}),
];
},
});