-
Notifications
You must be signed in to change notification settings - Fork 180
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
feat(compass-editor): expandable json editor #6446
base: main
Are you sure you want to change the base?
Conversation
The button on the top level doesn't expand all the child fields.
I'd defer those decisions to Diancheng: I've asked for her opinion. |
Sorry, I didn't communicate what's confusing here well, my bad. To clarify: we have two buttons with the same icon on the same line / level in UI doing slightly different things, how do user understands the difference and do they need to? Is there a point in having two? Might be worth asking Diancheng about this too |
The existing caret button is for fold/unfold code block; and the new one we are adding here is for expand/collapse all embedded fields. Both of them have tooltips when hovering, and it's easy enough to learn after clicking. Yes, we will hide the expand all button in the editor view. For the alignment, since the JSON view needs less space than the list view, I leave 8px on the sides of the border in the design. So it might look more like this (the green one): |
Yeah, so it seems like we broke the old behavior by switching editors and user wants the existing top level button to expand / collapse all and not just one level (instead of an extra button). It's just a handful of people who upvoted, so having two buttons is probably okay if it looks okay to you from design perspective |
Description
A sub-task of the design proposed in COMPASS-4635 is to add the "expand all" / "collapse all" button to the JSON editor view of documents.
Merging this PR will:
JSONEditor
component to use the non-deprecated variants, as well as pull the actions container to span the entire width.pointer-events
css properties to avoid capturing clicks on whitespace of the actions container.ActionButton
component, using the same hack introduced in #6439. I hope to replace this by an upstream change to leafygreen-ui.ActionsContainer
conditionally rendered on the presence of anonExpend
prop.onExpend
from theJSONEditor
into the editor, which calls the doc's collapse / expand methods.Notice how the "dismissal" behaviour is a bit different in the JSON editor than the regular document editor: As the focus is brought to the action button when clicking it, it will prevent the action group from disappearing. I.e. it is not enough to simply move the mouse pointer outside of the element to get the action buttons to hide. This is not new functionality but the effect of the existing styling here:
compass/packages/compass-editor/src/editor.tsx
Line 1382 in 05a557b
Screen.Recording.2024-11-05.at.09.32.12.mov
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes