News for hackers. Stuff that matters.
Re:Lexical – a web text editor framework that powers Facebook by trueadm on Monday June 20, 2022 @02:23PM (#31813753)
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

Re:Lexical – a web text editor framework that powers Facebook by guessmyname on Monday June 20, 2022 @07:53PM (#31817849)
What does “web text editor framework that powers Facebook” actually mean?

I don’t use Facebook, but AFAIK, there are no “blog features” in the platform, are there?

Other than a WYSIWYG editor [1], what other use cases do you intend this project for?

[1] https://en.wikipedia.org/wiki/WYSIWYG

Re:Lexical – a web text editor framework that powers Facebook by chii on Monday June 20, 2022 @09:40PM (#31818783)
see https://news.ycombinator.com/item?id=14838232

> The competition has no choice but to spend all their time porting and keeping up, time that they can’t spend writing new features. Look closely at the software landscape. The companies that do well are the ones who rely least on big companies and don’t have to spend all their cycles catching up and reimplementing and fixing bugs that crop up [only on Windows XP.]

so it is the same with the modern day web frameworks as it is in the old days of windows and microsoft's dominance.

Joel Spolsky was as right in early 2002 as he is right in 2022.

Re:Lexical – a web text editor framework that powers Facebook by groby_b on Monday June 20, 2022 @09:55PM (#31818889)
Joel Spolsky wasn't particularly right in 2002, and he hasn't gotten more relevant with age.

As for this particular article, what is your criticism? That FB makes a rich text editor available as open source (under the MIT license)? How on earth does that mean "companies have to spend all their cycles catching up and reimplementing and fixing bugs"?

You can always roll your own, or use one of the many others available if this one doesn't taste right? (Also: Who on earth gains a competitive advantage from having a text editor, in 2022?)

Re:Lexical – a web text editor framework that powers Facebook by chii on Monday June 20, 2022 @11:50PM (#31819633)
> 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 library updates incompatibly and now you're locked in either to using the old version, or painful upgrade to the new version).

Of course, they don't have to choose to use such a library, but if they don't then there's a community of people who then questions them on why they are spending time replicating a technology.

The point is, if a startup chose to use this library, they face the risk of having to expend time keeping up in pace (and associated cost of doing so) with facebook.

This equivalent scenario exists in someone writing against libraries released by microsoft on windows, and that's what spolsky is complaining about.

Re:Lexical – a web text editor framework that powers Facebook by groby_b on Tuesday June 21, 2022 @01:01AM (#31820075)
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.

Re:Lexical – a web text editor framework that powers Facebook by chii on Tuesday June 21, 2022 @03:22AM (#31821180)
> This is no different than choosing a volunteer-based OSS 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 by groby_b on Friday June 24, 2022 @08:15PM (#31871132)
Oh please. Any project that isn't under your direct control will at some point "rug pull", because they will make a decision that's different from what you'd have preferred.

Major controversies that come to mind around Linux pretty much immediately are systemd, Wayland, the sound server wars. I also vaguely recall major back and forth around memory management. That's normal and expected. That's why you make "buy vs build" decisions, and any third party package is susceptible to that.

And "many individuals involved" means absolutely nothing - do you honestly believe that somehow this editor is a lone work of genius? Or that companies somehow have a coherent vision for every single detail? Have you ever worked in a large company?

Re:Lexical – a web text editor framework that powers Facebook by singaporecode on Tuesday June 21, 2022 @12:55AM (#31820040)
If you are using someone else’s work for free, then what’s there to complain?
Re:Lexical – a web text editor framework that powers Facebook by code_biologist on Monday June 20, 2022 @09:51PM (#31818868)
See also “nerd sniping”: https://xkcd.com/356/
Re:Lexical – a web text editor framework that powers Facebook by dbbk on Tuesday June 21, 2022 @08:40AM (#31823143)
What are you on about
Re:Lexical – a web text editor framework that powers Facebook by WhitneyLand on Monday June 20, 2022 @09:46PM (#31818828)
A really nice project.

A recruiter called me from your company recently, and I kind of cringed hearing him talk about the meta verse.

I realize now they probably would be much more effective with engineers if they skipped that part and just focused on all the cool work that’s being done.

Re:Lexical – a web text editor framework that powers Facebook by nehalem on Monday June 20, 2022 @02:30PM (#31813839)
Thanks for the offer, let me take you up on this. Could you compare Lexical and Prosemirror from an architecture perspective? What motivated your decisions in that regard?
Re:Lexical – a web text editor framework that powers Facebook by trueadm on Monday June 20, 2022 @02:41PM (#31813967)
Sure thing. I actually wrote up a really detailed response to this on ProseMirror's discussion board:

https://discuss.prosemirror.net/t/differences-between-prosem...

Ultimately though, there are many similarities between the two – intentionally so. We were inspired by ProseMirror and some of its APIs and approaches. I think the biggest underlying differences are in how we tackle things from a DX perspective. We tried to bring a more composable API to making text editors work – from the plugin patterns, how updates and reads work, to how you listen for changes and react to them. Much of this was inspired by my prior work working on the React core team and from creating Inferno.

Re:Lexical – a web text editor framework that powers Facebook by samwillis on Monday June 20, 2022 @03:28PM (#31814599)
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 support!

[0]: http://tiptap.dev

Re:Lexical – a web text editor framework that powers Facebook by singaporecode on Tuesday June 21, 2022 @12:57AM (#31820055)
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 by samwillis on Tuesday June 21, 2022 @04:05AM (#31821478)
I would disagree on "worst developer experience possible", it has a very steep leaning curve, but once you grok it it makes a lot of sense.
Re:Lexical – a web text editor framework that powers Facebook by chucky123 on Monday June 20, 2022 @07:43PM (#31817764)
Fundamental problem with Tiptap is its horrendous docs. If lexical can put out better docs, it is better than Tiptap automatically.
Re:Lexical – a web text editor framework that powers Facebook by pixel_tracing on Monday June 20, 2022 @03:50PM (#31814884)
Hey since you work at Meta can you find when code support / markdown will be added to text editing components?

It’s so frustrating posting code snippets to friends threads on FB

Re:Lexical – a web text editor framework that powers Facebook by trueadm on Monday June 20, 2022 @03:55PM (#31814969)
Lexical supports code support / markdown. We actually use it a lot for Workplace, which is a kind of Facebook-like website for companies. It's really down to the product surfaces what features from Lexical they choose to use.
Re:Lexical – a web text editor framework that powers Facebook by jacobsimon on Monday June 20, 2022 @04:08PM (#31815158)
Hey on my business’s website we currently use draft.js for our user discussion product and we convert the user input to markdown for storing in our db. How hard would it be to switch to Lexical and does it support rendering from markdown syntax? Do you recommend any other approaches for safe storage and rendering of rich text? Thanks!
Re:Lexical – a web text editor framework that powers Facebook by acywatson on Monday June 20, 2022 @04:13PM (#31815250)
I work at Meta on the Lexical team - yes, Lexical supports markdown and rendering from markdown syntax. Lexical isn't a drop-in replacement for Draft, but we're migrating all of our surfaces internally and it isn't particularly difficult, especially if you aren't storing in the DraftJS-specific format. As for alternatives, you can also consider storing it as JSON, which Lexical supports.
Re:Lexical – a web text editor framework that powers Facebook by trueadm on Monday June 20, 2022 @04:11PM (#31815222)
Lexical has markdown support via `@lexical/markdown`. See https://lexical.dev/docs/api/lexical-markdown.
Re:Lexical – a web text editor framework that powers Facebook by kapravel on Tuesday June 21, 2022 @07:54AM (#31822844)
> Prevent the DOM from being manipulated externally (i.e. extensions) to guarantee that the DOM always matches the EditorState. [1]

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 by tumultco on Monday June 20, 2022 @08:41PM (#31818263)
Thanks for your work in developing this!

Does Lexical have a feature to set arbitrary CSS on a particular selection range? I've been looking for a solution to do this since the WebKit's -[WebView applyStyle:] is deprecated as part of WebView Legacy. It isn't clear to me from glancing at the docs if RangeSelection.formatText() or other methods can handle anything or just a subset of styling code. Thanks!

Re:Lexical – a web text editor framework that powers Facebook by acywatson on Tuesday June 21, 2022 @11:55AM (#31825391)
Yes, we have something like this in @lexical/selection: https://github.com/facebook/lexical/blob/af099ffd9f464b523d6...
Re:Lexical – a web text editor framework that powers Facebook by afd8856 on Tuesday June 21, 2022 @01:02AM (#31820082)
Just mentioning SlateJS which has [decorations](https://docs.slatejs.org/concepts/09-rendering#decorations) for this
Re:Lexical – a web text editor framework that powers Facebook by taf2 on Monday June 20, 2022 @09:28PM (#31818649)
Does it have vim keybindings? And does it need react or is there a standalone way to embed it?
Re:Lexical – a web text editor framework that powers Facebook by zwily on Tuesday June 21, 2022 @12:03AM (#31819701)
People have contributed bindings for Vue, Svelte, and Solid so far. I’m not sure what state they are in though. React is definitely the most mature binding.
Re:Lexical – a web text editor framework that powers Facebook by chx on Monday June 20, 2022 @09:46PM (#31818827)
Does wordperfect 5.1 say anything to you :) ? You just remade it and I love you for that.
Re:Lexical – a web text editor framework that powers Facebook by bythckr on Wednesday June 22, 2022 @07:30AM (#31834602)
Why not add a spell checker & word counter?
Re:Lexical – a web text editor framework that powers Facebook by hemantv on Monday June 20, 2022 @07:35PM (#31817691)
Awesome work. I have been early user of Lexical building getstable.co.

Thanks for great framework and design ;)

[dead]
Re:Lexical – a web text editor framework that powers Facebook by hemantv on Monday June 20, 2022 @07:34PM (#31817675)
Seriously wtf
Re:Lexical – a web text editor framework that powers Facebook by jjuliano on Monday June 20, 2022 @05:32PM (#31816289)
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 by jjuliano on Monday June 20, 2022 @09:18PM (#31818574)
sorry, I didn't realize this was a text editor. I was initially looking at the time-travel screen (the black box), and thought that is where to type things to be able to use it.

Lexical is awesome!