2016-08-10 15:13:17 +00:00
|
|
|
import * as ActionTypes from '../../../constants';
|
|
|
|
|
|
|
|
const initialState = {
|
2016-08-11 17:24:02 +00:00
|
|
|
lintMessages: []
|
2016-08-10 15:13:17 +00:00
|
|
|
};
|
2017-02-22 19:29:35 +00:00
|
|
|
let messageId = 0;
|
2016-08-10 15:13:17 +00:00
|
|
|
|
2016-08-11 17:29:30 +00:00
|
|
|
const editorAccessibility = (state = initialState, action) => {
|
2016-08-10 15:13:17 +00:00
|
|
|
switch (action.type) {
|
2016-08-11 18:09:59 +00:00
|
|
|
case ActionTypes.UPDATE_LINT_MESSAGE:
|
2017-02-22 19:29:35 +00:00
|
|
|
messageId += 1;
|
2016-08-11 17:24:02 +00:00
|
|
|
return Object.assign({}, state, {
|
|
|
|
lintMessages: state.lintMessages.concat(
|
2017-02-22 19:29:35 +00:00
|
|
|
{ severity: action.severity, line: action.line, message: action.message, id: messageId })
|
2016-08-11 17:24:02 +00:00
|
|
|
});
|
2016-08-11 18:09:59 +00:00
|
|
|
case ActionTypes.CLEAR_LINT_MESSAGE:
|
2016-08-11 17:24:02 +00:00
|
|
|
return Object.assign({}, state, { lintMessages: [] });
|
2016-08-10 15:13:17 +00:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-08-11 17:29:30 +00:00
|
|
|
export default editorAccessibility;
|