mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 00:05:50 +01:00
fix(react/dialogs): some type errors
This commit is contained in:
15
apps/client/src/widgets/react/react_utils.ts
Normal file
15
apps/client/src/widgets/react/react_utils.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { RefObject } from "preact";
|
||||
|
||||
/**
|
||||
* Takes in a React ref and returns a corresponding JQuery selector.
|
||||
*
|
||||
* @param ref the React ref from which to obtain the jQuery selector.
|
||||
* @returns the corresponding jQuery selector.
|
||||
*/
|
||||
export function refToJQuerySelector<T extends HTMLElement>(ref: RefObject<T> | null): JQuery<T> {
|
||||
if (ref?.current) {
|
||||
return $(ref.current);
|
||||
} else {
|
||||
return $();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user