summaryrefslogtreecommitdiff
path: root/elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-03 09:54:29 +0200
committerYorhel <git@yorhel.nl>2020-08-03 09:54:36 +0200
commita5204cdee31f5130330312eeaf7c31fab2504f89 (patch)
treeb08a83366516a95ed8f617c21c8a918717201638 /elm
parent09dfb2c285dac6a5a2e505aec6d934ebbed3fce8 (diff)
Elm: Fix focus when adding autocompleted elements with mouse click
I wasn't being consistent with propagating the Cmd returned by the autocompletion module.
Diffstat (limited to 'elm')
-rw-r--r--elm/CharEdit.elm4
-rw-r--r--elm/ProducerEdit.elm2
-rw-r--r--elm/VNEdit.elm8
3 files changed, 7 insertions, 7 deletions
diff --git a/elm/CharEdit.elm b/elm/CharEdit.elm
index 8c9ae9c7..837fbb4b 100644
--- a/elm/CharEdit.elm
+++ b/elm/CharEdit.elm
@@ -244,7 +244,7 @@ update msg model =
Just t ->
if not t.applicable || t.state /= 2 || List.any (\l -> l.tid == t.id) model.traits
then ({ model | traitSearch = A.clear nm "" }, c)
- else ({ model | traitSearch = A.clear nm "", traits = model.traits ++ [{ tid = t.id, spoil = t.defaultspoil, name = t.name, group = t.group_name, applicable = t.applicable, new = True }] }, Cmd.none)
+ else ({ model | traitSearch = A.clear nm "", traits = model.traits ++ [{ tid = t.id, spoil = t.defaultspoil, name = t.name, group = t.group_name, applicable = t.applicable, new = True }] }, c)
VnRel idx r -> ({ model | vns = modidx idx (\v -> { v | rid = r }) model.vns }, Cmd.none)
VnRole idx s -> ({ model | vns = modidx idx (\v -> { v | role = s }) model.vns }, Cmd.none)
@@ -261,7 +261,7 @@ update msg model =
if List.any (\v -> v.vid == vn.id) model.vns
then ({ model | vnSearch = A.clear nm "" }, c)
else ({ model | vnSearch = A.clear nm "", vns = model.vns ++ [{ vid = vn.id, title = vn.title, rid = Nothing, spoil = 0, role = "primary" }] }
- , if Dict.member vn.id model.releases then Cmd.none else GR.send { vid = vn.id } (VnRelGet vn.id))
+ , Cmd.batch [c, if Dict.member vn.id model.releases then Cmd.none else GR.send { vid = vn.id } (VnRelGet vn.id)])
VnRelGet vid (GApi.Releases r) -> ({ model | releases = Dict.insert vid r model.releases }, Cmd.none)
VnRelGet _ r -> ({ model | state = Api.Error r }, Cmd.none) -- XXX
diff --git a/elm/ProducerEdit.elm b/elm/ProducerEdit.elm
index f301d20c..0fd78375 100644
--- a/elm/ProducerEdit.elm
+++ b/elm/ProducerEdit.elm
@@ -125,7 +125,7 @@ update msg model =
Just p ->
if List.any (\l -> l.pid == p.id) model.rel
then ({ model | relSearch = A.clear nm "" }, c)
- else ({ model | relSearch = A.clear nm "", rel = model.rel ++ [{ pid = p.id, name = p.name, original = p.original, relation = "old" }] }, Cmd.none)
+ else ({ model | relSearch = A.clear nm "", rel = model.rel ++ [{ pid = p.id, name = p.name, original = p.original, relation = "old" }] }, c)
DupSubmit ->
if List.isEmpty model.dupProds
diff --git a/elm/VNEdit.elm b/elm/VNEdit.elm
index 3c6f06a6..0397b492 100644
--- a/elm/VNEdit.elm
+++ b/elm/VNEdit.elm
@@ -207,7 +207,7 @@ update msg model =
Just v ->
if List.any (\l -> l.vid == v.id) model.vns
then ({ model | vnSearch = A.clear nm "" }, c)
- else ({ model | vnSearch = A.clear nm "", vns = model.vns ++ [{ vid = v.id, title = v.title, original = v.original, relation = "seq", official = True }] }, Cmd.none)
+ else ({ model | vnSearch = A.clear nm "", vns = model.vns ++ [{ vid = v.id, title = v.title, original = v.original, relation = "seq", official = True }] }, c)
AnimeDel i -> ({ model | anime = delidx i model.anime }, Cmd.none)
AnimeSearch m ->
@@ -217,7 +217,7 @@ update msg model =
Just a ->
if List.any (\l -> l.aid == a.id) model.anime
then ({ model | animeSearch = A.clear nm "" }, c)
- else ({ model | animeSearch = A.clear nm "", anime = model.anime ++ [{ aid = a.id, title = a.title, original = a.original }] }, Cmd.none)
+ else ({ model | animeSearch = A.clear nm "", anime = model.anime ++ [{ aid = a.id, title = a.title, original = a.original }] }, c)
ImageSet s b -> let (nm, nc) = Img.new b s in ({ model | image = nm }, Cmd.map ImageMsg nc)
ImageSelect -> (model, FSel.file ["image/png", "image/jpg"] ImageSelected)
@@ -231,7 +231,7 @@ update msg model =
let (nm, c, res) = A.update staffConfig m model.staffSearch
in case res of
Nothing -> ({ model | staffSearch = nm }, c)
- Just s -> ({ model | staffSearch = A.clear nm "", staff = model.staff ++ [{ id = s.id, aid = s.aid, name = s.name, original = s.original, role = "staff", note = "" }] }, Cmd.none)
+ Just s -> ({ model | staffSearch = A.clear nm "", staff = model.staff ++ [{ id = s.id, aid = s.aid, name = s.name, original = s.original, role = "staff", note = "" }] }, c)
SeiyuuDef c -> ({ model | seiyuuDef = c }, Cmd.none)
SeiyuuDel idx -> ({ model | seiyuu = delidx idx model.seiyuu }, Cmd.none)
@@ -241,7 +241,7 @@ update msg model =
let (nm, c, res) = A.update seiyuuConfig m model.seiyuuSearch
in case res of
Nothing -> ({ model | seiyuuSearch = nm }, c)
- Just s -> ({ model | seiyuuSearch = A.clear nm "", seiyuu = model.seiyuu ++ [{ id = s.id, aid = s.aid, name = s.name, original = s.original, cid = model.seiyuuDef, note = "" }] }, Cmd.none)
+ Just s -> ({ model | seiyuuSearch = A.clear nm "", seiyuu = model.seiyuu ++ [{ id = s.id, aid = s.aid, name = s.name, original = s.original, cid = model.seiyuuDef, note = "" }] }, c)
ScrUplRel s -> ({ model | scrUplRel = s }, Cmd.none)
ScrUplSel -> (model, FSel.files ["image/png", "image/jpg"] ScrUpl)