Add NoNewLine tiptap extension

This commit is contained in:
Justin Edmund 2023-07-09 22:47:01 -07:00
parent e7464e3b8a
commit 31d0cd20c9

View file

@ -0,0 +1,26 @@
import { Extension } from '@tiptap/core'
import { Plugin, PluginKey } from 'prosemirror-state'
const NoNewLine = Extension.create({
name: 'no_new_line',
addProseMirrorPlugins() {
return [
new Plugin({
key: new PluginKey('eventHandler'),
props: {
handleKeyDown: (view, event) => {
if (event.key === 'Enter' && !event.shiftKey) {
console.log('enter pressed')
return true
}
},
// … and many, many more.
// Here is the full list: https://prosemirror.net/docs/ref/#view.EditorProps
},
}),
]
},
})
export default NoNewLine