From 4484c82b1becc2fe5ab7b6842b3419b16c523445 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 28 Jun 2017 01:47:51 -0400 Subject: PLT-6799 Removed tags from markdown links (#6766) * PLT-6799 Removed tags from markdown links * Fixed unit tests --- webapp/tests/utils/formatting_hashtags.test.jsx | 6 +++--- webapp/tests/utils/formatting_links.test.jsx | 2 +- webapp/utils/text_formatting.jsx | 12 ------------ 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/webapp/tests/utils/formatting_hashtags.test.jsx b/webapp/tests/utils/formatting_hashtags.test.jsx index 917f0135a..cba7322ff 100644 --- a/webapp/tests/utils/formatting_hashtags.test.jsx +++ b/webapp/tests/utils/formatting_hashtags.test.jsx @@ -53,7 +53,7 @@ describe('TextFormatting.Hashtags', function() { assert.equal( TextFormatting.formatText('#test1/#test2').trim(), - "

#test1/#test2

" + "

#test1/#test2

" ); assert.equal( @@ -137,12 +137,12 @@ describe('TextFormatting.Hashtags', function() { assert.equal( TextFormatting.formatText('#foo/#bar', {searchTerm: '#foo'}).trim(), - "

#foo/#bar

" + "

#foo/#bar

" ); assert.equal( TextFormatting.formatText('#foo/#bar', {searchTerm: 'bar'}).trim(), - "

#foo/#bar

" + "

#foo/#bar

" ); assert.equal( diff --git a/webapp/tests/utils/formatting_links.test.jsx b/webapp/tests/utils/formatting_links.test.jsx index efa66ae6b..c4f949203 100644 --- a/webapp/tests/utils/formatting_links.test.jsx +++ b/webapp/tests/utils/formatting_links.test.jsx @@ -489,7 +489,7 @@ describe('Markdown.Links', function() { it('Searching for links', function(done) { assert.equal( TextFormatting.formatText('https://en.wikipedia.org/wiki/Unix', {searchTerm: 'wikipedia'}).trim(), - '

https://en.wikipedia.org/wiki/Unix

' + '

https://en.wikipedia.org/wiki/Unix

' ); assert.equal( diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx index 5cae81f4e..33cc3242c 100644 --- a/webapp/utils/text_formatting.jsx +++ b/webapp/utils/text_formatting.jsx @@ -53,11 +53,6 @@ export function formatText(text, inputOptions) { output = replaceNewlines(output); } - // Add tags to recommend line breaking on slashes within URLs - if (!options.singleline) { - output = insertLongLinkWbr(output); - } - return output; } @@ -477,10 +472,3 @@ export function replaceTokens(text, tokens) { function replaceNewlines(text) { return text.replace(/\n/g, ' '); } - -//replace all "/" inside tags to "/" -function insertLongLinkWbr(test) { - return test.replace(/\//g, (match, position, string) => { - return match + ((/a[^>]*>[^<]*$/).test(string.substr(0, position)) ? '' : ''); - }); -} -- cgit v1.2.3-1-g7c22