Add onPreview hook for flexibility