Live data from Hacker News

Facebook open sources Lexical, an extensible text editor library

lexical.dev

41–50 of 141 posts

Re: Facebook open sources Lexical, an extensible text editor library

#41
post #28

One of the big frustrations with DraftJS is that Facebook moved on (which is understandable), but the core repo wasn’t given control to the community, so patches and updates couldn’t be pulled in. Obviously it’s open source and could be hard forked, but that’s not ideal. I’d be curious if there are plans internally to make sure Lexical continues to be supported by Facebook and doesn’t end up with the same fate.

I completely understand. I can't guarantee anything, no on can in software. However, we do have a dedicated full-time team working on Lexical. DraftJS never had that, it only had a few part-time maintainers at Facebook.

Hey Dominic, good to see you :)

I take you moved from the React team to this dedicated Lexical team?

Re: Facebook open sources Lexical, an extensible text editor library

#42
This feels half baked and confusing.

More than half docs page are blank:

- https://lexical.dev/docs/concepts/commands

- https://lexical.dev/docs/getting-started/quick-start

- https://lexical.dev/docs/concepts/extending-nodes

- https://lexical.dev/docs/concepts/editor-state

- https://lexical.dev/docs/api/lexical

- https://lexical.dev/docs/api/lexical-selection

- https://lexical.dev/docs/api/lexical-text

- https://lexical.dev/docs/api/lexical-offset

> An extensible text editor library

> Lexical is an extensible JavaScript web text-editor framework

The terminology is also confusing. In some places its called a library. In other places it's called a framework. Then other commenters mentioned that the demo gives the impression that it is a full package editor, but is just pegging onto CodeMirror. That's clarified here?

> It doesn't directly concern itself with UI components

> core of Lexical is ... a DOM reconciler that takes a set of editor states, diffs the changes, and updates the DOM according to their state.

> Lexical is designed for everyone. It follows best practices established in WCAG

These are weird and conflated set of buzzwords. Why should something that isn't concerned with UI components be concerned with accessibility best practices?

I'm building my own text editor and I thought VSCode was impressive enough. See this well written article about their text buffer reimplementation: https://code.visualstudio.com/blogs/2018/03/23/text-buffer-r.... Then I realized Ace.js has some even crazy magic implementation that can handle millions of LoC files without lag. Can Lexical handle 100k+ LoC? Normally I'd benchmark myself, but in this case I don't see other compelling reasons too. The author mentioned the 22kB bundle size is less than Draft.js by Facebook, but Slate.js is 10kB and much more mature.

Some features that could make Lexical have "powerful features" as claimed: UNDO/REDO manager (without storing the entire state on the stack, which is just not scalable on memory), possibly implementing the Command pattern, then make easy consumption of collaborative editing such as with Operational Transform.

Re: Facebook open sources Lexical, an extensible text editor library

#45
post #29
post #24

Do you have any support for collaborative editing such as with Yjs or Automerge?

Yep, we have full support with Yjs. https://github.com/facebook/lexical/tree/main/packages/lexic...

Very exciting! Great to see support for yjs. Does fb use yjs internally? Would love to learn more about this!

Re: Facebook open sources Lexical, an extensible text editor library

#46

Is this meant to be a good drop-in rich-text/WYSIWYG editor? What is the format that it creates that you could then persist in a database? Does it just save its state in HTML or some JSON format or what?

The core Lexical library is really a framework for building such editors. However, we also provide many common rich-text features out-of-the-box via separate packages, such as @lexical/rich-text. We also expose bindings for React (and hope to have them for other frameworks soon). Check out the lexical-playground package on GitHub for an example of how you can create a rich-text editor by adding plugins to the LexicalComposer component in @lexical/react.

Re: Facebook open sources Lexical, an extensible text editor library

#47
Hi Dominic, thanks for open sourcing the library. I have quite a few questions though:

1. Marijn has built an awesome open source richtext library (https://prosemirror.net/) which has a huge plugin ecosystem and bindings with a bunch of front-end frameworks (including React). Is there any specific motivation behind building one from scratch?

2. How is this different from Facebook's own DraftJS lib?

3. What's the story of realtime collaboration support with OT/CRDT? Prosemirror had this in mind when designing its state model and delta model, so it comes with out of the box support for realtime collaborations. Can we expect the same with Lexical?

4. What's the cross platform strategy for Lexical? If I store the editor's state as JSON on the server, how will I render it on devices and native desktop apps?

We've built our own library on top of Prosemirror to power the comments and feedback sections of Zoho Writer - https://writer.zoho.com

I'm always looking out for better approaches/alternatives in this space and I'm curious how different Lexical is. Thanks!

Re: Facebook open sources Lexical, an extensible text editor library

#48

This feels half baked and confusing. More than half docs page are blank: - https://lexical.dev/docs/concepts/commands - https://lexical.dev/docs/getting-started/quick-start - https://lexical.dev/docs/concepts/extending-nodes - https://lexical.dev/docs/concepts/editor-state - https://lexical.dev/docs/api/lexical - https://lexical.dev/docs/api/lexical-selection - https://lexical.dev/docs/api/lexical-text - https://lexi…

Thank for the feedback - we're definitely still working on the docs.

> These are weird and conflated set of buzzwords. Why should something that isn't concerned with UI components be concerned with accessibility best practices?

Are they? Support for speech-to-text technologies and IME/composition input, for example, are independent of UI components.

> but Slate.js is 10kB and much more mature.

Is it?

https://bundlephobia.com/package/slate@0.77.0

Re: Facebook open sources Lexical, an extensible text editor library

#50

This feels half baked and confusing. More than half docs page are blank: - https://lexical.dev/docs/concepts/commands - https://lexical.dev/docs/getting-started/quick-start - https://lexical.dev/docs/concepts/extending-nodes - https://lexical.dev/docs/concepts/editor-state - https://lexical.dev/docs/api/lexical - https://lexical.dev/docs/api/lexical-selection - https://lexical.dev/docs/api/lexical-text - https://lexi…

> I'm building my own text editor and I thought VSCode was impressive enough. See this well written article about their text buffer reimplementation: https://code.visualstudio.com/blogs/2018/03/23/text-buffer-r.... Then I realized Ace.js has some even crazy magic implementation that can handle millions of LoC files without lag. Can Lexical handle 100k+ LoC?

Also, to clear up any confusion, Lexical isn't a code editor - it could be used to build one, for sure, but some sort of virtualization would probably be required in order to support millions of lines of code.

Post reply on HN