mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-25 01:08:30 +03:00
disable navigation while explorer open
This commit is contained in:
parent
6d13daed45
commit
4136bc63b4
@ -72,7 +72,8 @@ termEditor term0 = do
|
||||
in
|
||||
mapDyn f state
|
||||
terms <- holdDyn term0 (fmapMaybe (\TermExplorer.S{..} -> Paths.asTerm overallTerm) (updated state))
|
||||
(e, dims, path) <- elClass "div" "root" $ DocView.widgets (dropWhen isExplorerOpen' keydown) (Width 400) docs
|
||||
(e, dims, path) <- elClass "div" "root" $
|
||||
DocView.widgets (dropWhen isExplorerOpen' keydown) (dropWhen isExplorerOpen') (Width 400) docs
|
||||
info <- do
|
||||
let f e p = liftIO . Note.run $ Node.localInfo node e p
|
||||
infos <- pure $ pushAlways (\_ -> f <$> sample (current terms) <*> sample (current path)) openEvent
|
||||
|
@ -29,10 +29,11 @@ import qualified Unison.Signals as S
|
||||
import qualified Unison.UI as UI
|
||||
|
||||
widgets :: (Show p, Path p, Eq p, MonadWidget t m)
|
||||
=> Event t Int -> Width -> Dynamic t (Doc Text p)
|
||||
=> Event t Int -> (Event t (X,Y) -> Event t (X,Y))
|
||||
-> Width -> Dynamic t (Doc Text p)
|
||||
-> m (Dynamic t (Maybe (El t)), Dynamic t (Width,Height), Dynamic t p)
|
||||
widgets keydown available docs = do
|
||||
p <- dyn =<< mapDyn (\doc -> widget keydown available doc) docs
|
||||
widgets keydown filterMouse available docs = do
|
||||
p <- dyn =<< mapDyn (\doc -> widget keydown filterMouse available doc) docs
|
||||
els <- holdDyn Nothing $ (\(e,_,_) -> Just e) <$> p
|
||||
dims <- holdDyn (Width 0, Height 0) ((\(_,xy,_) -> xy) <$> p)
|
||||
p0 <- S.now Path.root
|
||||
@ -41,8 +42,9 @@ widgets keydown available docs = do
|
||||
pure (els, dims, paths)
|
||||
|
||||
widget :: (Show p, Path p, Eq p, MonadWidget t m)
|
||||
=> Event t Int -> Width -> Doc Text p -> m (El t, (Width,Height), Dynamic t p)
|
||||
widget keydown available d =
|
||||
=> Event t Int -> (Event t (X,Y) -> Event t (X,Y))
|
||||
-> Width -> Doc Text p -> m (El t, (Width,Height), Dynamic t p)
|
||||
widget keydown filterMouse available d =
|
||||
let
|
||||
leaf txt = Text.replace " " " " txt
|
||||
width (_, (w,_)) = w
|
||||
@ -77,7 +79,7 @@ widget keydown available d =
|
||||
let (_, (_,_,w,h)) = Doc.root b
|
||||
node <- runDom $ interpret (Doc.flatten b)
|
||||
(e,_) <- el' "div" $ unsafePlaceElement (Dom.unsafeAsHTMLElement node)
|
||||
mouse <- UI.mouseMove' e
|
||||
mouse <- filterMouse <$> UI.mouseMove' e
|
||||
nav <- pure $ mergeWith (.) [
|
||||
const (Doc.up b) <$> (traceEvent "up" $ S.upArrow keydown),
|
||||
const (Doc.down b) <$> (traceEvent "down" $ S.downArrow keydown),
|
||||
|
@ -138,7 +138,7 @@ formatResult :: MonadWidget t m
|
||||
formatResult name e as w =
|
||||
let doc = Views.term name e
|
||||
txt = Text.unpack . Text.concat $ Doc.tokens "\n" (Doc.flow doc)
|
||||
in (txt, w (as <$ DocView.widget never (Dimensions.Width 300) doc))
|
||||
in (txt, w (as <$ DocView.widget never (const never) (Dimensions.Width 300) doc))
|
||||
|
||||
formatLocals :: MonadWidget t m
|
||||
=> (Reference -> Symbol View.DFO)
|
||||
|
Loading…
Reference in New Issue
Block a user