@layers-app/editor 2.3.22 → 2.3.24
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.js +6 -6
- package/dist/{layers.CbS3C__g.js → layers.0CpMH7Qd.js} +1 -1
- package/dist/{layers.BrP3wWRL.js → layers.4UUvIK2t.js} +1 -1
- package/dist/{layers.DLcDX70Z.js → layers.7sTg2ka1.js} +3 -3
- package/dist/{layers.DkNrb9ft.js → layers.AwhdZDwP.js} +354 -338
- package/dist/{layers.QRTVVRxj.js → layers.B-hQUarG.js} +1 -1
- package/dist/{layers.BfmOd0IG.js → layers.B2B2rB8R.js} +1 -1
- package/dist/{layers.BjBHnohY.js → layers.B3wtrxWs.js} +1 -1
- package/dist/{layers.BlflUhxJ.js → layers.B4roGXPG.js} +1 -1
- package/dist/{layers.Cg-UOum4.js → layers.B5-fG7P8.js} +1 -1
- package/dist/{layers.GSpa8h_2.js → layers.B7rjsYyQ.js} +1 -1
- package/dist/{layers.BpA2A1SP.js → layers.B8aPpU-3.js} +1 -1
- package/dist/{layers.1qWGMhpm.js → layers.B9XsK7sf.js} +1 -1
- package/dist/{layers.C8Prpr0O.js → layers.BB5xZerr.js} +1 -1
- package/dist/{layers.A-J34shn.js → layers.BBdzXGC6.js} +1 -1
- package/dist/{layers.DwL2pnlW.js → layers.BDZwabym.js} +1 -1
- package/dist/{layers.W_jMkNYj.js → layers.BEQSkQb5.js} +1 -1
- package/dist/{layers.nmt-R6cg.js → layers.BElnuJGo.js} +1 -1
- package/dist/{layers.Deu1cPA2.js → layers.BFMrrvO6.js} +1 -1
- package/dist/{layers.ClAcKiSi.js → layers.BH42eSHV.js} +1 -1
- package/dist/{layers.XfT19s41.js → layers.BJ4aigFR.js} +1 -1
- package/dist/{layers.BJ5t-bw_.js → layers.BJ6E1qlO.js} +1 -1
- package/dist/{layers.DB8zgJTz.js → layers.BL4_Vrtj.js} +1 -1
- package/dist/{layers.Cb2_zCXw.js → layers.BNG9-t-U.js} +5 -5
- package/dist/{layers.ompd91wY.js → layers.BPAXEqLu.js} +1 -1
- package/dist/{layers.Dir6S1sj.js → layers.BQiCz5VQ.js} +1 -1
- package/dist/{layers.C9hldwB8.js → layers.BVm7Nx47.js} +1 -1
- package/dist/{layers.BFY1gVOq.js → layers.BWMUkW4D.js} +1 -1
- package/dist/{layers.DQUOIIPB.js → layers.BWwL3Ve5.js} +1 -1
- package/dist/{layers.DsD85Ka3.js → layers.B_B2UGan.js} +1 -1
- package/dist/{layers.CsFMLTQi.js → layers.BaINgm3q.js} +1 -1
- package/dist/{layers.DCOc5pWl.js → layers.BcbGROAq.js} +1 -1
- package/dist/{layers.Dy9bHhxU.js → layers.Bf1K1fkU.js} +2 -2
- package/dist/{layers.CXN-z5qV.js → layers.BfKluevR.js} +4 -4
- package/dist/{layers.a9V6odf0.js → layers.BgotFTf5.js} +1 -1
- package/dist/{layers.XqrJuUP0.js → layers.Bgv2K37s.js} +1 -1
- package/dist/{layers.DAsr4tV-.js → layers.BhbnND3b.js} +1 -1
- package/dist/{layers.HKoBJXG-.js → layers.BjygM-VR.js} +1 -1
- package/dist/{layers.uIiS6YV-.js → layers.Bl9fmgeS.js} +1 -1
- package/dist/layers.BohN9r_4.js +8 -0
- package/dist/{layers.BR7jeDQP.js → layers.BqPMskjv.js} +1 -1
- package/dist/layers.BrDVZz1T.js +858 -0
- package/dist/{layers.CJ6Rg0lX.js → layers.Brigp_BM.js} +2 -2
- package/dist/{layers.AzEmDuuK.js → layers.Buwyevgo.js} +1 -1
- package/dist/{layers.C-VNVQ_M.js → layers.BvT1pOJ7.js} +1 -1
- package/dist/{layers.DimaJ3iX.js → layers.BxM08fK-.js} +1 -1
- package/dist/{layers.BsDRiufz.js → layers.BxcAE7-A.js} +2 -2
- package/dist/layers.ByUMS4pV.js +1 -0
- package/dist/{layers.CN6S0l1U.js → layers.C-EOUS7D.js} +2 -2
- package/dist/{layers.C4kyxHbT.js → layers.C1PtkGX3.js} +1 -1
- package/dist/{layers.BUHiSK2b.js → layers.C2JRWmoz.js} +1 -1
- package/dist/{layers.ByoOM1uY.js → layers.C3G0i3tG.js} +1 -1
- package/dist/{layers.D8ekFvdj.js → layers.C3Q2x4vM.js} +3 -3
- package/dist/{layers.CYJSOBmX.js → layers.C5zCKOAF.js} +1 -1
- package/dist/{layers.B5OPbl5O.js → layers.C8NgjywA.js} +1 -1
- package/dist/{layers.zlYYyRVj.js → layers.CBK3ExrE.js} +1 -1
- package/dist/{layers.DR6JVzHG.js → layers.CBKhhbj_.js} +1 -1
- package/dist/{layers.CvtU9F9h.js → layers.CBdq-aon.js} +1 -1
- package/dist/{layers.9S_U7WJt.js → layers.CCY9XOI0.js} +2 -2
- package/dist/{layers.Yf0OxZVn.js → layers.CD71nr4_.js} +1 -1
- package/dist/{layers.K3q1iEdP.js → layers.CDYV-VhD.js} +1 -1
- package/dist/{layers.C022zlhH.js → layers.CEe-N6eG.js} +3 -3
- package/dist/{layers.CzZ_Lw8x.js → layers.CFIW_fEO.js} +1 -1
- package/dist/{layers.Bc1ANehj.js → layers.CGNxynSI.js} +1 -1
- package/dist/{layers.BmVrOCMv.js → layers.CGtmQbiV.js} +1 -1
- package/dist/{layers.DePZG4Ik.js → layers.CHwK_NbH.js} +1 -1
- package/dist/{layers.CI3Mh_4i.js → layers.CHzUR2uh.js} +1 -1
- package/dist/{layers.BLNi4T18.js → layers.CIm79Ra1.js} +59 -59
- package/dist/{layers.DOhaef72.js → layers.CJgbI_A6.js} +2 -2
- package/dist/{layers.BAzG6mfN.js → layers.CKQ_7R8w.js} +1 -1
- package/dist/{layers.BfbRUhiR.js → layers.CLeeY6Zi.js} +1 -1
- package/dist/{layers.lz0ada28.js → layers.CLjq-kTO.js} +1 -1
- package/dist/{layers.Dj9ody1Y.js → layers.CNY3Xyfj.js} +1 -1
- package/dist/{layers.BVnH2iZU.js → layers.CNfT77xZ.js} +1 -1
- package/dist/{layers.Bnysev4o.js → layers.CNxKlWUs.js} +1 -1
- package/dist/{layers.C83JgyTY.js → layers.CORpX7r7.js} +1 -1
- package/dist/{layers.BhFXkdyO.js → layers.CPJeTos-.js} +1 -1
- package/dist/{layers.BDETfw7Y.js → layers.CSAoWA5M.js} +1 -1
- package/dist/{layers.C4thF7rY.js → layers.CV2Y68YA.js} +1 -1
- package/dist/{layers.CKXFnGMO.js → layers.CVJMrJM8.js} +1 -1
- package/dist/{layers.Zv5Q2kCL.js → layers.CVpip4qM.js} +1 -1
- package/dist/{layers.BAE80doB.js → layers.CWVq7Uy7.js} +1 -1
- package/dist/{layers.zgtgO7Zh.js → layers.CWi9bxx2.js} +1 -1
- package/dist/{layers.DB3cWXLP.js → layers.CZTvQbIJ.js} +1 -1
- package/dist/{layers.Dc582csS.js → layers.C_1xPfQN.js} +2 -2
- package/dist/{layers.BnApensJ.js → layers.C_x8dLfm.js} +1 -1
- package/dist/{layers.Bec2NPMN.js → layers.CaReiIEX.js} +1 -1
- package/dist/{layers.CxgdUK68.js → layers.CcDllE0Z.js} +1 -1
- package/dist/{layers.CZ0CmmBM.js → layers.CdVMpdra.js} +1 -1
- package/dist/{layers.D24zEVxP.js → layers.CdYNCOg7.js} +1 -1
- package/dist/layers.CeEEuJcv.js +1 -0
- package/dist/{layers.jOcyd8e6.js → layers.Cf8-96M8.js} +1 -1
- package/dist/{layers.GATEEFro.js → layers.ChO-FN9-.js} +1 -1
- package/dist/{layers.Dk7xH7i-.js → layers.Cim8IgKH.js} +1 -1
- package/dist/{layers.DdpWFXWy.js → layers.Cj_EqAWT.js} +1 -1
- package/dist/{layers.CerwdBZh.js → layers.ClHoBwGo.js} +1 -1
- package/dist/{layers.vfIPnMAR.js → layers.ClY73P1k.js} +1 -1
- package/dist/{layers.lngNinZ9.js → layers.ClnZvd9i.js} +1 -1
- package/dist/{layers.8q9B8kz1.js → layers.ClswqtpD.js} +1 -1
- package/dist/{layers.BWwBwOD4.js → layers.CnVOqy-h.js} +1 -1
- package/dist/{layers.Bwp7K1Fe.js → layers.Cq6Uaebt.js} +1 -1
- package/dist/{layers.B1W4QDhq.js → layers.CqeO-3EO.js} +1 -1
- package/dist/{layers.CT7M6On3.js → layers.CvOQ_oHk.js} +1 -1
- package/dist/{layers.nqiLr36J.js → layers.CwkZ6Ipi.js} +1 -1
- package/dist/{layers.auGuXsdN.js → layers.CxG2fQ_T.js} +1 -1
- package/dist/{layers.Bb1ZYnj6.js → layers.CyLTrS4x.js} +1 -1
- package/dist/{layers.DsIVqiyo.js → layers.CyqHpq0B.js} +1 -1
- package/dist/{layers.B1HffYv7.js → layers.CzbGQTNa.js} +1 -1
- package/dist/{layers.eaOgJ4Wu.js → layers.D0-QtSj4.js} +1 -1
- package/dist/{layers.CE0Njwxt.js → layers.D0FgHO-y.js} +1 -1
- package/dist/{layers.CryGe4d3.js → layers.D0ce_VhN.js} +3 -3
- package/dist/{layers.zmznhUJl.js → layers.D1Ng1ixT.js} +1 -1
- package/dist/{layers.C-gKhsjA.js → layers.D4eP5NqW.js} +1 -1
- package/dist/{layers.yTT4HagX.js → layers.D55-oG-_.js} +1 -1
- package/dist/{layers.Djv8mnBd.js → layers.D6NCqWh9.js} +1 -1
- package/dist/{layers.DZGPrqjE.js → layers.D8Wxx6-x.js} +4 -4
- package/dist/{layers.CjyIvmi8.js → layers.D9PPBeAk.js} +1 -1
- package/dist/{layers.ewnSao_N.js → layers.DAeqbGMo.js} +1 -1
- package/dist/{layers.IRm7rzMo.js → layers.DAn4p0sm.js} +1 -1
- package/dist/{layers.By_lv2Pn.js → layers.DB2pNf2i.js} +1 -1
- package/dist/{layers.D0zogLuJ.js → layers.DBT8nxxX.js} +1 -1
- package/dist/{layers.5e4HzkAG.js → layers.DBeX5TLo.js} +4 -4
- package/dist/{layers.BYfd0wSK.js → layers.DBvEUYd0.js} +1 -1
- package/dist/{layers.BM2oXKfk.js → layers.DCI-PU7V.js} +3 -3
- package/dist/{layers.B0-Ohe0x.js → layers.DD1nZQay.js} +1 -1
- package/dist/{layers.CQ0cQYXY.js → layers.DDtCoAUS.js} +1 -1
- package/dist/{layers.DtyL7pij.js → layers.DEVf_8IC.js} +1 -1
- package/dist/{layers.DfuhqG2u.js → layers.DFFWjOIN.js} +8 -8
- package/dist/{layers.Cb2eAkbB.js → layers.DGHhm0ig.js} +1 -1
- package/dist/{layers.DFQQpkyu.js → layers.DGJY2FkO.js} +1 -1
- package/dist/{layers.CjlLk4c2.js → layers.DHo3KKeF.js} +1 -1
- package/dist/{layers.BRizdMol.js → layers.DKKrMI1y.js} +1 -1
- package/dist/{layers.CRjYeg54.js → layers.DKOKkFda.js} +3 -3
- package/dist/{layers.B3HYN3oY.js → layers.DKpTuMTK.js} +1 -1
- package/dist/{layers.Dc9venkQ.js → layers.DLxiVk7N.js} +1 -1
- package/dist/{layers.9TjYB6Lm.js → layers.DPTnVoRy.js} +1 -1
- package/dist/{layers.BhJOc_53.js → layers.DQ0SYwRq.js} +1 -1
- package/dist/layers.DRzWJs0T.js +1 -0
- package/dist/{layers.BE9mWVfh.js → layers.DSCXzQ2d.js} +1 -1
- package/dist/{layers.CBAnwcdO.js → layers.DT3oYLNK.js} +1 -1
- package/dist/{layers._uw7YRIi.js → layers.DTHxplVc.js} +1 -1
- package/dist/{layers.CwP3lthA.js → layers.DTjXnAGW.js} +1 -1
- package/dist/{layers.lcbLy439.js → layers.DUcRoa8i.js} +3 -3
- package/dist/{layers.DgJjcdr-.js → layers.DXTeiF-e.js} +2 -2
- package/dist/{layers.DfOBXFHi.js → layers.DZwJH6W1.js} +1 -1
- package/dist/{layers.Bg2H7i8b.js → layers.D_7F5phf.js} +1 -1
- package/dist/{layers.CgVWLRcB.js → layers.Dd-wIXHi.js} +1 -1
- package/dist/{layers.8c3NMeFg.js → layers.DeQgcYwV.js} +1 -1
- package/dist/{layers.Ch2oXqKV.js → layers.DfPPz_X1.js} +1 -1
- package/dist/{layers.AGeuuPKs.js → layers.Dif1MzgT.js} +1 -1
- package/dist/{layers.BCoiZs-6.js → layers.DjmlUPia.js} +1 -1
- package/dist/{layers.BnOkWXKe.js → layers.DkGrVIsD.js} +1 -1
- package/dist/{layers.BHseXEJG.js → layers.Dlf6x2Ju.js} +1 -1
- package/dist/{layers.B_SghufF.js → layers.Dmh6stK3.js} +1 -1
- package/dist/{layers.CnMntrug.js → layers.Dqie3AbF.js} +1 -1
- package/dist/{layers.BZfaYHWc.js → layers.Dqjw6JqU.js} +7 -7
- package/dist/{layers.BPE4MhHl.js → layers.DtzgBbW_.js} +2 -2
- package/dist/{layers.DcqjZCy6.js → layers.Du79wVhh.js} +1 -1
- package/dist/{layers.Dl85KXes.js → layers.DuBANgoi.js} +2 -2
- package/dist/{layers.Dpg_nMfB.js → layers.DzRb8jra.js} +1 -1
- package/dist/{layers.B8VSx93-.js → layers.EffsiuNu.js} +1 -1
- package/dist/{layers.DMcnaW3o.js → layers.FpsTRMn5.js} +1 -1
- package/dist/{layers.B5-Y9hei.js → layers.GNukBRwS.js} +1 -1
- package/dist/{layers.BMgR6zim.js → layers.IP3dJr3G.js} +1 -1
- package/dist/{layers.H56VUT51.js → layers.Kz3zpi50.js} +1 -1
- package/dist/{layers.DmQ1wZpm.js → layers.LL7KnkpN.js} +1 -1
- package/dist/{layers.Bw9X3C0K.js → layers.O0qRaRpX.js} +1 -1
- package/dist/{layers.5hEvEW2h.js → layers.OVc7WJn6.js} +1 -1
- package/dist/{layers.DjZdXTYL.js → layers.PvYWyb5N.js} +3 -3
- package/dist/{layers.DS-kwiY3.js → layers.QU-k-nIw.js} +1 -1
- package/dist/{layers.D9aYJ_7L.js → layers.SpT_PVDP.js} +1 -1
- package/dist/{layers.CKUytNQF.js → layers.SqD4gItY.js} +24 -24
- package/dist/{layers.Wdz8I4TO.js → layers.U_MaUknB.js} +3 -3
- package/dist/{layers.J01QEWhB.js → layers.VGDmP6RB.js} +1 -1
- package/dist/{layers.BHtY7U65.js → layers.WA_t21W5.js} +1 -1
- package/dist/{layers.BMyHZLl7.js → layers.XVuP78OS.js} +1 -1
- package/dist/{layers.Cc9BNrA8.js → layers.XufwhRWn.js} +1 -1
- package/dist/{layers.BMGa3HCJ.js → layers.ZtfusTop.js} +1 -1
- package/dist/{layers.s0bl_qw4.js → layers.Zv74Kxrh.js} +1 -1
- package/dist/{layers.8o7bLXBz.js → layers.Zv83kZG8.js} +1 -1
- package/dist/{layers.DfItTiTT.js → layers.aHu_65DR.js} +1 -1
- package/dist/{layers.DOW1URZz.js → layers.b-D90IdJ.js} +1 -1
- package/dist/{layers.B7s98gVM.js → layers.bk6BoA31.js} +1 -1
- package/dist/{layers.4nJAZVHr.js → layers.eZOSE1Mz.js} +1 -1
- package/dist/{layers.DoHbEsor.js → layers.gctTNjH6.js} +1 -1
- package/dist/{layers.DTo56Kaw.js → layers.hM4mb7rr.js} +1 -1
- package/dist/{layers.Bhgwt_RD.js → layers.hQtFhwXx.js} +1 -1
- package/dist/{layers.Dda1UNZ_.js → layers.hkPgmxE-.js} +1 -1
- package/dist/{layers.CkeiW5Cy.js → layers.p99FvPzP.js} +1 -1
- package/dist/{layers.DwWROQZN.js → layers.ppcSfBF_.js} +1 -1
- package/dist/{layers.CChXVO_O.js → layers.qYo1swlB.js} +1 -1
- package/dist/{layers.P4I51qo6.js → layers.rxoXKzgA.js} +3 -3
- package/dist/{layers.CX0phJ8q.js → layers.sWOuZ1z8.js} +3 -3
- package/dist/{layers.DKQK8nuG.js → layers.taYJuEcx.js} +1 -1
- package/dist/{layers.BhQu4aCO.js → layers.u8DIrcKm.js} +1 -1
- package/dist/{layers.QXFv7QNP.js → layers.uOzxdMWN.js} +1 -1
- package/dist/{layers.DdqKEy7a.js → layers.v9JhgLGL.js} +1 -1
- package/dist/{layers.-uB6gAQf.js → layers.vhwfBfVO.js} +1 -1
- package/dist/{layers.C9IBQlri.js → layers.vl-FtmBd.js} +3 -3
- package/dist/{layers.CWF7Z6cc.js → layers.wSDWdOKk.js} +1 -1
- package/dist/{layers.D9wk0Seb.js → layers.xYL0u_aZ.js} +1 -1
- package/dist/{layers.Dao1nnCd.js → layers.xcpsF3RF.js} +1 -1
- package/dist/layers.xxa1nfz9.js +6 -0
- package/dist/{layers.jz_MWBi0.js → layers.yZEhq0RN.js} +1 -1
- package/dist/{layers.BKQYuzsa.js → layers.zTwito3k.js} +1 -1
- package/dist/{layers.5AMbHs6E.js → layers.z_BaOEVR.js} +1 -1
- package/dist/{layers.Bu2SrH4h.js → layers.zbwA3qRl.js} +18052 -17678
- package/package.json +1 -1
- package/dist/layers.BIi9GLEc.js +0 -8
- package/dist/layers.BYEIgAOB.js +0 -1
- package/dist/layers.BnatDFX7.js +0 -858
- package/dist/layers.DfImPHqB.js +0 -1
- package/dist/layers.MRYjEvWp.js +0 -1
- package/dist/layers.eBgRhwOk.js +0 -6
package/package.json
CHANGED
package/dist/layers.BIi9GLEc.js
DELETED
package/dist/layers.BYEIgAOB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),W=require("react-i18next"),F=require("@lexical/react/LexicalComposerContext"),w=require("@mantine/core"),S=require("lexical"),e=require("./layers.BnatDFX7.js"),H=require("@layers-app/shared"),G=require("@lexical/react/useLexicalEditable"),z=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 ye(o,a){const n=document.createElement("a");n.href=o,n.download=a,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove()}function V(o){try{const n=new URL(o,window.location.origin).pathname.split("/").pop()||"image";return n.includes(".")?n:`${n}.png`}catch{return"image"}}async function X(o,a){const n=await fetch(o);if(!n.ok)throw new Error("fetch failed");const s=await n.blob(),l=URL.createObjectURL(s);try{ye(l,a)}finally{setTimeout(()=>URL.revokeObjectURL(l),0)}}function Ce({editor:o,nodeKey:a,href:n,onClose:s}){const[l,u]=r.useState(()=>e.getLinkTypeFromUrl(n)),[c,g]=r.useState(()=>e.removeProtocol(n)),[j,v]=r.useState(!1),f=r.useCallback(p=>{u(p),v(!1)},[]),h=r.useCallback(p=>{g(p),v(!1)},[]),x=r.useCallback(()=>{const p=e.addProtocolIfNeeded(c.trim(),l);if(!p||!e.isValidUrl(p,l)){v(!0);return}e.$writeImageLinkToNode(o,a,e.sanitizeUrl(p)),s()},[o,a,c,l,s]),C=r.useCallback(()=>{e.$writeImageLinkToNode(o,a,""),s()},[o,a,s]),y=r.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),x()):p.key==="Escape"&&(p.preventDefault(),s())},[x,s]);return{linkType:l,linkUrl:c,error:j,onLinkTypeChange:f,onUrlInputChange:h,onUrlInputKeyDown:y,onSave:x,onRemove:C}}function Y({editor:o,nodeKey:a,href:n,onClose:s,mobile:l}){const u=r.useRef(null),c=Ce({editor:o,nodeKey:a,href:n,onClose:s});return r.useEffect(()=>{var g;(g=u.current)==null||g.focus({preventScroll:!0})},[]),t.jsx(e.CreateMode,{inputRef:u,linkUrl:c.linkUrl,linkType:c.linkType,error:c.error,mobile:l,onLinkTypeChange:c.onLinkTypeChange,onUrlInputChange:c.onUrlInputChange,onUrlInputKeyDown:c.onUrlInputKeyDown,onCancel:s,onSave:c.onSave,onRemove:n?c.onRemove:void 0})}function le({opened:o,onOpenChange:a,t:n,onDownload:s,onDelete:l,hasLink:u,onLinkAction:c}){return t.jsxs(w.Menu,{opened:o,onChange:a,transitionProps:e.zt,shadow:"md",position:"bottom-start",offset:4,withinPortal:!0,closeOnItemClick:!0,children:[t.jsx(w.Menu.Target,{children:t.jsx(e.At,{label:n("editor.toolbar.more"),icon:e.K1,iconColor:"var(--mantine-color-gray-text)","aria-label":n("editor.toolbar.more")})}),t.jsxs(w.Menu.Dropdown,{p:4,miw:164,w:"max-content",onMouseDown:g=>g.preventDefault(),children:[c&&t.jsx(w.Menu.Item,{leftSection:t.jsx(w.Flex,{align:"center",justify:"center",c:"gray.6",children:t.jsx(e.Icon,{name:"link",size:16})}),onClick:g=>{g.stopPropagation(),c()},children:n(u?"editor.link.editLink":"editor.link.addLink")}),t.jsx(w.Menu.Item,{leftSection:t.jsx(w.Flex,{align:"center",justify:"center",c:"gray.6",children:t.jsx(e.HugeiconsIcon,{icon:e.Tm,size:16})}),onClick:g=>{g.stopPropagation(),s()},children:n("editor.gallery.download")}),t.jsx(w.Menu.Item,{color:"red",leftSection:t.jsx(w.Flex,{align:"center",justify:"center",c:"red.6",children:t.jsx(e.HugeiconsIcon,{icon:e.lg,size:16})}),onClick:g=>{g.stopPropagation(),l()},children:n("editor.contextMenu.delete")})]})]})}const ce=({t:o,src:a,setShown:n,id:s})=>{const[l,{open:u,close:c}]=z.useDisclosure(!1),g=e.useCanDownload(),j=r.useMemo(()=>[{id:!s||s==="0"?"":s,Url:a??"",contentType:"image/*",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[a,s]),v=f=>{f?u():c()};return t.jsxs(t.Fragment,{children:[t.jsx(H.AttachmentsGalleryModal,{opened:l,onOpenChange:v,attachments:j,allowDownload:g}),t.jsx(e.At,{label:o("editor.image.preview"),icon:e.gn$1,iconColor:"var(--mantine-color-gray-text)","aria-label":o("editor.image.preview"),onClick:()=>{n(!1),u()}})]})},Ie=({nodeKey:o,src:a,href:n})=>{const[s]=F.useLexicalComposerContext(),l=G.useLexicalEditable(),[u,c]=r.useState(!1),[g,j]=r.useState(!1),[v,f]=r.useState(!1),{t:h}=W.useTranslation();r.useEffect(()=>{if(!v)return;const y=p=>{const b=p.target;b!=null&&b.closest(".floating-link-dropdown")||b!=null&&b.closest(".floating-link-type-combobox-dropdown")||f(!1)};return document.addEventListener("pointerdown",y,!0),()=>document.removeEventListener("pointerdown",y,!0)},[v]);const x=r.useCallback(()=>{s.update(()=>{const y=S.$getNodeByKey(o);e.$isImageNode(y)&&y.remove()})},[s,o]),C=r.useCallback(async()=>{if(a)try{await X(a,V(a))}catch{}},[a]);return t.jsxs(w.Popover,{opened:v,onChange:f,position:"bottom-end",offset:4,shadow:"md",radius:"md",withinPortal:!0,closeOnClickOutside:!1,children:[t.jsx(w.Popover.Target,{children:t.jsxs("div",{className:`media-actions ${l?"":"media-actions--readonly"}`,children:[t.jsx(ce,{t:h,src:a,setShown:()=>{}}),l&&t.jsxs(t.Fragment,{children:[t.jsx(e.gr,{opened:u,setOpened:c,t:h,editor:s,nodeKey:o,setShown:()=>{}}),t.jsx(le,{opened:g,onOpenChange:j,t:h,onDownload:()=>void C(),onDelete:x,hasLink:!!n,onLinkAction:()=>f(!0)})]})]})}),t.jsx(w.Popover.Dropdown,{className:`floating-link-dropdown floating-link-dropdown--${n?"edit":"create"}-mode`,"data-test-id":"floating-link-dropdown",children:t.jsx(Y,{editor:s,nodeKey:o,href:n,onClose:()=>f(!1)})})]})},je=()=>{};function De({nodeKey:o,src:a,id:n,href:s}){const{t:l}=W.useTranslation(),[u]=F.useLexicalComposerContext(),c=G.useLexicalEditable(),[g,j]=r.useState(!1),[v,f]=r.useState(!1),[h,x]=r.useState(!1);r.useEffect(()=>{if(!h)return;const p=b=>{const N=b.target;N!=null&&N.closest(".floating-link-dropdown")||N!=null&&N.closest(".floating-link-type-combobox-dropdown")||x(!1)};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[h]);const C=r.useCallback(()=>{f(!1),u.update(()=>{const p=S.$getNodeByKey(o);if(!e.$isImageNode(p))return;const b=p.getParent();e.$isImageOverlayWrapperNode(b)?b.remove():p.remove()})},[u,o]),y=r.useCallback(async()=>{if(a)try{await X(a,V(a))}catch{}},[a]);return t.jsxs(w.Popover,{opened:h,onChange:x,position:"bottom-end",offset:4,shadow:"md",radius:"md",withinPortal:!0,closeOnClickOutside:!1,children:[t.jsx(w.Popover.Target,{children:t.jsxs("div",{className:"media-actions visible",style:{position:"absolute",top:10,right:10,zIndex:10,pointerEvents:"auto",display:"flex",gap:4},onClick:p=>p.stopPropagation(),children:[t.jsx(ce,{t:l,src:a,setShown:je,id:n}),c&&t.jsxs(t.Fragment,{children:[t.jsx(e.gr,{opened:g,setOpened:j,t:l,editor:u,nodeKey:o}),t.jsx(le,{opened:v,onOpenChange:f,t:l,onDownload:()=>void y(),onDelete:C,hasLink:!!s,onLinkAction:()=>x(!0)})]})]})}),t.jsx(w.Popover.Dropdown,{className:`floating-link-dropdown floating-link-dropdown--${s?"edit":"create"}-mode`,"data-test-id":"floating-link-dropdown",children:t.jsx(Y,{editor:u,nodeKey:o,href:s,onClose:()=>x(!1)})})]})}function Se({nodeKey:o,src:a,id:n,href:s}){const{t:l}=W.useTranslation(),[u]=F.useLexicalComposerContext(),c=G.useLexicalEditable(),g=e.useCanDownload(),[j,{open:v,close:f}]=z.useDisclosure(!1),[h,{open:x,close:C}]=z.useDisclosure(!1),[y,{open:p,close:b}]=z.useDisclosure(!1),N=()=>{f(),p()},O=r.useMemo(()=>[{id:!n||n==="0"?"":n,Url:a??"",contentType:"image/*",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[a,n]),k=()=>{f(),x()},L=r.useCallback(async()=>{if(f(),!!a)try{await X(a,V(a))}catch{}},[a,f]),P=r.useCallback(()=>{f(),u.update(()=>{const I=S.$getNodeByKey(o);e.$isImageNode(I)&&I.remove()})},[u,o,f]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"image-touch-actions",style:{position:"absolute",top:8,right:8,zIndex:10,pointerEvents:"auto"},onClick:I=>I.stopPropagation(),children:t.jsx(e.At,{label:l("editor.toolbar.more"),icon:e.O1,iconColor:"var(--mantine-color-gray-text)","aria-label":l("editor.toolbar.more"),onClick:v})}),t.jsx(H.AttachmentsGalleryModal,{opened:h,onOpenChange:I=>I?x():C(),attachments:O,allowDownload:g}),t.jsx(e.gn,{opened:j,onClose:f,title:l("editor.image.mobileActions"),children:t.jsxs(w.Stack,{gap:4,p:0,children:[t.jsx(w.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:k,leftSection:t.jsx(e.HugeiconsIcon,{icon:e.gn$1,size:16,color:"var(--mantine-color-dimmed)"}),children:l("editor.image.previewFullScreen")}),c&&t.jsx(w.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:N,leftSection:t.jsx(e.HugeiconsIcon,{icon:e.zz,size:16,color:"var(--mantine-color-dimmed)"}),children:l(s?"editor.link.editLink":"editor.link.addLink")}),g&&t.jsx(w.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:()=>void L(),leftSection:t.jsx(e.HugeiconsIcon,{icon:e.Tm,size:16,color:"var(--mantine-color-dimmed)"}),children:l("editor.gallery.download")}),c&&t.jsx(w.Button,{type:"button",variant:"subtle",color:"red",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:P,leftSection:t.jsx(e.HugeiconsIcon,{icon:e.lg,size:16,color:"var(--mantine-color-red-6)"}),children:l("editor.actions.delete")})]})}),t.jsx(e.gn,{opened:y,onClose:b,title:l(s?"editor.link.editLink":"editor.link.addLink"),children:t.jsx(Y,{editor:u,nodeKey:o,href:s,onClose:b,mobile:!0})})]})}const se=o=>{const{width:a,height:n,isLoading:s,isError:l,src:u,id:c,altText:g,imageRef:j,maxWidth:v,aspectRatio:f,href:h}=o,x=r.useRef(null);return t.jsxs("div",{className:"media-wrapper","data-reserved-box":f?"":void 0,style:{width:a,height:f?"auto":n,aspectRatio:f||void 0,display:"inline-flex",position:"relative"},children:[t.jsx(w.LoadingOverlay,{visible:s,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),t.jsx("a",{className:"editor-image-link","data-link":h?"true":void 0,"data-href":h?e.sanitizeUrl(h):void 0,role:h?"link":void 0,rel:h?"noopener noreferrer":void 0,draggable:!1,onMouseDown:h?C=>{x.current={x:C.clientX,y:C.clientY}}:void 0,onClick:h?C=>{C.preventDefault();const y=x.current;x.current=null,!(y&&Math.hypot(C.clientX-y.x,C.clientY-y.y)>5)&&window.open(e.sanitizeUrl(h),"_blank","noopener,noreferrer")}:void 0,children:t.jsx(Ne,{className:null,src:u,altText:g,imageRef:j,width:"inherit",height:"inherit",maxWidth:v||"auto",id:c})}),e.Ke&&t.jsx(Se,{nodeKey:o.nodeKey,src:u,id:c,href:h}),e.or&&t.jsx(De,{nodeKey:o.nodeKey,src:u,id:c,href:h}),e.It&&!e.Ke&&!e.or&&t.jsx(Ie,{nodeKey:o.nodeKey,src:u,href:h})]})};function Ne({altText:o,className:a,imageRef:n,src:s,width:l,height:u,maxWidth:c,id:g}){const[j,v]=r.useState(!1);return t.jsx("img",{className:`${a||void 0} ${j?"":"loading"}`,src:s,alt:o,ref:n,style:{height:u,maxWidth:c,width:l},onLoad:()=>{s.includes("splash")?setTimeout(()=>{v(!0)},100):v(!0)},draggable:"false","data-id":g})}function Le(o){const{disable:a}=r.useContext(e.Context);return a&&e.ImageNode.isPlaceholderSrc(o.src)?null:t.jsx(Ee,{...o})}function Ee({src:o,altText:a,nodeKey:n,width:s,height:l,maxWidth:u,showCaption:c,caption:g,id:j,create:v,alignment:f,imagePickerTab:h,aspectRatio:x,href:C}){var re,ae;const y=r.useRef(null),[p,b]=r.useState(!0),[N,O]=r.useState(!1),[k]=F.useLexicalComposerContext(),[L,P]=r.useState(!0),[I,U]=r.useState({width:0,height:0}),{start:Z,cancel:J}=e.fr(),[Pe,M]=r.useState(0),{fetchUploadMedia:A,fetchDeleteMedia:Q,maxFileSize:Te,imperativeHandleRef:E,disable:de}=r.useContext(e.Context),$=e.mediaMap.has(o)&&(((re=e.mediaMap.get(o))==null?void 0:re.mediaNodeKeys.length)===0||((ae=e.mediaMap.get(o))==null?void 0:ae.mediaNodeKeys.length)===void 0||o.trim()===""),{t:R}=W.useTranslation(),K=i=>{if(typeof i=="number")return i>0?i:null;if(typeof i=="string"&&!i.includes("%")){const m=parseFloat(i);return Number.isFinite(m)&&m>0?m:null}return null},T=K(s),ee=K(l),te=T&&ee?T/ee:void 0,[ue,ge]=r.useState(void 0),oe=r.useMemo(()=>{try{const i=parseFloat(localStorage.getItem("layers-img-ratio:"+o)||"");return Number.isFinite(i)&&i>0?i:void 0}catch{return}},[o]),pe=te??x??oe??ue,[me,q]=r.useState(!1),fe=!me&&!te&&(x??oe)!=null,[Oe,he]=r.useState(0);r.useEffect(()=>k.registerDecoratorListener(()=>{he(i=>i+1)}),[$]),r.useEffect(()=>{const i=k.getElementByKey(n);i&&(i.style.removeProperty("aspect-ratio"),i.style.removeProperty("width"))},[k,n]),r.useEffect(()=>{if(!o||o.startsWith("data:image/")||!o.trim()){b(!1);return}const i=new Image;i.src=o,i.onload=()=>{if(b(!1),i.naturalWidth){const m=i.naturalWidth/i.naturalHeight;if(ge(m),i.naturalWidth>=100)try{localStorage.setItem("layers-img-ratio:"+o,String(m))}catch{}!x&&i.naturalWidth>=100&&k.update(()=>{const d=S.$getNodeByKey(n);e.$isImageNode(d)&&d.getAspectRatio()==null&&d.setAspectRatio(m)},{tag:"history-merge"})}},i.onerror=()=>{b(!1)}},[o,$]);const we=(i,m)=>{k.update(()=>{S.$setSelection(null);const d=S.$getNodeByKey(n);e.$isImageNode(d)&&d.setWidthAndHeight(i,m)})},{historyState:ne}=e.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:ie}}=e.useSettings();function xe(i){const m=e.decodeSvgDataUrl(i);return m?e.getSvgMarkupSize(m).width:0}function be(i){return new Promise((m,d)=>{if(e.isSvgSource(i)){m(xe(i));return}const D=new Image;D.src=i,D.onload=()=>{m(D.width)},D.onerror=()=>{d(new Error("Failed to load image"))}})}r.useEffect(()=>{let i=s,m=l,d=100;if((o.includes("unsplash")?o.trim():!$&&o.trim()||o.includes("upload-src-editor"))&&o!=="upload"){if(T!=null&&T>=d){P(!1),U({width:T,height:T}),q(!0);return}be(o).then(D=>{typeof i=="number"&&i<d&&D<d?(P(!0),U({width:i,height:m})):D<d?(P(!0),U({width:"auto",height:"auto"})):(U({width:D,height:D}),P(!1)),q(!0)}).catch(D=>{q(!0),console.warn("Ошибка при загрузке изображения:",D.message)})}},[o,$]),r.useEffect(()=>{I.width&&I.height&&L&&k.update(()=>{const i=S.$getNodeByKey(n);e.$isImageNode(i)&&i.setWidthAndHeight(I.width,I.height)})},[I.width,I.height,L]);const ke=r.useCallback(i=>e.$writeImagePickerTabToNode(k,n,i),[k,n]),B=r.useCallback((i,m)=>{O(!1),b(!1),k.update(()=>{const d=S.$getNodeByKey(n);e.$isImageNode(d)&&(d.setSrc(i),d.setId(m))})},[k,n]),ve=r.useCallback(()=>{J(),O(!1),b(!1),M(0)},[J]),_=r.useCallback(i=>{O(!0),b(!0);const m=Z();A&&A(i[0],(d,D)=>{B(d,D),M(0)},d=>{d&&H.showErrorNotification({message:R("editor.gallery.errorFile")}),M(0),B(o.startsWith("blob:")?"upload":"","")},m,d=>{M(d)},k.getEditorState().read(()=>{const d=S.$getNodeByKey(n);return e.$isImageNode(d)?d.getId():void 0}))},[k,A,n,Z,R,B,o]);return r.useEffect(()=>k.registerCommand(e.UPLOAD_IMAGE_COMMAND,i=>!o.startsWith("blob:")&&o!=="upload"||i.targetNodeKey!==n?!1:(_(i.files),!0),S.COMMAND_PRIORITY_LOW),[k,_,n,o]),!o||o==="upload"?N?t.jsx(w.Box,{"data-editor-image-picker-drop-root":!0,w:"100%",children:t.jsx(e.ur,{onCancel:ve})}):t.jsx(w.Box,{"data-editor-image-picker-drop-root":!0,w:"100%",children:t.jsx(e.ImagePicker,{inline:!0,nodeKey:n,defaultTabValue:h,onWriteTabToNode:ke,onUpload:i=>{var d,D;if(!A||!i.length)return;_([i[0]]);const m=i.slice(1);m.length&&((D=(d=E==null?void 0:E.current)==null?void 0:d.insertImages)==null||D.call(d,m))},popoverProps:{opened:!0,position:"bottom",zIndex:e.EDITOR_UI_MIN_Z_INDEX},onChange:i=>{k.update(()=>{const m=S.$getNodeByKey(n);e.$isImageNode(m)&&m.setSrc(i)})}})}):L&&!fe?t.jsx(se,{width:I.width,height:I.height,isLoading:p,isError:!1,isIcon:L,src:o,id:j,editor:k,nodeKey:n,fetchDeleteMedia:Q,altText:a,imageRef:y,maxWidth:u,showCaption:c,caption:g,isCollabActive:!1,historyState:ne,showNestedEditorTreeView:ie,t:R,href:C}):t.jsx(e.mr,{editor:k,isIcon:L,width:e.parseContainerSize(s),height:e.parseContainerSize(l),initialWidth:I.width||"",initialHeight:I.height||"",onResizeEnd:we,alignment:f,disable:de,onRegisterDecoratorEnter:i=>{E!=null&&E.current&&(E.current.decoratorEnterAction=i)},onActivate:()=>k.dispatchCommand(e.ON_CHANGE_COMMAND,"show_menu"),children:t.jsx(se,{width:"inherit",height:"inherit",aspectRatio:pe,isLoading:p,isError:!1,isIcon:L,src:o,id:j,editor:k,nodeKey:n,fetchDeleteMedia:Q,altText:a,imageRef:y,maxWidth:u,showCaption:c,caption:g,isCollabActive:!1,historyState:ne,showNestedEditorTreeView:ie,t:R,href:C})})}exports.default=Le;
|