Skip to content

Commit f519c42

Browse files
committed
Update documents
1 parent 46af261 commit f519c42

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

README.md

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ yarn add vue-codemirror
8181
import Vue from 'vue'
8282
import VueCodemirror from 'vue-codemirror'
8383

84-
// import base styles
84+
// import base style
8585
import 'codemirror/lib/codemirror.css'
8686

8787
// import more codemirror resource...
@@ -98,7 +98,7 @@ Vue.use(VueCodemirror, /* {
9898
```javascript
9999
import { codemirror } from 'vue-codemirror'
100100

101-
// import base styles
101+
// import base style
102102
import 'codemirror/lib/codemirror.css'
103103

104104
// import more codemirror resource...
@@ -110,28 +110,6 @@ export default {
110110
}
111111
```
112112

113-
**defined codemirror mode**
114-
115-
```javascript
116-
import CodeMirror from 'codemirror'
117-
CodeMirror.defineMode('mymode', () => {
118-
return {
119-
token(stream, state) {
120-
if (stream.match("const")) {
121-
return "style1"
122-
} else if (stream.match("bbb")) {
123-
return "style2"
124-
} else {
125-
stream.next()
126-
return null
127-
}
128-
}
129-
}
130-
})
131-
132-
// Vue app...
133-
```
134-
135113
### Component
136114

137115
```vue
@@ -166,7 +144,7 @@ CodeMirror.defineMode('mymode', () => {
166144
// import language js
167145
import 'codemirror/mode/javascript/javascript.js'
168146
169-
// import theme css
147+
// import theme style
170148
import 'codemirror/theme/base16-dark.css'
171149
172150
// import more 'codemirror/some-resource...'
@@ -181,7 +159,7 @@ export default {
181159
theme: 'base16-dark',
182160
lineNumbers: true,
183161
line: true,
184-
// more codemirror options...
162+
// more CodeMirror options...
185163
}
186164
}
187165
},
@@ -203,17 +181,15 @@ export default {
203181
}
204182
},
205183
mounted() {
206-
console.log('the current codemirror instance object:', this.codemirror)
184+
console.log('the current CodeMirror instance object:', this.codemirror)
207185
// you can use this.codemirror to do something...
208186
}
209187
}
210188
</script>
211189
```
212190

213-
214191
### Codemirror Merge
215192

216-
217193
```vue
218194
<template>
219195
<codemirror :merge="true" :options="cmOption" @scroll="onCmScroll" />
@@ -259,7 +235,29 @@ export default {
259235
</script>
260236
```
261237

262-
### Codemirror language mode types
238+
### Defined Codemirror mode
239+
240+
```javascript
241+
import CodeMirror from 'codemirror'
242+
CodeMirror.defineMode('mymode', () => {
243+
return {
244+
token(stream, state) {
245+
if (stream.match("const")) {
246+
return "style1"
247+
} else if (stream.match("bbb")) {
248+
return "style2"
249+
} else {
250+
stream.next()
251+
return null
252+
}
253+
}
254+
}
255+
})
256+
257+
// Vue app...
258+
```
259+
260+
### CodeMirror language mode types
263261

264262
Codemirror language mode have [string | object](https://codemirror.net/doc/manual.html#option_mode) types.
265263

0 commit comments

Comments
 (0)