Fix router and blur/cancel operations

This fixes:
1. Routing and the selected link
2. Onblur handler to save
3. Escape to cancel an edit
4. Focus on the input once double clicked
5. Minor refactorings