mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
Move frontmatter extraction from renderer to redux (#1413)
This commit is contained in:
parent
7fb7c55877
commit
04e16d8880
34 changed files with 680 additions and 589 deletions
|
@ -11,8 +11,7 @@ import { useDocumentTitleWithNoteTitle } from '../../hooks/common/use-document-t
|
|||
import { useNoteMarkdownContent } from '../../hooks/common/use-note-markdown-content'
|
||||
import {
|
||||
setCheckboxInMarkdownContent,
|
||||
setNoteFrontmatter,
|
||||
setNoteMarkdownContent,
|
||||
setNoteContent,
|
||||
updateNoteTitleByFirstHeading
|
||||
} from '../../redux/note-details/methods'
|
||||
import { MotdBanner } from '../common/motd-banner/motd-banner'
|
||||
|
@ -50,6 +49,7 @@ export const EditorPage: React.FC = () => {
|
|||
const markdownContent = useNoteMarkdownContent()
|
||||
const scrollSource = useRef<ScrollSource>(ScrollSource.EDITOR)
|
||||
|
||||
const documentContent = useApplicationState((state) => state.noteDetails.documentContent)
|
||||
const editorMode: EditorMode = useApplicationState((state) => state.editorConfig.editorMode)
|
||||
const editorSyncScroll: boolean = useApplicationState((state) => state.editorConfig.syncScroll)
|
||||
|
||||
|
@ -98,14 +98,14 @@ export const EditorPage: React.FC = () => {
|
|||
const leftPane = useMemo(
|
||||
() => (
|
||||
<EditorPane
|
||||
onContentChange={setNoteMarkdownContent}
|
||||
content={markdownContent}
|
||||
onContentChange={setNoteContent}
|
||||
content={documentContent}
|
||||
scrollState={scrollState.editorScrollState}
|
||||
onScroll={onEditorScroll}
|
||||
onMakeScrollSource={setEditorToScrollSource}
|
||||
/>
|
||||
),
|
||||
[markdownContent, onEditorScroll, scrollState.editorScrollState, setEditorToScrollSource]
|
||||
[documentContent, onEditorScroll, scrollState.editorScrollState, setEditorToScrollSource]
|
||||
)
|
||||
|
||||
const rightPane = useMemo(
|
||||
|
@ -116,7 +116,6 @@ export const EditorPage: React.FC = () => {
|
|||
onMakeScrollSource={setRendererToScrollSource}
|
||||
onFirstHeadingChange={updateNoteTitleByFirstHeading}
|
||||
onTaskCheckedChange={setCheckboxInMarkdownContent}
|
||||
onFrontmatterChange={setNoteFrontmatter}
|
||||
onScroll={onMarkdownRendererScroll}
|
||||
scrollState={scrollState.rendererScrollState}
|
||||
rendererType={RendererType.DOCUMENT}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue