Prevent line break on Enter Key

What is the proper way to prevent the “Enter” key from creating a new line (I want to use it to trigger a “submit” button)?

Bind a command to it—keymap.of([{key: "Enter", run: view => { doStuff(); return true }}]) and make sure that keymap has a higher precedence than whatever other bindings for Enter you are including.

Perfect, thank you!