vue-codemirror6 1.1.4 → 1.1.10
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/CHANGELOG.md +3 -4
- package/README.md +8 -7
- package/dist/Meta.d.ts +3 -0
- package/dist/Meta.js +6 -0
- package/dist/components/CodeMirror.d.ts +417 -0
- package/dist/components/CodeMirror.js +509 -0
- package/dist/helpers/h-demi.d.ts +18 -0
- package/dist/helpers/h-demi.js +27 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +13 -5
- package/dist/index.iife.js +16 -12
- package/dist/index.js +11 -0
- package/dist/index.umd.js +18 -14
- package/dist/interfaces/MetaInterface.d.ts +7 -0
- package/dist/interfaces/MetaInterface.js +1 -0
- package/package.json +17 -17
- package/src/components/CodeMirror.ts +19 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,10 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
-
#### [1.1.
|
|
7
|
+
#### [1.1.6](https://github.com/logue/vue-codemirror6/compare/1.1.3...1.1.6)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- Update dependencies. [`febe5f1`](https://github.com/logue/vue-codemirror6/commit/febe5f1822d86a8e30d38fc6440b13209b41186d)
|
|
9
|
+
- Fix for #11 [`c634b55`](https://github.com/logue/vue-codemirror6/commit/c634b555ffff93bb30da2f501ec366289fc86ec1)
|
|
10
|
+
- Update dependencies. [`63d99a2`](https://github.com/logue/vue-codemirror6/commit/63d99a23a5df4771ca1c3edea8e8f97502622228)
|
|
12
11
|
- release v1.1.2 [`903af1f`](https://github.com/logue/vue-codemirror6/commit/903af1fcf128ea7958ca9ae40fc97f062d8696d1)
|
|
13
12
|
|
|
14
13
|
#### [1.1.3](https://github.com/logue/vue-codemirror6/compare/1.1.2...1.1.3)
|
package/README.md
CHANGED
|
@@ -261,13 +261,14 @@ export default defineComponent({
|
|
|
261
261
|
|
|
262
262
|
## Methods
|
|
263
263
|
|
|
264
|
-
| Method
|
|
265
|
-
|
|
|
266
|
-
| selection
|
|
267
|
-
| cursor
|
|
268
|
-
| state
|
|
269
|
-
| focus
|
|
270
|
-
| lint
|
|
264
|
+
| Method | Description |
|
|
265
|
+
| ---------------- | --------------------------------------------------------------------------------------------------- |
|
|
266
|
+
| selection | Get and set the [EditorSelection](https://codemirror.net/docs/ref/#state.EditorSelection) instance. |
|
|
267
|
+
| cursor | Get and set the [cursor](https://codemirror.net/docs/ref/#state.EditorSelection^cursor) location. |
|
|
268
|
+
| state | Get and set [EditorState](https://codemirror.net/docs/ref/#state.EditorState). |
|
|
269
|
+
| focus | Get and set [focus](https://codemirror.net/docs/ref/#view.EditorView.focus). |
|
|
270
|
+
| lint | Force run linter (Only if `linter` prop is specified) |
|
|
271
|
+
| forceReconfigure | Re register all extensions. |
|
|
271
272
|
|
|
272
273
|
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.
|
|
273
274
|
|
package/dist/Meta.d.ts
ADDED
package/dist/Meta.js
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { type ObjectEmitsOptions, type PropType, type Ref } from 'vue-demi';
|
|
2
|
+
import { EditorState, type Extension, type Text } from '@codemirror/state';
|
|
3
|
+
import { EditorView, type ViewUpdate } from '@codemirror/view';
|
|
4
|
+
import { type LintSource } from '@codemirror/lint';
|
|
5
|
+
import type { LanguageSupport } from '@codemirror/language';
|
|
6
|
+
import type { StyleSpec } from 'style-mod';
|
|
7
|
+
/** Emit Interface */
|
|
8
|
+
export interface CodeMirrorEmitsOptions extends ObjectEmitsOptions {
|
|
9
|
+
/** Model Update */
|
|
10
|
+
(e: 'update:modelValue', value: string | Text): void;
|
|
11
|
+
/** CodeMirror ViewUpdate */
|
|
12
|
+
(e: 'update', value: ViewUpdate): void;
|
|
13
|
+
/** CodeMirror onFocus */
|
|
14
|
+
(e: 'focus', value: boolean): void;
|
|
15
|
+
/** CodeMirror onReady */
|
|
16
|
+
(e: 'ready', value: {
|
|
17
|
+
view: EditorView;
|
|
18
|
+
state: EditorState;
|
|
19
|
+
container: HTMLElement;
|
|
20
|
+
}): void;
|
|
21
|
+
/** CodeMirror onDestroy */
|
|
22
|
+
(e: 'destroy'): void;
|
|
23
|
+
/** State Changed */
|
|
24
|
+
(e: 'change', value: EditorState): void;
|
|
25
|
+
}
|
|
26
|
+
/** CodeMirror Component */
|
|
27
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
28
|
+
/** Model value */
|
|
29
|
+
modelValue: {
|
|
30
|
+
type: PropType<string | Text>;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Theme
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
|
|
37
|
+
*/
|
|
38
|
+
theme: {
|
|
39
|
+
type: PropType<{
|
|
40
|
+
[selector: string]: StyleSpec;
|
|
41
|
+
}>;
|
|
42
|
+
default: () => void;
|
|
43
|
+
};
|
|
44
|
+
/** Dark Mode */
|
|
45
|
+
dark: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
default: boolean;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Use Basic Setup
|
|
51
|
+
*
|
|
52
|
+
* @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
|
|
53
|
+
*/
|
|
54
|
+
basic: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Use Minimal Setup (The basic setting has priority.)
|
|
60
|
+
*
|
|
61
|
+
* @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
|
|
62
|
+
*/
|
|
63
|
+
minimal: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: boolean;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Placeholder
|
|
69
|
+
*
|
|
70
|
+
* @see {@link https://codemirror.net/docs/ref/#view.placeholder}
|
|
71
|
+
*/
|
|
72
|
+
placeholder: {
|
|
73
|
+
type: PropType<string | HTMLElement>;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Line wrapping
|
|
78
|
+
*
|
|
79
|
+
* An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
|
|
80
|
+
*
|
|
81
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
|
|
82
|
+
*/
|
|
83
|
+
wrap: {
|
|
84
|
+
type: BooleanConstructor;
|
|
85
|
+
default: boolean;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Allow tab key indent.
|
|
89
|
+
*
|
|
90
|
+
* @see {@link https://codemirror.net/examples/tab/}
|
|
91
|
+
*/
|
|
92
|
+
tab: {
|
|
93
|
+
type: BooleanConstructor;
|
|
94
|
+
default: boolean;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Tab size
|
|
98
|
+
*
|
|
99
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
|
|
100
|
+
*/
|
|
101
|
+
tabSize: {
|
|
102
|
+
type: NumberConstructor;
|
|
103
|
+
default: undefined;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Set line break (separetor) char.
|
|
107
|
+
*
|
|
108
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
|
|
109
|
+
*/
|
|
110
|
+
lineSeparator: {
|
|
111
|
+
type: StringConstructor;
|
|
112
|
+
default: undefined;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Readonly
|
|
116
|
+
*
|
|
117
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
|
|
118
|
+
*/
|
|
119
|
+
readonly: {
|
|
120
|
+
type: BooleanConstructor;
|
|
121
|
+
default: boolean;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Disable input.
|
|
125
|
+
*
|
|
126
|
+
* This is the reversed value of the CodeMirror editable.
|
|
127
|
+
* Similar to `readonly`, but setting this value to true disables dragging.
|
|
128
|
+
*
|
|
129
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
|
|
130
|
+
*/
|
|
131
|
+
disabled: {
|
|
132
|
+
type: BooleanConstructor;
|
|
133
|
+
default: boolean;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Additional Extension
|
|
137
|
+
*
|
|
138
|
+
* @see {@link https://codemirror.net/docs/ref/#state.Extension}
|
|
139
|
+
*/
|
|
140
|
+
extensions: {
|
|
141
|
+
type: PropType<Extension[]>;
|
|
142
|
+
default: () => never[];
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Language Phreses
|
|
146
|
+
*
|
|
147
|
+
* @see {@link https://codemirror.net/examples/translate/}
|
|
148
|
+
*/
|
|
149
|
+
phrases: {
|
|
150
|
+
type: PropType<Record<string, string>>;
|
|
151
|
+
default: () => undefined;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* CodeMirror Language
|
|
155
|
+
*
|
|
156
|
+
* @see {@link https://codemirror.net/docs/ref/#language}
|
|
157
|
+
*/
|
|
158
|
+
lang: {
|
|
159
|
+
type: PropType<LanguageSupport>;
|
|
160
|
+
default: () => undefined;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* CodeMirror Linter
|
|
164
|
+
*
|
|
165
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.linter}
|
|
166
|
+
*/
|
|
167
|
+
linter: {
|
|
168
|
+
type: PropType<LintSource>;
|
|
169
|
+
default: undefined;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Linter Config
|
|
173
|
+
*
|
|
174
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
|
|
175
|
+
*/
|
|
176
|
+
linterConfig: {
|
|
177
|
+
type: ObjectConstructor;
|
|
178
|
+
default: () => void;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Show Linter Gutter
|
|
182
|
+
*
|
|
183
|
+
* An area to 🔴 the lines with errors will be displayed.
|
|
184
|
+
* This feature is not enabled if `linter` is not specified.
|
|
185
|
+
*
|
|
186
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
|
|
187
|
+
*/
|
|
188
|
+
gutter: {
|
|
189
|
+
type: BooleanConstructor;
|
|
190
|
+
defalt: boolean;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Gutter Config
|
|
194
|
+
*
|
|
195
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
|
|
196
|
+
*/
|
|
197
|
+
gutterConfig: {
|
|
198
|
+
type: ObjectConstructor;
|
|
199
|
+
default: () => void;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Using tag
|
|
203
|
+
*/
|
|
204
|
+
tag: {
|
|
205
|
+
type: StringConstructor;
|
|
206
|
+
default: string;
|
|
207
|
+
};
|
|
208
|
+
}, {
|
|
209
|
+
editor: Ref<HTMLElement | undefined>;
|
|
210
|
+
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, CodeMirrorEmitsOptions, "update:modelValue" | "update" | "focus" | "ready" | "destroy" | "change", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
211
|
+
/** Model value */
|
|
212
|
+
modelValue: {
|
|
213
|
+
type: PropType<string | Text>;
|
|
214
|
+
default: string;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Theme
|
|
218
|
+
*
|
|
219
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
|
|
220
|
+
*/
|
|
221
|
+
theme: {
|
|
222
|
+
type: PropType<{
|
|
223
|
+
[selector: string]: StyleSpec;
|
|
224
|
+
}>;
|
|
225
|
+
default: () => void;
|
|
226
|
+
};
|
|
227
|
+
/** Dark Mode */
|
|
228
|
+
dark: {
|
|
229
|
+
type: BooleanConstructor;
|
|
230
|
+
default: boolean;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Use Basic Setup
|
|
234
|
+
*
|
|
235
|
+
* @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
|
|
236
|
+
*/
|
|
237
|
+
basic: {
|
|
238
|
+
type: BooleanConstructor;
|
|
239
|
+
default: boolean;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Use Minimal Setup (The basic setting has priority.)
|
|
243
|
+
*
|
|
244
|
+
* @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
|
|
245
|
+
*/
|
|
246
|
+
minimal: {
|
|
247
|
+
type: BooleanConstructor;
|
|
248
|
+
default: boolean;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Placeholder
|
|
252
|
+
*
|
|
253
|
+
* @see {@link https://codemirror.net/docs/ref/#view.placeholder}
|
|
254
|
+
*/
|
|
255
|
+
placeholder: {
|
|
256
|
+
type: PropType<string | HTMLElement>;
|
|
257
|
+
default: undefined;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Line wrapping
|
|
261
|
+
*
|
|
262
|
+
* An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
|
|
263
|
+
*
|
|
264
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
|
|
265
|
+
*/
|
|
266
|
+
wrap: {
|
|
267
|
+
type: BooleanConstructor;
|
|
268
|
+
default: boolean;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Allow tab key indent.
|
|
272
|
+
*
|
|
273
|
+
* @see {@link https://codemirror.net/examples/tab/}
|
|
274
|
+
*/
|
|
275
|
+
tab: {
|
|
276
|
+
type: BooleanConstructor;
|
|
277
|
+
default: boolean;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Tab size
|
|
281
|
+
*
|
|
282
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
|
|
283
|
+
*/
|
|
284
|
+
tabSize: {
|
|
285
|
+
type: NumberConstructor;
|
|
286
|
+
default: undefined;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Set line break (separetor) char.
|
|
290
|
+
*
|
|
291
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
|
|
292
|
+
*/
|
|
293
|
+
lineSeparator: {
|
|
294
|
+
type: StringConstructor;
|
|
295
|
+
default: undefined;
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Readonly
|
|
299
|
+
*
|
|
300
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
|
|
301
|
+
*/
|
|
302
|
+
readonly: {
|
|
303
|
+
type: BooleanConstructor;
|
|
304
|
+
default: boolean;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Disable input.
|
|
308
|
+
*
|
|
309
|
+
* This is the reversed value of the CodeMirror editable.
|
|
310
|
+
* Similar to `readonly`, but setting this value to true disables dragging.
|
|
311
|
+
*
|
|
312
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
|
|
313
|
+
*/
|
|
314
|
+
disabled: {
|
|
315
|
+
type: BooleanConstructor;
|
|
316
|
+
default: boolean;
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Additional Extension
|
|
320
|
+
*
|
|
321
|
+
* @see {@link https://codemirror.net/docs/ref/#state.Extension}
|
|
322
|
+
*/
|
|
323
|
+
extensions: {
|
|
324
|
+
type: PropType<Extension[]>;
|
|
325
|
+
default: () => never[];
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Language Phreses
|
|
329
|
+
*
|
|
330
|
+
* @see {@link https://codemirror.net/examples/translate/}
|
|
331
|
+
*/
|
|
332
|
+
phrases: {
|
|
333
|
+
type: PropType<Record<string, string>>;
|
|
334
|
+
default: () => undefined;
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* CodeMirror Language
|
|
338
|
+
*
|
|
339
|
+
* @see {@link https://codemirror.net/docs/ref/#language}
|
|
340
|
+
*/
|
|
341
|
+
lang: {
|
|
342
|
+
type: PropType<LanguageSupport>;
|
|
343
|
+
default: () => undefined;
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* CodeMirror Linter
|
|
347
|
+
*
|
|
348
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.linter}
|
|
349
|
+
*/
|
|
350
|
+
linter: {
|
|
351
|
+
type: PropType<LintSource>;
|
|
352
|
+
default: undefined;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Linter Config
|
|
356
|
+
*
|
|
357
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
|
|
358
|
+
*/
|
|
359
|
+
linterConfig: {
|
|
360
|
+
type: ObjectConstructor;
|
|
361
|
+
default: () => void;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Show Linter Gutter
|
|
365
|
+
*
|
|
366
|
+
* An area to 🔴 the lines with errors will be displayed.
|
|
367
|
+
* This feature is not enabled if `linter` is not specified.
|
|
368
|
+
*
|
|
369
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
|
|
370
|
+
*/
|
|
371
|
+
gutter: {
|
|
372
|
+
type: BooleanConstructor;
|
|
373
|
+
defalt: boolean;
|
|
374
|
+
};
|
|
375
|
+
/**
|
|
376
|
+
* Gutter Config
|
|
377
|
+
*
|
|
378
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
|
|
379
|
+
*/
|
|
380
|
+
gutterConfig: {
|
|
381
|
+
type: ObjectConstructor;
|
|
382
|
+
default: () => void;
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Using tag
|
|
386
|
+
*/
|
|
387
|
+
tag: {
|
|
388
|
+
type: StringConstructor;
|
|
389
|
+
default: string;
|
|
390
|
+
};
|
|
391
|
+
}>> & {
|
|
392
|
+
[x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
|
|
393
|
+
}, {
|
|
394
|
+
modelValue: string | Text;
|
|
395
|
+
theme: {
|
|
396
|
+
[selector: string]: StyleSpec;
|
|
397
|
+
};
|
|
398
|
+
dark: boolean;
|
|
399
|
+
basic: boolean;
|
|
400
|
+
minimal: boolean;
|
|
401
|
+
placeholder: string | HTMLElement;
|
|
402
|
+
wrap: boolean;
|
|
403
|
+
tab: boolean;
|
|
404
|
+
tabSize: number;
|
|
405
|
+
lineSeparator: string;
|
|
406
|
+
readonly: boolean;
|
|
407
|
+
disabled: boolean;
|
|
408
|
+
extensions: Extension[];
|
|
409
|
+
phrases: Record<string, string>;
|
|
410
|
+
lang: LanguageSupport;
|
|
411
|
+
linter: LintSource;
|
|
412
|
+
linterConfig: Record<string, any>;
|
|
413
|
+
gutter: boolean;
|
|
414
|
+
gutterConfig: Record<string, any>;
|
|
415
|
+
tag: string;
|
|
416
|
+
}>;
|
|
417
|
+
export default _default;
|