vue-codemirror6 1.1.10 → 1.1.12
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 +7 -3
- package/README.md +59 -0
- package/dist/index.es.js +186 -39
- package/dist/index.iife.js +185 -38
- package/dist/index.umd.js +185 -38
- package/dist/src/Meta.d.ts +3 -0
- package/dist/src/components/CodeMirror.d.ts +27 -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 +33 -30
- package/src/components/CodeMirror.ts +30 -7
- 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/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,15 @@ 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.11](https://github.com/logue/vue-codemirror6/compare/1.1.11...1.1.11)
|
|
8
8
|
|
|
9
|
+
#### [1.1.11](https://github.com/logue/vue-codemirror6/compare/1.1.3...1.1.11)
|
|
10
|
+
|
|
11
|
+
> 4 February 2023
|
|
12
|
+
|
|
13
|
+
- [SECURITY FIX] CWE-1333: Inefficient Regular Expression Complexity #13 [`fc63a9f`](https://github.com/logue/vue-codemirror6/commit/fc63a9f14b5307089e9551157b011072971b112f)
|
|
9
14
|
- Fix for #11 [`c634b55`](https://github.com/logue/vue-codemirror6/commit/c634b555ffff93bb30da2f501ec366289fc86ec1)
|
|
10
|
-
-
|
|
11
|
-
- release v1.1.2 [`903af1f`](https://github.com/logue/vue-codemirror6/commit/903af1fcf128ea7958ca9ae40fc97f062d8696d1)
|
|
15
|
+
- Add forceReconfigure() function. [`bbfa8ad`](https://github.com/logue/vue-codemirror6/commit/bbfa8adb5bd5cdb56a53bd69337a4e0313e52033)
|
|
12
16
|
|
|
13
17
|
#### [1.1.3](https://github.com/logue/vue-codemirror6/compare/1.1.2...1.1.3)
|
|
14
18
|
|
package/README.md
CHANGED
|
@@ -54,7 +54,11 @@ This component can handle bidirectional binding by `v-model` like a general Vue
|
|
|
54
54
|
|
|
55
55
|
### Supported Languages
|
|
56
56
|
|
|
57
|
+
#### Official
|
|
58
|
+
|
|
59
|
+
- [`@codemirror/lang-angular`](https://www.npmjs.com/package/@codemirror/lang-angular)
|
|
57
60
|
- [`@codemirror/lang-cpp`](https://www.npmjs.com/package/@codemirror/lang-cpp)
|
|
61
|
+
- [`@codemirror/lang-css`](https://www.npmjs.com/package/@codemirror/lang-css)
|
|
58
62
|
- [`@codemirror/lang-html`](https://www.npmjs.com/package/@codemirror/lang-html)
|
|
59
63
|
- [`@codemirror/lang-java`](https://www.npmjs.com/package/@codemirror/lang-java)
|
|
60
64
|
- [`@codemirror/lang-javascript`](https://www.npmjs.com/package/@codemirror/lang-javascript)
|
|
@@ -65,8 +69,61 @@ This component can handle bidirectional binding by `v-model` like a general Vue
|
|
|
65
69
|
- [`@codemirror/lang-python`](https://www.npmjs.com/package/@codemirror/lang-python)
|
|
66
70
|
- [`@codemirror/lang-rust`](https://www.npmjs.com/package/@codemirror/lang-rust)
|
|
67
71
|
- [`@codemirror/lang-sql`](https://www.npmjs.com/package/@codemirror/lang-sql)
|
|
72
|
+
- [`@codemirror/lang-vue`](https://www.npmjs.com/package/@codemirror/lang-vue)
|
|
73
|
+
- [`@codemirror/lang-west`](https://www.npmjs.com/package/@codemirror/lang-west)
|
|
68
74
|
- [`@codemirror/lang-xml`](https://www.npmjs.com/package/@codemirror/lang-xml)
|
|
69
75
|
|
|
76
|
+
### Unofficial
|
|
77
|
+
|
|
78
|
+
- [@phoenix-plugin-registry/petetnt.brackets-codemirror-fortran](https://www.npmjs.com/package/@phoenix-plugin-registry/petetnt.brackets-codemirror-fortran)
|
|
79
|
+
- [@phoenix-plugin-registry/petetnt.brackets-codemirror-go](https://www.npmjs.com/package/@phoenix-plugin-registry/petetnt.brackets-codemirror-go)
|
|
80
|
+
- [`@acarl005/lang-sql`](https://www.npmjs.com/package/@acarl005/lang-sql)
|
|
81
|
+
- [`@ark-us/codemirror-lang-taylor`](https://www.npmjs.com/package/@ark-us/codemirror-lang-taylor)
|
|
82
|
+
- [`@formulavize/lang-fiz`](https://www.npmjs.com/package/@formulavize/lang-fiz)
|
|
83
|
+
- [`@gravitywiz/codemirror-lang-gfcalc`](https://www.npmjs.com/package/@gravitywiz/codemirror-lang-gfcalc)
|
|
84
|
+
- [`@nextjournal/lang-clojure`](https://www.npmjs.com/package/@nextjournal/lang-clojure)
|
|
85
|
+
- [`@plutojl/lang-julia`](https://www.npmjs.com/package/@plutojl/lang-julia)
|
|
86
|
+
- [`@polybase/codemirror-lang-javascript`](https://www.npmjs.com/package/@polybase/codemirror-lang-javascript) -[`@replit/codemirror-lang-nix`](https://www.npmjs.com/package/@replit/codemirror-lang-nix)
|
|
87
|
+
- [`@replit/codemirror-lang-csharp`](https://www.npmjs.com/package/@replit/codemirror-lang-csharp)
|
|
88
|
+
- [`@replit/codemirror-lang-solidity`](https://www.npmjs.com/package/@replit/codemirror-lang-solidity)
|
|
89
|
+
- [`@replit/codemirror-lang-svelte`](https://www.npmjs.com/package/@replit/codemirror-lang-svelte)
|
|
90
|
+
- [`@zhijiu/lang-sql`](https://www.npmjs.com/package/@zhijiu/lang-sql)
|
|
91
|
+
- [`codemirror-lang-bool`](https://www.npmjs.com/package/codemirror-lang-bool)
|
|
92
|
+
- [`codemirror-lang-brainfuck`](https://www.npmjs.com/package/codemirror-lang-brainfuck)
|
|
93
|
+
- [`codemirror-lang-cherry`](https://www.npmjs.com/package/codemirror-lang-cherry)
|
|
94
|
+
- [`codemirror-lang-chordpro`](https://www.npmjs.com/package/codemirror-lang-chordpro)
|
|
95
|
+
- [`codemirror-lang-circom`](https://www.npmjs.com/package/codemirror-lang-circom)
|
|
96
|
+
- [`codemirror-lang-edn`](https://www.npmjs.com/package/codemirror-lang-edn)
|
|
97
|
+
- [`codemirror-lang-ejs`](https://www.npmjs.com/package/codemirror-lang-ejs)
|
|
98
|
+
- [`codemirror-lang-fsl`](https://www.npmjs.com/package/codemirror-lang-fsl)
|
|
99
|
+
- [`codemirror-lang-gml`](https://www.npmjs.com/package/codemirror-lang-gml)
|
|
100
|
+
- [`codemirror-lang-golfscript`](https://www.npmjs.com/package/codemirror-lang-golfscript)
|
|
101
|
+
- [`codemirror-lang-homescript`](https://www.npmjs.com/package/codemirror-lang-homescript)
|
|
102
|
+
- [`codemirror-lang-html-n8n`](https://www.npmjs.com/package/codemirror-lang-html-n8n)
|
|
103
|
+
- [`codemirror-lang-inform7`](https://www.npmjs.com/package/codemirror-lang-inform7)
|
|
104
|
+
- [`codemirror-lang-j`](https://www.npmjs.com/package/codemirror-lang-j)
|
|
105
|
+
- [`codemirror-lang-janet`](https://www.npmjs.com/package/codemirror-lang-janet)
|
|
106
|
+
- [`codemirror-lang-k`](https://www.npmjs.com/package/codemirror-lang-k)
|
|
107
|
+
- [`codemirror-lang-karol`](https://www.npmjs.com/package/codemirror-lang-karol)
|
|
108
|
+
- [`codemirror-lang-mermaid`](https://www.npmjs.com/package/codemirror-lang-mermaid)
|
|
109
|
+
- [`codemirror-lang-n8n-expression`](https://www.npmjs.com/package/codemirror-lang-n8n-expression)
|
|
110
|
+
- [`codemirror-lang-prolog`](https://www.npmjs.com/package/codemirror-lang-prolog)
|
|
111
|
+
- [`codemirror-lang-qpen`](https://www.npmjs.com/package/codemirror-lang-qpen)
|
|
112
|
+
- [`codemirror-lang-qtam`](https://www.npmjs.com/package/codemirror-lang-qtam)
|
|
113
|
+
- [`codemirror-lang-r`](https://www.npmjs.com/package/codemirror-lang-r)
|
|
114
|
+
- [`codemirror-lang-rome-ast`](https://www.npmjs.com/package/codemirror-lang-rome-ast)
|
|
115
|
+
- [`codemirror-lang-rome`](https://www.npmjs.com/package/codemirror-lang-rome)
|
|
116
|
+
- [`codemirror-lang-rush`](https://www.npmjs.com/package/codemirror-lang-rush)
|
|
117
|
+
- [`codemirror-lang-scopescript`](https://www.npmjs.com/package/codemirror-lang-scopescript)
|
|
118
|
+
- [`codemirror-lang-statement`](https://www.npmjs.com/package/codemirror-lang-statement)
|
|
119
|
+
- [`gcode-lang-codemirror`](https://www.npmjs.com/package/gcode-lang-codemirror)
|
|
120
|
+
- [`gmail-lang`](https://www.npmjs.com/package/gmail-lang)
|
|
121
|
+
- [`lang-bqn`](https://www.npmjs.com/package/lang-bqn)
|
|
122
|
+
- [`lang-clojure`](https://www.npmjs.com/package/lang-clojure)
|
|
123
|
+
- [`lang-d`](https://www.npmjs.com/package/lang-d)
|
|
124
|
+
- [`lang-feel`](https://www.npmjs.com/package/lang-feel)
|
|
125
|
+
- [`lang-firestore`](https://www.npmjs.com/package/lang-firestore)
|
|
126
|
+
|
|
70
127
|
### Supported Themes
|
|
71
128
|
|
|
72
129
|
- [`@codemirror/theme-one-dark`](https://github.com/codemirror/theme-one-dark)
|
|
@@ -312,6 +369,8 @@ const config: UserConfig = {
|
|
|
312
369
|
'@codemirror/search',
|
|
313
370
|
'@codemirror/state',
|
|
314
371
|
'@codemirror/view',
|
|
372
|
+
],
|
|
373
|
+
'codemirror-lang': [
|
|
315
374
|
// Add the following as needed.
|
|
316
375
|
'@codemirror/lang-html',
|
|
317
376
|
'@codemirror/lang-javascript',
|
package/dist/index.es.js
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
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.12
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { isVue2,
|
|
12
|
+
import { isVue2, h as h$1, defineComponent, ref, shallowRef, computed, watch, onMounted, nextTick, onUnmounted } from 'vue-demi';
|
|
13
13
|
import { compact, trim } from 'lodash';
|
|
14
14
|
import { basicSetup, minimalSetup } from 'codemirror';
|
|
15
15
|
import { EditorState, StateEffect, EditorSelection } from '@codemirror/state';
|
|
@@ -26,8 +26,8 @@ const adaptOnsV3 = (ons) => {
|
|
|
26
26
|
return { ...ret, [key]: handler };
|
|
27
27
|
}, {});
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
if (isVue2
|
|
29
|
+
function h(type, options = {}, chidren) {
|
|
30
|
+
if (isVue2) {
|
|
31
31
|
return h$1(type, options, chidren);
|
|
32
32
|
}
|
|
33
33
|
const { props, domProps, on, ...extraOptions } = options;
|
|
@@ -37,103 +37,219 @@ const h = (type, options = {}, chidren) => {
|
|
|
37
37
|
{ ...extraOptions, ...props, ...domProps, ...ons },
|
|
38
38
|
chidren
|
|
39
39
|
);
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
41
|
const slot = (defaultSlots) => typeof defaultSlots == "function" ? defaultSlots() : defaultSlots;
|
|
42
42
|
|
|
43
43
|
var CodeMirror = defineComponent({
|
|
44
|
+
/** Component Name */
|
|
44
45
|
name: "CodeMirror",
|
|
46
|
+
/** Model Definition */
|
|
45
47
|
model: {
|
|
46
48
|
prop: "modelValue",
|
|
47
49
|
event: "update:modelValue"
|
|
48
50
|
},
|
|
51
|
+
/** Props Definition */
|
|
49
52
|
props: {
|
|
53
|
+
/** Model value */
|
|
50
54
|
modelValue: {
|
|
51
55
|
type: String,
|
|
52
56
|
default: ""
|
|
53
57
|
},
|
|
58
|
+
/**
|
|
59
|
+
* Theme
|
|
60
|
+
*
|
|
61
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
|
|
62
|
+
*/
|
|
54
63
|
theme: {
|
|
55
64
|
type: Object,
|
|
56
65
|
default: () => {
|
|
57
66
|
}
|
|
58
67
|
},
|
|
68
|
+
/** Dark Mode */
|
|
59
69
|
dark: {
|
|
60
70
|
type: Boolean,
|
|
61
71
|
default: false
|
|
62
72
|
},
|
|
73
|
+
/**
|
|
74
|
+
* Use Basic Setup
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
|
|
77
|
+
*/
|
|
63
78
|
basic: {
|
|
64
79
|
type: Boolean,
|
|
65
80
|
default: false
|
|
66
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* Use Minimal Setup (The basic setting has priority.)
|
|
84
|
+
*
|
|
85
|
+
* @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
|
|
86
|
+
*/
|
|
67
87
|
minimal: {
|
|
68
88
|
type: Boolean,
|
|
69
89
|
default: false
|
|
70
90
|
},
|
|
91
|
+
/**
|
|
92
|
+
* Placeholder
|
|
93
|
+
*
|
|
94
|
+
* @see {@link https://codemirror.net/docs/ref/#view.placeholder}
|
|
95
|
+
*/
|
|
71
96
|
placeholder: {
|
|
72
97
|
type: String,
|
|
73
98
|
default: void 0
|
|
74
99
|
},
|
|
100
|
+
/**
|
|
101
|
+
* Line wrapping
|
|
102
|
+
*
|
|
103
|
+
* An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
|
|
104
|
+
*
|
|
105
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
|
|
106
|
+
*/
|
|
75
107
|
wrap: {
|
|
76
108
|
type: Boolean,
|
|
77
109
|
default: false
|
|
78
110
|
},
|
|
111
|
+
/**
|
|
112
|
+
* Allow tab key indent.
|
|
113
|
+
*
|
|
114
|
+
* @see {@link https://codemirror.net/examples/tab/}
|
|
115
|
+
*/
|
|
79
116
|
tab: {
|
|
80
117
|
type: Boolean,
|
|
81
118
|
default: false
|
|
82
119
|
},
|
|
120
|
+
/**
|
|
121
|
+
* Tab size
|
|
122
|
+
*
|
|
123
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
|
|
124
|
+
*/
|
|
83
125
|
tabSize: {
|
|
84
126
|
type: Number,
|
|
85
127
|
default: void 0
|
|
86
128
|
},
|
|
129
|
+
/**
|
|
130
|
+
* Set line break (separetor) char.
|
|
131
|
+
*
|
|
132
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
|
|
133
|
+
*/
|
|
87
134
|
lineSeparator: {
|
|
88
135
|
type: String,
|
|
89
136
|
default: void 0
|
|
90
137
|
},
|
|
138
|
+
/**
|
|
139
|
+
* Readonly
|
|
140
|
+
*
|
|
141
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
|
|
142
|
+
*/
|
|
91
143
|
readonly: {
|
|
92
144
|
type: Boolean,
|
|
93
145
|
default: false
|
|
94
146
|
},
|
|
147
|
+
/**
|
|
148
|
+
* Disable input.
|
|
149
|
+
*
|
|
150
|
+
* This is the reversed value of the CodeMirror editable.
|
|
151
|
+
* Similar to `readonly`, but setting this value to true disables dragging.
|
|
152
|
+
*
|
|
153
|
+
* @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
|
|
154
|
+
*/
|
|
95
155
|
disabled: {
|
|
96
156
|
type: Boolean,
|
|
97
157
|
default: false
|
|
98
158
|
},
|
|
159
|
+
/**
|
|
160
|
+
* Additional Extension
|
|
161
|
+
*
|
|
162
|
+
* @see {@link https://codemirror.net/docs/ref/#state.Extension}
|
|
163
|
+
*/
|
|
99
164
|
extensions: {
|
|
100
165
|
type: Array,
|
|
101
166
|
default: () => {
|
|
102
167
|
return [];
|
|
103
168
|
}
|
|
104
169
|
},
|
|
170
|
+
/**
|
|
171
|
+
* Language Phreses
|
|
172
|
+
*
|
|
173
|
+
* @see {@link https://codemirror.net/examples/translate/}
|
|
174
|
+
*/
|
|
105
175
|
phrases: {
|
|
106
176
|
type: Object,
|
|
107
177
|
default: () => void 0
|
|
108
178
|
},
|
|
179
|
+
/**
|
|
180
|
+
* CodeMirror Language
|
|
181
|
+
*
|
|
182
|
+
* @see {@link https://codemirror.net/docs/ref/#language}
|
|
183
|
+
*/
|
|
109
184
|
lang: {
|
|
110
185
|
type: Object,
|
|
111
186
|
default: () => void 0
|
|
112
187
|
},
|
|
188
|
+
/**
|
|
189
|
+
* CodeMirror Linter
|
|
190
|
+
*
|
|
191
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.linter}
|
|
192
|
+
*/
|
|
113
193
|
linter: {
|
|
114
194
|
type: Function,
|
|
115
195
|
default: void 0
|
|
116
196
|
},
|
|
197
|
+
/**
|
|
198
|
+
* Linter Config
|
|
199
|
+
*
|
|
200
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
|
|
201
|
+
*/
|
|
117
202
|
linterConfig: {
|
|
118
203
|
type: Object,
|
|
119
|
-
default: () =>
|
|
120
|
-
|
|
204
|
+
default: () => void 0
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* Forces any linters configured to run when the editor is idle to run right away.
|
|
208
|
+
*
|
|
209
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
|
|
210
|
+
*/
|
|
211
|
+
forceLinting: {
|
|
212
|
+
type: Boolean,
|
|
213
|
+
default: false
|
|
121
214
|
},
|
|
215
|
+
/**
|
|
216
|
+
* Show Linter Gutter
|
|
217
|
+
*
|
|
218
|
+
* An area to 🔴 the lines with errors will be displayed.
|
|
219
|
+
* This feature is not enabled if `linter` is not specified.
|
|
220
|
+
*
|
|
221
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
|
|
222
|
+
*/
|
|
122
223
|
gutter: {
|
|
123
224
|
type: Boolean,
|
|
124
225
|
defalt: false
|
|
125
226
|
},
|
|
227
|
+
/**
|
|
228
|
+
* Gutter Config
|
|
229
|
+
*
|
|
230
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
|
|
231
|
+
*/
|
|
126
232
|
gutterConfig: {
|
|
127
233
|
type: Object,
|
|
128
|
-
default: () =>
|
|
129
|
-
}
|
|
234
|
+
default: () => void 0
|
|
130
235
|
},
|
|
236
|
+
/**
|
|
237
|
+
* Using tag
|
|
238
|
+
*/
|
|
131
239
|
tag: {
|
|
132
240
|
type: String,
|
|
133
241
|
default: "div"
|
|
134
242
|
}
|
|
135
243
|
},
|
|
244
|
+
/** Emits */
|
|
136
245
|
emits: ["update:modelValue", "update", "ready", "focus", "change", "destroy"],
|
|
246
|
+
/**
|
|
247
|
+
* Setup
|
|
248
|
+
*
|
|
249
|
+
* @param props - Props
|
|
250
|
+
* @param context - Context
|
|
251
|
+
*/
|
|
252
|
+
// @ts-ignore
|
|
137
253
|
setup(props, context) {
|
|
138
254
|
const editor = ref();
|
|
139
255
|
const doc = ref(props.modelValue);
|
|
@@ -162,26 +278,45 @@ var CodeMirror = defineComponent({
|
|
|
162
278
|
() => view.value.state.doc.length
|
|
163
279
|
);
|
|
164
280
|
const extensions = computed(
|
|
165
|
-
() =>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
281
|
+
() => (
|
|
282
|
+
// TODO: Ignore previous prop was not changed.
|
|
283
|
+
compact([
|
|
284
|
+
// Toggle basic setup
|
|
285
|
+
props.basic ? basicSetup : void 0,
|
|
286
|
+
// Toggle minimal setup
|
|
287
|
+
props.minimal && !props.basic ? minimalSetup : void 0,
|
|
288
|
+
// ViewUpdate event listener
|
|
289
|
+
EditorView.updateListener.of(
|
|
290
|
+
(update) => context.emit("update", update)
|
|
291
|
+
),
|
|
292
|
+
// Toggle light/dark mode.
|
|
293
|
+
EditorView.theme(props.theme, { dark: props.dark }),
|
|
294
|
+
// Toggle line wrapping
|
|
295
|
+
props.wrap ? EditorView.lineWrapping : void 0,
|
|
296
|
+
// Indent with tab
|
|
297
|
+
props.tab ? keymap.of([indentWithTab]) : void 0,
|
|
298
|
+
// Indent tab size
|
|
299
|
+
props.tabSize ? EditorState.tabSize.of(props.tabSize) : void 0,
|
|
300
|
+
// locale settings
|
|
301
|
+
props.phrases ? EditorState.phrases.of(props.phrases) : void 0,
|
|
302
|
+
// Readonly option
|
|
303
|
+
EditorState.readOnly.of(props.readonly),
|
|
304
|
+
// Editable option
|
|
305
|
+
EditorView.editable.of(!props.disabled),
|
|
306
|
+
// Set Line break char
|
|
307
|
+
props.lineSeparator ? EditorState.lineSeparator.of(props.lineSeparator) : void 0,
|
|
308
|
+
// Lang
|
|
309
|
+
props.lang ? props.lang : void 0,
|
|
310
|
+
// Append Linter settings
|
|
311
|
+
props.linter ? linter(props.linter, props.linterConfig) : void 0,
|
|
312
|
+
// Show 🔴 to error line when linter enabled.
|
|
313
|
+
props.linter && props.gutter ? lintGutter(props.gutterConfig) : void 0,
|
|
314
|
+
// Placeholder
|
|
315
|
+
props.placeholder ? placeholder(props.placeholder) : void 0,
|
|
316
|
+
// Append Extensions (such as basic-setup)
|
|
317
|
+
...props.extensions
|
|
318
|
+
])
|
|
319
|
+
)
|
|
185
320
|
);
|
|
186
321
|
watch(
|
|
187
322
|
() => props.modelValue,
|
|
@@ -189,6 +324,9 @@ var CodeMirror = defineComponent({
|
|
|
189
324
|
if (view.value.composing) {
|
|
190
325
|
return;
|
|
191
326
|
}
|
|
327
|
+
if (props.linter && props.forceLinting) {
|
|
328
|
+
forceLinting(view.value);
|
|
329
|
+
}
|
|
192
330
|
view.value.dispatch({
|
|
193
331
|
changes: { from: 0, to: view.value.state.doc.length, insert: value },
|
|
194
332
|
selection: view.value.state.selection,
|
|
@@ -198,10 +336,12 @@ var CodeMirror = defineComponent({
|
|
|
198
336
|
{ immediate: true }
|
|
199
337
|
);
|
|
200
338
|
watch(
|
|
201
|
-
extensions,
|
|
202
|
-
(exts) =>
|
|
203
|
-
|
|
204
|
-
|
|
339
|
+
() => extensions.value,
|
|
340
|
+
(exts) => {
|
|
341
|
+
view.value.dispatch({
|
|
342
|
+
effects: StateEffect.reconfigure.of(exts)
|
|
343
|
+
});
|
|
344
|
+
}
|
|
205
345
|
);
|
|
206
346
|
watch(focus, (isFocus) => context.emit("focus", isFocus));
|
|
207
347
|
onMounted(async () => {
|
|
@@ -291,6 +431,7 @@ var CodeMirror = defineComponent({
|
|
|
291
431
|
length,
|
|
292
432
|
lint,
|
|
293
433
|
forceReconfigure,
|
|
434
|
+
// Bellow is CodeMirror5's function
|
|
294
435
|
getRange,
|
|
295
436
|
getLine,
|
|
296
437
|
lineCount,
|
|
@@ -312,23 +453,29 @@ var CodeMirror = defineComponent({
|
|
|
312
453
|
},
|
|
313
454
|
render() {
|
|
314
455
|
return h(
|
|
456
|
+
// @ts-ignore
|
|
315
457
|
this.$props.tag,
|
|
316
458
|
{
|
|
317
459
|
ref: "editor",
|
|
318
460
|
class: "vue-codemirror"
|
|
319
461
|
},
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
462
|
+
// @ts-ignore
|
|
463
|
+
this.$slots.default ? (
|
|
464
|
+
// Hide original content
|
|
465
|
+
h(
|
|
466
|
+
"aside",
|
|
467
|
+
{ style: "display: none;", "aria-hidden": "true" },
|
|
468
|
+
// @ts-ignore
|
|
469
|
+
slot(this.$slots.default)
|
|
470
|
+
)
|
|
324
471
|
) : void 0
|
|
325
472
|
);
|
|
326
473
|
}
|
|
327
474
|
});
|
|
328
475
|
|
|
329
476
|
const meta = {
|
|
330
|
-
version: "1.1.
|
|
331
|
-
date: "2023-
|
|
477
|
+
version: "1.1.12",
|
|
478
|
+
date: "2023-03-10T04:51:22.645Z"
|
|
332
479
|
};
|
|
333
480
|
|
|
334
481
|
const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
|