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

Allow users to set activeTabset to undefined #326

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/model/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class Actions {
static UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
static FLOAT_TAB = "FlexLayout_FloatTab";
static UNFLOAT_TAB = "FlexLayout_UnFloatTab";
static DESELECT_TABSET = "FlexLayout_DeselectTabset";

/**
* Adds a tab node to the given tabset node
Expand Down Expand Up @@ -165,4 +166,11 @@ export class Actions {
static unFloatTab(nodeId: string): Action {
return new Action(Actions.UNFLOAT_TAB, { node: nodeId });
}

/**
* Deselect the active tab set, setting the active tabset to undefined
*/
static deselectTabset(): Action {
return new Action(Actions.DESELECT_TABSET, {})
}
}
4 changes: 4 additions & 0 deletions src/model/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ export class Model {
node._updateAttrs(action.data.json);
break;
}
case Actions.DESELECT_TABSET: {
this._activeTabSet = undefined;
break;
}
default:
break;
}
Expand Down