note window opening

This commit is contained in:
nicwands
2026-02-23 11:42:22 -05:00
parent c436488f9d
commit 660b0825c5
18 changed files with 9687 additions and 9232 deletions

View File

@@ -1,20 +1,24 @@
import { contextBridge } from 'electron'
import { contextBridge, ipcRenderer } from 'electron'
import { electronAPI } from '@electron-toolkit/preload'
// Custom APIs for renderer
const api = {}
const api = {
openNoteWindow: (noteId) => {
ipcRenderer.send('open-note-window', noteId)
},
}
// Use `contextBridge` APIs to expose Electron APIs to
// renderer only if context isolation is enabled, otherwise
// just add to the DOM global.
if (process.contextIsolated) {
try {
contextBridge.exposeInMainWorld('electron', electronAPI)
contextBridge.exposeInMainWorld('api', api)
} catch (error) {
console.error(error)
}
try {
contextBridge.exposeInMainWorld('electron', electronAPI)
contextBridge.exposeInMainWorld('api', api)
} catch (error) {
console.error(error)
}
} else {
window.electron = electronAPI
window.api = api
window.electron = electronAPI
window.api = api
}