Fix bug on paste feature

Move logic to background page.