editor preview function