Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[popup] Add option to open extension pages in new tab using keyboard shortcuts #158

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## General


- Add option to open extension pages in a new tab using keyboard shortcuts (contribution by [Joshua Yarmak](https://github.com/toly11))
- Add customizable query templates to query export page (idea and co-develop with [Samuel Krissi](https://github.com/samuelkrissi))
- Explore-api page restyling
- Ability to define csv-file separator [feature 144](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/144) (issue by [Reinier van den Assum](https://github.com/foxysolutions))
Expand Down
19 changes: 15 additions & 4 deletions addon/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,32 @@ class App extends React.PureComponent {
}
if (e.key == "e") {
e.preventDefault();
this.refs.dataExportBtn.target = getLinkTarget(e);
this.refs.dataExportBtn.click();
}
if (e.key == "i") {
e.preventDefault();
this.refs.dataImportBtn.target = getLinkTarget(e);
this.refs.dataImportBtn.click();
}
if (e.key == "l") {
e.preventDefault();
this.refs.limitsBtn.target = getLinkTarget(e);
this.refs.limitsBtn.click();
}
if (e.key == "d") {
e.preventDefault();
this.refs.metaRetrieveBtn.click();
}
if (e.key == "d") {
e.preventDefault();
this.refs.metaRetrieveBtn.target = getLinkTarget(e);
this.refs.metaRetrieveBtn.click();
}
if (e.key == "x") {
e.preventDefault();
this.refs.apiExploreBtn.target = getLinkTarget(e);
this.refs.apiExploreBtn.click();
}
if (e.key == "h" && this.refs.homeBtn) {
e.preventDefault();
this.refs.homeBtn.target = getLinkTarget(e);
this.refs.homeBtn.click();
}
if (e.key == "o") {
Expand Down Expand Up @@ -1608,4 +1611,12 @@ function sfLocaleKeyToCountryCode(localeKey) {
return splitted[(splitted.length > 1 && !localeKey.includes("_LATN_")) ? 1 : 0].toLowerCase();
}

function getLinkTarget(e) {
if (localStorage.getItem("openLinksInNewTab") == "true" || (e.ctrlKey || e.metaKey)){
return "_blank";
} else {
return "_top";
}
}

tprouvot marked this conversation as resolved.
Show resolved Hide resolved
window.getRecordId = getRecordId; // for unit tests