UNPKG

@carbon/ibm-cloud-cognitive-cdai

Version:
20 lines (19 loc) 647 B
// // Copyright IBM Corp. 2020, 2020 // // This source code is licensed under the Apache-2.0 license found in the // LICENSE file in the root directory of this source tree. // export var copyToClipboard = function copyToClipboard(event, content) { var field = document.createElement('textarea'); event.currentTarget.parentNode.appendChild(field); field.textContent = content; field.select(); document.execCommand('copy'); event.currentTarget.parentNode.removeChild(field); }; export var copyContentToClipboard = function copyContentToClipboard(content) { return function (event) { return copyToClipboard(event, content); }; };