vue-codemirror6 1.3.13 → 1.3.16

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 CHANGED
@@ -203,7 +203,7 @@ export default defineComponent({
203
203
 
204
204
  ### Full Example
205
205
 
206
- When using as a Markdown editor on [https://github.com/logue/vite-vue3-ts-starter](vite-vue3-ts-starter).
206
+ When using as a Markdown editor on [vite-vue3-ts-starter](https://github.com/logue/vite-vue3-ts-starter).
207
207
 
208
208
  ```vue
209
209
  <script lang="ts" setup>
@@ -361,18 +361,7 @@ const config: UserConfig = {
361
361
  output: {
362
362
  manualChunks: {
363
363
  // ...
364
- codemirror: [
365
- // Split CodeMirror code.
366
- 'vue-codemirror6',
367
- 'codemirror',
368
- '@codemirror/autocomplete',
369
- '@codemirror/commands',
370
- '@codemirror/language',
371
- '@codemirror/lint',
372
- '@codemirror/search',
373
- '@codemirror/state',
374
- '@codemirror/view',
375
- ],
364
+ codemirror: ['vue-codemirror6'],
376
365
  'codemirror-lang': [
377
366
  // Add the following as needed.
378
367
  '@codemirror/lang-html',
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.12
8
+ * @version 1.3.16
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
@@ -13,12 +13,12 @@ import { indentWithTab as W } from "@codemirror/commands";
13
13
  import { indentUnit as G } from "@codemirror/language";
14
14
  import { linter as P, lintGutter as Z, forceLinting as b, diagnosticCount as k } from "@codemirror/lint";
15
15
  import { EditorState as s, Compartment as w, StateEffect as y, EditorSelection as C } from "@codemirror/state";
16
- import { EditorView as c, keymap as q, placeholder as H } from "@codemirror/view";
16
+ 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
- import { isVue2 as X, h as O, defineComponent as Y, ref as v, shallowRef as ee, computed as r, watch as V, onMounted as te, nextTick as ae, onUnmounted as ne } from "vue-demi";
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.12",
21
- date: "2025-03-31T11:10:32.144Z"
20
+ version: "1.3.16",
21
+ date: "2025-05-31T14:22:54.698Z"
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)
@@ -278,39 +278,41 @@ var oe = Y({
278
278
  * @param context - Context
279
279
  */
280
280
  setup(e, i) {
281
- const l = v(), u = v(e.modelValue), t = ee(new c()), d = r({
281
+ const l = v(), u = v(e.modelValue), t = ee(new r()), d = c({
282
282
  get: () => t.value.hasFocus,
283
283
  set: (a) => {
284
284
  a && t.value.focus();
285
285
  }
286
- }), f = r({
286
+ }), f = c({
287
287
  get: () => t.value.state.selection,
288
288
  set: (a) => t.value.dispatch({ selection: a })
289
- }), m = r({
289
+ }), m = c({
290
290
  get: () => t.value.state.selection.main.head,
291
291
  set: (a) => t.value.dispatch({ selection: { anchor: a } })
292
- }), M = r(
292
+ }), M = c(
293
293
  {
294
294
  get: () => t.value.state.toJSON(),
295
295
  set: (a) => t.value.setState(s.fromJSON(a))
296
296
  }
297
- ), S = v(0), h = v(0), g = r(() => {
297
+ ), S = v(0), h = v(0), g = c(() => {
298
298
  const a = new w(), n = new w();
299
299
  if (e.basic && e.minimal)
300
- throw "[Vue CodeMirror] Both basic and minimal cannot be specified.";
300
+ throw new Error(
301
+ "[Vue CodeMirror] Both basic and minimal cannot be specified."
302
+ );
301
303
  return [
302
304
  // Toggle basic setup
303
305
  e.basic && !e.minimal ? K : void 0,
304
306
  // Toggle minimal setup
305
307
  e.minimal && !e.basic ? Q : void 0,
306
308
  // ViewUpdate event listener
307
- c.updateListener.of((o) => {
309
+ r.updateListener.of((o) => {
308
310
  i.emit("focus", t.value.hasFocus), S.value = t.value.state.doc?.length, !(o.changes.empty || !o.docChanged) && (e.linter && (e.forceLinting && b(t.value), h.value = e.linter(t.value).length), i.emit("update", o));
309
311
  }),
310
312
  // Toggle light/dark mode.
311
- c.theme(e.theme, { dark: e.dark }),
313
+ r.theme(e.theme, { dark: e.dark }),
312
314
  // Toggle line wrapping
313
- e.wrap ? c.lineWrapping : void 0,
315
+ e.wrap ? r.lineWrapping : void 0,
314
316
  // Indent with tab
315
317
  e.tab ? q.of([W]) : void 0,
316
318
  // Tab character
@@ -324,7 +326,7 @@ var oe = Y({
324
326
  // Readonly option
325
327
  s.readOnly.of(e.readonly),
326
328
  // Editable option
327
- c.editable.of(!e.disabled),
329
+ r.editable.of(!e.disabled),
328
330
  // Set Line break char
329
331
  e.lineSeparator ? s.lineSeparator.of(e.lineSeparator) : void 0,
330
332
  // Lang
@@ -341,11 +343,7 @@ var oe = Y({
341
343
  });
342
344
  V(
343
345
  g,
344
- (a) => {
345
- t.value?.dispatch({
346
- effects: y.reconfigure.of(a)
347
- });
348
- },
346
+ (a) => t.value?.dispatch({ effects: y.reconfigure.of(a) }),
349
347
  { immediate: !0 }
350
348
  ), V(
351
349
  () => e.modelValue,
@@ -368,11 +366,11 @@ var oe = Y({
368
366
  let a = u.value;
369
367
  l.value && (l.value.childNodes[0] && (u.value !== "" && console.warn(
370
368
  "[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."
371
- ), a = l.value.childNodes[0].innerText.trim()), t.value = new c({
369
+ ), a = l.value.childNodes[0].innerText.trim()), t.value = new r({
372
370
  parent: l.value,
373
371
  state: s.create({ doc: a, extensions: g.value }),
374
372
  dispatch: (n) => {
375
- t.value.update([n]), !(n.changes.empty || !n.docChanged) && (i.emit("update:modelValue", n.state.doc.toString() ?? ""), i.emit("change", n.state));
373
+ t.value.update([n]), !(n.changes.empty || !n.docChanged) && (i.emit("update:modelValue", n.state.doc.toString()), i.emit("change", n.state));
376
374
  }
377
375
  }), await ae(), i.emit("ready", {
378
376
  view: t.value,
@@ -399,16 +397,16 @@ var oe = Y({
399
397
  t.value.state.selection.main.from,
400
398
  t.value.state.selection.main.to
401
399
  )) !== null && a !== void 0 ? a : "";
402
- }, R = () => {
400
+ }, E = () => {
403
401
  const a = t.value.state;
404
402
  return a ? a.selection.ranges.map(
405
403
  (n) => a.sliceDoc(n.from, n.to)
406
404
  ) : [];
407
- }, T = () => t.value.state.selection.ranges.some(
405
+ }, R = () => t.value.state.selection.ranges.some(
408
406
  (a) => !a.empty
409
- ), D = (a, n, o) => t.value.dispatch({
407
+ ), T = (a, n, o) => t.value.dispatch({
410
408
  changes: { from: n, to: o, insert: a }
411
- }), E = (a) => t.value.dispatch(t.value.state.replaceSelection(a)), F = (a) => t.value.dispatch({ selection: { anchor: a } }), I = (a, n) => t.value.dispatch({ selection: { anchor: a, head: n } }), J = (a, n) => t.value.dispatch({
409
+ }), D = (a) => t.value.dispatch(t.value.state.replaceSelection(a)), F = (a) => t.value.dispatch({ selection: { anchor: a } }), I = (a, n) => t.value.dispatch({ selection: { anchor: a, head: n } }), J = (a, n) => t.value.dispatch({
412
410
  selection: C.create(a, n)
413
411
  }), A = (a) => t.value.dispatch({
414
412
  selection: C.create(
@@ -433,10 +431,10 @@ var oe = Y({
433
431
  getCursor: N,
434
432
  listSelections: U,
435
433
  getSelection: z,
436
- getSelections: R,
437
- somethingSelected: T,
438
- replaceRange: D,
439
- replaceSelection: E,
434
+ getSelections: E,
435
+ somethingSelected: R,
436
+ replaceRange: T,
437
+ replaceSelection: D,
440
438
  setCursor: F,
441
439
  setSelection: I,
442
440
  setSelections: J,
@@ -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.12
8
+ * @version 1.3.16
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
12
- var CodeMirror=function(u,V,E,f,i,r,y,l){"use strict";const O={version:"1.3.12",date:"2025-03-31T11:10:32.144Z"},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:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:()=>{}},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 r.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"[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,r.EditorView.updateListener.of(d=>{c.emit("focus",t.value.hasFocus),C.value=t.value.state.doc?.length,!(d.changes.empty||!d.docChanged)&&(e.linter&&(e.forceLinting&&f.forceLinting(t.value),m.value=e.linter(t.value).length),c.emit("update",d))}),r.EditorView.theme(e.theme,{dark:e.dark}),e.wrap?r.EditorView.lineWrapping:void 0,e.tab?r.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),r.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?r.placeholder(e.placeholder):void 0,...e.extensions].filter(d=>!!d)});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
- `)===a)return;const n=!t.value.state.selection.ranges.every(d=>d.anchor<a.length&&d.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 r.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,d)=>t.value.dispatch({changes:{from:n,to:d,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);
12
+ var CodeMirror=function(u,V,E,f,i,d,y,l){"use strict";const O={version:"1.3.16",date:"2025-05-31T14:22:54.698Z"},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:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:()=>{}},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
+ `)===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.12
8
+ * @version 1.3.16
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",date:"2025-03-31T11:10:32.144Z"},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:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:()=>{}},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"[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
- `)===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})});
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.16",date:"2025-05-31T14:22:54.698Z"},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:()=>{}},lang:{type:Object,default:()=>{}},linter:{type:Function,default:void 0},linterConfig:{type:Object,default:()=>({})},forceLinting:{type:Boolean,default:!1},gutter:{type:Boolean,default:!1},gutterConfig:{type:Object,default:()=>{}},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
+ `)===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.13",
4
+ "version": "1.3.16",
5
5
  "license": "MIT",
6
6
  "description": "CodeMirror6 Component for vue2 and vue3.",
7
7
  "keywords": [
@@ -56,7 +56,7 @@
56
56
  "engines": {
57
57
  "pnpm": ">=10.3.0"
58
58
  },
59
- "packageManager": "pnpm@10.7.0",
59
+ "packageManager": "pnpm@10.11.0",
60
60
  "sideEffects": false,
61
61
  "scripts": {
62
62
  "dev": "vite",
@@ -77,9 +77,10 @@
77
77
  "@codemirror/language": "^6.11.0",
78
78
  "@codemirror/lint": "^6.8.5",
79
79
  "@codemirror/state": "^6.5.2",
80
- "@codemirror/view": "^6.36.5",
80
+ "@codemirror/view": "^6.37.1",
81
81
  "codemirror": "^6.0.1",
82
82
  "style-mod": "^4.1.2",
83
+ "vue-codemirror6": "file:",
83
84
  "vue-demi": "latest"
84
85
  },
85
86
  "peerDependencies": {
@@ -87,48 +88,48 @@
87
88
  },
88
89
  "devDependencies": {
89
90
  "@codemirror/autocomplete": "^6.18.6",
90
- "@codemirror/lang-javascript": "^6.2.3",
91
+ "@codemirror/lang-javascript": "^6.2.4",
91
92
  "@codemirror/lang-json": "^6.0.1",
92
93
  "@codemirror/lang-markdown": "^6.3.2",
93
94
  "@codemirror/lang-vue": "^0.1.3",
94
- "@codemirror/search": "^6.5.10",
95
+ "@codemirror/search": "^6.5.11",
95
96
  "@tsconfig/node-lts": "^22.0.1",
96
- "@types/node": "^22.13.14",
97
- "@vitejs/plugin-vue": "^5.2.3",
98
- "@vue/compiler-sfc": "^3.5.13",
97
+ "@types/node": "^22.15.29",
98
+ "@vitejs/plugin-vue": "^5.2.4",
99
+ "@vue/compiler-sfc": "^3.5.16",
99
100
  "@vue/eslint-config-prettier": "^10.2.0",
100
101
  "@vue/eslint-config-typescript": "^14.5.0",
101
102
  "@vue/test-utils": "^2.4.6",
102
103
  "@vue/tsconfig": "^0.7.0",
103
- "@vueuse/core": "^13.0.0",
104
- "bootstrap": "^5.3.3",
105
- "eslint": "^9.23.0",
104
+ "@vueuse/core": "^13.3.0",
105
+ "bootstrap": "^5.3.6",
106
+ "eslint": "^9.28.0",
106
107
  "eslint-import-resolver-custom-alias": "^1.3.2",
107
- "eslint-import-resolver-typescript": "^4.3.1",
108
- "eslint-linter-browserify": "^9.23.0",
108
+ "eslint-import-resolver-typescript": "^4.4.2",
109
+ "eslint-linter-browserify": "^9.28.0",
109
110
  "eslint-plugin-import": "^2.31.0",
110
111
  "eslint-plugin-playwright": "^2.2.0",
111
- "eslint-plugin-vue": "^10.0.0",
112
+ "eslint-plugin-vue": "^10.1.0",
112
113
  "eslint-plugin-vuejs-accessibility": "^2.4.1",
113
114
  "husky": "^9.1.7",
114
115
  "jiti": "^2.4.2",
115
- "lint-staged": "^15.5.0",
116
- "npm-run-all2": "^7.0.2",
116
+ "lint-staged": "^16.1.0",
117
+ "npm-run-all2": "^8.0.4",
117
118
  "prettier": "^3.5.3",
118
119
  "rimraf": "^6.0.1",
119
- "rollup-plugin-visualizer": "^5.14.0",
120
- "sass": "^1.86.0",
120
+ "rollup-plugin-visualizer": "^6.0.1",
121
+ "sass": "^1.89.1",
121
122
  "supports-color": "^10.0.0",
122
- "typescript": "^5.8.2",
123
- "typescript-eslint": "^8.28.0",
124
- "vite": "^6.2.4",
125
- "vite-plugin-banner": "^0.8.0",
126
- "vite-plugin-checker": "^0.9.1",
127
- "vite-plugin-dts": "^4.5.3",
128
- "vue": "^3.5.13",
129
- "vue-eslint-parser": "^10.1.1",
123
+ "typescript": "^5.8.3",
124
+ "typescript-eslint": "^8.33.0",
125
+ "vite": "^6.3.5",
126
+ "vite-plugin-banner": "^0.8.1",
127
+ "vite-plugin-checker": "^0.9.3",
128
+ "vite-plugin-dts": "^4.5.4",
129
+ "vue": "^3.5.16",
130
+ "vue-eslint-parser": "^10.1.3",
130
131
  "vue-markdown-wasm": "^0.5.1",
131
- "vue-tsc": "^2.2.8"
132
+ "vue-tsc": "^2.2.10"
132
133
  },
133
134
  "husky": {
134
135
  "hooks": {
@@ -143,4 +144,4 @@
143
144
  "json5": ">=2.2.3",
144
145
  "yaml": ">=2.6.0"
145
146
  }
146
- }
147
+ }
@@ -1,6 +1,3 @@
1
- // Helpers
2
-
3
- // CodeMirror
4
1
  import { indentWithTab } from '@codemirror/commands';
5
2
  import { indentUnit, type LanguageSupport } from '@codemirror/language';
6
3
  import {
@@ -372,7 +369,9 @@ export default defineComponent({
372
369
  const language = new Compartment();
373
370
  const tabSize = new Compartment();
374
371
  if (props.basic && props.minimal) {
375
- throw '[Vue CodeMirror] Both basic and minimal cannot be specified.';
372
+ throw new Error(
373
+ '[Vue CodeMirror] Both basic and minimal cannot be specified.'
374
+ );
376
375
  }
377
376
  // TODO: Ignore previous prop was not changed.
378
377
  return [
@@ -441,17 +440,14 @@ export default defineComponent({
441
440
  props.placeholder ? placeholder(props.placeholder) : undefined,
442
441
  // Append Extensions
443
442
  ...props.extensions,
444
- ].filter((extension): extension is Extension => !!extension);
443
+ ].filter((extension): extension is Extension => !!extension); // Filter undefined
445
444
  });
446
445
 
447
446
  // Extension (mostly props) Changed
448
447
  watch(
449
448
  extensions,
450
- exts => {
451
- view.value?.dispatch({
452
- effects: StateEffect.reconfigure.of(exts),
453
- });
454
- },
449
+ exts =>
450
+ view.value?.dispatch({ effects: StateEffect.reconfigure.of(exts) }),
455
451
  { immediate: true }
456
452
  );
457
453
 
@@ -516,7 +512,7 @@ export default defineComponent({
516
512
 
517
513
  // console.log(view.state.doc.toString(), tr);
518
514
  // state.toString() is not defined, so use toJSON and toText function to convert string.
519
- context.emit('update:modelValue', tr.state.doc.toString() ?? '');
515
+ context.emit('update:modelValue', tr.state.doc.toString());
520
516
  // Emit EditorState
521
517
  context.emit('change', tr.state);
522
518
  },