Permalink
Browse files

Escape description

  • Loading branch information...
Floris Verloop
Floris Verloop committed Aug 3, 2016
1 parent dd76064 commit f11ff0e0457c05e2a09572e3b272cf228da61030
Showing with 5 additions and 2 deletions.
  1. +5 −2 framer/Components/ShareComponent.coffee
@@ -360,14 +360,17 @@ class ShareComponent
urlRegex = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi
httpRegex = /^((http|https):\/\/)/
lineBreakRegex = /(?:\r\n|\r|\n)/g
removeAllTagsExceptBreaks = /<(?!br\s*\/?)[^>]+>/g
text = _.escape(text)
text = _.trimEnd(text)
text = text.replace(lineBreakRegex, "<br>")
urlified = text.replace urlRegex, (url) ->
href = url
href = "//#{url}" if not httpRegex.test(url)
return "<a href='#{href}' style='-webkit-user-select: auto' target='_blank'>#{url}</a>"
urlified.replace(lineBreakRegex, "<br />")
@description = new ShareLayer
parent: @info
y: @credentials.maxY + 10

0 comments on commit f11ff0e

Please sign in to comment.