Skip to content

Commit

Permalink
Fix reset of unit search input when unchecking (Issue #92).
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jan 27, 2021
1 parent 4e0d0c9 commit 1e5eb3d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Client/Views/AddBuildingBlockView.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ open Fable.React.Props
open Fulma
open Fulma.Extensions.Wikiki
open Fable.FontAwesome
open Fable.Core
open Fable.Core.JsInterop

open ExcelColors
open Model
open Messages
open Shared
open CustomComponents
open Fable.Core


let isValidBuildingBlock (block : AnnotationBuildingBlock) =
match block.Type with
Expand Down Expand Up @@ -132,7 +135,15 @@ let addBuildingBlockComponent (model:Model) (dispatch:Msg -> unit) =
| Parameter | Characteristics | Factor ->
Field.div [Field.HasAddons] [
Control.div [] [
Button.a [ Button.OnClick (fun _ -> ToggleBuildingBlockHasUnit |> AddBuildingBlock |> dispatch)] [
Button.a [
Button.OnClick (fun _ ->
let inputId = (AutocompleteSearch.AutocompleteParameters<DbDomain.Term>.ofAddBuildingBlockUnitState model.AddBuildingBlockState).InputId
if model.AddBuildingBlockState.BuildingBlockHasUnit = true then
let e = Browser.Dom.document.getElementById inputId
e?value <- null
ToggleBuildingBlockHasUnit |> AddBuildingBlock |> dispatch
)
] [
Fa.stack [Fa.Stack.Size Fa.FaSmall; Fa.Stack.Props [Style [ Color "#666666"]]][
Fa.i [Fa.Regular.Square; Fa.Stack2x][]
if model.AddBuildingBlockState.BuildingBlockHasUnit then
Expand Down

0 comments on commit 1e5eb3d

Please sign in to comment.