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…
Lexical – a web text editor framework that powers Facebook
81–90 of 107 posts
Re: Lexical – a web text editor framework that powers Facebook
#82Earlier quoted context omitted.
> How on earth does that mean "companies have to spend all their cycles catching up and reimplementing and fixing bugs"? The fact that there's draft.js, and a myriad of other existing editor libraries out there already, all of which could've been contributed to instead. If a startup chose to base their technology on a library that is released by a major corporation, they face the risk of getting "rug pulled" (or the…
This is no different than choosing a volunteer-based OSS solution or rolling your own. If you need things that are specific to your use case, you'll always need to shoulder the cost. That is no different from something you do yourself, either. What you call "rug pull" is merely the point where the solution you got for free suddenly costs as much to maintain as your inhouse solution.
the big difference with a true volunteer based OSS solution, like for example, linux, is that there's many individuals involved. The decision making in that project then won't turn into what spolsky said. I wouldn't imagine the linux maintainers "rug pull", but i can imagine facebook doing a rug pull.
Re: Lexical – a web text editor framework that powers Facebook
#83In 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.
Re: Lexical – a web text editor framework that powers Facebook
#84Re: Lexical – a web text editor framework that powers Facebook
#85Earlier quoted context omitted.
Interesting you say DX is a large aspect of what you are going for. ProseMirror is awesome but the API can be somewhat complex for simple things (but at the same time incredibly powerful when you get to understand it). I absolutely love TipTap[0] which is providing a much more user friendly API on top of ProseMirror, along with a clean Plugin system. Going to have to have a play with Lexical, excited to see Yjs suppo…
ProseMirror has some of the worst developer experience possible. I wasted so much time figuring out it’s convoluted API and abandoned it soon after. It does apparently have the best live editing / collaboration features of all text editors out there.
Re: Lexical – a web text editor framework that powers Facebook
#86It 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...
When they first launched a few months ago it was all Flow, and then it was quickly converted to Typescript. I think they still ship the Flow types too.
Re: Lexical – a web text editor framework that powers Facebook
#87Does Lexical require react?
There is an official (and mature) binding with React, but there are also unofficial bindings with Solid, Vue and Svelte.
Each has a dedicated channel in the Discord (including repo links).
Re: Lexical – a web text editor framework that powers Facebook
#88• Inserting emoji with my Compose key: some (e.g. U+1F641) get turned into image-backed emoji and then duplicated unless preceded by another image-backed emoji; some (e.g. U+1F928) get ignored and left as normal text.
• If I type an emoji that gets duplicated while inside a link (but not inside bold/italic), one goes where the caret is, and the other goes immediately before the link, and it leaves the caret there.
• The image-backed emoji are incompatible with inline text formatting: if you type them in the middle of formatted text, instead of ending up with the likes of text EMOJI text, you end up with text EMOJI text, and although you can subsequently apply the formatting so that it shows in the debug tree, it doesn’t change the HTML markup (e.g. subscript/superscript/underline/code should certainly be visible, and even italic and bold can change emoji rendering).
• If I select part of a link starting outside the end of a link (that is, go one character past the link and then press the Left arrow key—Firefox has valid caret positions for both inside and outside the start and end of an element, depending on which direction you came from, which my faint recollection was a major trouble point on WebKit many years ago, that you couldn’t do that and so literally couldn’t model various reasonable, kinda like multiple selection which is also Firefox-only and extremely useful on tables) and delete that, instead of just deleting the selected characters, it deletes the entire link. (As above, this seems to be specific to links, not affecting bold/italic.)
• Very early on (before I had done any editing at all) when I tried the time travel feature, I somehow activated the autocomplete popup on the words “The playground” by clicking or something, even though autocomplete was not turned on (I only confirmed that that was what it was, and not a spelling corrector, by later enabling it and typing “the”) and it was supposed to be read-only.
• Resizing table rows and columns is very buggy, with things like the grippies easily getting lost, the table-cell-action-button not updating its position, and it sometimes failing to act on mouse up. (Props for including the functionality, though, as it’s normally overlooked.)
• Clicking in table cells always moves the caret to the start of the cell rather than where you clicked, meaning you have to use arrow keys to get to the right place, and can’t select properly by mouse either.
• Pop-up menus don’t scroll with the document while open.
• Autocomplete popup doesn’t close when you move the caret by mouse, though they will no longer work if you click on them.
• Incidentally, who thought it a good idea to apply `list-style-position: inside`?
And this was from a fairly quick test. I found most of this stuff immediately and would expect to hit most of these issues in real life.
I honestly wish people would try to be less fancy with WYSIWYG components, because the web platform just isn’t well-adapted to it.
Re: Lexical – a web text editor framework that powers Facebook
#89I'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
Can you talk a bit more about how this is achieved? Is it DOM obfuscation?
[1] https://discuss.prosemirror.net/t/differences-between-prosem...
Re: Lexical – a web text editor framework that powers Facebook
#90Earlier 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…
is there a list/writeup of these problems somewhere? is this only applicable if you want to do editable rich text? could you perhaps try to explain the high level problem? what's different on iOS? thanks!
The major issue for both Android and CJK input is dealing with “composition” of characters by an “input method editor”. https://en.m.wikipedia.org/wiki/Input_method
In English, usually it’s okay to assume one key press event = one letter input. The opposite is true on Android generally, and for CJK languages on all platforms. These use input systems (like handwriting) where keypresses never occur, or many keypresses compose to produce one character. There are also new rules for IME composition input like “you can’t touch the DOM or change the selection during composition or the input will cancel and your user will be mad”. It turns the problem from “Hard” difficulty to “Nightmare” difficulty.
The baffling thing on Android is that each keyboard (Gboard, Samsung Keyboard, Swiftkey, Simeji, Sogou, Naver) have different composition behaviors with different event patterns… and GBoard’s ENGLISH input is probably the most strange! It composes whole English words like they were Chinese characters, and it wants to compose SO badly it will move text selection from wherever the user tapped to the nearest English word. And as an added bonus on Android only, the browsers selection APIs report the wrong selection during different phases of the event flow. Hah. Like when you tap a key, Android will send a selectionChange event before the first input-related event, and that selectionChange will probably report some weird lie about the selection position.