Fix a JS issue in Paste

Summary: Fixes T5227.