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
900956af
Commit
900956af
authored
Jan 15, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Markdown] first draft of the markdown editor
parent
7b864b3a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
1 deletion
+85
-1
packages.json
.psc-package/local/.set/packages.json
+22
-0
packages.dhall
packages.dhall
+22
-0
psc-package.json
psc-package.json
+2
-0
MarkdownEditor.purs
src/Gargantext/Components/MarkdownEditor.purs
+33
-0
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+6
-1
No files found.
.psc-package/local/.set/packages.json
View file @
900956af
...
...
@@ -1475,6 +1475,21 @@
"repo"
:
"https://github.com/justinwoo/purescript-makkori.git"
,
"version"
:
"v1.0.0"
},
"markdown"
:
{
"dependencies"
:
[
"precise"
],
"repo"
:
"https://github.com/poorscript/purescript-markdown"
,
"version"
:
"master"
},
"markdown-smolder"
:
{
"dependencies"
:
[
"markdown"
,
"smolder"
],
"repo"
:
"https://github.com/poorscript/purescript-markdown-smolder"
,
"version"
:
"master"
},
"math"
:
{
"dependencies"
:
[],
"repo"
:
"https://github.com/purescript/purescript-math.git"
,
...
...
@@ -2041,6 +2056,13 @@
"repo"
:
"https://github.com/purescript-node/purescript-posix-types.git"
,
"version"
:
"v4.0.0"
},
"precise"
:
{
"dependencies"
:
[
"prelude"
],
"repo"
:
"https://github.com/poorscript/purescript-precise"
,
"version"
:
"master"
},
"prelude"
:
{
"dependencies"
:
[],
"repo"
:
"https://github.com/purescript/purescript-prelude.git"
,
...
...
packages.dhall
View file @
900956af
...
...
@@ -191,6 +191,28 @@ let additions =
[ "aff", "arraybuffer-types", "web-file", "web-html" ]
"https://github.com/nwolverson/purescript-dom-filereader"
"v5.0.0"
, markdown =
mkPackage
[ "precise" ]
{- "https://github.com/slamdata/purescript-markdown"
"v12.0.0" -}
"https://github.com/poorscript/purescript-markdown"
"master"
, markdown-smolder =
mkPackage
[ "markdown"
, "smolder" ]
{- "https://github.com/hgiasac/purescript-markdown-smolder"
"v2.0.1" -}
"https://github.com/poorscript/purescript-markdown-smolder"
"master"
, precise =
mkPackage
[ "prelude" ]
{- "https://github.com/purescript-contrib/purescript-precise"
"v3.0.1" -}
"https://github.com/poorscript/purescript-precise"
"master"
, reactix =
mkPackage
[ "aff"
...
...
psc-package.json
View file @
900956af
...
...
@@ -17,6 +17,7 @@
"globals"
,
"integers"
,
"js-timers"
,
"markdown-smolder"
,
"math"
,
"maybe"
,
"nonempty"
,
...
...
@@ -28,6 +29,7 @@
"read"
,
"routing"
,
"sequences"
,
"smolder"
,
"spec-discovery"
,
"spec-quickcheck"
,
"string-parsers"
,
...
...
src/Gargantext/Components/MarkdownEditor.purs
0 → 100644
View file @
900956af
module Gargantext.Components.MarkdownEditor where
import Data.Either (either, Either(..))
import Prelude (($), (>>>), identity, pure)
import Reactix as R
import Reactix.DOM.HTML as H
import Text.Markdown.SlamDown.Parser (parseMd)
import Text.Markdown.SlamDown.Smolder as MD
import Text.Markdown.SlamDown.Syntax (SlamDownP(..))
import Text.Smolder.Renderer.String (render)
type Props =
( md :: String
, nodeId :: Int
)
compileMd' :: forall e. MD.ToMarkupOptions e -> String -> String
compileMd' options input =
either identity (MD.toMarkup' options >>> render)
(parseMd input :: Either String (SlamDownP String))
compileMd :: String -> String
compileMd = compileMd' MD.defaultToMarkupOptions
markdownEditor :: Record Props -> R.Element
markdownEditor p = R.createElement markdownEditorCpt p []
markdownEditorCpt :: R.Component Props
markdownEditorCpt = R.hooksComponent "G.C.MarkdownEditor" cpt
where
cpt {md, nodeId} _ =
pure $
H.div {} [ H.text $ compileMd md ]
src/Gargantext/Components/Nodes/Corpus.purs
View file @
900956af
...
...
@@ -9,6 +9,7 @@ import Effect.Exception (error)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.MarkdownEditor (markdownEditor)
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Types (NodeType(..), AffTableResult)
import Gargantext.Routes (SessionRoute(NodeAPI, Children))
...
...
@@ -24,9 +25,13 @@ corpusLayoutCpt = R.staticComponent "G.P.Corpus.corpusLayout" cpt
where
cpt {nodeId} _ =
H.div {}
[ H.iframe { src: gargMd , width: "100%", height: "100%", style: {"border-style": "none"}} []
[
markdownEditor {md, nodeId}
--H.iframe { src: gargMd , width: "100%", height: "100%", style: {"border-style": "none"}} []
]
gargMd = "https://hackmd.iscpif.fr/g9Aah4iwQtCayIzsKQjA0Q#"
md = "# Hello world"
newtype CorpusInfo =
CorpusInfo
{ title :: String
...
...
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