Prevent unfolding of nodes without children
This commit is contained in:
parent
909d587c53
commit
573a835022
4 changed files with 20 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ module Forest.Node
|
|||
-- * Node
|
||||
NodeId
|
||||
, Node(..)
|
||||
, hasChildren
|
||||
, emptyNode
|
||||
, initialNode
|
||||
, applyId
|
||||
|
|
@ -55,6 +56,9 @@ instance ToJSON Node where
|
|||
instance FromJSON Node where
|
||||
parseJSON = genericParseJSON nodeOptions
|
||||
|
||||
hasChildren :: Node -> Bool
|
||||
hasChildren = not . Map.null . nodeChildren
|
||||
|
||||
emptyNode :: T.Text -> Bool -> Bool -> Bool -> Bool -> Node
|
||||
emptyNode text edit delete reply act = Node text edit delete reply act Map.empty
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue