Conditionnally accept text pasted

Hello,

I want to intercept the content which is pasted, so that when a specific google drive link is pasted, I ask the user the choice to insert either the link or a google drive embed.

I tried to that with handlePaste but accessing the pasted content is done through getAsString but the function is async so impossible to know if I should return true or false from handlePaste. That could work inside transformPastedText, but this method can’t access the view .

Would like to do something like that:

	transformPastedText(text,plain){
				if (is_google_drive_link(text)){
					//ask_user_what he wants to do async, but can't access view
					return ""
				}
				return text
}

Is that possible to do that kind of thing ?

Thanks

In fact the function getData on DataTransfer instead of DataTransferItem is not async which solve the issue. Sorry for bothering.

	handlePaste(view, event,slice) {
				if (is_google_drive_link(event.clipboardData.getData("text/plain"))){
					let url = event.clipboardData.getData("text/plain")
				       // ask user
					return true
				}
				return false
			},