Conversation
|
@fantactuka is attempting to deploy a commit to the Facebook Open Source Team on Vercel. To accomplish this, @fantactuka needs to request access to the Team. Afterwards, an owner of the Team is required to accept their membership request. If you're already a member of the respective Vercel Team, make sure that your Personal Vercel Account is connected to your GitHub account. |
There was a problem hiding this comment.
I've added this to allow copy/pasting from editor into code block. By default divs are ignored and all code is inserted as a single line. Although it's intended to be temp code I wonder if there're any concerns to make it permanent
There was a problem hiding this comment.
I wonder if this would work for your case:
I was thinking about adding a generic childTransformer that can apply any arbitrary logic to the children of a DOM Node. It would handle cases like encountering a <strong> tag, where we need to apply the transformation of styling the text to "bold" for every child that's a TextNode.
I can look a bit deeper at this later, but appendAfter might make sense to have as well. Either way, we would need some tests for it.
314bed1 to
6600798
Compare
|
Rebased PR to lexical names and removed copy/paste transform update - it deserves its own PR |
|
There was a problem hiding this comment.
As far as I know, this would be the only place that we provide a className in a node constructor instead of getting it from the Theme. Not necessarily a problem, just something I wanted to point out.
There was a problem hiding this comment.
That's fair point, I'll extract highlighting classes into theme, it should be ~10 of them. Thanks for catching!
There was a problem hiding this comment.
I'm a little confused here - if you remove all the children, won't the length always be 0?
There was a problem hiding this comment.
Not always, e.g. you can have code block with 10 code-highlight children, and only need to replace from 2nd to 5th and keep the rest. This method works similar to Array.splice and allows deletion/replacement/insertion for specified range
Right now it's not very efficient, as it removes/inserts nodes one by one, and can be replaced with low-level api instead:
https://gist.github.com/fantactuka/27eca8dfc269ba4e371a7e257bd46af8
There was a problem hiding this comment.
Oh, right, the loop is bounded by the values of the from and to parameters...missed that. Thanks
|
Extracted code highlighting styles into theme, now instead of applying refractor's class name directly it'll be mapped to theme class instead. |
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/fbopensource/lexical/2JbRiWJB5LoVX3fadydLaJD64drR |
2d2e879 to
da8e817
Compare
Fixes #13386 Below I write a clarification to copy and paste into the release note, based on our latest upgrade of Lexical [in v3.29.0](https://github.com/payloadcms/payload/releases/tag/v3.29.0). ## Important This release upgrades the lexical dependency from 0.28.0 to 0.34.0. If you installed lexical manually, update it to 0.34.0. Installing lexical manually is not recommended, as it may break between updates, and our re-exported versions should be used. See the [yellow banner box](https://payloadcms.com/docs/rich-text/custom-features) for details. If you still encounter richtext-lexical errors, do the following, in this order: - Delete node_modules - Delete your lockfile (e.g. pnpm-lock.json) - Reinstall your dependencies (e.g. pnpm install) ### Lexical Breaking Changes The following Lexical releases describe breaking changes. We recommend reading them if you're using Lexical APIs directly (`@payloadcms/richtext-lexical/lexical/*`). - [v.0.33.0](https://github.com/facebook/lexical/releases/tag/v0.33.0) - [v.0.30.0](https://github.com/facebook/lexical/releases/tag/v0.30.0) - [v.0.29.0](https://github.com/facebook/lexical/releases/tag/v0.29.0) ___ TODO: - [x] facebook/lexical#7719 - [x] facebook/lexical#7362 - [x] facebook/lexical#7707 - [x] facebook/lexical#7388 - [x] facebook/lexical#7357 - [x] facebook/lexical#7352 - [x] facebook/lexical#7472 - [x] facebook/lexical#7556 - [x] facebook/lexical#7417 - [x] facebook/lexical#1036 - [x] facebook/lexical#7509 - [x] facebook/lexical#7693 - [x] facebook/lexical#7408 - [x] facebook/lexical#7450 - [x] facebook/lexical#7415 - [x] facebook/lexical#7368 - [x] facebook/lexical#7372 - [x] facebook/lexical#7572 - [x] facebook/lexical#7558 - [x] facebook/lexical#7613 - [x] facebook/lexical#7405 - [x] facebook/lexical#7420 - [x] facebook/lexical#7662 --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1211202581885926
Submitting PR for initial feedback
prism.tokenize to get highlight tokens.refractorfor highlighting (it's built on top ofprism.jsand generates highlights tree structure, comparing to prism's html output)Some concerns/thoughts