content commands as action/reducer
This commit is contained in:
parent
2c40d239f0
commit
adc6a5175c
6 changed files with 80 additions and 94 deletions
|
@ -1,4 +1,3 @@
|
|||
import * as actions from '../shared/actions';
|
||||
import * as tabs from './tabs';
|
||||
import KeyQueue from './key-queue';
|
||||
import backgroundReducers from '../reducers/background';
|
||||
|
@ -14,11 +13,9 @@ const keyPressHandle = (request, sender) => {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (actions.isContentAction(action.type)) {
|
||||
return backgroundReducers(undefined, action, sender).then(() => {
|
||||
return browser.tabs.sendMessage(sender.tab.id, action);
|
||||
} else {
|
||||
return backgroundReducers(undefined, action, sender);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const normalizeUrl = (string) => {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import newActions from '../actions';
|
||||
import * as actions from '../shared/actions';
|
||||
import actions from '../actions';
|
||||
|
||||
const DEFAULT_KEYMAP = {
|
||||
':': { type: actions.CMD_OPEN },
|
||||
|
@ -18,15 +17,15 @@ const DEFAULT_KEYMAP = {
|
|||
'G': { type: actions.SCROLL_BOTTOM },
|
||||
'0': { type: actions.SCROLL_LEFT },
|
||||
'$': { type: actions.SCROLL_RIGHT },
|
||||
'd': { type: newActions.TABS_CLOSE },
|
||||
'u': { type: newActions.TABS_REOPEN },
|
||||
'h': { type: newActions.TABS_PREV, count: 1 },
|
||||
'l': { type: newActions.TABS_NEXT, count: 1 },
|
||||
'r': { type: newActions.TABS_RELOAD, cache: false },
|
||||
'R': { type: newActions.TABS_RELOAD, cache: true },
|
||||
'zi': { type: newActions.ZOOM_IN },
|
||||
'zo': { type: newActions.ZOOM_OUT },
|
||||
'zz': { type: newActions.ZOOM_NEUTRAL },
|
||||
'd': { type: actions.TABS_CLOSE },
|
||||
'u': { type: actions.TABS_REOPEN },
|
||||
'h': { type: actions.TABS_PREV, count: 1 },
|
||||
'l': { type: actions.TABS_NEXT, count: 1 },
|
||||
'r': { type: actions.TABS_RELOAD, cache: false },
|
||||
'R': { type: actions.TABS_RELOAD, cache: true },
|
||||
'zi': { type: actions.ZOOM_IN },
|
||||
'zo': { type: actions.ZOOM_OUT },
|
||||
'zz': { type: actions.ZOOM_NEUTRAL },
|
||||
'f': { type: actions.FOLLOW_START, newTab: false },
|
||||
'F': { type: actions.FOLLOW_START, newTab: true },
|
||||
'H': { type: actions.HISTORY_PREV },
|
||||
|
|
Reference in a new issue