FIX: Check for link target attribute on link clink (#10923)

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.

Allowingtarget: "_blank" to work properly.

diff --git a/app/assets/javascripts/discourse/app/widgets/link.js b/app/assets/javascripts/discourse/app/widgets/link.js
index dc2d52e..63452b0 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) {

GitHub sha: e8ebaad7

This commit appears in #10923 which was approved by pmusaraj. It was merged by jordanvidrine.