diff --git a/CHANGES.md b/CHANGES.md index d2145679..76dba4d7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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)) diff --git a/addon/popup.js b/addon/popup.js index 8d796fba..28a79e2a 100644 --- a/addon/popup.js +++ b/addon/popup.js @@ -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") { @@ -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"; + } +} + window.getRecordId = getRecordId; // for unit tests