Cancel line break

Hello. I would like to create a static method for ProsseMirror that would override enter. A similar problem is solved in textarea, when you need to cancel the line break before sending. But I have no ideas, in which direction should I dig?

You can use a keymap to customize the behavior of a key (make sure you include it before other plugins that define keymaps, if you want it to have a higher precedence).