diff options
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index ce4f7ac3e..c9c006aa8 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -31,6 +31,18 @@ export class Utils { return { scale, translateX, translateY }; } + public static CopyText(text: string) { + var textArea = document.createElement("textarea"); + textArea.value = text; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + + try { document.execCommand('copy'); } catch (err) { } + + document.body.removeChild(textArea); + } + public static Emit<T>(socket: Socket | SocketIOClient.Socket, message: Message<T>, args: T) { socket.emit(message.Message, args); } |