diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-03-22 20:20:12 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-03-22 20:20:12 +0100 |
commit | 41fbf09c2b2f24e18a3277efa183fdb3f140956a (patch) | |
tree | e657edda4c19610be6266d3f2560bcd3efab960d /src/main/kotlin | |
parent | 734231731a2181baabc7d63f83a4ee2b1f4c8a3f (diff) | |
download | kvision-41fbf09c2b2f24e18a3277efa183fdb3f140956a.tar.gz kvision-41fbf09c2b2f24e18a3277efa183fdb3f140956a.tar.bz2 kvision-41fbf09c2b2f24e18a3277efa183fdb3f140956a.zip |
RichTextInput fix for Firefox
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt index 4c3d09a5..35418534 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt @@ -82,9 +82,10 @@ open class RichTextInput(value: String? = null, classes: Set<String> = setOf()) } this.getElementJQuery()?.on("trix-initialize", { _, _ -> trixId = this.getElementJQuery()?.attr("trix-id") - if (trixId!=null) { + if (trixId != null) { value?.let { - this.getElement().asDynamic().editor.loadHTML(it) + if (this.getElement().asDynamic().editor != undefined) + this.getElement().asDynamic().editor.loadHTML(it) } } }) @@ -102,9 +103,11 @@ open class RichTextInput(value: String? = null, classes: Set<String> = setOf()) val v = document.getElementById("trix-input-$trixId")?.let { jQuery(it).`val`() as String? } if (value != v) { val editor = this.getElement().asDynamic().editor - value?.let { - editor.loadHTML(it) - } ?: editor.loadHTML("") + if (editor != undefined) { + value?.let { + editor.loadHTML(it) + } ?: editor.loadHTML("") + } } } |