[Vuejs]-Submit on enter key (not as newline/breakline) on Vue ckeditor 5

0👍

I was looking to do something similar, but rather execute shiftEnter instead of enter, perhaps my investigations on this will help others landing here. A combination of these two sources answered the question for me:

Essentially adding a function like below (i.e. from In ckeditor5, how can I change entermode br instead of p?) in a seperate file…

export function ckEditorEnterBreaks(editor) {
    editor.editing.view.document.on('enter', (evt, data) => {
      //shift + enter creates a br tag
      editor.execute('shiftEnter');
      //cancel enter event to prevent p tag
      data.preventDefault();
      evt.stop();
    });
}

…importing it and adding to the editorConfig plugins:

editorConfig {
  plugins: [ckEditorEnterBreaks]
}

Leave a comment