-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lexical-code][breaking change] Bug Fix: explicitly import instead of window.
to support code nodes in nodejs
#6562
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
There seems to be a build issue with Astro in the integration tests scripts/tests/integration/fixtures/lexical-esm-astro-react › install & build succeeded
PrismJS is kind of abandoned and doesn't support ESM, we should probably move to Shiki at this point. |
For this particular case, to unblock, since all the supported languages are listed in here: https://github.com/facebook/lexical/blob/main/packages/lexical-code/src/CodeHighlighterPrism.ts |
For what it's worth, last time I tried to make improvements to the way code highlighting imports prism it got undone by meta |
See also #5828 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but no idea if it will break Meta's build or not
@potatowagon could you check if this change would work for you internally? |
window.
to support code nodes in nodejswindow.
to support code nodes in nodejs
thanks for the headsup, labeled this as breaking change as a memo for further testing internally |
Description
Describe the changes in this pull request
Remove reference to
window
inCodeNode
so the package can be used in node js. This is done by referencing Prism conditionally usingglobal.Prism
if it is in an environment wherewindow
is undefinedCloses #6563
Test plan
Before
Insert relevant screenshots/recordings/automated-tests
window is undefined
error appears when creating a code node in a headless editor in a nodejs environmentAfter
Insert relevant screenshots/recordings/automated-tests
No error appears