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
1 changed files with 7 additions and 5 deletions

View File

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