UNPKG

@itwin/frontend-devtools

Version:

Debug menu and supporting UI widgets

26 lines 1.14 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Utilities */ Object.defineProperty(exports, "__esModule", { value: true }); exports.copyStringToClipboard = copyStringToClipboard; /** Copy the input string to the system clipboard. * Obtained from https://techoverflow.net/2018/03/30/copying-strings-to-the-clipboard-using-pure-javascript/ * @beta */ function copyStringToClipboard(str) { const el = document.createElement("textarea"); el.value = str; el.setAttribute("readonly", ""); el.style.position = "absolute"; el.style.left = "-9999px"; document.body.appendChild(el); el.select(); document.execCommand("copy"); // eslint-disable-line @typescript-eslint/no-deprecated document.body.removeChild(el); } //# sourceMappingURL=ClipboardUtilities.js.map