(groupId?: UniqueId)
| 731 | } |
| 732 | |
| 733 | public cloneGroup(groupId?: UniqueId): IEditorGroup { |
| 734 | const { current, groups = [] } = this.state; |
| 735 | |
| 736 | const cloneGroup: IEditorGroup = Object.assign( |
| 737 | {}, |
| 738 | groupId ? this.getGroupById(groupId) : current |
| 739 | ); |
| 740 | |
| 741 | // get an random id for new group |
| 742 | const id = randomId(); |
| 743 | |
| 744 | const initialTab = Object.assign({}, cloneGroup.tab); |
| 745 | cloneGroup.data = [initialTab]; |
| 746 | cloneGroup.tab = initialTab; |
| 747 | cloneGroup.activeTab = initialTab.id; |
| 748 | cloneGroup.id = id; |
| 749 | |
| 750 | this.setState({ |
| 751 | current: cloneGroup, |
| 752 | groups: [...groups, cloneGroup], |
| 753 | }); |
| 754 | |
| 755 | return cloneGroup; |
| 756 | } |
| 757 | |
| 758 | public onUpdateTab(callback: (tab: IEditorTab) => void) { |
| 759 | this.subscribe(EditorEvent.OnUpdateTab, callback); |
nothing calls this directly
no test coverage detected