@layers-app/editor 2.2.25 → 2.2.27
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 +3 -5
- package/dist/index.js +2 -2
- package/dist/{layers.B_ud246t.js → layers.-dgpQp6-.js} +1 -1
- package/dist/{layers.BDo-LBaQ.js → layers.00FRH_NP.js} +3 -3
- package/dist/{layers.BTX2MNmu.js → layers.0D0M44_z.js} +1 -1
- package/dist/{layers.CVfCmQnt.js → layers.3ilWp83P.js} +1 -1
- package/dist/{layers.B4zknvXn.js → layers.41JWzypW.js} +1 -1
- package/dist/{layers.WnUr7AGc.js → layers.4C-a3sJU.js} +1 -1
- package/dist/{layers.BWq2O7t2.js → layers.6wkGIYdl.js} +1 -1
- package/dist/{layers._S7wKYby.js → layers.8F2P4REJ.js} +3 -3
- package/dist/{layers.BLsSCM5J.js → layers.9gqwZt8B.js} +1 -1
- package/dist/{layers.D3WKhHJY.js → layers.B-MJfoKp.js} +2 -2
- package/dist/{layers.DILXo1pG.js → layers.B11lvU6v.js} +1 -1
- package/dist/{layers.5SeyPnRU.js → layers.B16EP8ch.js} +1 -1
- package/dist/{layers.CGLiuYbD.js → layers.B1ia9-z4.js} +1 -1
- package/dist/{layers.DoFvQ_of.js → layers.B2k3fNCz.js} +1 -1
- package/dist/{layers.D6bDtboM.js → layers.B3TA635P.js} +8 -8
- package/dist/{layers.BNstAFLH.js → layers.B4BvJOgu.js} +1 -1
- package/dist/{layers.CA0pv9FQ.js → layers.B5hNxZzH.js} +2 -2
- package/dist/{layers.BHToj767.js → layers.B6SYcxJz.js} +1 -1
- package/dist/{layers.Cz8aLAaf.js → layers.B7Rf9GZC.js} +1 -1
- package/dist/{layers.CSKuOJHo.js → layers.B824PCWn.js} +2 -2
- package/dist/{layers.zVfsxCEL.js → layers.B8g6r_yw.js} +1 -1
- package/dist/layers.B8h-xT5A.js +1 -0
- package/dist/{layers.Dx-sJPph.js → layers.BC_4sJhq.js} +1 -1
- package/dist/{layers.BhnYIeJ8.js → layers.BCfbt_Lw.js} +1 -1
- package/dist/{layers.DUiqxrmC.js → layers.BD_677p3.js} +25 -25
- package/dist/layers.BDmyxa66.js +904 -0
- package/dist/{layers.BMFHg6iN.js → layers.BEXqWBHV.js} +1 -1
- package/dist/{layers.qxE0C0lP.js → layers.BIk8wfHG.js} +3 -3
- package/dist/{layers.BuuEB_Nq.js → layers.BIq1D-Xx.js} +1 -1
- package/dist/{layers.qXYhQzON.js → layers.BMVq8Y4f.js} +1 -1
- package/dist/{layers.CgiuApBK.js → layers.BNAvwkNY.js} +1 -1
- package/dist/{layers.DaVsPncw.js → layers.BNKBnIIM.js} +1 -1
- package/dist/{layers.DbTr1tHi.js → layers.BPQQDzHP.js} +1 -1
- package/dist/{layers.G1pQ-zwc.js → layers.BPV31WTw.js} +1 -1
- package/dist/{layers.cqSVs8Ve.js → layers.BQ976BdX.js} +1 -1
- package/dist/{layers.BH0dia_m.js → layers.BSAZM7jm.js} +3 -3
- package/dist/layers.BSYaI4oC.js +8 -0
- package/dist/{layers.lLPsS2lk.js → layers.BTArST3u.js} +1 -1
- package/dist/{layers.DuqqwzyC.js → layers.BTD4y3o8.js} +1 -1
- package/dist/{layers.COSJ-uNv.js → layers.BTQunTk2.js} +1 -1
- package/dist/{layers.BIY-fe97.js → layers.BU7FjeIH.js} +1 -1
- package/dist/layers.BVKe86fX.js +6 -0
- package/dist/{layers.DpWr-n2e.js → layers.BX4xHwVQ.js} +1 -1
- package/dist/{layers.B0KEM0_j.js → layers.BXherxrB.js} +1 -1
- package/dist/{layers.Dx1TRJYs.js → layers.BY8ursXf.js} +4 -4
- package/dist/{layers.BJ1OtisQ.js → layers.B_G6yZZl.js} +1 -1
- package/dist/{layers.CxEOxWM2.js → layers.BcSyFV0V.js} +1 -1
- package/dist/{layers.3gNsNe7K.js → layers.BdPrAJCx.js} +1 -1
- package/dist/{layers.Q1epHSd2.js → layers.Be9E9spi.js} +1 -1
- package/dist/{layers.D0nVjv6P.js → layers.Bfv7EFx1.js} +1 -1
- package/dist/{layers.Ck8MNmPH.js → layers.BfwrwrAo.js} +1 -1
- package/dist/layers.BhuZQmNW.js +1 -0
- package/dist/{layers.CABTuJVI.js → layers.BjToXDay.js} +1 -1
- package/dist/{layers.DGxsSYvu.js → layers.BlMhmtmL.js} +4 -4
- package/dist/{layers.VDvTgOKr.js → layers.BmTGHHYj.js} +4 -4
- package/dist/{layers.BRt32cSS.js → layers.BoBLiM9t.js} +1 -1
- package/dist/{layers.VUMNu9AH.js → layers.BqHANlMn.js} +1 -1
- package/dist/{layers.B-YxHXKV.js → layers.Bqe6NRi8.js} +1 -1
- package/dist/{layers.DX6BDaRc.js → layers.BqkO58Fi.js} +3 -3
- package/dist/{layers.ClrZnPHC.js → layers.BrUQDGTv.js} +1 -1
- package/dist/{layers.OqMl3XQp.js → layers.BsqiIiG1.js} +1 -1
- package/dist/{layers.CvDCfIeP.js → layers.Btvr50tQ.js} +3 -3
- package/dist/{layers.DUaVPJPE.js → layers.Bwbz1yyF.js} +1 -1
- package/dist/{layers.C7PcZ0D5.js → layers.BxZ3cMnu.js} +1 -1
- package/dist/{layers.BtQ4aSt-.js → layers.ByEQoFcB.js} +1 -1
- package/dist/{layers.BjXsP3z0.js → layers.BzVfXhKp.js} +1 -1
- package/dist/{layers.QY4kpRnA.js → layers.BztPQciL.js} +1 -1
- package/dist/{layers.B5FO4NxA.js → layers.C-UpVEnt.js} +1 -1
- package/dist/{layers.CMzXtIaN.js → layers.C0o0U5lx.js} +1 -1
- package/dist/{layers.D2BjrQcp.js → layers.C3DogXGT.js} +1 -1
- package/dist/{layers.DxWNS5iF.js → layers.C3KVcSov.js} +1 -1
- package/dist/{layers.CS0mGl9I.js → layers.C3ZMMACc.js} +1 -1
- package/dist/{layers.sDPXR5cz.js → layers.C5AnS74F.js} +1 -1
- package/dist/{layers.B712MYcj.js → layers.C5x1fzBE.js} +1 -1
- package/dist/{layers.DLCNM-7H.js → layers.CAOVukXd.js} +1 -1
- package/dist/{layers.BH_QpRYt.js → layers.CCwWC1zR.js} +1 -1
- package/dist/{layers.DePzFtVT.js → layers.CEPCrdUZ.js} +1 -1
- package/dist/{layers.DvYC10ji.js → layers.CHSlR0Cr.js} +1 -1
- package/dist/{layers.BrF1N5DM.js → layers.CHjN09D7.js} +1 -1
- package/dist/{layers.D-0DzCF8.js → layers.CKDa7hUe.js} +1 -1
- package/dist/{layers.IHUrBJoR.js → layers.CL2jWZ31.js} +1 -1
- package/dist/{layers.CHnP7Hr1.js → layers.CM1iAfME.js} +1 -1
- package/dist/{layers.K2Lh2or9.js → layers.CMLocNAN.js} +1 -1
- package/dist/{layers.DISJ1J5o.js → layers.CNf98U1h.js} +1 -1
- package/dist/{layers.DScbZL7t.js → layers.COEsCLT_.js} +1 -1
- package/dist/{layers.DPUnFRkt.js → layers.CPP_66kl.js} +1 -1
- package/dist/{layers.A-KIGt9n.js → layers.CVMEvRWd.js} +1 -1
- package/dist/{layers.Dp0GDgbc.js → layers.CW-aONFA.js} +1 -1
- package/dist/{layers.DnegRgVw.js → layers.CXkk710x.js} +1 -1
- package/dist/{layers.VwgKc6vX.js → layers.CYeb1P6w.js} +3 -3
- package/dist/{layers.D2fqgjzq.js → layers.CZmXZE1U.js} +1 -1
- package/dist/{layers.Cfs76Bac.js → layers.CZtpTBP6.js} +2 -2
- package/dist/{layers.DR7Yk7ay.js → layers.CZwif9Vv.js} +1 -1
- package/dist/{layers.DgQkDT56.js → layers.Ca6mZxrH.js} +1 -1
- package/dist/{layers.CPZm_lF3.js → layers.Cav_tIYR.js} +1 -1
- package/dist/{layers.CQC7v3v0.js → layers.CefovRfq.js} +1 -1
- package/dist/{layers.BgR5pKhh.js → layers.CgPh4aJF.js} +1 -1
- package/dist/{layers.BFeAcSo5.js → layers.Ch3NxlAb.js} +2 -2
- package/dist/{layers.CHRqq4dB.js → layers.ChTR7k10.js} +1 -1
- package/dist/{layers.KxfSlDZD.js → layers.Cj6i_GQl.js} +1 -1
- package/dist/{layers.BrtQpGZk.js → layers.CmG-hmEk.js} +1 -1
- package/dist/{layers.6b6pjdKf.js → layers.CmMNQzO6.js} +1 -1
- package/dist/{layers.DFrY-4gb.js → layers.Cmq3n1_g.js} +1 -1
- package/dist/{layers.D-iy-iA3.js → layers.CnVK3XtZ.js} +1 -1
- package/dist/{layers.D3l1ZyHH.js → layers.CoYcDTPP.js} +1 -1
- package/dist/{layers.Bl_b6_nd.js → layers.CocjdSg4.js} +1 -1
- package/dist/{layers.KPmBc_WW.js → layers.CtYbB-F6.js} +1 -1
- package/dist/{layers.BHrfhuVg.js → layers.CwCl7p-6.js} +1 -1
- package/dist/{layers.Cp_hfA6G.js → layers.CxJEm4_v.js} +7 -7
- package/dist/{layers.Bsqs-sMQ.js → layers.D-8ueD2W.js} +1 -1
- package/dist/{layers.CzrADXjC.js → layers.D-Q0JjZX.js} +4 -4
- package/dist/{layers.Y6nWTmKQ.js → layers.D19UblAW.js} +1 -1
- package/dist/{layers.BM69qyGz.js → layers.D1GVU4At.js} +4 -4
- package/dist/{layers.7nP33gDZ.js → layers.D2-Iq5V-.js} +1 -1
- package/dist/{layers.iICyhCJl.js → layers.D3XP_g04.js} +1 -1
- package/dist/{layers.s5tsc7Fy.js → layers.D3r5p88U.js} +1 -1
- package/dist/{layers.cdkqVt2D.js → layers.D4x6smKe.js} +4 -4
- package/dist/{layers.CMhQ5e5U.js → layers.D6Gids1T.js} +1 -1
- package/dist/{layers.CrJVEP1A.js → layers.D7MGrTVm.js} +1 -1
- package/dist/{layers.D6pFTUCV.js → layers.D8LxTYV2.js} +1 -1
- package/dist/{layers.DB2sIWI4.js → layers.D8tH6wSI.js} +1 -1
- package/dist/{layers.CuVTI700.js → layers.D9m-hfIE.js} +3 -3
- package/dist/{layers.GtmpICs8.js → layers.D9zYYHES.js} +1 -1
- package/dist/{layers.Ckzn5j33.js → layers.DCWabxE-.js} +1 -1
- package/dist/{layers.Bg-FikPJ.js → layers.DClCqOww.js} +1 -1
- package/dist/{layers.C2l2KpY4.js → layers.DES3cGKg.js} +1 -1
- package/dist/{layers.B6zsiVjS.js → layers.DEXMmpzr.js} +4 -4
- package/dist/{layers.9UOuHsFv.js → layers.DHMTcXW6.js} +1 -1
- package/dist/{layers.B8dg0DHs.js → layers.DLR5MtIp.js} +1 -1
- package/dist/{layers.CqiVEoco.js → layers.DNbylp_J.js} +5 -5
- package/dist/{layers.CMFZ5Ffh.js → layers.DOW0FQFC.js} +1 -1
- package/dist/{layers.CAsf4sVS.js → layers.DQNz5kHs.js} +1 -1
- package/dist/{layers.CA1mpHy-.js → layers.DR66m3f8.js} +1 -1
- package/dist/{layers.CHxf5IPU.js → layers.DRBL5ik1.js} +1 -1
- package/dist/{layers.B4WRgsAz.js → layers.DRpzf_ir.js} +1 -1
- package/dist/{layers.B545UBEr.js → layers.DVILB492.js} +1 -1
- package/dist/{layers.B4zGHwZL.js → layers.DWay28DD.js} +1 -1
- package/dist/{layers.sW3RaCFu.js → layers.DX5tKqZN.js} +1 -1
- package/dist/{layers.YKkAEiaT.js → layers.DZ8ceCU8.js} +4 -4
- package/dist/{layers.BScGoS8o.js → layers.DZHjfod3.js} +1 -1
- package/dist/{layers.oIAYhWqx.js → layers.D_7d8sxA.js} +1 -1
- package/dist/{layers.e1eficW4.js → layers.D_K2xqvR.js} +1 -1
- package/dist/{layers.CfFVKKz3.js → layers.Db2Tj0AA.js} +1 -1
- package/dist/{layers.C_UfU1sf.js → layers.DbZwd4Kh.js} +1 -1
- package/dist/{layers.DcJTQ9vd.js → layers.DcQOjUXx.js} +1 -1
- package/dist/{layers.bESpqf2s.js → layers.Ddm6_mcw.js} +1 -1
- package/dist/{layers.wPgKuvOf.js → layers.Dekk2FTV.js} +1 -1
- package/dist/layers.DeuLqaq9.js +1 -0
- package/dist/{layers.8BLDzygA.js → layers.DhYCq1qU.js} +1 -1
- package/dist/{layers.CW0WldGt.js → layers.Dhba5XDR.js} +1 -1
- package/dist/{layers.DpD7bpvK.js → layers.Dljk8Ylw.js} +1 -1
- package/dist/{layers.CLgN2bhO.js → layers.DmWlTI5D.js} +37168 -37661
- package/dist/{layers.DEIF7FgX.js → layers.DmrXWbaC.js} +1 -1
- package/dist/{layers.DneUh6zw.js → layers.DoxOmssF.js} +1 -1
- package/dist/{layers.B41KRyPt.js → layers.DrebGAq5.js} +4 -6
- package/dist/{layers.BUPTN8SU.js → layers.Drp9VQ1Q.js} +1 -1
- package/dist/{layers.DC98vWSh.js → layers.Durk4ME3.js} +1 -1
- package/dist/{layers.DXqDkcB3.js → layers.Dwe6Ywns.js} +1 -1
- package/dist/{layers.pABr_nAu.js → layers.E6xku4p2.js} +1 -1
- package/dist/{layers.W69ot4at.js → layers.G9w5SvmA.js} +1 -1
- package/dist/{layers.CFoj4Zna.js → layers.GFojANou.js} +1 -1
- package/dist/{layers.bG0QIpwb.js → layers.GcoUlJrC.js} +1 -1
- package/dist/{layers.CKH2iyVA.js → layers.Hn_cKDze.js} +1 -1
- package/dist/{layers.CZ2U-vdB.js → layers.J-6NXQVx.js} +1 -1
- package/dist/{layers.CMkK1DON.js → layers.J9RKwbyT.js} +4 -4
- package/dist/{layers.CEnnlbBH.js → layers.JKf-PjBb.js} +1 -1
- package/dist/{layers.BR9XCLIa.js → layers.JkKkx6gr.js} +6 -6
- package/dist/{layers.EeR4iGmP.js → layers.KDr72-zN.js} +1 -1
- package/dist/{layers.BssdJ-HO.js → layers.KDv1cI5_.js} +1 -1
- package/dist/{layers.C1BKy6RY.js → layers.NbYq7qal.js} +1 -1
- package/dist/{layers.CJEas8n2.js → layers.NrLxm8qw.js} +1 -1
- package/dist/{layers.D_Lhvqik.js → layers.QA0orbAC.js} +1 -1
- package/dist/{layers.Bjnlh4WK.js → layers.RWTHov0P.js} +1 -1
- package/dist/{layers.C_QB1dSe.js → layers.SkPEtUw9.js} +2 -2
- package/dist/{layers.FRLj3gvj.js → layers.V1e7jALv.js} +1 -1
- package/dist/{layers.CwhP1KNE.js → layers.YGhWouuE.js} +1 -1
- package/dist/{layers.C1el8ltS.js → layers.YI4DPCpO.js} +1 -1
- package/dist/{layers.BgKFttd8.js → layers.Z0R9DKPE.js} +1 -1
- package/dist/{layers.Cz-sl4_V.js → layers.ZAZRvnnR.js} +1 -1
- package/dist/{layers.BCbQyUab.js → layers._4N7leqh.js} +1 -1
- package/dist/{layers.xMShhAuF.js → layers.a432W3yX.js} +1 -1
- package/dist/{layers.CWb6_V7a.js → layers.aQck1vMu.js} +3 -3
- package/dist/{layers.BQowxmA-.js → layers.bWSnoRa1.js} +1 -1
- package/dist/{layers.B0a3181k.js → layers.dywCl_mE.js} +1 -1
- package/dist/{layers.YAtugjSe.js → layers.fwtiYMmO.js} +1 -1
- package/dist/{layers.BuX8wgTb.js → layers.gajYPuks.js} +3 -3
- package/dist/{layers.C_pIEfJ-.js → layers.gwFU0Ohj.js} +1 -1
- package/dist/{layers.O0VThdAv.js → layers.iBWteWQP.js} +1 -1
- package/dist/{layers.6iN3vsGA.js → layers.iMPYfSC_.js} +5 -5
- package/dist/{layers.CgiH-oqc.js → layers.jsRwZkqZ.js} +1 -1
- package/dist/{layers.DnzwWnLL.js → layers.mDv0cIeZ.js} +1 -1
- package/dist/{layers.CFlo8No7.js → layers.oHwLYZup.js} +4 -4
- package/dist/{layers.3tA7LhzO.js → layers.oWxzUCer.js} +4 -4
- package/dist/{layers.DpIxUFCO.js → layers.qDbb_Oll.js} +1 -1
- package/dist/{layers.BULwU-CD.js → layers.qiUKD4sh.js} +1 -1
- package/dist/{layers.BJS1AABK.js → layers.sIPp_rOs.js} +1 -1
- package/dist/{layers.BuzTyPSk.js → layers.sje2Lcv-.js} +1 -1
- package/dist/{layers.BimRAJzW.js → layers.uBugfNKB.js} +1 -1
- package/dist/{layers.CfS18898.js → layers.uYA8qwWu.js} +1 -1
- package/dist/{layers.Br6ACIjO.js → layers.vzVfKJj1.js} +1 -1
- package/dist/{layers.CA7j07E3.js → layers.wfDuXjjn.js} +1 -1
- package/dist/{layers.DgQ6iIki.js → layers.y52gzF_g.js} +1 -1
- package/package.json +80 -80
- package/dist/layers.BJLBQJnd.js +0 -6
- package/dist/layers.CMefeXBO.js +0 -1
- package/dist/layers.CPYPtH_I.js +0 -1021
- package/dist/layers.CZyfRCmd.js +0 -8
- package/dist/layers.Cr0kDOhd.js +0 -1
- package/dist/layers.Ot9F5usL.js +0 -1
package/dist/layers.CZyfRCmd.js
DELETED
package/dist/layers.Cr0kDOhd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./layers.BQowxmA-.js");require("./layers.Cp_hfA6G.js");exports.Commands=e.CB;exports.subsetToBase64=e.QB;exports.subsetToBinary=e.NQ;exports.toBase64=e.AI;
|
package/dist/layers.Ot9F5usL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),M=require("react-i18next"),O=require("@lexical/react/LexicalComposerContext"),w=require("@mantine/core"),C=require("lexical"),t=require("./layers.CPYPtH_I.js"),q=require("@layers-app/shared"),ne=require("@lexical/react/useLexicalEditable"),$=require("@mantine/hooks");require("@lexical/react/LexicalDecoratorBlockNode");require("@lexical/utils");require("@lexical/mark");require("@lexical/code");require("@lexical/selection");require("react-dom");require("@lexical/react/LexicalErrorBoundary");require("@lexical/react/LexicalBlockWithAlignableContents");require("@mantine/notifications");function ie(e,i){const n=document.createElement("a");n.href=e,n.download=i,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove()}function z(e){try{const n=new URL(e,window.location.origin).pathname.split("/").pop()||"image";return n.includes(".")?n:`${n}.png`}catch{return"image"}}async function R(e,i){const n=await fetch(e);if(!n.ok)throw new Error("fetch failed");const r=await n.blob(),c=URL.createObjectURL(r);try{ie(c,i)}finally{setTimeout(()=>URL.revokeObjectURL(c),0)}}function X({opened:e,onOpenChange:i,t:n,onDownload:r,onDelete:c}){return o.jsxs(w.Menu,{opened:e,onChange:i,transitionProps:t.animationMenu,shadow:"md",position:"bottom-start",offset:4,withinPortal:!0,closeOnItemClick:!0,children:[o.jsx(w.Menu.Target,{children:o.jsx(t.ActionIcon,{label:n("editor.toolbar.more"),icon:t.K1,iconColor:"var(--mantine-color-gray-text)","aria-label":n("editor.toolbar.more")})}),o.jsxs(w.Menu.Dropdown,{p:4,w:164,onMouseDown:l=>l.preventDefault(),children:[o.jsx(w.Menu.Item,{leftSection:o.jsx(w.Flex,{align:"center",justify:"center",c:"gray.6",children:o.jsx(t.HugeiconsIcon,{icon:t.Tm,size:16})}),onClick:l=>{l.stopPropagation(),r()},children:n("editor.gallery.download")}),o.jsx(w.Menu.Item,{color:"red",leftSection:o.jsx(w.Flex,{align:"center",justify:"center",c:"red.6",children:o.jsx(t.HugeiconsIcon,{icon:t.lg,size:16})}),onClick:l=>{l.stopPropagation(),c()},children:n("editor.contextMenu.delete")})]})]})}const Y=({t:e,src:i,setShown:n,id:r})=>{const[c,{open:l,close:h}]=$.useDisclosure(!1),u=s.useMemo(()=>[{id:!r||r==="0"?"":r,Url:i??"",contentType:"image/*",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[i,r]),m=p=>{p?l():h()};return o.jsxs(o.Fragment,{children:[o.jsx(q.AttachmentsGalleryModal,{opened:c,onOpenChange:m,attachments:u}),o.jsx(t.ActionIcon,{label:e("editor.image.preview"),icon:t.gn,iconColor:"var(--mantine-color-gray-text)","aria-label":e("editor.image.preview"),onClick:()=>{n(!1),l()}})]})},ae=({nodeKey:e,src:i})=>{const[n]=O.useLexicalComposerContext(),r=ne.useLexicalEditable(),[c,l]=s.useState(!1),[h,u]=s.useState(!1),{t:m}=M.useTranslation(),p=s.useCallback(()=>{n.update(()=>{const b=C.$getNodeByKey(e);t.$isImageNode(b)&&b.remove()})},[n,e]),y=s.useCallback(async()=>{if(i)try{await R(i,z(i))}catch{}},[i]);return o.jsxs("div",{className:`media-actions ${r?"":"media-actions--readonly"}`,children:[o.jsx(Y,{t:m,src:i,setShown:()=>{}}),r&&o.jsxs(o.Fragment,{children:[o.jsx(t.NodeAlignmentMenu,{opened:c,setOpened:l,t:m,editor:n,nodeKey:e,setShown:()=>{}}),o.jsx(X,{opened:h,onOpenChange:u,t:m,onDownload:()=>void y(),onDelete:p})]})]})},re=()=>{};function se({nodeKey:e,src:i,id:n}){const{t:r}=M.useTranslation(),[c]=O.useLexicalComposerContext(),[l,h]=s.useState(!1),[u,m]=s.useState(!1),p=s.useCallback(()=>{m(!1),c.update(()=>{const b=C.$getNodeByKey(e);if(!t.$isImageNode(b))return;const j=b.getParent();t.$isImageOverlayWrapperNode(j)?j.remove():b.remove()})},[c,e]),y=s.useCallback(async()=>{if(i)try{await R(i,z(i))}catch{}},[i]);return o.jsxs("div",{className:"media-actions visible",style:{position:"absolute",top:10,right:10,zIndex:10,pointerEvents:"auto",display:"flex",gap:4},onClick:b=>b.stopPropagation(),children:[o.jsx(Y,{t:r,src:i,setShown:re,id:n}),o.jsx(t.NodeAlignmentMenu,{opened:l,setOpened:h,t:r,editor:c,nodeKey:e}),o.jsx(X,{opened:u,onOpenChange:m,t:r,onDownload:()=>void y(),onDelete:p})]})}function le({nodeKey:e,src:i,id:n}){const{t:r}=M.useTranslation(),[c]=O.useLexicalComposerContext(),[l,{open:h,close:u}]=$.useDisclosure(!1),[m,{open:p,close:y}]=$.useDisclosure(!1),b=s.useMemo(()=>[{id:!n||n==="0"?"":n,Url:i??"",contentType:"",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[i,n]),j=()=>{u(),p()},S=s.useCallback(async()=>{if(u(),!!i)try{await R(i,z(i))}catch{}},[i,u]),v=s.useCallback(()=>{u(),c.update(()=>{const d=C.$getNodeByKey(e);t.$isImageNode(d)&&d.remove()})},[c,e,u]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"image-touch-actions",style:{position:"absolute",top:8,right:8,zIndex:10,pointerEvents:"auto"},onClick:d=>d.stopPropagation(),children:o.jsx(t.ActionIcon,{label:r("editor.toolbar.more"),icon:t.O1,iconColor:"var(--mantine-color-gray-text)","aria-label":r("editor.toolbar.more"),onClick:h})}),o.jsx(q.AttachmentsGalleryModal,{opened:m,onOpenChange:d=>d?p():y(),attachments:b}),o.jsx(t.MobileDrawer,{opened:l,onClose:u,title:r("editor.image.mobileActions"),children:o.jsxs(w.Stack,{gap:4,p:0,children:[o.jsx(w.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:j,leftSection:o.jsx(t.HugeiconsIcon,{icon:t.gn,size:16,color:"var(--mantine-color-dimmed)"}),children:r("editor.image.previewFullScreen")}),o.jsx(w.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:()=>void S(),leftSection:o.jsx(t.HugeiconsIcon,{icon:t.Tm,size:16,color:"var(--mantine-color-dimmed)"}),children:r("editor.gallery.download")}),o.jsx(w.Button,{type:"button",variant:"subtle",color:"red",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:v,leftSection:o.jsx(t.HugeiconsIcon,{icon:t.lg,size:16,color:"var(--mantine-color-red-6)"}),children:r("editor.actions.delete")})]})})]})}const K=e=>{const{width:i,height:n,isLoading:r,isError:c,src:l,id:h,altText:u,imageRef:m,maxWidth:p}=e;return o.jsxs("div",{className:"media-wrapper",style:{width:i,height:n,display:"inline-flex",position:"relative"},children:[o.jsx(w.LoadingOverlay,{visible:r,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),o.jsx(ce,{className:null,src:l,altText:u,imageRef:m,width:"inherit",height:"inherit",maxWidth:p||"auto",id:h}),t.IS_TOUCH_DEVICE&&o.jsx(le,{nodeKey:e.nodeKey,src:l,id:h}),t.IS_TOUCH_TABLET&&o.jsx(se,{nodeKey:e.nodeKey,src:l,id:h}),t.IS_HOVER_CAPABLE&&!t.IS_TOUCH_DEVICE&&!t.IS_TOUCH_TABLET&&o.jsx(ae,{nodeKey:e.nodeKey,src:l})]})};function ce({altText:e,className:i,imageRef:n,src:r,width:c,height:l,maxWidth:h,id:u}){const[m,p]=s.useState(!1);return o.jsx("img",{className:`${i||void 0} ${m?"":"loading"}`,src:r,alt:e,ref:n,style:{height:l,maxWidth:h,width:c},onLoad:()=>{r.includes("splash")?setTimeout(()=>{p(!0)},100):p(!0)},draggable:"false","data-id":u})}function de(e){const{disable:i}=s.useContext(t.Context);return i&&t.ImageNode.isPlaceholderSrc(e.src)?null:o.jsx(ue,{...e})}function ue({src:e,altText:i,nodeKey:n,width:r,height:c,maxWidth:l,showCaption:h,caption:u,id:m,create:p,alignment:y,imagePickerTab:b}){var V,G;const j=s.useRef(null),[S,v]=s.useState(!0),[d]=O.useLexicalComposerContext(),[N,k]=s.useState(!0),[I,L]=s.useState({width:0,height:0}),{start:W}=t.useCancelUpload(),[ge,P]=s.useState(0),{fetchUploadMedia:D,fetchDeleteMedia:H,maxFileSize:me,imperativeHandleRef:A,disable:Z}=s.useContext(t.Context),T=t.mediaMap.has(e)&&(((V=t.mediaMap.get(e))==null?void 0:V.mediaNodeKeys.length)===0||((G=t.mediaMap.get(e))==null?void 0:G.mediaNodeKeys.length)===void 0||e.trim()===""),{t:E}=M.useTranslation(),[he,J]=s.useState(0);s.useEffect(()=>d.registerDecoratorListener(()=>{J(a=>a+1)}),[T]),s.useEffect(()=>{if(!e||e.startsWith("data:image/")||!e.trim()){v(!1);return}const a=new Image;a.src=e,a.onload=()=>v(!1),a.onerror=()=>{v(!1)}},[e,T]);const Q=(a,f)=>{d.update(()=>{C.$setSelection(null);const g=C.$getNodeByKey(n);t.$isImageNode(g)&&g.setWidthAndHeight(a,f)})},{historyState:B}=t.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:F}}=t.useSettings();function ee(a){return a.endsWith(".svg")||a.includes("image/svg+xml")}function te(a){return new Promise((f,g)=>{if(ee(a)){f(0);return}const x=new Image;x.src=a,x.onload=()=>{f(x.width)},x.onerror=()=>{g(new Error("Failed to load image"))}})}s.useEffect(()=>{let a=r,f=c,g=100;(e.includes("unsplash")?e.trim():!T&&e.trim()||e.includes("upload-src-editor"))&&e!=="upload"&&te(e).then(x=>{typeof a=="number"&&a<g&&x<g?(k(!0),L({width:a,height:f})):x<g?(k(!0),L({width:"auto",height:"auto"})):(L({width:x,height:x}),k(!1))}).catch(x=>{console.warn("Ошибка при загрузке изображения:",x.message)})},[e,T]),s.useEffect(()=>{I.width&&I.height&&N&&d.update(()=>{const a=C.$getNodeByKey(n);t.$isImageNode(a)&&a.setWidthAndHeight(I.width,I.height)})},[I.width,I.height,N]);const oe=s.useCallback(a=>t.$writeImagePickerTabToNode(d,n,a),[d,n]),U=s.useCallback((a,f)=>{v(!1),d.update(()=>{const g=C.$getNodeByKey(n);t.$isImageNode(g)&&(g.setSrc(a),g.setId(f))})},[d,n]),_=s.useCallback(a=>{v(!0);const f=W();D&&D(a[0],(g,x)=>{U(g,x),P(0)},g=>{g&&q.showErrorNotification({message:E("editor.gallery.errorFile")}),P(0),U("","")},f,g=>{P(g)})},[D,W,E,U]);return s.useEffect(()=>d.registerCommand(t.UPLOAD_IMAGE_COMMAND,a=>e!=="upload"||a.targetNodeKey!==n?!1:(_(a.files),!0),C.COMMAND_PRIORITY_LOW),[d,_,n,e]),!e||e==="upload"?o.jsx(w.Box,{"data-editor-image-picker-drop-root":!0,w:"100%",children:o.jsx(t.ImagePicker,{inline:!0,nodeKey:n,defaultTabValue:b,onWriteTabToNode:oe,uploading:!1,onUpload:a=>{!D||!a.length||_(a)},popoverProps:{opened:!0,position:"bottom",zIndex:t.EDITOR_UI_MIN_Z_INDEX},onChange:a=>{d.update(()=>{const f=C.$getNodeByKey(n);t.$isImageNode(f)&&f.setSrc(a)})}})}):N?o.jsx(K,{width:I.width,height:I.height,isLoading:S,isError:!1,isIcon:N,src:e,id:m,editor:d,nodeKey:n,fetchDeleteMedia:H,altText:i,imageRef:j,maxWidth:l,showCaption:h,caption:u,isCollabActive:!1,historyState:B,showNestedEditorTreeView:F,t:E}):o.jsx(t.ResizableContainer,{editor:d,isIcon:N,width:t.parseContainerSize(r),height:t.parseContainerSize(c),initialWidth:I.width||"",initialHeight:I.height||"",onResizeEnd:Q,alignment:y,disable:Z,onRegisterDecoratorEnter:a=>{A!=null&&A.current&&(A.current.decoratorEnterAction=a)},onActivate:()=>d.dispatchCommand(t.ON_CHANGE_COMMAND,"show_menu"),children:o.jsx(K,{width:"inherit",height:"inherit",isLoading:S,isError:!1,isIcon:N,src:e,id:m,editor:d,nodeKey:n,fetchDeleteMedia:H,altText:i,imageRef:j,maxWidth:l,showCaption:h,caption:u,isCollabActive:!1,historyState:B,showNestedEditorTreeView:F,t:E})})}exports.default=de;
|