Add NoNewLine tiptap extension
This commit is contained in:
parent
e7464e3b8a
commit
31d0cd20c9
1 changed files with 26 additions and 0 deletions
26
extensions/NoNewLine/index.tsx
Normal file
26
extensions/NoNewLine/index.tsx
Normal 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
|
||||
Loading…
Reference in a new issue