Describe the bug
Right now when I tap Enter there is new line appear, is it possible to call some other action and prevent new line?
Steps to Reproduce / Codesandbox Example
Steps to reproduce the behavior:
Open https://tiptap.scrumpy.io/history
Click Enter
Expected behavior
I want to call another action by clicking on Enter
I'm not sure why you labeled this as a bug, but you can create a custom Extension for it.
import { Extension, Plugin } from 'tiptap'
export default class EnterHandler extends Extension {
get name() {
return 'enter_handler'
}
get plugins() {
return [
new Plugin({
props: {
handleKeyDown: (view, event) => {
if (event.key === 'Enter' && !event.shiftKey) {
// do something
return true
}
return false
},
},
}),
]
}
}
Yes, it works! Thanks a lot, specially for quick response.
Most helpful comment
I'm not sure why you labeled this as a bug, but you can create a custom Extension for it.