Live data from Hacker News

Lexical – a web text editor framework that powers Facebook

playground.lexical.dev

31–40 of 107 posts

Re: Lexical – a web text editor framework that powers Facebook

#31
post #6
post #5

How do you handle Android and multi-lingual input? Writing the state machine to deal with Chrome/Android’s bananas selection bugs in Notion’s editor gave me a lot of headaches. Do you add extra DOM nodes on Android? Any key insights that help deal with IME on Android?

Android is indeed a headache to support. The biggest issue is how all keyboards force composition on all keystrokes, meaning you're constantly having to read the DOM input and work out what might have been entered. We don't use extra DOM nodes, but we do listen to `beforeinput`, `input` and use DOM MutationObserver to try and detect common Android patterns. I'd search this module for references to Android: https://gi…

It's currently a bit broken on Android.

I select some text and then try to change the font size. The selection is lost when tapping on the font size menu.

ProseMirror does keep the selection intact.

Re: Lexical – a web text editor framework that powers Facebook

#32
post #25

We're trying to choose between Lexical and Slate at work. Do you have any code examples that would be similar to this? Example: https://www.slatejs.org/examples/richtext Code: https://github.com/ianstormtaylor/slate/blob/main/site/examp...

If you are planning to build a Notion competitor, I recommend Slate . Seriously though, if you need to support Android or CJK, you should understand Slate’s limitations before you buy into it. I think ProseMirror is the best choice today because it has been around for a long time and has battle-tested MutationObserver logic. Lexical is worth considering depending on your risk appetite. It also uses MutationObserver a…

Thanks for the advice!

Re: Lexical – a web text editor framework that powers Facebook

#33
post #23

We're trying to choose between Lexical and Slate at work. Do you have any code examples that would be similar to this? Example: https://www.slatejs.org/examples/richtext Code: https://github.com/ianstormtaylor/slate/blob/main/site/examp...

The Lexical playground is one giant kitchen-sink example all written in React. You could check out the code for it locally and `npm run start` and play around with removing/adding plugins. You can also check out some examples on Codesandbox: https://codesandbox.io/s/lexical-rich-text-example-5tncvy

Thanks! Very helpful.

Re: Lexical – a web text editor framework that powers Facebook

#34
post #31
post #6

Earlier quoted context omitted.

Android is indeed a headache to support. The biggest issue is how all keyboards force composition on all keystrokes, meaning you're constantly having to read the DOM input and work out what might have been entered. We don't use extra DOM nodes, but we do listen to `beforeinput`, `input` and use DOM MutationObserver to try and detect common Android patterns. I'd search this module for references to Android: https://gi…

It's currently a bit broken on Android. I select some text and then try to change the font size. The selection is lost when tapping on the font size menu. ProseMirror does keep the selection intact.

ANDROID!!!!!

Re: Lexical – a web text editor framework that powers Facebook

#35
post #25

We're trying to choose between Lexical and Slate at work. Do you have any code examples that would be similar to this? Example: https://www.slatejs.org/examples/richtext Code: https://github.com/ianstormtaylor/slate/blob/main/site/examp...

If you are planning to build a Notion competitor, I recommend Slate . Seriously though, if you need to support Android or CJK, you should understand Slate’s limitations before you buy into it. I think ProseMirror is the best choice today because it has been around for a long time and has battle-tested MutationObserver logic. Lexical is worth considering depending on your risk appetite. It also uses MutationObserver a…

Why the sarcasm?

Re: Lexical – a web text editor framework that powers Facebook

#36
post #25

Earlier quoted context omitted.

If you are planning to build a Notion competitor, I recommend Slate . Seriously though, if you need to support Android or CJK, you should understand Slate’s limitations before you buy into it. I think ProseMirror is the best choice today because it has been around for a long time and has battle-tested MutationObserver logic. Lexical is worth considering depending on your risk appetite. It also uses MutationObserver a…

Why the sarcasm?

I work at Notion and recently rebuilt much of the editor core, and I don’t think Slate is a good choice because it considers nice, simple code more important than CJK or Android support. Notion doesn’t use Slate or any other editor framework. I just study a lot of editor core code.

Re: Lexical – a web text editor framework that powers Facebook

#37
post #2

I'm the author of Lexical and one of the many engineers working on Lexical full-time at Meta. If you'd like to know anything, or ask any questions, please do! For those of you looking for the sourcecode for the playground, you can find it here: https://github.com/facebook/lexical/tree/main/packages/lexic... We also have a Discord channel you can check out: https://discord.gg/KmG4wQnnD9

Hi, I did (or somewhat invented/devised) a similar concept, but for visually programming UI design. See: https://jjuliano.github.io/markdown-ui/docs/container.html

Re: Lexical – a web text editor framework that powers Facebook

#38
post #31
post #6

Earlier quoted context omitted.

Android is indeed a headache to support. The biggest issue is how all keyboards force composition on all keystrokes, meaning you're constantly having to read the DOM input and work out what might have been entered. We don't use extra DOM nodes, but we do listen to `beforeinput`, `input` and use DOM MutationObserver to try and detect common Android patterns. I'd search this module for references to Android: https://gi…

It's currently a bit broken on Android. I select some text and then try to change the font size. The selection is lost when tapping on the font size menu. ProseMirror does keep the selection intact.

It's probably because we're using a native select element, which likes to steal selection on Android.

Re: Lexical – a web text editor framework that powers Facebook

#39
It is interesting (and cool) that this uses Typescript over Flow. It seems like Flow is still being developed too.

Just looking at the top level package.json [1], I wonder at which point you abstract all those copy/pasted targets into a script that takes an argument.

[1] https://github.com/facebook/lexical/blob/main/package.json#L...

Re: Lexical – a web text editor framework that powers Facebook

#40
post #21
post #15

In what sense does this "power" Facebook? Do you mean it's used for most or some specific text editing components of Facebook?

It's replacing any previous web text editor UX components that we had in the past (likely DraftJS). We're also building Lexical for iOS which is slowly rolling out across iOS devices too.

Well, I want the previous editor back. In fact, just give me a text area. The current editor breaks the selection and, in turn, the clipboard manager, it doesn't work well with Compose and dead keys, and it sometimes ties itself into a knot, and the text can't be edited anymore.
Post reply on HN