Merge pull request #368 from emlow/issue-279

Add shortcut to view page source
This commit is contained in:
Shin'ya Ueoka 2018-05-05 18:39:56 +09:00 committed by GitHub
commit 828ac8cd84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 0 deletions

View file

@ -49,6 +49,7 @@ The default mappings are as follows:
- <kbd>/</kbd>: start to find a keyword in the page - <kbd>/</kbd>: start to find a keyword in the page
- <kbd>n</kbd>: find next keyword in the page - <kbd>n</kbd>: find next keyword in the page
- <kbd>N</kbd>: find prev keyword in the page - <kbd>N</kbd>: find prev keyword in the page
- <kbd>g</kbd><kbd>f</kbd>: view page source
### Console commands ### Console commands

View file

@ -77,6 +77,12 @@ const exec = (operation, tab) => {
return browser.tabs.sendMessage(tab.id, { return browser.tabs.sendMessage(tab.id, {
type: messages.CONSOLE_HIDE, type: messages.CONSOLE_HIDE,
}); });
case operations.PAGE_SOURCE:
return browser.tabs.create({
url: 'view-source:' + tab.url,
index: tab.index + 1,
openerTabId: tab.id,
});
default: default:
return Promise.resolve(); return Promise.resolve();
} }

View file

@ -36,6 +36,7 @@ const KeyMapFields = [
['navigate.link.prev', 'Open previous link'], ['navigate.link.prev', 'Open previous link'],
['navigate.parent', 'Go to parent directory'], ['navigate.parent', 'Go to parent directory'],
['navigate.root', 'Go to root directory'], ['navigate.root', 'Go to root directory'],
['page.source', 'Open page source'],
['focus.input', 'Focus input'], ['focus.input', 'Focus input'],
], [ ], [
['find.start', 'Start find mode'], ['find.start', 'Start find mode'],

View file

@ -37,6 +37,9 @@ export default {
// Focus // Focus
FOCUS_INPUT: 'focus.input', FOCUS_INPUT: 'focus.input',
// Page
PAGE_SOURCE: 'page.source',
// Tabs // Tabs
TAB_CLOSE: 'tabs.close', TAB_CLOSE: 'tabs.close',
TAB_CLOSE_FORCE: 'tabs.close.force', TAB_CLOSE_FORCE: 'tabs.close.force',

View file

@ -48,6 +48,7 @@ export default {
"gu": { "type": "navigate.parent" }, "gu": { "type": "navigate.parent" },
"gU": { "type": "navigate.root" }, "gU": { "type": "navigate.root" },
"gi": { "type": "focus.input" }, "gi": { "type": "focus.input" },
"gf": { "type": "page.source" },
"y": { "type": "urls.yank" }, "y": { "type": "urls.yank" },
"p": { "type": "urls.paste", "newTab": false }, "p": { "type": "urls.paste", "newTab": false },
"P": { "type": "urls.paste", "newTab": true }, "P": { "type": "urls.paste", "newTab": true },