Merge pull request #368 from emlow/issue-279

Add shortcut to view page source
jh-changes
Shin'ya Ueoka 7 years ago committed by GitHub
commit 828ac8cd84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      README.md
  2. 6
      src/background/actions/operation.js
  3. 1
      src/settings/components/form/keymaps-form.jsx
  4. 3
      src/shared/operations.js
  5. 1
      src/shared/settings/default.js

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

@ -77,6 +77,12 @@ const exec = (operation, tab) => {
return browser.tabs.sendMessage(tab.id, {
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:
return Promise.resolve();
}

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

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

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