mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
UI: Fix overlapping click event handler (#614)
The click event handler for links in the card display are overlapping: The general event for opening the link in a new window matches on user mentions, too. But user mentions cannot be opened in a new window.
This commit is contained in:
parent
3f12e3e96f
commit
36f17a5717
1 changed files with 11 additions and 9 deletions
|
|
@ -90,15 +90,10 @@ Blaze.Template.registerHelper('mentions', new Template('mentions', function() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Template.viewer.events({
|
Template.viewer.events({
|
||||||
'click .js-open-member'(evt, tpl) {
|
|
||||||
const userId = evt.currentTarget.dataset.userid;
|
|
||||||
Popup.open('member').call({ userId }, evt, tpl);
|
|
||||||
},
|
|
||||||
|
|
||||||
// Viewer sometimes have click-able wrapper around them (for instance to edit
|
// Viewer sometimes have click-able wrapper around them (for instance to edit
|
||||||
// the corresponding text). Clicking a link shouldn't fire these actions, stop
|
// the corresponding text). Clicking a link shouldn't fire these actions, stop
|
||||||
// we stop these event at the viewer component level.
|
// we stop these event at the viewer component level.
|
||||||
'click a'(evt) {
|
'click a'(evt, tpl) {
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
|
|
||||||
// XXX We hijack the build-in browser action because we currently don't have
|
// XXX We hijack the build-in browser action because we currently don't have
|
||||||
|
|
@ -106,9 +101,16 @@ Template.viewer.events({
|
||||||
// handled by a third party package that we can't configure easily. Fix that
|
// handled by a third party package that we can't configure easily. Fix that
|
||||||
// by using directly `_blank` attribute in the rendered HTML.
|
// by using directly `_blank` attribute in the rendered HTML.
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
const href = evt.currentTarget.href;
|
|
||||||
if (href) {
|
const userId = evt.currentTarget.dataset.userid;
|
||||||
window.open(href, '_blank');
|
if (userId) {
|
||||||
|
Popup.open('member').call({ userId }, evt, tpl);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const href = evt.currentTarget.href;
|
||||||
|
if (href) {
|
||||||
|
window.open(href, '_blank');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue