@next-bricks/markdown 1.10.9 → 1.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_next_bricks_markdown=self.webpackChunk_next_bricks_markdown||[]).push([[967],{7196:(e,t,n)=>{n.r(t),n.d(t,{MarkdownEditor:()=>S,MarkdownEditorComponent:()=>Ne});var a,i,o,r,l,s,c,u,d,h,m,k,p,A,b,y,v,g,w,f,E,C,M,N,S,W=n(9740),j=n(6330),I=n(4586),_=n(4635),x=n(918),T=n(6902),q=n(5536),D=n(6121),U=n(829),V=n(2740),B=n(9575),F=n(8769),O=n.n(F),P=n(169),$=n(5617),G=(n(6329),n(998)),J=n(3717),K=n(692),X=n(2466),L=n(9409),Q=n(9760),R=n(135),Y=n(6486),Z=n(6512),z=n(8653),H=n(1123),ee=n(5435),te=n(9796),ne=n(3971),ae=n(6385),ie=n(1151),oe=n(4557),re=n(426),le=n(3373),se=n.n(le),ce=(0,$.wrapBrick)("eo-form-item"),ue=(0,$.wrapBrick)("eo-icon"),de=e=>{var{icon:t,onClick:n,tooltip:a}=e;return O().createElement("div",{className:"menu-btn-box",onMouseDown:e=>{null==n||n(),e.preventDefault()}},O().createElement(ue,(0,B.A)({style:{verticalAlign:"middle"}},t)),a&&O().createElement("div",{className:"menuIconTooltip"},a))},{defineElement:he,property:me,event:ke}=(0,P.createDecorators)(),pe=new WeakMap,Ae=new WeakMap,be=new WeakMap,ye=new WeakMap,ve=new WeakMap,ge=new WeakMap,we=new WeakMap,fe=new WeakMap,Ee=new WeakSet,Ce=new WeakMap;class Me extends re.N{constructor(){super(...arguments),(0,_.A)(this,Ee),(0,x.A)(this,pe,o(this)),(0,x.A)(this,Ae,(r(this),l(this))),(0,x.A)(this,be,(s(this),c(this))),(0,x.A)(this,ye,(u(this),d(this))),(0,x.A)(this,ve,(h(this),m(this))),(0,x.A)(this,ge,(k(this),p(this))),(0,x.A)(this,we,(A(this),b(this))),(0,x.A)(this,fe,(y(this),v(this))),(0,I.A)(this,"handleUploadImage",(f(this),e=>{(0,q.A)(Ee,this,g).emit(e)})),(0,x.A)(this,Ce,E(this)),(0,I.A)(this,"handleMarkdownValueChange",(N(this),e=>{var t;null===(t=this.getFormElement())||void 0===t||t.formStore.onChange(this.name,e),this.value=e,(0,q.A)(Ee,this,C).emit(e)}))}get name(){return(0,U.A)(pe,this)}set name(e){(0,D.A)(pe,this,e)}get label(){return(0,U.A)(Ae,this)}set label(e){(0,D.A)(Ae,this,e)}get required(){return(0,U.A)(be,this)}set required(e){(0,D.A)(be,this,e)}get value(){return(0,U.A)(ye,this)}set value(e){(0,D.A)(ye,this,e)}get bucketName(){return(0,U.A)(ve,this)}set bucketName(e){(0,D.A)(ve,this,e)}get readonly(){return(0,U.A)(ge,this)}set readonly(e){(0,D.A)(ge,this,e)}get containerStyle(){return(0,U.A)(we,this)}set containerStyle(e){(0,D.A)(we,this,e)}render(){return O().createElement(X.pb,null,O().createElement(ne.vo,null,O().createElement(Ne,{formElement:this.getFormElement(),name:this.name,label:this.label,required:this.required,curElement:this,bucketName:this.bucketName,value:this.value,readonly:this.readonly,containerStyle:this.containerStyle,onUploadImage:this.handleUploadImage,onMarkdownValueChange:this.handleMarkdownValueChange})))}}function Ne(e){var{bucketName:t,containerStyle:n,value:a,formElement:i,readonly:o,onUploadImage:r,onMarkdownValueChange:l}=e,[s,c]=(0,F.useState)(!1),u=function(){var n=(0,j.A)((function*(n,a){for(var i=[],o=[],l=0;l<n.length;l++){var s=n.item(l);s&&s.type.includes("image")&&i.push(s)}try{o=yield Promise.all(i.map(function(){var n=(0,j.A)((function*(n){var i,o=yield(0,J.i)(t,{file:n,width:1280,height:800}),l=(i=null==o?void 0:o.objectName,"/next/api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/".concat(e.bucketName,"/object/").concat(i)),s=n.name;return r&&r({name:s,src:l}),a.nodes.image.createAndFill({src:l,alt:s})}));return function(e){return n.apply(this,arguments)}}()))}catch(e){console.error("upload failed:",e)}return o}));return function(e,t){return n.apply(this,arguments)}}(),d=(0,ne.Uv)(),h=(0,ne.rJ)(),m=(0,ne.$X)(),k=(0,F.useMemo)((()=>o?[]:[H.Te,ie.EI,ie.nk,e=>(0,j.A)((function*(){e.set(ie.EI.key,{view:d({component:ie.ST})}),e.set(H.iS.key,{ExitTable:["Enter"],NextCell:["Mod-]","Tab"],PrevCell:["Mod-[","Shift-Tab"]})})),(0,ie.jp)(h)].flat()),[o,d,h]),{get:p}=(0,X.hG)((e=>K.KE.make().config((n=>{n.set(K.k,e),n.update(K.QM,(e=>(0,W.A)((0,W.A)({},e),{},{editable:()=>!o}))),a&&n.set(K.CI,a),n.get(z.Ob).markdownUpdated(((e,t,n)=>{l&&l(t)})).focus((()=>{c(!0)})).blur((()=>{c(!1)})),t&&n.update(Y.wu.key,(e=>(0,W.A)((0,W.A)({},e),{},{uploader:u}))),n.update(te.mS.key,(e=>(0,W.A)((0,W.A)({},e),{},{configureRefractor:()=>ae.L})))})).config(Q.E).use(z.F_).use(L.PD).use(R.b6).use(H.Te).use(ee.pZ).use(Y.Se).use(k).use(te.Wj).use(o?[]:(0,Z.m5)(L.Ay.node,(()=>m({component:oe.N}))))),[]);function A(e,t){var n;return null===(n=p())||void 0===n?void 0:n.action((0,Z.KD)(e,t))}(0,F.useEffect)((()=>{var e;i&&void 0!==a&&!s&&(null===(e=p())||void 0===e||e.action((0,Z.yh)(a)))}),[p(),a]);var b=[{icon:{lib:"antd",icon:"undo"},onClick:()=>A(R.Eb.key),tooltip:"撤销"},{icon:{lib:"antd",icon:"redo"},onClick:()=>A(R.eD.key),tooltip:"重做"},{icon:{lib:"antd",icon:"bold"},onClick:()=>A(L.vY.key),tooltip:"粗体"},{icon:{lib:"antd",icon:"italic"},onClick:()=>A(L.e0.key),tooltip:"斜体"},{icon:{lib:"antd",icon:"strikethrough"},onClick:()=>A(H.$l.key),tooltip:"删除线"},{icon:{lib:"antd",icon:"table"},onClick:()=>A(H.f$.key),tooltip:"表格"},{icon:{lib:"antd",icon:"unordered-list"},onClick:()=>A(L.Xk.key),tooltip:"无序列表"},{icon:{lib:"antd",icon:"ordered-list"},onClick:()=>A(L.Ej.key),tooltip:"有序列表"},{icon:{lib:"fa",icon:"quote-right"},onClick:()=>A(L.oO.key),tooltip:"块引用"}];return O().createElement(ce,e,O().createElement("div",{className:se()("markdown-container",{readonly:o}),style:n},!o&&O().createElement("div",{className:"menu-container-outter"},O().createElement("div",{className:"menu-container-inner prose"},b.map((e=>O().createElement(de,(0,B.A)({},e,{key:JSON.stringify(e.icon)})))))),O().createElement("div",{className:"editor-container"},O().createElement(X.y5,null))))}a=Me,({e:[o,r,l,s,c,u,d,h,m,k,p,A,b,y,v,g,w,f,E,C,M,N],c:[S,i]}=(0,V.A)(a,[he("eo-markdown-editor",{styleTexts:[G.A],alias:["markdown.markdown-editor"]})],[[me(),1,"name"],[me(),1,"label"],[me({type:Boolean}),1,"required"],[me(),1,"value"],[me(),1,"bucketName"],[me({type:Boolean}),1,"readonly"],[me({attribute:!1}),1,"containerStyle"],[ke({type:"image.upload"}),1,"uploadImage",e=>(0,U.A)(fe,e),(e,t)=>(0,D.A)(fe,e,t)],[ke({type:"markdown.value.change"}),1,"markdownValueChange",e=>(0,U.A)(Ce,e),(e,t)=>(0,D.A)(Ce,e,t)]],0,(e=>Ee.has((0,T.A)(e))),re.N)),i()}}]);
2
- //# sourceMappingURL=eo-markdown-editor.3b032fe4.js.map