diff --git a/src/plugins/topbar/topbar.jsx b/src/plugins/topbar/topbar.jsx index 1773cdbc..30655b33 100644 --- a/src/plugins/topbar/topbar.jsx +++ b/src/plugins/topbar/topbar.jsx @@ -27,6 +27,7 @@ export default class Topbar extends React.Component { onUrlSelect =(e)=> { let url = e.target.value || e.target.href this.loadSpec(url) + this.setSelectedUrl(url) e.preventDefault() } @@ -35,6 +36,23 @@ export default class Topbar extends React.Component { e.preventDefault() } + setSelectedUrl = (selectedUrl) => { + const configs = this.props.getConfigs() + const urls = configs.urls || [] + + if(urls && urls.length) { + if(selectedUrl) + { + urls.forEach((spec, i) => { + if(spec.url === selectedUrl) + { + this.setState({selectedIndex: i}) + } + }) + } + } + } + componentWillMount() { const configs = this.props.getConfigs() const urls = configs.urls || []