Skip to content
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

feat: export 'IS_' and 'CAN_*' environment constants from @lexical/utils #5831

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

etrepum
Copy link
Collaborator

@etrepum etrepum commented Apr 5, 2024

Exports all of the `IS_*` and `CAN_*` environment constants from @lexical/utils.
export {CAN_USE_DOM} from 'shared/canUseDOM';
export {
  CAN_USE_BEFORE_INPUT,
  IS_ANDROID,
  IS_ANDROID_CHROME,
  IS_APPLE,
  IS_APPLE_WEBKIT,
  IS_CHROME,
  IS_FIREFOX,
  IS_IOS,
  IS_SAFARI,
} from 'shared/environment';

While browser detection isn't really the purview of Lexical, these constants (or copy-pasted equivalents) are often necessary when implementing lower level features or just working around browser quirks. I found them useful to copy when I was working on a project that blended the code from lexical/plain-text and lexical/rich-text, which I found easier to understand and maintain by creating an independent "registerCustomText" rather than picking one and overriding functionality with higher command priorities.

Resolves #5827

Copy link

vercel bot commented Apr 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 3:02am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 3:02am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 5, 2024
@etrepum etrepum marked this pull request as ready for review April 5, 2024 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: IS_IOS, IS_SAFARI, IS_APPLE_WEBKIT, CAN_USE_BEFORE_INPUT not found in lexical import errors
3 participants