regex find links with spaces and format them

stable
Juanfran 2017-03-30 08:18:01 +02:00 committed by Jesús Espino
parent 0bb96ff528
commit 5e5cc54ecf
1 changed files with 9 additions and 1 deletions

View File

@ -79,6 +79,13 @@ class WysiwygService
return '[' + title + '](' + link + ')'
linkTitleWithSpaces: (text) ->
link = /\[[^\]]*\]\(([^\)]*)\)/g # [Title-with-spaces](Title with spaces)
return text.replace link, (match, p1, offset, str) ->
return match.replace /\(.*\)/, '(' + taiga.slugify(p1) + ')'
replaceUrls: (html) ->
el = document.createElement( 'html' )
el.innerHTML = html
@ -213,6 +220,7 @@ class WysiwygService
}
text = @.replaceEmojiNameByImgs(text)
text = @.linkTitleWithSpaces(text)
text = @.pipeLinks(text)
md = window.markdownit({