Add image placeholder and upload indicating frame (#1666)

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
Co-authored-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Tilman Vatteroth 2021-12-11 15:34:33 +01:00 committed by GitHub
parent 58fecc0b3a
commit d4251519e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 908 additions and 72 deletions

View file

@ -7,6 +7,7 @@
import { store } from '..'
import type { NoteDto } from '../../api/notes/types'
import type {
ReplaceInMarkdownContentAction,
SetNoteDetailsFromServerAction,
SetNoteDocumentContentAction,
UpdateNoteTitleByFirstHeadingAction,
@ -49,6 +50,7 @@ export const updateNoteTitleByFirstHeading = (firstHeading?: string): void => {
/**
* Changes a checkbox state in the note document content. Triggered when a checkbox in the rendering is clicked.
*
* @param lineInDocumentContent The line in the document content to change.
* @param checked true if the checkbox is checked, false otherwise.
*/
@ -59,3 +61,17 @@ export const setCheckboxInMarkdownContent = (lineInDocumentContent: number, chec
changedLine: lineInDocumentContent
} as UpdateTaskListCheckboxAction)
}
/**
* Replaces a string in the markdown content in the global application state.
*
* @param replaceable The string that should be replaced
* @param replacement The replacement for the replaceable
*/
export const replaceInMarkdownContent = (replaceable: string, replacement: string): void => {
store.dispatch({
type: NoteDetailsActionType.REPLACE_IN_MARKDOWN_CONTENT,
placeholder: replaceable,
replacement
} as ReplaceInMarkdownContentAction)
}