contenteditable div is focusing out while editing it

I am new to angular and I have a textarea and a contenteditable div. Inside textarea HTML code will be there and div render its preview and if we modify anything in preview div the same will reflect in HTML code in textarea. Initially after one edit(erase or adding 1 character) div used to focus out and later I came up with a solution that can keep the div 1 sec focused after that again, it will focus out, and then I have tried adding focus event listener. this kept the div focused but it wasn’t reflected the HTML code whatever modifications happened in preview div. I need div not to focus out while editing it and whatever modifications happened in the div should reflect HTML in textarea. any help would be appreciated. thank you.


  content = 
<p>This is a great example...</p>
updateModel(event) {
  setTimeout(()=> {
    this.content =;
  }, 1000)


<div [innerHtml]="content" contenteditable="true" (input)="updateModel($event)" #model>

Source: New feed
Source Url contenteditable div is focusing out while editing it