import { SETPASTTEXTMODEVALUE, REPASTTEXTDATA, CLEARPASTTEXTDATA } from '../types/pastHistory';
import { setTextModeValue, rePastData } from '../actions/pastHistory';
import config from '@config/index';
const block = Object.assign(JSON.parse(config.textLabel), { full: true });//空白时保留一个自由文本标签
const initState = {
  data: [block],
  isEmpty: true,
  saveText: [],
  deledTags: {},
  focusIndex: '',
  editClear: true
};

export default function (state = initState, action) {//console.log(state)
  const res = Object.assign({}, state);
  switch (action.type) {
    case SETPASTTEXTMODEVALUE:
      return setTextModeValue(state, action);
    case REPASTTEXTDATA:
      return rePastData(state, action);
    case CLEARPASTTEXTDATA:
      res.saveText = [];
      return res;
    default:
      return res;
  }
}