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
137
Issues
137
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
bf623050
Commit
bf623050
authored
Jan 15, 2025
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Action share] Implement clipboard functionality for sharing URLs
parent
514d4953
Pipeline
#7560
passed with stages
in 20 minutes and 5 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+13
-1
Clipboard.js
src/Gargantext/Utils/Clipboard.js
+12
-0
Clipboard.purs
src/Gargantext/Utils/Clipboard.purs
+10
-0
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
bf623050
...
@@ -24,6 +24,7 @@ import Gargantext.Types (ID, NodeID, NodeType)
...
@@ -24,6 +24,7 @@ import Gargantext.Types (ID, NodeID, NodeType)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.SimpleJSON as GUSJ
import Gargantext.Utils.SimpleJSON as GUSJ
import Gargantext.Utils.Clipboard (modalClipboard)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Simple.JSON as JSON
...
@@ -212,12 +213,23 @@ shareURLInnercpt :: R.Component (url :: String)
...
@@ -212,12 +213,23 @@ shareURLInnercpt :: R.Component (url :: String)
shareURLInnercpt = here.component "shareURLInner" cpt
shareURLInnercpt = here.component "shareURLInner" cpt
where
where
cpt { url } _ = do
cpt { url } _ = do
R.useEffect' $ modalClipboard ".copy" url
pure $ Tools.panelNoFooter
pure $ Tools.panelNoFooter
{ mError: Nothing
{ mError: Nothing
, iconName: "share-alt"
, iconName: "share-alt"
, textTitle: "Share the node (URL)"
, textTitle: "Share the node (URL)"
}
}
[ H.div {} [ H.text url ] ]
[ H.div {}
[ H.text url
, B.iconButton
{ name: "clone"
, title: "Copy to clipboard"
, className: "copy"
, callback: \_ -> pure unit
}
]
]
loadUrl :: { session :: Session, id :: NodeID, nodeType :: NodeType } -> AffRESTError String
loadUrl :: { session :: Session, id :: NodeID, nodeType :: NodeType } -> AffRESTError String
loadUrl { session, id, nodeType } = get session $ GR.ShareURL id nodeType
loadUrl { session, id, nodeType } = get session $ GR.ShareURL id nodeType
src/Gargantext/Utils/Clipboard.js
0 → 100644
View file @
bf623050
import
ClipboardJS
from
"clipboard"
;
export
function
_modalClipboard
(
el
,
url
)
{
modal_id
=
document
.
getElementsByClassName
(
"b-modal modal show"
)[
0
].
id
return
new
ClipboardJS
(
el
,
{
container
:
document
.
getElementById
(
modal_id
),
text
:
function
(
trigger
)
{
return
url
}
});
}
src/Gargantext/Utils/Clipboard.purs
0 → 100644
View file @
bf623050
module Gargantext.Utils.Clipboard where
import Effect (Effect)
import Effect.Uncurried (EffectFn2, runEffectFn2)
import Gargantext.Prelude
foreign import _modalClipboard :: EffectFn2 String String Unit
modalClipboard :: String -> String -> Effect Unit
modalClipboard = runEffectFn2 _modalClipboard
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