How to monitor whether it is in full-screen mode? #7823
Replies: 1 comment 3 replies
-
|
Trilium doesn't provide a built-in frontend API or event for monitoring full-screen mode changes. However, you can use the browser's Fullscreen API to listen for changes. For example, you can add an event listener for fullscreen changes and update your component state accordingly: useEffect(() => {
function handleFullscreenChange() {
setIsFullscreen(!!document.fullscreenElement);
}
document.addEventListener('fullscreenchange', handleFullscreenChange);
return () => {
document.removeEventListener('fullscreenchange', handleFullscreenChange);
};
}, []);You can then conditionally render components based on the To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
On a whim, certain components can be displayed when in full-screen mode, and they can be hidden when not in full-screen. Is there a way for the frontend API to listen for this?
Beta Was this translation helpful? Give feedback.
All reactions