-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add buttons to reorder split panes #3984
Conversation
I have changed the mechanism to utilize the As shown in the first GIF, the scrolling position can be preserved when the This even enables a more-intuitive swapping when new tab is involved, instead of cloning the existing pane to the empty one. When testing the swapping of new tabs, I discovered an existing bug in master (0.60.1-beta) that breaks the tab row if the main context is an empty note upon refreshing the page. It is described in #3985. |
Thanks, that looks useful! I'll take a closer look tomorrow. |
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 good with some minor comments.
I have simplified the logic by passing the new and old main contexts IDs instead of passing arrays around, since we can assume there will be at most 1 main context change per reorder event. |
Thanks for the contribution! |
Background
I use the split-pane function quite often to view other reference/literature notes when doing my writing. Sometimes I need to compare difference versions of my work, and I find it quite clumsy to swap the notes in the two panes, i.e. focus into the left pane, jump to another note, focus into the right pane, and then jump to another note.
It would be nice if we can somehow reorder the panes to better organize the notes. The reordering/swapping buttons would also allow "closing the left pane" without using the Jump to Note function, that would become a simple swap followed by closing the right pane.
Proposed funtion
Introduce "Move left" and "Move right" buttons next to "Create new split" and "Close this pane" buttons for users to reorder split panes. When split panes are used, these buttons will appear given that the moving direction is valid in relation to other panes on the screen.
In case there are more than two panes, both buttons will be shown in the middle panes. Also, when one of the panes involved in the move operation is empty, it has the same effect as copying the non-empty pane to the empty one.
In this implementation, the note contexts will switch directly to their new note paths. A small catch is that the scrolling position in the panes will not be preserved. I think it might be possible to utilize the
noteContextReorder
event, but I found it quite complicated since we also need to update the main context ID of all the subcontexts before refreshing the UI. Anyway, I think the current proof of concept should be good enough for most use cases.