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
a1446170
Commit
a1446170
authored
Jan 02, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[code editor] fix codetype change from markdown to json
parent
a49918b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
CodeEditor.purs
src/Gargantext/Components/CodeEditor.purs
+0
-4
CodeSection.purs
src/Gargantext/Components/Corpus/CodeSection.purs
+6
-4
No files found.
src/Gargantext/Components/CodeEditor.purs
View file @
a1446170
...
...
@@ -111,7 +111,6 @@ renderPython s = s
-- | I took the idea from: https://github.com/satya164/react-simple-code-editor
codeEditor :: R2.Leaf Props
codeEditor = R2.leaf codeEditorCpt
codeEditorCpt :: R.Component Props
codeEditorCpt = here.component "codeEditor" cpt where
cpt {code, defaultCodeType, onChange} _ = do
...
...
@@ -245,7 +244,6 @@ type ToolbarProps =
toolbar :: R2.Leaf ToolbarProps
toolbar = R2.leaf toolbarCpt
toolbarCpt :: R.Component ToolbarProps
toolbarCpt = here.component "toolbar" cpt where
cpt { controls: { codeS, codeType, viewType }
...
...
@@ -294,7 +292,6 @@ type ErrorComponentProps =
errorComponent :: Record ErrorComponentProps -> R.Element
errorComponent p = R.createElement errorComponentCpt p []
errorComponentCpt :: R.Component ErrorComponentProps
errorComponentCpt = here.component "errorComponent" cpt
where
...
...
@@ -313,7 +310,6 @@ type CodeTypeSelectorProps =
codeTypeSelector :: R2.Leaf CodeTypeSelectorProps
codeTypeSelector = R2.leaf codeTypeSelectorCpt
codeTypeSelectorCpt :: R.Component CodeTypeSelectorProps
codeTypeSelectorCpt = here.component "codeTypeSelector" cpt where
cpt { codeType, onChange } _ = do
...
...
src/Gargantext/Components/Corpus/CodeSection.purs
View file @
a1446170
...
...
@@ -82,9 +82,11 @@ fieldsCodeEditorCpt = here.component "fieldsCodeEditorCpt" cpt
where
onChange :: Index -> FieldType -> Effect Unit
onChange idx typ = do
T.modify_ (\(FTFieldsWithIndex fs) ->
FTFieldsWithIndex $ fromMaybe fs $
List.modifyAt idx (\{ ftField: Field f} -> { idx, ftField: Field $ f { typ = typ } }) fs) fields
T.modify_ (
(\(FTFieldsWithIndex fs) ->
FTFieldsWithIndex $ fromMaybe fs $
List.modifyAt idx (\{ ftField: Field f} -> { idx, ftField: Field $ f { typ = typ } }) fs))
fields
onMoveDown :: T2.ReloadS -> Index -> Unit -> Effect Unit
onMoveDown masterKey idx _ = do
...
...
@@ -352,7 +354,7 @@ changeCode onc (Python {python}) CE.Markdown _ = onc $ Markdown $ defaultMarkdow
changeCode onc (Markdown _) CE.Haskell c = onc $ Haskell $ defaultHaskell' { haskell = c }
changeCode onc (Markdown _) CE.Python c = onc $ Python $ defaultPython' { python = c }
changeCode onc (Markdown _) CE.JSON c = onc $
Markdown $ defaultMarkdown' { text
= c }
changeCode onc (Markdown _) CE.JSON c = onc $
JSON $ defaultJSON' { desc
= c }
changeCode onc (Markdown md) CE.Markdown c = onc $ Markdown $ md { text = c }
changeCode onc (JSON j) CE.Haskell _ = onc $ Haskell $ defaultHaskell' { haskell = haskell }
...
...
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