I'm trying to create a website like medium.com and I have a page that I can create a new post with tools (bold,italic,insert image,add quote,add code) and I create styles for these elements like the below image created for quote text.
when I press the Enter key this block expands correctly. and I want to exit this block when pressing CTRL + ENTER. I wrote this code to handle it.
if (e.ctrlKey && (e.keyCode == 13 || e.keyCode == 10)) {
document.execCommand('insertParagraph');
e.preventDefault()
}
but when I press CTRL+KEY the last style doesn't destroy. and new line created with the last quote style. actually create new blockquote tag in the new line.
How can I fix it? thanks