2023-08-02 17:34:55 +00:00
|
|
|
import { EditorProps } from "@tiptap/pm/view";
|
|
|
|
|
|
|
|
export const TiptapEditorProps: EditorProps = {
|
|
|
|
attributes: {
|
|
|
|
class: `prose prose-brand max-w-full prose-headings:font-display font-default focus:outline-none`,
|
2023-08-02 18:45:02 +00:00
|
|
|
},
|
|
|
|
handleDOMEvents: {
|
|
|
|
keydown: (_view, event) => {
|
|
|
|
// prevent default event listeners from firing when slash command is active
|
|
|
|
if (["ArrowUp", "ArrowDown", "Enter"].includes(event.key)) {
|
|
|
|
const slashCommand = document.querySelector("#slash-command");
|
|
|
|
if (slashCommand) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2023-08-02 17:34:55 +00:00
|
|
|
};
|