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/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,28 @@ 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.13](https://github.com/logue/vue-codemirror6/compare/1.1.12...1.1.13)
|
|
8
8
|
|
|
9
|
+
- Changed minimum Vue version requirement to 2.7.14. [`5b8b255`](https://github.com/logue/vue-codemirror6/commit/5b8b2558967f9fb6f6d9e83a0181afa50f182b98)
|
|
10
|
+
- Add allow-multiple-selections prop. [`ced91ed`](https://github.com/logue/vue-codemirror6/commit/ced91edab8fc25f8f1299341489f6bbbdace9ce8)
|
|
11
|
+
- Update README.md [`99bb208`](https://github.com/logue/vue-codemirror6/commit/99bb2080adb2c47a43b7a47bafddc958993caa13)
|
|
12
|
+
|
|
13
|
+
#### [1.1.12](https://github.com/logue/vue-codemirror6/compare/1.1.11...1.1.12)
|
|
14
|
+
|
|
15
|
+
> 10 March 2023
|
|
16
|
+
|
|
17
|
+
- chore(CODEOWNERS): CODEOWNERS.com Bot, at your service! [`#14`](https://github.com/logue/vue-codemirror6/pull/14)
|
|
18
|
+
- Update demo code. (Replaced @codemirror/html to @codemirror/vue.) [`8da1a8a`](https://github.com/logue/vue-codemirror6/commit/8da1a8a4e37d713cc78281ce9c304c42a06940dc)
|
|
19
|
+
- Changed implementation to generate \*.d.ts with vite-plugin-dts. [`1caaa20`](https://github.com/logue/vue-codemirror6/commit/1caaa20b1423a3d252a6c770a630fb60e2e3440d)
|
|
20
|
+
- Update README.md. [`f8dd493`](https://github.com/logue/vue-codemirror6/commit/f8dd4934a7b9cc089cd830473db5250d28b3389b)
|
|
21
|
+
|
|
22
|
+
#### [1.1.11](https://github.com/logue/vue-codemirror6/compare/1.1.3...1.1.11)
|
|
23
|
+
|
|
24
|
+
> 4 February 2023
|
|
25
|
+
|
|
26
|
+
- [SECURITY FIX] CWE-1333: Inefficient Regular Expression Complexity #13 [`fc63a9f`](https://github.com/logue/vue-codemirror6/commit/fc63a9f14b5307089e9551157b011072971b112f)
|
|
9
27
|
- 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)
|
|
28
|
+
- Add forceReconfigure() function. [`bbfa8ad`](https://github.com/logue/vue-codemirror6/commit/bbfa8adb5bd5cdb56a53bd69337a4e0313e52033)
|
|
12
29
|
|
|
13
30
|
#### [1.1.3](https://github.com/logue/vue-codemirror6/compare/1.1.2...1.1.3)
|
|
14
31
|
|
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# vue-codemirror6
|
|
2
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://user-images.githubusercontent.com/480173/224358008-6ffad05d-1d97-4c18-8554-7d41b03f88ab.png" alt="logo" width="300" height="300" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
3
7
|
[](https://www.jsdelivr.com/package/npm/vue-codemirror6)
|
|
4
8
|
[](https://www.npmjs.com/package/vue-codemirror6)
|
|
5
9
|
[](https://uiwjs.github.io/npm-unpkg/#/pkg/vue-codemirror6/file/README.md)
|
|
@@ -27,34 +31,39 @@ This component can handle bidirectional binding by `v-model` like a general Vue
|
|
|
27
31
|
|
|
28
32
|
## Props
|
|
29
33
|
|
|
30
|
-
| Props
|
|
31
|
-
|
|
|
32
|
-
| model-value
|
|
33
|
-
| basic
|
|
34
|
-
| minimal
|
|
35
|
-
| dark
|
|
36
|
-
| placeholder
|
|
37
|
-
| wrap
|
|
38
|
-
| tab
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
34
|
+
| Props | Type | Information |
|
|
35
|
+
| ------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
36
|
+
| model-value | string \| Text | Text value. (Not `value`) |
|
|
37
|
+
| basic | boolean | Use [basicSetup](https://codemirror.net/docs/ref/#codemirror.basicSetup). |
|
|
38
|
+
| minimal | boolean | Use [miniSetup](https://codemirror.net/docs/ref/#codemirror.minimalSetup). If a `basic` prop is also specified, that setting will take precedence. |
|
|
39
|
+
| dark | boolean | Toggle Darkmode. |
|
|
40
|
+
| placeholder | string | Add placeholder text (or HTML DOM) when blank |
|
|
41
|
+
| wrap | boolean | Line text wrapping. see [lineWrapping](https://codemirror.net/6/docs/ref/#view.EditorView.lineWrapping). |
|
|
42
|
+
| tab | boolean | Enables tab indentation. |
|
|
43
|
+
| allow-multiple-selections | boolean | Allow Multiple Selection. See [allowMultipleSelections](https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections) |
|
|
44
|
+
| tab-size | number | Configures the tab size to use in this state. |
|
|
45
|
+
| line-separator | string | Set line break (separetor) char. (Default is `\n`.) |
|
|
46
|
+
| theme | { [selector: string]: StyleSpec } | Specify the theme. For example, if you use [@codemirror/theme-one-dark](https://github.com/codemirror/theme-one-dark), import `oneDark` and put it in this prop. |
|
|
47
|
+
| readonly | boolean | Makes the cursor visible or you can drag the text but not edit the value. |
|
|
48
|
+
| disabled | boolean | This is the reversed value of the CodeMirror editable. Similar to `readonly`, but setting this value to true disables dragging. |
|
|
49
|
+
| lang | LanguageSupport | The language you want to have syntax highlighting. see <https://codemirror.net/6/#languages> |
|
|
50
|
+
| phrases | Record<string, string> | Specify here if you want to make the displayed character string multilingual. see <https://codemirror.net/6/examples/translate/> |
|
|
51
|
+
| extensions | Extension[] | Includes enhancements to extend CodeMirror. |
|
|
52
|
+
| linter | LintSource | Set Linter. Enter a linter (eg `esLint([arbitrary rule])` function for `@codemirror/lang-javascript`, `jsonParseLinter()`function for`@codemirror/json`). See the sources for various language libraries for more information. |
|
|
53
|
+
| linterConfig | Object | see <https://codemirror.net/docs/ref/#lint.linter^config> |
|
|
54
|
+
| gutter | boolean | Display 🔴 on the line where there was an error when `linter` was specified. It will not work if `linter` is not specified. |
|
|
55
|
+
| gutterConfig | Object | see <https://codemirror.net/docs/ref/#lint.lintGutter^config> |
|
|
56
|
+
| tag | string | HTML tags used in the component. (Default is `div` tag.) |
|
|
52
57
|
|
|
53
58
|
⚠ Notice: `lang` and `linter` can also be set together in `extensions`. These are separated for compatibility with previous versions of CodeMirror settings and for typing props.
|
|
54
59
|
|
|
55
60
|
### Supported Languages
|
|
56
61
|
|
|
62
|
+
#### Official
|
|
63
|
+
|
|
64
|
+
- [`@codemirror/lang-angular`](https://www.npmjs.com/package/@codemirror/lang-angular)
|
|
57
65
|
- [`@codemirror/lang-cpp`](https://www.npmjs.com/package/@codemirror/lang-cpp)
|
|
66
|
+
- [`@codemirror/lang-css`](https://www.npmjs.com/package/@codemirror/lang-css)
|
|
58
67
|
- [`@codemirror/lang-html`](https://www.npmjs.com/package/@codemirror/lang-html)
|
|
59
68
|
- [`@codemirror/lang-java`](https://www.npmjs.com/package/@codemirror/lang-java)
|
|
60
69
|
- [`@codemirror/lang-javascript`](https://www.npmjs.com/package/@codemirror/lang-javascript)
|
|
@@ -65,8 +74,61 @@ This component can handle bidirectional binding by `v-model` like a general Vue
|
|
|
65
74
|
- [`@codemirror/lang-python`](https://www.npmjs.com/package/@codemirror/lang-python)
|
|
66
75
|
- [`@codemirror/lang-rust`](https://www.npmjs.com/package/@codemirror/lang-rust)
|
|
67
76
|
- [`@codemirror/lang-sql`](https://www.npmjs.com/package/@codemirror/lang-sql)
|
|
77
|
+
- [`@codemirror/lang-vue`](https://www.npmjs.com/package/@codemirror/lang-vue)
|
|
78
|
+
- [`@codemirror/lang-west`](https://www.npmjs.com/package/@codemirror/lang-west)
|
|
68
79
|
- [`@codemirror/lang-xml`](https://www.npmjs.com/package/@codemirror/lang-xml)
|
|
69
80
|
|
|
81
|
+
### Unofficial
|
|
82
|
+
|
|
83
|
+
- [@phoenix-plugin-registry/petetnt.brackets-codemirror-fortran](https://www.npmjs.com/package/@phoenix-plugin-registry/petetnt.brackets-codemirror-fortran)
|
|
84
|
+
- [@phoenix-plugin-registry/petetnt.brackets-codemirror-go](https://www.npmjs.com/package/@phoenix-plugin-registry/petetnt.brackets-codemirror-go)
|
|
85
|
+
- [`@acarl005/lang-sql`](https://www.npmjs.com/package/@acarl005/lang-sql)
|
|
86
|
+
- [`@ark-us/codemirror-lang-taylor`](https://www.npmjs.com/package/@ark-us/codemirror-lang-taylor)
|
|
87
|
+
- [`@formulavize/lang-fiz`](https://www.npmjs.com/package/@formulavize/lang-fiz)
|
|
88
|
+
- [`@gravitywiz/codemirror-lang-gfcalc`](https://www.npmjs.com/package/@gravitywiz/codemirror-lang-gfcalc)
|
|
89
|
+
- [`@nextjournal/lang-clojure`](https://www.npmjs.com/package/@nextjournal/lang-clojure)
|
|
90
|
+
- [`@plutojl/lang-julia`](https://www.npmjs.com/package/@plutojl/lang-julia)
|
|
91
|
+
- [`@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)
|
|
92
|
+
- [`@replit/codemirror-lang-csharp`](https://www.npmjs.com/package/@replit/codemirror-lang-csharp)
|
|
93
|
+
- [`@replit/codemirror-lang-solidity`](https://www.npmjs.com/package/@replit/codemirror-lang-solidity)
|
|
94
|
+
- [`@replit/codemirror-lang-svelte`](https://www.npmjs.com/package/@replit/codemirror-lang-svelte)
|
|
95
|
+
- [`@zhijiu/lang-sql`](https://www.npmjs.com/package/@zhijiu/lang-sql)
|
|
96
|
+
- [`codemirror-lang-bool`](https://www.npmjs.com/package/codemirror-lang-bool)
|
|
97
|
+
- [`codemirror-lang-brainfuck`](https://www.npmjs.com/package/codemirror-lang-brainfuck)
|
|
98
|
+
- [`codemirror-lang-cherry`](https://www.npmjs.com/package/codemirror-lang-cherry)
|
|
99
|
+
- [`codemirror-lang-chordpro`](https://www.npmjs.com/package/codemirror-lang-chordpro)
|
|
100
|
+
- [`codemirror-lang-circom`](https://www.npmjs.com/package/codemirror-lang-circom)
|
|
101
|
+
- [`codemirror-lang-edn`](https://www.npmjs.com/package/codemirror-lang-edn)
|
|
102
|
+
- [`codemirror-lang-ejs`](https://www.npmjs.com/package/codemirror-lang-ejs)
|
|
103
|
+
- [`codemirror-lang-fsl`](https://www.npmjs.com/package/codemirror-lang-fsl)
|
|
104
|
+
- [`codemirror-lang-gml`](https://www.npmjs.com/package/codemirror-lang-gml)
|
|
105
|
+
- [`codemirror-lang-golfscript`](https://www.npmjs.com/package/codemirror-lang-golfscript)
|
|
106
|
+
- [`codemirror-lang-homescript`](https://www.npmjs.com/package/codemirror-lang-homescript)
|
|
107
|
+
- [`codemirror-lang-html-n8n`](https://www.npmjs.com/package/codemirror-lang-html-n8n)
|
|
108
|
+
- [`codemirror-lang-inform7`](https://www.npmjs.com/package/codemirror-lang-inform7)
|
|
109
|
+
- [`codemirror-lang-j`](https://www.npmjs.com/package/codemirror-lang-j)
|
|
110
|
+
- [`codemirror-lang-janet`](https://www.npmjs.com/package/codemirror-lang-janet)
|
|
111
|
+
- [`codemirror-lang-k`](https://www.npmjs.com/package/codemirror-lang-k)
|
|
112
|
+
- [`codemirror-lang-karol`](https://www.npmjs.com/package/codemirror-lang-karol)
|
|
113
|
+
- [`codemirror-lang-mermaid`](https://www.npmjs.com/package/codemirror-lang-mermaid)
|
|
114
|
+
- [`codemirror-lang-n8n-expression`](https://www.npmjs.com/package/codemirror-lang-n8n-expression)
|
|
115
|
+
- [`codemirror-lang-prolog`](https://www.npmjs.com/package/codemirror-lang-prolog)
|
|
116
|
+
- [`codemirror-lang-qpen`](https://www.npmjs.com/package/codemirror-lang-qpen)
|
|
117
|
+
- [`codemirror-lang-qtam`](https://www.npmjs.com/package/codemirror-lang-qtam)
|
|
118
|
+
- [`codemirror-lang-r`](https://www.npmjs.com/package/codemirror-lang-r)
|
|
119
|
+
- [`codemirror-lang-rome-ast`](https://www.npmjs.com/package/codemirror-lang-rome-ast)
|
|
120
|
+
- [`codemirror-lang-rome`](https://www.npmjs.com/package/codemirror-lang-rome)
|
|
121
|
+
- [`codemirror-lang-rush`](https://www.npmjs.com/package/codemirror-lang-rush)
|
|
122
|
+
- [`codemirror-lang-scopescript`](https://www.npmjs.com/package/codemirror-lang-scopescript)
|
|
123
|
+
- [`codemirror-lang-statement`](https://www.npmjs.com/package/codemirror-lang-statement)
|
|
124
|
+
- [`gcode-lang-codemirror`](https://www.npmjs.com/package/gcode-lang-codemirror)
|
|
125
|
+
- [`gmail-lang`](https://www.npmjs.com/package/gmail-lang)
|
|
126
|
+
- [`lang-bqn`](https://www.npmjs.com/package/lang-bqn)
|
|
127
|
+
- [`lang-clojure`](https://www.npmjs.com/package/lang-clojure)
|
|
128
|
+
- [`lang-d`](https://www.npmjs.com/package/lang-d)
|
|
129
|
+
- [`lang-feel`](https://www.npmjs.com/package/lang-feel)
|
|
130
|
+
- [`lang-firestore`](https://www.npmjs.com/package/lang-firestore)
|
|
131
|
+
|
|
70
132
|
### Supported Themes
|
|
71
133
|
|
|
72
134
|
- [`@codemirror/theme-one-dark`](https://github.com/codemirror/theme-one-dark)
|
|
@@ -312,6 +374,8 @@ const config: UserConfig = {
|
|
|
312
374
|
'@codemirror/search',
|
|
313
375
|
'@codemirror/state',
|
|
314
376
|
'@codemirror/view',
|
|
377
|
+
],
|
|
378
|
+
'codemirror-lang': [
|
|
315
379
|
// Add the following as needed.
|
|
316
380
|
'@codemirror/lang-html',
|
|
317
381
|
'@codemirror/lang-javascript',
|
|
@@ -328,6 +392,4 @@ const config: UserConfig = {
|
|
|
328
392
|
|
|
329
393
|
## LICENSE
|
|
330
394
|
|
|
331
|
-
[MIT](LICENSE)
|
|
332
|
-
|
|
333
|
-
© 2022 by Logue.
|
|
395
|
+
©2022-2023 by Logue. Licensed under the [MIT License](LICENSE).
|
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.13
|
|
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,7 +37,7 @@ 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({
|
|
@@ -117,6 +117,15 @@ var CodeMirror = defineComponent({
|
|
|
117
117
|
type: Boolean,
|
|
118
118
|
default: false
|
|
119
119
|
},
|
|
120
|
+
/**
|
|
121
|
+
* Allow Multiple Selection.
|
|
122
|
+
*
|
|
123
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
|
|
124
|
+
*/
|
|
125
|
+
allowMultipleSelections: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: false
|
|
128
|
+
},
|
|
120
129
|
/**
|
|
121
130
|
* Tab size
|
|
122
131
|
*
|
|
@@ -201,8 +210,16 @@ var CodeMirror = defineComponent({
|
|
|
201
210
|
*/
|
|
202
211
|
linterConfig: {
|
|
203
212
|
type: Object,
|
|
204
|
-
default: () =>
|
|
205
|
-
|
|
213
|
+
default: () => void 0
|
|
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
|
|
206
223
|
},
|
|
207
224
|
/**
|
|
208
225
|
* Show Linter Gutter
|
|
@@ -223,8 +240,7 @@ var CodeMirror = defineComponent({
|
|
|
223
240
|
*/
|
|
224
241
|
gutterConfig: {
|
|
225
242
|
type: Object,
|
|
226
|
-
default: () =>
|
|
227
|
-
}
|
|
243
|
+
default: () => void 0
|
|
228
244
|
},
|
|
229
245
|
/**
|
|
230
246
|
* Using tag
|
|
@@ -242,6 +258,7 @@ var CodeMirror = defineComponent({
|
|
|
242
258
|
* @param props - Props
|
|
243
259
|
* @param context - Context
|
|
244
260
|
*/
|
|
261
|
+
// @ts-ignore
|
|
245
262
|
setup(props, context) {
|
|
246
263
|
const editor = ref();
|
|
247
264
|
const doc = ref(props.modelValue);
|
|
@@ -287,6 +304,8 @@ var CodeMirror = defineComponent({
|
|
|
287
304
|
props.wrap ? EditorView.lineWrapping : void 0,
|
|
288
305
|
// Indent with tab
|
|
289
306
|
props.tab ? keymap.of([indentWithTab]) : void 0,
|
|
307
|
+
// Allow Multiple Selections
|
|
308
|
+
EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
290
309
|
// Indent tab size
|
|
291
310
|
props.tabSize ? EditorState.tabSize.of(props.tabSize) : void 0,
|
|
292
311
|
// locale settings
|
|
@@ -298,14 +317,14 @@ var CodeMirror = defineComponent({
|
|
|
298
317
|
// Set Line break char
|
|
299
318
|
props.lineSeparator ? EditorState.lineSeparator.of(props.lineSeparator) : void 0,
|
|
300
319
|
// Lang
|
|
301
|
-
props.lang ? props.lang : void 0,
|
|
320
|
+
props.lang ? props.lang.extension : void 0,
|
|
302
321
|
// Append Linter settings
|
|
303
322
|
props.linter ? linter(props.linter, props.linterConfig) : void 0,
|
|
304
323
|
// Show 🔴 to error line when linter enabled.
|
|
305
324
|
props.linter && props.gutter ? lintGutter(props.gutterConfig) : void 0,
|
|
306
325
|
// Placeholder
|
|
307
326
|
props.placeholder ? placeholder(props.placeholder) : void 0,
|
|
308
|
-
// Append Extensions
|
|
327
|
+
// Append Extensions
|
|
309
328
|
...props.extensions
|
|
310
329
|
])
|
|
311
330
|
)
|
|
@@ -316,6 +335,9 @@ var CodeMirror = defineComponent({
|
|
|
316
335
|
if (view.value.composing) {
|
|
317
336
|
return;
|
|
318
337
|
}
|
|
338
|
+
if (props.linter && props.forceLinting) {
|
|
339
|
+
forceLinting(view.value);
|
|
340
|
+
}
|
|
319
341
|
view.value.dispatch({
|
|
320
342
|
changes: { from: 0, to: view.value.state.doc.length, insert: value },
|
|
321
343
|
selection: view.value.state.selection,
|
|
@@ -325,13 +347,13 @@ var CodeMirror = defineComponent({
|
|
|
325
347
|
{ immediate: true }
|
|
326
348
|
);
|
|
327
349
|
watch(
|
|
328
|
-
extensions,
|
|
329
|
-
(exts) =>
|
|
330
|
-
// TODO: Reduce unchanched value
|
|
350
|
+
() => extensions.value,
|
|
351
|
+
(exts) => {
|
|
331
352
|
view.value.dispatch({
|
|
332
353
|
effects: StateEffect.reconfigure.of(exts)
|
|
333
|
-
})
|
|
334
|
-
|
|
354
|
+
});
|
|
355
|
+
},
|
|
356
|
+
{ deep: true }
|
|
335
357
|
);
|
|
336
358
|
watch(focus, (isFocus) => context.emit("focus", isFocus));
|
|
337
359
|
onMounted(async () => {
|
|
@@ -443,16 +465,19 @@ var CodeMirror = defineComponent({
|
|
|
443
465
|
},
|
|
444
466
|
render() {
|
|
445
467
|
return h(
|
|
468
|
+
// @ts-ignore
|
|
446
469
|
this.$props.tag,
|
|
447
470
|
{
|
|
448
471
|
ref: "editor",
|
|
449
472
|
class: "vue-codemirror"
|
|
450
473
|
},
|
|
474
|
+
// @ts-ignore
|
|
451
475
|
this.$slots.default ? (
|
|
452
476
|
// Hide original content
|
|
453
477
|
h(
|
|
454
478
|
"aside",
|
|
455
479
|
{ style: "display: none;", "aria-hidden": "true" },
|
|
480
|
+
// @ts-ignore
|
|
456
481
|
slot(this.$slots.default)
|
|
457
482
|
)
|
|
458
483
|
) : void 0
|
|
@@ -461,8 +486,8 @@ var CodeMirror = defineComponent({
|
|
|
461
486
|
});
|
|
462
487
|
|
|
463
488
|
const meta = {
|
|
464
|
-
version: "1.1.
|
|
465
|
-
date: "2023-
|
|
489
|
+
version: "1.1.13",
|
|
490
|
+
date: "2023-03-13T09:36:27.207Z"
|
|
466
491
|
};
|
|
467
492
|
|
|
468
493
|
const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
|
package/dist/index.iife.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
|
|
|
@@ -21,8 +21,8 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
21
21
|
return { ...ret, [key]: handler };
|
|
22
22
|
}, {});
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
if (vueDemi.isVue2
|
|
24
|
+
function h(type, options = {}, chidren) {
|
|
25
|
+
if (vueDemi.isVue2) {
|
|
26
26
|
return vueDemi.h(type, options, chidren);
|
|
27
27
|
}
|
|
28
28
|
const { props, domProps, on, ...extraOptions } = options;
|
|
@@ -32,7 +32,7 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
32
32
|
{ ...extraOptions, ...props, ...domProps, ...ons },
|
|
33
33
|
chidren
|
|
34
34
|
);
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
const slot = (defaultSlots) => typeof defaultSlots == "function" ? defaultSlots() : defaultSlots;
|
|
37
37
|
|
|
38
38
|
var CodeMirror = vueDemi.defineComponent({
|
|
@@ -112,6 +112,15 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
112
112
|
type: Boolean,
|
|
113
113
|
default: false
|
|
114
114
|
},
|
|
115
|
+
/**
|
|
116
|
+
* Allow Multiple Selection.
|
|
117
|
+
*
|
|
118
|
+
* @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
|
|
119
|
+
*/
|
|
120
|
+
allowMultipleSelections: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: false
|
|
123
|
+
},
|
|
115
124
|
/**
|
|
116
125
|
* Tab size
|
|
117
126
|
*
|
|
@@ -196,8 +205,16 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
196
205
|
*/
|
|
197
206
|
linterConfig: {
|
|
198
207
|
type: Object,
|
|
199
|
-
default: () =>
|
|
200
|
-
|
|
208
|
+
default: () => void 0
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Forces any linters configured to run when the editor is idle to run right away.
|
|
212
|
+
*
|
|
213
|
+
* @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
|
|
214
|
+
*/
|
|
215
|
+
forceLinting: {
|
|
216
|
+
type: Boolean,
|
|
217
|
+
default: false
|
|
201
218
|
},
|
|
202
219
|
/**
|
|
203
220
|
* Show Linter Gutter
|
|
@@ -218,8 +235,7 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
218
235
|
*/
|
|
219
236
|
gutterConfig: {
|
|
220
237
|
type: Object,
|
|
221
|
-
default: () =>
|
|
222
|
-
}
|
|
238
|
+
default: () => void 0
|
|
223
239
|
},
|
|
224
240
|
/**
|
|
225
241
|
* Using tag
|
|
@@ -237,6 +253,7 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
237
253
|
* @param props - Props
|
|
238
254
|
* @param context - Context
|
|
239
255
|
*/
|
|
256
|
+
// @ts-ignore
|
|
240
257
|
setup(props, context) {
|
|
241
258
|
const editor = vueDemi.ref();
|
|
242
259
|
const doc = vueDemi.ref(props.modelValue);
|
|
@@ -282,6 +299,8 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
282
299
|
props.wrap ? view.EditorView.lineWrapping : void 0,
|
|
283
300
|
// Indent with tab
|
|
284
301
|
props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
|
|
302
|
+
// Allow Multiple Selections
|
|
303
|
+
state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
285
304
|
// Indent tab size
|
|
286
305
|
props.tabSize ? state.EditorState.tabSize.of(props.tabSize) : void 0,
|
|
287
306
|
// locale settings
|
|
@@ -293,14 +312,14 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
293
312
|
// Set Line break char
|
|
294
313
|
props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
|
|
295
314
|
// Lang
|
|
296
|
-
props.lang ? props.lang : void 0,
|
|
315
|
+
props.lang ? props.lang.extension : void 0,
|
|
297
316
|
// Append Linter settings
|
|
298
317
|
props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
|
|
299
318
|
// Show 🔴 to error line when linter enabled.
|
|
300
319
|
props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
|
|
301
320
|
// Placeholder
|
|
302
321
|
props.placeholder ? view.placeholder(props.placeholder) : void 0,
|
|
303
|
-
// Append Extensions
|
|
322
|
+
// Append Extensions
|
|
304
323
|
...props.extensions
|
|
305
324
|
])
|
|
306
325
|
)
|
|
@@ -311,6 +330,9 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
311
330
|
if (view$1.value.composing) {
|
|
312
331
|
return;
|
|
313
332
|
}
|
|
333
|
+
if (props.linter && props.forceLinting) {
|
|
334
|
+
lint.forceLinting(view$1.value);
|
|
335
|
+
}
|
|
314
336
|
view$1.value.dispatch({
|
|
315
337
|
changes: { from: 0, to: view$1.value.state.doc.length, insert: value },
|
|
316
338
|
selection: view$1.value.state.selection,
|
|
@@ -320,13 +342,13 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
320
342
|
{ immediate: true }
|
|
321
343
|
);
|
|
322
344
|
vueDemi.watch(
|
|
323
|
-
extensions,
|
|
324
|
-
(exts) =>
|
|
325
|
-
// TODO: Reduce unchanched value
|
|
345
|
+
() => extensions.value,
|
|
346
|
+
(exts) => {
|
|
326
347
|
view$1.value.dispatch({
|
|
327
348
|
effects: state.StateEffect.reconfigure.of(exts)
|
|
328
|
-
})
|
|
329
|
-
|
|
349
|
+
});
|
|
350
|
+
},
|
|
351
|
+
{ deep: true }
|
|
330
352
|
);
|
|
331
353
|
vueDemi.watch(focus, (isFocus) => context.emit("focus", isFocus));
|
|
332
354
|
vueDemi.onMounted(async () => {
|
|
@@ -438,16 +460,19 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
438
460
|
},
|
|
439
461
|
render() {
|
|
440
462
|
return h(
|
|
463
|
+
// @ts-ignore
|
|
441
464
|
this.$props.tag,
|
|
442
465
|
{
|
|
443
466
|
ref: "editor",
|
|
444
467
|
class: "vue-codemirror"
|
|
445
468
|
},
|
|
469
|
+
// @ts-ignore
|
|
446
470
|
this.$slots.default ? (
|
|
447
471
|
// Hide original content
|
|
448
472
|
h(
|
|
449
473
|
"aside",
|
|
450
474
|
{ style: "display: none;", "aria-hidden": "true" },
|
|
475
|
+
// @ts-ignore
|
|
451
476
|
slot(this.$slots.default)
|
|
452
477
|
)
|
|
453
478
|
) : void 0
|
|
@@ -456,8 +481,8 @@ var CodeMirror = (function (exports, vueDemi, lodash, codemirror, state, view, c
|
|
|
456
481
|
});
|
|
457
482
|
|
|
458
483
|
const meta = {
|
|
459
|
-
version: "1.1.
|
|
460
|
-
date: "2023-
|
|
484
|
+
version: "1.1.13",
|
|
485
|
+
date: "2023-03-13T09:36:27.207Z"
|
|
461
486
|
};
|
|
462
487
|
|
|
463
488
|
const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
|