Skip to content

Commit

Permalink
Merge pull request #2 from yabwe/master
Browse files Browse the repository at this point in the history
Updating fork branch
  • Loading branch information
Saju Sasidharan authored Oct 17, 2016
2 parents 14c0017 + d2c21a7 commit b200484
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/js/extensions/auto-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
var WHITESPACE_CHARS,
KNOWN_TLDS_FRAGMENT,
LINK_REGEXP_TEXT,
KNOWN_TLDS_REGEXP;
KNOWN_TLDS_REGEXP,
LINK_REGEXP;

WHITESPACE_CHARS = [' ', '\t', '\n', '\r', '\u00A0', '\u2000', '\u2001', '\u2002', '\u2003',
'\u2028', '\u2029'];
Expand All @@ -26,6 +27,8 @@

KNOWN_TLDS_REGEXP = new RegExp('^(' + KNOWN_TLDS_FRAGMENT + ')$', 'i');

LINK_REGEXP = new RegExp(LINK_REGEXP_TEXT, 'gi');

function nodeIsNotInsideAnchorTag(node) {
return !MediumEditor.util.getClosestTag(node, 'a');
}
Expand Down Expand Up @@ -207,12 +210,11 @@
},

findLinkableText: function (contenteditable) {
var linkRegExp = new RegExp(LINK_REGEXP_TEXT, 'gi'),
textContent = contenteditable.textContent,
var textContent = contenteditable.textContent,
match = null,
matches = [];

while ((match = linkRegExp.exec(textContent)) !== null) {
while ((match = LINK_REGEXP.exec(textContent)) !== null) {
var matchOk = true,
matchEnd = match.index + match[0].length;
// If the regexp detected something as a link that has text immediately preceding/following it, bail out.
Expand Down

0 comments on commit b200484

Please sign in to comment.