Skip to content

Conversation

@prudho
Copy link
Contributor

@prudho prudho commented Aug 2, 2023

Description

This PR add the ability to remove a tab by clicking on an icon or programmaticaly. It works by adding the removable class to the desired tab headers or setting removable: true on initialization. Two new callbacks are implemented: onRemove(tabPath) when the tab is removed, and onBeforeRemove(tabPath), which allow cancelling the removal of the table by returning false. When removing a tab, it will move to the closest which is not disabled.

For now i'll mark it as WIP, since there's some tests to do on nested tabs, and decide what to do if all tabs are closed.

Screenshot

image

Closes

#2521

@prudho prudho added type/feat Any feature requests or improvements type/discussion Anything which is up for discussion state/awaiting-docs Pull requests which need doc changes/additions javascript labels Aug 2, 2023
@prudho prudho added this to the 2.9.3 milestone Aug 2, 2023
@prudho prudho requested a review from a team August 2, 2023 13:42
Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick thoughts

  • What about a lonely "+" icon inside a new (unbound/fake) tab to also add a new tab (optional). Would also need two new events "onAdd" and "onBeforeAdd" just like you implemented for remove

what to do if all tabs are closed.

I think it should be an (optional) restriction to keep at least 1 tab (or that setting can define how many tabs have to stay as minimum)

@prudho
Copy link
Contributor Author

prudho commented Aug 4, 2023

What about a lonely "+" icon inside a new (unbound/fake) tab to also add a new tab (optional). Would also need two new events "onAdd" and "onBeforeAdd" just like you implemented for remove

I'll try that on another PR !

@lubber-de lubber-de modified the milestones: 2.9.3, 2.9.x Sep 4, 2023
@lubber-de lubber-de modified the milestones: 2.9.x, 2.10.x Feb 19, 2025
@lubber-de lubber-de added lang/javascript Anything involving JavaScript and removed javascript labels Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang/javascript Anything involving JavaScript state/awaiting-docs Pull requests which need doc changes/additions type/discussion Anything which is up for discussion type/feat Any feature requests or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants