fix preview problem.

1. fix preview problem, closure problem cause multiple blocks preview
failed.
2. add a new templatemanager to manage template.
3. clear how to load template: in popup, first check if already loaded,
if not then load by calling api.
4. TODO add edit and delete function.