focus tags input when editing bookmark
This commit is contained in:
parent
01afd5efad
commit
0546de274d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -30,3 +30,4 @@ tmp
|
||||||
tags
|
tags
|
||||||
purs/docset/purescript-local.docset/
|
purs/docset/purescript-local.docset/
|
||||||
.ghc.environment.x86_64-linux-8.6.5
|
.ghc.environment.x86_64-linux-8.6.5
|
||||||
|
.vscode
|
||||||
|
|
|
@ -97,7 +97,7 @@ addbmark b' =
|
||||||
[ td_ [ label [ for "title" ] [ text "title" ] ]
|
[ td_ [ label [ for "title" ] [ text "title" ] ]
|
||||||
, td [class_ "flex"]
|
, td [class_ "flex"]
|
||||||
[ input [ type_ InputText , id_ "title", class_ "w-100 mv1 flex-auto" , name "title" , value (edit_bm.title) , onValueChange (editField Etitle)]
|
[ input [ type_ InputText , id_ "title", class_ "w-100 mv1 flex-auto" , name "title" , value (edit_bm.title) , onValueChange (editField Etitle)]
|
||||||
, button [ disabled s.loading, type_ ButtonButton, onClick \_ -> Just BLookupTitle, class_ ("ml2 input-reset ba b--navy pointer f6 di dim pa1 ma1 mr0 " <> guard s.loading "bg-light-silver") ] [ text "Fetch" ]
|
, button [ disabled s.loading, type_ ButtonButton, onClick \_ -> Just BLookupTitle, class_ ("ml2 input-reset ba b--navy pointer f6 di dim pa1 ma1 mr0 " <> guard s.loading "bg-light-silver") ] [ text "fetch" ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, tr_
|
, tr_
|
||||||
|
|
|
@ -13,7 +13,7 @@ import Data.String (null, split, take) as S
|
||||||
import Data.String.Pattern (Pattern(..))
|
import Data.String.Pattern (Pattern(..))
|
||||||
import Data.Symbol (SProxy(..))
|
import Data.Symbol (SProxy(..))
|
||||||
import Effect.Aff (Aff)
|
import Effect.Aff (Aff)
|
||||||
import Globals (app')
|
import Globals (app', setFocus)
|
||||||
import Halogen as H
|
import Halogen as H
|
||||||
import Halogen.HTML (HTML, a, br_, button, div, div_, form, input, label, span, text, textarea)
|
import Halogen.HTML (HTML, a, br_, button, div, div_, form, input, label, span, text, textarea)
|
||||||
import Halogen.HTML as HH
|
import Halogen.HTML as HH
|
||||||
|
@ -155,24 +155,20 @@ bmark b' =
|
||||||
[ div_ [ text "url" ]
|
[ div_ [ text "url" ]
|
||||||
, input [ type_ InputUrl , class_ "url w-100 mb2 pt1 f7 edit_form_input" , required true , name "url"
|
, input [ type_ InputUrl , class_ "url w-100 mb2 pt1 f7 edit_form_input" , required true , name "url"
|
||||||
, value (edit_bm.url) , onValueChange (editField Eurl) ]
|
, value (edit_bm.url) , onValueChange (editField Eurl) ]
|
||||||
, br_
|
|
||||||
, div_ [ text "title" ]
|
, div_ [ text "title" ]
|
||||||
, div [class_ "flex"]
|
, div [class_ "flex"]
|
||||||
[input [ type_ InputText , class_ "title w-100 mb2 pt1 f7 edit_form_input" , name "title"
|
[input [ type_ InputText , class_ "title w-100 mb2 pt1 f7 edit_form_input" , name "title"
|
||||||
, value (edit_bm.title) , onValueChange (editField Etitle) ]
|
, value (edit_bm.title) , onValueChange (editField Etitle) ]
|
||||||
, button [ disabled s.loading, type_ ButtonButton, onClick \_ -> Just BLookupTitle, class_ ("ml1 pa1 mb2 dark-gray ba b--moon-gray bg-near-white pointer rdim f7 " <> guard s.loading "bg-light-silver") ] [ text "Fetch" ]
|
, button [ disabled s.loading, type_ ButtonButton, onClick \_ -> Just BLookupTitle, class_ ("ml1 pa1 mb2 dark-gray ba b--moon-gray bg-near-white pointer rdim f7 " <> guard s.loading "bg-light-silver") ] [ text "fetch" ]
|
||||||
]
|
]
|
||||||
, br_
|
|
||||||
, div_ [ text "description" ]
|
, div_ [ text "description" ]
|
||||||
, textarea [ class_ "description w-100 mb1 pt1 f7 edit_form_input" , name "description", rows 5
|
, textarea [ class_ "description w-100 mb1 pt1 f7 edit_form_input" , name "description", rows 5
|
||||||
, value (edit_bm.description) , onValueChange (editField Edescription) ]
|
, value (edit_bm.description) , onValueChange (editField Edescription) ]
|
||||||
, br_
|
|
||||||
, div [ id_ "tags_input_box"]
|
, div [ id_ "tags_input_box"]
|
||||||
[ div_ [ text "tags" ]
|
[ div_ [ text "tags" ]
|
||||||
, input [ type_ InputText , class_ "tags w-100 mb1 pt1 f7 edit_form_input" , name "tags"
|
, input [ id_ (tagid edit_bm), type_ InputText , class_ "tags w-100 mb1 pt1 f7 edit_form_input" , name "tags"
|
||||||
, autocomplete false, attr "autocapitalize" "off"
|
, autocomplete false, attr "autocapitalize" "off"
|
||||||
, value (edit_bm.tags) , onValueChange (editField Etags) ]
|
, value (edit_bm.tags) , onValueChange (editField Etags) ]
|
||||||
, br_
|
|
||||||
]
|
]
|
||||||
, div [ class_ "edit_form_checkboxes mv3"]
|
, div [ class_ "edit_form_checkboxes mv3"]
|
||||||
[ input [ type_ InputCheckbox , class_ "private pointer" , id_ "edit_private", name "private"
|
[ input [ type_ InputCheckbox , class_ "private pointer" , id_ "edit_private", name "private"
|
||||||
|
@ -184,7 +180,6 @@ bmark b' =
|
||||||
, checked (edit_bm.toread) , onChecked (editField Etoread) ]
|
, checked (edit_bm.toread) , onChecked (editField Etoread) ]
|
||||||
, text " "
|
, text " "
|
||||||
, label [ for "edit_toread" ] [ text "to-read" ]
|
, label [ for "edit_toread" ] [ text "to-read" ]
|
||||||
, br_
|
|
||||||
]
|
]
|
||||||
, input [ type_ InputSubmit , class_ "mr1 pv1 ph2 dark-gray ba b--moon-gray bg-near-white pointer rdim" , value "save" ]
|
, input [ type_ InputSubmit , class_ "mr1 pv1 ph2 dark-gray ba b--moon-gray bg-near-white pointer rdim" , value "save" ]
|
||||||
, text " "
|
, text " "
|
||||||
|
@ -200,6 +195,8 @@ bmark b' =
|
||||||
linkToFilterTag tag = fromNullableStr app.userR <> "/t:" <> tag
|
linkToFilterTag tag = fromNullableStr app.userR <> "/t:" <> tag
|
||||||
shtime = S.take 16 bm.time `append` "Z"
|
shtime = S.take 16 bm.time `append` "Z"
|
||||||
|
|
||||||
|
tagid bm = show bm.bid <> "_tags"
|
||||||
|
|
||||||
handleAction :: BAction -> H.HalogenM BState BAction ChildSlots BMessage Aff Unit
|
handleAction :: BAction -> H.HalogenM BState BAction ChildSlots BMessage Aff Unit
|
||||||
|
|
||||||
-- | Star
|
-- | Star
|
||||||
|
@ -230,6 +227,7 @@ bmark b' =
|
||||||
bm <- use _bm
|
bm <- use _bm
|
||||||
_edit_bm .= bm
|
_edit_bm .= bm
|
||||||
_edit .= e
|
_edit .= e
|
||||||
|
H.liftEffect $ whenM (pure e) (setFocus (tagid bm))
|
||||||
|
|
||||||
-- | Update Form Field
|
-- | Update Form Field
|
||||||
handleAction (BEditField f) = do
|
handleAction (BEditField f) = do
|
||||||
|
|
|
@ -65,3 +65,7 @@ exports._mmoment8601 = function(just, nothing, tuple, s) {
|
||||||
exports._closeWindow = function (window) {
|
exports._closeWindow = function (window) {
|
||||||
window.close();
|
window.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports._setFocus = function(elemId) {
|
||||||
|
document.getElementById(elemId).focus();
|
||||||
|
};
|
||||||
|
|
|
@ -95,3 +95,8 @@ closeWindow win = pure $ runFn1 _closeWindow win
|
||||||
newtype RawHTML = RawHTML String
|
newtype RawHTML = RawHTML String
|
||||||
|
|
||||||
derive instance newtypeRawHTML :: Newtype RawHTML _
|
derive instance newtypeRawHTML :: Newtype RawHTML _
|
||||||
|
|
||||||
|
foreign import _setFocus :: Fn1 String Unit
|
||||||
|
|
||||||
|
setFocus :: String -> Effect Unit
|
||||||
|
setFocus s = pure $ runFn1 _setFocus s
|
||||||
|
|
2
static/js/app.min.js
vendored
2
static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in a new issue