I'm not interested in already made text editor(have tried to understand how they were doing but got lost)
I would like to know the solution algorithm for this problem and subproblems.
I have a textarea on the page.itEditor. All these elements, I assign a new property initEditor which initialisere editor. In my panel there is a button that inserts a Code block
<code lang="html">//add code here
Much further to walk?