Skip to content

Commit

Permalink
feat(jsbattle-webpage): add code folding
Browse files Browse the repository at this point in the history
  • Loading branch information
jamro committed Dec 11, 2019
1 parent cec42e5 commit 573e33a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/jsbattle-webpage/build/libs.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{"from": "/node_modules/codemirror/lib/**/*", "to": "/dist/vendor/codemirror/lib"},
{"from": "/node_modules/codemirror/mode/javascript/**/*", "to": "/dist/vendor/codemirror/mode"},
{"from": "/node_modules/codemirror/addon/hint/**/*", "to": "/dist/vendor/codemirror/addon/hint"},
{"from": "/node_modules/codemirror/addon/fold/**/*", "to": "/dist/vendor/codemirror/addon/fold"},
{"from": "/node_modules/codemirror/theme/ambiance.css", "to": "/dist/vendor/codemirror/theme"},
{"from": "/node_modules/popper.js/dist/umd/**/*", "to": "/dist/vendor/popperjs"},
{"from": "/node_modules/@fortawesome/fontawesome-free/**/*", "to": "/dist/vendor/fontawesome"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ export default class CodeArea extends React.Component {
mode: "javascript",
theme: 'ambiance',
tabSize: 2,
viewportMargin: Infinity
viewportMargin: Infinity,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
});
this.codeMirror.on('change', () => {
this.props.onChange(this.codeMirror.getValue());
Expand Down
4 changes: 4 additions & 0 deletions packages/jsbattle-webpage/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="vendor/codemirror/lib/codemirror.css" rel="stylesheet">
<link href="vendor/codemirror/addon/hint/show-hint.css" rel="stylesheet">
<link href="vendor/codemirror/addon/fold/foldgutter.css" rel="stylesheet">
<link href="vendor/codemirror/theme/ambiance.css" rel="stylesheet">
<link href="vendor/fontawesome/css/all.min.css" rel="stylesheet">
<link href="css/jsbattle.css" rel="stylesheet">
Expand Down Expand Up @@ -56,6 +57,9 @@
<script type="text/javascript" src="vendor/codemirror/mode/javascript.js"></script>
<script type="text/javascript" src="vendor/codemirror/addon/hint/show-hint.js"></script>
<script type="text/javascript" src="vendor/codemirror/addon/hint/javascript-hint.js"></script>
<script type="text/javascript" src="vendor/codemirror/addon/fold/foldcode.js"></script>
<script type="text/javascript" src="vendor/codemirror/addon/fold/foldgutter.js"></script>
<script type="text/javascript" src="vendor/codemirror/addon/fold/brace-fold.js"></script>
<script type="text/javascript" src="vendor/clipboard.min.js"></script>
<script type="text/javascript" src="vendor/ajv.min.js"></script>
<script type="text/javascript" src="js/highlight.pack.js"></script>
Expand Down

0 comments on commit 573e33a

Please sign in to comment.