Add onCopy callback to CopyableText
Created by: philipp-spiess
Part of https://github.com/sourcegraph/sourcegraph/issues/27101
This PR is based on top of https://github.com/sourcegraph/sourcegraph/pull/30591 to avoid merge conflicts (we'll land them together anyway).
In order to log events around when invite links are copied, we need a callback from the <CopyableText />
component. Notice that there are two paths to copying text: Either by clicking the button or by focusing the text. This onCopy
callback is emitted on both paths.
I tested the changes by adding an onClick={() => console.log("onCopy called")}
prop to the caller in StartSearching.tsx
and it worked as expected: