mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-27 13:34:28 -04:00
added upload functionality (#758)
Co-authored-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
8ce344512c
commit
0c0841639a
20 changed files with 401 additions and 73 deletions
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { store } from '..'
|
||||
import { DocumentContentActionType, SetDocumentContentAction } from './types'
|
||||
import { DocumentContentActionType, SetDocumentContentAction, SetNoteIdAction } from './types'
|
||||
|
||||
export const setDocumentContent = (content: string): void => {
|
||||
const action: SetDocumentContentAction = {
|
||||
|
@ -14,3 +14,11 @@ export const setDocumentContent = (content: string): void => {
|
|||
}
|
||||
store.dispatch(action)
|
||||
}
|
||||
|
||||
export const setNoteId = (noteId: string): void => {
|
||||
const action: SetNoteIdAction = {
|
||||
type: DocumentContentActionType.SET_NOTE_ID,
|
||||
noteId: noteId
|
||||
}
|
||||
store.dispatch(action)
|
||||
}
|
||||
|
|
|
@ -5,16 +5,31 @@
|
|||
*/
|
||||
|
||||
import { Reducer } from 'redux'
|
||||
import { DocumentContent, DocumentContentAction, DocumentContentActionType, SetDocumentContentAction } from './types'
|
||||
import {
|
||||
DocumentContent,
|
||||
DocumentContentAction,
|
||||
DocumentContentActionType,
|
||||
SetDocumentContentAction,
|
||||
SetNoteIdAction
|
||||
} from './types'
|
||||
|
||||
export const initialState: DocumentContent = {
|
||||
content: ''
|
||||
content: '',
|
||||
noteId: ''
|
||||
}
|
||||
|
||||
export const DocumentContentReducer: Reducer<DocumentContent, DocumentContentAction> = (state: DocumentContent = initialState, action: DocumentContentAction) => {
|
||||
switch (action.type) {
|
||||
case DocumentContentActionType.SET_DOCUMENT_CONTENT:
|
||||
return { content: (action as SetDocumentContentAction).content }
|
||||
return {
|
||||
...state,
|
||||
content: (action as SetDocumentContentAction).content
|
||||
}
|
||||
case DocumentContentActionType.SET_NOTE_ID:
|
||||
return {
|
||||
...state,
|
||||
noteId: (action as SetNoteIdAction).noteId
|
||||
}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ import { Action } from 'redux'
|
|||
|
||||
export enum DocumentContentActionType {
|
||||
SET_DOCUMENT_CONTENT = 'document-content/set',
|
||||
SET_NOTE_ID = 'document-content/noteid/set'
|
||||
}
|
||||
|
||||
export interface DocumentContent {
|
||||
content: string
|
||||
noteId: string
|
||||
}
|
||||
|
||||
export interface DocumentContentAction extends Action<DocumentContentActionType> {
|
||||
|
@ -21,3 +23,7 @@ export interface DocumentContentAction extends Action<DocumentContentActionType>
|
|||
export interface SetDocumentContentAction extends DocumentContentAction {
|
||||
content: string
|
||||
}
|
||||
|
||||
export interface SetNoteIdAction extends DocumentContentAction {
|
||||
noteId: string
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue