vue-codemirror6 0.0.1
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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/vue-codemirror.es.js +9726 -0
- package/dist/vue-codemirror.umd.js +12 -0
- package/package.json +89 -0
- package/src/components/CodeMirror.vue +121 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Masashi Yoshikawa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# vue-codemirror6
|
|
2
|
+
|
|
3
|
+
A component for using [CodeMirror6](https://codemirror.net/6/) with Vue. Unlike [surmon-china's vue-codemirror](https://github.com/surmon-china/vue-codemirror), it is for CodeMirror6.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
When using as a Markdown editor on Vuetify.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<codemirror
|
|
12
|
+
v-model="value"
|
|
13
|
+
:lang="lang"
|
|
14
|
+
:phrases="phreses"
|
|
15
|
+
:extensions="extensions"
|
|
16
|
+
:dark="$vuetify.theme.dark"
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { Component, Vue } from 'vue-property-decorator';
|
|
22
|
+
|
|
23
|
+
// Load component
|
|
24
|
+
import CodeMirror from 'vue-codemirror6';
|
|
25
|
+
|
|
26
|
+
// CodeMirror extensions
|
|
27
|
+
import { basicSetup } from '@codemirror/basic-setup';
|
|
28
|
+
import { LanguageSupport } from '@codemirror/language';
|
|
29
|
+
import { markdown } from '@codemirror/lang-markdown';
|
|
30
|
+
|
|
31
|
+
@Component({ components: { CodeMirror } })
|
|
32
|
+
export default class Home extends Vue {
|
|
33
|
+
/** text */
|
|
34
|
+
value: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* CodeMirror Language
|
|
38
|
+
*
|
|
39
|
+
* @see {@link https://codemirror.net/6/docs/ref/#language|@codemirror/language}
|
|
40
|
+
*/
|
|
41
|
+
lang: LanguageSupport = markdown();
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Internationalization Config
|
|
45
|
+
*
|
|
46
|
+
* @see {@link https://codemirror.net/6/examples/translate/|Example: Internationalization}
|
|
47
|
+
*/
|
|
48
|
+
phrases: Record<string, string> = {
|
|
49
|
+
// @codemirror/view
|
|
50
|
+
'Control character': '制御文字',
|
|
51
|
+
// @codemirror/fold
|
|
52
|
+
'Folded lines': '折り畳まれた行',
|
|
53
|
+
'Unfolded lines': '折り畳める行',
|
|
54
|
+
to: '行き先',
|
|
55
|
+
'folded code': '折り畳まれたコード',
|
|
56
|
+
unfold: '折り畳む解除',
|
|
57
|
+
'Fold line': '行を折り畳む',
|
|
58
|
+
'Unfold line': '行の折り畳む解除',
|
|
59
|
+
// @codemirror/search
|
|
60
|
+
'Go to line': '行き先の行',
|
|
61
|
+
go: 'OK',
|
|
62
|
+
Find: '検索',
|
|
63
|
+
Replace: '置き換え',
|
|
64
|
+
next: '▼',
|
|
65
|
+
previous: '▲',
|
|
66
|
+
all: 'すべて',
|
|
67
|
+
'match case': '一致条件',
|
|
68
|
+
regexp: '正規表現',
|
|
69
|
+
replace: '置き換え',
|
|
70
|
+
'replace all': 'すべてを置き換え',
|
|
71
|
+
close: '閉じる',
|
|
72
|
+
'current match': '現在の一致',
|
|
73
|
+
'on line': 'した行',
|
|
74
|
+
// @codemirror/lint
|
|
75
|
+
Diagnostics: 'エラー',
|
|
76
|
+
'No diagnostics': 'エラーなし',
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* CodeMirror Extensions
|
|
81
|
+
*
|
|
82
|
+
* @see {@link:https://codemirror.net/6/docs/ref/#state.Extension|Extending Editor State}
|
|
83
|
+
*/
|
|
84
|
+
extensions: [
|
|
85
|
+
/** @see {@link:https://codemirror.net/6/docs/ref/#basic-setup|basic-setup} */
|
|
86
|
+
basicSetup
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## LICENSE
|
|
92
|
+
|
|
93
|
+
[MIT](LICENSE)
|