You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
18 lines
528 B
TypeScript
18 lines
528 B
TypeScript
import { useMemo } from 'react';
|
|
import { EditorCursorLocations, NoteIdToEditorCursorLocations } from '../../../app.reducer';
|
|
|
|
interface Props {
|
|
lastEditorCursorLocations: NoteIdToEditorCursorLocations;
|
|
noteId: string;
|
|
}
|
|
|
|
const useInitialCursorLocation = ({ noteId, lastEditorCursorLocations }: Props) => {
|
|
const lastCursorLocation = lastEditorCursorLocations[noteId];
|
|
|
|
return useMemo((): EditorCursorLocations => {
|
|
return lastCursorLocation ?? { };
|
|
}, [lastCursorLocation]);
|
|
};
|
|
|
|
export default useInitialCursorLocation;
|