added previewEle parameter to constructor