Rename mode acton and reducer

This commit is contained in:
Shin'ya Ueoka 2018-10-11 15:35:28 +09:00
parent bf283c732e
commit 2055dfb2fb
3 changed files with 18 additions and 13 deletions

View file

@ -6,6 +6,7 @@ import * as focuses from 'content/focuses';
import * as urls from 'content/urls';
import * as consoleFrames from 'content/console-frames';
import * as addonActions from './addon';
import * as markActions from './mark';
import * as properties from 'shared/settings/properties';
// eslint-disable-next-line complexity, max-lines-per-function
@ -57,6 +58,10 @@ const exec = (operation, repeat, settings, addonEnabled) => {
background: operation.background,
}), '*');
break;
case operations.MARK_SET_PREFIX:
return markActions.startSet();
case operations.MARK_JUMP_PREFIX:
return markActions.startJump();
case operations.NAVIGATE_HISTORY_PREV:
navigates.historyPrev(window);
break;

View file

@ -1,19 +1,19 @@
import actions from 'content/actions';
const defaultState = {
set: false,
jump: false,
setMode: false,
jumpMode: false,
marks: {},
};
export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
case actions.MARK_START_SET:
return { ...state, set: true };
return { ...state, setMode: true };
case actions.MARK_START_JUMP:
return { ...state, jump: true };
return { ...state, jumpMode: true };
case actions.MARK_CANCEL:
return { ...state, set: false, jump: false };
return { ...state, setMode: false, jumpMode: false };
case actions.MARK_SET_LOCAL: {
let marks = { ...state.marks };
marks[action.key] = { y: action.y };