hedgedoc/frontend/src/hooks/common/use-note-markdown-content.ts
Tilman Vatteroth 6698450461 fix(frontend): make note details in redux optional
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-09-09 09:40:06 +02:00

15 lines
477 B
TypeScript

/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useApplicationState } from './use-application-state'
/**
* Extracts the markdown content of the current note from the global application state.
*
* @return The markdown content of the note
*/
export const useNoteMarkdownContent = (): string => {
return useApplicationState((state) => state.noteDetails?.markdownContent.plain ?? '')
}