Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Add shortcut to view page source #3474

Closed
wants to merge 3 commits into from
Closed

Add shortcut to view page source #3474

wants to merge 3 commits into from

Conversation

Sh1d0w
Copy link

@Sh1d0w Sh1d0w commented Aug 27, 2016

Added handy shortcut to display page source, just like in Google Chrome.

cc @bbondy @bridiver @bsclifton

@bsclifton bsclifton changed the title Add schortcut to view page source Add shortcut to view page source Aug 27, 2016
@Sh1d0w Sh1d0w self-assigned this Aug 30, 2016
@Sh1d0w Sh1d0w added this to the 0.11.7dev milestone Sep 1, 2016
@@ -452,7 +452,10 @@ class Frame extends ImmutableComponent {
break
case 'view-source':
const sourceLocation = UrlUtil.getViewSourceUrlFromUrl(this.webview.getURL())
windowActions.newFrame({location: sourceLocation}, true)
let src = this.frame.get('src')
if (UrlUtil.isHttpAddress(src) && !UrlUtil.isImageAddress(src)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we split this change out from the shortcut? I think we probably want to make these extra checks in getViewSourceUrlFromUrl and maybe return a null location if there is not valid view-source for the url
@bradleyrichter is this shortcut in your list?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, moved.

@bbondy
Copy link
Member

bbondy commented Sep 3, 2016

If you type in gmail compose, or any text editable for example, and do command+U to underline it, it'll open the page source in a new tab instead.

I tweaked it to be the same shortcut as Chrome (with an Alt key too and merged. Thanks!)

@Sh1d0w
Copy link
Author

Sh1d0w commented Sep 3, 2016

@bbondy I think you forgot to put the check for the current address like I did in my PR, so if you click CTRL + ALT + U on new tab frame or on a image you currently opened in a browser you will trigger view-source, which does not happens on other browsers and should not happen in Brave as well.

Please see my PR for reference how I have checked this, so you can put that too :)

@bbondy
Copy link
Member

bbondy commented Sep 3, 2016

The task was merged so it is all commits
Is there a problem on master?

@bbondy
Copy link
Member

bbondy commented Sep 3, 2016

I only merged your PR and then did a commit on top.

@Sh1d0w
Copy link
Author

Sh1d0w commented Sep 3, 2016

@bbondy Ah never mind my comment I tought you closed my PR without merging it because github stated Closed with unmerged commits and saw only your last commit in main page. It's all ok.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants