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

Fix EuiCode / EuiCodeBlock's support for non-string values #2792

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Jan 24, 2020

Summary

Fixes #2437

When formatting text in an element, highlight.js modifies the DOM which makes React lose references between its Virtual DOM and the browser DOM. I've updated EuiCodeBlockImpl to render its children into a portal and then copy that portal's contents into another element for highlight.js to process.

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in IE11 and Firefox
- [ ] Props have proper autodocs
- [ ] Added documentation examples

  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Fixes the prop warnings in the docs, also.

@chandlerprall chandlerprall merged commit 37e4316 into elastic:master Feb 3, 2020
@chandlerprall chandlerprall deleted the bug/2437-euihighlight-euicode-fixing branch February 3, 2020 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do I mix EuiHighlight and EuiCode now that both expect strings?
3 participants