-
Notifications
You must be signed in to change notification settings - Fork 841
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
[EuiMarkdownEditor] Better support to extend to full height #4245
[EuiMarkdownEditor] Better support to extend to full height #4245
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
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.
It would be great to also have an example to shows how to grow the markdown editor to fill a container's height.
Co-authored-by: Caroline Horn <[email protected]>
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
Long story shortI tried to add The magical waySo the magical way is for the prop Preview should get the size of the
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
…-improving-height-props
…-improving-height-props
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
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.
The functionality works great and feels intuitive! 👍
I think it would be work noting that the heights and max-heights don't take the toolbar into account. Meaning the toolbar adds an extra ~40px to the height they pass in.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
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.
Nice!! Couple small asks but everything looks really well put together. In the end, everything you said probably has a better way does but not without unrelated effort to enable those better ways - and the workarounds look right to me.
I pushed one change to detecting the preview's height to fully respond to any border & margin.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
Co-authored-by: Chandler Prall <[email protected]>
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
@chandlerprall I went through your comments and pushed the suggested changes. But I noticed that when the markdown editor has errors, on resizing, the height doesn't update as expected. If I resize the editor in This issue only happens when there are errors. Could it be something related to the component reloading and going back to the initial state? I tried to find the issue and no luck. |
I'll check it out! |
…-improving-height-props
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
The footer height was read when the component mounted, and the errors only render after the initial mount & parse. The error button adjusts the footer height by a few pixels, so the recorded height didn't match the new height, which triggered a size reset. I've swapped height tracking to respond to any footer resize instead of only on mount, and couldn't get it into a bad state - though I'd love some extra testing. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
Thanks @chandlerprall. 🙌🏽 I tested again in Safari, Chrome, Edge, and Firefox, and the issue is fixed. |
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 and works beautifully! Really nice job. Docs are really clear too.
I only found a couple things that could also be hand-waved or addressed later and just has to do with the responsiveness.
- The auto-height of the preview style doesn't update it's height on window resize, only when you toggle between code & preview. So you'll get scrollbars.
- At some point we should figure out a better responsive layout for the toolbar.
Other than a few other code suggestions. 👍 LGTM!!
Preview documentation changes for this PR: https://eui.elastic.co/pr_4245/ |
Thanks @cchaos. I added the snippets as you suggested. I'll make sure I'll address later points 1 and 2. |
Summary
Closes #4241.
This PR adds a
"full"
option to theheight
prop of the EuiMarkdownEditor to better support extend it to full height.It also adds a
maxHeight
prop. This way consumers have more options to control the height.The
autoExpandPreview
is very common for markdown editors like this one from GitHub. If the content is very long the height expands to fit all the content rather than adding a scrollbar. I decided to provide this functionality as a prop but enable it by default.Checklist
[ ] Checked in mobile[ ] Checked Code Sandbox works for the any docs examples[ ] Checked for breaking changes and labeled appropriately[ ] Checked for accessibility including keyboard-only and screenreader modes