-
Notifications
You must be signed in to change notification settings - Fork 62
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
Provide scrollToBottom method & after command callback #36
Comments
As for the scroll to bottom thing, I thought I had already implemented that feature but as it seems it got lost somewhere. The terminal is definitely intended to scroll to bottom after input. Your idea of being able to toggle it is cool too, will consider adding it. The command callback idea is really nifty and something I should have considered initially, it’s passed by me completely. I’ll consider adding that too. |
* Added command callback support and new commandCallback prop (#36) * Added default-enabled automatic bottom scrolling on command (Disabled via new noAutoScroll prop) (#36) * Moved utility functions to src/utils/helpers.js * Moved styles that needn't be computed from state to src/utils/sourceStyles.js * Moved prop types to src/utils/types.js and switched to static class field prop type declaration
Pushed my proposed changes in accordance with this request in f2d2525. You can check out the proposed new command callback system and automatic scrolling there. I believe this is the best of both worlds: Automatic scroll per default that can be disabled if scrolling at a later time is desired. Manual scrolling is also easy to do via the command callback, as all you need to do is to get the root element and set |
Also added live demo at https://linuswillner.me/react-console-emulator/ now. |
@linuswillner I have a problem trying it on my machine in my project, can you please publish this as alpha to npm? Or you can just merge it, from what I had a look at a code it should work. I'll notify you if it's not sufficient. |
Just published version 1.7.0 to NPM. Feel free to try it out and reopen this if any issues arise 😄 |
With 1.7.0, I get this error, I thought it was a linking issue of mine when I tried to use it from a forked repo, but now I get it from prod. as well. Edit: I can't re-open @linuswillner |
Good grief, why did I not think of that... Yeah of course, it makes total sense now. It’s an issue with the build flow that is only affected by the package. I’ll fix that tomorrow, sorry about this. I can’t issue a fix at this very moment, but a temporary fix is to obtain the Sorry about the inconvenience once again. |
Moving this conversation to #39. |
Hi again,
I'm trying to use this in a real application and I only have limited space to show a console.
I've set
maxHeight
by usingcontentClassName
property. However now I want my console to scroll to bottom every time it's needed (after a command is executed).For this, I'm missing some public method on a component that would
Another option is to have boolean property that will scrollToBottom after command is executed. Maybe it's worth even to have it true by default.
What do you think?
The text was updated successfully, but these errors were encountered: