@layers-app/editor 0.7.76 → 0.7.78
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.
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +70 -6
- package/dist/index.js +14 -12
- package/dist/{layers.Dr__uDIi.js → layers.0Y1qnl1G.js} +1 -1
- package/dist/{layers.C-bHn0n6.js → layers.0fsVAKhk.js} +1 -1
- package/dist/{layers.BizhFq3i.js → layers.1-NgjLB1.js} +1 -1
- package/dist/{layers.D6PFsN_n.js → layers.4mXbqwQz.js} +1 -1
- package/dist/{layers.BwCW4HQI.js → layers.515YmFp2.js} +1 -1
- package/dist/{layers.CNatppcK.js → layers.7PYtla9F.js} +1 -1
- package/dist/{layers.BPEIOpuf.js → layers.80zZkFZy.js} +1 -1
- package/dist/{layers.CLep0qXy.js → layers.AIWrQESY.js} +1 -1
- package/dist/layers.B0hzGWHm.js +17 -0
- package/dist/{layers.D9NihHtR.js → layers.B2NmFuMF.js} +1 -1
- package/dist/{layers.oHGzBOGg.js → layers.B3r9apZY.js} +1 -1
- package/dist/{layers.8X2uUg-1.js → layers.B4Nujy-W.js} +1 -1
- package/dist/{layers.sBsh3t04.js → layers.B4oqbc3n.js} +1 -1
- package/dist/{layers.3HQmD-i9.js → layers.B5yHbfHz.js} +1 -1
- package/dist/layers.B93mlMVg.js +1 -0
- package/dist/{layers.Cd4yC_RD.js → layers.B9UxA7oB.js} +1 -1
- package/dist/{layers.3sB2RYDg.js → layers.BA-KmiPF.js} +1 -1
- package/dist/{layers.BrB0bkUa.js → layers.BBVtioek.js} +1 -1
- package/dist/{layers.BpZCX031.js → layers.BB_9B4fo.js} +7 -7
- package/dist/{layers.BKpO_8eE.js → layers.BENdLcO-.js} +1 -1
- package/dist/{layers.A0dlShyS.js → layers.BEYYOqjt.js} +1 -1
- package/dist/{layers.DfTz_8aW.js → layers.BHHU17Hh.js} +1 -1
- package/dist/{layers.BySjNBw0.js → layers.BHbOQ8mW.js} +3 -3
- package/dist/{layers.CMnEsT_f.js → layers.BIGBZTJQ.js} +1 -1
- package/dist/{layers.3HgRBIKA.js → layers.BL2-bsw_.js} +4 -4
- package/dist/{layers.B4YVXT-M.js → layers.BLGXeqHI.js} +1 -1
- package/dist/layers.BNUA11IQ.js +1 -0
- package/dist/{layers.CJyDiiHP.js → layers.BNwCX_a3.js} +1 -1
- package/dist/{layers.u_kLzhWe.js → layers.BPY_YIjN.js} +1 -1
- package/dist/{layers.L4xR0uXE.js → layers.BPqRxZ_9.js} +1 -1
- package/dist/layers.BPvkLXia.js +43993 -0
- package/dist/{layers.DFBXyeW-.js → layers.BSZN9Cbf.js} +1 -1
- package/dist/{layers.BC3uY1z6.js → layers.BUe6Fley.js} +1 -1
- package/dist/{layers.Cp4IZWMi.js → layers.BW-MhyT0.js} +1 -1
- package/dist/{layers.CwTmqPtx.js → layers.BWY5OhEO.js} +1 -1
- package/dist/{layers.mXLlNCHu.js → layers.BWvugbcq.js} +1 -1
- package/dist/{layers.ccUhxyWM.js → layers.BXwSSGOP.js} +1 -1
- package/dist/{layers.Cyai_rha.js → layers.BZDPu4w6.js} +1 -1
- package/dist/layers.BcBq8AlG.js +1 -0
- package/dist/{layers.C66ljMzs.js → layers.BdG3k_hs.js} +8 -8
- package/dist/layers.BeQ9YXA_.js +6 -0
- package/dist/{layers.BvqjRRAq.js → layers.Bf6lLK8a.js} +3 -3
- package/dist/{layers.NVEwzwTf.js → layers.BfY7AosZ.js} +1 -1
- package/dist/{layers.CuMYUfep.js → layers.BgYEljJ_.js} +1 -1
- package/dist/{layers.fxB_Szcv.js → layers.BgZ80nBG.js} +1 -1
- package/dist/{layers.BVestiSR.js → layers.BiKZpDTt.js} +1 -1
- package/dist/{layers.BW8fQq6M.js → layers.BiYaXYfe.js} +1 -1
- package/dist/{layers.gGEg2UEp.js → layers.BjEcjDvl.js} +1 -1
- package/dist/{layers.98S3fG1s.js → layers.Bj_M3P16.js} +3 -3
- package/dist/{layers.W4_7L68P.js → layers.BktNuMeg.js} +1 -1
- package/dist/{layers.Dw4xYl9C.js → layers.BnaFkLXr.js} +1 -1
- package/dist/{layers.DV2K9i9M.js → layers.Bny6sOA6.js} +1 -1
- package/dist/{layers.C5-pXyja.js → layers.BtlBrRBE.js} +1 -1
- package/dist/{layers.Deq-x4f7.js → layers.Bu8DKvk7.js} +1 -1
- package/dist/{layers.DC_X0jt1.js → layers.BxMs_uR-.js} +1 -1
- package/dist/{layers.D_3i8ZKG.js → layers.BxU87ICV.js} +5 -5
- package/dist/{layers.Nh0j4HHM.js → layers.BxyrBHL5.js} +1 -1
- package/dist/{layers.BFk7FVnD.js → layers.Bzua1pmT.js} +1 -1
- package/dist/{layers.yg4Ocs-p.js → layers.C-JcVOgm.js} +1 -1
- package/dist/{layers.BHU8KCnB.js → layers.C-Y8p6cn.js} +2 -2
- package/dist/layers.C0Me094z.js +1 -0
- package/dist/{layers.CSzeNtlD.js → layers.C105wwo7.js} +1 -1
- package/dist/{layers.D9Kmtznv.js → layers.C1Hzs5fa.js} +24 -24
- package/dist/{layers.ygCXBRoQ.js → layers.C27kGY5A.js} +1 -1
- package/dist/{layers.QBfrOVlI.js → layers.C2VEZ-qb.js} +3 -3
- package/dist/{layers.DRY_7Cfb.js → layers.C5mfAwKZ.js} +1 -1
- package/dist/{layers.C3xXjAnx.js → layers.C7umgYWg.js} +1 -1
- package/dist/{layers.DKIi5eMR.js → layers.C8orXEHJ.js} +1 -1
- package/dist/{layers.CYX2tMK1.js → layers.C9OM6nT3.js} +1 -1
- package/dist/layers.CB9cfYZa.js +1 -0
- package/dist/{layers.DWU0K8j8.js → layers.CCZ6_Wrw.js} +1 -1
- package/dist/{layers.D3BrP60h.js → layers.CD1wSFLR.js} +1 -1
- package/dist/{layers.Fsr-b0e_.js → layers.CD9Gpt1y.js} +1 -1
- package/dist/{layers.Dlx-ul8F.js → layers.CE2rGRKc.js} +1 -1
- package/dist/{layers.piNAJlCH.js → layers.CEs7S6fZ.js} +1 -1
- package/dist/{layers.4JuSV48m.js → layers.CF6gZUn8.js} +1 -1
- package/dist/{layers.CjIqKryv.js → layers.CGT8RNLy.js} +1 -1
- package/dist/{layers.aYkBkweH.js → layers.CH5sZ9y2.js} +1 -1
- package/dist/{layers.Bsr-goIs.js → layers.CHNwPCcP.js} +1 -1
- package/dist/{layers.t8apjdsW.js → layers.CHjfZV3Y.js} +2 -2
- package/dist/{layers.Bt6FT2CC.js → layers.CKepCH9l.js} +1 -1
- package/dist/layers.CLEDkiCk.js +346 -0
- package/dist/{layers.oar6poC5.js → layers.CLlpta2X.js} +1 -1
- package/dist/{layers.hSyfIICt.js → layers.CN5kSOlp.js} +1 -1
- package/dist/{layers.CCDVQ0jH.js → layers.CNWeM8YC.js} +1 -1
- package/dist/{layers.Dw28EQaj.js → layers.COMdL1L-.js} +2 -2
- package/dist/{layers.BbPkmuOf.js → layers.CRU1QNHI.js} +1 -1
- package/dist/{layers.CzLRABRl.js → layers.CSp_fUX9.js} +1 -1
- package/dist/{layers.D6Zc4DN3.js → layers.CTmobPht.js} +1 -1
- package/dist/{layers.BbfnBYE2.js → layers.CTyeZA74.js} +1 -1
- package/dist/{layers.BoY7aX9Q.js → layers.CU-KamiB.js} +1 -1
- package/dist/{layers.DIITR8ru.js → layers.CVyvMI9c.js} +1 -1
- package/dist/{layers.BS1nWQv8.js → layers.CYLLfE2A.js} +1 -1
- package/dist/{layers.ojkfuFMs.js → layers.CZFodX-E.js} +1 -1
- package/dist/{layers.C3BWbnz4.js → layers.CcIycQA5.js} +1 -1
- package/dist/{layers.CDdK4ZPa.js → layers.CcZ7lvE9.js} +1 -1
- package/dist/{layers.BKks9bmD.js → layers.Cce3uOww.js} +1 -1
- package/dist/{layers.CKLfQCSd.js → layers.CcgC0wyZ.js} +1 -1
- package/dist/{layers.CnBjSGVn.js → layers.CcxNr1WJ.js} +1 -1
- package/dist/{layers.D4y8tfKL.js → layers.CeElkwBf.js} +1 -1
- package/dist/{layers.C-JzwkDv.js → layers.CecVLcyQ.js} +4 -4
- package/dist/{layers.DLeJweHw.js → layers.CggsYr0c.js} +1 -1
- package/dist/{layers.BmjMajO5.js → layers.CiJKn6R8.js} +1 -1
- package/dist/{layers.ZWVfCB-j.js → layers.Cj_3ai7F.js} +5 -5
- package/dist/{layers.CKAdBWVi.js → layers.CjiGu82L.js} +1 -1
- package/dist/layers.CmmYt3Ou.js +1 -0
- package/dist/{layers.nsj6rYOJ.js → layers.CmxdGLsP.js} +1 -1
- package/dist/{layers.CDhsaSOZ.js → layers.CmxgG84N.js} +1 -1
- package/dist/{layers.3--NaHtI.js → layers.CoBd9S7u.js} +1 -1
- package/dist/{layers.In0s46fL.js → layers.Co_5xN7g.js} +3 -3
- package/dist/{layers.BNA_jqKV.js → layers.CpsZt8D1.js} +3 -3
- package/dist/{layers.g14tmGrJ.js → layers.CqA113CL.js} +1 -1
- package/dist/{layers.BXC4aLD6.js → layers.Cr3Askgk.js} +1 -1
- package/dist/{layers.DsfVnOHM.js → layers.Cr9LsWSp.js} +1 -1
- package/dist/{layers.FA36oxZh.js → layers.Cs4W0xng.js} +1 -1
- package/dist/{layers.DWbBk8f8.js → layers.CshIiX8i.js} +1 -1
- package/dist/{layers.C5N3J39x.js → layers.CtDgzw74.js} +1 -1
- package/dist/{layers.sEtygoKy.js → layers.CtX9oKVv.js} +1 -1
- package/dist/{layers.CljDd9A-.js → layers.Cu51YqSE.js} +4 -4
- package/dist/layers.CvcpAYuM.js +296 -0
- package/dist/{layers.DxVtEm1F.js → layers.CvuuDQmg.js} +1 -1
- package/dist/layers.D05yrn3O.js +1 -0
- package/dist/layers.D0X8KZzh.js +304 -0
- package/dist/{layers.u1W92FJG.js → layers.D26fGq9e.js} +1 -1
- package/dist/{layers.RHFjtAc3.js → layers.D3U4gCDM.js} +4 -4
- package/dist/{layers.BRJUEk_q.js → layers.D53ECpyT.js} +3 -3
- package/dist/{layers.BJz_j8RM.js → layers.D5f_UTqz.js} +1 -1
- package/dist/{layers.DmyJlIiD.js → layers.D6f5jje7.js} +3 -3
- package/dist/{layers.C18qPx6x.js → layers.D82NsaKN.js} +1 -1
- package/dist/{layers.0bR5HDos.js → layers.D8T367jD.js} +3 -3
- package/dist/{layers.BhulBKYv.js → layers.D9X0FyWW.js} +1 -1
- package/dist/{layers.CQAl3qEA.js → layers.D9n9z8YG.js} +1 -1
- package/dist/{layers.CHhlyMQM.js → layers.DA8ptbxj.js} +1 -1
- package/dist/{layers.CIvBE-7u.js → layers.DAZX9DhM.js} +1 -1
- package/dist/layers.DB-vtUk9.js +454 -0
- package/dist/{layers.erv_KQw9.js → layers.DBIp1-89.js} +1 -1
- package/dist/{layers.C4kP5cJM.js → layers.DCMRe4s_.js} +1 -1
- package/dist/{layers.BI6AwQLG.js → layers.DCngQBR0.js} +1 -1
- package/dist/{layers.DqkZv-3R.js → layers.DD1kaPgm.js} +1 -1
- package/dist/{layers.cpKeHZiE.js → layers.DFYDyH7z.js} +1 -1
- package/dist/{layers.BbExwE0N.js → layers.DFkl1ZSl.js} +1 -1
- package/dist/{layers.Cxua8aGD.js → layers.DGGRbYnV.js} +4 -4
- package/dist/{layers.BBsDWzVz.js → layers.DH9O_NeT.js} +1 -1
- package/dist/{layers.B9Hj-255.js → layers.DHgqjuG0.js} +1 -1
- package/dist/{layers.EaOlxf65.js → layers.DLYZRcK4.js} +1 -1
- package/dist/{layers.CZpFdww-.js → layers.DRQG0sOU.js} +1 -1
- package/dist/{layers.B9zfT8Jg.js → layers.DRorHC-o.js} +1 -1
- package/dist/{layers.ePWi_vsU.js → layers.DUfrGX_H.js} +1 -1
- package/dist/{layers.Btzeqb6v.js → layers.DXHgwQSF.js} +1 -1
- package/dist/{layers.DyiakeBc.js → layers.DbiqHLuu.js} +1 -1
- package/dist/{layers.DICeT5Ah.js → layers.DdGilF1y.js} +1 -1
- package/dist/{layers.CPei2bwV.js → layers.DhATdRwD.js} +1 -1
- package/dist/{layers.CJE4fcBy.js → layers.DiU6cOXj.js} +1 -1
- package/dist/layers.DilA0qnM.js +54 -0
- package/dist/{layers.zuJNBa5t.js → layers.Din2GY_v.js} +1 -1
- package/dist/{layers.GJRS5NpN.js → layers.DkOOn3oi.js} +1 -1
- package/dist/{layers.S0tnwmLX.js → layers.Dl0nflkg.js} +1 -1
- package/dist/{layers.BK5cfJAp.js → layers.DoAIxshB.js} +1 -1
- package/dist/{layers.C-BPQWCM.js → layers.DpqsTBtA.js} +1 -1
- package/dist/{layers.CeOdLzgV.js → layers.Dqb3E0zJ.js} +1 -1
- package/dist/{layers.CbcbTsr2.js → layers.Du6LkFzU.js} +1 -1
- package/dist/{layers.uHN1c1yf.js → layers.Dv7C-CRq.js} +1 -1
- package/dist/{layers.CgIGOGRZ.js → layers.DvM6Rvuy.js} +1 -1
- package/dist/{layers.DIKnkOPC.js → layers.DvQ3ACdp.js} +1 -1
- package/dist/{layers.DKzCVkVx.js → layers.DvnUP-Vo.js} +1 -1
- package/dist/{layers.BYjsIyyZ.js → layers.DyN9zqvw.js} +1 -1
- package/dist/{layers.DG1Fd15D.js → layers.FzN5R_MI.js} +4 -4
- package/dist/{layers.BrcbO6wM.js → layers.IKs1cP2i.js} +1 -1
- package/dist/{layers.D0NajOJY.js → layers.JJpurIJD.js} +4 -4
- package/dist/{layers.LoW3Rgr2.js → layers.K3ZUUM9n.js} +1 -1
- package/dist/{layers.Du96EN5t.js → layers.KZgKtoDw.js} +1 -1
- package/dist/{layers.38QxLvPA.js → layers.KqM0XPII.js} +1 -1
- package/dist/{layers.Dv-j1T73.js → layers.M3VtTDPw.js} +1 -1
- package/dist/{layers.DbqT6bF3.js → layers.MEapmzkA.js} +1 -1
- package/dist/{layers.BwRuRFx0.js → layers.Mj8hqlJW.js} +1 -1
- package/dist/{layers.Ccrk7q2R.js → layers.NSLZMsAU.js} +1 -1
- package/dist/{layers.CoMArPB0.js → layers.RSlXJHc_.js} +1 -1
- package/dist/{layers.Dg6mexwj.js → layers.RVU_H6uS.js} +1 -1
- package/dist/{layers.DC6cvHOr.js → layers.SZFN9FKm.js} +1 -1
- package/dist/{layers.BGzaUFZD.js → layers.UNT1qzd1.js} +1 -1
- package/dist/{layers.BlJE6ZpK.js → layers.V_xsoN8K.js} +2 -2
- package/dist/{layers.CvAo09AI.js → layers.VrUXD08v.js} +1 -1
- package/dist/{layers.CEfO-rvJ.js → layers.Xkl8rP3s.js} +3 -3
- package/dist/{layers.z2CzUvpV.js → layers.Ye9pNj24.js} +1 -1
- package/dist/{layers.Db8VRVOy.js → layers._TEMZO38.js} +1 -1
- package/dist/{layers.BSUJEaun.js → layers.akRKdkA-.js} +1 -1
- package/dist/{layers.BG-yhBOs.js → layers.aoBGq5VX.js} +3 -3
- package/dist/{layers.BeFrGQIv.js → layers.cADCpzYZ.js} +4 -4
- package/dist/{layers.DKAjaI5i.js → layers.dNqRbTzt.js} +4 -4
- package/dist/{layers.Cqm9c-yD.js → layers.fHzcdU1b.js} +1 -1
- package/dist/{layers.DH4UAj3W.js → layers.ggRBsGE2.js} +1 -1
- package/dist/{layers.B_vbjBqN.js → layers.gtk1_Zb2.js} +1 -1
- package/dist/layers.iYBuyc8i.js +8 -0
- package/dist/{layers.Ch0hFSkP.js → layers.jrw0SA_r.js} +1 -1
- package/dist/{layers.B_E0_70W.js → layers.js2hd4k-.js} +1 -1
- package/dist/{layers.DgnOqAB3.js → layers.oASG8w4r.js} +1 -1
- package/dist/{layers.CBA6KQW1.js → layers.oCWE0tph.js} +6 -6
- package/dist/{layers.DZcJkjjX.js → layers.p2Zn_qfy.js} +1 -1
- package/dist/{layers.B3nqEd26.js → layers.pTNqmcpG.js} +1 -1
- package/dist/{layers.DOTM6oum.js → layers.r1vLQhL7.js} +1 -1
- package/dist/{layers.By15NuiI.js → layers.s3JW7UmE.js} +2 -2
- package/dist/{layers.CiAWUZFH.js → layers.t69kU_aF.js} +1 -1
- package/dist/{layers.6GjV1Fl2.js → layers.vDkMOGSi.js} +1 -1
- package/dist/{layers.DH0uLfFY.js → layers.zppDmomd.js} +1 -1
- package/package.json +192 -160
- package/dist/layers.7tC5EsDm.js +0 -1
- package/dist/layers.BLVz_CVV.js +0 -295
- package/dist/layers.BOlK4NIG.js +0 -28647
- package/dist/layers.BRyfu_O2.js +0 -6
- package/dist/layers.BTZ8PtY6.js +0 -1
- package/dist/layers.BaNt6HxZ.js +0 -213
- package/dist/layers.BseMgv3U.js +0 -1
- package/dist/layers.C3zpUfLi.js +0 -296
- package/dist/layers.C75B6it3.js +0 -1
- package/dist/layers.CI3CyLfR.js +0 -1
- package/dist/layers.CXWblFrY.js +0 -8
- package/dist/layers.Cdmfplqj.js +0 -76
- package/dist/layers.Cl2HiRZ8.js +0 -129
- package/dist/layers.CsrLvgX4.js +0 -1
- package/dist/layers.DB7b-L3h.js +0 -276
- package/dist/layers.MBOrWZoc.js +0 -271
- package/dist/layers.P_gm5rWf.js +0 -1
- package/dist/layers.fV5NT3eO.js +0 -1
package/dist/layers.CsrLvgX4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("react"),V=require("react-i18next"),Y=require("@lexical/react/LexicalComposerContext"),J=require("@mantine/core"),C=require("lexical"),Q=require("@layers-app/shared"),i=require("./layers.Cl2HiRZ8.js"),U=t=>{const{width:h,height:l,isLoading:g,isError:w,src:f,id:m,altText:p,imageRef:x,maxWidth:c}=t;return u.jsxs("div",{className:"media-wrapper",style:{width:h,height:l,display:"inline-flex",position:"relative"},children:[u.jsx(J.LoadingOverlay,{visible:g,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),u.jsx(X,{className:null,src:f,altText:p,imageRef:x,width:"inherit",height:"inherit",maxWidth:c||"auto",id:m})]})};function X({altText:t,className:h,imageRef:l,src:g,width:w,height:f,maxWidth:m,id:p}){const[x,c]=n.useState(!1);return u.jsx("img",{className:`${h||void 0} ${x?"":"loading"}`,src:g,alt:t,ref:l,style:{height:f,maxWidth:m,width:w},onLoad:()=>{g.includes("splash")?setTimeout(()=>{c(!0)},100):c(!0)},draggable:"false","data-id":p})}function Z({src:t,altText:h,nodeKey:l,width:g,height:w,maxWidth:f,showCaption:m,caption:p,id:x,create:c,alignment:_}){var q,k;const W=n.useRef(null),[E,I]=n.useState(!0),[s]=Y.useLexicalComposerContext(),[S,R]=n.useState(!0),[d,L]=n.useState({width:0,height:0}),{start:B,cancel:D}=i.useCancelUpload(),[H,M]=n.useState(0),{fetchUploadMedia:j,fetchDeleteMedia:$,maxFileSize:ee}=n.useContext(i.Context),N=i.mediaMap.has(t)&&(((q=i.mediaMap.get(t))==null?void 0:q.mediaNodeKeys.length)===0||((k=i.mediaMap.get(t))==null?void 0:k.mediaNodeKeys.length)===void 0||t.trim()===""),{t:b}=V.useTranslation(),[te,T]=n.useState(0);n.useEffect(()=>s.registerDecoratorListener(()=>{T(e=>e+1)}),[N]),n.useEffect(()=>{if(!t||t.startsWith("data:image/")||!t.trim()){I(!1);return}const e=new Image;e.src=t,e.onload=()=>I(!1),e.onerror=()=>{I(!1)}},[t,N]);const F=(e,a)=>{s.update(()=>{C.$setSelection(null);const o=C.$getNodeByKey(l);i.$isImageNode(o)&&o.setWidthAndHeight(e,a)})},{historyState:O}=i.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:P}}=i.useSettings(),[v,y]=n.useState(!1);function G(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function K(e){return new Promise((a,o)=>{if(G(e)){a(0);return}const r=new Image;r.src=e,r.onload=()=>{a(r.width)},r.onerror=()=>{o(new Error("Failed to load image"))}})}n.useEffect(()=>{c&&y(!0)},[c]),n.useEffect(()=>{let e=g,a=w,o=100;(t.includes("unsplash")?t.trim():!N&&t.trim()||t.includes("upload-src-editor"))&&t!=="upload"&&K(t).then(r=>{typeof e=="number"&&e<o&&r<o?(R(!0),L({width:e,height:a})):r<o?(R(!0),L({width:"auto",height:"auto"})):(L({width:r,height:r}),R(!1))}).catch(r=>{console.warn("Ошибка при загрузке изображения:",r.message)})},[t,N]),n.useEffect(()=>{d.width&&d.height&&S&&s.update(()=>{const e=C.$getNodeByKey(l);i.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,S]),n.useEffect(()=>(v?i.blockScroll(s.getRootElement()):i.unblockScroll(s.getRootElement()),()=>{i.unblockScroll(s.getRootElement())}),[v,s]),n.useEffect(()=>s.registerCommand(i.UPLOAD_IMAGE_COMMAND,e=>(t==="upload"&&A(e),!1),C.COMMAND_PRIORITY_LOW),[t,E]);const z=(e,a)=>{I(!1),s.update(()=>{const o=C.$getNodeByKey(l);i.$isImageNode(o)&&(o.setSrc(e),o.setId(a))})},A=e=>{I(!0);const a=B();j&&j(e[0],(o,r)=>{z(o,r),M(0)},o=>{o&&Q.showErrorNotification({message:b("editor.gallery.errorFile")}),M(0),z("","")},a,o=>{M(o)})};return!t||t==="upload"?u.jsx(i.ImagePicker,{uploading:!1,onUpload:e=>{!j||!e.length||(A(e),y(!1))},popoverProps:{opened:v,position:"bottom",onChange:y},onChange:e=>{y(!1),s.update(()=>{const a=C.$getNodeByKey(l);i.$isImageNode(a)&&a.setSrc(e)})},children:u.jsx(i.EmptyNodeButton,{title:b("editor.image.add_photo"),icon:"photo",onClick:()=>y(!v),isLoading:E,progress:H,onAfterCancel:()=>{D(),I(!1)}})}):S?u.jsx(U,{width:d.width,height:d.height,isLoading:E,isError:!1,isIcon:S,src:t,id:x,editor:s,nodeKey:l,fetchDeleteMedia:$,altText:h,imageRef:W,maxWidth:f,showCaption:m,caption:p,isCollabActive:!1,historyState:O,showNestedEditorTreeView:P,t:b}):u.jsx(i.ResizableContainer,{editor:s,isIcon:S,width:i.parseContainerSize(g),height:i.parseContainerSize(w),initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:F,alignment:_,children:u.jsx(U,{width:"inherit",height:"inherit",isLoading:E,isError:!1,isIcon:S,src:t,id:x,editor:s,nodeKey:l,fetchDeleteMedia:$,altText:h,imageRef:W,maxWidth:f,showCaption:m,caption:p,isCollabActive:!1,historyState:O,showNestedEditorTreeView:P,t:b})})}exports.default=Z;
|
package/dist/layers.DB7b-L3h.js
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { jsxs as E, Fragment as T, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as N, useEffect as d, useState as C, useCallback as f } from "react";
|
|
3
|
-
import { createPortal as U } from "react-dom";
|
|
4
|
-
import { h as P, d as S, c as $, i as V, H as X, j as Y, O as J } from "./layers.BOlK4NIG.js";
|
|
5
|
-
import { useLexicalComposerContext as W } from "@lexical/react/LexicalComposerContext";
|
|
6
|
-
import { LexicalErrorBoundary as _ } from "@lexical/react/LexicalErrorBoundary";
|
|
7
|
-
import { useLexicalEditable as Z } from "@lexical/react/useLexicalEditable";
|
|
8
|
-
import { Textarea as K, Group as ee, Button as H } from "@mantine/core";
|
|
9
|
-
import { $getNodeByKey as v, COMMAND_PRIORITY_EDITOR as te } from "lexical";
|
|
10
|
-
import ne from "./layers.b9B2NY7n.js";
|
|
11
|
-
function w({
|
|
12
|
-
equation: r,
|
|
13
|
-
inline: a,
|
|
14
|
-
onDoubleClick: s
|
|
15
|
-
}) {
|
|
16
|
-
const n = N(null);
|
|
17
|
-
return d(() => {
|
|
18
|
-
const l = n.current;
|
|
19
|
-
l !== null && ne.render(r, l, {
|
|
20
|
-
displayMode: !a,
|
|
21
|
-
errorColor: "#cc0000",
|
|
22
|
-
output: "html",
|
|
23
|
-
strict: "warn",
|
|
24
|
-
throwOnError: !1,
|
|
25
|
-
trust: !1
|
|
26
|
-
});
|
|
27
|
-
}, [r, a]), /* @__PURE__ */ E(T, { children: [
|
|
28
|
-
/* @__PURE__ */ o(
|
|
29
|
-
"img",
|
|
30
|
-
{
|
|
31
|
-
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
32
|
-
width: 0,
|
|
33
|
-
height: 0,
|
|
34
|
-
alt: ""
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
/* @__PURE__ */ o(
|
|
38
|
-
"span",
|
|
39
|
-
{
|
|
40
|
-
role: "button",
|
|
41
|
-
tabIndex: -1,
|
|
42
|
-
onDoubleClick: s,
|
|
43
|
-
ref: n
|
|
44
|
-
}
|
|
45
|
-
),
|
|
46
|
-
/* @__PURE__ */ o(
|
|
47
|
-
"img",
|
|
48
|
-
{
|
|
49
|
-
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
50
|
-
width: 0,
|
|
51
|
-
height: 0,
|
|
52
|
-
alt: ""
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
] });
|
|
56
|
-
}
|
|
57
|
-
let M = !1;
|
|
58
|
-
const I = /* @__PURE__ */ new Map();
|
|
59
|
-
function oe(r) {
|
|
60
|
-
M || (M = !0, r.registerCommand(
|
|
61
|
-
J,
|
|
62
|
-
(a) => {
|
|
63
|
-
const s = I.get(a);
|
|
64
|
-
return s ? (s(), !0) : !1;
|
|
65
|
-
},
|
|
66
|
-
te
|
|
67
|
-
));
|
|
68
|
-
}
|
|
69
|
-
function pe({
|
|
70
|
-
equation: r,
|
|
71
|
-
inline: a,
|
|
72
|
-
nodeKey: s
|
|
73
|
-
}) {
|
|
74
|
-
const [n] = W(), l = Z(), p = N(null), B = N(null), [m, x] = C(r), [c, u] = C(!1), [O, j] = C({ top: 0, left: 0 }), [F, D] = C(!1), b = f(() => {
|
|
75
|
-
const e = p.current;
|
|
76
|
-
if (!e) return;
|
|
77
|
-
const i = (e.closest(
|
|
78
|
-
".editor-equation"
|
|
79
|
-
) || e).getBoundingClientRect();
|
|
80
|
-
j({
|
|
81
|
-
top: i.bottom + 18,
|
|
82
|
-
left: i.left
|
|
83
|
-
}), D(!0);
|
|
84
|
-
}, []);
|
|
85
|
-
d(() => {
|
|
86
|
-
oe(n);
|
|
87
|
-
}, [n]), d(() => {
|
|
88
|
-
const e = () => {
|
|
89
|
-
l && u(!0);
|
|
90
|
-
};
|
|
91
|
-
return I.set(s, e), () => {
|
|
92
|
-
I.delete(s);
|
|
93
|
-
};
|
|
94
|
-
}, [l, s]);
|
|
95
|
-
const A = f(() => {
|
|
96
|
-
if (l) {
|
|
97
|
-
if (c) {
|
|
98
|
-
u(!1);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
b(), u(!0);
|
|
102
|
-
}
|
|
103
|
-
}, [l, c, b]), k = f(() => {
|
|
104
|
-
const e = m.trim();
|
|
105
|
-
n.update(() => {
|
|
106
|
-
const t = v(s);
|
|
107
|
-
if (P(t)) {
|
|
108
|
-
if (t.isInline && t.isInline() && e === "") {
|
|
109
|
-
t.remove();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
t.setEquation(e);
|
|
113
|
-
}
|
|
114
|
-
}), u(!1);
|
|
115
|
-
}, [n, s, m]), q = f(() => {
|
|
116
|
-
if (!r && a) {
|
|
117
|
-
n.update(() => {
|
|
118
|
-
const e = v(s);
|
|
119
|
-
P(e) && e.remove();
|
|
120
|
-
}), u(!1);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
x(r), r && u(!1);
|
|
124
|
-
}, [n, r, a, s]);
|
|
125
|
-
d(() => {
|
|
126
|
-
c || x(r);
|
|
127
|
-
}, [r, c]), d(() => {
|
|
128
|
-
if (!c) {
|
|
129
|
-
S(n.getRootElement()), D(!1);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
$(n.getRootElement()), b();
|
|
133
|
-
const e = window.requestAnimationFrame(() => {
|
|
134
|
-
const t = B.current;
|
|
135
|
-
if (!t) return;
|
|
136
|
-
const i = t.value.length;
|
|
137
|
-
t.focus(), t.setSelectionRange(i, i);
|
|
138
|
-
});
|
|
139
|
-
return () => {
|
|
140
|
-
window.cancelAnimationFrame(e), S(n.getRootElement());
|
|
141
|
-
};
|
|
142
|
-
}, [c, b]), d(() => {
|
|
143
|
-
if (!c) return;
|
|
144
|
-
const e = (t) => {
|
|
145
|
-
const i = t.target, g = p.current, y = document.querySelector(".equation-block__popup");
|
|
146
|
-
i && (g != null && g.contains(i) || y instanceof HTMLElement && y.contains(i)) || (a && !m.trim() && n.update(() => {
|
|
147
|
-
const L = v(s);
|
|
148
|
-
P(L) && L.remove();
|
|
149
|
-
}), u(!1));
|
|
150
|
-
};
|
|
151
|
-
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
152
|
-
}, [n, a, c, s, m]);
|
|
153
|
-
const h = (c ? m : r).trim(), R = h.length > 0;
|
|
154
|
-
d(() => {
|
|
155
|
-
const e = p.current;
|
|
156
|
-
if (!e) return;
|
|
157
|
-
const t = e.closest(".editor-equation"), i = h;
|
|
158
|
-
if (t) {
|
|
159
|
-
if (!i) {
|
|
160
|
-
t.removeAttribute("data-lexical-equation");
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
try {
|
|
164
|
-
const g = btoa(unescape(encodeURIComponent(i)));
|
|
165
|
-
t.setAttribute("data-lexical-equation", g);
|
|
166
|
-
} catch {
|
|
167
|
-
t.setAttribute("data-lexical-equation", i);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}, [h]);
|
|
171
|
-
const z = a && !l ? /* @__PURE__ */ o("span", { className: "equation-inline-trigger", children: /* @__PURE__ */ o(_, { onError: (e) => {
|
|
172
|
-
var t;
|
|
173
|
-
return (t = n._onError) == null ? void 0 : t.call(n, e);
|
|
174
|
-
}, children: /* @__PURE__ */ o(
|
|
175
|
-
w,
|
|
176
|
-
{
|
|
177
|
-
equation: r,
|
|
178
|
-
inline: a,
|
|
179
|
-
onDoubleClick: A
|
|
180
|
-
}
|
|
181
|
-
) }) }) : a ? /* @__PURE__ */ o(
|
|
182
|
-
"span",
|
|
183
|
-
{
|
|
184
|
-
className: `equation-inline-trigger${R ? "" : " equation-inline-trigger--empty"}`,
|
|
185
|
-
onClick: A,
|
|
186
|
-
ref: p,
|
|
187
|
-
children: R ? /* @__PURE__ */ o(_, { onError: (e) => {
|
|
188
|
-
var t;
|
|
189
|
-
return (t = n._onError) == null ? void 0 : t.call(n, e);
|
|
190
|
-
}, children: /* @__PURE__ */ o(
|
|
191
|
-
w,
|
|
192
|
-
{
|
|
193
|
-
equation: h,
|
|
194
|
-
inline: a,
|
|
195
|
-
onDoubleClick: A
|
|
196
|
-
}
|
|
197
|
-
) }) : /* @__PURE__ */ E("span", { className: "equation-inline-placeholder", children: [
|
|
198
|
-
/* @__PURE__ */ o(X, { icon: Y, size: 24 }),
|
|
199
|
-
/* @__PURE__ */ o("span", { children: "New equation" })
|
|
200
|
-
] })
|
|
201
|
-
}
|
|
202
|
-
) : /* @__PURE__ */ o("div", { className: "equation-block", ref: p, children: /* @__PURE__ */ o(
|
|
203
|
-
"div",
|
|
204
|
-
{
|
|
205
|
-
className: "equation-block__container",
|
|
206
|
-
onClick: A,
|
|
207
|
-
style: { cursor: l ? "pointer" : "default" },
|
|
208
|
-
children: R ? /* @__PURE__ */ o(_, { onError: (e) => {
|
|
209
|
-
var t;
|
|
210
|
-
return (t = n._onError) == null ? void 0 : t.call(n, e);
|
|
211
|
-
}, children: /* @__PURE__ */ o(
|
|
212
|
-
w,
|
|
213
|
-
{
|
|
214
|
-
equation: h,
|
|
215
|
-
inline: a,
|
|
216
|
-
onDoubleClick: A
|
|
217
|
-
}
|
|
218
|
-
) }) : /* @__PURE__ */ o("div", { className: "equation-block__placeholder", children: "Add a TeX equation" })
|
|
219
|
-
}
|
|
220
|
-
) }), G = f(
|
|
221
|
-
(e) => {
|
|
222
|
-
e.stopPropagation(), x(e.currentTarget.value);
|
|
223
|
-
},
|
|
224
|
-
[]
|
|
225
|
-
), Q = f(
|
|
226
|
-
V({
|
|
227
|
-
onConfirm: k,
|
|
228
|
-
onCancel: q
|
|
229
|
-
}),
|
|
230
|
-
[k, q]
|
|
231
|
-
);
|
|
232
|
-
return /* @__PURE__ */ E(T, { children: [
|
|
233
|
-
z,
|
|
234
|
-
c && F && U(
|
|
235
|
-
/* @__PURE__ */ o(
|
|
236
|
-
"div",
|
|
237
|
-
{
|
|
238
|
-
className: "equation-block__popup",
|
|
239
|
-
style: {
|
|
240
|
-
position: "fixed",
|
|
241
|
-
top: O.top,
|
|
242
|
-
left: O.left,
|
|
243
|
-
zIndex: 400
|
|
244
|
-
},
|
|
245
|
-
children: /* @__PURE__ */ E("div", { className: "equation-block__editor", children: [
|
|
246
|
-
/* @__PURE__ */ o(
|
|
247
|
-
K,
|
|
248
|
-
{
|
|
249
|
-
autosize: !0,
|
|
250
|
-
minRows: 2,
|
|
251
|
-
variant: "unstyled",
|
|
252
|
-
value: m,
|
|
253
|
-
onChange: G,
|
|
254
|
-
onKeyDown: Q,
|
|
255
|
-
placeholder: "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",
|
|
256
|
-
classNames: {
|
|
257
|
-
wrapper: "equation-block__textarea-wrapper"
|
|
258
|
-
},
|
|
259
|
-
autoFocus: !0,
|
|
260
|
-
ref: B
|
|
261
|
-
}
|
|
262
|
-
),
|
|
263
|
-
/* @__PURE__ */ E(ee, { justify: "flex-end", gap: "sm", children: [
|
|
264
|
-
/* @__PURE__ */ o(H, { variant: "subtle", color: "gray", onClick: q, children: "Cancel" }),
|
|
265
|
-
/* @__PURE__ */ o(H, { onClick: k, children: "Save" })
|
|
266
|
-
] })
|
|
267
|
-
] })
|
|
268
|
-
}
|
|
269
|
-
),
|
|
270
|
-
document.body
|
|
271
|
-
)
|
|
272
|
-
] });
|
|
273
|
-
}
|
|
274
|
-
export {
|
|
275
|
-
pe as default
|
|
276
|
-
};
|
package/dist/layers.MBOrWZoc.js
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as p, Fragment as k } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as b, useState as S, useCallback as M, useEffect as F, Suspense as $ } from "react";
|
|
3
|
-
import { useLexicalComposerContext as Y } from "@lexical/react/LexicalComposerContext";
|
|
4
|
-
import { LexicalErrorBoundary as K } from "@lexical/react/LexicalErrorBoundary";
|
|
5
|
-
import { LexicalNestedComposer as U } from "@lexical/react/LexicalNestedComposer";
|
|
6
|
-
import { RichTextPlugin as j } from "@lexical/react/LexicalRichTextPlugin";
|
|
7
|
-
import { useLexicalNodeSelection as G } from "@lexical/react/useLexicalNodeSelection";
|
|
8
|
-
import { mergeRegister as z } from "@lexical/utils";
|
|
9
|
-
import { $isNodeSelection as A, $getSelection as v, $getNodeByKey as w, $setSelection as O, SELECTION_CHANGE_COMMAND as H, COMMAND_PRIORITY_LOW as g, CLICK_COMMAND as W, DRAGSTART_COMMAND as q, KEY_DELETE_COMMAND as J, KEY_BACKSPACE_COMMAND as Q, KEY_ENTER_COMMAND as V, KEY_ESCAPE_COMMAND as X } from "lexical";
|
|
10
|
-
import { r as Z, s as ee, L as te, F as ne, t as oe, B as re } from "./layers.BOlK4NIG.js";
|
|
11
|
-
import { TextInput as ae } from "@mantine/core";
|
|
12
|
-
function le({
|
|
13
|
-
children: t,
|
|
14
|
-
className: a
|
|
15
|
-
}) {
|
|
16
|
-
return /* @__PURE__ */ e("div", { className: a || "Placeholder__root", children: t });
|
|
17
|
-
}
|
|
18
|
-
function ie({
|
|
19
|
-
label: t,
|
|
20
|
-
value: a,
|
|
21
|
-
onChange: n,
|
|
22
|
-
placeholder: f = "",
|
|
23
|
-
"data-test-id": l,
|
|
24
|
-
type: c = "text"
|
|
25
|
-
}) {
|
|
26
|
-
return /* @__PURE__ */ e(
|
|
27
|
-
ae,
|
|
28
|
-
{
|
|
29
|
-
type: c,
|
|
30
|
-
placeholder: f,
|
|
31
|
-
value: a,
|
|
32
|
-
onChange: (i) => {
|
|
33
|
-
n(i.target.value);
|
|
34
|
-
},
|
|
35
|
-
label: t,
|
|
36
|
-
"data-test-id": l,
|
|
37
|
-
mb: 10
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
const P = /* @__PURE__ */ new Set();
|
|
42
|
-
function se(t) {
|
|
43
|
-
if (!P.has(t))
|
|
44
|
-
throw new Promise((a) => {
|
|
45
|
-
const n = new Image();
|
|
46
|
-
n.src = t, n.onload = () => {
|
|
47
|
-
P.add(t), a(null);
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function ce({
|
|
52
|
-
altText: t,
|
|
53
|
-
className: a,
|
|
54
|
-
imageRef: n,
|
|
55
|
-
src: f,
|
|
56
|
-
width: l,
|
|
57
|
-
height: c,
|
|
58
|
-
position: i
|
|
59
|
-
}) {
|
|
60
|
-
return se(f), /* @__PURE__ */ e(
|
|
61
|
-
"img",
|
|
62
|
-
{
|
|
63
|
-
className: a || void 0,
|
|
64
|
-
src: f,
|
|
65
|
-
alt: t,
|
|
66
|
-
ref: n,
|
|
67
|
-
"data-position": i,
|
|
68
|
-
style: {
|
|
69
|
-
display: "block",
|
|
70
|
-
height: c,
|
|
71
|
-
width: l
|
|
72
|
-
},
|
|
73
|
-
draggable: "false"
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
function ue({
|
|
78
|
-
activeEditor: t,
|
|
79
|
-
nodeKey: a,
|
|
80
|
-
onClose: n
|
|
81
|
-
}) {
|
|
82
|
-
const l = t.getEditorState().read(
|
|
83
|
-
() => w(a)
|
|
84
|
-
), [c, i] = S(l.getAltText()), [h, I] = S(l.getShowCaption()), [_, E] = S(l.getPosition()), C = (d) => {
|
|
85
|
-
I(d.target.checked);
|
|
86
|
-
}, u = () => {
|
|
87
|
-
const d = { altText: c, position: _, showCaption: h };
|
|
88
|
-
l && t.update(() => {
|
|
89
|
-
l.update(d);
|
|
90
|
-
}), n();
|
|
91
|
-
};
|
|
92
|
-
return /* @__PURE__ */ p(k, { children: [
|
|
93
|
-
/* @__PURE__ */ e("div", { style: { marginBottom: "1em" }, children: /* @__PURE__ */ e(
|
|
94
|
-
ie,
|
|
95
|
-
{
|
|
96
|
-
label: "Alt-текст",
|
|
97
|
-
placeholder: "Альтернативный текст",
|
|
98
|
-
onChange: i,
|
|
99
|
-
value: c,
|
|
100
|
-
"data-test-id": "image-modal-alt-text-input"
|
|
101
|
-
}
|
|
102
|
-
) }),
|
|
103
|
-
/* @__PURE__ */ p("div", { className: "Input__wrapper", children: [
|
|
104
|
-
/* @__PURE__ */ e(
|
|
105
|
-
"input",
|
|
106
|
-
{
|
|
107
|
-
id: "caption",
|
|
108
|
-
type: "checkbox",
|
|
109
|
-
checked: h,
|
|
110
|
-
onChange: C
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
/* @__PURE__ */ e("label", { htmlFor: "caption", children: "Show Caption" })
|
|
114
|
-
] }),
|
|
115
|
-
/* @__PURE__ */ e(
|
|
116
|
-
re,
|
|
117
|
-
{
|
|
118
|
-
"data-test-id": "image-modal-file-upload-btn",
|
|
119
|
-
onClick: () => u(),
|
|
120
|
-
children: "Применить"
|
|
121
|
-
}
|
|
122
|
-
)
|
|
123
|
-
] });
|
|
124
|
-
}
|
|
125
|
-
function xe({
|
|
126
|
-
src: t,
|
|
127
|
-
altText: a,
|
|
128
|
-
nodeKey: n,
|
|
129
|
-
width: f,
|
|
130
|
-
height: l,
|
|
131
|
-
showCaption: c,
|
|
132
|
-
caption: i,
|
|
133
|
-
position: h
|
|
134
|
-
}) {
|
|
135
|
-
const [I, _] = Z(), E = b(null), C = b(null), [u, d, D] = G(n), [r] = Y(), [y, B] = S(null), T = b(null), x = M(
|
|
136
|
-
(s) => {
|
|
137
|
-
if (u && A(v())) {
|
|
138
|
-
s.preventDefault();
|
|
139
|
-
const o = w(n);
|
|
140
|
-
ee(o) && o.remove();
|
|
141
|
-
}
|
|
142
|
-
return !1;
|
|
143
|
-
},
|
|
144
|
-
[u, n]
|
|
145
|
-
), L = M(
|
|
146
|
-
(s) => {
|
|
147
|
-
const m = v(), o = C.current;
|
|
148
|
-
if (u && A(m) && m.getNodes().length === 1) {
|
|
149
|
-
if (c)
|
|
150
|
-
return O(null), s.preventDefault(), i.focus(), !0;
|
|
151
|
-
if (o !== null && o !== document.activeElement)
|
|
152
|
-
return s.preventDefault(), o.focus(), !0;
|
|
153
|
-
}
|
|
154
|
-
return !1;
|
|
155
|
-
},
|
|
156
|
-
[i, u, c]
|
|
157
|
-
), R = M(
|
|
158
|
-
(s) => T.current === i || C.current === s.target ? (O(null), r.update(() => {
|
|
159
|
-
d(!0);
|
|
160
|
-
const m = r.getRootElement();
|
|
161
|
-
m !== null && m.focus();
|
|
162
|
-
}), !0) : !1,
|
|
163
|
-
[i, r, d]
|
|
164
|
-
);
|
|
165
|
-
return F(() => {
|
|
166
|
-
let s = !0;
|
|
167
|
-
const m = z(
|
|
168
|
-
r.registerUpdateListener(({ editorState: o }) => {
|
|
169
|
-
s && B(o.read(() => v()));
|
|
170
|
-
}),
|
|
171
|
-
r.registerCommand(
|
|
172
|
-
H,
|
|
173
|
-
(o, N) => (T.current = N, !1),
|
|
174
|
-
g
|
|
175
|
-
),
|
|
176
|
-
r.registerCommand(
|
|
177
|
-
W,
|
|
178
|
-
(o) => {
|
|
179
|
-
const N = o;
|
|
180
|
-
return N.target === E.current ? (N.shiftKey ? d(!u) : (D(), d(!0)), !0) : !1;
|
|
181
|
-
},
|
|
182
|
-
g
|
|
183
|
-
),
|
|
184
|
-
r.registerCommand(
|
|
185
|
-
q,
|
|
186
|
-
(o) => o.target === E.current ? (o.preventDefault(), !0) : !1,
|
|
187
|
-
g
|
|
188
|
-
),
|
|
189
|
-
r.registerCommand(
|
|
190
|
-
J,
|
|
191
|
-
x,
|
|
192
|
-
g
|
|
193
|
-
),
|
|
194
|
-
r.registerCommand(
|
|
195
|
-
Q,
|
|
196
|
-
x,
|
|
197
|
-
g
|
|
198
|
-
),
|
|
199
|
-
r.registerCommand(V, L, g),
|
|
200
|
-
r.registerCommand(
|
|
201
|
-
X,
|
|
202
|
-
R,
|
|
203
|
-
g
|
|
204
|
-
)
|
|
205
|
-
);
|
|
206
|
-
return () => {
|
|
207
|
-
s = !1, m();
|
|
208
|
-
};
|
|
209
|
-
}, [
|
|
210
|
-
D,
|
|
211
|
-
r,
|
|
212
|
-
u,
|
|
213
|
-
n,
|
|
214
|
-
x,
|
|
215
|
-
L,
|
|
216
|
-
R,
|
|
217
|
-
d
|
|
218
|
-
]), /* @__PURE__ */ p($, { fallback: null, children: [
|
|
219
|
-
/* @__PURE__ */ p(k, { children: [
|
|
220
|
-
/* @__PURE__ */ p("div", { draggable: !1, children: [
|
|
221
|
-
/* @__PURE__ */ e(
|
|
222
|
-
"button",
|
|
223
|
-
{
|
|
224
|
-
className: "image-edit-button",
|
|
225
|
-
ref: C,
|
|
226
|
-
onClick: () => {
|
|
227
|
-
_("Update Inline Image", (s) => /* @__PURE__ */ e(
|
|
228
|
-
ue,
|
|
229
|
-
{
|
|
230
|
-
activeEditor: r,
|
|
231
|
-
nodeKey: n,
|
|
232
|
-
onClose: s
|
|
233
|
-
}
|
|
234
|
-
));
|
|
235
|
-
},
|
|
236
|
-
children: "Edit"
|
|
237
|
-
}
|
|
238
|
-
),
|
|
239
|
-
/* @__PURE__ */ e(
|
|
240
|
-
ce,
|
|
241
|
-
{
|
|
242
|
-
className: u ? `focused ${A(y) ? "draggable" : ""}` : null,
|
|
243
|
-
src: t,
|
|
244
|
-
altText: a,
|
|
245
|
-
imageRef: E,
|
|
246
|
-
width: f,
|
|
247
|
-
height: l,
|
|
248
|
-
position: h
|
|
249
|
-
}
|
|
250
|
-
)
|
|
251
|
-
] }),
|
|
252
|
-
c && /* @__PURE__ */ e("div", { className: "image-caption-container", children: /* @__PURE__ */ p(U, { initialEditor: i, children: [
|
|
253
|
-
/* @__PURE__ */ e(te, {}),
|
|
254
|
-
/* @__PURE__ */ e(ne, {}),
|
|
255
|
-
/* @__PURE__ */ e(
|
|
256
|
-
j,
|
|
257
|
-
{
|
|
258
|
-
contentEditable: /* @__PURE__ */ e(oe, { className: "InlineImageNode__contentEditable" }),
|
|
259
|
-
placeholder: /* @__PURE__ */ e(le, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
|
|
260
|
-
ErrorBoundary: K
|
|
261
|
-
}
|
|
262
|
-
)
|
|
263
|
-
] }) })
|
|
264
|
-
] }),
|
|
265
|
-
I
|
|
266
|
-
] });
|
|
267
|
-
}
|
|
268
|
-
export {
|
|
269
|
-
ue as UpdateInlineImageDialog,
|
|
270
|
-
xe as default
|
|
271
|
-
};
|
package/dist/layers.P_gm5rWf.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),T=require("react-dom"),u=require("./layers.Cl2HiRZ8.js"),$=require("@lexical/react/LexicalComposerContext"),R=require("@lexical/react/LexicalErrorBoundary"),H=require("@lexical/react/useLexicalEditable"),h=require("@mantine/core"),b=require("lexical"),F=require("./layers.R8mPlCA0.js");function P({equation:s,inline:a,onDoubleClick:c}){const r=o.useRef(null);return o.useEffect(()=>{const d=r.current;d!==null&&F.default.render(s,d,{displayMode:!a,errorColor:"#cc0000",output:"html",strict:"warn",throwOnError:!1,trust:!1})},[s,a]),n.jsxs(n.Fragment,{children:[n.jsx("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",width:0,height:0,alt:""}),n.jsx("span",{role:"button",tabIndex:-1,onDoubleClick:c,ref:r}),n.jsx("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",width:0,height:0,alt:""})]})}let I=!1;const N=new Map;function z(s){I||(I=!0,s.registerCommand(u.OPEN_EQUATION_POPUP_COMMAND,a=>{const c=N.get(a);return c?(c(),!0):!1},b.COMMAND_PRIORITY_EDITOR))}function G({equation:s,inline:a,nodeKey:c}){const[r]=$.useLexicalComposerContext(),d=H.useLexicalEditable(),p=o.useRef(null),_=o.useRef(null),[A,C]=o.useState(s),[l,f]=o.useState(!1),[v,L]=o.useState({top:0,left:0}),[S,y]=o.useState(!1),E=o.useCallback(()=>{const e=p.current;if(!e)return;const i=(e.closest(".editor-equation")||e).getBoundingClientRect();L({top:i.bottom+18,left:i.left}),y(!0)},[]);o.useEffect(()=>{z(r)},[r]),o.useEffect(()=>{const e=()=>{d&&f(!0)};return N.set(c,e),()=>{N.delete(c)}},[d,c]);const m=o.useCallback(()=>{if(d){if(l){f(!1);return}E(),f(!0)}},[d,l,E]),q=o.useCallback(()=>{const e=A.trim();r.update(()=>{const t=b.$getNodeByKey(c);if(u.$isEquationNode(t)){if(t.isInline&&t.isInline()&&e===""){t.remove();return}t.setEquation(e)}}),f(!1)},[r,c,A]),j=o.useCallback(()=>{if(!s&&a){r.update(()=>{const e=b.$getNodeByKey(c);u.$isEquationNode(e)&&e.remove()}),f(!1);return}C(s),s&&f(!1)},[r,s,a,c]);o.useEffect(()=>{l||C(s)},[s,l]),o.useEffect(()=>{if(!l){u.unblockScroll(r.getRootElement()),y(!1);return}u.blockScroll(r.getRootElement()),E();const e=window.requestAnimationFrame(()=>{const t=_.current;if(!t)return;const i=t.value.length;t.focus(),t.setSelectionRange(i,i)});return()=>{window.cancelAnimationFrame(e),u.unblockScroll(r.getRootElement())}},[l,E]),o.useEffect(()=>{if(!l)return;const e=t=>{const i=t.target,g=p.current,w=document.querySelector(".equation-block__popup");i&&(g!=null&&g.contains(i)||w instanceof HTMLElement&&w.contains(i))||(a&&!A.trim()&&r.update(()=>{const B=b.$getNodeByKey(c);u.$isEquationNode(B)&&B.remove()}),f(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r,a,l,c,A]);const x=(l?A:s).trim(),k=x.length>0;o.useEffect(()=>{const e=p.current;if(!e)return;const t=e.closest(".editor-equation"),i=x;if(t){if(!i){t.removeAttribute("data-lexical-equation");return}try{const g=btoa(unescape(encodeURIComponent(i)));t.setAttribute("data-lexical-equation",g)}catch{t.setAttribute("data-lexical-equation",i)}}},[x]);const O=a&&!d?n.jsx("span",{className:"equation-inline-trigger",children:n.jsx(R.LexicalErrorBoundary,{onError:e=>{var t;return(t=r._onError)==null?void 0:t.call(r,e)},children:n.jsx(P,{equation:s,inline:a,onDoubleClick:m})})}):a?n.jsx("span",{className:`equation-inline-trigger${k?"":" equation-inline-trigger--empty"}`,onClick:m,ref:p,children:k?n.jsx(R.LexicalErrorBoundary,{onError:e=>{var t;return(t=r._onError)==null?void 0:t.call(r,e)},children:n.jsx(P,{equation:x,inline:a,onDoubleClick:m})}):n.jsxs("span",{className:"equation-inline-placeholder",children:[n.jsx(u.HugeiconsIcon,{icon:u.c4,size:24}),n.jsx("span",{children:"New equation"})]})}):n.jsx("div",{className:"equation-block",ref:p,children:n.jsx("div",{className:"equation-block__container",onClick:m,style:{cursor:d?"pointer":"default"},children:k?n.jsx(R.LexicalErrorBoundary,{onError:e=>{var t;return(t=r._onError)==null?void 0:t.call(r,e)},children:n.jsx(P,{equation:x,inline:a,onDoubleClick:m})}):n.jsx("div",{className:"equation-block__placeholder",children:"Add a TeX equation"})})}),D=o.useCallback(e=>{e.stopPropagation(),C(e.currentTarget.value)},[]),M=o.useCallback(u.createPopupKeyDownHandler({onConfirm:q,onCancel:j}),[q,j]);return n.jsxs(n.Fragment,{children:[O,l&&S&&T.createPortal(n.jsx("div",{className:"equation-block__popup",style:{position:"fixed",top:v.top,left:v.left,zIndex:400},children:n.jsxs("div",{className:"equation-block__editor",children:[n.jsx(h.Textarea,{autosize:!0,minRows:2,variant:"unstyled",value:A,onChange:D,onKeyDown:M,placeholder:"x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",classNames:{wrapper:"equation-block__textarea-wrapper"},autoFocus:!0,ref:_}),n.jsxs(h.Group,{justify:"flex-end",gap:"sm",children:[n.jsx(h.Button,{variant:"subtle",color:"gray",onClick:j,children:"Cancel"}),n.jsx(h.Button,{onClick:q,children:"Save"})]})]})}),document.body)]})}exports.default=G;
|
package/dist/layers.fV5NT3eO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./layers.BJz_j8RM.js");require("./layers.BpZCX031.js");exports.Commands=e.CB;exports.subsetToBase64=e.QB;exports.subsetToBinary=e.NQ;exports.toBase64=e.AI;
|