implement go-root command
This commit is contained in:
parent
e9863299ab
commit
ac8f7e65dc
5 changed files with 10 additions and 1 deletions
|
@ -40,6 +40,7 @@ Firefox by WebExtensions API.
|
||||||
- [ ] yank/paste page
|
- [ ] yank/paste page
|
||||||
- [x] pagenation
|
- [x] pagenation
|
||||||
- [x] open parent page
|
- [x] open parent page
|
||||||
|
- [x] open root page
|
||||||
- [ ] hints
|
- [ ] hints
|
||||||
- [x] open a link
|
- [x] open a link
|
||||||
- [ ] open a link in new tab
|
- [ ] open a link in new tab
|
||||||
|
|
|
@ -33,6 +33,7 @@ const defaultKeymap = {
|
||||||
'[[': { type: operations.NAVIGATE_LINK_PREV },
|
'[[': { type: operations.NAVIGATE_LINK_PREV },
|
||||||
']]': { type: operations.NAVIGATE_LINK_NEXT },
|
']]': { type: operations.NAVIGATE_LINK_NEXT },
|
||||||
'gu': { type: operations.NAVIGATE_PARENT },
|
'gu': { type: operations.NAVIGATE_PARENT },
|
||||||
|
'gU': { type: operations.NAVIGATE_ROOT },
|
||||||
};
|
};
|
||||||
|
|
||||||
const asKeymapChars = (keys) => {
|
const asKeymapChars = (keys) => {
|
||||||
|
|
|
@ -45,6 +45,8 @@ const execOperation = (operation) => {
|
||||||
return navigates.linkNext(window);
|
return navigates.linkNext(window);
|
||||||
case operations.NAVIGATE_PARENT:
|
case operations.NAVIGATE_PARENT:
|
||||||
return navigates.parent(window);
|
return navigates.parent(window);
|
||||||
|
case operations.NAVIGATE_ROOT:
|
||||||
|
return navigates.root(window);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -63,4 +63,8 @@ const parent = (win) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export { historyPrev, historyNext, linkPrev, linkNext, parent };
|
const root = (win) => {
|
||||||
|
win.location = win.location.origin;
|
||||||
|
};
|
||||||
|
|
||||||
|
export { historyPrev, historyNext, linkPrev, linkNext, parent, root };
|
||||||
|
|
|
@ -16,6 +16,7 @@ export default {
|
||||||
NAVIGATE_LINK_PREV: 'navigate.link.prev',
|
NAVIGATE_LINK_PREV: 'navigate.link.prev',
|
||||||
NAVIGATE_LINK_NEXT: 'navigate.link.next',
|
NAVIGATE_LINK_NEXT: 'navigate.link.next',
|
||||||
NAVIGATE_PARENT: 'navigate.parent',
|
NAVIGATE_PARENT: 'navigate.parent',
|
||||||
|
NAVIGATE_ROOT: 'navigate.root',
|
||||||
|
|
||||||
// Background
|
// Background
|
||||||
TABS_CLOSE: 'tabs.close',
|
TABS_CLOSE: 'tabs.close',
|
||||||
|
|
Reference in a new issue