vue-codemirror6 1.3.12 → 1.3.15

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 CHANGED
@@ -4,11 +4,13 @@ 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.12](https://github.com/logue/vue-codemirror6/compare/1.3.8...1.3.12)
7
+ #### [1.3.13](https://github.com/logue/vue-codemirror6/compare/1.3.13...1.3.13)
8
8
 
9
+ > 31 March 2025
10
+
11
+ - Rewrite to eslint.config.ts [`841f686`](https://github.com/logue/vue-codemirror6/commit/841f686ebab5f542a5b7bc1569660ce58a21af65)
9
12
  - Fixed types path. [`2b86b2c`](https://github.com/logue/vue-codemirror6/commit/2b86b2c4da906f4591e13221e5c41e52b8792523)
10
13
  - Update @codemirror/language, @codemirror/lint, @codemirror/state, @codemirror/view. [`916fa98`](https://github.com/logue/vue-codemirror6/commit/916fa9899e7c3806199f53bddb210d3cba9e7517)
11
- - Update dependencies. [`7f7f942`](https://github.com/logue/vue-codemirror6/commit/7f7f942f3c6198e3d7ae5eea83e36ffa74489b8f)
12
14
 
13
15
  #### [1.3.8](https://github.com/logue/vue-codemirror6/compare/1.1.16...1.3.8)
14
16
 
package/README.md CHANGED
@@ -55,6 +55,7 @@ This component can handle bidirectional binding by `v-model` like a general Vue
55
55
  | gutter | boolean | Display 🔴 on the line where there was an error when `linter` was specified. It will not work if `linter` is not specified. |
56
56
  | gutterConfig | Object | see <https://codemirror.net/docs/ref/#lint.lintGutter^config> |
57
57
  | tag | string | HTML tags used in the component. (Default is `div` tag.) |
58
+ | scrollIntoView | boolean | Allows an external update to scroll the form. (Default is `true`) |
58
59
 
59
60
  ⚠ 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.
60
61
 
@@ -81,8 +82,8 @@ This component can handle bidirectional binding by `v-model` like a general Vue
81
82
 
82
83
  ### Unofficial
83
84
 
84
- - [@phoenix-plugin-registry/petetnt.brackets-codemirror-fortran](https://www.npmjs.com/package/@phoenix-plugin-registry/petetnt.brackets-codemirror-fortran)
85
- - [@phoenix-plugin-registry/petetnt.brackets-codemirror-go](https://www.npmjs.com/package/@phoenix-plugin-registry/petetnt.brackets-codemirror-go)
85
+ - [`@phoenix-plugin-registry/petetnt.brackets-codemirror-fortran`](https://www.npmjs.com/package/@phoenix-plugin-registry/petetnt.brackets-codemirror-fortran)
86
+ - [`@phoenix-plugin-registry/petetnt.brackets-codemirror-go`](https://www.npmjs.com/package/@phoenix-plugin-registry/petetnt.brackets-codemirror-go)
86
87
  - [`@acarl005/lang-sql`](https://www.npmjs.com/package/@acarl005/lang-sql)
87
88
  - [`@ark-us/codemirror-lang-taylor`](https://www.npmjs.com/package/@ark-us/codemirror-lang-taylor)
88
89
  - [`@formulavize/lang-fiz`](https://www.npmjs.com/package/@formulavize/lang-fiz)
@@ -209,6 +209,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
209
209
  type: StringConstructor;
210
210
  default: string;
211
211
  };
212
+ /**
213
+ * Allows an external update to scroll the form.
214
+ * @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
215
+ */
216
+ scrollIntoView: {
217
+ type: BooleanConstructor;
218
+ default: boolean;
219
+ };
212
220
  }>, {
213
221
  editor: Ref<HTMLElement | undefined, HTMLElement | undefined>;
214
222
  view: ShallowRef<EditorView>;
@@ -456,6 +464,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
456
464
  type: StringConstructor;
457
465
  default: string;
458
466
  };
467
+ /**
468
+ * Allows an external update to scroll the form.
469
+ * @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
470
+ */
471
+ scrollIntoView: {
472
+ type: BooleanConstructor;
473
+ default: boolean;
474
+ };
459
475
  }>> & Readonly<{
460
476
  onChange?: ((_value: EditorState) => any) | undefined;
461
477
  onFocus?: ((_value: boolean) => any) | undefined;
@@ -491,5 +507,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
491
507
  gutter: boolean;
492
508
  gutterConfig: Record<string, any>;
493
509
  tag: string;
510
+ scrollIntoView: boolean;
494
511
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
495
512
  export default _default;
package/dist/index.es.js CHANGED
@@ -5,32 +5,32 @@
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.11
8
+ * @version 1.3.15
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
12
- import { indentWithTab as G } from "@codemirror/commands";
13
- import { indentUnit as I } from "@codemirror/language";
12
+ import { indentWithTab as W } from "@codemirror/commands";
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
- import { EditorState as s, Compartment as C, StateEffect as y, EditorSelection as w } from "@codemirror/state";
15
+ import { EditorState as s, Compartment as w, StateEffect as y, EditorSelection as C } from "@codemirror/state";
16
16
  import { EditorView as c, 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 B, 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 r, watch as V, onMounted as te, nextTick as ae, onUnmounted as ne } from "vue-demi";
19
19
  const me = {
20
- version: "1.3.11",
21
- date: "2025-02-15T06:13:33.482Z"
22
- }, ie = (e) => e ? Object.entries(e).reduce((l, [i, u]) => (i = i.charAt(0).toUpperCase() + i.slice(1), i = `on${i}`, { ...l, [i]: u }), {}) : {};
23
- function M(e, l = {}, i) {
20
+ version: "1.3.15",
21
+ date: "2025-05-18T15:06:25.724Z"
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
+ function B(e, i = {}, l) {
24
24
  if (X)
25
- return O(e, l, i);
26
- const { props: u, domProps: t, on: d, ...f } = l, m = d ? ie(d) : {};
25
+ return O(e, i, l);
26
+ const { props: u, domProps: t, on: d, ...f } = i, m = d ? le(d) : {};
27
27
  return O(
28
28
  e,
29
29
  { ...f, ...u, ...t, ...m },
30
- i
30
+ l
31
31
  );
32
32
  }
33
- const le = (e) => typeof e == "function" ? e() : e;
33
+ const ie = (e) => typeof e == "function" ? e() : e;
34
34
  var oe = Y({
35
35
  /** Component Name */
36
36
  name: "CodeMirror",
@@ -246,6 +246,14 @@ var oe = Y({
246
246
  tag: {
247
247
  type: String,
248
248
  default: "div"
249
+ },
250
+ /**
251
+ * Allows an external update to scroll the form.
252
+ * @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
253
+ */
254
+ scrollIntoView: {
255
+ type: Boolean,
256
+ default: !0
249
257
  }
250
258
  },
251
259
  /** Emits */
@@ -269,8 +277,8 @@ var oe = Y({
269
277
  * @param props - Props
270
278
  * @param context - Context
271
279
  */
272
- setup(e, l) {
273
- const i = v(), u = v(e.modelValue), t = ee(new c()), d = r({
280
+ setup(e, i) {
281
+ const l = v(), u = v(e.modelValue), t = ee(new c()), d = r({
274
282
  get: () => t.value.hasFocus,
275
283
  set: (a) => {
276
284
  a && t.value.focus();
@@ -281,13 +289,13 @@ var oe = Y({
281
289
  }), m = r({
282
290
  get: () => t.value.state.selection.main.head,
283
291
  set: (a) => t.value.dispatch({ selection: { anchor: a } })
284
- }), V = r(
292
+ }), M = r(
285
293
  {
286
294
  get: () => t.value.state.toJSON(),
287
295
  set: (a) => t.value.setState(s.fromJSON(a))
288
296
  }
289
297
  ), S = v(0), h = v(0), g = r(() => {
290
- const a = new C(), n = new C();
298
+ const a = new w(), n = new w();
291
299
  if (e.basic && e.minimal)
292
300
  throw "[Vue CodeMirror] Both basic and minimal cannot be specified.";
293
301
  return [
@@ -297,16 +305,16 @@ var oe = Y({
297
305
  e.minimal && !e.basic ? Q : void 0,
298
306
  // ViewUpdate event listener
299
307
  c.updateListener.of((o) => {
300
- l.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), l.emit("update", o));
308
+ 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));
301
309
  }),
302
310
  // Toggle light/dark mode.
303
311
  c.theme(e.theme, { dark: e.dark }),
304
312
  // Toggle line wrapping
305
313
  e.wrap ? c.lineWrapping : void 0,
306
314
  // Indent with tab
307
- e.tab ? q.of([G]) : void 0,
315
+ e.tab ? q.of([W]) : void 0,
308
316
  // Tab character
309
- e.indentUnit ? I.of(e.indentUnit) : void 0,
317
+ e.indentUnit ? G.of(e.indentUnit) : void 0,
310
318
  // Allow Multiple Selections
311
319
  s.allowMultipleSelections.of(e.allowMultipleSelections),
312
320
  // Indent tab size
@@ -331,7 +339,7 @@ var oe = Y({
331
339
  ...e.extensions
332
340
  ].filter((o) => !!o);
333
341
  });
334
- B(
342
+ V(
335
343
  g,
336
344
  (a) => {
337
345
  t.value?.dispatch({
@@ -339,7 +347,7 @@ var oe = Y({
339
347
  });
340
348
  },
341
349
  { immediate: !0 }
342
- ), B(
350
+ ), V(
343
351
  () => e.modelValue,
344
352
  async (a) => {
345
353
  if (t.value.composing || // IME fix
@@ -352,27 +360,27 @@ var oe = Y({
352
360
  t.value.dispatch({
353
361
  changes: { from: 0, to: t.value.state.doc.length, insert: a },
354
362
  selection: n ? { anchor: 0, head: 0 } : t.value.state.selection,
355
- scrollIntoView: !0
363
+ scrollIntoView: e.scrollIntoView
356
364
  });
357
365
  },
358
366
  { immediate: !0 }
359
367
  ), te(async () => {
360
368
  let a = u.value;
361
- i.value && (i.value.childNodes[0] && (u.value !== "" && console.warn(
369
+ l.value && (l.value.childNodes[0] && (u.value !== "" && console.warn(
362
370
  "[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."
363
- ), a = i.value.childNodes[0].innerText.trim()), t.value = new c({
364
- parent: i.value,
371
+ ), a = l.value.childNodes[0].innerText.trim()), t.value = new c({
372
+ parent: l.value,
365
373
  state: s.create({ doc: a, extensions: g.value }),
366
374
  dispatch: (n) => {
367
- t.value.update([n]), !(n.changes.empty || !n.docChanged) && (l.emit("update:modelValue", n.state.doc.toString() ?? ""), l.emit("change", n.state));
375
+ t.value.update([n]), !(n.changes.empty || !n.docChanged) && (i.emit("update:modelValue", n.state.doc.toString() ?? ""), i.emit("change", n.state));
368
376
  }
369
- }), await ae(), l.emit("ready", {
377
+ }), await ae(), i.emit("ready", {
370
378
  view: t.value,
371
379
  state: t.value.state,
372
- container: i.value
380
+ container: l.value
373
381
  }));
374
382
  }), ne(() => {
375
- t.value.destroy(), l.emit("destroy");
383
+ t.value.destroy(), i.emit("destroy");
376
384
  });
377
385
  const $ = () => {
378
386
  !e.linter || !t.value || (e.forceLinting && b(t.value), h.value = k(t.value.state));
@@ -400,20 +408,20 @@ var oe = Y({
400
408
  (a) => !a.empty
401
409
  ), D = (a, n, o) => t.value.dispatch({
402
410
  changes: { from: n, to: o, insert: a }
403
- }), E = (a) => t.value.dispatch(t.value.state.replaceSelection(a)), F = (a) => t.value.dispatch({ selection: { anchor: a } }), J = (a, n) => t.value.dispatch({ selection: { anchor: a, head: n } }), A = (a, n) => t.value.dispatch({
404
- selection: w.create(a, n)
405
- }), W = (a) => t.value.dispatch({
406
- selection: w.create(
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({
412
+ selection: C.create(a, n)
413
+ }), A = (a) => t.value.dispatch({
414
+ selection: C.create(
407
415
  f.value.ranges.map((n) => n.extend(a(n)))
408
416
  )
409
417
  }), p = {
410
- editor: i,
418
+ editor: l,
411
419
  view: t,
412
420
  cursor: m,
413
421
  selection: f,
414
422
  focus: d,
415
423
  length: S,
416
- json: V,
424
+ json: M,
417
425
  diagnosticCount: h,
418
426
  dom: t.value.contentDOM,
419
427
  lint: $,
@@ -430,14 +438,14 @@ var oe = Y({
430
438
  replaceRange: D,
431
439
  replaceSelection: E,
432
440
  setCursor: F,
433
- setSelection: J,
434
- setSelections: A,
435
- extendSelectionsBy: W
441
+ setSelection: I,
442
+ setSelections: J,
443
+ extendSelectionsBy: A
436
444
  };
437
- return l.expose(p), p;
445
+ return i.expose(p), p;
438
446
  },
439
447
  render() {
440
- return M(
448
+ return B(
441
449
  this.$props.tag,
442
450
  {
443
451
  ref: "editor",
@@ -445,10 +453,10 @@ var oe = Y({
445
453
  },
446
454
  this.$slots.default ? (
447
455
  // Hide original content
448
- M(
456
+ B(
449
457
  "aside",
450
458
  { style: "display: none;", "aria-hidden": "true" },
451
- le(this.$slots.default)
459
+ ie(this.$slots.default)
452
460
  )
453
461
  ) : void 0
454
462
  );
@@ -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.11
8
+ * @version 1.3.15
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
12
- var CodeMirror=function(u,E,V,f,i,r,y,l){"use strict";const O={version:"1.3.11",date:"2025-02-15T06:13:33.482Z"},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 $=e=>typeof e=="function"?e():e;var C=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"}},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))}),w=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),w.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([E.indentWithTab]):void 0,e.indentUnit?V.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:!0})},{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:""},J=()=>{const a=t.value.state;return a?a.selection.ranges.map(n=>a.sliceDoc(n.from,n.to)):[]},x=()=>t.value.state.selection.ranges.some(a=>!a.empty),A=(a,n,d)=>t.value.dispatch({changes:{from:n,to:d,insert:a}}),P=a=>t.value.dispatch(t.value.state.replaceSelection(a)),W=a=>t.value.dispatch({selection:{anchor:a}}),G=(a,n)=>t.value.dispatch({selection:{anchor:a,head:n}}),I=(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:w,json:j,diagnosticCount:m,dom:t.value.contentDOM,lint:_,forceReconfigure:L,getRange:N,getLine:U,lineCount:z,getCursor:R,listSelections:T,getSelection:F,getSelections:J,somethingSelected:x,replaceRange:A,replaceSelection:P,setCursor:W,setSelection:G,setSelections:I,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"},$(this.$slots.default)):void 0)}});const B=e=>e.component("CodeMirror",C);return u.Meta=O,u.default=C,u.install=B,Object.defineProperty(u,"__esModule",{value:!0}),u}({},commands,language,lint,state,view,codemirror,VueDemi);
12
+ var CodeMirror=function(u,V,E,f,i,r,y,l){"use strict";const O={version:"1.3.15",date:"2025-05-18T15:06:25.724Z"},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);
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.11
8
+ * @version 1.3.15
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,V,v,r,s,p,i){"use strict";const O={version:"1.3.11",date:"2025-02-15T06:13:33.482Z"},M=e=>e?Object.entries(e).reduce((d,[o,u])=>(o=o.charAt(0).toUpperCase()+o.slice(1),o=`on${o}`,{...d,[o]:u}),{}):{};function w(e,d={},o){if(i.isVue2)return i.h(e,d,o);const{props:u,domProps:t,on:m,...h}=d,g=m?M(m):{};return i.h(e,{...h,...u,...t,...g},o)}const $=e=>typeof e=="function"?e():e;var C=i.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"}},emits:{"update:modelValue":(e="")=>!0,update:e=>!0,ready:e=>!0,focus:e=>!0,change:e=>!0,destroy:()=>!0},setup(e,d){const o=i.ref(),u=i.ref(e.modelValue),t=i.shallowRef(new s.EditorView),m=i.computed({get:()=>t.value.hasFocus,set:a=>{a&&t.value.focus()}}),h=i.computed({get:()=>t.value.state.selection,set:a=>t.value.dispatch({selection:a})}),g=i.computed({get:()=>t.value.state.selection.main.head,set:a=>t.value.dispatch({selection:{anchor:a}})}),j=i.computed({get:()=>t.value.state.toJSON(),set:a=>t.value.setState(r.EditorState.fromJSON(a))}),b=i.ref(0),S=i.ref(0),y=i.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?V.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)});i.watch(y,a=>{t.value?.dispatch({effects:r.StateEffect.reconfigure.of(a)})},{immediate:!0}),i.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:!0})},{immediate:!0}),i.onMounted(async()=>{let a=u.value;o.value&&(o.value.childNodes[0]&&(u.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 s.EditorView({parent:o.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 i.nextTick(),d.emit("ready",{view:t.value,state:t.value.state,container:o.value}))}),i.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),J=(a,n,c)=>t.value.dispatch({changes:{from:n,to:c,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:r.EditorSelection.create(a,n)}),I=a=>t.value.dispatch({selection:r.EditorSelection.create(h.value.ranges.map(n=>n.extend(a(n))))}),E={editor:o,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:J,replaceSelection:A,setCursor:P,setSelection:W,setSelections:G,extendSelectionsBy:I};return d.expose(E),E},render(){return w(this.$props.tag,{ref:"editor",class:"vue-codemirror"},this.$slots.default?w("aside",{style:"display: none;","aria-hidden":"true"},$(this.$slots.default)):void 0)}});const B=e=>e.component("CodeMirror",C);l.Meta=O,l.default=C,l.install=B,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.15",date:"2025-05-18T15:06:25.724Z"},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})});
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.12",
4
+ "version": "1.3.15",
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.5.2",
59
+ "packageManager": "pnpm@10.11.0",
60
60
  "sideEffects": false,
61
61
  "scripts": {
62
62
  "dev": "vite",
@@ -73,13 +73,14 @@
73
73
  "version": "auto-changelog -p && git add CHANGELOG.md"
74
74
  },
75
75
  "dependencies": {
76
- "@codemirror/commands": "^6.8.0",
77
- "@codemirror/language": "^6.10.8",
78
- "@codemirror/lint": "^6.8.4",
76
+ "@codemirror/commands": "^6.8.1",
77
+ "@codemirror/language": "^6.11.0",
78
+ "@codemirror/lint": "^6.8.5",
79
79
  "@codemirror/state": "^6.5.2",
80
- "@codemirror/view": "^6.36.3",
80
+ "@codemirror/view": "^6.36.8",
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.8",
97
- "@vitejs/plugin-vue": "^5.2.1",
98
- "@vue/compiler-sfc": "^3.5.13",
97
+ "@types/node": "^22.15.18",
98
+ "@vitejs/plugin-vue": "^5.2.4",
99
+ "@vue/compiler-sfc": "^3.5.14",
99
100
  "@vue/eslint-config-prettier": "^10.2.0",
100
- "@vue/eslint-config-typescript": "^14.4.0",
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": "^12.7.0",
104
- "bootstrap": "^5.3.3",
105
- "eslint": "^9.21.0",
104
+ "@vueuse/core": "^13.2.0",
105
+ "bootstrap": "^5.3.6",
106
+ "eslint": "^9.27.0",
106
107
  "eslint-import-resolver-custom-alias": "^1.3.2",
107
- "eslint-import-resolver-typescript": "^3.8.3",
108
- "eslint-linter-browserify": "^9.21.0",
108
+ "eslint-import-resolver-typescript": "^4.3.5",
109
+ "eslint-linter-browserify": "^9.27.0",
109
110
  "eslint-plugin-import": "^2.31.0",
110
111
  "eslint-plugin-playwright": "^2.2.0",
111
- "eslint-plugin-vue": "^9.32.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.4.3",
116
- "npm-run-all": "^4.1.5",
117
- "prettier": "^3.5.2",
116
+ "lint-staged": "^16.0.0",
117
+ "npm-run-all2": "^8.0.2",
118
+ "prettier": "^3.5.3",
118
119
  "rimraf": "^6.0.1",
119
120
  "rollup-plugin-visualizer": "^5.14.0",
120
- "sass": "^1.85.1",
121
+ "sass": "^1.89.0",
121
122
  "supports-color": "^10.0.0",
122
- "typescript": "^5.8.2",
123
- "typescript-eslint": "^8.25.0",
124
- "vite": "^6.2.0",
125
- "vite-plugin-banner": "^0.8.0",
126
- "vite-plugin-checker": "^0.9.0",
127
- "vite-plugin-dts": "^4.5.1",
128
- "vue": "^3.5.13",
129
- "vue-eslint-parser": "^9.4.3",
123
+ "typescript": "^5.8.3",
124
+ "typescript-eslint": "^8.32.1",
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.14",
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": {
@@ -269,6 +269,14 @@ export default defineComponent({
269
269
  type: String,
270
270
  default: 'div',
271
271
  },
272
+ /**
273
+ * Allows an external update to scroll the form.
274
+ * @see {@link https://codemirror.net/docs/ref/#state.TransactionSpec.scrollIntoView}
275
+ */
276
+ scrollIntoView: {
277
+ type: Boolean,
278
+ default: true,
279
+ },
272
280
  },
273
281
  /** Emits */
274
282
  emits: {
@@ -472,7 +480,7 @@ export default defineComponent({
472
480
  selection: isSelectionOutOfRange
473
481
  ? { anchor: 0, head: 0 }
474
482
  : view.value.state.selection,
475
- scrollIntoView: true,
483
+ scrollIntoView: props.scrollIntoView,
476
484
  });
477
485
  },
478
486
  { immediate: true }