Skip to content

Commit cd135a2

Browse files
author
Gianfranco
committed
React Devtools Component: Add hotkeys to start inspecting node
1 parent 6470e0f commit cd135a2

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

packages/react-devtools-extensions/chrome/manifest.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,15 @@
4848
"js": ["build/injectGlobalHook.js"],
4949
"run_at": "document_start"
5050
}
51-
]
51+
],
52+
53+
"commands": {
54+
"inspect_node": {
55+
"suggested_key": {
56+
"default": "Ctrl+Shift+X",
57+
"mac": "Command+Shift+X"
58+
},
59+
"description": "Toggle on element/node inspector on React Devtools Component"
60+
}
61+
}
5262
}

packages/react-devtools-extensions/src/main.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,18 @@ function createPanelIfReactLoaded() {
319319
});
320320
});
321321
});
322+
323+
// Add hotkeys/commands here
324+
chrome.commands.onCommand.addListener(command => {
325+
switch (command) {
326+
case 'inspect_node': {
327+
bridge.send('startInspectingNative');
328+
return;
329+
}
330+
default:
331+
return;
332+
}
333+
});
322334
},
323335
);
324336
}

packages/react-devtools-shared/src/devtools/views/Components/InspectHostNodesToggle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function InspectHostNodesToggle() {
4343
<Toggle
4444
onChange={handleChange}
4545
isChecked={isInspecting}
46-
title="Select an element in the page to inspect it">
46+
title="Select an element in the page to inspect it (Cmd/Ctrl Shift X)">
4747
<ButtonIcon type="search" />
4848
</Toggle>
4949
);

0 commit comments

Comments
 (0)