aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-richtext
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules/kvision-richtext')
-rw-r--r--kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt34
-rw-r--r--kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt26
2 files changed, 28 insertions, 32 deletions
diff --git a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
index 04a02279..4bf3948d 100644
--- a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
+++ b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
@@ -57,23 +57,21 @@ open class RichText(
this.addInternal(input)
this.addInternal(invalidFeedback)
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Container.richText(
- value: String? = null,
- name: String? = null,
- label: String? = null,
- rich: Boolean = false,
- init: (RichText.() -> Unit)? = null
- ): RichText {
- val richText = RichText(value, name, label, rich).apply { init?.invoke(this) }
- this.add(richText)
- return richText
- }
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.richText(
+ value: String? = null,
+ name: String? = null,
+ label: String? = null,
+ rich: Boolean = false,
+ init: (RichText.() -> Unit)? = null
+): RichText {
+ val richText = RichText(value, name, label, rich).apply { init?.invoke(this) }
+ this.add(richText)
+ return richText
}
diff --git a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
index 43b018f4..8b58e272 100644
--- a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
+++ b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
@@ -114,19 +114,17 @@ open class RichTextInput(value: String? = null, classes: Set<String> = setOf())
override fun changeValue() {
// disabled parent class functionality
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Container.richTextInput(
- value: String? = null, classes: Set<String> = setOf(), init: (RichTextInput.() -> Unit)? = null
- ): RichTextInput {
- val richTextInput = RichTextInput(value, classes).apply { init?.invoke(this) }
- this.add(richTextInput)
- return richTextInput
- }
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.richTextInput(
+ value: String? = null, classes: Set<String> = setOf(), init: (RichTextInput.() -> Unit)? = null
+): RichTextInput {
+ val richTextInput = RichTextInput(value, classes).apply { init?.invoke(this) }
+ this.add(richTextInput)
+ return richTextInput
}