mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
fix: remove redundant note detail props
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
cdfcd325a1
commit
77f858bff8
13 changed files with 12 additions and 49 deletions
|
@ -60,10 +60,10 @@ const buildStateFromMarkdownContentAndLines = (
|
|||
lines: markdownContentLines,
|
||||
lineStartIndexes
|
||||
},
|
||||
startOfContentLineOffset: 0,
|
||||
rawFrontmatter: '',
|
||||
title: generateNoteTitle(initialState.frontmatter, state.firstHeading),
|
||||
frontmatter: initialState.frontmatter,
|
||||
frontmatterRendererInfo: initialState.frontmatterRendererInfo
|
||||
frontmatter: initialState.frontmatter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,11 +88,7 @@ const buildStateFromFrontmatterUpdate = (
|
|||
rawFrontmatter: frontmatterExtraction.rawText,
|
||||
frontmatter: frontmatter,
|
||||
title: generateNoteTitle(frontmatter, state.firstHeading),
|
||||
frontmatterRendererInfo: {
|
||||
lineOffset: frontmatterExtraction.lineOffset,
|
||||
frontmatterInvalid: false,
|
||||
slideOptions: frontmatter.slideOptions
|
||||
}
|
||||
startOfContentLineOffset: frontmatterExtraction.lineOffset
|
||||
}
|
||||
} catch (e) {
|
||||
return {
|
||||
|
@ -100,11 +96,7 @@ const buildStateFromFrontmatterUpdate = (
|
|||
title: generateNoteTitle(initialState.frontmatter, state.firstHeading),
|
||||
rawFrontmatter: frontmatterExtraction.rawText,
|
||||
frontmatter: initialState.frontmatter,
|
||||
frontmatterRendererInfo: {
|
||||
lineOffset: frontmatterExtraction.lineOffset,
|
||||
frontmatterInvalid: true,
|
||||
slideOptions: initialState.frontmatterRendererInfo.slideOptions
|
||||
}
|
||||
startOfContentLineOffset: frontmatterExtraction.lineOffset
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,7 @@ export const initialState: NoteDetails = {
|
|||
},
|
||||
selection: { from: 0 },
|
||||
rawFrontmatter: '',
|
||||
frontmatterRendererInfo: {
|
||||
frontmatterInvalid: false,
|
||||
lineOffset: 0,
|
||||
slideOptions: initialSlideOptions
|
||||
},
|
||||
startOfContentLineOffset: 0,
|
||||
id: '',
|
||||
createdAt: 0,
|
||||
updatedAt: 0,
|
||||
|
@ -52,8 +48,6 @@ export const initialState: NoteDetails = {
|
|||
lang: 'en',
|
||||
dir: NoteTextDirection.LTR,
|
||||
newlinesAreBreaks: true,
|
||||
GA: '',
|
||||
disqus: '',
|
||||
license: '',
|
||||
type: NoteType.DOCUMENT,
|
||||
opengraph: {},
|
||||
|
|
|
@ -39,8 +39,6 @@ const parseRawNoteFrontmatter = (rawData: RawNoteFrontmatter): NoteFrontmatter =
|
|||
description: rawData.description ?? initialState.frontmatter.description,
|
||||
robots: rawData.robots ?? initialState.frontmatter.robots,
|
||||
newlinesAreBreaks: parseBoolean(rawData.breaks) ?? initialState.frontmatter.newlinesAreBreaks,
|
||||
GA: rawData.GA ?? initialState.frontmatter.GA,
|
||||
disqus: rawData.disqus ?? initialState.frontmatter.disqus,
|
||||
lang: parseLanguage(rawData),
|
||||
type: parseNoteType(rawData),
|
||||
dir: parseTextDirection(rawData),
|
||||
|
|
|
@ -12,8 +12,6 @@ export interface RawNoteFrontmatter {
|
|||
lang: string | undefined
|
||||
dir: string | undefined
|
||||
breaks: boolean | undefined
|
||||
GA: string | undefined
|
||||
disqus: string | undefined
|
||||
license: string | undefined
|
||||
type: string | undefined
|
||||
slideOptions: { [key: string]: string } | null
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
import type { Note } from '../../../api/notes/types'
|
||||
import * as buildStateFromUpdatedMarkdownContentModule from '../build-state-from-updated-markdown-content'
|
||||
import { initialSlideOptions } from '../initial-state'
|
||||
import type { NoteDetails } from '../types/note-details'
|
||||
import { buildStateFromServerDto } from './build-state-from-set-note-data-from-server'
|
||||
import { NoteTextDirection, NoteType } from '@hedgedoc/commons'
|
||||
|
@ -88,8 +87,6 @@ describe('build state from set note data from server', () => {
|
|||
license: '',
|
||||
dir: NoteTextDirection.LTR,
|
||||
newlinesAreBreaks: true,
|
||||
GA: '',
|
||||
disqus: '',
|
||||
type: NoteType.DOCUMENT,
|
||||
opengraph: {},
|
||||
slideOptions: {
|
||||
|
@ -100,11 +97,7 @@ describe('build state from set note data from server', () => {
|
|||
slideNumber: false
|
||||
}
|
||||
},
|
||||
frontmatterRendererInfo: {
|
||||
frontmatterInvalid: false,
|
||||
lineOffset: 0,
|
||||
slideOptions: initialSlideOptions
|
||||
},
|
||||
startOfContentLineOffset: 0,
|
||||
title: 'title',
|
||||
selection: { from: 0 },
|
||||
markdownContent: {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
import type { NoteMetadata } from '../../../api/notes/types'
|
||||
import type { CursorSelection } from '../../../components/editor-page/editor-pane/tool-bar/formatters/types/cursor-selection'
|
||||
import type { SlideOptions } from '@hedgedoc/commons'
|
||||
import type { NoteFrontmatter } from '@hedgedoc/commons'
|
||||
|
||||
type UnnecessaryNoteAttributes = 'updatedAt' | 'createdAt' | 'tags' | 'description'
|
||||
|
@ -25,11 +24,5 @@ export interface NoteDetails extends Omit<NoteMetadata, UnnecessaryNoteAttribute
|
|||
firstHeading?: string
|
||||
rawFrontmatter: string
|
||||
frontmatter: NoteFrontmatter
|
||||
frontmatterRendererInfo: RendererFrontmatterInfo
|
||||
}
|
||||
|
||||
export interface RendererFrontmatterInfo {
|
||||
lineOffset: number
|
||||
frontmatterInvalid: boolean
|
||||
slideOptions: SlideOptions
|
||||
startOfContentLineOffset: number
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue