Markdown previewer issue

hello campers, I don’t know why I couldn’t pass the user stroy 4 here is the link to the challenge

in the the user story 4 when I type on the #editor the #preview should be updated, and that’s what actually happend in my code ,but it is not rendered synchronically, I don’t know how to make it synchronious ?

here is my code pen link:

please help me !

and my last question I want to know if my code is a little perfect ,because I have used refs for gettind DOM elements and manipulate css by giving them new classes by classList.toggle();