FrappeApplications/playbook/public/frontend/assets/InsertVideo.a8f5bc73.js

2 lines
1.9 KiB
JavaScript
Raw Normal View History

2024-05-21 08:54:56 +00:00
import{_ as D,j as v,D as h,K as C,e as u,v as k,x,y as w,f as t,w as i,F as y,g as r,o as c,m as B,q as n,H as U,t as F,J as f}from"./vendor.8583bfd9.js";const I={name:"InsertImage",props:["editor"],expose:["openDialog"],data(){return{addVideoDialog:{url:"",file:null,show:!1}}},components:{Button:v,Dialog:h,FileUploader:C},methods:{openDialog(){this.addVideoDialog.show=!0},onVideoSelect(l){let o=l.target.files[0];!o||(this.addVideoDialog.file=o)},addVideo(l){this.editor.chain().focus().insertContent(`<video src="${l}"></video>`).run(),this.reset()},reset(){this.addVideoDialog=this.$options.data().addVideoDialog}}},N={class:"flex items-center space-x-2"},S=n(" Remove "),A=["src"],b=n(" Insert Video "),j=n("Cancel");function L(l,o,P,R,e,s){const a=r("Button"),g=r("FileUploader"),p=r("Dialog");return c(),u(y,null,[k(l.$slots,"default",x(w({onClick:s.openDialog}))),t(p,{options:{title:"Add Video"},modelValue:e.addVideoDialog.show,"onUpdate:modelValue":o[2]||(o[2]=d=>e.addVideoDialog.show=d),onAfterLeave:s.reset},{"body-content":i(()=>[t(g,{"file-types":"video/*",onSuccess:o[0]||(o[0]=d=>e.addVideoDialog.url=d.file_url)},{default:i(({file:d,progress:V,uploading:_,openFileSelector:m})=>[B("div",N,[t(a,{onClick:m},{default:i(()=>[n(U(_?`Uploading ${V}%`:e.addVideoDialog.url?"Change Video":"Upload Video"),1)]),_:2},1032,["onClick"]),e.addVideoDialog.url?(c(),F(a,{key:0,onClick:()=>{e.addVideoDialog.url=null,e.addVideoDialog.file=null}},{default:i(()=>[S]),_:2},1032,["onClick"])):f("",!0)])]),_:1}),e.addVideoDialog.url?(c(),u("video",{key:0,src:e.addVideoDialog.url,class:"mt-2 w-full rounded-lg",type:"video/mp4",controls:""},null,8,A)):f("",!0)]),actions:i(()=>[t(a,{variant:"solid",onClick:o[1]||(o[1]=d=>s.addVideo(e.addVideoDialog.url))},{default:i(()=>[b]),_:1}),t(a,{onClick:s.reset},{default:i(()=>[j]),_:1},8,["onClick"])]),_:1},8,["modelValue","onAfterLeave"])],64)}var z=D(I,[["render",L]]);export{z as default};