finish preview function for edit