mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 23:54:16 +08:00
FIX: Middle clicking on search should open it in a new tab
This commit is contained in:
parent
5c583ff5bb
commit
cf7b08d034
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue
Block a user