p5.js-web-editor/client/modules/IDE/reducers/editorAccessibility.js

25 lines
738 B
JavaScript
Raw Normal View History

import * as ActionTypes from '../../../constants';
const initialState = {
2016-08-12 18:23:34 +00:00
lineNumber: 'line',
2016-08-11 17:24:02 +00:00
lintMessages: []
};
2016-08-11 17:29:30 +00:00
const editorAccessibility = (state = initialState, action) => {
switch (action.type) {
2016-08-11 18:09:59 +00:00
case ActionTypes.UPDATE_LINT_MESSAGE:
2016-08-11 17:24:02 +00:00
return Object.assign({}, state, {
lintMessages: state.lintMessages.concat(
{ severity: action.severity, line: action.line, message: action.message })
});
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: [] });
case ActionTypes.UPDATE_LINENUMBER:
2016-08-12 18:23:34 +00:00
return Object.assign({}, state, { lineNumber: `line ${action.lineNumber}` });
default:
return state;
}
};
2016-08-11 17:29:30 +00:00
export default editorAccessibility;