Hacker News new | ask | show | jobs
by ozanyurtsever 1466 days ago
Hello Guys,

Until this year, draft.js was one of the mainly used libraries out there for building web based text editors, and there are lots of component libraries for React based on draft.js. However, the development team(which is facebook) has announced that the project is not under development anymore, since they have started a brand new project, which is Lexical. Lexical is a framework to build text editors and is under early development currently. By using Lexical, I have built a new component library that comes with a ready to use rich text editor. It is under very early development as well, as I am trying to make it more modular and flexible with each improvement. I hope this project can help some startups that needs to implement a highly functional text editor to their projects. All of the support(like stars) and contribution to the project is very much welcomed.

Thanks.

2 comments

Thanks for the writeup. For a minute there I thought you were creating a WYSIWYG editor from scratch, in which case, as someone involved in a high-profile project of this sort in the past, I would have to urge you to refrain from doing it - it's not worth it.

----

I know you're reading this, Wiktor. Say hi to the team for me.

> it's not worth it.

It depends. If the editor is a central part of what your software is doing and you need/want total control, it's well worth it. General purpose libraries are mostly made of bloat when your project just need 20% of all the things they (have to) do. Focusing on that 20% could be a good time investment and yield a better software.

The Selection API alone is such a minefield of divergent browser implementations that it's a massive PITA.

And that's just the start. Check what happens in different browsers when you hit backspace in a contenteditable containing a single space character.

Overall there are a lot of such changing, undocumented behaviours.

I know. The APIs offered by browsers for editing text are less than ideal, and require a lot of work to make something robust. That being said, my point stands. If something is not easy it doesn't necessarily mean that is not worth doing. I have my opinions about how text editing should work in my software, and it is my job to design and develop a solution that fullfills my vision. I will take working around the browser APIs every day instead of fighting a library developed to fullfill a different vision, that adds layers of indirection on top of the same problematic browser APIs.
There's a name for what you're displaying here and it's "Not Invented Here Syndrome".

I strongly advise against this.

Now I am confused. Did you express the same strong advice against doing this to Dominic when they started working on lexical? In the end draft.js already existed. Why reinvent it? How much should we go back in time to find the point when things started to be so perfect to make everything coming after a worthless reinvention? What I think instead is that some developers have a phobia of writing code, and prefer to glue together various pieces to "get the job done". Others enjoy the process of creating something unique and potentially better, for some connotation of "better" that is not to be disputed. I think that there is nothing bad in doing so.
Don't listen to naysayers. If you think you need it, and you want to do it - do it; Always. Failures will make you learn, success is how we progress. Road not taken approach is individual.
How has been your experience working with Lexical so far?
Hello, as it is in very early phase, most of the time you cannot find a sufficient amount of information or no information from the docs about a provided API. However, I have used lexical playground to bootstrap this project, so it was easier to convert it to a separate react component package.