import{d as $,E as b,r as V,bo as k,G as w,o as L,c as M,aa as E,a0 as T,Y as h}from"./BvNnk7SS.js";import{_ as j}from"./Cs47TkFU.js";const B=E(j),D=$({__name:"EditorText",props:{modelValue:{},lang:{default:"markdown"}},emits:["update:modelValue","focus","blur"],setup(m,{emit:p}){const i=m,f=p,l=b({get:()=>i.modelValue,set(o){f("update:modelValue",o)}}),r=V(),c=k(),_={theme:`vs-${c.value}`,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,roundedSelection:!0,wordWrap:"on",lineNumbers:"off",folding:!1,padding:{top:10,bottom:10}};w(c,o=>{r.value?.$editor._themeService.setTheme(`vs-${o}`)});function g(o){o&&o.onDropIntoEditor(n=>{const a=n.event.dataTransfer.getData("itemKey");if(!a)return;let e=a;if(e){const t=e.split(":");if(t.includes("content")){const s=t.indexOf("content");e=`/${t.slice(s+1).join("/").replace(/\..*$/,"")}`}if(t.includes("public")){const s=t.indexOf("public");e=`/${t.slice(s+1).join("/")}`}i.lang==="markdown"&&T(e)==="image"&&(e=`![${t.at(-1).replace(/\..*$/,"").replaceAll("-"," ")}](${e})`)}const v=h(),{lineNumber:d,column:u}=n.position,x=new v.Range(d,u,d,u),y={identifier:{major:1,minor:1},range:x,text:e,forceMoveMarkers:!0};o.executeEdits("my-source",[y])})}return(o,n)=>{const a=B;return L(),M(a,{ref_key:"editorRef",ref:r,modelValue:l.value,"onUpdate:modelValue":n[0]||(n[0]=e=>l.value=e),class:"text-monaco-editor",options:_,lang:o.lang,"data-testid":"editor",onLoad:g},null,8,["modelValue","lang"])}}});export{D as default};
