commit
847f571fb6
|
@ -53,7 +53,7 @@ object inquiry {
|
|||
def renderNote(r: lila.user.Note)(implicit ctx: Context) =
|
||||
(!r.dox || isGranted(_.Doxing)) option div(cls := "doc note")(
|
||||
h3("by ", userIdLink(r.from.some, withOnline = false), ", ", momentFromNow(r.date)),
|
||||
p(richText(r.text))
|
||||
p(richText(r.text, expandImg = false))
|
||||
)
|
||||
|
||||
def autoNextInput = input(cls := "auto-next", tpe := "hidden", name := "next", value := "1")
|
||||
|
|
|
@ -32,7 +32,7 @@ object publicChat {
|
|||
div(cls := "line")(
|
||||
userIdLink(line.author.toLowerCase.some, withOnline = false, withTitle = false),
|
||||
" ",
|
||||
richText(line.text)
|
||||
richText(line.text, expandImg = false)
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -50,7 +50,7 @@ object publicChat {
|
|||
div(cls := "line")(
|
||||
userIdLink(line.author.toLowerCase.some, withOnline = false, withTitle = false),
|
||||
" ",
|
||||
richText(line.text)
|
||||
richText(line.text, expandImg = false)
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
|
@ -158,7 +158,7 @@ object header {
|
|||
}
|
||||
.map { note =>
|
||||
div(cls := "note")(
|
||||
p(cls := "note__text")(richText(note.text)),
|
||||
p(cls := "note__text")(richText(note.text, expandImg = false)),
|
||||
p(cls := "note__meta")(
|
||||
userIdLink(note.from.some),
|
||||
br,
|
||||
|
|
|
@ -69,9 +69,9 @@ object String {
|
|||
|
||||
object html {
|
||||
|
||||
def richText(rawText: String, nl2br: Boolean = true): Frag =
|
||||
def richText(rawText: String, nl2br: Boolean = true, expandImg: Boolean = true): Frag =
|
||||
raw {
|
||||
val withLinks = RawHtml.addLinks(rawText)
|
||||
val withLinks = RawHtml.addLinks(rawText, expandImg)
|
||||
if (nl2br) RawHtml.nl2br(withLinks) else withLinks
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ final object RawHtml {
|
|||
|
||||
def hasLinks(text: String) = urlPattern.matcher(text).find
|
||||
|
||||
def addLinks(text: String): String =
|
||||
def addLinks(text: String, expandImg: Boolean = true): String =
|
||||
expandAtUser(text).map { expanded =>
|
||||
val m = urlPattern.matcher(expanded)
|
||||
|
||||
|
@ -117,7 +117,7 @@ final object RawHtml {
|
|||
val url = (if (isHttp) "http://" else "https://") + allButScheme
|
||||
val text = if (isHttp) url else allButScheme
|
||||
val imgHtml = {
|
||||
if (end < sArr.length && sArr(end) == '"') None
|
||||
if ((end < sArr.length && sArr(end) == '"') || !expandImg) None
|
||||
else imgUrl(url)
|
||||
}
|
||||
sb.append(
|
||||
|
|
Loading…
Reference in New Issue