vue-codemirror6 1.6.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +6 -5
- package/README.md +24 -9
- package/dist/index.d.ts +381 -640
- package/dist/index.es.js +361 -354
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/package.json +72 -64
package/dist/index.d.ts
CHANGED
|
@@ -1,321 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vue-codemirror6
|
|
3
|
+
*
|
|
4
|
+
* @description CodeMirror6 Component for vue2 and vue3.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @version 1.7.0
|
|
8
|
+
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import { App } from 'vue-demi';
|
|
2
12
|
import { ComponentOptionsMixin } from 'vue';
|
|
3
13
|
import { ComponentProvideOptions } from 'vue';
|
|
4
14
|
import { DefineComponent } from 'vue';
|
|
5
15
|
import { EditorSelection } from '@codemirror/state';
|
|
6
16
|
import { EditorState } from '@codemirror/state';
|
|
7
|
-
import { EditorView } from '@codemirror/view';
|
|
17
|
+
import type { EditorView } from '@codemirror/view';
|
|
18
|
+
import { EditorView as EditorView_2 } from 'codemirror';
|
|
8
19
|
import { Extension } from '@codemirror/state';
|
|
9
20
|
import { ExtractPropTypes } from 'vue';
|
|
10
21
|
import { KeyBinding } from '@codemirror/view';
|
|
11
22
|
import { LanguageSupport } from '@codemirror/language';
|
|
12
23
|
import { LintSource } from '@codemirror/lint';
|
|
13
|
-
import { PropType } from 'vue
|
|
24
|
+
import { PropType } from 'vue';
|
|
14
25
|
import { PublicProps } from 'vue';
|
|
15
|
-
import { Ref } from 'vue
|
|
26
|
+
import { Ref } from 'vue';
|
|
16
27
|
import { SelectionRange } from '@codemirror/state';
|
|
17
|
-
import { ShallowRef } from 'vue
|
|
28
|
+
import { ShallowRef } from 'vue';
|
|
18
29
|
import { StateField } from '@codemirror/state';
|
|
19
|
-
import
|
|
30
|
+
import { StyleSpec } from 'style-mod';
|
|
20
31
|
import { Text as Text_2 } from '@codemirror/state';
|
|
21
32
|
import { ViewUpdate } from '@codemirror/view';
|
|
22
|
-
import {
|
|
33
|
+
import { VueElementConstructor } from 'vue';
|
|
34
|
+
import { WritableComputedRef } from 'vue';
|
|
23
35
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
type: PropType<string | Text_2>;
|
|
29
|
-
default: string;
|
|
36
|
+
export declare const CodeMirror: VueElementConstructor<ExtractPropTypes< {
|
|
37
|
+
readonly modelValue: {
|
|
38
|
+
readonly type: PropType<string | Text_2>;
|
|
39
|
+
readonly default: '';
|
|
30
40
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
|
|
35
|
-
*/
|
|
36
|
-
theme: {
|
|
37
|
-
type: PropType<Record<string, StyleSpec>>;
|
|
38
|
-
default: () => {};
|
|
39
|
-
};
|
|
40
|
-
/** Dark Mode */
|
|
41
|
-
dark: {
|
|
42
|
-
type: BooleanConstructor;
|
|
43
|
-
default: boolean;
|
|
41
|
+
readonly theme: {
|
|
42
|
+
readonly type: PropType<Record<string, StyleSpec>>;
|
|
43
|
+
readonly default: () => {};
|
|
44
44
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* This will enable the basic setup for the editor.
|
|
49
|
-
*
|
|
50
|
-
* @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
|
|
51
|
-
*/
|
|
52
|
-
basic: {
|
|
53
|
-
type: BooleanConstructor;
|
|
54
|
-
default: boolean;
|
|
45
|
+
readonly dark: {
|
|
46
|
+
readonly type: BooleanConstructor;
|
|
47
|
+
readonly default: false;
|
|
55
48
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
|
|
60
|
-
*/
|
|
61
|
-
minimal: {
|
|
62
|
-
type: BooleanConstructor;
|
|
63
|
-
default: boolean;
|
|
49
|
+
readonly basic: {
|
|
50
|
+
readonly type: BooleanConstructor;
|
|
51
|
+
readonly default: false;
|
|
64
52
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
* @see {@link https://codemirror.net/docs/ref/#view.placeholder}
|
|
69
|
-
*/
|
|
70
|
-
placeholder: {
|
|
71
|
-
type: PropType<string | HTMLElement>;
|
|
72
|
-
default: undefined;
|
|
53
|
+
readonly minimal: {
|
|
54
|
+
readonly type: BooleanConstructor;
|
|
55
|
+
readonly default: false;
|
|
73
56
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
* An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
|
|
78
|
-
*
|
|
79
|
-
* @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
|
|
80
|
-
*/
|
|
81
|
-
wrap: {
|
|
82
|
-
type: BooleanConstructor;
|
|
83
|
-
default: boolean;
|
|
57
|
+
readonly placeholder: {
|
|
58
|
+
readonly type: PropType<string | HTMLElement>;
|
|
59
|
+
readonly default: undefined;
|
|
84
60
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* This will enable the tab key to indent the current line or selection.
|
|
89
|
-
*
|
|
90
|
-
* @see {@link https://codemirror.net/examples/tab/}
|
|
91
|
-
*/
|
|
92
|
-
tab: {
|
|
93
|
-
type: BooleanConstructor;
|
|
94
|
-
default: boolean;
|
|
61
|
+
readonly wrap: {
|
|
62
|
+
readonly type: BooleanConstructor;
|
|
63
|
+
readonly default: false;
|
|
95
64
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* This is the unit of indentation used when the editor is configured to indent with tabs.
|
|
100
|
-
* It is also used to determine the size of the tab character when the editor is configured to use tabs for indentation..
|
|
101
|
-
*
|
|
102
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^indentUnit}
|
|
103
|
-
*/
|
|
104
|
-
indentUnit: {
|
|
105
|
-
type: StringConstructor;
|
|
106
|
-
default: undefined;
|
|
65
|
+
readonly tab: {
|
|
66
|
+
readonly type: BooleanConstructor;
|
|
67
|
+
readonly default: false;
|
|
107
68
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
* This allows the editor to have multiple selections at the same time.
|
|
112
|
-
* This is useful for editing multiple parts of the document at once.
|
|
113
|
-
* If this is set to true, the editor will allow multiple selections.
|
|
114
|
-
* If this is set to false, the editor will only allow a single selection.
|
|
115
|
-
*
|
|
116
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
|
|
117
|
-
*/
|
|
118
|
-
allowMultipleSelections: {
|
|
119
|
-
type: BooleanConstructor;
|
|
120
|
-
default: boolean;
|
|
69
|
+
readonly indentUnit: {
|
|
70
|
+
readonly type: StringConstructor;
|
|
71
|
+
readonly default: undefined;
|
|
121
72
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
* This is the number of spaces that a tab character represents in the editor.
|
|
126
|
-
* It is used to determine the size of the tab character when the editor is configured to use tabs for indentation.
|
|
127
|
-
* If this is set to a number, the editor will use that number of spaces for each tab character.
|
|
128
|
-
*
|
|
129
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
|
|
130
|
-
*/
|
|
131
|
-
tabSize: {
|
|
132
|
-
type: NumberConstructor;
|
|
133
|
-
default: undefined;
|
|
73
|
+
readonly allowMultipleSelections: {
|
|
74
|
+
readonly type: BooleanConstructor;
|
|
75
|
+
readonly default: false;
|
|
134
76
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
* This is the character that is used to separate lines in the editor.
|
|
139
|
-
* It is used to determine the line break character when the editor is configured to use a specific line break character.
|
|
140
|
-
*
|
|
141
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
|
|
142
|
-
*/
|
|
143
|
-
lineSeparator: {
|
|
144
|
-
type: StringConstructor;
|
|
145
|
-
default: undefined;
|
|
77
|
+
readonly tabSize: {
|
|
78
|
+
readonly type: NumberConstructor;
|
|
79
|
+
readonly default: undefined;
|
|
146
80
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* This is a CodeMirror Facet that allows you to set the editor to read-only mode.
|
|
151
|
-
* When this is set to true, the editor will not allow any changes to be made to the document.
|
|
152
|
-
* This is useful for displaying code that should not be edited, such as documentation or examples.
|
|
153
|
-
* If this is set to false, the editor will allow changes to be made to the document.
|
|
154
|
-
*
|
|
155
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
|
|
156
|
-
*/
|
|
157
|
-
readonly: {
|
|
158
|
-
type: BooleanConstructor;
|
|
159
|
-
default: boolean;
|
|
81
|
+
readonly lineSeparator: {
|
|
82
|
+
readonly type: StringConstructor;
|
|
83
|
+
readonly default: undefined;
|
|
160
84
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
* This is the reversed value of the CodeMirror editable.
|
|
165
|
-
* Similar to `readonly`, but setting this value to true disables dragging.
|
|
166
|
-
*
|
|
167
|
-
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
|
|
168
|
-
*/
|
|
169
|
-
disabled: {
|
|
170
|
-
type: BooleanConstructor;
|
|
171
|
-
default: boolean;
|
|
85
|
+
readonly readonly: {
|
|
86
|
+
readonly type: BooleanConstructor;
|
|
87
|
+
readonly default: false;
|
|
172
88
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
* You can use this to add any additional extensions that you want to use in the editor.
|
|
177
|
-
*
|
|
178
|
-
* @see {@link https://codemirror.net/docs/ref/#state.Extension}
|
|
179
|
-
*/
|
|
180
|
-
extensions: {
|
|
181
|
-
type: PropType<Extension[]>;
|
|
182
|
-
default: () => never[];
|
|
89
|
+
readonly disabled: {
|
|
90
|
+
readonly type: BooleanConstructor;
|
|
91
|
+
readonly default: false;
|
|
183
92
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
* This is a CodeMirror Facet that allows you to define custom phrases for the editor.
|
|
188
|
-
* It can be used to override default phrases or add new ones.
|
|
189
|
-
* This is useful for translating the editor to different languages or for customizing the editor's UI.
|
|
190
|
-
*
|
|
191
|
-
* @see {@link https://codemirror.net/examples/translate/}
|
|
192
|
-
*/
|
|
193
|
-
phrases: {
|
|
194
|
-
type: PropType<Record<string, string>>;
|
|
195
|
-
default: undefined;
|
|
93
|
+
readonly extensions: {
|
|
94
|
+
readonly type: PropType<Extension[]>;
|
|
95
|
+
readonly default: () => never[];
|
|
196
96
|
};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
* This is a CodeMirror Facet that allows you to define the language of the editor.
|
|
201
|
-
* It can be used to enable syntax highlighting and other language-specific features.
|
|
202
|
-
* It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
|
|
203
|
-
*
|
|
204
|
-
* @see {@link https://codemirror.net/docs/ref/#language}
|
|
205
|
-
*/
|
|
206
|
-
lang: {
|
|
207
|
-
type: PropType<LanguageSupport>;
|
|
208
|
-
default: undefined;
|
|
97
|
+
readonly phrases: {
|
|
98
|
+
readonly type: PropType<Record<string, string>>;
|
|
99
|
+
readonly default: undefined;
|
|
209
100
|
};
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
* This is a CodeMirror Facet that allows you to define a linter for the editor.
|
|
214
|
-
* It can be used to check the code for errors and warnings, and to provide feedback to the user.
|
|
215
|
-
* It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
|
|
216
|
-
* This is useful for providing feedback to the user about the code they are writing.
|
|
217
|
-
*
|
|
218
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.linter}
|
|
219
|
-
*/
|
|
220
|
-
linter: {
|
|
221
|
-
type: PropType<LintSource>;
|
|
222
|
-
default: undefined;
|
|
101
|
+
readonly lang: {
|
|
102
|
+
readonly type: PropType<LanguageSupport>;
|
|
103
|
+
readonly default: undefined;
|
|
223
104
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* This is a CodeMirror Facet that allows you to define the configuration for the linter.
|
|
228
|
-
* It can be used to specify options for the linter, such as the severity of errors and warnings, and to customize the behavior of the linter.
|
|
229
|
-
* This is useful for providing feedback to the user about the code they are writing.
|
|
230
|
-
*
|
|
231
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
|
|
232
|
-
*/
|
|
233
|
-
linterConfig: {
|
|
234
|
-
type: ObjectConstructor;
|
|
235
|
-
default: () => {};
|
|
105
|
+
readonly linter: {
|
|
106
|
+
readonly type: PropType<LintSource>;
|
|
107
|
+
readonly default: undefined;
|
|
236
108
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
* This is useful for running linters on the initial load of the editor, or when the user has made changes to the code and wants to see the results immediately.
|
|
241
|
-
*
|
|
242
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
|
|
243
|
-
*/
|
|
244
|
-
forceLinting: {
|
|
245
|
-
type: BooleanConstructor;
|
|
246
|
-
default: boolean;
|
|
109
|
+
readonly linterConfig: {
|
|
110
|
+
readonly type: ObjectConstructor;
|
|
111
|
+
readonly default: () => {};
|
|
247
112
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
* An area to 🔴 the lines with errors will be displayed.
|
|
252
|
-
* This feature is not enabled if `linter` is not specified.
|
|
253
|
-
*
|
|
254
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
|
|
255
|
-
*/
|
|
256
|
-
gutter: {
|
|
257
|
-
type: BooleanConstructor;
|
|
258
|
-
default: boolean;
|
|
113
|
+
readonly forceLinting: {
|
|
114
|
+
readonly type: BooleanConstructor;
|
|
115
|
+
readonly default: false;
|
|
259
116
|
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
* This is a CodeMirror Facet that allows you to define the configuration for the gutter.
|
|
264
|
-
* It can be used to specify options for the gutter, such as the size of the gutter, the position of the gutter, and to customize the behavior of the gutter.
|
|
265
|
-
* This is useful for providing feedback to the user about the code they are writing.
|
|
266
|
-
*
|
|
267
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
|
|
268
|
-
*/
|
|
269
|
-
gutterConfig: {
|
|
270
|
-
type: ObjectConstructor;
|
|
271
|
-
default: undefined;
|
|
117
|
+
readonly gutter: {
|
|
118
|
+
readonly type: BooleanConstructor;
|
|
119
|
+
readonly default: false;
|
|
272
120
|
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
tag: {
|
|
277
|
-
type: StringConstructor;
|
|
278
|
-
default: string;
|
|
121
|
+
readonly gutterConfig: {
|
|
122
|
+
readonly type: ObjectConstructor;
|
|
123
|
+
readonly default: undefined;
|
|
279
124
|
};
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
* This is useful for scrolling the editor to a specific position when the user has made changes to the code and wants to see the results immediately.
|
|
284
|
-
* If this is set to true, the editor will scroll to the position specified in the transaction.
|
|
285
|
-
* If this is set to false, the editor will not scroll to the position specified in the transaction.
|
|
286
|
-
*
|
|
287
|
-
* @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
|
|
288
|
-
*/
|
|
289
|
-
scrollIntoView: {
|
|
290
|
-
type: BooleanConstructor;
|
|
291
|
-
default: boolean;
|
|
125
|
+
readonly tag: {
|
|
126
|
+
readonly type: StringConstructor;
|
|
127
|
+
readonly default: 'div';
|
|
292
128
|
};
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
*/
|
|
301
|
-
preserveScrollPosition: {
|
|
302
|
-
type: BooleanConstructor;
|
|
303
|
-
default: boolean;
|
|
129
|
+
readonly scrollIntoView: {
|
|
130
|
+
readonly type: BooleanConstructor;
|
|
131
|
+
readonly default: true;
|
|
132
|
+
};
|
|
133
|
+
readonly preserveScrollPosition: {
|
|
134
|
+
readonly type: BooleanConstructor;
|
|
135
|
+
readonly default: false;
|
|
304
136
|
};
|
|
137
|
+
readonly keymap: {
|
|
138
|
+
readonly type: PropType<KeyBinding[]>;
|
|
139
|
+
readonly default: () => never[];
|
|
140
|
+
};
|
|
141
|
+
}>>;
|
|
142
|
+
|
|
305
143
|
/**
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
144
|
+
* Public API exposed from the CodeMirror component instance.
|
|
145
|
+
*
|
|
146
|
+
* Note: Vue 3 auto-unwraps refs on the component instance proxy,
|
|
147
|
+
* so reactive refs appear as their underlying value types here.
|
|
148
|
+
*/
|
|
149
|
+
export declare type CodeMirrorExposed = {
|
|
150
|
+
/** Editor DOM element. */
|
|
151
|
+
editor: HTMLElement | undefined;
|
|
152
|
+
/** CodeMirror Editor View. @see {@link https://codemirror.net/docs/ref/#view.EditorView} */
|
|
153
|
+
view: EditorView | undefined;
|
|
154
|
+
/** Cursor position. */
|
|
155
|
+
cursor: number;
|
|
156
|
+
/** Editor selection. @see {@link https://codemirror.net/docs/ref/#state.EditorSelection} */
|
|
157
|
+
selection: EditorSelection | undefined;
|
|
158
|
+
/** Whether the editor has focus. @see {@link https://codemirror.net/docs/ref/#view.EditorView.hasFocus} */
|
|
159
|
+
focus: boolean;
|
|
160
|
+
/** Document text length. */
|
|
161
|
+
length: number;
|
|
162
|
+
/** Serialized editor state. */
|
|
163
|
+
json: Record<string, StateField<unknown>> | undefined;
|
|
164
|
+
/** Number of active lint diagnostics. @see {@link https://codemirror.net/docs/ref/#lint.diagnosticCount} */
|
|
165
|
+
diagnosticCount: number;
|
|
166
|
+
/** Editor content DOM element. */
|
|
167
|
+
dom: Element | undefined;
|
|
168
|
+
/** Forces any linters configured to run when the editor is idle to run right away. */
|
|
169
|
+
lint: () => void;
|
|
170
|
+
/** Deconfigures and re-registers all extensions. @see {@link https://codemirror.net/examples/config/#top-level-reconfiguration} */
|
|
171
|
+
forceReconfigure: () => void;
|
|
172
|
+
/** Get the text between the given points in the editor. */
|
|
173
|
+
getRange: (from?: number, to?: number) => string | undefined;
|
|
174
|
+
/** Get the content of the given line. */
|
|
175
|
+
getLine: (number: number) => string | undefined;
|
|
176
|
+
/** Get the number of lines in the editor. */
|
|
177
|
+
lineCount: () => number;
|
|
178
|
+
/** Retrieve one end of the primary selection. */
|
|
179
|
+
getCursor: () => number;
|
|
180
|
+
/** Retrieves a list of all current selections. */
|
|
181
|
+
listSelections: () => readonly SelectionRange[];
|
|
182
|
+
/** Get the currently selected code. */
|
|
183
|
+
getSelection: () => string;
|
|
184
|
+
/** Get the currently selected code for every selection range. */
|
|
185
|
+
getSelections: () => string[];
|
|
186
|
+
/** Return true if any text is selected. */
|
|
187
|
+
somethingSelected: () => boolean;
|
|
188
|
+
/** Replace the part of the document between from and to with the given string. */
|
|
189
|
+
replaceRange: (replacement: string | Text_2, from: number, to: number) => void;
|
|
190
|
+
/** Replace the selection(s) with the given string. */
|
|
191
|
+
replaceSelection: (replacement: string | Text_2) => void;
|
|
192
|
+
/** Set the cursor position. */
|
|
193
|
+
setCursor: (position: number) => void;
|
|
194
|
+
/** Set a single selection range. */
|
|
195
|
+
setSelection: (anchor: number, head?: number) => void;
|
|
196
|
+
/** Sets a new set of selections. There must be at least one selection in the given array. */
|
|
197
|
+
setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
|
|
198
|
+
/** Applies the given function to all existing selections, and calls extendSelections on the result. */
|
|
199
|
+
extendSelectionsBy: (f: (range: SelectionRange) => number) => void;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/** CodeMirror Component */
|
|
203
|
+
declare const component: DefineComponent<ExtractPropTypes< {
|
|
204
|
+
readonly modelValue: {
|
|
205
|
+
readonly type: PropType<string | Text_2>;
|
|
206
|
+
readonly default: '';
|
|
207
|
+
};
|
|
208
|
+
readonly theme: {
|
|
209
|
+
readonly type: PropType<Record<string, StyleSpec>>;
|
|
210
|
+
readonly default: () => {};
|
|
211
|
+
};
|
|
212
|
+
readonly dark: {
|
|
213
|
+
readonly type: BooleanConstructor;
|
|
214
|
+
readonly default: false;
|
|
215
|
+
};
|
|
216
|
+
readonly basic: {
|
|
217
|
+
readonly type: BooleanConstructor;
|
|
218
|
+
readonly default: false;
|
|
219
|
+
};
|
|
220
|
+
readonly minimal: {
|
|
221
|
+
readonly type: BooleanConstructor;
|
|
222
|
+
readonly default: false;
|
|
223
|
+
};
|
|
224
|
+
readonly placeholder: {
|
|
225
|
+
readonly type: PropType<string | HTMLElement>;
|
|
226
|
+
readonly default: undefined;
|
|
227
|
+
};
|
|
228
|
+
readonly wrap: {
|
|
229
|
+
readonly type: BooleanConstructor;
|
|
230
|
+
readonly default: false;
|
|
231
|
+
};
|
|
232
|
+
readonly tab: {
|
|
233
|
+
readonly type: BooleanConstructor;
|
|
234
|
+
readonly default: false;
|
|
235
|
+
};
|
|
236
|
+
readonly indentUnit: {
|
|
237
|
+
readonly type: StringConstructor;
|
|
238
|
+
readonly default: undefined;
|
|
239
|
+
};
|
|
240
|
+
readonly allowMultipleSelections: {
|
|
241
|
+
readonly type: BooleanConstructor;
|
|
242
|
+
readonly default: false;
|
|
243
|
+
};
|
|
244
|
+
readonly tabSize: {
|
|
245
|
+
readonly type: NumberConstructor;
|
|
246
|
+
readonly default: undefined;
|
|
247
|
+
};
|
|
248
|
+
readonly lineSeparator: {
|
|
249
|
+
readonly type: StringConstructor;
|
|
250
|
+
readonly default: undefined;
|
|
251
|
+
};
|
|
252
|
+
readonly readonly: {
|
|
253
|
+
readonly type: BooleanConstructor;
|
|
254
|
+
readonly default: false;
|
|
255
|
+
};
|
|
256
|
+
readonly disabled: {
|
|
257
|
+
readonly type: BooleanConstructor;
|
|
258
|
+
readonly default: false;
|
|
259
|
+
};
|
|
260
|
+
readonly extensions: {
|
|
261
|
+
readonly type: PropType<Extension[]>;
|
|
262
|
+
readonly default: () => never[];
|
|
263
|
+
};
|
|
264
|
+
readonly phrases: {
|
|
265
|
+
readonly type: PropType<Record<string, string>>;
|
|
266
|
+
readonly default: undefined;
|
|
267
|
+
};
|
|
268
|
+
readonly lang: {
|
|
269
|
+
readonly type: PropType<LanguageSupport>;
|
|
270
|
+
readonly default: undefined;
|
|
271
|
+
};
|
|
272
|
+
readonly linter: {
|
|
273
|
+
readonly type: PropType<LintSource>;
|
|
274
|
+
readonly default: undefined;
|
|
275
|
+
};
|
|
276
|
+
readonly linterConfig: {
|
|
277
|
+
readonly type: ObjectConstructor;
|
|
278
|
+
readonly default: () => {};
|
|
279
|
+
};
|
|
280
|
+
readonly forceLinting: {
|
|
281
|
+
readonly type: BooleanConstructor;
|
|
282
|
+
readonly default: false;
|
|
283
|
+
};
|
|
284
|
+
readonly gutter: {
|
|
285
|
+
readonly type: BooleanConstructor;
|
|
286
|
+
readonly default: false;
|
|
287
|
+
};
|
|
288
|
+
readonly gutterConfig: {
|
|
289
|
+
readonly type: ObjectConstructor;
|
|
290
|
+
readonly default: undefined;
|
|
291
|
+
};
|
|
292
|
+
readonly tag: {
|
|
293
|
+
readonly type: StringConstructor;
|
|
294
|
+
readonly default: 'div';
|
|
295
|
+
};
|
|
296
|
+
readonly scrollIntoView: {
|
|
297
|
+
readonly type: BooleanConstructor;
|
|
298
|
+
readonly default: true;
|
|
299
|
+
};
|
|
300
|
+
readonly preserveScrollPosition: {
|
|
301
|
+
readonly type: BooleanConstructor;
|
|
302
|
+
readonly default: false;
|
|
303
|
+
};
|
|
304
|
+
readonly keymap: {
|
|
305
|
+
readonly type: PropType<KeyBinding[]>;
|
|
306
|
+
readonly default: () => never[];
|
|
315
307
|
};
|
|
316
308
|
}>, {
|
|
317
309
|
editor: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
318
|
-
view: ShallowRef<
|
|
310
|
+
view: ShallowRef<EditorView_2 | undefined>;
|
|
319
311
|
cursor: WritableComputedRef<number, number>;
|
|
320
312
|
selection: WritableComputedRef<EditorSelection | undefined, EditorSelection | undefined>;
|
|
321
313
|
focus: WritableComputedRef<boolean, boolean>;
|
|
@@ -340,412 +332,161 @@ setSelection: (anchor: number, head?: number) => void;
|
|
|
340
332
|
setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
|
|
341
333
|
extendSelectionsBy: (f: (range: SelectionRange) => number) => void;
|
|
342
334
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
/** CodeMirror ViewUpdate */
|
|
346
|
-
update: (_value: ViewUpdate) => true;
|
|
347
|
-
/** CodeMirror onReady */
|
|
335
|
+
'update:modelValue': (_value?: string | Text_2) => boolean;
|
|
336
|
+
update: (_value: ViewUpdate) => boolean;
|
|
348
337
|
ready: (_value: {
|
|
349
|
-
view:
|
|
338
|
+
view: EditorView_2;
|
|
350
339
|
state: EditorState;
|
|
351
340
|
container: HTMLElement;
|
|
352
|
-
}) =>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
change: (_value: EditorState) => true;
|
|
357
|
-
/** CodeMirror onDestroy */
|
|
358
|
-
destroy: () => true;
|
|
341
|
+
}) => boolean;
|
|
342
|
+
focus: (_value: boolean) => boolean;
|
|
343
|
+
change: (_value: EditorState) => boolean;
|
|
344
|
+
destroy: () => boolean;
|
|
359
345
|
}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
default: string;
|
|
346
|
+
readonly modelValue: {
|
|
347
|
+
readonly type: PropType<string | Text_2>;
|
|
348
|
+
readonly default: '';
|
|
364
349
|
};
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
|
|
369
|
-
*/
|
|
370
|
-
theme: {
|
|
371
|
-
type: PropType<Record<string, StyleSpec>>;
|
|
372
|
-
default: () => {};
|
|
373
|
-
};
|
|
374
|
-
/** Dark Mode */
|
|
375
|
-
dark: {
|
|
376
|
-
type: BooleanConstructor;
|
|
377
|
-
default: boolean;
|
|
350
|
+
readonly theme: {
|
|
351
|
+
readonly type: PropType<Record<string, StyleSpec>>;
|
|
352
|
+
readonly default: () => {};
|
|
378
353
|
};
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
* This will enable the basic setup for the editor.
|
|
383
|
-
*
|
|
384
|
-
* @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
|
|
385
|
-
*/
|
|
386
|
-
basic: {
|
|
387
|
-
type: BooleanConstructor;
|
|
388
|
-
default: boolean;
|
|
354
|
+
readonly dark: {
|
|
355
|
+
readonly type: BooleanConstructor;
|
|
356
|
+
readonly default: false;
|
|
389
357
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
* @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
|
|
394
|
-
*/
|
|
395
|
-
minimal: {
|
|
396
|
-
type: BooleanConstructor;
|
|
397
|
-
default: boolean;
|
|
358
|
+
readonly basic: {
|
|
359
|
+
readonly type: BooleanConstructor;
|
|
360
|
+
readonly default: false;
|
|
398
361
|
};
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
* @see {@link https://codemirror.net/docs/ref/#view.placeholder}
|
|
403
|
-
*/
|
|
404
|
-
placeholder: {
|
|
405
|
-
type: PropType<string | HTMLElement>;
|
|
406
|
-
default: undefined;
|
|
362
|
+
readonly minimal: {
|
|
363
|
+
readonly type: BooleanConstructor;
|
|
364
|
+
readonly default: false;
|
|
407
365
|
};
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
* An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
|
|
412
|
-
*
|
|
413
|
-
* @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
|
|
414
|
-
*/
|
|
415
|
-
wrap: {
|
|
416
|
-
type: BooleanConstructor;
|
|
417
|
-
default: boolean;
|
|
366
|
+
readonly placeholder: {
|
|
367
|
+
readonly type: PropType<string | HTMLElement>;
|
|
368
|
+
readonly default: undefined;
|
|
418
369
|
};
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
* This will enable the tab key to indent the current line or selection.
|
|
423
|
-
*
|
|
424
|
-
* @see {@link https://codemirror.net/examples/tab/}
|
|
425
|
-
*/
|
|
426
|
-
tab: {
|
|
427
|
-
type: BooleanConstructor;
|
|
428
|
-
default: boolean;
|
|
370
|
+
readonly wrap: {
|
|
371
|
+
readonly type: BooleanConstructor;
|
|
372
|
+
readonly default: false;
|
|
429
373
|
};
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
* This is the unit of indentation used when the editor is configured to indent with tabs.
|
|
434
|
-
* It is also used to determine the size of the tab character when the editor is configured to use tabs for indentation..
|
|
435
|
-
*
|
|
436
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^indentUnit}
|
|
437
|
-
*/
|
|
438
|
-
indentUnit: {
|
|
439
|
-
type: StringConstructor;
|
|
440
|
-
default: undefined;
|
|
374
|
+
readonly tab: {
|
|
375
|
+
readonly type: BooleanConstructor;
|
|
376
|
+
readonly default: false;
|
|
441
377
|
};
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
* This allows the editor to have multiple selections at the same time.
|
|
446
|
-
* This is useful for editing multiple parts of the document at once.
|
|
447
|
-
* If this is set to true, the editor will allow multiple selections.
|
|
448
|
-
* If this is set to false, the editor will only allow a single selection.
|
|
449
|
-
*
|
|
450
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
|
|
451
|
-
*/
|
|
452
|
-
allowMultipleSelections: {
|
|
453
|
-
type: BooleanConstructor;
|
|
454
|
-
default: boolean;
|
|
378
|
+
readonly indentUnit: {
|
|
379
|
+
readonly type: StringConstructor;
|
|
380
|
+
readonly default: undefined;
|
|
455
381
|
};
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
* This is the number of spaces that a tab character represents in the editor.
|
|
460
|
-
* It is used to determine the size of the tab character when the editor is configured to use tabs for indentation.
|
|
461
|
-
* If this is set to a number, the editor will use that number of spaces for each tab character.
|
|
462
|
-
*
|
|
463
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
|
|
464
|
-
*/
|
|
465
|
-
tabSize: {
|
|
466
|
-
type: NumberConstructor;
|
|
467
|
-
default: undefined;
|
|
382
|
+
readonly allowMultipleSelections: {
|
|
383
|
+
readonly type: BooleanConstructor;
|
|
384
|
+
readonly default: false;
|
|
468
385
|
};
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
* This is the character that is used to separate lines in the editor.
|
|
473
|
-
* It is used to determine the line break character when the editor is configured to use a specific line break character.
|
|
474
|
-
*
|
|
475
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
|
|
476
|
-
*/
|
|
477
|
-
lineSeparator: {
|
|
478
|
-
type: StringConstructor;
|
|
479
|
-
default: undefined;
|
|
386
|
+
readonly tabSize: {
|
|
387
|
+
readonly type: NumberConstructor;
|
|
388
|
+
readonly default: undefined;
|
|
480
389
|
};
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
* This is a CodeMirror Facet that allows you to set the editor to read-only mode.
|
|
485
|
-
* When this is set to true, the editor will not allow any changes to be made to the document.
|
|
486
|
-
* This is useful for displaying code that should not be edited, such as documentation or examples.
|
|
487
|
-
* If this is set to false, the editor will allow changes to be made to the document.
|
|
488
|
-
*
|
|
489
|
-
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
|
|
490
|
-
*/
|
|
491
|
-
readonly: {
|
|
492
|
-
type: BooleanConstructor;
|
|
493
|
-
default: boolean;
|
|
390
|
+
readonly lineSeparator: {
|
|
391
|
+
readonly type: StringConstructor;
|
|
392
|
+
readonly default: undefined;
|
|
494
393
|
};
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
* This is the reversed value of the CodeMirror editable.
|
|
499
|
-
* Similar to `readonly`, but setting this value to true disables dragging.
|
|
500
|
-
*
|
|
501
|
-
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
|
|
502
|
-
*/
|
|
503
|
-
disabled: {
|
|
504
|
-
type: BooleanConstructor;
|
|
505
|
-
default: boolean;
|
|
394
|
+
readonly readonly: {
|
|
395
|
+
readonly type: BooleanConstructor;
|
|
396
|
+
readonly default: false;
|
|
506
397
|
};
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
* You can use this to add any additional extensions that you want to use in the editor.
|
|
511
|
-
*
|
|
512
|
-
* @see {@link https://codemirror.net/docs/ref/#state.Extension}
|
|
513
|
-
*/
|
|
514
|
-
extensions: {
|
|
515
|
-
type: PropType<Extension[]>;
|
|
516
|
-
default: () => never[];
|
|
398
|
+
readonly disabled: {
|
|
399
|
+
readonly type: BooleanConstructor;
|
|
400
|
+
readonly default: false;
|
|
517
401
|
};
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
* This is a CodeMirror Facet that allows you to define custom phrases for the editor.
|
|
522
|
-
* It can be used to override default phrases or add new ones.
|
|
523
|
-
* This is useful for translating the editor to different languages or for customizing the editor's UI.
|
|
524
|
-
*
|
|
525
|
-
* @see {@link https://codemirror.net/examples/translate/}
|
|
526
|
-
*/
|
|
527
|
-
phrases: {
|
|
528
|
-
type: PropType<Record<string, string>>;
|
|
529
|
-
default: undefined;
|
|
402
|
+
readonly extensions: {
|
|
403
|
+
readonly type: PropType<Extension[]>;
|
|
404
|
+
readonly default: () => never[];
|
|
530
405
|
};
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
* This is a CodeMirror Facet that allows you to define the language of the editor.
|
|
535
|
-
* It can be used to enable syntax highlighting and other language-specific features.
|
|
536
|
-
* It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
|
|
537
|
-
*
|
|
538
|
-
* @see {@link https://codemirror.net/docs/ref/#language}
|
|
539
|
-
*/
|
|
540
|
-
lang: {
|
|
541
|
-
type: PropType<LanguageSupport>;
|
|
542
|
-
default: undefined;
|
|
406
|
+
readonly phrases: {
|
|
407
|
+
readonly type: PropType<Record<string, string>>;
|
|
408
|
+
readonly default: undefined;
|
|
543
409
|
};
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
* This is a CodeMirror Facet that allows you to define a linter for the editor.
|
|
548
|
-
* It can be used to check the code for errors and warnings, and to provide feedback to the user.
|
|
549
|
-
* It is useful for displaying code in a specific language, such as JavaScript, Python, or HTML.
|
|
550
|
-
* This is useful for providing feedback to the user about the code they are writing.
|
|
551
|
-
*
|
|
552
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.linter}
|
|
553
|
-
*/
|
|
554
|
-
linter: {
|
|
555
|
-
type: PropType<LintSource>;
|
|
556
|
-
default: undefined;
|
|
410
|
+
readonly lang: {
|
|
411
|
+
readonly type: PropType<LanguageSupport>;
|
|
412
|
+
readonly default: undefined;
|
|
557
413
|
};
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
* This is a CodeMirror Facet that allows you to define the configuration for the linter.
|
|
562
|
-
* It can be used to specify options for the linter, such as the severity of errors and warnings, and to customize the behavior of the linter.
|
|
563
|
-
* This is useful for providing feedback to the user about the code they are writing.
|
|
564
|
-
*
|
|
565
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
|
|
566
|
-
*/
|
|
567
|
-
linterConfig: {
|
|
568
|
-
type: ObjectConstructor;
|
|
569
|
-
default: () => {};
|
|
414
|
+
readonly linter: {
|
|
415
|
+
readonly type: PropType<LintSource>;
|
|
416
|
+
readonly default: undefined;
|
|
570
417
|
};
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
* This is useful for running linters on the initial load of the editor, or when the user has made changes to the code and wants to see the results immediately.
|
|
575
|
-
*
|
|
576
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
|
|
577
|
-
*/
|
|
578
|
-
forceLinting: {
|
|
579
|
-
type: BooleanConstructor;
|
|
580
|
-
default: boolean;
|
|
418
|
+
readonly linterConfig: {
|
|
419
|
+
readonly type: ObjectConstructor;
|
|
420
|
+
readonly default: () => {};
|
|
581
421
|
};
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
* An area to 🔴 the lines with errors will be displayed.
|
|
586
|
-
* This feature is not enabled if `linter` is not specified.
|
|
587
|
-
*
|
|
588
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
|
|
589
|
-
*/
|
|
590
|
-
gutter: {
|
|
591
|
-
type: BooleanConstructor;
|
|
592
|
-
default: boolean;
|
|
422
|
+
readonly forceLinting: {
|
|
423
|
+
readonly type: BooleanConstructor;
|
|
424
|
+
readonly default: false;
|
|
593
425
|
};
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
* This is a CodeMirror Facet that allows you to define the configuration for the gutter.
|
|
598
|
-
* It can be used to specify options for the gutter, such as the size of the gutter, the position of the gutter, and to customize the behavior of the gutter.
|
|
599
|
-
* This is useful for providing feedback to the user about the code they are writing.
|
|
600
|
-
*
|
|
601
|
-
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
|
|
602
|
-
*/
|
|
603
|
-
gutterConfig: {
|
|
604
|
-
type: ObjectConstructor;
|
|
605
|
-
default: undefined;
|
|
426
|
+
readonly gutter: {
|
|
427
|
+
readonly type: BooleanConstructor;
|
|
428
|
+
readonly default: false;
|
|
606
429
|
};
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
tag: {
|
|
611
|
-
type: StringConstructor;
|
|
612
|
-
default: string;
|
|
430
|
+
readonly gutterConfig: {
|
|
431
|
+
readonly type: ObjectConstructor;
|
|
432
|
+
readonly default: undefined;
|
|
613
433
|
};
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
* This is useful for scrolling the editor to a specific position when the user has made changes to the code and wants to see the results immediately.
|
|
618
|
-
* If this is set to true, the editor will scroll to the position specified in the transaction.
|
|
619
|
-
* If this is set to false, the editor will not scroll to the position specified in the transaction.
|
|
620
|
-
*
|
|
621
|
-
* @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
|
|
622
|
-
*/
|
|
623
|
-
scrollIntoView: {
|
|
624
|
-
type: BooleanConstructor;
|
|
625
|
-
default: boolean;
|
|
434
|
+
readonly tag: {
|
|
435
|
+
readonly type: StringConstructor;
|
|
436
|
+
readonly default: 'div';
|
|
626
437
|
};
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
* This keeps the editor's own scroll container from jumping when
|
|
631
|
-
* `modelValue` is updated from outside the component.
|
|
632
|
-
*
|
|
633
|
-
* @see {@link https://codemirror.net/docs/ref/#view.EditorView.scrollSnapshot}
|
|
634
|
-
*/
|
|
635
|
-
preserveScrollPosition: {
|
|
636
|
-
type: BooleanConstructor;
|
|
637
|
-
default: boolean;
|
|
438
|
+
readonly scrollIntoView: {
|
|
439
|
+
readonly type: BooleanConstructor;
|
|
440
|
+
readonly default: true;
|
|
638
441
|
};
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
keymap: {
|
|
647
|
-
type: PropType<KeyBinding[]>;
|
|
648
|
-
default: () => never[];
|
|
442
|
+
readonly preserveScrollPosition: {
|
|
443
|
+
readonly type: BooleanConstructor;
|
|
444
|
+
readonly default: false;
|
|
445
|
+
};
|
|
446
|
+
readonly keymap: {
|
|
447
|
+
readonly type: PropType<KeyBinding[]>;
|
|
448
|
+
readonly default: () => never[];
|
|
649
449
|
};
|
|
650
450
|
}>> & Readonly<{
|
|
651
451
|
onChange?: ((_value: EditorState) => any) | undefined;
|
|
652
452
|
onDestroy?: (() => any) | undefined;
|
|
653
453
|
onFocus?: ((_value: boolean) => any) | undefined;
|
|
654
454
|
onReady?: ((_value: {
|
|
655
|
-
view:
|
|
455
|
+
view: EditorView_2;
|
|
656
456
|
state: EditorState;
|
|
657
457
|
container: HTMLElement;
|
|
658
458
|
}) => any) | undefined;
|
|
659
459
|
onUpdate?: ((_value: ViewUpdate) => any) | undefined;
|
|
660
460
|
"onUpdate:modelValue"?: ((_value?: string | Text_2 | undefined) => any) | undefined;
|
|
661
461
|
}>, {
|
|
662
|
-
modelValue: string | Text_2;
|
|
663
|
-
theme: Record<string, StyleSpec>;
|
|
664
|
-
dark: boolean;
|
|
665
|
-
basic: boolean;
|
|
666
|
-
minimal: boolean;
|
|
667
|
-
placeholder: string | HTMLElement;
|
|
668
|
-
wrap: boolean;
|
|
669
|
-
tab: boolean;
|
|
670
|
-
indentUnit: string;
|
|
671
|
-
allowMultipleSelections: boolean;
|
|
672
|
-
tabSize: number;
|
|
673
|
-
lineSeparator: string;
|
|
674
|
-
readonly: boolean;
|
|
675
|
-
disabled: boolean;
|
|
676
|
-
extensions: Extension[];
|
|
677
|
-
phrases: Record<string, string>;
|
|
678
|
-
lang: LanguageSupport;
|
|
679
|
-
linter: LintSource;
|
|
680
|
-
linterConfig: Record<string, any>;
|
|
681
|
-
forceLinting: boolean;
|
|
682
|
-
gutter: boolean;
|
|
683
|
-
gutterConfig: Record<string, any>;
|
|
684
|
-
tag: string;
|
|
685
|
-
scrollIntoView: boolean;
|
|
686
|
-
preserveScrollPosition: boolean;
|
|
687
|
-
keymap: KeyBinding[];
|
|
462
|
+
readonly modelValue: string | Text_2;
|
|
463
|
+
readonly theme: Record<string, StyleSpec>;
|
|
464
|
+
readonly dark: boolean;
|
|
465
|
+
readonly basic: boolean;
|
|
466
|
+
readonly minimal: boolean;
|
|
467
|
+
readonly placeholder: string | HTMLElement;
|
|
468
|
+
readonly wrap: boolean;
|
|
469
|
+
readonly tab: boolean;
|
|
470
|
+
readonly indentUnit: string;
|
|
471
|
+
readonly allowMultipleSelections: boolean;
|
|
472
|
+
readonly tabSize: number;
|
|
473
|
+
readonly lineSeparator: string;
|
|
474
|
+
readonly readonly: boolean;
|
|
475
|
+
readonly disabled: boolean;
|
|
476
|
+
readonly extensions: Extension[];
|
|
477
|
+
readonly phrases: Record<string, string>;
|
|
478
|
+
readonly lang: LanguageSupport;
|
|
479
|
+
readonly linter: LintSource;
|
|
480
|
+
readonly linterConfig: Record<string, any>;
|
|
481
|
+
readonly forceLinting: boolean;
|
|
482
|
+
readonly gutter: boolean;
|
|
483
|
+
readonly gutterConfig: Record<string, any>;
|
|
484
|
+
readonly tag: string;
|
|
485
|
+
readonly scrollIntoView: boolean;
|
|
486
|
+
readonly preserveScrollPosition: boolean;
|
|
487
|
+
readonly keymap: KeyBinding[];
|
|
688
488
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
689
|
-
export default
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* Public API exposed from the CodeMirror component instance.
|
|
693
|
-
*
|
|
694
|
-
* Note: Vue 3 auto-unwraps refs on the component instance proxy,
|
|
695
|
-
* so reactive refs appear as their underlying value types here.
|
|
696
|
-
*/
|
|
697
|
-
export declare type CodeMirrorExposed = {
|
|
698
|
-
/** Editor DOM element. */
|
|
699
|
-
editor: HTMLElement | undefined;
|
|
700
|
-
/** CodeMirror Editor View. @see {@link https://codemirror.net/docs/ref/#view.EditorView} */
|
|
701
|
-
view: EditorView | undefined;
|
|
702
|
-
/** Cursor position. */
|
|
703
|
-
cursor: number;
|
|
704
|
-
/** Editor selection. @see {@link https://codemirror.net/docs/ref/#state.EditorSelection} */
|
|
705
|
-
selection: EditorSelection | undefined;
|
|
706
|
-
/** Whether the editor has focus. @see {@link https://codemirror.net/docs/ref/#view.EditorView.hasFocus} */
|
|
707
|
-
focus: boolean;
|
|
708
|
-
/** Document text length. */
|
|
709
|
-
length: number;
|
|
710
|
-
/** Serialized editor state. */
|
|
711
|
-
json: Record<string, StateField<unknown>> | undefined;
|
|
712
|
-
/** Number of active lint diagnostics. @see {@link https://codemirror.net/docs/ref/#lint.diagnosticCount} */
|
|
713
|
-
diagnosticCount: number;
|
|
714
|
-
/** Editor content DOM element. */
|
|
715
|
-
dom: Element | undefined;
|
|
716
|
-
/** Forces any linters configured to run when the editor is idle to run right away. */
|
|
717
|
-
lint: () => void;
|
|
718
|
-
/** Deconfigures and re-registers all extensions. @see {@link https://codemirror.net/examples/config/#top-level-reconfiguration} */
|
|
719
|
-
forceReconfigure: () => void;
|
|
720
|
-
/** Get the text between the given points in the editor. */
|
|
721
|
-
getRange: (from?: number, to?: number) => string | undefined;
|
|
722
|
-
/** Get the content of the given line. */
|
|
723
|
-
getLine: (number: number) => string | undefined;
|
|
724
|
-
/** Get the number of lines in the editor. */
|
|
725
|
-
lineCount: () => number;
|
|
726
|
-
/** Retrieve one end of the primary selection. */
|
|
727
|
-
getCursor: () => number;
|
|
728
|
-
/** Retrieves a list of all current selections. */
|
|
729
|
-
listSelections: () => readonly SelectionRange[];
|
|
730
|
-
/** Get the currently selected code. */
|
|
731
|
-
getSelection: () => string;
|
|
732
|
-
/** Get the currently selected code for every selection range. */
|
|
733
|
-
getSelections: () => string[];
|
|
734
|
-
/** Return true if any text is selected. */
|
|
735
|
-
somethingSelected: () => boolean;
|
|
736
|
-
/** Replace the part of the document between from and to with the given string. */
|
|
737
|
-
replaceRange: (replacement: string | Text_2, from: number, to: number) => void;
|
|
738
|
-
/** Replace the selection(s) with the given string. */
|
|
739
|
-
replaceSelection: (replacement: string | Text_2) => void;
|
|
740
|
-
/** Set the cursor position. */
|
|
741
|
-
setCursor: (position: number) => void;
|
|
742
|
-
/** Set a single selection range. */
|
|
743
|
-
setSelection: (anchor: number, head?: number) => void;
|
|
744
|
-
/** Sets a new set of selections. There must be at least one selection in the given array. */
|
|
745
|
-
setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
|
|
746
|
-
/** Applies the given function to all existing selections, and calls extendSelections on the result. */
|
|
747
|
-
extendSelectionsBy: (f: (range: SelectionRange) => number) => void;
|
|
748
|
-
};
|
|
489
|
+
export default component;
|
|
749
490
|
|
|
750
491
|
/**
|
|
751
492
|
* Vue plugin install function that registers the CodeMirror component globally.
|
|
@@ -763,8 +504,8 @@ export declare type Meta = {
|
|
|
763
504
|
};
|
|
764
505
|
|
|
765
506
|
export declare const Meta: Meta = {
|
|
766
|
-
version:
|
|
767
|
-
date:
|
|
507
|
+
version: import.meta.env.APP_VERSION,
|
|
508
|
+
date: import.meta.env.BUILD_DATE,
|
|
768
509
|
};
|
|
769
510
|
|
|
770
511
|
export { }
|