Created
April 1, 2016 19:41
-
-
Save typeoneerror/5039324d5d471ebb6352e52c98bae169 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 9092d3a70d0360dec52c44f2bb81e45c890e67dc Mon Sep 17 00:00:00 2001 | |
From: Benjamin Borowski <[email protected]> | |
Date: Fri, 1 Apr 2016 12:37:39 -0700 | |
Subject: [PATCH] [REDACTOR] Adds ability to set rel option on links | |
--- | |
vendor/redactorII/lib/redactor.js | 9 ++++++--- | |
1 file changed, 6 insertions(+), 3 deletions(-) | |
diff --git a/vendor/redactorII/lib/redactor.js b/vendor/redactorII/lib/redactor.js | |
index 1f2857e..fcf188e 100644 | |
--- a/vendor/redactorII/lib/redactor.js | |
+++ b/vendor/redactorII/lib/redactor.js | |
@@ -175,6 +175,7 @@ | |
linkTooltip: true, | |
linkNofollow: false, | |
+ linkRelOption: false, | |
linkSize: 30, | |
videoContainerClass: 'video-container', | |
@@ -2462,10 +2463,12 @@ | |
} | |
// link nofollow | |
- if (this.opts.linkNofollow) | |
+ if (this.opts.linkNofollow || this.opts.linkRelOption) | |
{ | |
- html = html.replace(/<a(.*?)rel="nofollow"(.*?[^>])>/gi, '<a$1$2>'); | |
- html = html.replace(/<a(.*?[^>])>/gi, '<a$1 rel="nofollow">'); | |
+ var rel = this.opts.linkRelOption || 'nofollow'; | |
+ | |
+ html = html.replace(new RegExp('<a(.*?)rel="' + rel + '"(.*?[^>])>', 'gi'), '<a$1$2>'); | |
+ html = html.replace(/<a(.*?[^>])>/gi, '<a$1 rel="' + rel + '">'); | |
} | |
// replace special characters | |
-- | |
2.2.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment