Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
ce563ccf
Commit
ce563ccf
authored
May 13, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[contextMenu] some work on the context menu clickability
parent
a55f5ac0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
29 deletions
+38
-29
packages.json
.psc-package/local/.set/packages.json
+15
-10
purs-packages.nix
nix/purs-packages.nix
+9
-9
AnnotatedField.purs
src/Gargantext/Components/Annotation/AnnotatedField.purs
+0
-4
ContextMenu.purs
src/Gargantext/Components/ContextMenu/ContextMenu.purs
+7
-6
Reactix.purs
src/Gargantext/Utils/Reactix.purs
+7
-0
No files found.
.psc-package/local/.set/packages.json
View file @
ce563ccf
...
...
@@ -989,7 +989,7 @@
"prelude"
,
"unsafe-coerce"
],
"repo"
:
"https://github.com/
poorscript
/purescript-dom-simple"
,
"repo"
:
"https://github.com/
irresponsible
/purescript-dom-simple"
,
"version"
:
"v0.2.7"
},
"dotenv"
:
{
...
...
@@ -1218,7 +1218,7 @@
"nullable"
,
"unsafe-coerce"
],
"repo"
:
"https://github.com/
poorscript
/purescript-ffi-simple"
,
"repo"
:
"https://github.com/
irresponsible
/purescript-ffi-simple"
,
"version"
:
"v0.2.10"
},
"filterable"
:
{
...
...
@@ -1411,9 +1411,13 @@
},
"formula"
:
{
"dependencies"
:
[
"effect"
,
"prelude"
,
"reactix"
,
"record"
,
"toestand"
,
"tuples"
,
"typelevel-prelude"
,
"typisch"
],
"repo"
:
"https://github.com/poorscript/purescript-formula"
,
...
...
@@ -3812,10 +3816,9 @@
"functions"
,
"nullable"
,
"prelude"
,
"tuples"
,
"unsafe-coerce"
],
"repo"
:
"https://github.com/
poorscript
/purescript-reactix"
,
"repo"
:
"https://github.com/
irresponsible
/purescript-reactix"
,
"version"
:
"v0.4.11"
},
"read"
:
{
...
...
@@ -4719,12 +4722,14 @@
"dependencies"
:
[
"aff"
,
"coroutines"
,
"web-dom"
,
"freet"
,
"profunctor-lenses"
,
"react"
"react"
,
"react-dom"
],
"repo"
:
"https://github.com/p
af31
/purescript-thermite.git"
,
"version"
:
"
v6.3.1
"
"repo"
:
"https://github.com/p
oorscript
/purescript-thermite.git"
,
"version"
:
"
hide-2020-03-04
"
},
"thermite-dom"
:
{
"dependencies"
:
[
...
...
@@ -4746,13 +4751,13 @@
},
"toestand"
:
{
"dependencies"
:
[
"prelude"
,
"effect"
,
"foldable-traversable"
,
"reactix"
,
"prelude"
,
"record"
,
"tuples"
,
"typelevel-prelude"
"typelevel-prelude"
,
"typisch"
],
"repo"
:
"https://github.com/poorscript/purescript-toestand"
,
"version"
:
"v0.6.1"
...
...
nix/purs-packages.nix
View file @
ce563ccf
...
...
@@ -212,7 +212,7 @@
name
=
"dom-simple"
;
version
=
"v0.2.7"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/
poorscript
/purescript-dom-simple"
;
url
=
"https://github.com/
irresponsible
/purescript-dom-simple"
;
rev
=
"v0.2.7"
;
sha256
=
"02f1vsjk5frva3p3xpbrnj2zg4rg01l07dnvc3i6axvc5k30i282"
;
};
...
...
@@ -266,7 +266,7 @@
name
=
"ffi-simple"
;
version
=
"v0.2.10"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/
poorscript
/purescript-ffi-simple"
;
url
=
"https://github.com/
irresponsible
/purescript-ffi-simple"
;
rev
=
"v0.2.10"
;
sha256
=
"14slcccmy96ml7r8rzhhqnw486qj1b385i9095fdymms78g5gnj5"
;
};
...
...
@@ -372,11 +372,11 @@
};
"generics-rep"
=
{
name
=
"generics-rep"
;
version
=
"v6.1.
1
"
;
version
=
"v6.1.
3
"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/purescript/purescript-generics-rep.git"
;
rev
=
"v6.1.
1
"
;
sha256
=
"1
5vchzbcvf6byks90q14lvcwb8hnxqzm2mrlxi7v1f7has4s74kn
"
;
rev
=
"v6.1.
3
"
;
sha256
=
"1
8yz3wfhh0xk1aw6scgv94mlr0hyf0q1ydhi8y3wm4zlch0lpy5i
"
;
};
};
"globals"
=
{
...
...
@@ -705,11 +705,11 @@
};
"proxy"
=
{
name
=
"proxy"
;
version
=
"v3.0.
0
"
;
version
=
"v3.0.
2
"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/purescript/purescript-proxy.git"
;
rev
=
"v3.0.
0
"
;
sha256
=
"0
rqf25b1n9p5sgx7gdsxwrfv9rb3sqxgqmqpp5kdm30lfk7snz24
"
;
rev
=
"v3.0.
2
"
;
sha256
=
"0
p941cp8qz7dqyvybm7l1dyx6hbid4azxf35clj9i0zxr4k3vb8l
"
;
};
};
"psci-support"
=
{
...
...
@@ -752,7 +752,7 @@
name
=
"reactix"
;
version
=
"v0.4.11"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/
poorscript
/purescript-reactix"
;
url
=
"https://github.com/
irresponsible
/purescript-reactix"
;
rev
=
"v0.4.11"
;
sha256
=
"1prxqww81lk32cp4mr318yanvf51kf9hz7x4n6rxdbcprj27710d"
;
};
...
...
src/Gargantext/Components/Annotation/AnnotatedField.purs
View file @
ce563ccf
...
...
@@ -70,10 +70,8 @@ annotatedFieldInner p = R.createElement annotatedFieldInnerCpt p []
annotatedFieldInnerCpt :: R.Component InnerProps
annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where
cpt { menuRef, ngrams, redrawMenu, setTermList, text: fieldText } _ = do
-- redrawMenu <- T.useBox false
redrawMenu' <- T.useLive T.unequal redrawMenu
-- menuRef <- R.useRef (Nothing :: Maybe (Record AnnotationMenu))
-- menu <- T.useBox (Nothing :: Maybe (Record AnnotationMenu))
let wrap (text /\ list) = { list
...
...
@@ -138,8 +136,6 @@ showMenu { event, getList, menuRef, menuType, ngram, redrawMenu, setTermList } =
setList t = do
setTermList ngram list t
hideMenu { menuRef, redrawMenu }
-- here.log2 "x" x
-- here.log2 "y" y
E.preventDefault event
--range <- Sel.getRange sel 0
--here.log2 "selection range" $ Sel.rangeToTuple range
...
...
src/Gargantext/Components/ContextMenu/ContextMenu.purs
View file @
ce563ccf
...
...
@@ -36,12 +36,11 @@ contextMenu = R.createElement contextMenuCpt
contextMenuCpt :: forall t. R.Component (Props t)
contextMenuCpt = here.component "contextMenu" cpt
where
cpt menu@{
x, y, onClose
} children = do
cpt menu@{
onClose, x, y
} children = do
host <- R2.getPortalHost
root <- R.useRef null
-- rect <- T.useBox $ Just $ R2.domRectFromRect { x, y, width: 224.6, height: 102.0 }
let childRect = R2.boundingRect children
rect <- T.useBox $ Just $ R2.domRectFromRect { x, y, width: childRect.width, height: childRect.height }
-- NOTE: Just some dummy width/height here, it should be set properly in the effect function later
rect <- T.useBox $ Just $ R2.domRectFromRect { x, y, width: 100.0, height: 100.0 }
rect' <- T.useLive T.unequal rect
R.useLayoutEffect1 (R.readRef root) $ do
...
...
@@ -92,8 +91,10 @@ contextMenuEffect onClose rootRef =
documentClickHandler :: Effect Unit -> DOM.Element -> Callback DE.MouseEvent
documentClickHandler onClose menu =
R2.named "hideMenuOnClickOutside" $ callback $ \e ->
when (Element.contains menu (DE.target e)) onClose
R2.named "hideMenuOnClickOutside" $ callback $ \e -> do
when (R2.mouseClickInElement e menu) $ do
here.log "mouse in element"
onClose
documentScrollHandler :: Effect Unit -> Callback DE.MouseEvent
documentScrollHandler onClose =
...
...
src/Gargantext/Utils/Reactix.purs
View file @
ce563ccf
...
...
@@ -146,6 +146,13 @@ affEffect errmsg aff = do
mousePosition :: RE.SyntheticEvent DE.MouseEvent -> Point
mousePosition e = Point { x: RE.clientX e, y: RE.clientY e }
mouseClickInElement :: DE.MouseEvent -> DOM.Element -> Boolean
mouseClickInElement e el = x <= cx && cx <= x + width && y <= cy && cy <= y + height
where
{ x, y, width, height } = Element.boundingRect el
cx = DE.clientX e
cy = DE.clientY e
domMousePosition :: DE.MouseEvent -> Point
domMousePosition = mousePosition <<< unsafeCoerce
-- | This is naughty, it quietly mutates the input and returns it
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment