Skip to content

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

Merged
chandlerprall merged 5 commits intoelastic:masterfrom
chandlerprall:bug/2437-euihighlight-euicode-fixing
Feb 3, 2020
Merged

Fix EuiCode / EuiCodeBlock's support for non-string values#2792
chandlerprall merged 5 commits intoelastic:masterfrom
chandlerprall:bug/2437-euihighlight-euicode-fixing

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