diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-09-01 22:26:48 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-09-01 22:27:57 +0200 |
commit | 07e4637e3cd8c79a30f4d9e38d2e0001da4bed8a (patch) | |
tree | 522296aaca624f37d3ebbfd7cc5fbded026343dc | |
parent | 39666d236a34b574523167f0ce9ce4a7b4e6bd12 (diff) | |
download | wekan-07e4637e3cd8c79a30f4d9e38d2e0001da4bed8a.tar.gz wekan-07e4637e3cd8c79a30f4d9e38d2e0001da4bed8a.tar.bz2 wekan-07e4637e3cd8c79a30f4d9e38d2e0001da4bed8a.zip |
Avoid side effects while clicking on a link in a card description
Fixes #261
-rw-r--r-- | client/components/main/editor.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/client/components/main/editor.js b/client/components/main/editor.js index 68e278ee..7966ff60 100644 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -66,3 +66,20 @@ EscapeActions.register('textcomplete', function() {}, function() { return dropdownMenuIsOpened; } ); + +Template.viewer.events({ + // 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': function(evt) { + evt.stopPropagation(); + + // XXX We hijack the build-in browser action because we currently don't have + // `_blank` attributes in viewer links, and the transformer function is + // 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(); + let href = evt.currentTarget.href; + window.open(href, '_blank'); + } +}); |