1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

sagas for node creation dialog

This commit is contained in:
Fedor Katurov 2019-10-16 16:22:01 +07:00
parent 265b075ddc
commit 1b6a81d27c
11 changed files with 119 additions and 22 deletions

View file

@ -2,18 +2,24 @@ import { FC } from 'react';
import { IBlock, INode, ValueOf, IComment } from '../types';
import { NodeImageBlock } from '~/components/node/NodeImageBlock';
import { ImageEditor } from '~/components/editors/ImageEditor';
import { TextEditor } from '~/components/editors/TextEditor';
import { DIALOGS } from '../modal/constants';
const prefix = 'NODE.';
export const NODE_ACTIONS = {
SAVE: `${prefix}SAVE`,
LOAD_NODE: `${prefix}LOAD_NODE`,
EDIT: `${prefix}EDIT`,
CREATE: `${prefix}CREATE`,
SET_SAVE_ERRORS: `${prefix}SET_SAVE_ERRORS`,
SET_LOADING: `${prefix}SET_LOADING`,
SET_LOADING_COMMENTS: `${prefix}SET_LOADING_COMMENTS`,
SET_SENDING_COMMENT: `${prefix}SET_SENDING_COMMENT`,
SET_CURRENT: `${prefix}SET_CURRENT`,
SET_COMMENT_DATA: `${prefix}SET_COMMENT_DATA`,
SET_EDITOR: `${prefix}SET_EDITOR`,
POST_COMMENT: `${prefix}POST_COMMENT`,
SET_COMMENTS: `${prefix}SET_COMMENTS`,
@ -22,13 +28,6 @@ export const NODE_ACTIONS = {
SET_TAGS: `${prefix}SET_TAGS`,
};
export const EMPTY_BLOCK: IBlock = {
type: null,
files: [],
content: null,
embeds: [],
};
export const EMPTY_NODE: INode = {
id: null,
@ -78,6 +77,16 @@ export const EMPTY_COMMENT: IComment = {
export const NODE_EDITORS = {
[NODE_TYPES.IMAGE]: ImageEditor,
[NODE_TYPES.TEXT]: TextEditor,
};
export const MAX_NODE_FILES = 16;
export const NODE_EDITOR_DATA: Record<
typeof NODE_TYPES[keyof typeof NODE_TYPES],
Partial<INode>
> = {
[NODE_TYPES.TEXT]: {
blocks: [{ text: '', type: 'text' }],
},
};