Refactor HTML definition in detail view
All checks were successful
Pull Request / build (pull_request) Successful in 3m31s
All checks were successful
Pull Request / build (pull_request) Successful in 3m31s
This commit is contained in:
parent
30f88c9e3e
commit
cdcfd92f60
@ -8,6 +8,12 @@ import javafx.scene.control.Label
|
||||
import javafx.scene.control.ListView
|
||||
import javafx.scene.control.TabPane
|
||||
import javafx.scene.web.WebView
|
||||
import kotlinx.html.body
|
||||
import kotlinx.html.h1
|
||||
import kotlinx.html.html
|
||||
import kotlinx.html.li
|
||||
import kotlinx.html.ol
|
||||
import kotlinx.html.stream.createHTML
|
||||
|
||||
class DetailsController(private val model: Model) {
|
||||
@FXML
|
||||
@ -64,19 +70,19 @@ class DetailsController(private val model: Model) {
|
||||
return@addListener
|
||||
}
|
||||
webViewDefinition.engine.loadContent(
|
||||
buildString {
|
||||
append("<html>")
|
||||
append("<body>")
|
||||
append("<h1>CC-CEDICT</h1>")
|
||||
append("<ol>")
|
||||
for (definition in newValue.definitions) {
|
||||
append("<li>")
|
||||
append(definition.joinToString(separator = "; "))
|
||||
append("</li>")
|
||||
createHTML().html {
|
||||
body {
|
||||
h1 {
|
||||
+"CC-CEDICT"
|
||||
}
|
||||
ol {
|
||||
for (definition in newValue.definitions) {
|
||||
li {
|
||||
+definition.joinToString(separator = "; ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
append("</ol>")
|
||||
append("</body>")
|
||||
append("</html>")
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -15,6 +15,11 @@ h1 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
ol {
|
||||
padding-left: 0;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
ol li:only-child {
|
||||
list-style: none;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user