summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2016-07-11 12:04:42 +0200
committerMaxime Quandalle <maxime@quandalle.com>2016-07-11 12:04:42 +0200
commit36f17a57171bce23840f67c89ef25361cd2b49f6 (patch)
treec9f8da67d5d26a14ee41f5ac2e5ea74fac57eb2f
parent3f12e3e96f4ca6ac2bd8d399ea8fdfa4e0497038 (diff)
downloadwekan-36f17a57171bce23840f67c89ef25361cd2b49f6.tar.gz
wekan-36f17a57171bce23840f67c89ef25361cd2b49f6.tar.bz2
wekan-36f17a57171bce23840f67c89ef25361cd2b49f6.zip
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.
-rwxr-xr-xclient/components/main/editor.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/client/components/main/editor.js b/client/components/main/editor.js
index da66bb74..17429067 100755
--- a/client/components/main/editor.js
+++ b/client/components/main/editor.js
@@ -90,15 +90,10 @@ Blaze.Template.registerHelper('mentions', new Template('mentions', function() {
}));
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
// the corresponding text). Clicking a link shouldn't fire these actions, stop
// we stop these event at the viewer component level.
- 'click a'(evt) {
+ 'click a'(evt, tpl) {
evt.stopPropagation();
// 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
// by using directly `_blank` attribute in the rendered HTML.
evt.preventDefault();
- const href = evt.currentTarget.href;
- if (href) {
- window.open(href, '_blank');
+
+ const userId = evt.currentTarget.dataset.userid;
+ if (userId) {
+ Popup.open('member').call({ userId }, evt, tpl);
+ }
+ else {
+ const href = evt.currentTarget.href;
+ if (href) {
+ window.open(href, '_blank');
+ }
}
},
});