Add delegate to get index of selected tag

1. fix crash when add an empty text
2. add delegate to get index of selected tag
no, this still stand there and be available.