vue-codemirror6 1.3.16 → 1.3.17
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 +10 -3
- package/dist/components/CodeMirror.d.ts +6 -6
- package/dist/index.es.js +6 -9
- package/dist/index.iife.js +2 -2
- package/dist/index.umd.js +2 -2
- package/package.json +3 -4
- package/src/components/CodeMirror.ts +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,14 @@ 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.3.
|
|
7
|
+
#### [1.3.17](https://github.com/logue/vue-codemirror6/compare/1.3.13...1.3.17)
|
|
8
|
+
|
|
9
|
+
- fix: full example link [`#58`](https://github.com/logue/vue-codemirror6/pull/58)
|
|
10
|
+
- Update dependencies. [`985f36f`](https://github.com/logue/vue-codemirror6/commit/985f36f23c4fc1b562b53b664deb7ff1eec79989)
|
|
11
|
+
- Removed unnecessary comment. [`8d624a4`](https://github.com/logue/vue-codemirror6/commit/8d624a46cebc0f9196e5987f793e90184332ae4b)
|
|
12
|
+
- Fixed typo. [`b39f9cb`](https://github.com/logue/vue-codemirror6/commit/b39f9cb0993708338f0a96429b4cdc2fd510208e)
|
|
13
|
+
|
|
14
|
+
#### [1.3.13](https://github.com/logue/vue-codemirror6/compare/1.3.8...1.3.13)
|
|
8
15
|
|
|
9
16
|
> 31 March 2025
|
|
10
17
|
|
|
@@ -16,7 +23,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
16
23
|
|
|
17
24
|
> 22 November 2024
|
|
18
25
|
|
|
19
|
-
- Fix sample code syntax
|
|
26
|
+
- Fix sample code syntax error [`#47`](https://github.com/logue/vue-codemirror6/pull/47)
|
|
20
27
|
- chore: demo docs [`#43`](https://github.com/logue/vue-codemirror6/pull/43)
|
|
21
28
|
- fix: editor not update content when `modelValue` change and selection is out of range [`#44`](https://github.com/logue/vue-codemirror6/pull/44)
|
|
22
29
|
- chore: props and readme doc [`#31`](https://github.com/logue/vue-codemirror6/pull/31)
|
|
@@ -48,7 +55,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
48
55
|
|
|
49
56
|
- chore(CODEOWNERS): CODEOWNERS.com Bot, at your service! [`#14`](https://github.com/logue/vue-codemirror6/pull/14)
|
|
50
57
|
- Update demo code. (Replaced @codemirror/html to @codemirror/vue.) [`8da1a8a`](https://github.com/logue/vue-codemirror6/commit/8da1a8a4e37d713cc78281ce9c304c42a06940dc)
|
|
51
|
-
- Changed implementation to generate
|
|
58
|
+
- Changed implementation to generate *.d.ts with vite-plugin-dts. [`1caaa20`](https://github.com/logue/vue-codemirror6/commit/1caaa20b1423a3d252a6c770a630fb60e2e3440d)
|
|
52
59
|
- Update README.md. [`f8dd493`](https://github.com/logue/vue-codemirror6/commit/f8dd4934a7b9cc089cd830473db5250d28b3389b)
|
|
53
60
|
|
|
54
61
|
#### [1.1.11](https://github.com/logue/vue-codemirror6/compare/1.1.3...1.1.11)
|
|
@@ -143,7 +143,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
143
143
|
*/
|
|
144
144
|
phrases: {
|
|
145
145
|
type: PropType<Record<string, string>>;
|
|
146
|
-
default:
|
|
146
|
+
default: undefined;
|
|
147
147
|
};
|
|
148
148
|
/**
|
|
149
149
|
* CodeMirror Language
|
|
@@ -152,7 +152,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
152
152
|
*/
|
|
153
153
|
lang: {
|
|
154
154
|
type: PropType<LanguageSupport>;
|
|
155
|
-
default:
|
|
155
|
+
default: undefined;
|
|
156
156
|
};
|
|
157
157
|
/**
|
|
158
158
|
* CodeMirror Linter
|
|
@@ -200,7 +200,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
200
200
|
*/
|
|
201
201
|
gutterConfig: {
|
|
202
202
|
type: ObjectConstructor;
|
|
203
|
-
default:
|
|
203
|
+
default: undefined;
|
|
204
204
|
};
|
|
205
205
|
/**
|
|
206
206
|
* Using tag
|
|
@@ -398,7 +398,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
398
398
|
*/
|
|
399
399
|
phrases: {
|
|
400
400
|
type: PropType<Record<string, string>>;
|
|
401
|
-
default:
|
|
401
|
+
default: undefined;
|
|
402
402
|
};
|
|
403
403
|
/**
|
|
404
404
|
* CodeMirror Language
|
|
@@ -407,7 +407,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
407
407
|
*/
|
|
408
408
|
lang: {
|
|
409
409
|
type: PropType<LanguageSupport>;
|
|
410
|
-
default:
|
|
410
|
+
default: undefined;
|
|
411
411
|
};
|
|
412
412
|
/**
|
|
413
413
|
* CodeMirror Linter
|
|
@@ -455,7 +455,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
455
455
|
*/
|
|
456
456
|
gutterConfig: {
|
|
457
457
|
type: ObjectConstructor;
|
|
458
|
-
default:
|
|
458
|
+
default: undefined;
|
|
459
459
|
};
|
|
460
460
|
/**
|
|
461
461
|
* Using tag
|
package/dist/index.es.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2025 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.17
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -17,8 +17,8 @@ import { EditorView as r, keymap as q, placeholder as H } from "@codemirror/view
|
|
|
17
17
|
import { basicSetup as K, minimalSetup as Q } from "codemirror";
|
|
18
18
|
import { isVue2 as X, h as O, defineComponent as Y, ref as v, shallowRef as ee, computed as c, watch as V, onMounted as te, nextTick as ae, onUnmounted as ne } from "vue-demi";
|
|
19
19
|
const me = {
|
|
20
|
-
version: "1.3.
|
|
21
|
-
date: "2025-
|
|
20
|
+
version: "1.3.17",
|
|
21
|
+
date: "2025-06-02T14:16:10.878Z"
|
|
22
22
|
}, le = (e) => e ? Object.entries(e).reduce((i, [l, u]) => (l = l.charAt(0).toUpperCase() + l.slice(1), l = `on${l}`, { ...i, [l]: u }), {}) : {};
|
|
23
23
|
function B(e, i = {}, l) {
|
|
24
24
|
if (X)
|
|
@@ -178,8 +178,7 @@ var oe = Y({
|
|
|
178
178
|
*/
|
|
179
179
|
phrases: {
|
|
180
180
|
type: Object,
|
|
181
|
-
default:
|
|
182
|
-
}
|
|
181
|
+
default: void 0
|
|
183
182
|
},
|
|
184
183
|
/**
|
|
185
184
|
* CodeMirror Language
|
|
@@ -188,8 +187,7 @@ var oe = Y({
|
|
|
188
187
|
*/
|
|
189
188
|
lang: {
|
|
190
189
|
type: Object,
|
|
191
|
-
default:
|
|
192
|
-
}
|
|
190
|
+
default: void 0
|
|
193
191
|
},
|
|
194
192
|
/**
|
|
195
193
|
* CodeMirror Linter
|
|
@@ -237,8 +235,7 @@ var oe = Y({
|
|
|
237
235
|
*/
|
|
238
236
|
gutterConfig: {
|
|
239
237
|
type: Object,
|
|
240
|
-
default:
|
|
241
|
-
}
|
|
238
|
+
default: void 0
|
|
242
239
|
},
|
|
243
240
|
/**
|
|
244
241
|
* Using tag
|
package/dist/index.iife.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2025 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.17
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
var CodeMirror=function(u,V,E,f,i,d,y,l){"use strict";const O={version:"1.3.
|
|
12
|
+
var CodeMirror=function(u,V,E,f,i,d,y,l){"use strict";const O={version:"1.3.17",date:"2025-06-02T14:16:10.878Z"},M=e=>e?Object.entries(e).reduce((c,[o,s])=>(o=o.charAt(0).toUpperCase()+o.slice(1),o=`on${o}`,{...c,[o]:s}),{}):{};function b(e,c={},o){if(l.isVue2)return l.h(e,c,o);const{props:s,domProps:t,on:v,...g}=c,h=v?M(v):{};return l.h(e,{...g,...s,...t,...h},o)}const B=e=>typeof e=="function"?e():e;var w=l.defineComponent({name:"CodeMirror",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:""},theme:{type:Object,default:()=>({})},dark:{type:Boolean,default:!1},basic:{type:Boolean,default:!1},minimal:{type:Boolean,default:!1},placeholder:{type:String,default:void 0},wrap:{type:Boolean,default:!1},tab:{type:Boolean,default:!1},indentUnit:{type:String,default:void 0},allowMultipleSelections:{type:Boolean,default:!1},tabSize:{type:Number,default:void 0},lineSeparator:{type:String,default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},phrases:{type:Object,default:void 0},lang:{type:Object,default:void 0},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:void 0},tag:{type:String,default:"div"},scrollIntoView:{type:Boolean,default:!0}},emits:{"update:modelValue":(e="")=>!0,update:e=>!0,ready:e=>!0,focus:e=>!0,change:e=>!0,destroy:()=>!0},setup(e,c){const o=l.ref(),s=l.ref(e.modelValue),t=l.shallowRef(new d.EditorView),v=l.computed({get:()=>t.value.hasFocus,set:a=>{a&&t.value.focus()}}),g=l.computed({get:()=>t.value.state.selection,set:a=>t.value.dispatch({selection:a})}),h=l.computed({get:()=>t.value.state.selection.main.head,set:a=>t.value.dispatch({selection:{anchor:a}})}),j=l.computed({get:()=>t.value.state.toJSON(),set:a=>t.value.setState(i.EditorState.fromJSON(a))}),C=l.ref(0),m=l.ref(0),S=l.computed(()=>{const a=new i.Compartment,n=new i.Compartment;if(e.basic&&e.minimal)throw new Error("[Vue CodeMirror] Both basic and minimal cannot be specified.");return[e.basic&&!e.minimal?y.basicSetup:void 0,e.minimal&&!e.basic?y.minimalSetup:void 0,d.EditorView.updateListener.of(r=>{c.emit("focus",t.value.hasFocus),C.value=t.value.state.doc?.length,!(r.changes.empty||!r.docChanged)&&(e.linter&&(e.forceLinting&&f.forceLinting(t.value),m.value=e.linter(t.value).length),c.emit("update",r))}),d.EditorView.theme(e.theme,{dark:e.dark}),e.wrap?d.EditorView.lineWrapping:void 0,e.tab?d.keymap.of([V.indentWithTab]):void 0,e.indentUnit?E.indentUnit.of(e.indentUnit):void 0,i.EditorState.allowMultipleSelections.of(e.allowMultipleSelections),e.tabSize?n.of(i.EditorState.tabSize.of(e.tabSize)):void 0,e.phrases?i.EditorState.phrases.of(e.phrases):void 0,i.EditorState.readOnly.of(e.readonly),d.EditorView.editable.of(!e.disabled),e.lineSeparator?i.EditorState.lineSeparator.of(e.lineSeparator):void 0,e.lang?a.of(e.lang):void 0,e.linter?f.linter(e.linter,e.linterConfig):void 0,e.linter&&e.gutter?f.lintGutter(e.gutterConfig):void 0,e.placeholder?d.placeholder(e.placeholder):void 0,...e.extensions].filter(r=>!!r)});l.watch(S,a=>t.value?.dispatch({effects:i.StateEffect.reconfigure.of(a)}),{immediate:!0}),l.watch(()=>e.modelValue,async a=>{if(t.value.composing||t.value.state.doc.toJSON().join(e.lineSeparator??`
|
|
13
13
|
`)===a)return;const n=!t.value.state.selection.ranges.every(r=>r.anchor<a.length&&r.head<a.length);t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:n?{anchor:0,head:0}:t.value.state.selection,scrollIntoView:e.scrollIntoView})},{immediate:!0}),l.onMounted(async()=>{let a=s.value;o.value&&(o.value.childNodes[0]&&(s.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a=o.value.childNodes[0].innerText.trim()),t.value=new d.EditorView({parent:o.value,state:i.EditorState.create({doc:a,extensions:S.value}),dispatch:n=>{t.value.update([n]),!(n.changes.empty||!n.docChanged)&&(c.emit("update:modelValue",n.state.doc.toString()),c.emit("change",n.state))}}),await l.nextTick(),c.emit("ready",{view:t.value,state:t.value.state,container:o.value}))}),l.onUnmounted(()=>{t.value.destroy(),c.emit("destroy")});const _=()=>{!e.linter||!t.value||(e.forceLinting&&f.forceLinting(t.value),m.value=f.diagnosticCount(t.value.state))},L=()=>{t.value?.dispatch({effects:i.StateEffect.reconfigure.of([])}),t.value?.dispatch({effects:i.StateEffect.appendConfig.of(S.value)})},N=(a,n)=>t.value.state.sliceDoc(a,n),U=a=>t.value.state.doc.line(a+1).text,z=()=>t.value.state.doc.lines,R=()=>t.value.state.selection.main.head,T=()=>{let a;return(a=t.value.state.selection.ranges)!==null&&a!==void 0?a:[]},F=()=>{let a;return(a=t.value.state.sliceDoc(t.value.state.selection.main.from,t.value.state.selection.main.to))!==null&&a!==void 0?a:""},I=()=>{const a=t.value.state;return a?a.selection.ranges.map(n=>a.sliceDoc(n.from,n.to)):[]},J=()=>t.value.state.selection.ranges.some(a=>!a.empty),x=(a,n,r)=>t.value.dispatch({changes:{from:n,to:r,insert:a}}),A=a=>t.value.dispatch(t.value.state.replaceSelection(a)),P=a=>t.value.dispatch({selection:{anchor:a}}),W=(a,n)=>t.value.dispatch({selection:{anchor:a,head:n}}),G=(a,n)=>t.value.dispatch({selection:i.EditorSelection.create(a,n)}),Z=a=>t.value.dispatch({selection:i.EditorSelection.create(g.value.ranges.map(n=>n.extend(a(n))))}),p={editor:o,view:t,cursor:h,selection:g,focus:v,length:C,json:j,diagnosticCount:m,dom:t.value.contentDOM,lint:_,forceReconfigure:L,getRange:N,getLine:U,lineCount:z,getCursor:R,listSelections:T,getSelection:F,getSelections:I,somethingSelected:J,replaceRange:x,replaceSelection:A,setCursor:P,setSelection:W,setSelections:G,extendSelectionsBy:Z};return c.expose(p),p},render(){return b(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?b("aside",{style:"display: none;","aria-hidden":"true"},B(this.$slots.default)):void 0)}});const $=e=>e.component("CodeMirror",w);return u.Meta=O,u.default=w,u.install=$,Object.defineProperty(u,"__esModule",{value:!0}),u}({},commands,language,lint,state,view,codemirror,VueDemi);
|
package/dist/index.umd.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2025 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.17
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
(function(l,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("@codemirror/commands"),require("@codemirror/language"),require("@codemirror/lint"),require("@codemirror/state"),require("@codemirror/view"),require("codemirror"),require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","@codemirror/commands","@codemirror/language","@codemirror/lint","@codemirror/state","@codemirror/view","codemirror","vue-demi"],f):(l=typeof globalThis<"u"?globalThis:l||self,f(l.CodeMirror={},l.commands,l.language,l.lint,l.state,l.view,l.codemirror,l.VueDemi))})(this,function(l,f,E,v,r,s,p,o){"use strict";const O={version:"1.3.
|
|
12
|
+
(function(l,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("@codemirror/commands"),require("@codemirror/language"),require("@codemirror/lint"),require("@codemirror/state"),require("@codemirror/view"),require("codemirror"),require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","@codemirror/commands","@codemirror/language","@codemirror/lint","@codemirror/state","@codemirror/view","codemirror","vue-demi"],f):(l=typeof globalThis<"u"?globalThis:l||self,f(l.CodeMirror={},l.commands,l.language,l.lint,l.state,l.view,l.codemirror,l.VueDemi))})(this,function(l,f,E,v,r,s,p,o){"use strict";const O={version:"1.3.17",date:"2025-06-02T14:16:10.878Z"},M=e=>e?Object.entries(e).reduce((d,[i,u])=>(i=i.charAt(0).toUpperCase()+i.slice(1),i=`on${i}`,{...d,[i]:u}),{}):{};function w(e,d={},i){if(o.isVue2)return o.h(e,d,i);const{props:u,domProps:t,on:m,...h}=d,g=m?M(m):{};return o.h(e,{...h,...u,...t,...g},i)}const B=e=>typeof e=="function"?e():e;var C=o.defineComponent({name:"CodeMirror",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:""},theme:{type:Object,default:()=>({})},dark:{type:Boolean,default:!1},basic:{type:Boolean,default:!1},minimal:{type:Boolean,default:!1},placeholder:{type:String,default:void 0},wrap:{type:Boolean,default:!1},tab:{type:Boolean,default:!1},indentUnit:{type:String,default:void 0},allowMultipleSelections:{type:Boolean,default:!1},tabSize:{type:Number,default:void 0},lineSeparator:{type:String,default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},phrases:{type:Object,default:void 0},lang:{type:Object,default:void 0},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:void 0},tag:{type:String,default:"div"},scrollIntoView:{type:Boolean,default:!0}},emits:{"update:modelValue":(e="")=>!0,update:e=>!0,ready:e=>!0,focus:e=>!0,change:e=>!0,destroy:()=>!0},setup(e,d){const i=o.ref(),u=o.ref(e.modelValue),t=o.shallowRef(new s.EditorView),m=o.computed({get:()=>t.value.hasFocus,set:a=>{a&&t.value.focus()}}),h=o.computed({get:()=>t.value.state.selection,set:a=>t.value.dispatch({selection:a})}),g=o.computed({get:()=>t.value.state.selection.main.head,set:a=>t.value.dispatch({selection:{anchor:a}})}),j=o.computed({get:()=>t.value.state.toJSON(),set:a=>t.value.setState(r.EditorState.fromJSON(a))}),b=o.ref(0),S=o.ref(0),y=o.computed(()=>{const a=new r.Compartment,n=new r.Compartment;if(e.basic&&e.minimal)throw new Error("[Vue CodeMirror] Both basic and minimal cannot be specified.");return[e.basic&&!e.minimal?p.basicSetup:void 0,e.minimal&&!e.basic?p.minimalSetup:void 0,s.EditorView.updateListener.of(c=>{d.emit("focus",t.value.hasFocus),b.value=t.value.state.doc?.length,!(c.changes.empty||!c.docChanged)&&(e.linter&&(e.forceLinting&&v.forceLinting(t.value),S.value=e.linter(t.value).length),d.emit("update",c))}),s.EditorView.theme(e.theme,{dark:e.dark}),e.wrap?s.EditorView.lineWrapping:void 0,e.tab?s.keymap.of([f.indentWithTab]):void 0,e.indentUnit?E.indentUnit.of(e.indentUnit):void 0,r.EditorState.allowMultipleSelections.of(e.allowMultipleSelections),e.tabSize?n.of(r.EditorState.tabSize.of(e.tabSize)):void 0,e.phrases?r.EditorState.phrases.of(e.phrases):void 0,r.EditorState.readOnly.of(e.readonly),s.EditorView.editable.of(!e.disabled),e.lineSeparator?r.EditorState.lineSeparator.of(e.lineSeparator):void 0,e.lang?a.of(e.lang):void 0,e.linter?v.linter(e.linter,e.linterConfig):void 0,e.linter&&e.gutter?v.lintGutter(e.gutterConfig):void 0,e.placeholder?s.placeholder(e.placeholder):void 0,...e.extensions].filter(c=>!!c)});o.watch(y,a=>t.value?.dispatch({effects:r.StateEffect.reconfigure.of(a)}),{immediate:!0}),o.watch(()=>e.modelValue,async a=>{if(t.value.composing||t.value.state.doc.toJSON().join(e.lineSeparator??`
|
|
13
13
|
`)===a)return;const n=!t.value.state.selection.ranges.every(c=>c.anchor<a.length&&c.head<a.length);t.value.dispatch({changes:{from:0,to:t.value.state.doc.length,insert:a},selection:n?{anchor:0,head:0}:t.value.state.selection,scrollIntoView:e.scrollIntoView})},{immediate:!0}),o.onMounted(async()=>{let a=u.value;i.value&&(i.value.childNodes[0]&&(u.value!==""&&console.warn("[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."),a=i.value.childNodes[0].innerText.trim()),t.value=new s.EditorView({parent:i.value,state:r.EditorState.create({doc:a,extensions:y.value}),dispatch:n=>{t.value.update([n]),!(n.changes.empty||!n.docChanged)&&(d.emit("update:modelValue",n.state.doc.toString()),d.emit("change",n.state))}}),await o.nextTick(),d.emit("ready",{view:t.value,state:t.value.state,container:i.value}))}),o.onUnmounted(()=>{t.value.destroy(),d.emit("destroy")});const _=()=>{!e.linter||!t.value||(e.forceLinting&&v.forceLinting(t.value),S.value=v.diagnosticCount(t.value.state))},q=()=>{t.value?.dispatch({effects:r.StateEffect.reconfigure.of([])}),t.value?.dispatch({effects:r.StateEffect.appendConfig.of(y.value)})},L=(a,n)=>t.value.state.sliceDoc(a,n),T=a=>t.value.state.doc.line(a+1).text,x=()=>t.value.state.doc.lines,N=()=>t.value.state.selection.main.head,U=()=>{let a;return(a=t.value.state.selection.ranges)!==null&&a!==void 0?a:[]},z=()=>{let a;return(a=t.value.state.sliceDoc(t.value.state.selection.main.from,t.value.state.selection.main.to))!==null&&a!==void 0?a:""},R=()=>{const a=t.value.state;return a?a.selection.ranges.map(n=>a.sliceDoc(n.from,n.to)):[]},F=()=>t.value.state.selection.ranges.some(a=>!a.empty),I=(a,n,c)=>t.value.dispatch({changes:{from:n,to:c,insert:a}}),J=a=>t.value.dispatch(t.value.state.replaceSelection(a)),A=a=>t.value.dispatch({selection:{anchor:a}}),P=(a,n)=>t.value.dispatch({selection:{anchor:a,head:n}}),W=(a,n)=>t.value.dispatch({selection:r.EditorSelection.create(a,n)}),G=a=>t.value.dispatch({selection:r.EditorSelection.create(h.value.ranges.map(n=>n.extend(a(n))))}),V={editor:i,view:t,cursor:g,selection:h,focus:m,length:b,json:j,diagnosticCount:S,dom:t.value.contentDOM,lint:_,forceReconfigure:q,getRange:L,getLine:T,lineCount:x,getCursor:N,listSelections:U,getSelection:z,getSelections:R,somethingSelected:F,replaceRange:I,replaceSelection:J,setCursor:A,setSelection:P,setSelections:W,extendSelectionsBy:G};return d.expose(V),V},render(){return w(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?w("aside",{style:"display: none;","aria-hidden":"true"},B(this.$slots.default)):void 0)}});const $=e=>e.component("CodeMirror",C);l.Meta=O,l.default=C,l.install=$,Object.defineProperty(l,"__esModule",{value:!0})});
|
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.3.
|
|
4
|
+
"version": "1.3.17",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "CodeMirror6 Component for vue2 and vue3.",
|
|
7
7
|
"keywords": [
|
|
@@ -73,26 +73,25 @@
|
|
|
73
73
|
"version": "auto-changelog -p && git add CHANGELOG.md"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
+
"@codemirror/autocomplete": "^6.18.6",
|
|
76
77
|
"@codemirror/commands": "^6.8.1",
|
|
77
78
|
"@codemirror/language": "^6.11.0",
|
|
78
79
|
"@codemirror/lint": "^6.8.5",
|
|
80
|
+
"@codemirror/search": "^6.5.11",
|
|
79
81
|
"@codemirror/state": "^6.5.2",
|
|
80
82
|
"@codemirror/view": "^6.37.1",
|
|
81
83
|
"codemirror": "^6.0.1",
|
|
82
84
|
"style-mod": "^4.1.2",
|
|
83
|
-
"vue-codemirror6": "file:",
|
|
84
85
|
"vue-demi": "latest"
|
|
85
86
|
},
|
|
86
87
|
"peerDependencies": {
|
|
87
88
|
"vue": "^2.7.14 || ^3.4"
|
|
88
89
|
},
|
|
89
90
|
"devDependencies": {
|
|
90
|
-
"@codemirror/autocomplete": "^6.18.6",
|
|
91
91
|
"@codemirror/lang-javascript": "^6.2.4",
|
|
92
92
|
"@codemirror/lang-json": "^6.0.1",
|
|
93
93
|
"@codemirror/lang-markdown": "^6.3.2",
|
|
94
94
|
"@codemirror/lang-vue": "^0.1.3",
|
|
95
|
-
"@codemirror/search": "^6.5.11",
|
|
96
95
|
"@tsconfig/node-lts": "^22.0.1",
|
|
97
96
|
"@types/node": "^22.15.29",
|
|
98
97
|
"@vitejs/plugin-vue": "^5.2.4",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { indentWithTab } from '@codemirror/commands';
|
|
2
2
|
import { indentUnit, type LanguageSupport } from '@codemirror/language';
|
|
3
3
|
import {
|
|
4
|
-
diagnosticCount as
|
|
4
|
+
diagnosticCount as linterDiagnosticCount,
|
|
5
5
|
forceLinting,
|
|
6
6
|
linter,
|
|
7
7
|
lintGutter,
|
|
@@ -198,7 +198,7 @@ export default defineComponent({
|
|
|
198
198
|
*/
|
|
199
199
|
phrases: {
|
|
200
200
|
type: Object as PropType<Record<string, string>>,
|
|
201
|
-
default:
|
|
201
|
+
default: undefined,
|
|
202
202
|
},
|
|
203
203
|
/**
|
|
204
204
|
* CodeMirror Language
|
|
@@ -207,7 +207,7 @@ export default defineComponent({
|
|
|
207
207
|
*/
|
|
208
208
|
lang: {
|
|
209
209
|
type: Object as PropType<LanguageSupport>,
|
|
210
|
-
default:
|
|
210
|
+
default: undefined,
|
|
211
211
|
},
|
|
212
212
|
/**
|
|
213
213
|
* CodeMirror Linter
|
|
@@ -257,7 +257,7 @@ export default defineComponent({
|
|
|
257
257
|
*/
|
|
258
258
|
gutterConfig: {
|
|
259
259
|
type: Object,
|
|
260
|
-
default:
|
|
260
|
+
default: undefined,
|
|
261
261
|
},
|
|
262
262
|
/**
|
|
263
263
|
* Using tag
|
|
@@ -545,7 +545,7 @@ export default defineComponent({
|
|
|
545
545
|
if (props.forceLinting) {
|
|
546
546
|
forceLinting(view.value);
|
|
547
547
|
}
|
|
548
|
-
diagnosticCount.value =
|
|
548
|
+
diagnosticCount.value = linterDiagnosticCount(view.value.state);
|
|
549
549
|
};
|
|
550
550
|
|
|
551
551
|
/**
|