add preview and save function to edit page