From 7093a932f8d9979fc4ede5aba333dcebc0b782ac Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Tue, 16 Mar 2021 14:54:53 -0700 Subject: [PATCH] expose client.writeTextToClipboard Summary: per title Reviewed By: priteshrnandgaonkar Differential Revision: D27044508 fbshipit-source-id: 8af99f66ec8203b76ccb3d880e1a184193a389c7 --- desktop/flipper-plugin/src/plugin/PluginBase.tsx | 6 ++++++ docs/extending/flipper-plugin.mdx | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/desktop/flipper-plugin/src/plugin/PluginBase.tsx b/desktop/flipper-plugin/src/plugin/PluginBase.tsx index 0694d109f..906c08d7d 100644 --- a/desktop/flipper-plugin/src/plugin/PluginBase.tsx +++ b/desktop/flipper-plugin/src/plugin/PluginBase.tsx @@ -86,6 +86,11 @@ export interface BasePluginClient { * Clicking the notification will open this plugin. If the `action` id is set, it will be used as deeplink. */ showNotification(notification: Notification): void; + + /** + * Writes text to the clipboard of the Operating System + */ + writeTextToClipboard(text: string): void; } let currentPluginInstance: BasePluginInstance | undefined = undefined; @@ -272,6 +277,7 @@ export abstract class BasePluginInstance { this.menuEntries.push(normalizeMenuEntry(entry)); } }, + writeTextToClipboard: this.flipperLib.writeTextToClipboard, createPaste: this.flipperLib.createPaste, GK: this.flipperLib.GK, showNotification: (notification: Notification) => { diff --git a/docs/extending/flipper-plugin.mdx b/docs/extending/flipper-plugin.mdx index b46dbfb8b..936e53800 100644 --- a/docs/extending/flipper-plugin.mdx +++ b/docs/extending/flipper-plugin.mdx @@ -295,6 +295,12 @@ interface Notification { }; ``` +#### `writeTextToClipboard` + +Usage: `writeTextToClipboard(text: string)` + +Writes text to the OS-level clipboard. + #### `createPaste` Facebook only API.