Skip to content

Commit

Permalink
Merge 0b53aac into 85adeb0
Browse files Browse the repository at this point in the history
  • Loading branch information
oshi97 committed Feb 22, 2023
2 parents 85adeb0 + 0b53aac commit e491f92
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/answers-search-ui",
"version": "1.15.2",
"version": "1.15.3",
"description": "Javascript Search Programming Interface",
"main": "dist/answers-umd.js",
"repository": {
Expand Down
14 changes: 14 additions & 0 deletions src/ui/components/navigation/navigationcomponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,19 @@ export default class NavigationComponent extends Component {
this.refitNav();
DOM.on(DOM.query(this._container, '.yxt-Nav-more'), 'click', this.toggleMoreDropdown.bind(this));
}
const navLinks = DOM.queryAll(this._container, '[data-originalurl]');
navLinks.forEach(link => {
const originalUrl = link.dataset.originalurl;
if (originalUrl) {
DOM.on(link, 'click', e => {
if (e.metaKey || e.ctrlKey) {
return;
}
e.preventDefault();
window.open(originalUrl, '_self');
});
}
});
}

setParentUrl (parentUrl) {
Expand Down Expand Up @@ -389,6 +402,7 @@ export default class NavigationComponent extends Component {
const parentUrlWithoutParams = this._parentUrl.split('?')[0];
const urlParser = document.createElement('a');
tabs.forEach(tab => {
tab.originalUrl = tab.url;
urlParser.href = tab.url;
const tabParams = new SearchParams(urlParser.search);
const verticalUrl = urlParser.pathname.replace(/^\//, '');
Expand Down
3 changes: 3 additions & 0 deletions src/ui/templates/navigation/navigation.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
data-eventtype="VERTICAL_TAB_NAVIGATION"
data-eventoptions='{"verticalKey": "{{verticalKey}}"}'
{{/if}}
{{#if originalUrl}}
data-originalurl="{{originalUrl}}"
{{/if}}
>
{{label}}
</a>
Expand Down

0 comments on commit e491f92

Please sign in to comment.