Rails World 2026: Lexxy: a new text editor for Action Text (Jorge Manrubia) Video: https://www.youtube.com/watch?v=UIXwabQ9jIU Talk page: https://www.rubyevents.org/talks/lexxy-a-new-text-editor-for-action-text Unedited machine transcript, generated with Whisper. It contains recognition errors (names, technical terms). Check the video before quoting. ---- Thank you. Thank you, Fernando. So my name is Jorge. I work at 37 Signals. And today I'm going to talk about Lexi. So Lexi is an open source rich text editor that we have released. It's a project we are super excited about, and today I'm going to tell you everything about it. I'm going to try to explain to you why we are so excited. So let me start with the motivation. Why did we create Lexi? And to do that, we need to start with Twix. So Twix is a rich text editor that we released in 2015. in this first version of Action Text in Rails 6. And Trix is a wonderful editor. It's simple, it's battle-tested, it's robust, and millions of users have used it for well over a decade. So, in recent years, we at 37 Signals in the company, we've been feeling that Trix had started to fall support for our expectations. So, customers, essentially, were requesting features that we struggled to implement or that we directly couldn't implement. Things like tables, for example, in Basecamp. Customers wanted to use tables, and we didn't manage to implement those, and there were several of those features that made us reconsider the whole situation. to talk a little bit about the TRIX document model. So the TRIX document model is quite simple. It's a flat list of blocks, a block being a text fragment with a series of attributes or labels that characterize it. So for example, if you think of having a valid item inside a block quote, which looks like nested information, TRIX internally stores that as a block, with a label signaling the block quote followed by another block with three labels, block quote, ballot item, for example. So at rendering time, Tricks is going to render the information nested, but internally there is no nesting. And this is essential to understand why it's so hard or impossible to implement things like tables, node containing table rows, a row can contain cells, a cell can contain arbitrary HTML. It's impossible to represent with this model. On the other hand, this model is great because it's simple. So, for example, you can represent a position in a document with two numbers. HTML is clean, by definition, because the model can't contain arbitrary HTML. So it has some benefits, but also some trade-offs. The problem we had with TRIX is maintenance. See, these modern editors are like engineering wonders that are built on top of content editable. And content editable is unstable ground. Content editable behaves differently depending on the browser. And content editable sometimes breaks or changes in ways you don't expect when operating systems update. this very well, 2024 with iOS, there were a series of releases that broke tweaks in different ways, like, for example, regarding autocompletion or dictation or cursor management. This one in particular was a problem where it was close to a code red at 37 signals because we detected on an iOS beta that our products were about to break badly. with the official release because Trix wasn't working at all. So, one second. Okay. So, to give you a little bit of chronology here, we've been talking about this in the company for years. 2022, we started a project to add tables to tricks. We spent like one or two weeks on that before dropping the effort, because as I said, it was quite impossible to implement tables in a way that was appealing to us. 2023, I worked on a spike to use TipTap in Hay. Again, a very quick effort, because in Hay, we had the problem of composing emails, and the world of email format is wild. So how you reply to an email that is from in arbitrary ways. It's a complex problem. TRIX wasn't delivering there. We didn't pursue the effort. It was an interesting one, but we moved on. Then, in 2024, we released WriteBook. And with WriteBook, we created HouseMD, which is a markdown editor. It's not a WYSIWYG editor. It's a what you see is what you mean editor, meaning you get to see the markdown syntax visual formatting sugar on the top, which works. It works wonderfully well for writing books or for writing long-form documentation. But when we tried to use HouseMD in general-purpose products, early in 2025, I participated in a project where we tried to do that, and it wasn't feeling right at all. Like, the general audience want, like, a WYSIWYG editor, like, in general. in our use case. So with these scenarios, like 2025, early in 2025, Brian Bailey, our head of product strategy, started the discussion again. What do we do about the editor? Which path should we follow for our products? And that was when we started to evaluate options again. TipTap was a contender again, but we discarded it because And David was pretty clear that we didn't want a setup where there were like an open source product with a VC backed company behind, so a sales time behind. And with this tension of how does this company make money out of this product? Because the setups where you end up with is, for example, with features that are maybe part of the open source core, maybe they got moved to the proprietary part, or maybe the company decides that moving forward, we are going to release patches only if you pay a license or a certain fee. And this is a structure that had beaten us in the past, for example, with Chef, and we didn't want to invest on such a structure thinking in the long term. So, it was then, 2025, when we discovered Lexical by Meta, which is a text editing framework that we evaluated, fall in love as the technical foundation we wanted to use moving forward. So let me tell you a little bit about Lexical, how Lexical is designed. So Lexical has a very tiny core with no dependencies that interestingly implements the same pattern or the same approach that Triggs used like 12 years earlier, is treating content editable as an input/output device and as a rendering surface, but not at the source of truth. The source of truth in the editor is a document model. So whenever you want to modify the document, you don't add on content editable directly, but you perform an update where you get a new document snapshot. So the state itself is immutable. You get new snapshots. that are themselves immutable. And the core has several primitives. One of them is a reconciler that, let's say, compared the snapshots to calculate the difference between them and represents them in the DOM, in the real DOM, very efficiently. Kind of what the virtual DOM technique that React popularized. Other primitives in the core are commands, which is like a global event bus where you can subscribe to commands and react to them. It has transformers, which let you listen to node changes and intervene in a way that plays very well with the reconciler. And pretty much that is like the core of Lexical. Small core with no dependencies of anything else. Then in the Orbit, what you have is a series of packages implementing the more user-facing features, like, for example, rich text formatting, markdown, tables, the clipboard, and such. So it's a phenomenal design that we've tested empirically. I mean, the folks from Meta who designed Lexical, they knew what they were doing. It's a fantastic design. Lexical also solved the maintenance problem we had. Because Meta is using Lexical in their products, meaning that we have literally hundreds of millions of users using this editor. So if there is some kind of obscure bug in some keyboard or some device, Android, iOS, whatever, they are going to cut it before it hits us. And we've seen this in a year and a half plus we've been working with Lexical. We've seen this happening several times, where the Lexical team, fixes something, which is something we super appreciate, coming from Tricks and from our current position. And also the structure of incentives with this setup is so much better for what we wanted. Because now you have Meta is making money out of their products, like WhatsApp or Instagram, and then it's in the best interest to maintain lexical so that those products are great, but they don't have to, you know, struggle to make money out of out of lexical which from our perspective is a much better setup of course you never know how things are going to go but we are much happier with this with this approach and position so lexical is packed with features so the plan was grab lexical prepare a nice package with with the packages we want and add a toolbar and then We're done with it, right? So it didn't work exactly like that. It turns out that creating a great editing experience is super hard. It's super hard. You need to handle, like, one million details. Lexi alone is, I think, 13,000 lines of vanilla JavaScript that's on top of Lexical. An editor is essentially... I mean, managing a state in software is very hard. is a thing where you can change the state in one million different directions. All the permutations you can think of multiple times per second. So an editor is a complex thing to get right. And also, you need to take care of things like, for example, if you have two images next to each other and you want to represent the cursor blinking between them, how do you do that if you don't have room in the DOM, for example? Or what happens if you copy and paste the content from Microsoft Word paragraphs or whatever format is not using standard markup. You need to take care of a lot of those details. So, in terms of chronology, we released the first version of Lexi with Fizzy in May 2025. Sorry, in May of '25 was the first pull request. In December, we released Fizzy, which was the first time where customers were using Lexi. And then, in May of 2026, we released, let's say, Basecamp 5, which is when Lexi started being used by a lot of folks. So, I want to recognize these two folks here, who are Sultan Hotsu and Sam Pesher, from 37signals, they were the guys who took care of a lot of that complexity in the iceberg, building major features, fixing countless bugs, a lot of polish, and they took a very green prototype of Lexi to something we could release with Spacecam 5, so my recognition to them. And this is important. You know, we didn't want to create a trick with tables here. very, very good. We wanted to be ambitious with Lexi. The reason is that Lexi is a fantastic editing framework and also that we had agents to help as productivity multipliers for everyone in the team. So we wanted the full package. We wanted the features, of course, but also the speed, the accessibility, the security, the documentation, the extensibility, the configuration APIs, the full package. So in terms of features, a quick tour. Lexiz supports, for example, a color highlighter, which was a feature we only had available in Tweaks in Basecamp as a proprietary thing. Now it's a standard feature. It has tables, of course, with a wonderful user interface. It has Markdown, supports Markdown syntax. It has code, real-time code highlighting, supporting more than 20 languages, thanks to Prism. Also, image galleries, of course, with much better support for drag and drop than tricks, and also for the keyboard. You can create links by pasting URLs. We have a wonderful API for creating prompts, like an emoji picker to offer mentions, to mention people in your company or any kind of prompts you can think of that we've designed. APIs for all the scenarios we have detected in both PC and Basecamp. So it's an API that is fantastic. It will also show previews of attachments like PDFs or movies, which was another proprietary feature we had in Basecamp, but it's now part of the editor. And I want to talk about the integration with ActionText, because it's interesting. ActionText made a decision early on, which was it normalizes the HTML it stores regarding attachments, with attachments being things like image galleries or images, file attachments, and also custom attachments, like, for example, mentions or bits of editable information that reference things in your application. of making that kind of a canonical markup format to store so that it's not tied to any editor in particular. So TRIX does some conversion back and forth between the editor and the database. What we did with Lexi was leveraging the fact that Lexi is very good at letting you customize how to emit HTML. like that native canonical format so that if you graph an Lexi editor instance and you grab the value, you're going to see that HTML normalized. And another wonderful thing that this design offered is that we could extend action text to make the editor configurable. we created an adapter for this back and forth between the editor and the server. We created an implementation for Tricks, another implementation for Lexi. And well, I want to recognize also Son Doyle from Thoughtbot. He actually had created a pull request for doing this way before we started with Lexi. And then with our input after releasing Lexi, he took it to the finish line. He did a phenomenal job there. And now in Rails, I think this is going to be efficient in Rails 8.2, but this is already part of the main branch. You can do things like this. And hopefully, this will offer the options so that other editors, using other editing frameworks or maybe other editing philosophies like House, you know, to be plugged in a standard way. Okay, this support is already there. So, Trixis, Lexi is also extendable, so what we did was we created an API to offer extensions, to implement extensions. This API leverages the extensions capability that Lexiql has, so it exposes all those capabilities so that you can do things like defining new node types, or creating new commands, adding new buttons to the toolbar, and extending the editor in any way you want. This is absolutely battle-tested. I think Lexi itself has like 10 internal extensions. We have like nine or 10 extensions also in Basecamp. So this is not like a theoretical API or something we designed in the abstract. It's something that absolutely works. And my favorite example is in Basecamp we have a proprietary extension, which is voice notes, is created with this extension API, and it's pretty complex, as you can imagine. So, essentially, you can really, really build whatever you want. You can extend the editor in any way you want. Lexi is fast, okay, because Lexical is very fast. The chart we show, there you can see, like, that line is like 50 millisecond threshold, which is the time that elapses and you press the keyboard until you see the editor update 50 mil second is like the threshold beyond which you will notice slugginess you can see in the chart how you know Lexi is so much faster than tricks and beyond the numbers like you can perceive this if you start using Lexi if you open tricks in the sandbox open Lexi in the sandbox you start typing them you will see how Lexi is way more responsive Accessibility. So we really wanted to make Lexi accessible. It turns out that making content editable editors accessible is very, very challenging. TRIX is not great accessibility-wise. So what we did, well, we got Bruno Prieto and Michael Berger working on this. the QA team lead at 37signals and our accessibility champion. Bruno Prieto, I'm sure many of you know him. He's an outstanding programmer who knows everything about Rails and Hotwire, Frontend, the web, and also happens to be a blind person. And, well, Bruno took this, I mean, we hired Bruno. Bruno took this, like, kind of enthusiastically because he's been suffering the problems of not accessible editors his whole life. And he really delivered here. Lexis is going to generate accessible HTML. It's using accessible HTML in terms of structure and annotations. It also offers an amazing keyboard support, focus management support. You can do, for example, things like switching between the editor and the toolbar, manage the toolbar with the arrow keys. or an image, you have the Alt F10 convention to switch between the specific toolbar and the editor back and forth. You can do things like sorting images with arrow keys without shift. So we really worked hard on this, and it's something we are super proud of. Security, same story. I don't know if you have heard that AI has represented like an unprecedented explosion in terms of vulnerabilities discovered. And we took that quite seriously. We put parameters of the caliber of Jeremy Dyer and Mike D'Alessio to help us with this. And we've really taken care of things like sanitization. Lexi comes with its own Don't Purify instance. And we've taken care of sanitizing URLs. Of course, the markup itself. Also, the attachment types, the editor support, the node types support. We've taken care of a lot of details here because we know how important it is. And then I want to talk a little bit about agents. So, Lexi is very special to me because, you know, I think every developer on Planet Earth discovered in 2025 that the agents were mind-blowing. Lexi was the first project where I started using Cloud, the first big project where I started using Cloud from scratch. And, of course, I was blown away like everybody else. I want to drop a couple of notes there. One of them is that, see, when I started working with Lexi, I started with Capuara for tests. So I was using Capybara because I wanted to exercise the testing of the action text boundaries to test how Lexi behaved, saving action text payloads in the server, but also was using Capybara for text editing interactions. And at some point, I introduced Playwright in the suite. was that Playwright was supporting multiple browsers when testing. So I wanted that for Lexi to make it more robust. So we kept the server-side tests on Capoeira and the text editing interactions. We moved those to Playwright. But to my surprise, this was wonderful for agents. It was wonderful for Claude. It was like if Claude was saying, finally, it blossomed. And I think it's because PlyWrite offers better primitives for low-level interaction, like focus management, keyboard management, and Claude and agents really shine writing tests for an editor, a rich text editor with PlyWrite. And it was probably the best decision we made in the project, agents-wise. working in a project where I would put like, I don't know, 10, 15 agents fixing bugs in parallel, you know, we collected a lot of bugs after the first release, preparing for Basecamp 5, and after releasing the first version of Basecamp 5, we tackled like almost 300 bugs and carts in general, big bugs, small bugs, polish, but this is not features, okay? of reactive Lexi work. And another lesson here was that when you start working with agents in such large batches, the problem you have is how do I validate and I review so many pull requests? And something we tried and that worked pretty well was to use agents to do that. So, we have a skill that is going to -- when it's going to -- it's looking into a bug fix or into something that is user-facing. It's going to try to reproduce with a fresh context that bug in production using the Lexi production sandbox in the home page. Then it's going to try to reproduce with the same script the fix with Lexi working locally. And if it checks both, then it's going to label the pull request with this So, when you imagine that if you have to review 15 pull requests and, you know, 11 of those have this label, then you can go much faster over those that have been validated like this. And to finish, we are going to release version one of Lexi today. Lexi has been stable for a few months already, but we were saving the number for this wonderful stage. We are going to make Lexi the new Rails default. This is already in the works. So, you know, Rails applications in the future are going to start with Lexi instead of Trix. For all of you who are listening to this, I recommend you to start with, if you are starting a Rails application right now, today, go with Lexi, okay? the future. And if you are actually running an application that is using Trix right now, probably unless you are doing like very complex extensions or patches to extend the functionality of Trix, the change should be pretty seamless, okay? Because that's exactly the scenario we had with Basecamp, and we've made sure that that's possible. I do believe that Lex is like right now a top contender to be one of the best web editors there is in the market. So I really encourage you to use it. And that was all. Thank you so much.