Skip to content

Commit 5f6c47f

Browse files
committed
Add shell module to electron-preload.ts and update openUrl function in Landing.vue
1 parent 7a52050 commit 5f6c47f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src-electron/electron-preload.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { contextBridge, ipcRenderer } from 'electron'
1+
import { contextBridge, ipcRenderer, shell } from 'electron'
22

33
contextBridge.exposeInMainWorld('ipcRenderer', { //exposes to main script for global access via electron
44
invoke: ipcRenderer.invoke,
55
on: ipcRenderer.on,
6-
// add other methods you need
6+
shell: shell
7+
// add other methods to be used from electron that need to be exposed for use beforehand
78
})
89

910
/**

src/components/right-sidebar/tutorial/Landing.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ const nextTab = () => emit("nextTab");
4343
const store = useStore();
4444
const toggleTutorial = () => store.toggleTutorial();
4545
46-
const openUrl = (url: string) => shell.openExternal(url, { activate: true });
46+
const openUrl = (url: string) => {
47+
if (window.ipcRenderer && window.ipcRenderer.shell) {
48+
window.ipcRenderer.shell.openExternal(url);
49+
} else {
50+
window.open(url, '_blank');
51+
}
52+
};
4753
</script>
4854

4955
<style lang="scss" scoped>

0 commit comments

Comments
 (0)