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
131
Issues
131
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
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
cf7c31e2
Commit
cf7c31e2
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
b477c999
Pipeline
#7315
passed with stages
in 23 minutes and 59 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletion
+34
-1
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+14
-1
Clipboard.js
src/Gargantext/Utils/Clipboard.js
+10
-0
Clipboard.purs
src/Gargantext/Utils/Clipboard.purs
+10
-0
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
cf7c31e2
...
...
@@ -24,6 +24,7 @@ import Gargantext.Types (ID, NodeID, NodeType)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.SimpleJSON as GUSJ
import Gargantext.Utils.Clipboard (clipboard)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
...
...
@@ -204,7 +205,19 @@ shareURLInnercpt :: R.Component (url :: String)
shareURLInnercpt = here.component "shareURLInner" cpt
where
cpt { url } _ = do
pure $ Tools.panel { mError: Nothing } [ H.div {} [ H.text url ] ]
R.useEffect' $ clipboard ".copy" url "portal"
pure $ Tools.panel { mError: Nothing }
[ 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, id, nodeType } = get session $ GR.ShareURL id nodeType
src/Gargantext/Utils/Clipboard.js
0 → 100644
View file @
cf7c31e2
import
ClipboardJS
from
"clipboard"
;
export
function
_clipboard
(
el
,
url
,
modal_id
)
{
return
new
ClipboardJS
(
el
,
{
container
:
document
.
getElementById
(
modal_id
),
text
:
function
(
trigger
)
{
return
url
}
});
}
\ No newline at end of file
src/Gargantext/Utils/Clipboard.purs
0 → 100644
View file @
cf7c31e2
module Gargantext.Utils.Clipboard where
import Effect (Effect)
import Effect.Uncurried (EffectFn3, runEffectFn3)
import Gargantext.Prelude
foreign import _clipboard :: EffectFn3 String String String Unit
clipboard :: String -> String -> String -> Effect Unit
clipboard = runEffectFn3 _clipboard
\ No newline at end of file
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