auto save markup when unmount