mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-27 13:34:28 -04:00
Add prettier for codestyle and re-format everything (#1294)
This commit is contained in:
parent
8b78154075
commit
0aae1f70d2
319 changed files with 4809 additions and 3936 deletions
|
@ -52,7 +52,10 @@ export const initialState: NoteDetails = {
|
|||
}
|
||||
}
|
||||
|
||||
export const NoteDetailsReducer: Reducer<NoteDetails, NoteDetailsAction> = (state: NoteDetails = initialState, action: NoteDetailsAction) => {
|
||||
export const NoteDetailsReducer: Reducer<NoteDetails, NoteDetailsAction> = (
|
||||
state: NoteDetails = initialState,
|
||||
action: NoteDetailsAction
|
||||
) => {
|
||||
switch (action.type) {
|
||||
case NoteDetailsActionType.SET_DOCUMENT_CONTENT:
|
||||
return {
|
||||
|
@ -94,7 +97,7 @@ const setCheckboxInMarkdownContent = (markdownContent: string, lineInMarkdown: n
|
|||
if (results) {
|
||||
const before = results[1]
|
||||
const after = results[3]
|
||||
lines[lineInMarkdown] = `${ before }[${ checked ? 'x' : ' ' }]${ after }`
|
||||
lines[lineInMarkdown] = `${before}[${checked ? 'x' : ' '}]${after}`
|
||||
return lines.join('\n')
|
||||
}
|
||||
return markdownContent
|
||||
|
@ -103,11 +106,13 @@ const setCheckboxInMarkdownContent = (markdownContent: string, lineInMarkdown: n
|
|||
const generateNoteTitle = (frontmatter: NoteFrontmatter, firstHeading?: string) => {
|
||||
if (frontmatter?.title && frontmatter?.title !== '') {
|
||||
return frontmatter.title.trim()
|
||||
} else if (frontmatter?.opengraph && frontmatter?.opengraph.get('title') && frontmatter?.opengraph.get('title') !== '') {
|
||||
} else if (
|
||||
frontmatter?.opengraph &&
|
||||
frontmatter?.opengraph.get('title') &&
|
||||
frontmatter?.opengraph.get('title') !== ''
|
||||
) {
|
||||
return (frontmatter?.opengraph.get('title') ?? firstHeading ?? '').trim()
|
||||
} else {
|
||||
return (firstHeading ?? firstHeading ?? '').trim()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue