Live data from Hacker News

Facebook open sources Lexical, an extensible text editor library

lexical.dev

111–120 of 141 posts

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

#111

From a company that intentionally broke text editing on mobile to force people to install the Messenger app, I wouldn't use it even if it was great.

> a company that intentionally broke text editing Of course inclined to believe you, but do you have a source to back this up?

https://github.com/facebook/draft-js/issues/1077

_Perhaps_ it wasn't intentional, but it started happening around the time FB started forcing people to use Messenger and now you can't even access messages via the mobile website so who knows.

I haven't used FB for several years now so I'm a bit out of touch.

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

#112

Earlier quoted context omitted.

I don't think ProseMirror has taken a bad approach. I think we've just taken a different approach when it comes to the design of things. In Lexical, you rarely concern yourself with the DOM – and typically you deal with Lexical's node API directly and that's really all you touch. Lexical also treat its own EditorState as the source of truth. We use DOM MutationObservers to ensure the DOM matches the EditorState at al…

quick question: I assume it ships(or supports a plugin) with a serializer to convert an editor state JSON to HTML. Does it depend on browser APIs to do so? Can it be somehow liberated out of native DOM APIs and language bindings for JSON-2-HTML in common languages like Java & Rust. This could be a huge win for simple multi-platform rendering.

The EditorState is fully JSON serializable. You can use JSON.stringify in the browser, or an alternative on other platforms. You can then pass the stringified values around and parse them using `editor.parseEditorState()`

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

#113
post #36

Earlier quoted context omitted.

My mistake... I thought the code editor was implemented using Lexical. The real demo is here: https://lexical-playground.vercel.app/ (Edit) I think you should put this demo on the front page and the code sample on some other page. I was expecting to see the demo on the home page.

> I think you should put this demo on the front page and the code sample on some other page. I was expecting to see the demo on the home page. yeah lol, i think everyone in this thread had the same experience

We'll look into fixing this problem. Sorry for the confusion!

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

#114

Earlier quoted context omitted.

> 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 edito…

> but some sort of virtualization would probably be required in order to support millions of lines of code. From my understanding, Lexical is a layer for the text document model and a pattern for transforming that text model. Updates to the model is where bottleneck comes about at VSCode / Ace scale.

Lexical's model might become a bottleneck at some point, but we haven't done any extensive testing on huge models (I mean really huge, we know large models are fine). There are so many things folks want to do with text editors – from small plain text editors to WYSIWYG, to full blown code editors. We're hoping the community can help us fill in the blanks on some of these areas, as we're only a small team.

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

#115

Earlier quoted context omitted.

quick question: I assume it ships(or supports a plugin) with a serializer to convert an editor state JSON to HTML. Does it depend on browser APIs to do so? Can it be somehow liberated out of native DOM APIs and language bindings for JSON-2-HTML in common languages like Java & Rust. This could be a huge win for simple multi-platform rendering.

The EditorState is fully JSON serializable. You can use JSON.stringify in the browser, or an alternative on other platforms. You can then pass the stringified values around and parse them using `editor.parseEditorState()`

But, let's say I'd like to parse this stored state and send an email (as HTML) on the server?

My best guess is to use a NodeJS/V8 instance on the server to somehow transform JSON to HTML using Lexical's serializer (if something like that exists). Even this is tricky because it might depend on browser DOM apis for the conversion.

A better solution would be support language specific bindings to get HTML from JSON with zero dependecies.

Any chance you thought along these lines?

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

#117

Earlier quoted context omitted.

> So Lexical doesn't care about how the DOM is rendered? Or is speech-to-text derived independent of the DOM? I do now see your general point about the conflation there - the reality is Lexical also provides separate packages that implement a lot of common rich-text functionality. Within these, we do try to adhere to accessibility best practices. At the same time, the core library's accessibility claims are more base…

> I'm not sure what you mean by "batteries included"? A rendering layer. With Lexical, you'd have to add in the React layer, which wasn't already included in the bundle size comparison.

Don't you need `slate-react`, `slate-history` and other plugins too?

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

#118

Earlier quoted context omitted.

The EditorState is fully JSON serializable. You can use JSON.stringify in the browser, or an alternative on other platforms. You can then pass the stringified values around and parse them using `editor.parseEditorState()`

But, let's say I'd like to parse this stored state and send an email (as HTML) on the server? My best guess is to use a NodeJS/V8 instance on the server to somehow transform JSON to HTML using Lexical's serializer (if something like that exists). Even this is tricky because it might depend on browser DOM apis for the conversion. A better solution would be support language specific bindings to get HTML from JSON with…

Yeah, I'd roll with Node/Deno and use Lexical that way. :)

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

#119

Earlier quoted context omitted.

> I can't guarantee anything, no on can in software. What does this mean?

(1) People aren't often good at communicating their intent with language. It requires using public meanings (words) assembled in some order to reflect a private meaning which is non-linguistic. (2) I think something like "At the moment it's funded, but I can't legally bind my org to that commitment. And in general, as software comes-and-goes, it's future utility and support is always hard to pin-down". I mention (1)…

I agree that people are sometimes accidentally unclear; that's why I asked a clarifying question.
Post reply on HN