Merge pull request #459 from lared/feature/show-devtools

fix(#440) open dev tools from menu
This commit is contained in:
Anoop M D 2023-10-08 04:10:16 +05:30 committed by GitHub
commit c479c2e786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -18,6 +18,7 @@ const TitleBar = () => {
const [importCollectionModalOpen, setImportCollectionModalOpen] = useState(false);
const [importCollectionLocationModalOpen, setImportCollectionLocationModalOpen] = useState(false);
const dispatch = useDispatch();
const { ipcRenderer } = window;
const handleImportCollection = (collection) => {
setImportedCollection(collection);
@ -50,6 +51,10 @@ const TitleBar = () => {
);
};
const openDevTools = () => {
ipcRenderer.invoke('renderer:open-devtools');
};
return (
<StyledWrapper className="px-2 py-2">
{createCollectionModalOpen ? <CreateCollection onClose={() => setCreateCollectionModalOpen(false)} /> : null}
@ -104,6 +109,15 @@ const TitleBar = () => {
>
Import Collection
</div>
<div
className="dropdown-item"
onClick={(e) => {
menuDropdownTippyRef.current.hide();
openDevTools();
}}
>
Devtools
</div>
</Dropdown>
</div>
</div>

View File

@ -486,6 +486,10 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
return Promise.reject(error);
}
});
ipcMain.handle('renderer:open-devtools', async () => {
mainWindow.webContents.openDevTools();
});
};
const registerMainEventHandlers = (mainWindow, watcher, lastOpenedCollections) => {