Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3738 from chenba/3714-enter-key-action
Browse files Browse the repository at this point in the history
Download shot when Enter is pressed in download only mode.
  • Loading branch information
ianb committed Nov 8, 2017
2 parents 49bafca + df973cd commit d01d442
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon/webextension/selector/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
return result;
}

function isDownloadOnly() {
let isDownloadOnly = exports.isDownloadOnly = function() {
return window.downloadOnly;
}

Expand Down
7 changes: 5 additions & 2 deletions addon/webextension/selector/uicontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,11 @@ this.uicontrol = (function() {
sendEvent("cancel-shot", "keyboard-escape");
exports.deactivate();
}
if ((event.key || event.code) === "Enter") {
if (getState.state === "selected") {
if ((event.key || event.code) === "Enter" && getState.state === "selected") {
if (ui.isDownloadOnly()) {
sendEvent("download-shot", "keyboard-enter");
shooter.downloadShot(selectedPos);
} else {
sendEvent("save-shot", "keyboard-enter");
shooter.takeShot("selection", selectedPos);
}
Expand Down

0 comments on commit d01d442

Please sign in to comment.