The library medium editor default behavior is to add a p tag when the user hits enter. This can cause layout and styling issues within the editable tag. Instead I would like to insert a br tag when the user hits enter.
I found this code that works as expected
editor.subscribe("editableKeydownEnter", (event, element) => {
// debugger
// if (event.shiftKey) {
// debugger
event.preventDefault()
event.stopPropagation()
MediumEditor.selection.getSelectionStart(editor.options.ownerDocument)
MediumEditor.util.insertHTMLCommand(editor.options.ownerDocument, "<br>")
// }
})
It inserts the br tag after the string of character within the editable div. However the cursor of the user stays behind the br tag so in the end the cursor doesent really goes to the line.
Is there a solution to this ?