Many years ago I wrote a "bespoke" blogging CMS just for a friend of mine. (The big innovation I'd wanted to try is JavaScript that would preview your post while you were typing it in...)
What I learned is it's fairly simple to make a text editor - but there's also the occasional fiddly little bug that has to be sorted out. (It could've also had security holes -- it was protected by obscurity...)
I was frustrated with downtime at my blogging site at the time -- but in the end I just switched to "live-editing" my blog posts directly on the server using Pico.