fix: remove redundant note detail props

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-05-15 21:29:28 +02:00
parent cdfcd325a1
commit 77f858bff8
13 changed files with 12 additions and 49 deletions

View file

@ -45,7 +45,7 @@ export const useOnImageUploadFromRenderer = (): void => {
const file = new File([blob], fileName, { type: blob.type })
const { cursorSelection, alt, title } = Optional.ofNullable(lineIndex)
.flatMap((actualLineIndex) => {
const lineOffset = getGlobalState().noteDetails.frontmatterRendererInfo.lineOffset
const lineOffset = getGlobalState().noteDetails.startOfContentLineOffset
return findPlaceholderInMarkdownContent(actualLineIndex + lineOffset, placeholderIndexInLine)
})
.orElse({} as ExtractResult)

View file

@ -21,8 +21,7 @@ export const useOnScrollWithLineOffset = (onScroll: ScrollCallback | undefined):
} else {
return (scrollState: ScrollState) => {
onScroll({
firstLineInView:
scrollState.firstLineInView + getGlobalState().noteDetails.frontmatterRendererInfo.lineOffset,
firstLineInView: scrollState.firstLineInView + getGlobalState().noteDetails.startOfContentLineOffset,
scrolledPercentage: scrollState.scrolledPercentage
})
}

View file

@ -14,7 +14,7 @@ import { useMemo } from 'react'
* @return the adjusted scroll state without the line offset
*/
export const useScrollStateWithoutLineOffset = (scrollState: ScrollState | undefined): ScrollState | undefined => {
const lineOffset = useApplicationState((state) => state.noteDetails.frontmatterRendererInfo.lineOffset)
const lineOffset = useApplicationState((state) => state.noteDetails.startOfContentLineOffset)
return useMemo(() => {
return scrollState === undefined
? undefined