Clipboard
The Clipboard
module lets you interact with the windows clipboard for programmatic copy and paste purposes.
Get
Get the current string value of the system clipboard
var copyValue = Clipboard.get();
Set
Sets the current value of the system clipboard to a string. By default, the value is only available for pasting until the flow has ended. If you need to be able to paste the value after the flow has ended, use the persist
option as shown below. It is best not to use the persist
option when sensitive data is put in the clipboard.
Clipboard.set('This text can be pasted by the user or by the flow until the flow has finished');
// Persist
Clipboard.set('This text can be pasted even after the flow has finished', { persist: true });
Clear
Clears the current value of the system clipboard. Useful if the flow needs to temporarily put sensitive data in the clipboard.
try {
Clipboard.set('This is not for everyone to see');
Clipboard.paste();
} finally {
Clipboard.clear();
}
Copy
Carries out a standard copy (Ctrl + c) operation
Clipboard.copy();
var copiedValue = Clipboard.get();
Cut
Carries out a standard cut (Ctrl + x) operation
Clipboard.cut();
var cutValue = Clipboard.get();
Paste
Carries out a standard paste (Ctrl + v) operation
Clipboard.set('some text to paste');
Clipboard.paste();