index-51fd717a.js 3.1 KB

1
  1. import{E as T,T as O}from"./index.esm-44936652.js";import{_ as A,A as s,U as z,m as B}from"./index-3887ab05.js";import{s as L,o as h,a as F,w as U,n as M,k as N,W as g,X as I,Y as P,m as E,a1 as W}from"./vue-74beb2f3.js";const V={components:{Editor:T,Toolbar:O},props:["id","content","isEdit"],setup(o){const n=L();h(()=>{f()});const r=F(""),l=F(""),f=async()=>{const e=await s.requested({classname:"webmanage.site.site",method:"querySite_Parameter",content:{}});r.value=e.data.appfolderid,l.value=e.data.salematerialfolderid};U(()=>o.isEdit,e=>{M(()=>{e?n.value.disable():n.value.enable()})},{immediate:!0});const d=(e,i)=>{let t=e.name.substr(0,e.name.indexOf(".")),b=e.name.substr(e.name.indexOf(".")+1),C={classname:"system.attachment.huawei.OBS",method:"getFileName",content:{filename:t,filetype:b,parentid:r.value}};s.requested(C).then(p=>{let v=p.data.uploadurl,_=p.data.serialfilename,w={headers:{"Content-Type":"application/octet-stream"}};z.upload(v,e,w).then(q=>{if(q.statusText=="OK"){let x={classname:"system.attachment.huawei.OBS",method:"uploadSuccess",content:{serialfilename:_}};s.requested(x).then(y=>{let R=y.data.attachmentids,k={classname:"system.attachment.Attachment",method:"createFileLink",content:{ownertable:"SAT_SHAREMATERIAL",ownerid:o.id,usetype:"richtext",attachmentids:R}};s.requested(k).then(m=>{m.msg!="成功"?B("上传失败!"):i(m.data[0].url,t,m.data[0].url)})})}})})},c={},u={placeholder:"请输入内容...",MENU_CONF:{uploadImage:{customUpload:d},uploadVideo:{customUpload:d}}};N(()=>{const e=n.value;e!=null&&e.destroy()});const S=e=>{n.value=e,console.log(n.value),n.value.on("fullScreen",i=>{const t=document.getElementById("editorEl");t.RequestFullScreen?t.RequestFullScreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullScreen?t.webkitRequestFullScreen():t.msRequestFullscreen&&t.msRequestFullscreen()}),n.value.on("unFullScreen",i=>{document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()})},a=()=>{document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement||(n.value.unFullScreen(),console.log("全屏模式已退出"))};return h(()=>{document.addEventListener("fullscreenchange",a),document.addEventListener("mozfullscreenchange",a),document.addEventListener("webkitfullscreenchange",a),document.addEventListener("MSFullscreenChange",a)}),{editorRef:n,mode:"default",toolbarConfig:c,editorConfig:u,handleCreated:S}}},H={style:{border:"1px solid #ccc"},id:"editorEl"};function K(o,n,r,l,f,d){const c=g("Toolbar"),u=g("Editor");return I(),P("div",H,[E(c,{style:{"border-bottom":"1px solid #ccc"},editor:l.editorRef,defaultConfig:l.toolbarConfig,mode:l.mode},null,8,["editor","defaultConfig","mode"]),E(u,W({style:{height:"400px","overflow-y":"hidden"}},o.$attrs,{defaultConfig:l.editorConfig,mode:l.mode,onOnCreated:l.handleCreated}),null,16,["defaultConfig","mode","onOnCreated"])])}const D=A(V,[["render",K]]);export{D as W};