vue-codemirror6 1.1.11 → 1.1.13
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 +20 -3
- package/README.md +87 -25
- package/dist/index.es.js +43 -18
- package/dist/index.iife.js +42 -17
- package/dist/index.umd.js +42 -17
- package/dist/src/Meta.d.ts +3 -0
- package/dist/src/components/CodeMirror.d.ts +25 -0
- package/dist/{helpers → src/helpers}/h-demi.d.ts +20 -18
- package/dist/{index.d.ts → src/index.d.ts} +4 -4
- package/dist/{interfaces → src/interfaces}/MetaInterface.d.ts +7 -7
- package/package.json +30 -36
- package/src/components/CodeMirror.ts +42 -9
- package/dist/Meta.d.ts +0 -3
- package/dist/Meta.js +0 -6
- package/dist/components/CodeMirror.d.ts +0 -417
- package/dist/components/CodeMirror.js +0 -509
- package/dist/helpers/h-demi.js +0 -27
- package/dist/index.js +0 -11
- package/dist/interfaces/MetaInterface.js +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.1.
|
|
8
|
+
* @version 1.1.13
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
return { ...ret, [key]: handler };
|
|
25
25
|
}, {});
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
if (vueDemi.isVue2
|
|
27
|
+
function h(type, options = {}, chidren) {
|
|
28
|
+
if (vueDemi.isVue2) {
|
|
29
29
|
return vueDemi.h(type, options, chidren);
|
|
30
30
|
}
|
|
31
31
|
const { props, domProps, on, ...extraOptions } = options;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
{ ...extraOptions, ...props, ...domProps, ...ons },
|
|
36
36
|
chidren
|
|
37
37
|
);
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
const slot = (defaultSlots) => typeof defaultSlots == "function" ? defaultSlots() : defaultSlots;
|
|
40
40
|
|
|
41
41
|
var CodeMirror = vueDemi.defineComponent({
|
|
@@ -115,6 +115,15 @@
|
|
|
115
115
|
type: Boolean,
|
|
116
116
|
default: false
|
|
117
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
|
+
},
|
|
118
127
|
/**
|
|
119
128
|
* Tab size
|
|
120
129
|
*
|
|
@@ -199,8 +208,16 @@
|
|
|
199
208
|
*/
|
|
200
209
|
linterConfig: {
|
|
201
210
|
type: Object,
|
|
202
|
-
default: () =>
|
|
203
|
-
|
|
211
|
+
default: () => void 0
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Forces any linters configured to run when the editor is idle to run right away.
|
|
215
|
+
*
|
|
216
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
|
|
217
|
+
*/
|
|
218
|
+
forceLinting: {
|
|
219
|
+
type: Boolean,
|
|
220
|
+
default: false
|
|
204
221
|
},
|
|
205
222
|
/**
|
|
206
223
|
* Show Linter Gutter
|
|
@@ -221,8 +238,7 @@
|
|
|
221
238
|
*/
|
|
222
239
|
gutterConfig: {
|
|
223
240
|
type: Object,
|
|
224
|
-
default: () =>
|
|
225
|
-
}
|
|
241
|
+
default: () => void 0
|
|
226
242
|
},
|
|
227
243
|
/**
|
|
228
244
|
* Using tag
|
|
@@ -240,6 +256,7 @@
|
|
|
240
256
|
* @param props - Props
|
|
241
257
|
* @param context - Context
|
|
242
258
|
*/
|
|
259
|
+
// @ts-ignore
|
|
243
260
|
setup(props, context) {
|
|
244
261
|
const editor = vueDemi.ref();
|
|
245
262
|
const doc = vueDemi.ref(props.modelValue);
|
|
@@ -285,6 +302,8 @@
|
|
|
285
302
|
props.wrap ? view.EditorView.lineWrapping : void 0,
|
|
286
303
|
// Indent with tab
|
|
287
304
|
props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
|
|
305
|
+
// Allow Multiple Selections
|
|
306
|
+
state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
288
307
|
// Indent tab size
|
|
289
308
|
props.tabSize ? state.EditorState.tabSize.of(props.tabSize) : void 0,
|
|
290
309
|
// locale settings
|
|
@@ -296,14 +315,14 @@
|
|
|
296
315
|
// Set Line break char
|
|
297
316
|
props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
|
|
298
317
|
// Lang
|
|
299
|
-
props.lang ? props.lang : void 0,
|
|
318
|
+
props.lang ? props.lang.extension : void 0,
|
|
300
319
|
// Append Linter settings
|
|
301
320
|
props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
|
|
302
321
|
// Show 🔴 to error line when linter enabled.
|
|
303
322
|
props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
|
|
304
323
|
// Placeholder
|
|
305
324
|
props.placeholder ? view.placeholder(props.placeholder) : void 0,
|
|
306
|
-
// Append Extensions
|
|
325
|
+
// Append Extensions
|
|
307
326
|
...props.extensions
|
|
308
327
|
])
|
|
309
328
|
)
|
|
@@ -314,6 +333,9 @@
|
|
|
314
333
|
if (view$1.value.composing) {
|
|
315
334
|
return;
|
|
316
335
|
}
|
|
336
|
+
if (props.linter && props.forceLinting) {
|
|
337
|
+
lint.forceLinting(view$1.value);
|
|
338
|
+
}
|
|
317
339
|
view$1.value.dispatch({
|
|
318
340
|
changes: { from: 0, to: view$1.value.state.doc.length, insert: value },
|
|
319
341
|
selection: view$1.value.state.selection,
|
|
@@ -323,13 +345,13 @@
|
|
|
323
345
|
{ immediate: true }
|
|
324
346
|
);
|
|
325
347
|
vueDemi.watch(
|
|
326
|
-
extensions,
|
|
327
|
-
(exts) =>
|
|
328
|
-
// TODO: Reduce unchanched value
|
|
348
|
+
() => extensions.value,
|
|
349
|
+
(exts) => {
|
|
329
350
|
view$1.value.dispatch({
|
|
330
351
|
effects: state.StateEffect.reconfigure.of(exts)
|
|
331
|
-
})
|
|
332
|
-
|
|
352
|
+
});
|
|
353
|
+
},
|
|
354
|
+
{ deep: true }
|
|
333
355
|
);
|
|
334
356
|
vueDemi.watch(focus, (isFocus) => context.emit("focus", isFocus));
|
|
335
357
|
vueDemi.onMounted(async () => {
|
|
@@ -441,16 +463,19 @@
|
|
|
441
463
|
},
|
|
442
464
|
render() {
|
|
443
465
|
return h(
|
|
466
|
+
// @ts-ignore
|
|
444
467
|
this.$props.tag,
|
|
445
468
|
{
|
|
446
469
|
ref: "editor",
|
|
447
470
|
class: "vue-codemirror"
|
|
448
471
|
},
|
|
472
|
+
// @ts-ignore
|
|
449
473
|
this.$slots.default ? (
|
|
450
474
|
// Hide original content
|
|
451
475
|
h(
|
|
452
476
|
"aside",
|
|
453
477
|
{ style: "display: none;", "aria-hidden": "true" },
|
|
478
|
+
// @ts-ignore
|
|
454
479
|
slot(this.$slots.default)
|
|
455
480
|
)
|
|
456
481
|
) : void 0
|
|
@@ -459,8 +484,8 @@
|
|
|
459
484
|
});
|
|
460
485
|
|
|
461
486
|
const meta = {
|
|
462
|
-
version: "1.1.
|
|
463
|
-
date: "2023-
|
|
487
|
+
version: "1.1.13",
|
|
488
|
+
date: "2023-03-13T09:36:27.207Z"
|
|
464
489
|
};
|
|
465
490
|
|
|
466
491
|
const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ObjectEmitsOptions } from 'vue-demi';
|
|
2
|
+
import { EditorState, type Text } from '@codemirror/state';
|
|
3
|
+
import { EditorView, type ViewUpdate } from '@codemirror/view';
|
|
4
|
+
/** Emit Interface */
|
|
5
|
+
export interface CodeMirrorEmitsOptions extends ObjectEmitsOptions {
|
|
6
|
+
/** Model Update */
|
|
7
|
+
(e: 'update:modelValue', value: string | Text): void;
|
|
8
|
+
/** CodeMirror ViewUpdate */
|
|
9
|
+
(e: 'update', value: ViewUpdate): void;
|
|
10
|
+
/** CodeMirror onFocus */
|
|
11
|
+
(e: 'focus', value: boolean): void;
|
|
12
|
+
/** CodeMirror onReady */
|
|
13
|
+
(e: 'ready', value: {
|
|
14
|
+
view: EditorView;
|
|
15
|
+
state: EditorState;
|
|
16
|
+
container: HTMLElement;
|
|
17
|
+
}): void;
|
|
18
|
+
/** CodeMirror onDestroy */
|
|
19
|
+
(e: 'destroy'): void;
|
|
20
|
+
/** State Changed */
|
|
21
|
+
(e: 'change', value: EditorState): void;
|
|
22
|
+
}
|
|
23
|
+
/** CodeMirror Component */
|
|
24
|
+
declare const _default: import("vue-demi").DefineComponent<unknown, object, {}, import("vue-demi").ComputedOptions, import("vue-demi").MethodOptions, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<unknown>, {}>;
|
|
25
|
+
export default _default;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* h-demi - h function for Vue 2 and 3
|
|
3
|
-
*
|
|
4
|
-
* @see {@link https://github.com/vueuse/vue-demi/issues/65}
|
|
5
|
-
*/
|
|
6
|
-
import { type VNode } from 'vue-demi';
|
|
7
|
-
interface Options {
|
|
8
|
-
class?: string;
|
|
9
|
-
domProps?: Record<any, any>;
|
|
10
|
-
on?: Record<any, any>;
|
|
11
|
-
props?: Record<any, any>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
/**
|
|
2
|
+
* h-demi - h function for Vue 2 and 3
|
|
3
|
+
*
|
|
4
|
+
* @see {@link https://github.com/vueuse/vue-demi/issues/65}
|
|
5
|
+
*/
|
|
6
|
+
import { type Slots, type VNode, type VNodeProps } from 'vue-demi';
|
|
7
|
+
interface Options extends VNodeProps {
|
|
8
|
+
class?: string;
|
|
9
|
+
domProps?: Record<any, any>;
|
|
10
|
+
on?: Record<any, any>;
|
|
11
|
+
props?: Record<any, any>;
|
|
12
|
+
style?: string;
|
|
13
|
+
'aria-hidden'?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* hDemi function.
|
|
17
|
+
*/
|
|
18
|
+
declare function h(type: string | Record<any, any>, options?: Options, chidren?: any): VNode;
|
|
19
|
+
declare const slot: (defaultSlots: any) => Slots;
|
|
20
|
+
export { slot, h as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import CodeMirror from './components/CodeMirror';
|
|
2
|
-
import Meta from './Meta';
|
|
3
|
-
declare const installCodeMirror: (app: any) => any;
|
|
4
|
-
export { CodeMirror as default, installCodeMirror as install, Meta };
|
|
1
|
+
import CodeMirror from './components/CodeMirror';
|
|
2
|
+
import Meta from './Meta';
|
|
3
|
+
declare const installCodeMirror: (app: any) => any;
|
|
4
|
+
export { CodeMirror as default, installCodeMirror as install, Meta };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** Build information meta data */
|
|
2
|
-
export default interface MetaInterface {
|
|
3
|
-
/** Version */
|
|
4
|
-
version: string;
|
|
5
|
-
/** Build date */
|
|
6
|
-
date: string;
|
|
7
|
-
}
|
|
1
|
+
/** Build information meta data */
|
|
2
|
+
export default interface MetaInterface {
|
|
3
|
+
/** Version */
|
|
4
|
+
version: string;
|
|
5
|
+
/** Build date */
|
|
6
|
+
date: string;
|
|
7
|
+
}
|
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.13",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "CodeMirror6 Component for vue2 and vue3.",
|
|
7
7
|
"keywords": [
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
"main": "dist/index.umd.js",
|
|
38
38
|
"module": "dist/index.es.js",
|
|
39
|
-
"types": "dist/index.d.ts",
|
|
39
|
+
"types": "dist/src/index.d.ts",
|
|
40
40
|
"exports": {
|
|
41
41
|
".": {
|
|
42
42
|
"import": "./dist/index.es.js",
|
|
43
43
|
"require": "./dist/index.umd.js",
|
|
44
|
-
"types": "./dist/index.d.ts"
|
|
44
|
+
"types": "./dist/src/index.d.ts"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
@@ -53,21 +53,20 @@
|
|
|
53
53
|
"./sfc": "./src/components/CodeMirror.ts"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
|
-
"node": ">=18.
|
|
57
|
-
"yarn": ">=1.22.
|
|
56
|
+
"node": ">=18.15.0",
|
|
57
|
+
"yarn": ">=1.22.19"
|
|
58
58
|
},
|
|
59
|
-
"packageManager": "yarn@3.
|
|
59
|
+
"packageManager": "yarn@3.4.1",
|
|
60
60
|
"sideEffects": false,
|
|
61
61
|
"scripts": {
|
|
62
62
|
"dev": "vite",
|
|
63
63
|
"clean": "rimraf node_modules/.vite",
|
|
64
64
|
"type-check": "tsc --noEmit --composite false",
|
|
65
|
-
"build": "run-p type-check build-only
|
|
65
|
+
"build": "run-p type-check build-only",
|
|
66
66
|
"build:analyze": "vite build --mode=analyze",
|
|
67
67
|
"build:clean": "rimraf dist docs",
|
|
68
68
|
"build:docs": "vite build --mode=docs",
|
|
69
69
|
"build-only": "vite build",
|
|
70
|
-
"build-declaration": "tsc -p tsconfig.app.json --composite false",
|
|
71
70
|
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
|
|
72
71
|
"preview": "vite preview --mode=docs",
|
|
73
72
|
"prepare": "husky install",
|
|
@@ -79,56 +78,51 @@
|
|
|
79
78
|
"vue-demi": "latest"
|
|
80
79
|
},
|
|
81
80
|
"peerDependencies": {
|
|
82
|
-
"
|
|
83
|
-
"vue": "^2.6.14 || ^3.2.39"
|
|
84
|
-
},
|
|
85
|
-
"peerDependenciesMeta": {
|
|
86
|
-
"@vue/composition-api": {
|
|
87
|
-
"optional": true
|
|
88
|
-
}
|
|
81
|
+
"vue": "^2.7.14 || ^3.2.47"
|
|
89
82
|
},
|
|
90
83
|
"devDependencies": {
|
|
91
|
-
"@codemirror/lang-javascript": "^6.1.
|
|
84
|
+
"@codemirror/lang-javascript": "^6.1.4",
|
|
92
85
|
"@codemirror/lang-json": "^6.0.1",
|
|
93
|
-
"@codemirror/lang-markdown": "^6.0
|
|
86
|
+
"@codemirror/lang-markdown": "^6.1.0",
|
|
87
|
+
"@codemirror/lang-vue": "^0.1.1",
|
|
94
88
|
"@types/lodash": "^4.14.191",
|
|
95
|
-
"@types/node": "^18.
|
|
96
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
97
|
-
"@typescript-eslint/parser": "^5.
|
|
89
|
+
"@types/node": "^18.15.1",
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
91
|
+
"@typescript-eslint/parser": "^5.54.1",
|
|
98
92
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
99
|
-
"@vue/eslint-config-prettier": "^7.
|
|
93
|
+
"@vue/eslint-config-prettier": "^7.1.0",
|
|
100
94
|
"@vue/tsconfig": "^0.1.3",
|
|
101
|
-
"@vueuse/core": "^9.
|
|
102
|
-
"eslint": "^8.
|
|
95
|
+
"@vueuse/core": "^9.13.0",
|
|
96
|
+
"eslint": "^8.36.0",
|
|
103
97
|
"eslint-config-google": "^0.14.0",
|
|
104
|
-
"eslint-config-prettier": "^8.
|
|
98
|
+
"eslint-config-prettier": "^8.7.0",
|
|
105
99
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
106
100
|
"eslint-import-resolver-typescript": "^3.5.3",
|
|
107
|
-
"eslint-linter-browserify": "^8.
|
|
101
|
+
"eslint-linter-browserify": "^8.36.0",
|
|
108
102
|
"eslint-plugin-html": "^7.1.0",
|
|
109
103
|
"eslint-plugin-import": "^2.27.5",
|
|
110
|
-
"eslint-plugin-jsdoc": "^
|
|
104
|
+
"eslint-plugin-jsdoc": "^40.0.1",
|
|
111
105
|
"eslint-plugin-prettier": "^4.2.1",
|
|
112
106
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
113
107
|
"eslint-plugin-vue": "^9.9.0",
|
|
114
108
|
"eslint-plugin-vuejs-accessibility": "^2.1.0",
|
|
115
109
|
"eslint-plugin-yaml": "^0.5.0",
|
|
116
110
|
"husky": "^8.0.3",
|
|
117
|
-
"lint-staged": "^13.
|
|
111
|
+
"lint-staged": "^13.2.0",
|
|
118
112
|
"npm-run-all": "^4.1.5",
|
|
119
|
-
"prettier": "^2.8.
|
|
120
|
-
"rimraf": "^4.
|
|
113
|
+
"prettier": "^2.8.4",
|
|
114
|
+
"rimraf": "^4.4.0",
|
|
121
115
|
"rollup-plugin-visualizer": "^5.9.0",
|
|
122
|
-
"sass": "^1.
|
|
123
|
-
"sass-loader": "^13.2.0",
|
|
116
|
+
"sass": "^1.59.2",
|
|
124
117
|
"typescript": "^4.9.5",
|
|
125
|
-
"vite": "^4.1.
|
|
118
|
+
"vite": "^4.1.4",
|
|
126
119
|
"vite-plugin-banner": "^0.7.0",
|
|
127
|
-
"vite-plugin-checker": "^0.5.
|
|
128
|
-
"
|
|
120
|
+
"vite-plugin-checker": "^0.5.6",
|
|
121
|
+
"vite-plugin-dts": "^2.1.0",
|
|
122
|
+
"vue": "^3.2.47",
|
|
129
123
|
"vue-eslint-parser": "^9.1.0",
|
|
130
|
-
"vue-markdown-wasm": "^0.3.
|
|
131
|
-
"vue-tsc": "^1.0
|
|
124
|
+
"vue-markdown-wasm": "^0.3.6",
|
|
125
|
+
"vue-tsc": "^1.2.0"
|
|
132
126
|
},
|
|
133
127
|
"husky": {
|
|
134
128
|
"hooks": {
|
|
@@ -146,6 +146,15 @@ export default defineComponent({
|
|
|
146
146
|
type: Boolean,
|
|
147
147
|
default: false,
|
|
148
148
|
},
|
|
149
|
+
/**
|
|
150
|
+
* Allow Multiple Selection.
|
|
151
|
+
*
|
|
152
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
|
|
153
|
+
*/
|
|
154
|
+
allowMultipleSelections: {
|
|
155
|
+
type: Boolean,
|
|
156
|
+
default: false,
|
|
157
|
+
},
|
|
149
158
|
/**
|
|
150
159
|
* Tab size
|
|
151
160
|
*
|
|
@@ -230,7 +239,16 @@ export default defineComponent({
|
|
|
230
239
|
*/
|
|
231
240
|
linterConfig: {
|
|
232
241
|
type: Object,
|
|
233
|
-
default: () =>
|
|
242
|
+
default: () => undefined,
|
|
243
|
+
},
|
|
244
|
+
/**
|
|
245
|
+
* Forces any linters configured to run when the editor is idle to run right away.
|
|
246
|
+
*
|
|
247
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
|
|
248
|
+
*/
|
|
249
|
+
forceLinting: {
|
|
250
|
+
type: Boolean,
|
|
251
|
+
default: false,
|
|
234
252
|
},
|
|
235
253
|
/**
|
|
236
254
|
* Show Linter Gutter
|
|
@@ -251,7 +269,7 @@ export default defineComponent({
|
|
|
251
269
|
*/
|
|
252
270
|
gutterConfig: {
|
|
253
271
|
type: Object,
|
|
254
|
-
default: () =>
|
|
272
|
+
default: () => undefined,
|
|
255
273
|
},
|
|
256
274
|
/**
|
|
257
275
|
* Using tag
|
|
@@ -269,6 +287,7 @@ export default defineComponent({
|
|
|
269
287
|
* @param props - Props
|
|
270
288
|
* @param context - Context
|
|
271
289
|
*/
|
|
290
|
+
// @ts-ignore
|
|
272
291
|
setup(props, context: SetupContext<CodeMirrorEmitsOptions>) {
|
|
273
292
|
/** Editor DOM */
|
|
274
293
|
const editor: Ref<HTMLElement | undefined> = ref();
|
|
@@ -346,6 +365,8 @@ export default defineComponent({
|
|
|
346
365
|
props.wrap ? EditorView.lineWrapping : undefined,
|
|
347
366
|
// Indent with tab
|
|
348
367
|
props.tab ? keymap.of([indentWithTab]) : undefined,
|
|
368
|
+
// Allow Multiple Selections
|
|
369
|
+
EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
349
370
|
// Indent tab size
|
|
350
371
|
props.tabSize ? EditorState.tabSize.of(props.tabSize) : undefined,
|
|
351
372
|
// locale settings
|
|
@@ -359,7 +380,7 @@ export default defineComponent({
|
|
|
359
380
|
? EditorState.lineSeparator.of(props.lineSeparator)
|
|
360
381
|
: undefined,
|
|
361
382
|
// Lang
|
|
362
|
-
props.lang ? props.lang : undefined,
|
|
383
|
+
props.lang ? props.lang.extension : undefined,
|
|
363
384
|
// Append Linter settings
|
|
364
385
|
props.linter ? linter(props.linter, props.linterConfig) : undefined,
|
|
365
386
|
// Show 🔴 to error line when linter enabled.
|
|
@@ -368,7 +389,7 @@ export default defineComponent({
|
|
|
368
389
|
: undefined,
|
|
369
390
|
// Placeholder
|
|
370
391
|
props.placeholder ? placeholder(props.placeholder) : undefined,
|
|
371
|
-
// Append Extensions
|
|
392
|
+
// Append Extensions
|
|
372
393
|
...props.extensions,
|
|
373
394
|
])
|
|
374
395
|
);
|
|
@@ -382,6 +403,11 @@ export default defineComponent({
|
|
|
382
403
|
return;
|
|
383
404
|
}
|
|
384
405
|
|
|
406
|
+
// Enable Force Linting
|
|
407
|
+
if (props.linter && props.forceLinting) {
|
|
408
|
+
forceLinting(view.value);
|
|
409
|
+
}
|
|
410
|
+
|
|
385
411
|
// Update
|
|
386
412
|
view.value.dispatch({
|
|
387
413
|
changes: { from: 0, to: view.value.state.doc.length, insert: value },
|
|
@@ -393,11 +419,14 @@ export default defineComponent({
|
|
|
393
419
|
);
|
|
394
420
|
|
|
395
421
|
// Extension (mostly props) Changed
|
|
396
|
-
watch(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
422
|
+
watch(
|
|
423
|
+
() => extensions.value,
|
|
424
|
+
exts => {
|
|
425
|
+
view.value.dispatch({
|
|
426
|
+
effects: StateEffect.reconfigure.of(exts),
|
|
427
|
+
});
|
|
428
|
+
},
|
|
429
|
+
{ deep: true }
|
|
401
430
|
);
|
|
402
431
|
|
|
403
432
|
// focus changed
|
|
@@ -433,6 +462,7 @@ export default defineComponent({
|
|
|
433
462
|
context.emit('change', view.value.state);
|
|
434
463
|
},
|
|
435
464
|
});
|
|
465
|
+
|
|
436
466
|
await nextTick();
|
|
437
467
|
context.emit('ready', {
|
|
438
468
|
view: view,
|
|
@@ -620,16 +650,19 @@ export default defineComponent({
|
|
|
620
650
|
// </div>
|
|
621
651
|
// </template>
|
|
622
652
|
return h(
|
|
653
|
+
// @ts-ignore
|
|
623
654
|
this.$props.tag,
|
|
624
655
|
{
|
|
625
656
|
ref: 'editor',
|
|
626
657
|
class: 'vue-codemirror',
|
|
627
658
|
},
|
|
659
|
+
// @ts-ignore
|
|
628
660
|
this.$slots.default
|
|
629
661
|
? // Hide original content
|
|
630
662
|
h(
|
|
631
663
|
'aside',
|
|
632
664
|
{ style: 'display: none;', 'aria-hidden': 'true' },
|
|
665
|
+
// @ts-ignore
|
|
633
666
|
slot(this.$slots.default)
|
|
634
667
|
)
|
|
635
668
|
: undefined
|
package/dist/Meta.d.ts
DELETED