@@ -81,7 +81,7 @@ yarn add vue-codemirror
81
81
import Vue from ' vue'
82
82
import VueCodemirror from ' vue-codemirror'
83
83
84
- // import base styles
84
+ // import base style
85
85
import ' codemirror/lib/codemirror.css'
86
86
87
87
// import more codemirror resource...
@@ -98,7 +98,7 @@ Vue.use(VueCodemirror, /* {
98
98
``` javascript
99
99
import { codemirror } from ' vue-codemirror'
100
100
101
- // import base styles
101
+ // import base style
102
102
import ' codemirror/lib/codemirror.css'
103
103
104
104
// import more codemirror resource...
@@ -110,28 +110,6 @@ export default {
110
110
}
111
111
```
112
112
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
-
135
113
### Component
136
114
137
115
``` vue
@@ -166,7 +144,7 @@ CodeMirror.defineMode('mymode', () => {
166
144
// import language js
167
145
import 'codemirror/mode/javascript/javascript.js'
168
146
169
- // import theme css
147
+ // import theme style
170
148
import 'codemirror/theme/base16-dark.css'
171
149
172
150
// import more 'codemirror/some-resource...'
@@ -181,7 +159,7 @@ export default {
181
159
theme: 'base16-dark',
182
160
lineNumbers: true,
183
161
line: true,
184
- // more codemirror options...
162
+ // more CodeMirror options...
185
163
}
186
164
}
187
165
},
@@ -203,17 +181,15 @@ export default {
203
181
}
204
182
},
205
183
mounted() {
206
- console.log('the current codemirror instance object:', this.codemirror)
184
+ console.log('the current CodeMirror instance object:', this.codemirror)
207
185
// you can use this.codemirror to do something...
208
186
}
209
187
}
210
188
</script>
211
189
```
212
190
213
-
214
191
### Codemirror Merge
215
192
216
-
217
193
``` vue
218
194
<template>
219
195
<codemirror :merge="true" :options="cmOption" @scroll="onCmScroll" />
@@ -259,7 +235,29 @@ export default {
259
235
</script>
260
236
```
261
237
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
263
261
264
262
Codemirror language mode have [ string | object] ( https://codemirror.net/doc/manual.html#option_mode ) types.
265
263
0 commit comments