vue-codemirror6 1.1.28 → 1.1.31
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/dist/Meta.d.ts +3 -0
- package/dist/components/CodeMirror.d.ts +3 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +532 -0
- package/dist/index.iife.js +536 -0
- package/dist/index.umd.js +537 -0
- package/package.json +20 -21
- package/src/components/CodeMirror.ts +1 -1
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vue-codemirror6
|
|
3
|
+
*
|
|
4
|
+
* @description CodeMirror6 Component for vue2 and vue3.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
|
+
* @license MIT
|
|
8
|
+
* @version 1.1.30
|
|
9
|
+
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
(function (global, factory) {
|
|
13
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue-demi'), require('codemirror'), require('@codemirror/view'), require('@codemirror/state'), require('@codemirror/lint'), require('@codemirror/commands')) :
|
|
14
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue-demi', 'codemirror', '@codemirror/view', '@codemirror/state', '@codemirror/lint', '@codemirror/commands'], factory) :
|
|
15
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CodeMirror = {}, global.VueDemi, global.codemirror, global.view, global.state, global.lint, global.commands));
|
|
16
|
+
})(this, (function (exports, vueDemi, codemirror, view, state, lint, commands) { 'use strict';
|
|
17
|
+
|
|
18
|
+
const adaptOnsV3 = (ons) => {
|
|
19
|
+
if (!ons)
|
|
20
|
+
return {};
|
|
21
|
+
return Object.entries(ons).reduce((ret, [key, handler]) => {
|
|
22
|
+
key = key.charAt(0).toUpperCase() + key.slice(1);
|
|
23
|
+
key = `on${key}`;
|
|
24
|
+
return { ...ret, [key]: handler };
|
|
25
|
+
}, {});
|
|
26
|
+
};
|
|
27
|
+
function h(type, options = {}, chidren) {
|
|
28
|
+
if (vueDemi.isVue2) {
|
|
29
|
+
return vueDemi.h(type, options, chidren);
|
|
30
|
+
}
|
|
31
|
+
const { props, domProps, on, ...extraOptions } = options;
|
|
32
|
+
const ons = on ? adaptOnsV3(on) : {};
|
|
33
|
+
return vueDemi.h(
|
|
34
|
+
type,
|
|
35
|
+
{ ...extraOptions, ...props, ...domProps, ...ons },
|
|
36
|
+
chidren
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const slot = (defaultSlots) => typeof defaultSlots === "function" ? defaultSlots() : defaultSlots;
|
|
40
|
+
|
|
41
|
+
var CodeMirror = vueDemi.defineComponent({
|
|
42
|
+
/** Component Name */
|
|
43
|
+
name: "CodeMirror",
|
|
44
|
+
/** Model Definition */
|
|
45
|
+
model: {
|
|
46
|
+
prop: "modelValue",
|
|
47
|
+
event: "update:modelValue"
|
|
48
|
+
},
|
|
49
|
+
/** Props Definition */
|
|
50
|
+
props: {
|
|
51
|
+
/** Model value */
|
|
52
|
+
modelValue: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: ""
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Theme
|
|
58
|
+
*
|
|
59
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
|
|
60
|
+
*/
|
|
61
|
+
theme: {
|
|
62
|
+
type: Object,
|
|
63
|
+
default: () => {
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
/** Dark Mode */
|
|
67
|
+
dark: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Use Basic Setup
|
|
73
|
+
*
|
|
74
|
+
* @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
|
|
75
|
+
*/
|
|
76
|
+
basic: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Use Minimal Setup (The basic setting has priority.)
|
|
82
|
+
*
|
|
83
|
+
* @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
|
|
84
|
+
*/
|
|
85
|
+
minimal: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* Placeholder
|
|
91
|
+
*
|
|
92
|
+
* @see {@link https://codemirror.net/docs/ref/#view.placeholder}
|
|
93
|
+
*/
|
|
94
|
+
placeholder: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: void 0
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Line wrapping
|
|
100
|
+
*
|
|
101
|
+
* An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
|
|
102
|
+
*
|
|
103
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
|
|
104
|
+
*/
|
|
105
|
+
wrap: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* Allow tab key indent.
|
|
111
|
+
*
|
|
112
|
+
* @see {@link https://codemirror.net/examples/tab/}
|
|
113
|
+
*/
|
|
114
|
+
tab: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Allow Multiple Selection.
|
|
120
|
+
*
|
|
121
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
|
|
122
|
+
*/
|
|
123
|
+
allowMultipleSelections: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: false
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Tab size
|
|
129
|
+
*
|
|
130
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
|
|
131
|
+
*/
|
|
132
|
+
tabSize: {
|
|
133
|
+
type: Number,
|
|
134
|
+
default: void 0
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* Set line break (separetor) char.
|
|
138
|
+
*
|
|
139
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
|
|
140
|
+
*/
|
|
141
|
+
lineSeparator: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: void 0
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* Readonly
|
|
147
|
+
*
|
|
148
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
|
|
149
|
+
*/
|
|
150
|
+
readonly: {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
default: false
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* Disable input.
|
|
156
|
+
*
|
|
157
|
+
* This is the reversed value of the CodeMirror editable.
|
|
158
|
+
* Similar to `readonly`, but setting this value to true disables dragging.
|
|
159
|
+
*
|
|
160
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
|
|
161
|
+
*/
|
|
162
|
+
disabled: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
default: false
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* Additional Extension
|
|
168
|
+
*
|
|
169
|
+
* @see {@link https://codemirror.net/docs/ref/#state.Extension}
|
|
170
|
+
*/
|
|
171
|
+
extensions: {
|
|
172
|
+
type: Array,
|
|
173
|
+
default: () => {
|
|
174
|
+
return [];
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Language Phreses
|
|
179
|
+
*
|
|
180
|
+
* @see {@link https://codemirror.net/examples/translate/}
|
|
181
|
+
*/
|
|
182
|
+
phrases: {
|
|
183
|
+
type: Object,
|
|
184
|
+
default: () => void 0
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* CodeMirror Language
|
|
188
|
+
*
|
|
189
|
+
* @see {@link https://codemirror.net/docs/ref/#language}
|
|
190
|
+
*/
|
|
191
|
+
lang: {
|
|
192
|
+
type: Object,
|
|
193
|
+
default: () => void 0
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* CodeMirror Linter
|
|
197
|
+
*
|
|
198
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.linter}
|
|
199
|
+
*/
|
|
200
|
+
linter: {
|
|
201
|
+
type: Function,
|
|
202
|
+
default: void 0
|
|
203
|
+
},
|
|
204
|
+
/**
|
|
205
|
+
* Linter Config
|
|
206
|
+
*
|
|
207
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
|
|
208
|
+
*/
|
|
209
|
+
linterConfig: {
|
|
210
|
+
type: Object,
|
|
211
|
+
default: () => {
|
|
212
|
+
return {};
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
/**
|
|
216
|
+
* Forces any linters configured to run when the editor is idle to run right away.
|
|
217
|
+
*
|
|
218
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
|
|
219
|
+
*/
|
|
220
|
+
forceLinting: {
|
|
221
|
+
type: Boolean,
|
|
222
|
+
default: false
|
|
223
|
+
},
|
|
224
|
+
/**
|
|
225
|
+
* Show Linter Gutter
|
|
226
|
+
*
|
|
227
|
+
* An area to 🔴 the lines with errors will be displayed.
|
|
228
|
+
* This feature is not enabled if `linter` is not specified.
|
|
229
|
+
*
|
|
230
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
|
|
231
|
+
*/
|
|
232
|
+
gutter: {
|
|
233
|
+
type: Boolean,
|
|
234
|
+
defalt: false
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* Gutter Config
|
|
238
|
+
*
|
|
239
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
|
|
240
|
+
*/
|
|
241
|
+
gutterConfig: {
|
|
242
|
+
type: Object,
|
|
243
|
+
default: () => void 0
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* Using tag
|
|
247
|
+
*/
|
|
248
|
+
tag: {
|
|
249
|
+
type: String,
|
|
250
|
+
default: "div"
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
/** Emits */
|
|
254
|
+
emits: {
|
|
255
|
+
/** Model Update */
|
|
256
|
+
"update:modelValue": (value) => true,
|
|
257
|
+
/** CodeMirror ViewUpdate */
|
|
258
|
+
update: (value) => true,
|
|
259
|
+
/** CodeMirror onReady */
|
|
260
|
+
ready: (value) => true,
|
|
261
|
+
/** CodeMirror onFocus */
|
|
262
|
+
focus: (value) => true,
|
|
263
|
+
/** State Changed */
|
|
264
|
+
change: (value) => true,
|
|
265
|
+
/** CodeMirror onDestroy */
|
|
266
|
+
destroy: () => true
|
|
267
|
+
},
|
|
268
|
+
/**
|
|
269
|
+
* Setup
|
|
270
|
+
*
|
|
271
|
+
* @param props - Props
|
|
272
|
+
* @param context - Context
|
|
273
|
+
*/
|
|
274
|
+
setup(props, context) {
|
|
275
|
+
const editor = vueDemi.ref();
|
|
276
|
+
const doc = vueDemi.ref(props.modelValue);
|
|
277
|
+
const view$1 = vueDemi.shallowRef(new view.EditorView());
|
|
278
|
+
const focus = vueDemi.computed({
|
|
279
|
+
get: () => view$1.value.hasFocus,
|
|
280
|
+
set: (f) => {
|
|
281
|
+
if (f) {
|
|
282
|
+
view$1.value.focus();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
const selection = vueDemi.computed({
|
|
287
|
+
get: () => view$1.value.state.selection,
|
|
288
|
+
set: (s) => view$1.value.dispatch({ selection: s })
|
|
289
|
+
});
|
|
290
|
+
const cursor = vueDemi.computed({
|
|
291
|
+
get: () => view$1.value.state.selection.main.head,
|
|
292
|
+
set: (a) => view$1.value.dispatch({ selection: { anchor: a } })
|
|
293
|
+
});
|
|
294
|
+
const json = vueDemi.computed(
|
|
295
|
+
{
|
|
296
|
+
get: () => view$1.value.state.toJSON(),
|
|
297
|
+
set: (j) => view$1.value.setState(state.EditorState.fromJSON(j))
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
const length = vueDemi.ref(0);
|
|
301
|
+
const diagnosticCount = vueDemi.ref(0);
|
|
302
|
+
const extensions = vueDemi.computed(() => {
|
|
303
|
+
const language = new state.Compartment();
|
|
304
|
+
const tabSize = new state.Compartment();
|
|
305
|
+
return [
|
|
306
|
+
// Toggle basic setup
|
|
307
|
+
props.basic ? codemirror.basicSetup : void 0,
|
|
308
|
+
// Toggle minimal setup
|
|
309
|
+
props.minimal && !props.basic ? codemirror.minimalSetup : void 0,
|
|
310
|
+
// ViewUpdate event listener
|
|
311
|
+
view.EditorView.updateListener.of((update) => {
|
|
312
|
+
context.emit("focus", view$1.value.hasFocus);
|
|
313
|
+
length.value = view$1.value.state.doc.length;
|
|
314
|
+
if (update.changes.empty || !update.docChanged) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (props.linter) {
|
|
318
|
+
if (props.forceLinting) {
|
|
319
|
+
lint.forceLinting(view$1.value);
|
|
320
|
+
}
|
|
321
|
+
diagnosticCount.value = props.linter(view$1.value).length;
|
|
322
|
+
}
|
|
323
|
+
context.emit("update", update);
|
|
324
|
+
}),
|
|
325
|
+
// Toggle light/dark mode.
|
|
326
|
+
view.EditorView.theme(props.theme, { dark: props.dark }),
|
|
327
|
+
// Toggle line wrapping
|
|
328
|
+
props.wrap ? view.EditorView.lineWrapping : void 0,
|
|
329
|
+
// Indent with tab
|
|
330
|
+
props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
|
|
331
|
+
// Allow Multiple Selections
|
|
332
|
+
state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
333
|
+
// Indent tab size
|
|
334
|
+
props.tabSize ? tabSize.of(state.EditorState.tabSize.of(props.tabSize)) : void 0,
|
|
335
|
+
// locale settings
|
|
336
|
+
props.phrases ? state.EditorState.phrases.of(props.phrases) : void 0,
|
|
337
|
+
// Readonly option
|
|
338
|
+
state.EditorState.readOnly.of(props.readonly),
|
|
339
|
+
// Editable option
|
|
340
|
+
view.EditorView.editable.of(!props.disabled),
|
|
341
|
+
// Set Line break char
|
|
342
|
+
props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
|
|
343
|
+
// Lang
|
|
344
|
+
props.lang ? language.of(props.lang) : void 0,
|
|
345
|
+
// Append Linter settings
|
|
346
|
+
props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
|
|
347
|
+
// Show 🔴 to error line when linter enabled.
|
|
348
|
+
props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
|
|
349
|
+
// Placeholder
|
|
350
|
+
props.placeholder ? view.placeholder(props.placeholder) : void 0,
|
|
351
|
+
// Append Extensions
|
|
352
|
+
...props.extensions
|
|
353
|
+
].filter((extension) => !!extension);
|
|
354
|
+
});
|
|
355
|
+
vueDemi.watch(
|
|
356
|
+
extensions,
|
|
357
|
+
(exts) => {
|
|
358
|
+
view$1.value?.dispatch({
|
|
359
|
+
effects: state.StateEffect.reconfigure.of(exts)
|
|
360
|
+
});
|
|
361
|
+
},
|
|
362
|
+
{ immediate: true }
|
|
363
|
+
);
|
|
364
|
+
vueDemi.watch(
|
|
365
|
+
() => props.modelValue,
|
|
366
|
+
async (value) => {
|
|
367
|
+
if (view$1.value.composing || // IME fix
|
|
368
|
+
view$1.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
view$1.value.dispatch({
|
|
372
|
+
changes: { from: 0, to: view$1.value.state.doc.length, insert: value },
|
|
373
|
+
selection: view$1.value.state.selection,
|
|
374
|
+
scrollIntoView: true
|
|
375
|
+
});
|
|
376
|
+
},
|
|
377
|
+
{ immediate: true }
|
|
378
|
+
);
|
|
379
|
+
vueDemi.onMounted(async () => {
|
|
380
|
+
let value = doc.value;
|
|
381
|
+
if (!editor.value) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (editor.value.childNodes[0]) {
|
|
385
|
+
if (doc.value !== "") {
|
|
386
|
+
console.warn(
|
|
387
|
+
"[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
value = editor.value.childNodes[0].innerText.trim();
|
|
391
|
+
}
|
|
392
|
+
view$1.value = new view.EditorView({
|
|
393
|
+
parent: editor.value,
|
|
394
|
+
state: state.EditorState.create({ doc: value, extensions: extensions.value }),
|
|
395
|
+
dispatch: (tr) => {
|
|
396
|
+
view$1.value.update([tr]);
|
|
397
|
+
if (tr.changes.empty || !tr.docChanged) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
context.emit("update:modelValue", tr.state.doc.toString());
|
|
401
|
+
context.emit("change", tr.state);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
await vueDemi.nextTick();
|
|
405
|
+
context.emit("ready", {
|
|
406
|
+
view: view$1.value,
|
|
407
|
+
state: view$1.value.state,
|
|
408
|
+
container: editor.value
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
vueDemi.onUnmounted(() => {
|
|
412
|
+
view$1.value.destroy();
|
|
413
|
+
context.emit("destroy");
|
|
414
|
+
});
|
|
415
|
+
const lint$1 = () => {
|
|
416
|
+
if (!props.linter || !view$1.value) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (props.forceLinting) {
|
|
420
|
+
lint.forceLinting(view$1.value);
|
|
421
|
+
}
|
|
422
|
+
diagnosticCount.value = lint.diagnosticCount(view$1.value.state);
|
|
423
|
+
};
|
|
424
|
+
const forceReconfigure = () => {
|
|
425
|
+
view$1.value?.dispatch({
|
|
426
|
+
effects: state.StateEffect.reconfigure.of([])
|
|
427
|
+
});
|
|
428
|
+
view$1.value?.dispatch({
|
|
429
|
+
effects: state.StateEffect.appendConfig.of(extensions.value)
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
const getRange = (from, to) => view$1.value.state.sliceDoc(from, to);
|
|
433
|
+
const getLine = (number) => view$1.value.state.doc.line(number + 1).text;
|
|
434
|
+
const lineCount = () => view$1.value.state.doc.lines;
|
|
435
|
+
const getCursor = () => view$1.value.state.selection.main.head;
|
|
436
|
+
const listSelections = () => {
|
|
437
|
+
let _view$value$state$sel;
|
|
438
|
+
return (_view$value$state$sel = view$1.value.state.selection.ranges) !== null && _view$value$state$sel !== void 0 ? _view$value$state$sel : [];
|
|
439
|
+
};
|
|
440
|
+
const getSelection = () => {
|
|
441
|
+
let _view$value$state$sli;
|
|
442
|
+
return (_view$value$state$sli = view$1.value.state.sliceDoc(
|
|
443
|
+
view$1.value.state.selection.main.from,
|
|
444
|
+
view$1.value.state.selection.main.to
|
|
445
|
+
)) !== null && _view$value$state$sli !== void 0 ? _view$value$state$sli : "";
|
|
446
|
+
};
|
|
447
|
+
const getSelections = () => {
|
|
448
|
+
const s = view$1.value.state;
|
|
449
|
+
if (!s) {
|
|
450
|
+
return [];
|
|
451
|
+
}
|
|
452
|
+
return s.selection.ranges.map(
|
|
453
|
+
(r) => s.sliceDoc(r.from, r.to)
|
|
454
|
+
);
|
|
455
|
+
};
|
|
456
|
+
const somethingSelected = () => view$1.value.state.selection.ranges.some(
|
|
457
|
+
(r) => !r.empty
|
|
458
|
+
);
|
|
459
|
+
const replaceRange = (replacement, from, to) => view$1.value.dispatch({
|
|
460
|
+
changes: { from, to, insert: replacement }
|
|
461
|
+
});
|
|
462
|
+
const replaceSelection = (replacement) => view$1.value.dispatch(view$1.value.state.replaceSelection(replacement));
|
|
463
|
+
const setCursor = (position) => view$1.value.dispatch({ selection: { anchor: position } });
|
|
464
|
+
const setSelection = (anchor, head) => view$1.value.dispatch({ selection: { anchor, head } });
|
|
465
|
+
const setSelections = (ranges, primary) => view$1.value.dispatch({
|
|
466
|
+
selection: state.EditorSelection.create(ranges, primary)
|
|
467
|
+
});
|
|
468
|
+
const extendSelectionsBy = (f) => view$1.value.dispatch({
|
|
469
|
+
selection: state.EditorSelection.create(
|
|
470
|
+
selection.value.ranges.map((r) => r.extend(f(r)))
|
|
471
|
+
)
|
|
472
|
+
});
|
|
473
|
+
const exposed = {
|
|
474
|
+
editor,
|
|
475
|
+
view: view$1,
|
|
476
|
+
cursor,
|
|
477
|
+
selection,
|
|
478
|
+
focus,
|
|
479
|
+
length,
|
|
480
|
+
json,
|
|
481
|
+
diagnosticCount,
|
|
482
|
+
dom: view$1.value.contentDOM,
|
|
483
|
+
lint: lint$1,
|
|
484
|
+
forceReconfigure,
|
|
485
|
+
// Bellow is CodeMirror5's function
|
|
486
|
+
getRange,
|
|
487
|
+
getLine,
|
|
488
|
+
lineCount,
|
|
489
|
+
getCursor,
|
|
490
|
+
listSelections,
|
|
491
|
+
getSelection,
|
|
492
|
+
getSelections,
|
|
493
|
+
somethingSelected,
|
|
494
|
+
replaceRange,
|
|
495
|
+
replaceSelection,
|
|
496
|
+
setCursor,
|
|
497
|
+
setSelection,
|
|
498
|
+
setSelections,
|
|
499
|
+
extendSelectionsBy
|
|
500
|
+
};
|
|
501
|
+
context.expose(exposed);
|
|
502
|
+
return exposed;
|
|
503
|
+
},
|
|
504
|
+
render() {
|
|
505
|
+
return h(
|
|
506
|
+
this.$props.tag,
|
|
507
|
+
{
|
|
508
|
+
ref: "editor",
|
|
509
|
+
class: "vue-codemirror"
|
|
510
|
+
},
|
|
511
|
+
this.$slots.default ? (
|
|
512
|
+
// Hide original content
|
|
513
|
+
h(
|
|
514
|
+
"aside",
|
|
515
|
+
{ style: "display: none;", "aria-hidden": "true" },
|
|
516
|
+
slot(this.$slots.default)
|
|
517
|
+
)
|
|
518
|
+
) : void 0
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
const meta = {
|
|
524
|
+
version: "1.1.30",
|
|
525
|
+
date: "2023-11-29T09:13:26.916Z"
|
|
526
|
+
};
|
|
527
|
+
var meta$1 = meta;
|
|
528
|
+
|
|
529
|
+
const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
|
|
530
|
+
|
|
531
|
+
exports.Meta = meta$1;
|
|
532
|
+
exports["default"] = CodeMirror;
|
|
533
|
+
exports.install = installCodeMirror;
|
|
534
|
+
|
|
535
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
536
|
+
|
|
537
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "vue-codemirror6",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.31",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "CodeMirror6 Component for vue2 and vue3.",
|
|
7
7
|
"keywords": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"homepage": "https://github.com/logue/vue-codemirror6",
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "git@github.com
|
|
32
|
+
"url": "git+ssh://git@github.com/logue/vue-codemirror6.git"
|
|
33
33
|
},
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/logue/vue-codemirror6/issues"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"engines": {
|
|
56
56
|
"yarn": ">=1.22.19"
|
|
57
57
|
},
|
|
58
|
-
"packageManager": "yarn@4.0.
|
|
58
|
+
"packageManager": "yarn@4.0.2",
|
|
59
59
|
"sideEffects": false,
|
|
60
60
|
"scripts": {
|
|
61
61
|
"dev": "vite",
|
|
@@ -81,45 +81,45 @@
|
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@codemirror/lang-javascript": "^6.2.1",
|
|
83
83
|
"@codemirror/lang-json": "^6.0.1",
|
|
84
|
-
"@codemirror/lang-markdown": "^6.2.
|
|
84
|
+
"@codemirror/lang-markdown": "^6.2.3",
|
|
85
85
|
"@codemirror/lang-vue": "^0.1.2",
|
|
86
86
|
"@tsconfig/node-lts": "^18.12.5",
|
|
87
|
-
"@types/node": "^20.
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
89
|
-
"@vitejs/plugin-vue": "^4.
|
|
90
|
-
"@vue/compiler-sfc": "^3.3.
|
|
87
|
+
"@types/node": "^20.10.0",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
|
89
|
+
"@vitejs/plugin-vue": "^4.5.0",
|
|
90
|
+
"@vue/compiler-sfc": "^3.3.9",
|
|
91
91
|
"@vue/eslint-config-prettier": "^8.0.0",
|
|
92
92
|
"@vue/tsconfig": "^0.4.0",
|
|
93
|
-
"@vueuse/core": "^10.
|
|
93
|
+
"@vueuse/core": "^10.6.1",
|
|
94
94
|
"bootstrap": "^5.3.2",
|
|
95
|
-
"eslint": "^8.
|
|
96
|
-
"eslint-config-standard-with-typescript": "^
|
|
95
|
+
"eslint": "^8.54.0",
|
|
96
|
+
"eslint-config-standard-with-typescript": "^40.0.0",
|
|
97
97
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
98
98
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
99
|
-
"eslint-linter-browserify": "^8.
|
|
99
|
+
"eslint-linter-browserify": "^8.54.0",
|
|
100
100
|
"eslint-plugin-html": "^7.1.0",
|
|
101
101
|
"eslint-plugin-import": "^2.29.0",
|
|
102
|
-
"eslint-plugin-n": "^16.3.
|
|
102
|
+
"eslint-plugin-n": "^16.3.1",
|
|
103
103
|
"eslint-plugin-promise": "^6.1.1",
|
|
104
104
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
105
105
|
"eslint-plugin-vue": "latest",
|
|
106
106
|
"eslint-plugin-vuejs-accessibility": "^2.2.0",
|
|
107
107
|
"eslint-plugin-yaml": "^0.5.0",
|
|
108
108
|
"husky": "^8.0.3",
|
|
109
|
-
"lint-staged": "^15.0
|
|
109
|
+
"lint-staged": "^15.1.0",
|
|
110
110
|
"npm-run-all": "^4.1.5",
|
|
111
|
-
"prettier": "^3.0
|
|
111
|
+
"prettier": "^3.1.0",
|
|
112
112
|
"rimraf": "^5.0.5",
|
|
113
|
-
"rollup-plugin-visualizer": "^5.9.
|
|
113
|
+
"rollup-plugin-visualizer": "^5.9.3",
|
|
114
114
|
"sass": "~1.69.5",
|
|
115
|
-
"typescript": "^5.
|
|
116
|
-
"vite": "^
|
|
115
|
+
"typescript": "^5.3.2",
|
|
116
|
+
"vite": "^5.0.3",
|
|
117
117
|
"vite-plugin-banner": "^0.7.1",
|
|
118
118
|
"vite-plugin-checker": "^0.6.2",
|
|
119
119
|
"vite-plugin-dts": "^3.6.3",
|
|
120
|
-
"vue": "^3.3.
|
|
120
|
+
"vue": "^3.3.9",
|
|
121
121
|
"vue-eslint-parser": "^9.3.2",
|
|
122
|
-
"vue-markdown-wasm": "^0.3.
|
|
122
|
+
"vue-markdown-wasm": "^0.3.14",
|
|
123
123
|
"vue-tsc": "^1.8.22"
|
|
124
124
|
},
|
|
125
125
|
"husky": {
|
|
@@ -137,7 +137,6 @@
|
|
|
137
137
|
"postcss": "^8.4.31",
|
|
138
138
|
"semver": "^7.5.2",
|
|
139
139
|
"tough-cookie": "^4.1.3",
|
|
140
|
-
"vite": "^4.3.9",
|
|
141
140
|
"word-wrap": "^1.2.4",
|
|
142
141
|
"yaml": "^2.3.2"
|
|
143
142
|
}
|