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
Hasn't this method been completely removed in the implementation file?