fix issue 5011 - support to pipe markdownn links
parent
37b909e005
commit
b2af789412
|
@ -259,6 +259,9 @@ getMatches = (string, regex, index) ->
|
|||
match = null
|
||||
|
||||
while match = regex.exec(string)
|
||||
if index == -1
|
||||
matches.push(match)
|
||||
else
|
||||
matches.push(match[index])
|
||||
|
||||
return matches
|
||||
|
|
|
@ -70,6 +70,15 @@ class WysiwygService
|
|||
|
||||
return text
|
||||
|
||||
pipeLinks: (text) ->
|
||||
return text.replace /\[\[(.*?)\]\]/g, (match, p1, offset, str) ->
|
||||
linkParams = p1.split('|')
|
||||
|
||||
link = linkParams[0]
|
||||
title = linkParams[1] || linkParams[0]
|
||||
|
||||
return '[' + title + '](' + link + ')'
|
||||
|
||||
replaceUrls: (html) ->
|
||||
el = document.createElement( 'html' )
|
||||
el.innerHTML = html
|
||||
|
@ -146,7 +155,9 @@ class WysiwygService
|
|||
options = {
|
||||
breaks: true
|
||||
}
|
||||
|
||||
text = @.replaceEmojiNameByImgs(text)
|
||||
text = @.pipeLinks(text)
|
||||
|
||||
md = window.markdownit({
|
||||
breaks: true
|
||||
|
|
Loading…
Reference in New Issue