You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| basic | boolean | Use [basicSetup](https://codemirror.net/docs/ref/#codemirror.basicSetup). |
32
-
| minimal | boolean | Use [miniSetup](https://codemirror.net/docs/ref/#codemirror.minimalSetup). If a `basic` prop is also specified, that setting will take precedence. |
33
-
| dark | boolean | Toggle Darkmode. |
34
-
| wrap | boolean | Line text wrapping. see [lineWrapping](https://codemirror.net/6/docs/ref/#view.EditorView.lineWrapping). |
35
-
| tab | boolean | Enables tab indentation. |
36
-
| theme | { [selector: string]: StyleSpec } | Specify the theme. For example, if you use [@codemirror/theme-one-dark](https://github.com/codemirror/theme-one-dark), import `oneDark` and put it in this prop. |
37
-
| readonly | boolean | Makes the cursor visible or you can drag the text but not edit the value. |
38
-
| editable | boolean | When this is set to false, it is similar to `readonly`, except that the cursor is not displayed like the normal pre tag. |
39
-
| lang | LanguageSupport | The language you want to have syntax highlighting. see <https://codemirror.net/6/#languages>|
40
-
| phrases | Record<string, string>| Specify here if you want to make the displayed character string multilingual. see <https://codemirror.net/6/examples/translate/>|
41
-
| extensions | Extension[]| Includes enhancements to extend CodeMirror. |
42
-
| linter | LintSource | Set Linter. Enter a linter (eg `esLint([arbitrary rule])` function for `@codemirror / lang-javascript`, `jsonParseLinter()`function for`@codemirror/json`). See the sources for various language libraries for more information. |
43
-
| lintGutter | boolean | Display 🔴 on the line where there was an error when `linter` was specified. It will not work if `linter` is not specified. |
| basic | boolean | Use [basicSetup](https://codemirror.net/docs/ref/#codemirror.basicSetup). |
32
+
| minimal | boolean | Use [miniSetup](https://codemirror.net/docs/ref/#codemirror.minimalSetup). If a `basic` prop is also specified, that setting will take precedence. |
33
+
| dark | boolean | Toggle Darkmode. |
34
+
| wrap | boolean | Line text wrapping. see [lineWrapping](https://codemirror.net/6/docs/ref/#view.EditorView.lineWrapping). |
35
+
| tab | boolean | Enables tab indentation. |
36
+
| theme | { [selector: string]: StyleSpec } | Specify the theme. For example, if you use [@codemirror/theme-one-dark](https://github.com/codemirror/theme-one-dark), import `oneDark` and put it in this prop. |
37
+
| readonly | boolean | Makes the cursor visible or you can drag the text but not edit the value. |
38
+
| editable | boolean | When this is set to false, it is similar to `readonly`, except that the cursor is not displayed like the normal pre tag. |
39
+
| lang | LanguageSupport | The language you want to have syntax highlighting. see <https://codemirror.net/6/#languages>|
40
+
| phrases | Record<string, string>| Specify here if you want to make the displayed character string multilingual. see <https://codemirror.net/6/examples/translate/>|
41
+
| extensions | Extension[]| Includes enhancements to extend CodeMirror. |
42
+
| linter | LintSource | Set Linter. Enter a linter (eg `esLint([arbitrary rule])` function for `@codemirror/lang-javascript`, `jsonParseLinter()`function for`@codemirror/json`). See the sources for various language libraries for more information. |
43
+
| lintGutter | boolean | Display 🔴 on the line where there was an error when `linter` was specified. It will not work if `linter` is not specified. |
44
+
| tag | string | HTML tags used in the component. (Default is `div` tag.) |
44
45
45
46
Notice: `lang` and `linter` can also be set together in `extensions`. This is defined for usability compatibility with past CodeMirrors.
| selection | Get and set the [EditorSelection](https://codemirror.net/docs/ref/#state.EditorSelection) instance. |
259
+
| cursor | Get and set the [cursor](https://codemirror.net/docs/ref/#state.EditorSelection^cursor) location. |
260
+
| state | Get and set [EditorState](https://codemirror.net/docs/ref/#state.EditorState). |
261
+
| focus | Get and set [focus](https://codemirror.net/docs/ref/#view.EditorView.focus). |
262
+
263
+
The instructions below are compatible methods for those familiar with [codemirror5](https://codemirror.net/5/). Since the above method is usually sufficient, its active use is not recommended.
| getRange(from?: number, to?: number) | Get the text between the given points in the editor. |
268
+
| getLine(number: number) | Get the content of line. |
269
+
| lineCount() | Get the number of lines in the editor. |
270
+
| getCursor() | Retrieve one end of the primary selection. |
271
+
| listSelections() | Retrieves a list of all current selections. |
272
+
| getSelection() | Get the currently selected code. |
273
+
| getSelections() | The length of the given array should be the same as the number of active selections. |
274
+
| somethingSelected() | Return true if any text is selected. |
275
+
| replaceRange(replacement: string \| Text, from: number, to: number) | Replace the part of the document between from and to with the given string. |
276
+
| replaceSelection(replacement: string \| Text) | Replace the selection(s) with the given string. |
277
+
| setCursor(position: number) | Set the cursor position. |
278
+
| setSelection(anchor: number, head?: number) | Set a single selection range. |
279
+
| setSelections(ranges: readonly SelectionRange[], primary?: number) | Sets a new set of selections. |
280
+
| extendSelectionsBy(f: Function) | Applies the given function to all existing selections, and calls extendSelections on the result. |
268
281
269
282
## Recommendations
270
283
271
-
Since CodeMirror has a relatively large capacity, when using vite, it is recommended to set it to output as a separate file using the [`manualChunks`](https://vitejs.dev/guide/build.html#chunking-strategy) option at build time as shown below.
284
+
Since CodeMirror has a relatively large capacity, when using [vite](https://vitejs.dev), it is recommended to set it to output as a separate file using the [`manualChunks`](https://vitejs.dev/guide/build.html#chunking-strategy) option at build time as shown below.
0 commit comments