mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
refactor: change return type of frontmatter extractor to use undefined
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
77f858bff8
commit
4d0a2cb79e
5 changed files with 29 additions and 56 deletions
|
@ -8,7 +8,7 @@ import { initialState } from './initial-state'
|
|||
import { createNoteFrontmatterFromYaml } from './raw-note-frontmatter-parser/parser'
|
||||
import type { NoteDetails } from './types/note-details'
|
||||
import { extractFrontmatter, generateNoteTitle } from '@hedgedoc/commons'
|
||||
import type { PresentFrontmatterExtractionResult } from '@hedgedoc/commons'
|
||||
import type { FrontmatterExtractionResult } from '@hedgedoc/commons'
|
||||
|
||||
/**
|
||||
* Copies a {@link NoteDetails} but with another markdown content.
|
||||
|
@ -40,7 +40,7 @@ const buildStateFromMarkdownContentAndLines = (
|
|||
): NoteDetails => {
|
||||
const frontmatterExtraction = extractFrontmatter(markdownContentLines)
|
||||
const lineStartIndexes = calculateLineStartIndexes(markdownContentLines)
|
||||
if (frontmatterExtraction.isPresent) {
|
||||
if (frontmatterExtraction !== undefined) {
|
||||
return buildStateFromFrontmatterUpdate(
|
||||
{
|
||||
...state,
|
||||
|
@ -76,7 +76,7 @@ const buildStateFromMarkdownContentAndLines = (
|
|||
*/
|
||||
const buildStateFromFrontmatterUpdate = (
|
||||
state: NoteDetails,
|
||||
frontmatterExtraction: PresentFrontmatterExtractionResult
|
||||
frontmatterExtraction: FrontmatterExtractionResult
|
||||
): NoteDetails => {
|
||||
if (frontmatterExtraction.rawText === state.rawFrontmatter) {
|
||||
return state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue