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.
Parameters
optionsoptional object with options for the read:formatwhich clipboard format to read -"text"(the default),"html"or"unicode". Any other string is passed to Windows as a raw clipboard format name.
var copyValue = Clipboard.get();
// or read the HTML flavour of the clipboard
var copyHtml = Clipboard.get({ format: 'html' });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.
Parameters
textthe string to put on the clipboardoptionsoptional object with options for the write:persistkeep the data on the clipboard after the flow ends (defaultfalse)formatwhich clipboard format to write -"text"(the default),"html"or"unicode". Any other string is passed to Windows as a raw clipboard format name.
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 });
// Put HTML on the clipboard
Clipboard.set('<b>bold</b>', { format: 'html' });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();