vue-codemirror6 0.0.3 → 0.0.4
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/README.md +17 -3
- package/dist/components/CodeMirror.vue.d.ts +37 -0
- package/dist/components/CodeMirror.vue.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/{types/entry.esm.d.ts → dist/index.esm.d.ts} +6 -6
- package/dist/index.esm.d.ts.map +1 -0
- package/dist/vue-codemirror6.es.js +25 -8699
- package/dist/vue-codemirror6.umd.js +1 -12
- package/package.json +21 -10
- package/src/components/CodeMirror.vue +13 -9
- package/types/entry.d.ts +0 -4
- package/types/entry.d.ts.map +0 -1
- package/types/entry.esm.d.ts.map +0 -1
|
@@ -5,22 +5,23 @@
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { EditorView, ViewUpdate } from '@codemirror/view';
|
|
10
|
-
import type { Diagnostic } from '@codemirror/lint';
|
|
8
|
+
import type { Extension, Transaction } from '@codemirror/state';
|
|
11
9
|
import type { LanguageSupport } from '@codemirror/language';
|
|
12
|
-
|
|
13
|
-
import
|
|
10
|
+
import type { ViewUpdate } from '@codemirror/view';
|
|
11
|
+
import type { Diagnostic } from '@codemirror/lint';
|
|
12
|
+
import { EditorState } from '@codemirror/state';
|
|
13
|
+
import { EditorView } from '@codemirror/view';
|
|
14
14
|
import type { StyleSpec } from 'style-mod';
|
|
15
|
+
import merge from 'lodash/merge';
|
|
15
16
|
|
|
16
|
-
@Component
|
|
17
|
+
@Component({ name: 'CodeMirror' })
|
|
17
18
|
/** CodeMirror Component */
|
|
18
19
|
export default class CodeMirror extends Vue {
|
|
19
20
|
/** Editor */
|
|
20
|
-
editor!: EditorView;
|
|
21
|
+
private editor!: EditorView;
|
|
21
22
|
|
|
22
23
|
/** Theme */
|
|
23
|
-
@Prop({ type: Object })
|
|
24
|
+
@Prop({ type: Object, default: () => {} })
|
|
24
25
|
readonly theme!: { [selector: string]: StyleSpec };
|
|
25
26
|
|
|
26
27
|
/** Dark Mode */
|
|
@@ -74,13 +75,16 @@ export default class CodeMirror extends Vue {
|
|
|
74
75
|
get extension(): Extension[] {
|
|
75
76
|
/** Default extension */
|
|
76
77
|
const ext = [
|
|
77
|
-
EditorState.phrases.of(this.phrases),
|
|
78
78
|
EditorView.updateListener.of((update: ViewUpdate) =>
|
|
79
79
|
this.$emit('update', update)
|
|
80
80
|
),
|
|
81
81
|
EditorView.theme(this.theme, { dark: this.dark }),
|
|
82
82
|
];
|
|
83
83
|
|
|
84
|
+
if (this.phrases) {
|
|
85
|
+
ext.push(EditorState.phrases.of(this.phrases));
|
|
86
|
+
}
|
|
87
|
+
|
|
84
88
|
if (this.lang) {
|
|
85
89
|
ext.push(this.lang);
|
|
86
90
|
}
|
package/types/entry.d.ts
DELETED
package/types/entry.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AACA,OAAkB,KAAK,YAAY,MAAM,aAAa,CAAC;;AASvD,wBAC0C"}
|
package/types/entry.esm.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.esm.d.ts","sourceRoot":"","sources":["../src/entry.esm.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAGzC,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAGpD,aAAK,oBAAoB,GAAG,OAAO,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;;AAKjE,wBASK"}
|