Skip to content

Commit

Permalink
add code folding support
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Aug 19, 2017
1 parent 1eb732d commit 5991ae2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/utils/create-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import 'codemirror/addon/edit/matchbrackets'
import 'codemirror/addon/edit/closebrackets'
import 'codemirror/addon/edit/closetag'
import 'codemirror/addon/comment/comment'
import 'codemirror/addon/fold/foldcode'
import 'codemirror/addon/fold/foldgutter'
import 'codemirror/addon/fold/brace-fold'
import 'codemirror/addon/fold/xml-fold'
import 'codemirror/addon/fold/markdown-fold'
import 'codemirror/addon/fold/comment-fold'

const isMac = CodeMirror.keyMap.default === CodeMirror.keyMap.macDefault

Expand All @@ -20,6 +26,8 @@ export default function (el, opts = {}) {
styleActiveLine: true,
matchTags: { bothTags: true },
matchBrackets: true,
foldGutter: true,
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
...opts
})

Expand Down
1 change: 1 addition & 0 deletions src/views/EditorPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
</script>

<style src="codemirror/lib/codemirror.css"></style>
<style src="codemirror/addon/fold/foldgutter.css"></style>

<style lang="stylus" scoped>
.pans
Expand Down

0 comments on commit 5991ae2

Please sign in to comment.