File size: 932 Bytes
2130805 |
1 |
import{eD as e,eH as t,eM as n,eR as r,eX as i,eZ as a,es as o,f0 as s,f2 as c,fa as l}from"./index-BftXnxo2.js";var u=t({__name:`Basic`,props:n({defaultHeight:{}},{modelValue:{default:``},modelModifiers:{}}),emits:n([`submit`,`pasteFile`],[`update:modelValue`]),setup(t,{emit:n}){let u=t,d=n,f=i(t,`modelValue`),p=c(),m=c(`auto`);function h(e){e.code===`Enter`&&!e.shiftKey&&(e.preventDefault(),d(`submit`,f.value))}function g(e){if(!e.clipboardData)return;let{files:t}=e.clipboardData;t.length>0&&(e.preventDefault(),d(`pasteFile`,Array.from(t)))}return a(f,()=>{m.value=`auto`,requestAnimationFrame(()=>{if(p.value){if(f.value===``){m.value=u.defaultHeight||`fit-content`;return}m.value=`${p.value.scrollHeight}px`}})},{immediate:!0}),(t,n)=>s((r(),e(`textarea`,{ref_key:`textareaRef`,ref:p,"onUpdate:modelValue":n[0]||=e=>f.value=e,style:l({height:m.value}),onKeydown:h,onPaste:g},null,36)),[[o,f.value]])}}),d=u;export{d as b}; |