mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
chore(react/type_widget): bring back update interval
This commit is contained in:
@@ -75,11 +75,12 @@ export function useSpacedUpdate(callback: () => void | Promise<void>, interval =
|
||||
return spacedUpdateRef.current;
|
||||
}
|
||||
|
||||
export function useEditorSpacedUpdate({ note, getData, onContentChange, dataSaved }: {
|
||||
export function useEditorSpacedUpdate({ note, getData, onContentChange, dataSaved, updateInterval }: {
|
||||
note: FNote,
|
||||
getData: () => Promise<object | undefined> | object | undefined,
|
||||
onContentChange: (newContent: string) => void,
|
||||
dataSaved?: () => void
|
||||
dataSaved?: () => void,
|
||||
updateInterval?: number;
|
||||
}) {
|
||||
const parentComponent = useContext(ParentComponent);
|
||||
const blob = useNoteBlob(note, parentComponent?.componentId);
|
||||
@@ -105,6 +106,9 @@ export function useEditorSpacedUpdate({ note, getData, onContentChange, dataSave
|
||||
spacedUpdate.allowUpdateWithoutChange(() => onContentChange(blob.content));
|
||||
}, [ blob ]);
|
||||
|
||||
// React to update interval changes.
|
||||
useEffect(() => spacedUpdate.setUpdateInterval(updateInterval), [ updateInterval ]);
|
||||
|
||||
return spacedUpdate;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user