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
e184d32a
Commit
e184d32a
authored
Dec 28, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[input with autocomplete] fix reactix call for blur
Add Reactix.preventDefault/stopPropagation
parent
279d1985
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
12 deletions
+37
-12
Search.purs
src/Gargantext/Components/GraphExplorer/Search.purs
+0
-1
InputWithAutocomplete.purs
src/Gargantext/Components/InputWithAutocomplete.purs
+2
-0
Reactix.js
src/Gargantext/Utils/Reactix.js
+25
-10
Reactix.purs
src/Gargantext/Utils/Reactix.purs
+10
-1
No files found.
src/Gargantext/Components/GraphExplorer/Search.purs
View file @
e184d32a
...
@@ -4,7 +4,6 @@ module Gargantext.Components.GraphExplorer.Search
...
@@ -4,7 +4,6 @@ module Gargantext.Components.GraphExplorer.Search
import Prelude
import Prelude
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Set as Set
import Data.Set as Set
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Reactix as R
import Reactix as R
...
...
src/Gargantext/Components/InputWithAutocomplete.purs
View file @
e184d32a
...
@@ -79,6 +79,8 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
...
@@ -79,6 +79,8 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
onInputKeyUp :: R.Ref (Nullable DOM.Element) -> DE.KeyboardEvent -> Effect Boolean
onInputKeyUp :: R.Ref (Nullable DOM.Element) -> DE.KeyboardEvent -> Effect Boolean
onInputKeyUp inputRef e = do
onInputKeyUp inputRef e = do
if DE.key e == "Enter" then do
if DE.key e == "Enter" then do
R2.preventDefault e
R2.stopPropagation e
let val = R.unsafeEventValue e
let val = R.unsafeEventValue e
let mInput = toMaybe $ R.readRef inputRef
let mInput = toMaybe $ R.readRef inputRef
T.write_ val state
T.write_ val state
...
...
src/Gargantext/Utils/Reactix.js
View file @
e184d32a
...
@@ -27,12 +27,27 @@ function domRectFromRect(obj) {
...
@@ -27,12 +27,27 @@ function domRectFromRect(obj) {
return
DOMRectReadOnly
.
fromRect
(
obj
)
return
DOMRectReadOnly
.
fromRect
(
obj
)
}
}
function
preventDefault
(
e
)
{
return
e
.
preventDefault
();
}
function
stopPropagation
(
e
)
{
return
e
.
stopPropagation
();
}
function
blur
(
el
)
{
return
el
.
blur
();
}
exports
.
_addRootElement
=
addRootElement
;
exports
.
_addRootElement
=
addRootElement
;
exports
.
_getSelection
=
getSelection
;
exports
.
_getSelection
=
getSelection
;
exports
.
_stringify
=
stringify
;
exports
.
_stringify
=
stringify
;
exports
.
_postMessage
=
postMessage
;
exports
.
_postMessage
=
postMessage
;
exports
.
_setCookie
=
setCookie
;
exports
.
_setCookie
=
setCookie
;
exports
.
_domRectFromRect
=
domRectFromRect
;
exports
.
_domRectFromRect
=
domRectFromRect
;
exports
.
_preventDefault
=
preventDefault
;
exports
.
_stopPropagation
=
stopPropagation
;
exports
.
_blur
=
blur
;
exports
.
_keyCode
=
function
(
e
)
{
exports
.
_keyCode
=
function
(
e
)
{
// https://www.w3schools.com/jsref/event_key_keycode.asp
// https://www.w3schools.com/jsref/event_key_keycode.asp
...
...
src/Gargantext/Utils/Reactix.purs
View file @
e184d32a
...
@@ -335,14 +335,23 @@ inputFileNameWithBlob n e = case ff of
...
@@ -335,14 +335,23 @@ inputFileNameWithBlob n e = case ff of
where
where
ff = inputFile n e
ff = inputFile n e
foreign import _preventDefault :: forall e. EffectFn1 e Unit
preventDefault :: forall e. DE.IsEvent e => e -> Effect Unit
preventDefault = runEffectFn1 _preventDefault
foreign import _stopPropagation :: forall e. EffectFn1 e Unit
stopPropagation :: forall e. DE.IsEvent e => e -> Effect Unit
stopPropagation = runEffectFn1 _stopPropagation
-- | Get blob from a drop event
-- | Get blob from a drop event
--dataTransferFileBlob :: forall e. DE.IsEvent e => RE.SyntheticEvent e -> Effect Blob
--dataTransferFileBlob :: forall e. DE.IsEvent e => RE.SyntheticEvent e -> Effect Blob
dataTransferFileBlob e = unsafePartial $ do
dataTransferFileBlob e = unsafePartial $ do
let ff = fromJust $ item 0 $ ((e .. "dataTransfer" .. "files") :: FileList)
let ff = fromJust $ item 0 $ ((e .. "dataTransfer" .. "files") :: FileList)
pure $ WF.toBlob ff
pure $ WF.toBlob ff
foreign import _blur :: EffectFn1 DOM.Element Unit
blur :: DOM.Element -> Effect Unit
blur :: DOM.Element -> Effect Unit
blur
el = el ... "blur" $ []
blur
= runEffectFn1 _blur
row :: Array R.Element -> R.Element
row :: Array R.Element -> R.Element
row children = H.div { className: "row" } children
row children = H.div { className: "row" } children
...
...
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