fix(#440) open dev tools from menu

This commit is contained in:
Michał Szymborski 2023-10-07 23:41:55 +02:00
parent 856236c918
commit 6d8bdfa276
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) => {