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

Is it possible to disable auto scroll ? #79

Closed
jason51553262 opened this issue May 16, 2022 · 6 comments
Closed

Is it possible to disable auto scroll ? #79

jason51553262 opened this issue May 16, 2022 · 6 comments

Comments

@jason51553262
Copy link

jason51553262 commented May 16, 2022

Is it possible to disable auto scroll?
When I have multiple editors on the page it always scrolls down the page to the middle one for some reason.
It would be good if auto scroll could be disabled entirely to let the user manually scroll from the top of the page.

I've updated the previous sandbox:
https://codesandbox.io/s/blue-cloud-i4vo7

Awesome tool btw. The tree view is great in my project. I really like the way you parse \n in strings too. I have yaml inside json and this works really well.

Also, I'm getting a strange issue where the expand method on load is not working on one of the editors which has a fair bit of data. I can't reproduce it in the codesandbox though which is strange.
image

@jason51553262
Copy link
Author

Actually, if I add that setTimeout workaround like you mentioned in the previous issue (with a small delay) it expands ok.

setTimeout(() => editor.current.expand(), 250);

@josdejong
Copy link
Owner

Thanks for reporting Jason, and for the sandbox that demonstrates the issue. It looks like a bug, probably related to the editors not having a fixed height (and scrolling contents). Will look into it.

Awesome tool btw. The tree view is great in my project. I really like the way you parse \n in strings too. I have yaml inside json and this works really well.

Good to hear 😎

@jason51553262
Copy link
Author

btw, I was hoping to disable the autoscroll altogether. I have an instance details view which shows every attribute of an inventory object, and if it has json attributes, I show the editor. The first editor could be a ways down the page, I was hoping to keep the scroll position on load set to the top of the page and not the first editor

@josdejong
Copy link
Owner

Yes definitely. Scrolling the editor into view was a bug. I found the cause: for the navigation bar I used some code to scroll to the right side when the path is longer than the width of the editor. I used element.scrollIntoView there, not realizing this side effect of scrolling the editor itself into view when it isn't. I've fixed it by changing to use element.scrollTo, see commit 42fe818. Will publish the fix today.

@josdejong
Copy link
Owner

The issue has been fixed now in v0.3.50

@jason51553262
Copy link
Author

Awesome. Just confirmed it no longer scrolls with v0.3.50. Thanks heaps! Cheers

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

No branches or pull requests

2 participants