Skip to content

Commit

Permalink
fix #71 closePopup (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dufgui authored Apr 29, 2024
1 parent 1c2172e commit e4bde2d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-env node */

module.exports = {
"env": {
"browser": true,
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## Version 1.26

- Escape to close popup [issue 71](https://github.com/dufoli/Salesforce-Inspector-Advanced/issues/71)

## Version 1.25

- Metadata: download data model by @dufoli in [issue 11](https://github.com/dufoli/Salesforce-Inspector-Advanced/issues/11)
Expand Down
25 changes: 18 additions & 7 deletions addon/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class App extends React.PureComponent {
onShortcutKey(e) {
const refs = this.refs;
const actionMap = {
"Escape": ["closePopup", ""],
"m": ["all", "clickShowDetailsBtn"],
"a": ["all", "clickAllDataBtn"],
"f": ["all", "clickShowFieldAPINameBtn"],
Expand All @@ -152,14 +153,24 @@ class App extends React.PureComponent {
}
e.preventDefault();
const [action, target] = actionMap[e.key];
if (action === "all") {
refs.showAllDataBox.refs?.showAllDataBoxSObject?.[target]();
} else if (action === "click" && refs[target]) {
refs[target].target = getLinkTarget(e);
refs[target].click();
} else if (action === "tab") {
refs.showAllDataBox.refs[target].click();
switch (action) {
case "closePopup":
closePopup();
return;
case "all":
refs.showAllDataBox.refs?.showAllDataBoxSObject?.[target]();
break;
case "click":
if (refs[target]) {
refs[target].target = getLinkTarget(e);
refs[target].click();
}
break;
case "tab":
refs.showAllDataBox.refs[target].click();
break;
}

if (e.key == "p") {
e.preventDefault();
this.refs.apexRunnerBtn.target = getLinkTarget(e);
Expand Down

0 comments on commit e4bde2d

Please sign in to comment.