From e7591b2a81cdee11880273dcf16e21acfe722cb0 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Wed, 13 Jul 2022 01:38:55 -0700 Subject: [PATCH] Set clearLogs accelerator for log-rendering plugins Summary: Sets a default key binding of `ctrl+l` to clear the screen within built-in Flipper plugins which display a log view. Motivation: A small quality of life improvement for developers used to the default "clear screen" binding. This makes our log-rendering plugins consistent with other native apps such as terminals, Chrome DevTools, and many others. Reviewed By: mweststrate Differential Revision: D37782638 fbshipit-source-id: 0a85b930faaa0e9468d5391f15092aad7b6057ee --- desktop/pkg/src/__tests__/runInit.node.tsx | 2 ++ desktop/pkg/templates/device-plugin/src/index.tsx.template | 1 + desktop/pkg/templates/plugin/src/index.tsx.template | 1 + desktop/plugins/public/logs/index.tsx | 1 + desktop/plugins/public/network/index.tsx | 1 + 5 files changed, 6 insertions(+) diff --git a/desktop/pkg/src/__tests__/runInit.node.tsx b/desktop/pkg/src/__tests__/runInit.node.tsx index abe953c3c..f01f03bd1 100644 --- a/desktop/pkg/src/__tests__/runInit.node.tsx +++ b/desktop/pkg/src/__tests__/runInit.node.tsx @@ -190,6 +190,7 @@ test.skip('It generates the correct files for client plugin', async () => { handler: async () => { data.set({}); }, + accelerator: 'ctrl+l', }); return {data}; @@ -388,6 +389,7 @@ test.skip('It generates the correct files for device plugin', async () => { handler: async () => { data.set([]); }, + accelerator: 'ctrl+l', }); return {data}; diff --git a/desktop/pkg/templates/device-plugin/src/index.tsx.template b/desktop/pkg/templates/device-plugin/src/index.tsx.template index cc934cade..138bf99aa 100644 --- a/desktop/pkg/templates/device-plugin/src/index.tsx.template +++ b/desktop/pkg/templates/device-plugin/src/index.tsx.template @@ -23,6 +23,7 @@ export function devicePlugin(client: DevicePluginClient) { handler: async () => { data.set([]); }, + accelerator: 'ctrl+l', }); return {data}; diff --git a/desktop/pkg/templates/plugin/src/index.tsx.template b/desktop/pkg/templates/plugin/src/index.tsx.template index ce0f6af89..81c50f85b 100644 --- a/desktop/pkg/templates/plugin/src/index.tsx.template +++ b/desktop/pkg/templates/plugin/src/index.tsx.template @@ -26,6 +26,7 @@ export function plugin(client: PluginClient) { handler: async () => { data.set({}); }, + accelerator: 'ctrl+l', }); return {data}; diff --git a/desktop/plugins/public/logs/index.tsx b/desktop/plugins/public/logs/index.tsx index 578b9f8f2..517596672 100644 --- a/desktop/plugins/public/logs/index.tsx +++ b/desktop/plugins/public/logs/index.tsx @@ -139,6 +139,7 @@ export function devicePlugin(client: DevicePluginClient) { { action: 'clear', handler: clearLogs, + accelerator: 'ctrl+l', }, { action: 'createPaste', diff --git a/desktop/plugins/public/network/index.tsx b/desktop/plugins/public/network/index.tsx index 51e5ce5ce..b9ce02eb1 100644 --- a/desktop/plugins/public/network/index.tsx +++ b/desktop/plugins/public/network/index.tsx @@ -148,6 +148,7 @@ export function plugin(client: PluginClient) { client.addMenuEntry({ action: 'clear', handler: clearLogs, + accelerator: 'ctrl+l', }); client.onConnect(() => {