Copy/Paste implementation
Summary: ^ Reviewed By: aigoncharov Differential Revision: D46515194 fbshipit-source-id: 0ee6931569d5248d5643b391683e230e0c095e41
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b9322247e6
commit
2815ba0fb8
@@ -63,7 +63,7 @@ export async function initializeElectron(
|
||||
processId: electronProcess.pid,
|
||||
isProduction,
|
||||
readTextFromClipboard() {
|
||||
return clipboard.readText();
|
||||
return Promise.resolve(clipboard.readText());
|
||||
},
|
||||
writeTextToClipboard(text: string) {
|
||||
clipboard.writeText(text);
|
||||
|
||||
@@ -95,7 +95,7 @@ type ChildProcessEvents = {
|
||||
* Utilities provided by the render host, e.g. Electron, the Browser, etc
|
||||
*/
|
||||
export interface RenderHost {
|
||||
readTextFromClipboard(): string | undefined;
|
||||
readTextFromClipboard(): Promise<string> | undefined;
|
||||
writeTextToClipboard(text: string): void;
|
||||
/**
|
||||
* @deprecated
|
||||
|
||||
@@ -16,12 +16,9 @@ export function initializeRenderHost(
|
||||
) {
|
||||
globalThis.FlipperRenderHostInstance = {
|
||||
readTextFromClipboard() {
|
||||
// TODO:
|
||||
return undefined;
|
||||
},
|
||||
writeTextToClipboard(_text: string) {
|
||||
// TODO:
|
||||
},
|
||||
writeTextToClipboard(_text: string) {},
|
||||
async importFile() {
|
||||
throw new Error('Not implemented');
|
||||
},
|
||||
@@ -46,9 +43,7 @@ export function initializeRenderHost(
|
||||
shouldUseDarkColors() {
|
||||
return false;
|
||||
},
|
||||
restartFlipper() {
|
||||
// TODO:
|
||||
},
|
||||
restartFlipper() {},
|
||||
serverConfig: flipperServerConfig,
|
||||
GK(gatekeeper) {
|
||||
return flipperServerConfig.gatekeepers[gatekeeper] ?? false;
|
||||
|
||||
@@ -35,12 +35,11 @@ export function initializeRenderHost(
|
||||
flipperServerConfig: FlipperServerConfig,
|
||||
) {
|
||||
FlipperRenderHostInstance = {
|
||||
readTextFromClipboard() {
|
||||
// TODO:
|
||||
return undefined;
|
||||
async readTextFromClipboard() {
|
||||
return await navigator.clipboard.readText();
|
||||
},
|
||||
writeTextToClipboard(_text: string) {
|
||||
// TODO:
|
||||
writeTextToClipboard(text: string) {
|
||||
return navigator.clipboard.writeText(text);
|
||||
},
|
||||
async importFile() {
|
||||
throw new Error('Not implemented');
|
||||
@@ -71,7 +70,7 @@ export function initializeRenderHost(
|
||||
);
|
||||
},
|
||||
restartFlipper() {
|
||||
window.flipperShowError!(
|
||||
window.flipperShowError?.(
|
||||
'Flipper settings have changed, please restart flipper server for the changes to take effect',
|
||||
);
|
||||
},
|
||||
|
||||
@@ -197,7 +197,7 @@ function createStubRenderHost(): RenderHost {
|
||||
|
||||
return {
|
||||
readTextFromClipboard() {
|
||||
return '';
|
||||
return Promise.resolve('');
|
||||
},
|
||||
writeTextToClipboard() {},
|
||||
async importFile() {
|
||||
|
||||
Reference in New Issue
Block a user