From e8ebaad77132b69bc193899901675ea823ae3426 Mon Sep 17 00:00:00 2001 From: Jordan Vidrine <30537603+jordanvidrine@users.noreply.github.com> Date: Wed, 14 Oct 2020 15:01:39 -0500 Subject: [PATCH] FIX: Check for link target attribute on link clink (#10923) * FEATURE: Add ability to add target to link This commit will add the ability for a link's target attribute to be specified. Allowing`target: "_blank"` to work properly. --- app/assets/javascripts/discourse/app/widgets/link.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/widgets/link.js b/app/assets/javascripts/discourse/app/widgets/link.js index dc2d52e143f..63452b05202 100644 --- a/app/assets/javascripts/discourse/app/widgets/link.js +++ b/app/assets/javascripts/discourse/app/widgets/link.js @@ -97,14 +97,18 @@ export default createWidget("link", { ); } } - return result; }, click(e) { + if (this.attrs.attributes && this.attrs.attributes.target === "_blank") { + return; + } + if (wantsNewWindow(e)) { return; } + e.preventDefault(); if (this.attrs.action) {