Fix image tags in commenting
authorLanius Trolling <lanius@laniustrolling.dev>
Thu, 24 Aug 2023 18:59:38 +0000 (14:59 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Thu, 24 Aug 2023 18:59:38 +0000 (14:59 -0400)
src/main/kotlin/info/mechyrdia/data/views_comment.kt
src/main/kotlin/info/mechyrdia/lore/parser_tags.kt

index ed64c34fa112f1dcced4d934085ff7aa8dcad9ab..14af05990dd36b2a9af3446017bb81f555b65c95 100644 (file)
@@ -465,8 +465,8 @@ suspend fun ApplicationCall.commentHelpPage(): HTML.() -> Unit = page("Commentin
                                                p {
                                                        +"Creates an embedded image:"
                                                        br
-                                                       unsafe {
-                                                               raw("<script>window.appendImageThumb('https://i.ibb.co/Lns12z1/robert-sparr.png', '${getImageSizeStyleValue(256, 256)}');</script>")
+                                                       img(src = "https://i.ibb.co/Lns12z1/robert-sparr.png") {
+                                                               style = getImageSizeStyleValue(256, 256)
                                                        }
                                                        br
                                                        +"The tag param controls the width and height, much like a table cell. The size unit is viewport-responsive and has no correlation with pixels."
@@ -474,8 +474,8 @@ suspend fun ApplicationCall.commentHelpPage(): HTML.() -> Unit = page("Commentin
                                                p {
                                                        +"A similar tag is used to embed images that are hosted on Imgur, e.g. the image at https://i.imgur.com/dd0mmQ1.png"
                                                        br
-                                                       unsafe {
-                                                               raw("<script>window.appendImageThumb('https://i.imgur.com/dd0mmQ1.png', '${getImageSizeStyleValue(250, 323)}');</script>")
+                                                       img(src = "https://i.imgur.com/dd0mmQ1.png") {
+                                                               style = getImageSizeStyleValue(250, 323)
                                                        }
                                                        br
                                                        +"can be embedded using [imgur=250x323]dd0mmQ1.png[/imgur]"
index 70bd963fd1a323224a5555c97f20b4575cd330e2..7c37e5d1358af38728bdd29741e647d26b4a7bde 100644 (file)
@@ -361,7 +361,7 @@ enum class TextParserCommentTags(val type: TextParserTagType<Unit>) {
                        val imageUrl = sanitizeExtLink(content)
                        val (width, height) = getSizeParam(tagParam)
                        
-                       "<script>window.appendImageThumb('https://i.imgur.com/$imageUrl', '${getImageSizeStyleValue(width, height)}');</script>"
+                       "<img src='https://i.imgur.com/$imageUrl'${getImageSizeAttributes(width, height)}/>"
                }
        ),
        IMGBB(
@@ -369,7 +369,7 @@ enum class TextParserCommentTags(val type: TextParserTagType<Unit>) {
                        val imageUrl = sanitizeExtLink(content)
                        val (width, height) = getSizeParam(tagParam)
                        
-                       "<script>window.appendImageThumb('https://i.ibb.co/$imageUrl', '${getImageSizeStyleValue(width, height)}');</script>"
+                       "<img src='https://i.ibb.co/$imageUrl'${getImageSizeAttributes(width, height)}/>"
                }
        ),