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