Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
Exit from a custom element style in ContentEditable after press CTRL+ENTER key in React

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.

enter image description here

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.

enter image description here

How can I fix it? thanks

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda