mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	fix(client): touch bar triggering on server
This commit is contained in:
		
							parent
							
								
									f01a772d8d
								
							
						
					
					
						commit
						1cffff77bf
					
				| @ -2,7 +2,7 @@ import { useContext, useEffect, useMemo, useState } from "preact/hooks"; | |||||||
| import { ParentComponent } from "./react_utils"; | import { ParentComponent } from "./react_utils"; | ||||||
| import { ComponentChildren, createContext } from "preact"; | import { ComponentChildren, createContext } from "preact"; | ||||||
| import { TouchBarItem } from "../../components/touch_bar"; | import { TouchBarItem } from "../../components/touch_bar"; | ||||||
| import { dynamicRequire } from "../../services/utils"; | import { dynamicRequire, isElectron, isMac } from "../../services/utils"; | ||||||
| 
 | 
 | ||||||
| interface TouchBarProps { | interface TouchBarProps { | ||||||
|     children: ComponentChildren; |     children: ComponentChildren; | ||||||
| @ -51,6 +51,10 @@ interface TouchBarContextApi { | |||||||
| const TouchBarContext = createContext<TouchBarContextApi | null>(null); | const TouchBarContext = createContext<TouchBarContextApi | null>(null); | ||||||
| 
 | 
 | ||||||
| export default function TouchBar({ children }: TouchBarProps) { | export default function TouchBar({ children }: TouchBarProps) { | ||||||
|  |     if (!isElectron() || !isMac()) { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     const [ isFocused, setIsFocused ] = useState(false); |     const [ isFocused, setIsFocused ] = useState(false); | ||||||
|     const parentComponent = useContext(ParentComponent); |     const parentComponent = useContext(ParentComponent); | ||||||
|     const remote = dynamicRequire("@electron/remote") as typeof import("@electron/remote"); |     const remote = dynamicRequire("@electron/remote") as typeof import("@electron/remote"); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran