Does Enter always need to return a new line?

Is it possible to set up the editor to create a break instead of a new line? Basically we don’t want any new lines, but we do want editors to be able to designate where they would like breaks.

Thank you, Trey

Enter works through the command bound to it in your keymap. If you’re using the base keymap, it’ll split the current textblock (in most circumstances), but you’re free to bind it to something else.

thank you! that’s what i had thought.

I tried this to get started, but nothing happens:

function bind (key, cmd) {
    if (mapKeys) {
      let mapped = mapKeys[key]
      if (mapped === false) return
      if (mapped) key = mapped
    }
    keys[key] = cmd
  }

bind('Enter', () => {
    window.alert('foo')
})

I assume I am doing something incorrectly – but what? :slight_smile:

Try the docs for the keymap plugin.

It works for Shift-Enter but not for Enter.

I think I tracked it down – I have this later in the code and so it was writing over the Enter property! Yikes! Sorry about that!

  if ((type = schema.nodes.listItem)) {
    bind('Enter', splitListItem(type))
  }