Skip to content

Commit

Permalink
Merge pull request #1383 from gemini-hlsw/text-changed
Browse files Browse the repository at this point in the history
  • Loading branch information
cquiroz authored Dec 19, 2024
2 parents 457cc4a + 92c6872 commit d120fb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import org.scalajs.linker.interface.ModuleSplitStyle

ThisBuild / tlBaseVersion := "0.124"
ThisBuild / tlBaseVersion := "0.125"
ThisBuild / tlCiReleaseBranches := Seq("master")

val Versions = new {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final case class FormInputTextAreaView[V[_]](
autoResize: js.UndefOr[Boolean] = js.undefined,
tooltip: js.UndefOr[VdomNode] = js.undefined,
tooltipPlacement: floatingui.Placement = floatingui.Placement.Top,
onTextChange: String => Callback = _ => Callback.empty,
modifiers: Seq[TagMod] = Seq.empty
)(using val vl: ViewLike[V])
extends ReactFnProps(FormInputTextAreaView.component):
Expand All @@ -42,10 +43,13 @@ object FormInputTextAreaView:

private type Props[V[_]] = FormInputTextAreaView[V]

private def onChange[V[_]](valueView: View[String]): ReactEventFromTextArea => Callback =
private def onChange[V[_]](
valueView: View[String],
onTextChange: String => Callback
): ReactEventFromTextArea => Callback =
(e: ReactEventFromTextArea) => {
val v = e.target.value
valueView.set(v)
valueView.set(v) *> onTextChange(v)
}

private def onBlur[V[_]](props: Props[V], valueView: View[String]): Callback =
Expand All @@ -68,7 +72,7 @@ object FormInputTextAreaView:
props.tooltipPlacement,
props.modifiers
)(
^.onChange ==> onChange[V](valueView),
^.onChange ==> onChange[V](valueView, props.onTextChange),
^.onBlur --> onBlur(props, valueView)
)
)
Expand Down

0 comments on commit d120fb9

Please sign in to comment.