generated from tweag/project
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Factor out Editor component. * Use Ace editor. * Working tests using Ace editor. * Styling.
- Loading branch information
1 parent
fc26dc5
commit 61d076c
Showing
6 changed files
with
133 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,3 +82,7 @@ button:not(:disabled) { | |
border-color: #c792fa; | ||
color: #212529; | ||
} | ||
|
||
.hidden { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import AceEditor from "react-ace"; | ||
|
||
import "ace-builds/src-noconflict/ext-language_tools"; | ||
import "ace-builds/src-noconflict/mode-plain_text"; | ||
import "ace-builds/src-noconflict/theme-clouds.js"; | ||
|
||
export default function Editor(props: { | ||
id: string, | ||
value: string, | ||
placeholder: string, | ||
readOnly?: boolean, | ||
onChange?: (value: string) => void | ||
}) { | ||
return ( | ||
<AceEditor | ||
mode="plain_text" | ||
theme="clouds" | ||
name={props.id} | ||
value={props.value} | ||
placeholder={props.placeholder} | ||
readOnly={props.readOnly} | ||
onChange={props.onChange} | ||
width="100%" | ||
height="100%" | ||
tabSize={2} | ||
enableBasicAutocompletion={true} | ||
enableLiveAutocompletion={true} | ||
enableSnippets={true} | ||
/> | ||
) | ||
} | ||
|