prevent user entering commas to separate tags
This commit is contained in:
parent
6377d229d1
commit
ef2fd93a66
|
@ -9,8 +9,8 @@ import Data.Lens (Lens', lens, use, (%=), (.=))
|
|||
import Data.Maybe (Maybe(..), fromMaybe, isJust)
|
||||
import Data.Monoid (guard)
|
||||
import Data.Nullable (toMaybe)
|
||||
import Data.String (null, split, take) as S
|
||||
import Data.String.Pattern (Pattern(..))
|
||||
import Data.String (null, split, take, replaceAll) as S
|
||||
import Data.String.Pattern (Pattern(..), Replacement(..))
|
||||
import Data.Symbol (SProxy(..))
|
||||
import Effect.Aff (Aff)
|
||||
import Globals (app', setFocus, toLocaleDateString)
|
||||
|
@ -256,6 +256,7 @@ bmark b' =
|
|||
handleAction (BEditSubmit e) = do
|
||||
H.liftEffect (preventDefault e)
|
||||
edit_bm <- use _edit_bm
|
||||
void $ H.liftAff (editBookmark edit_bm)
|
||||
_bm .= edit_bm
|
||||
let edit_bm' = edit_bm { tags = S.replaceAll (Pattern ",") (Replacement " ") edit_bm.tags }
|
||||
void $ H.liftAff (editBookmark edit_bm')
|
||||
_bm .= edit_bm'
|
||||
_edit .= false
|
||||
|
|
|
@ -3,6 +3,7 @@ module Handler.Add where
|
|||
import Import
|
||||
import Handler.Archive
|
||||
import Data.List (nub)
|
||||
import qualified Data.Text as T (replace)
|
||||
|
||||
-- View
|
||||
|
||||
|
@ -72,7 +73,7 @@ _handleFormSuccess bookmarkForm = do
|
|||
pure (res, kbid)
|
||||
where
|
||||
mkbid = BookmarkKey <$> _bid bookmarkForm
|
||||
tags = maybe [] (nub . words) (_tags bookmarkForm)
|
||||
tags = maybe [] (nub . words . T.replace "," " ") (_tags bookmarkForm)
|
||||
|
||||
postLookupTitleR :: Handler ()
|
||||
postLookupTitleR = do
|
||||
|
|
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