Fix template editor JS