copy function
Serializes the current selection to plain text, and adds it to the clipboard.
Implementation
void copy({
required Document document,
required DocumentSelection selection,
}) {
final textToCopy = _textInSelection(
document: document,
documentSelection: selection,
);
// TODO: figure out a general approach for asynchronous behaviors that
// need to be carried out in response to user input.
_saveToClipboard(textToCopy);
}