Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat(openPlunkr): enable ctrl+click #10826

Closed
wants to merge 1 commit into from
Closed

feat(openPlunkr): enable ctrl+click #10826

wants to merge 1 commit into from

Conversation

ghoti143
Copy link
Contributor

This is an initial suggestion for dealing with the problem described in #10641. To summarize, the problem is:

  • The "Edit in Plunkr" anchor tag has an ng-click attribute
  • The openPlunkr function is fired on click which calls formPostData
  • formPostData creates a new form element, adds it to the page, posts it, and removes the form element
  • The form, when posted, opens in the same page (target="_self")
  • This can be unhelpful for people who want to stay on the AngularJS documentation site.
  • Changing the target attribute to "_blank", however, can trigger the popup blocker.
  • If a user chose to bypass pop-up blocker one time and click the link, they would arrive at a new default plnkr, not a plnkr with the desired template.

To resolve, the following steps were taken:

  • Pass the $event object into the openPlunkr function
  • Check if the ctrl button was pressed during click
    • If true, set target="_blank"
    • If false, set target="_self"

This enables a user to "opt-in" to the new window functionality, and the assumption is that they will whitelist the AngularJS docs page so their popup blocker doesn't block the popup. However, for the users who do not ctrl+click, they will continue experiencing the default functionality and not experience the undesired behavior described above.

This change allows users to ctrl+click on the "Edit in Plunker"
button which will set the posted form's target attribute to
"_blank" instead of "_self" which is the default.

Closes #10641
@caitp
Copy link
Contributor

caitp commented Jan 23, 2015

it looks good to me, tbh. tries it

@caitp
Copy link
Contributor

caitp commented Jan 23, 2015

added one more commit to it to work better on macs, since by default ctrl+click is right-click

@caitp caitp closed this in dca5fa7 Jan 23, 2015
caitp pushed a commit that referenced this pull request Jan 23, 2015
This change allows users to ctrl+click on the "Edit in Plunker"
button which will set the posted form's target attribute to
"_blank" instead of "_self" which is the default.

Closes #10641
Closes #10826
@ghoti143 ghoti143 deleted the ctrl-click-plunkr branch January 26, 2015 21:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants