mirror of
https://github.com/zadam/trilium.git
synced 2025-10-19 22:58:52 +02:00
feat(collection/presentation): use sync instead of full reload
This commit is contained in:
parent
66ba4a596c
commit
4d772ab48d
@ -72,7 +72,7 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation:
|
||||
useEffect(() => {
|
||||
if (apiRef.current || !containerRef.current) return;
|
||||
|
||||
apiRef.current = new Reveal(containerRef.current, {
|
||||
const api = new Reveal(containerRef.current, {
|
||||
transition: "slide",
|
||||
embedded: true,
|
||||
keyboardCondition(event) {
|
||||
@ -85,16 +85,18 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation:
|
||||
},
|
||||
});
|
||||
externalApiRef.current = apiRef.current;
|
||||
apiRef.current.initialize().then(() => {
|
||||
// Initialization logic.
|
||||
api.initialize().then(() => {
|
||||
apiRef.current = api;
|
||||
});
|
||||
|
||||
return () => {
|
||||
if (apiRef.current) {
|
||||
apiRef.current.destroy();
|
||||
apiRef.current = null;
|
||||
}
|
||||
api.destroy();
|
||||
apiRef.current = null;
|
||||
}
|
||||
}, [ ]);
|
||||
|
||||
useEffect(() => {
|
||||
apiRef.current?.sync();
|
||||
}, [ presentation ]);
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user