Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
import type { LocalFile } from "../types/attachment";
import type { EditorAction, EditorState, LoadingKey } from "./types";
export const editorActions = {
initMemo: (payload: { content: string; metadata: EditorState["metadata"]; timestamps: EditorState["timestamps"] }): EditorAction => ({
type: "INIT_MEMO",
payload,
}),
updateContent: (content: string): EditorAction => ({
type: "UPDATE_CONTENT",
payload: { content },
}),
setMetadata: (metadata: Partial<EditorState["metadata"]>): EditorAction => ({
type: "SET_METADATA",
payload: metadata,
}),
addLocalFile: (file: LocalFile): EditorAction => ({
type: "ADD_LOCAL_FILE",
payload: file,
}),
removeLocalFile: (previewUrl: string): EditorAction => ({
type: "REMOVE_LOCAL_FILE",
payload: previewUrl,
}),
setLocalFiles: (files: LocalFile[]): EditorAction => ({
type: "SET_LOCAL_FILES",
payload: files,
}),
toggleFocusMode: (): EditorAction => ({
type: "TOGGLE_FOCUS_MODE",
}),
setLoading: (key: LoadingKey, value: boolean): EditorAction => ({
type: "SET_LOADING",
payload: { key, value },
}),
setPendingInlineImageInsertions: (value: number): EditorAction => ({
type: "SET_PENDING_INLINE_IMAGE_INSERTIONS",
payload: value,
}),
setTimestamps: (timestamps: Partial<EditorState["timestamps"]>): EditorAction => ({
type: "SET_TIMESTAMPS",
payload: timestamps,
}),
setJustSaved: (value: boolean): EditorAction => ({
type: "SET_JUST_SAVED",
payload: value,
}),
setRecorderBusy: (value: boolean): EditorAction => ({
type: "SET_RECORDER_BUSY",
payload: value,
}),
acceptSuggestion: (id: string): EditorAction => ({
type: "ACCEPT_SUGGESTION",
payload: id,
}),
reset: (): EditorAction => ({
type: "RESET",
}),
};