Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror-editor-vue3

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror-editor-vue3 - npm Package Compare versions

Comparing version 2.1.8 to 2.1.9-beta1

9

CHANGELOG.md

@@ -0,1 +1,10 @@

## [2.1.9-beta1](https://github.com/RennCheung/codemirror-editor-vue3/compare/v2.1.7...v2.1.9-beta1) (2023-02-09)
### Bug Fixes
* Data not updated when all code is selected for deletion([#30](https://github.com/RennCheung/codemirror-editor-vue3/issues/30)) ([95b43ea](https://github.com/RennCheung/codemirror-editor-vue3/commit/95b43ea5638da37603b739d4632045f94901cf6f))
## [2.1.8](https://github.com/RennCheung/codemirror-editor-vue3/compare/v2.1.7...v2.1.8) (2023-01-31)

@@ -2,0 +11,0 @@

10

dist/codemirror-editor-vue3.es.js

@@ -356,5 +356,5 @@ var __defProp = Object.defineProperty;

const componentEventMap = {
"update:value": (value) => value,
"update:value": () => true,
change: (value, cm) => ({ value, cm }),
input: (value) => value,
input: () => true,
ready: (cm) => cm

@@ -427,7 +427,7 @@ };

const currentVal = cm.getValue();
if (currentVal === content.value)
if (currentVal === content.value && currentVal !== "")
return;
content.value = currentVal;
content.value && emit("update:value", content.value || "");
content.value && emit("input", content.value || "");
emit("update:value", content.value || "");
emit("input", content.value || " ");
Promise.resolve().then(() => {

@@ -434,0 +434,0 @@ emit("change", content.value, cm);

@@ -5,3 +5,3 @@ var Me=Object.defineProperty,be=Object.defineProperties;var Ce=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var Se=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;var P=(s,t,w)=>t in s?Me(s,t,{enumerable:!0,configurable:!0,writable:!0,value:w}):s[t]=w,b=(s,t)=>{for(var w in t||(t={}))Se.call(t,w)&&P(s,w,t[w]);if(H)for(var w of H(t))Ee.call(t,w)&&P(s,w,t[w]);return s},z=(s,t)=>be(s,Ce(t));(function(s,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("codemirror/lib/codemirror.css"),require("codemirror"),require("codemirror/addon/merge/merge.css"),require("codemirror/addon/merge/merge.js"),require("diff-match-patch"),require("codemirror/addon/mode/simple.js")):typeof define=="function"&&define.amd?define(["exports","vue","codemirror/lib/codemirror.css","codemirror","codemirror/addon/merge/merge.css","codemirror/addon/merge/merge.js","diff-match-patch","codemirror/addon/mode/simple.js"],t):(s=typeof globalThis!="undefined"?globalThis:s||self,t(s["codemirror-editor-vue3"]={},s.Vue,null,s.codemirror,null,null,s.DiffMatchPatch))})(this,function(s,t,w,q,xe,ve,U){"use strict";function T(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var L=T(q),W=T(U);!window.CodeMirror&&(window.CodeMirror=L.default);const C=window.CodeMirror||L.default;var v=(e,o)=>{const a=e.__vccOpts||e;for(const[n,r]of o)a[n]=r;return a};const G=t.defineComponent({name:"DefaultMode",props:{name:{type:String,default:`cm-textarea-${+new Date}`},value:{type:String,default:""},content:{type:String,default:""},options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>null},placeholder:{type:String,default:""}},emits:{ready:e=>e,"update:cminstance":e=>e},setup(e,{emit:o}){const a=t.ref(),n=t.ref(null),r=()=>{n.value=t.markRaw(C.fromTextArea(a.value,e.options)),o("update:cminstance",n.value);const u=t.watch(()=>e.cminstance,l=>{var y;l&&((y=e.cminstance)==null||y.setValue(e.value||e.content)),o("ready",t.unref(n)),u==null||u()},{deep:!0})};return t.onMounted(()=>{r()}),{textarea:a,initialize:r}}}),J=["name","placeholder"];function Z(e,o,a,n,r,u){return t.openBlock(),t.createElementBlock("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,J)}var D=v(G,[["render",Z]]);window.diff_match_patch=W.default,window.DIFF_DELETE=-1,window.DIFF_INSERT=1,window.DIFF_EQUAL=0;const K=t.defineComponent({name:"MergeMode",props:{options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})}},emits:["update:cminstance","ready"],setup(e,{emit:o}){const a=t.ref(),n=t.ref(),r=()=>{a.value=t.markRaw(C.MergeView(n.value,e.options)),o("update:cminstance",a.value),o("ready",a)};return t.onMounted(()=>{r()}),{mergeView:n,initialize:r}}}),Q={ref:"mergeView"};function X(e,o,a,n,r,u){return t.openBlock(),t.createElementBlock("div",Q,null,512)}var Y=v(K,[["render",X]]);s.logErrorType=void 0,function(e){e.info="info",e.warning="warning",e.error="error"}(s.logErrorType||(s.logErrorType={}));function I(){const e=new Date,o=e.getHours()<10?`0${e.getHours()}`:e.getHours(),a=e.getMinutes()<10?`0${e.getMinutes()}`:e.getMinutes(),n=e.getSeconds()<10?`0${e.getSeconds()}`:e.getSeconds();return`${o}:${a}:${n}`}function ee(e){return`#link#${JSON.stringify(e)}#link#`}function A(e){const o=/#link#(.+)#link#/g,a=[];let n;for(n=o.exec(e);n;){const r=document.createElement("a"),u=JSON.parse(n[1]),l=Object.entries(u);for(const[y,f]of l)r.setAttribute(y,f);r.className="editor_custom_link",r.innerHTML="logDownload",a.push({start:n.index,end:n.index+n[0].length,node:r}),n=o.exec(e)}return a}function te(e="",o="info"){return`#log<${o}>log#${e}#log<${o}>log#`}function B(e){const o=[];function a(){const n=/#log<(\w*)>log#((.|\r\n|\n)*?)#log<(\w*)>log#/g;let r;for(r=n.exec(e);r;){const l=r[0].replace(/\r\n/g,`

`).split(`
`),h=document.createElement("span"),d=r[1];h.className=`c-editor--log__${d}`;let m=0;for(let i=0;i<l.length;i++){const p=l[i],_=f[i],$=h.cloneNode(!1);$.innerText=_,o.push({start:r.index+m,end:r.index+m+p.length,node:$}),m=m+p.length+1}r=n.exec(e)}}return a(),o}function ne(e,o){return`[${I()}] <${o}> ${e}`}function re(e,o,a){const r=new Array(Math.max(o||15,5)).join(a||"=");return`${r}${e}${r}`}const S=[{regex:/(\[.*?\])([ \t]*)(<error>[ \t])(.+)/,token:["tag","","error.strong","error.strong"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<info>)(.+)(.?)/,token:["tag","","bracket","bracket","hr"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<warning>)(.+)(.?)/,token:["tag","","comment","comment","hr"],sol:!0}];C.defineSimpleMode("fclog",{start:[...S,{regex:/.*/,token:"hr"}],error:[...S,{regex:/.*/,token:"error.strong"}],info:[...S,{regex:/.*/,token:"bracket"}],warning:[...S,{regex:/.*\[/,token:"comment"}]}),C.defineSimpleMode("log",{start:[{regex:/^[=]+[^=]*[=]+/,token:"strong"},{regex:/([^\w])([A-Z][\w]*)/,token:["","string"]},{regex:/(^[A-Z][\w]*)/,token:"string"}]});const oe=t.defineComponent({name:"CodemirrorFclog",props:{value:{type:String,default:""},name:{type:String,default:`cm-textarea-${+new Date}`},options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""}},emits:["update:cminstance","ready"],setup(e,{emit:o}){const a=t.ref(),n=t.ref(null),r=(l=e.cminstance)=>{l.getAllMarks().forEach(d=>d.clear());const f=l.getValue(),h=[].concat(A(f)).concat(B(f));for(let d=0;d<h.length;d++){const m=h[d];l.markText(l.posFromIndex(m.start),l.posFromIndex(m.end),{replacedWith:m.node})}},u=()=>{var l;n.value=t.markRaw(C.fromTextArea(a.value,e.options)),o("update:cminstance",t.unref(n)),(l=n.value)==null||l.on("change",r)};return t.watch(()=>e.cminstance,l=>{var y;l&&(r(e.cminstance),(y=e.cminstance)==null||y.setValue(e.value),o("ready",n))},{deep:!0,immediate:!0}),t.onMounted(()=>{u()}),{initialize:u,textarea:a}}}),ae=["name","placeholder"];function se(e,o,a,n,r,u){return t.openBlock(),t.createElementBlock("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,ae)}var ce=v(oe,[["render",se]]);const N={"update:value":e=>e,change:(e,o)=>({value:e,cm:o}),input:e=>e,ready:e=>e},le=["changes","scroll","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"],ie=()=>{const e={};return le.forEach(o=>{e[o]=(...a)=>a}),e},de=b(b({},N),ie()),O={mode:"text",theme:"default",lineNumbers:!0,smartIndent:!0,indentUnit:2};function ue(e){Promise.resolve().then(()=>{const o=e.getScrollInfo();e.scrollTo(o.left,o.height)})}const fe=({props:e,cminstance:o,emit:a,internalInstance:n,content:r})=>{const u=t.computed(()=>{var f;return e.merge?(f=t.unref(o))==null?void 0:f.editor():t.unref(o)}),l=()=>{const f=[];return Object.keys(n==null?void 0:n.vnode.props).forEach(h=>{if(h.startsWith("on")){const d=h.replace(h[2],h[2].toLowerCase()).slice(2);!N[d]&&f.push(d)}}),f};return{listenerEvents:()=>{u.value.on("change",d=>{const m=d.getValue();m!==r.value&&(r.value=m,r.value&&a("update:value",r.value||""),r.value&&a("input",r.value||""),Promise.resolve().then(()=>{a("change",r.value,d)}),e.keepCursorInEnd&&ue(d))});const f={};l().filter(d=>!f[d]&&(f[d]=!0)).forEach(d=>{u.value.on(d,(...m)=>{a(d,...m)})})}}};function me({props:e,cminstance:o,presetRef:a}){const n=t.ref(null),r=t.ref(null),u=t.computed(()=>{var i;return e.merge?(i=t.unref(o))==null?void 0:i.editor():t.unref(o)}),l=()=>{t.nextTick(()=>{var i;(i=u.value)==null||i.refresh()})},y=(i=e.width,p=e.height)=>{var $;n.value=String(i).replace("px",""),r.value=String(p).replace("px","");const _=r.value;($=u.value)==null||$.setSize(n.value,_)},f=()=>{var p;const i=(p=u.value)==null?void 0:p.getWrapperElement();i==null||i.remove()},h=()=>{var p,_,$;const i=(p=u.value)==null?void 0:p.getDoc().getHistory();(_=a.value)==null||_.initialize(),f(),($=u.value)==null||$.getDoc().setHistory(i)},d=()=>{const i=document.querySelector(".CodeMirror-gutters");return(i==null?void 0:i.style.left.replace("px",""))!=="0"};return{reload:h,refresh:l,resize:y,destroy:f,containerHeight:r,reviseStyle:()=>{if(l(),!d())return;const i=setInterval(()=>{d()?l():clearInterval(i)},60),p=setTimeout(()=>{clearInterval(i),clearTimeout(p)},400)}}}const E=t.defineComponent({props:{value:{type:String,default:""},options:{type:Object,default:()=>O},globalOptions:{type:Object,default:()=>O},placeholder:{type:String,default:""},border:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},originalStyle:{type:Boolean,default:!1},keepCursorInEnd:{type:Boolean,default:!1},merge:{type:Boolean,default:!1},name:{type:String,default:""},marker:{type:Function,default:()=>null},unseenLines:{type:Array,default:()=>[]}},emits:de,setup(e,{expose:o,emit:a}){var F,R;const n=e;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value(c,g){if(c==null)throw new TypeError("Cannot convert undefined or null to object");const k=Object(c);for(let M=1;M<arguments.length;M++){const x=arguments[M];if(x!=null)for(const j in x)Object.prototype.hasOwnProperty.call(x,j)&&(k[j]=x[j])}return k},writable:!0,configurable:!0});const r=t.ref(null),u=t.ref(""),l=t.shallowRef(D),y=t.ref(b(b(b({},O),n.globalOptions),n.options)),f=t.getCurrentInstance(),h=n.name||((R=(F=f==null?void 0:f.parent)==null?void 0:F.type)==null?void 0:R.name)||void 0,d=t.ref(null),m=t.computed(()=>{var c;return n.merge?(c=t.unref(r))==null?void 0:c.editor():t.unref(r)}),{refresh:i,resize:p,destroy:_,containerHeight:$,reviseStyle:ye}=me({props:n,cminstance:r,presetRef:d}),{listenerEvents:ke}=fe({props:n,cminstance:r,emit:a,internalInstance:f,content:u}),V=()=>{n.unseenLines!==void 0&&n.marker!==void 0&&n.unseenLines.forEach(c=>{var k,M;const g=(k=r.value)==null?void 0:k.lineInfo(c);(M=r.value)==null||M.setGutterMarker(c,"breakpoints",(g==null?void 0:g.gutterMarkers)?null:n.marker())})},we=c=>{var k,M;const g=(k=r.value)==null?void 0:k.getValue();c!==g&&((M=r.value)==null||M.setValue(c),u.value=c,ye()),V()},$e=()=>{ke(),V(),p(n.width,n.height),a("ready",r.value),t.watch([()=>n.width,()=>n.height],([c,g])=>{p(c,g)},{deep:!0})},_e=()=>{if(n.options.mode==="fclog"||n.options.mode==="log"){l.value=ce;return}if(n.merge){l.value=Y;return}l.value=D};return t.watch(()=>n.options,c=>{var g;for(const k in n.options)(g=m.value)==null||g.setOption(k,t.unref(c[k]))},{deep:!0}),t.watch(()=>n.value,c=>{we(c)}),t.watch(()=>n.placeholder,c=>{var g;(g=m.value)==null||g.setOption("placeholder",c)}),t.watch(()=>n.merge,c=>{_e()},{immediate:!0}),t.onBeforeUnmount(()=>{_()}),o({cminstance:r,resize:p,refresh:i,destroy:_}),(c,g)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["codemirror-container",{merge:c.$props.merge,bordered:c.$props.border||c.$props.merge&&!n.originalStyle,"width-auto":!c.$props.width||c.$props.width=="100%","height-auto":!c.$props.height||c.$props.height=="100%","original-style":n.originalStyle}]),style:t.normalizeStyle({height:t.unref($)+"px"})},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(l)),t.mergeProps({ref_key:"presetRef",ref:d,cminstance:r.value,"onUpdate:cminstance":g[0]||(g[0]=k=>r.value=k),style:{height:"100%"}},z(b(b({},c.$props),c.$attrs),{options:y.value,name:t.unref(h),content:u.value}),{onReady:$e}),null,16,["cminstance"]))],6))}});var Oe="";const pe=(e,o)=>(o&&o.options&&(E.props.globalOptions.default=()=>o.options),e.component((o==null?void 0:o.componentName)||"Codemirror",E),e),ge=window.CodeMirror||C,he=pe;function styleInject(css,ref){if(ref===void 0){ref={}}var insertAt=ref.insertAt;if(!css||typeof document==="undefined"){return}var head=document.head||document.getElementsByTagName("head")[0];var style=document.createElement("style");style.type="text/css";if(insertAt==="top"){if(head.firstChild){head.insertBefore(style,head.firstChild)}else{head.appendChild(style)}}else{head.appendChild(style)}if(style.styleSheet){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))}};styleInject(`.codemirror-container {
`),h=document.createElement("span"),d=r[1];h.className=`c-editor--log__${d}`;let m=0;for(let i=0;i<l.length;i++){const p=l[i],_=f[i],$=h.cloneNode(!1);$.innerText=_,o.push({start:r.index+m,end:r.index+m+p.length,node:$}),m=m+p.length+1}r=n.exec(e)}}return a(),o}function ne(e,o){return`[${I()}] <${o}> ${e}`}function re(e,o,a){const r=new Array(Math.max(o||15,5)).join(a||"=");return`${r}${e}${r}`}const S=[{regex:/(\[.*?\])([ \t]*)(<error>[ \t])(.+)/,token:["tag","","error.strong","error.strong"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<info>)(.+)(.?)/,token:["tag","","bracket","bracket","hr"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<warning>)(.+)(.?)/,token:["tag","","comment","comment","hr"],sol:!0}];C.defineSimpleMode("fclog",{start:[...S,{regex:/.*/,token:"hr"}],error:[...S,{regex:/.*/,token:"error.strong"}],info:[...S,{regex:/.*/,token:"bracket"}],warning:[...S,{regex:/.*\[/,token:"comment"}]}),C.defineSimpleMode("log",{start:[{regex:/^[=]+[^=]*[=]+/,token:"strong"},{regex:/([^\w])([A-Z][\w]*)/,token:["","string"]},{regex:/(^[A-Z][\w]*)/,token:"string"}]});const oe=t.defineComponent({name:"CodemirrorFclog",props:{value:{type:String,default:""},name:{type:String,default:`cm-textarea-${+new Date}`},options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""}},emits:["update:cminstance","ready"],setup(e,{emit:o}){const a=t.ref(),n=t.ref(null),r=(l=e.cminstance)=>{l.getAllMarks().forEach(d=>d.clear());const f=l.getValue(),h=[].concat(A(f)).concat(B(f));for(let d=0;d<h.length;d++){const m=h[d];l.markText(l.posFromIndex(m.start),l.posFromIndex(m.end),{replacedWith:m.node})}},u=()=>{var l;n.value=t.markRaw(C.fromTextArea(a.value,e.options)),o("update:cminstance",t.unref(n)),(l=n.value)==null||l.on("change",r)};return t.watch(()=>e.cminstance,l=>{var y;l&&(r(e.cminstance),(y=e.cminstance)==null||y.setValue(e.value),o("ready",n))},{deep:!0,immediate:!0}),t.onMounted(()=>{u()}),{initialize:u,textarea:a}}}),ae=["name","placeholder"];function se(e,o,a,n,r,u){return t.openBlock(),t.createElementBlock("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,ae)}var ce=v(oe,[["render",se]]);const N={"update:value":()=>!0,change:(e,o)=>({value:e,cm:o}),input:()=>!0,ready:e=>e},le=["changes","scroll","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"],ie=()=>{const e={};return le.forEach(o=>{e[o]=(...a)=>a}),e},de=b(b({},N),ie()),O={mode:"text",theme:"default",lineNumbers:!0,smartIndent:!0,indentUnit:2};function ue(e){Promise.resolve().then(()=>{const o=e.getScrollInfo();e.scrollTo(o.left,o.height)})}const fe=({props:e,cminstance:o,emit:a,internalInstance:n,content:r})=>{const u=t.computed(()=>{var f;return e.merge?(f=t.unref(o))==null?void 0:f.editor():t.unref(o)}),l=()=>{const f=[];return Object.keys(n==null?void 0:n.vnode.props).forEach(h=>{if(h.startsWith("on")){const d=h.replace(h[2],h[2].toLowerCase()).slice(2);!N[d]&&f.push(d)}}),f};return{listenerEvents:()=>{u.value.on("change",d=>{const m=d.getValue();m===r.value&&m!==""||(r.value=m,a("update:value",r.value||""),a("input",r.value||" "),Promise.resolve().then(()=>{a("change",r.value,d)}),e.keepCursorInEnd&&ue(d))});const f={};l().filter(d=>!f[d]&&(f[d]=!0)).forEach(d=>{u.value.on(d,(...m)=>{a(d,...m)})})}}};function me({props:e,cminstance:o,presetRef:a}){const n=t.ref(null),r=t.ref(null),u=t.computed(()=>{var i;return e.merge?(i=t.unref(o))==null?void 0:i.editor():t.unref(o)}),l=()=>{t.nextTick(()=>{var i;(i=u.value)==null||i.refresh()})},y=(i=e.width,p=e.height)=>{var $;n.value=String(i).replace("px",""),r.value=String(p).replace("px","");const _=r.value;($=u.value)==null||$.setSize(n.value,_)},f=()=>{var p;const i=(p=u.value)==null?void 0:p.getWrapperElement();i==null||i.remove()},h=()=>{var p,_,$;const i=(p=u.value)==null?void 0:p.getDoc().getHistory();(_=a.value)==null||_.initialize(),f(),($=u.value)==null||$.getDoc().setHistory(i)},d=()=>{const i=document.querySelector(".CodeMirror-gutters");return(i==null?void 0:i.style.left.replace("px",""))!=="0"};return{reload:h,refresh:l,resize:y,destroy:f,containerHeight:r,reviseStyle:()=>{if(l(),!d())return;const i=setInterval(()=>{d()?l():clearInterval(i)},60),p=setTimeout(()=>{clearInterval(i),clearTimeout(p)},400)}}}const E=t.defineComponent({props:{value:{type:String,default:""},options:{type:Object,default:()=>O},globalOptions:{type:Object,default:()=>O},placeholder:{type:String,default:""},border:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},originalStyle:{type:Boolean,default:!1},keepCursorInEnd:{type:Boolean,default:!1},merge:{type:Boolean,default:!1},name:{type:String,default:""},marker:{type:Function,default:()=>null},unseenLines:{type:Array,default:()=>[]}},emits:de,setup(e,{expose:o,emit:a}){var F,R;const n=e;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value(c,g){if(c==null)throw new TypeError("Cannot convert undefined or null to object");const k=Object(c);for(let M=1;M<arguments.length;M++){const x=arguments[M];if(x!=null)for(const j in x)Object.prototype.hasOwnProperty.call(x,j)&&(k[j]=x[j])}return k},writable:!0,configurable:!0});const r=t.ref(null),u=t.ref(""),l=t.shallowRef(D),y=t.ref(b(b(b({},O),n.globalOptions),n.options)),f=t.getCurrentInstance(),h=n.name||((R=(F=f==null?void 0:f.parent)==null?void 0:F.type)==null?void 0:R.name)||void 0,d=t.ref(null),m=t.computed(()=>{var c;return n.merge?(c=t.unref(r))==null?void 0:c.editor():t.unref(r)}),{refresh:i,resize:p,destroy:_,containerHeight:$,reviseStyle:ye}=me({props:n,cminstance:r,presetRef:d}),{listenerEvents:ke}=fe({props:n,cminstance:r,emit:a,internalInstance:f,content:u}),V=()=>{n.unseenLines!==void 0&&n.marker!==void 0&&n.unseenLines.forEach(c=>{var k,M;const g=(k=r.value)==null?void 0:k.lineInfo(c);(M=r.value)==null||M.setGutterMarker(c,"breakpoints",(g==null?void 0:g.gutterMarkers)?null:n.marker())})},we=c=>{var k,M;const g=(k=r.value)==null?void 0:k.getValue();c!==g&&((M=r.value)==null||M.setValue(c),u.value=c,ye()),V()},$e=()=>{ke(),V(),p(n.width,n.height),a("ready",r.value),t.watch([()=>n.width,()=>n.height],([c,g])=>{p(c,g)},{deep:!0})},_e=()=>{if(n.options.mode==="fclog"||n.options.mode==="log"){l.value=ce;return}if(n.merge){l.value=Y;return}l.value=D};return t.watch(()=>n.options,c=>{var g;for(const k in n.options)(g=m.value)==null||g.setOption(k,t.unref(c[k]))},{deep:!0}),t.watch(()=>n.value,c=>{we(c)}),t.watch(()=>n.placeholder,c=>{var g;(g=m.value)==null||g.setOption("placeholder",c)}),t.watch(()=>n.merge,c=>{_e()},{immediate:!0}),t.onBeforeUnmount(()=>{_()}),o({cminstance:r,resize:p,refresh:i,destroy:_}),(c,g)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["codemirror-container",{merge:c.$props.merge,bordered:c.$props.border||c.$props.merge&&!n.originalStyle,"width-auto":!c.$props.width||c.$props.width=="100%","height-auto":!c.$props.height||c.$props.height=="100%","original-style":n.originalStyle}]),style:t.normalizeStyle({height:t.unref($)+"px"})},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(l)),t.mergeProps({ref_key:"presetRef",ref:d,cminstance:r.value,"onUpdate:cminstance":g[0]||(g[0]=k=>r.value=k),style:{height:"100%"}},z(b(b({},c.$props),c.$attrs),{options:y.value,name:t.unref(h),content:u.value}),{onReady:$e}),null,16,["cminstance"]))],6))}});var Oe="";const pe=(e,o)=>(o&&o.options&&(E.props.globalOptions.default=()=>o.options),e.component((o==null?void 0:o.componentName)||"Codemirror",E),e),ge=window.CodeMirror||C,he=pe;function styleInject(css,ref){if(ref===void 0){ref={}}var insertAt=ref.insertAt;if(!css||typeof document==="undefined"){return}var head=document.head||document.getElementsByTagName("head")[0];var style=document.createElement("style");style.type="text/css";if(insertAt==="top"){if(head.firstChild){head.insertBefore(style,head.firstChild)}else{head.appendChild(style)}}else{head.appendChild(style)}if(style.styleSheet){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))}};styleInject(`.codemirror-container {
position: relative;

@@ -8,0 +8,0 @@ display: inline-block;

@@ -657,3 +657,3 @@ import type { Ref, PropType } from "vue";

overwriteToggle: (instance: Editor, overwrite: boolean) => void;
"update:value": (value: string) => string;
"update:value": (value: string) => any;
change: (value: string, cm: Editor) => {

@@ -663,3 +663,3 @@ value: string;

};
input: (value: string) => string;
input: (value: string) => any;
ready: (cm: Editor) => Editor;

@@ -666,0 +666,0 @@ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{

@@ -10,3 +10,3 @@ import { Editor, EditorEventMap } from "codemirror";

export interface ComponentEventMap {
"update:value": (value: string) => string;
"update:value": (value: string) => any;
change: (value: string, cm: Editor) => {

@@ -16,3 +16,3 @@ value: string;

};
input: (value: string) => string;
input: (value: string) => any;
ready: (cm: Editor) => Editor;

@@ -44,3 +44,3 @@ }

overwriteToggle: (instance: Editor, overwrite: boolean) => void;
"update:value": (value: string) => string;
"update:value": (value: string) => any;
change: (value: string, cm: Editor) => {

@@ -50,3 +50,3 @@ value: string;

};
input: (value: string) => string;
input: (value: string) => any;
ready: (cm: Editor) => Editor;

@@ -53,0 +53,0 @@ };

{
"name": "codemirror-editor-vue3",
"description": "CodeMirror component for Vue3",
"version": "2.1.8",
"version": "2.1.9-beta1",
"license": "MIT",

@@ -6,0 +6,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc