mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +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(() => {
|
useEffect(() => {
|
||||||
if (apiRef.current || !containerRef.current) return;
|
if (apiRef.current || !containerRef.current) return;
|
||||||
|
|
||||||
apiRef.current = new Reveal(containerRef.current, {
|
const api = new Reveal(containerRef.current, {
|
||||||
transition: "slide",
|
transition: "slide",
|
||||||
embedded: true,
|
embedded: true,
|
||||||
keyboardCondition(event) {
|
keyboardCondition(event) {
|
||||||
@ -85,16 +85,18 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation:
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
externalApiRef.current = apiRef.current;
|
externalApiRef.current = apiRef.current;
|
||||||
apiRef.current.initialize().then(() => {
|
api.initialize().then(() => {
|
||||||
// Initialization logic.
|
apiRef.current = api;
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (apiRef.current) {
|
api.destroy();
|
||||||
apiRef.current.destroy();
|
|
||||||
apiRef.current = null;
|
apiRef.current = null;
|
||||||
}
|
}
|
||||||
}
|
}, [ ]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
apiRef.current?.sync();
|
||||||
}, [ presentation ]);
|
}, [ presentation ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user