Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!