FIX: Middle clicking on search should open it in a new tab

This commit is contained in:
Robin Ward 2016-05-02 11:50:40 -04:00
parent 5c583ff5bb
commit cf7b08d034
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D

View file

@ -2,6 +2,7 @@ import { createWidget } from 'discourse/widgets/widget';
import { iconNode } from 'discourse/helpers/fa-icon';
import { avatarImg } from 'discourse/widgets/post';
import DiscourseURL from 'discourse/lib/url';
import { wantsNewWindow } from 'discourse/lib/intercept-click';
import { h } from 'virtual-dom';
@ -11,6 +12,7 @@ const dropdown = {
},
click(e) {
if (wantsNewWindow(e)) { return; }
e.preventDefault();
if (!this.attrs.active) {
this.sendWidgetAction(this.attrs.action);
@ -43,7 +45,7 @@ createWidget('header-notifications', {
}
});
createWidget('user-dropdown', jQuery.extend(dropdown, {
createWidget('user-dropdown', jQuery.extend({
tagName: 'li.header-dropdown-toggle.current-user',
buildId() {
@ -56,9 +58,9 @@ createWidget('user-dropdown', jQuery.extend(dropdown, {
return h('a.icon', { attributes: { href: currentUser.get('path'), 'data-auto-route': true } },
this.attach('header-notifications', attrs));
}
}));
}, dropdown));
createWidget('header-dropdown', jQuery.extend(dropdown, {
createWidget('header-dropdown', jQuery.extend({
tagName: 'li.header-dropdown-toggle',
html(attrs) {
@ -69,13 +71,13 @@ createWidget('header-dropdown', jQuery.extend(dropdown, {
body.push(attrs.contents.call(this));
}
return h('a.icon', { attributes: { href: '',
return h('a.icon', { attributes: { href: attrs.href,
'data-auto-route': true,
title,
'aria-label': title,
id: attrs.iconId } }, body);
}
}));
}, dropdown));
createWidget('header-icons', {
tagName: 'ul.icons.clearfix',