aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/html
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-09-02 22:58:49 +0200
committerRobert Jaros <rjaros@finn.pl>2017-09-02 22:58:49 +0200
commit64e2bca354a1eb6018086427365336c3acb75cb8 (patch)
tree0a154d36120fc731d5704d4320af3dba711de37b /src/main/kotlin/pl/treksoft/kvision/html
parent0407e661dced3adcf8386b27738295e285a043a0 (diff)
downloadkvision-64e2bca354a1eb6018086427365336c3acb75cb8.tar.gz
kvision-64e2bca354a1eb6018086427365336c3acb75cb8.tar.bz2
kvision-64e2bca354a1eb6018086427365336c3acb75cb8.zip
Tag widget refactoring
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/InTag.kt48
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Tag.kt17
2 files changed, 16 insertions, 49 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/InTag.kt b/src/main/kotlin/pl/treksoft/kvision/html/InTag.kt
deleted file mode 100644
index 88f69435..00000000
--- a/src/main/kotlin/pl/treksoft/kvision/html/InTag.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-package pl.treksoft.kvision.html
-
-import com.github.snabbdom.VNode
-import pl.treksoft.kvision.core.KVManager
-import pl.treksoft.kvision.core.Widget
-
-enum class INTAG(val tagName: String) {
- MARK("mark"),
- DEL("del"),
- S("s"),
- INS("ins"),
- U("u"),
- SMALL("small"),
- STRONG("strong"),
- EM("em"),
- CITE("cite"),
- CODE("code"),
- KBD("kbd"),
- VAR("var"),
- SAMP("samp"),
- SPAN("span")
-}
-
-open class InTag(type: INTAG, text: String, rich: Boolean = false, classes: Set<String> = setOf()) : Widget(classes) {
- var type = type
- set(value) {
- field = value
- refresh()
- }
- var text = text
- set(value) {
- field = value
- refresh()
- }
- var rich = rich
- set(value) {
- field = value
- refresh()
- }
-
- override fun render(): VNode {
- if (rich) {
- return kvh(type.tagName, arrayOf(KVManager.virtualize("<span>$text</span>")))
- } else {
- return kvh(type.tagName, arrayOf(text))
- }
- }
-} \ No newline at end of file
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
index 60910707..4178fbfb 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
@@ -17,7 +17,22 @@ enum class TAG(val tagName: String) {
ADDRESS("address"),
BLOCKQUOTE("blockquote"),
FOOTER("footer"),
- PRE("pre")
+ PRE("pre"),
+
+ MARK("mark"),
+ DEL("del"),
+ S("s"),
+ INS("ins"),
+ U("u"),
+ SMALL("small"),
+ STRONG("strong"),
+ EM("em"),
+ CITE("cite"),
+ CODE("code"),
+ KBD("kbd"),
+ VAR("var"),
+ SAMP("samp"),
+ SPAN("span")
}
enum class ALIGN(val className: String) {