@layers-app/editor 2.2.45 → 2.3.2
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 +8 -8
- package/dist/{layers.sKO5wWzt.js → layers.-Lu1Y8pE.js} +1 -1
- package/dist/{layers.n-DYmU2Z.js → layers.-szWP3hz.js} +1 -1
- package/dist/{layers.t9b6t4Ii.js → layers.07RX8yEb.js} +1 -1
- package/dist/{layers.nXKHyTlo.js → layers.0b2KQv8V.js} +1 -1
- package/dist/{layers.CDc-JAN1.js → layers.0p7IoDBP.js} +1 -1
- package/dist/{layers.B5yZJBoB.js → layers.1LdmAcFn.js} +1 -1
- package/dist/{layers.DIYV_Qgp.js → layers.1QfkvGfu.js} +1 -1
- package/dist/{layers.D1OY3B-n.js → layers.1u37zniq.js} +137 -137
- package/dist/{layers.Dt-Xolan.js → layers.2YempUdR.js} +1 -1
- package/dist/{layers.DNqMXVNp.js → layers.2lHfCJig.js} +1 -1
- package/dist/{layers.DVZjfzxM.js → layers.3NkYOlPc.js} +1 -1
- package/dist/{layers.DveF4Taj.js → layers.5-nlHms-.js} +1 -1
- package/dist/{layers.BaVDbZc-.js → layers.7QEU54i7.js} +1 -1
- package/dist/{layers.BVrMVvbD.js → layers.9Ao_2noc.js} +1 -1
- package/dist/{layers.CuZ6oi1Y.js → layers.B-SVhE6O.js} +1 -1
- package/dist/{layers.CJzs0OdD.js → layers.B18cm1fP.js} +1 -1
- package/dist/{layers.C4W6rbDZ.js → layers.B1zVsm3v.js} +2982 -4133
- package/dist/{layers.DYK2Cc2v.js → layers.B3AzuO5j.js} +6 -6
- package/dist/{layers.DKpytb6w.js → layers.B45uHJx5.js} +1 -1
- package/dist/layers.B4RgDHky.js +8 -0
- package/dist/{layers.ByyJrMEp.js → layers.B6BkvW61.js} +2 -2
- package/dist/{layers.BKrToDbz.js → layers.B6eWq2PJ.js} +1 -1
- package/dist/{layers.C2pTMR38.js → layers.B7XmQLJK.js} +1 -1
- package/dist/layers.B7stR0tg.js +7 -0
- package/dist/{layers.BaMwv1jF.js → layers.BA8DF0PO.js} +1 -1
- package/dist/{layers.xMjrkzgP.js → layers.BApatZ6g.js} +1 -1
- package/dist/layers.BCIkvjT3.js +1157 -0
- package/dist/layers.BDBPcQmQ.js +6 -0
- package/dist/{layers.D2IuhDCQ.js → layers.BGhbAdxW.js} +1 -1
- package/dist/{layers.BqnQzZ9x.js → layers.BHSzaYhb.js} +1 -1
- package/dist/{layers.Cjk9bUrz.js → layers.BJrXormV.js} +1 -1
- package/dist/layers.BKn-MzWR.js +1 -0
- package/dist/{layers.DiA7fPFt.js → layers.BNJSdCvt.js} +3 -3
- package/dist/{layers.oXNzpBlK.js → layers.BNWZu7ax.js} +27 -27
- package/dist/{layers.CcfiG8Od.js → layers.BSLmKXjv.js} +1 -1
- package/dist/{layers.Cg39QOHR.js → layers.BVgL-L5o.js} +1 -1
- package/dist/{layers.BcfRIrYG.js → layers.BZVFfwPr.js} +1 -1
- package/dist/{layers.DWpAFgGF.js → layers.B_D5rwSo.js} +1 -1
- package/dist/{layers.Du37x8v3.js → layers.B_TxnlNK.js} +1 -1
- package/dist/{layers.vEoVIWoQ.js → layers.BaYNtgYj.js} +1 -1
- package/dist/{layers.BadeIJgG.js → layers.BcFAMw4h.js} +4 -4
- package/dist/layers.Bg7BQcmt.js +31 -0
- package/dist/{layers.DjG7qFHf.js → layers.BgfG0iAU.js} +11 -11
- package/dist/{layers.CtFiU_U-.js → layers.Bi3TxQ-w.js} +1 -1
- package/dist/{layers.ClSS_-JK.js → layers.Bk0YEHy0.js} +1 -1
- package/dist/{layers.BEdP6w5G.js → layers.Bl6nUUCL.js} +1 -1
- package/dist/{layers.9chn1oBm.js → layers.BmHLBcUn.js} +1 -1
- package/dist/{layers.DvfttTXQ.js → layers.Bou1yCWs.js} +1 -1
- package/dist/{layers.DinGcvYA.js → layers.BpdNScyT.js} +33 -33
- package/dist/{layers.VPQgHqCC.js → layers.BpzAh8uk.js} +1 -1
- package/dist/{layers.DheygGyD.js → layers.BqB1S61a.js} +1 -1
- package/dist/{layers.DJTqJuKz.js → layers.Bqi5-M5H.js} +15 -15
- package/dist/{layers.CABrQ2Zs.js → layers.Br59qLOa.js} +1 -1
- package/dist/{layers.CmSiqz4U.js → layers.Br99nr8r.js} +3 -3
- package/dist/{layers.DLiv2kEf.js → layers.BsMr5tgs.js} +1 -1
- package/dist/{layers.g-cZDg-J.js → layers.BskjH0Pq.js} +42 -42
- package/dist/{layers.QhZDFUq4.js → layers.BvQ-SlEw.js} +1 -1
- package/dist/{layers.BEIgYyne.js → layers.BvVY8MIz.js} +1 -1
- package/dist/{layers.vXZEDgHQ.js → layers.Bw05_Vds.js} +1 -1
- package/dist/{layers.Cof8D_jH.js → layers.Bxfnl5-h.js} +1 -1
- package/dist/{layers.BOkb4Kwr.js → layers.C0C2_xj0.js} +1 -1
- package/dist/{layers.CHqw81xe.js → layers.C0mcLf6q.js} +1 -1
- package/dist/{layers.cCd9G0s7.js → layers.C3Rfjtv2.js} +1 -1
- package/dist/{layers.CO180qeA.js → layers.C3T10c7B.js} +1 -1
- package/dist/{layers.CAs2-nlo.js → layers.C438BOob.js} +13 -13
- package/dist/{layers.a0ekgaAk.js → layers.C4Sae2dk.js} +1 -1
- package/dist/{layers.CGra3CE8.js → layers.C4ys15M1.js} +2 -2
- package/dist/{layers.Cx21Vx7C.js → layers.C6L2IcKs.js} +1 -1
- package/dist/{layers.B68ca-eU.js → layers.C8xyAF4H.js} +1 -1
- package/dist/{layers.BmnporKE.js → layers.C9ZkpW3f.js} +1 -1
- package/dist/{layers.BTBRVGFs.js → layers.CACM-S8f.js} +1 -1
- package/dist/{layers.CwiLAF0n.js → layers.CBptEVEC.js} +1 -1
- package/dist/{layers.CqFgGsQ4.js → layers.CCO6z_Dk.js} +3 -3
- package/dist/{layers.CFLly-Qe.js → layers.CD3hBq0O.js} +1 -1
- package/dist/{layers.DqCVQnl5.js → layers.CD6NTcVN.js} +1 -1
- package/dist/{layers.YdWr9xoX.js → layers.CDcS1HVy.js} +1 -1
- package/dist/{layers.C_M8g-oV.js → layers.CFelVuJn.js} +1 -1
- package/dist/{layers.wby51kRL.js → layers.CGrTICUV.js} +4 -4
- package/dist/{layers.B028_Pfk.js → layers.CHp6mCE4.js} +13 -13
- package/dist/{layers.C7y7h6VM.js → layers.CI5w6LTn.js} +1 -1
- package/dist/{layers.Du94jGQf.js → layers.CMmkXOIK.js} +1 -1
- package/dist/{layers.CM1BoU1E.js → layers.CNlly0q1.js} +1 -1
- package/dist/layers.COQskeW_.js +1 -0
- package/dist/{layers.DDTNqkEk.js → layers.CPRLWAR-.js} +1 -1
- package/dist/{layers.Cc98lCPt.js → layers.CPTJ3alm.js} +1 -1
- package/dist/{layers.Db7WC46z.js → layers.CQ6hARGk.js} +1 -1
- package/dist/{layers.B0sQe5D1.js → layers.CQSidsT8.js} +3 -3
- package/dist/{layers.D_LcSG5Y.js → layers.CTUNcEKH.js} +1 -1
- package/dist/{layers.bk9EcYJr.js → layers.CUICXRX_.js} +39 -39
- package/dist/{layers.DG26Vzsi.js → layers.CVoEUbsY.js} +3 -3
- package/dist/{layers.NEN1dVNO.js → layers.CVwlyScd.js} +1 -1
- package/dist/{layers.Dd_MQmMI.js → layers.CWGbyc5i.js} +8 -8
- package/dist/{layers.BfHX9frV.js → layers.CXP6VyC8.js} +1 -1
- package/dist/{layers.DvlQFVL_.js → layers.CYjAXUTT.js} +1 -1
- package/dist/{layers.Czx1TgLO.js → layers.C_TU8VSm.js} +2 -2
- package/dist/{layers.BJrL0_Rw.js → layers.C_pPFp7r.js} +2 -2
- package/dist/{layers.C9bqqwGA.js → layers.CaMSFA8F.js} +40 -40
- package/dist/{layers.C2izS29k.js → layers.CcrUyw_4.js} +1 -1
- package/dist/{layers.Ce54L6_R.js → layers.CfdV11eO.js} +1 -1
- package/dist/{layers.CKLSBcei.js → layers.Cgk-kwK1.js} +1 -1
- package/dist/{layers.CldflZpf.js → layers.CiGiXdW0.js} +1 -1
- package/dist/{layers.CEaPCwCe.js → layers.Ck5r7FLY.js} +1 -1
- package/dist/{layers.0KslT0iv.js → layers.CkM48uS9.js} +1 -1
- package/dist/{layers.DzgpLhqO.js → layers.Cl9S-4Pe.js} +1 -1
- package/dist/{layers.C7E3l-g_.js → layers.CoCas1TR.js} +2 -2
- package/dist/{layers.mHLeiSFC.js → layers.Cp0-bIRY.js} +1 -1
- package/dist/{layers.C53wglsE.js → layers.CpxSB-RY.js} +1 -1
- package/dist/{layers.CLP8NLxE.js → layers.Cs-91dHA.js} +1 -1
- package/dist/{layers.km8iRn1X.js → layers.Csa1VvEE.js} +95 -95
- package/dist/{layers.DQNE7pSr.js → layers.CslLaJk_.js} +1 -1
- package/dist/{layers.9PIBmdB5.js → layers.CuR5VVPK.js} +31 -31
- package/dist/{layers.Bex3-2F0.js → layers.CvEHURtU.js} +7 -7
- package/dist/{layers.C9O_XgoY.js → layers.CvGS___n.js} +3 -3
- package/dist/{layers.Bmw_ImFW.js → layers.CxUdn3NH.js} +1 -1
- package/dist/{layers.BDSMUwmt.js → layers.CydBhqPl.js} +1 -1
- package/dist/{layers.D53HW-OH.js → layers.CzuvYlVS.js} +1 -1
- package/dist/{layers.CiDAyBeD.js → layers.D3ETIEPw.js} +1 -1
- package/dist/{layers.BDmaTCfD.js → layers.D5Y3jocj.js} +6 -6
- package/dist/{layers.DQbonqH1.js → layers.D6DW5vEY.js} +1 -1
- package/dist/{layers.jg--vRcI.js → layers.D6G3COyk.js} +15952 -15775
- package/dist/{layers.Cyy4XziO.js → layers.D7jViIYU.js} +1 -1
- package/dist/{layers.DhROyrvJ.js → layers.D8LVQ3ZY.js} +1 -1
- package/dist/{layers.D-dncXMv.js → layers.D8tNGYAu.js} +1 -1
- package/dist/{layers.Bb6_oKs8.js → layers.D98-ldv6.js} +1 -1
- package/dist/{layers.CbG7bPrw.js → layers.DBF94XFg.js} +1 -1
- package/dist/{layers.C2CWUW0P.js → layers.DBFr2bUd.js} +1 -1
- package/dist/{layers.DvhAl2Y2.js → layers.DC8w8IZi.js} +1 -1
- package/dist/layers.DEGygGYH.js +1 -0
- package/dist/layers.DG37kMJR.js +8 -0
- package/dist/{layers.BVQVuKjJ.js → layers.DG8L4wIG.js} +1 -1
- package/dist/{layers.B7VPVY9m.js → layers.DGcUMS0Y.js} +1 -1
- package/dist/{layers.C5spre2i.js → layers.DHj5lmQt.js} +1 -1
- package/dist/{layers.CQESVhxO.js → layers.DIPLdCyl.js} +1 -1
- package/dist/{layers.QSp10MBY.js → layers.DJaA-u-I.js} +1 -1
- package/dist/{layers.DhOjjk4e.js → layers.DJs9wM3X.js} +1 -1
- package/dist/{layers.Dx2lhGzZ.js → layers.DKUdJiaR.js} +3 -3
- package/dist/{layers.bWZDlvmW.js → layers.DRlDj5iQ.js} +1 -1
- package/dist/{layers.BxaGfbS4.js → layers.DRxlnsz8.js} +2 -2
- package/dist/{layers.B22dcdRZ.js → layers.DTz-KpDZ.js} +1 -1
- package/dist/{layers.CmXdbn8_.js → layers.DUcUGFmf.js} +1 -1
- package/dist/{layers.BC7Cg5cy.js → layers.DUhN3YqR.js} +1 -1
- package/dist/{layers.B5HuEtfE.js → layers.DVKcHQP4.js} +1 -1
- package/dist/{layers.P39es0O4.js → layers.DVntzq3z.js} +1 -1
- package/dist/{layers.C7LxBBYp.js → layers.DW7LKZ0_.js} +5 -5
- package/dist/{layers.B5a2e-Mn.js → layers.DXfvADbO.js} +1 -1
- package/dist/layers.DZCT2Mg-.js +1314 -0
- package/dist/{layers.jcCRaKGd.js → layers.D_beONxk.js} +1 -1
- package/dist/layers.Dbm3hiPL.js +5 -0
- package/dist/{layers.B465LyPz.js → layers.DcHhrRyA.js} +1 -1
- package/dist/{layers.yftdzODL.js → layers.Dd6kYaXy.js} +1 -1
- package/dist/{layers.D2bgGfrE.js → layers.DdXWqMWK.js} +5 -5
- package/dist/{layers.DRNjIrAp.js → layers.DfiQKKL6.js} +1 -1
- package/dist/{layers.CIMF-Kx_.js → layers.DhPRmiMt.js} +1 -1
- package/dist/{layers.CP2x77Hz.js → layers.DhySCQVw.js} +1 -1
- package/dist/{layers.CsgsF5Ft.js → layers.Di5OB7o7.js} +1 -1
- package/dist/{layers.BkUV4peM.js → layers.Di82CoED.js} +1 -1
- package/dist/{layers.CZzgBinT.js → layers.DiL6nhZW.js} +1 -1
- package/dist/{layers.0O_y_PSM.js → layers.Diyb97EX.js} +4 -4
- package/dist/{layers.DxQF7DU5.js → layers.DjZrXDXn.js} +1 -1
- package/dist/{layers.CY17OEce.js → layers.DjjlhtCb.js} +1 -1
- package/dist/{layers.C-TQ4gDg.js → layers.DktiF6wI.js} +1 -1
- package/dist/{layers.CYW1WEKe.js → layers.Dlo3gmCf.js} +1 -1
- package/dist/{layers.CgtkYIke.js → layers.Dngx99va.js} +1 -1
- package/dist/{layers.CwazPZdq.js → layers.DrCegXS7.js} +2 -2
- package/dist/{layers.BpL4mYVq.js → layers.Dsjwdeov.js} +1 -1
- package/dist/{layers.VNPeSDc5.js → layers.DuAKqNV4.js} +1 -1
- package/dist/{layers.CSsCFhvL.js → layers.DvtOcWdD.js} +1 -1
- package/dist/{layers.DFxl_E74.js → layers.Dx0gFI_8.js} +4 -4
- package/dist/layers.Dxr2o7ON.js +1 -0
- package/dist/{layers.oNZW8UBG.js → layers.DyI1UB-M.js} +1 -1
- package/dist/{layers.DXbA6oVt.js → layers.Dywy71My.js} +1 -1
- package/dist/{layers.Co4l7_YV.js → layers.EhSWkpTH.js} +1 -1
- package/dist/layers.Hlsf4WAl.js +84 -0
- package/dist/{layers.j6LRzfso.js → layers.I-yaQKvi.js} +1 -1
- package/dist/layers.IP5Q54QC.js +90 -0
- package/dist/{layers.CT3XTF81.js → layers.IUszdZkA.js} +1 -1
- package/dist/{layers.BuPdI71w.js → layers.JJZGIQ_O.js} +1 -1
- package/dist/{layers.DnSDu3aj.js → layers.JK4CPmb2.js} +1 -1
- package/dist/{layers.DcYmpYNe.js → layers.LU2ER-pA.js} +1 -1
- package/dist/{layers.ia3f0EYv.js → layers.M4pn2wm-.js} +1 -1
- package/dist/{layers.BWWFQbUs.js → layers.PLuaosLv.js} +25 -25
- package/dist/{layers.Dvt-Szfl.js → layers.PTKeHAhs.js} +1 -1
- package/dist/{layers.CMB0mF82.js → layers.Pum1ALdT.js} +1 -1
- package/dist/layers.VUXyPQnV.js +1 -0
- package/dist/{layers.XAmXrnxl.js → layers.VyIOesty.js} +1 -1
- package/dist/{layers.DmmEgUMf.js → layers.Ze-wao45.js} +1 -1
- package/dist/{layers.JKpsQUa8.js → layers._dfPZGuq.js} +1 -1
- package/dist/{layers.DgBtq91i.js → layers.aT2npTXt.js} +1 -1
- package/dist/{layers.BunhC82l.js → layers.ba2tniXd.js} +1 -1
- package/dist/{layers.DUD000-v.js → layers.bv5XSWTF.js} +16 -16
- package/dist/layers.c7P3mcxJ.js +1 -0
- package/dist/{layers.CCQQxd5s.js → layers.dDOcJyrx.js} +1 -1
- package/dist/{layers.DuNmb6iV.js → layers.eQTvi5Gi.js} +1 -1
- package/dist/{layers.fnoJpR74.js → layers.ezjomIHR.js} +1 -1
- package/dist/{layers.Cw289Pgg.js → layers.gFANqZul.js} +12 -12
- package/dist/{layers.BUZ2pvws.js → layers.gbsNfZYX.js} +1 -1
- package/dist/{layers.Cvc8xBfw.js → layers.h_l-O4Ya.js} +4107 -4135
- package/dist/{layers.Bf3CS2lb.js → layers.i4tkD9gF.js} +4 -4
- package/dist/{layers.D5naed4X.js → layers.iwts8VqI.js} +1 -1
- package/dist/{layers.txhP70wF.js → layers.jASAtfrf.js} +1 -1
- package/dist/{layers.DGO5wxx-.js → layers.jC4CNUhM.js} +1 -1
- package/dist/{layers.BjDSCoZM.js → layers.khwx4QvE.js} +1 -1
- package/dist/{layers.NCy-p2UI.js → layers.lTT2Z5W-.js} +21 -21
- package/dist/{layers.rkrNrIQd.js → layers.mY4jXoD0.js} +1 -1
- package/dist/{layers.Cg-zHhDe.js → layers.maXwdOZO.js} +2 -2
- package/dist/{layers.0ohwJnJO.js → layers.oBoAHASG.js} +174 -167
- package/dist/{layers.DoceYQaZ.js → layers.v6OYKSou.js} +1 -1
- package/dist/{layers.AL_UvFa5.js → layers.zaXLl66X.js} +1 -1
- package/package.json +7 -2
- package/dist/layers.BX2zMMPD.js +0 -6
- package/dist/layers.CjUQRZCf.js +0 -1313
- package/dist/layers.DXT1JSUZ.js +0 -5
- package/dist/layers.Dele1d2B.js +0 -1
- package/dist/layers.DfHZkVTD.js +0 -1
- package/dist/layers.DrZOHzCc.js +0 -84
- package/dist/layers.OYg34Rse.js +0 -1
- package/dist/layers.SIpDBTUg.js +0 -96
- package/dist/layers.nIE5wUh9.js +0 -1
- package/dist/layers.rE1cepGv.js +0 -8
package/dist/layers.nIE5wUh9.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),R=require("react-i18next"),$=require("@lexical/react/LexicalComposerContext"),x=require("@mantine/core"),N=require("lexical"),o=require("./layers.CjUQRZCf.js"),F=require("@layers-app/shared"),q=require("@lexical/react/useLexicalEditable"),A=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 xe(e,r){const n=document.createElement("a");n.href=e,n.download=r,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove()}function B(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 H(e,r){const n=await fetch(e);if(!n.ok)throw new Error("fetch failed");const s=await n.blob(),l=URL.createObjectURL(s);try{xe(l,r)}finally{setTimeout(()=>URL.revokeObjectURL(l),0)}}function be({editor:e,nodeKey:r,href:n,onClose:s}){const[l,d]=a.useState(()=>o.getLinkTypeFromUrl(n)),[c,u]=a.useState(()=>o.removeProtocol(n)),[I,v]=a.useState(!1),m=a.useCallback(g=>{d(g),v(!1)},[]),f=a.useCallback(g=>{u(g),v(!1)},[]),b=a.useCallback(()=>{const g=o.addProtocolIfNeeded(c.trim(),l);if(!g||!o.isValidUrl(g,l)){v(!0);return}o.$writeImageLinkToNode(e,r,o.sanitizeUrl(g)),s()},[e,r,c,l,s]),C=a.useCallback(()=>{o.$writeImageLinkToNode(e,r,""),s()},[e,r,s]),y=a.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),b()):g.key==="Escape"&&(g.preventDefault(),s())},[b,s]);return{linkType:l,linkUrl:c,error:I,onLinkTypeChange:m,onUrlInputChange:f,onUrlInputKeyDown:y,onSave:b,onRemove:C}}function V({editor:e,nodeKey:r,href:n,onClose:s,mobile:l}){const d=a.useRef(null),c=be({editor:e,nodeKey:r,href:n,onClose:s});return a.useEffect(()=>{var u;(u=d.current)==null||u.focus({preventScroll:!0})},[]),t.jsx(o.CreateMode,{inputRef:d,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 ae({opened:e,onOpenChange:r,t:n,onDownload:s,onDelete:l,hasLink:d,onLinkAction:c}){return t.jsxs(x.Menu,{opened:e,onChange:r,transitionProps:o.animationMenu,shadow:"md",position:"bottom-start",offset:4,withinPortal:!0,closeOnItemClick:!0,children:[t.jsx(x.Menu.Target,{children:t.jsx(o.ActionIcon,{label:n("editor.toolbar.more"),icon:o.K1,iconColor:"var(--mantine-color-gray-text)","aria-label":n("editor.toolbar.more")})}),t.jsxs(x.Menu.Dropdown,{p:4,miw:164,w:"max-content",onMouseDown:u=>u.preventDefault(),children:[c&&t.jsx(x.Menu.Item,{leftSection:t.jsx(x.Flex,{align:"center",justify:"center",c:"gray.6",children:t.jsx(o.Icon,{name:"link",size:16})}),onClick:u=>{u.stopPropagation(),c()},children:n(d?"editor.link.editLink":"editor.link.addLink")}),t.jsx(x.Menu.Item,{leftSection:t.jsx(x.Flex,{align:"center",justify:"center",c:"gray.6",children:t.jsx(o.HugeiconsIcon,{icon:o.Tm,size:16})}),onClick:u=>{u.stopPropagation(),s()},children:n("editor.gallery.download")}),t.jsx(x.Menu.Item,{color:"red",leftSection:t.jsx(x.Flex,{align:"center",justify:"center",c:"red.6",children:t.jsx(o.HugeiconsIcon,{icon:o.lg,size:16})}),onClick:u=>{u.stopPropagation(),l()},children:n("editor.contextMenu.delete")})]})]})}const re=({t:e,src:r,setShown:n,id:s})=>{const[l,{open:d,close:c}]=A.useDisclosure(!1),u=o.useCanDownload(),I=a.useMemo(()=>[{id:!s||s==="0"?"":s,Url:r??"",contentType:"image/*",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[r,s]),v=m=>{m?d():c()};return t.jsxs(t.Fragment,{children:[t.jsx(F.AttachmentsGalleryModal,{opened:l,onOpenChange:v,attachments:I,allowDownload:u}),t.jsx(o.ActionIcon,{label:e("editor.image.preview"),icon:o.gn,iconColor:"var(--mantine-color-gray-text)","aria-label":e("editor.image.preview"),onClick:()=>{n(!1),d()}})]})},ke=({nodeKey:e,src:r,href:n})=>{const[s]=$.useLexicalComposerContext(),l=q.useLexicalEditable(),[d,c]=a.useState(!1),[u,I]=a.useState(!1),[v,m]=a.useState(!1),{t:f}=R.useTranslation();a.useEffect(()=>{if(!v)return;const y=g=>{const k=g.target;k!=null&&k.closest(".floating-link-dropdown")||k!=null&&k.closest(".floating-link-type-combobox-dropdown")||m(!1)};return document.addEventListener("pointerdown",y,!0),()=>document.removeEventListener("pointerdown",y,!0)},[v]);const b=a.useCallback(()=>{s.update(()=>{const y=N.$getNodeByKey(e);o.$isImageNode(y)&&y.remove()})},[s,e]),C=a.useCallback(async()=>{if(r)try{await H(r,B(r))}catch{}},[r]);return t.jsxs(x.Popover,{opened:v,onChange:m,position:"bottom-end",offset:4,shadow:"md",radius:"md",withinPortal:!0,closeOnClickOutside:!1,children:[t.jsx(x.Popover.Target,{children:t.jsxs("div",{className:`media-actions ${l?"":"media-actions--readonly"}`,children:[t.jsx(re,{t:f,src:r,setShown:()=>{}}),l&&t.jsxs(t.Fragment,{children:[t.jsx(o.NodeAlignmentMenu,{opened:d,setOpened:c,t:f,editor:s,nodeKey:e,setShown:()=>{}}),t.jsx(ae,{opened:u,onOpenChange:I,t:f,onDownload:()=>void C(),onDelete:b,hasLink:!!n,onLinkAction:()=>m(!0)})]})]})}),t.jsx(x.Popover.Dropdown,{className:`floating-link-dropdown floating-link-dropdown--${n?"edit":"create"}-mode`,"data-test-id":"floating-link-dropdown",children:t.jsx(V,{editor:s,nodeKey:e,href:n,onClose:()=>m(!1)})})]})},ve=()=>{};function ye({nodeKey:e,src:r,id:n,href:s}){const{t:l}=R.useTranslation(),[d]=$.useLexicalComposerContext(),c=q.useLexicalEditable(),[u,I]=a.useState(!1),[v,m]=a.useState(!1),[f,b]=a.useState(!1);a.useEffect(()=>{if(!f)return;const g=k=>{const p=k.target;p!=null&&p.closest(".floating-link-dropdown")||p!=null&&p.closest(".floating-link-type-combobox-dropdown")||b(!1)};return document.addEventListener("pointerdown",g,!0),()=>document.removeEventListener("pointerdown",g,!0)},[f]);const C=a.useCallback(()=>{m(!1),d.update(()=>{const g=N.$getNodeByKey(e);if(!o.$isImageNode(g))return;const k=g.getParent();o.$isImageOverlayWrapperNode(k)?k.remove():g.remove()})},[d,e]),y=a.useCallback(async()=>{if(r)try{await H(r,B(r))}catch{}},[r]);return t.jsxs(x.Popover,{opened:f,onChange:b,position:"bottom-end",offset:4,shadow:"md",radius:"md",withinPortal:!0,closeOnClickOutside:!1,children:[t.jsx(x.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:g=>g.stopPropagation(),children:[t.jsx(re,{t:l,src:r,setShown:ve,id:n}),c&&t.jsxs(t.Fragment,{children:[t.jsx(o.NodeAlignmentMenu,{opened:u,setOpened:I,t:l,editor:d,nodeKey:e}),t.jsx(ae,{opened:v,onOpenChange:m,t:l,onDownload:()=>void y(),onDelete:C,hasLink:!!s,onLinkAction:()=>b(!0)})]})]})}),t.jsx(x.Popover.Dropdown,{className:`floating-link-dropdown floating-link-dropdown--${s?"edit":"create"}-mode`,"data-test-id":"floating-link-dropdown",children:t.jsx(V,{editor:d,nodeKey:e,href:s,onClose:()=>b(!1)})})]})}function Ce({nodeKey:e,src:r,id:n,href:s}){const{t:l}=R.useTranslation(),[d]=$.useLexicalComposerContext(),c=q.useLexicalEditable(),u=o.useCanDownload(),[I,{open:v,close:m}]=A.useDisclosure(!1),[f,{open:b,close:C}]=A.useDisclosure(!1),[y,{open:g,close:k}]=A.useDisclosure(!1),p=()=>{m(),g()},L=a.useMemo(()=>[{id:!n||n==="0"?"":n,Url:r??"",contentType:"image/*",originalFileName:"",fileSize:0,storageType:"",storagePath:"",fileName:"",parentType:"",parentId:"",ownerId:"",createdAt:new Date,updatedAt:new Date,version:0,deleted:!1,deletedAt:new Date}],[r,n]),E=()=>{m(),b()},D=a.useCallback(async()=>{if(m(),!!r)try{await H(r,B(r))}catch{}},[r,m]),T=a.useCallback(()=>{m(),d.update(()=>{const S=N.$getNodeByKey(e);o.$isImageNode(S)&&S.remove()})},[d,e,m]);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:S=>S.stopPropagation(),children:t.jsx(o.ActionIcon,{label:l("editor.toolbar.more"),icon:o.O1,iconColor:"var(--mantine-color-gray-text)","aria-label":l("editor.toolbar.more"),onClick:v})}),t.jsx(F.AttachmentsGalleryModal,{opened:f,onOpenChange:S=>S?b():C(),attachments:L,allowDownload:u}),t.jsx(o.MobileDrawer,{opened:I,onClose:m,title:l("editor.image.mobileActions"),children:t.jsxs(x.Stack,{gap:4,p:0,children:[t.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:E,leftSection:t.jsx(o.HugeiconsIcon,{icon:o.gn,size:16,color:"var(--mantine-color-dimmed)"}),children:l("editor.image.previewFullScreen")}),c&&t.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:p,leftSection:t.jsx(o.HugeiconsIcon,{icon:o.zz,size:16,color:"var(--mantine-color-dimmed)"}),children:l(s?"editor.link.editLink":"editor.link.addLink")}),u&&t.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:()=>void D(),leftSection:t.jsx(o.HugeiconsIcon,{icon:o.Tm,size:16,color:"var(--mantine-color-dimmed)"}),children:l("editor.gallery.download")}),c&&t.jsx(x.Button,{type:"button",variant:"subtle",color:"red",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:T,leftSection:t.jsx(o.HugeiconsIcon,{icon:o.lg,size:16,color:"var(--mantine-color-red-6)"}),children:l("editor.actions.delete")})]})}),t.jsx(o.MobileDrawer,{opened:y,onClose:k,title:l(s?"editor.link.editLink":"editor.link.addLink"),children:t.jsx(V,{editor:d,nodeKey:e,href:s,onClose:k,mobile:!0})})]})}const ie=e=>{const{width:r,height:n,isLoading:s,isError:l,src:d,id:c,altText:u,imageRef:I,maxWidth:v,aspectRatio:m,href:f}=e,b=a.useRef(null);return t.jsxs("div",{className:"media-wrapper","data-reserved-box":m?"":void 0,style:{width:r,height:m?"auto":n,aspectRatio:m||void 0,display:"inline-flex",position:"relative"},children:[t.jsx(x.LoadingOverlay,{visible:s,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),t.jsx("a",{className:"editor-image-link","data-link":f?"true":void 0,"data-href":f?o.sanitizeUrl(f):void 0,role:f?"link":void 0,rel:f?"noopener noreferrer":void 0,draggable:!1,onMouseDown:f?C=>{b.current={x:C.clientX,y:C.clientY}}:void 0,onClick:f?C=>{C.preventDefault();const y=b.current;b.current=null,!(y&&Math.hypot(C.clientX-y.x,C.clientY-y.y)>5)&&window.open(o.sanitizeUrl(f),"_blank","noopener,noreferrer")}:void 0,children:t.jsx(Ie,{className:null,src:d,altText:u,imageRef:I,width:"inherit",height:"inherit",maxWidth:v||"auto",id:c})}),o.IS_TOUCH_DEVICE&&t.jsx(Ce,{nodeKey:e.nodeKey,src:d,id:c,href:f}),o.IS_TOUCH_TABLET&&t.jsx(ye,{nodeKey:e.nodeKey,src:d,id:c,href:f}),o.IS_HOVER_CAPABLE&&!o.IS_TOUCH_DEVICE&&!o.IS_TOUCH_TABLET&&t.jsx(ke,{nodeKey:e.nodeKey,src:d,href:f})]})};function Ie({altText:e,className:r,imageRef:n,src:s,width:l,height:d,maxWidth:c,id:u}){const[I,v]=a.useState(!1);return t.jsx("img",{className:`${r||void 0} ${I?"":"loading"}`,src:s,alt:e,ref:n,style:{height:d,maxWidth:c,width:l},onLoad:()=>{s.includes("splash")?setTimeout(()=>{v(!0)},100):v(!0)},draggable:"false","data-id":u})}function je(e){const{disable:r}=a.useContext(o.Context);return r&&o.ImageNode.isPlaceholderSrc(e.src)?null:t.jsx(De,{...e})}function De({src:e,altText:r,nodeKey:n,width:s,height:l,maxWidth:d,showCaption:c,caption:u,id:I,create:v,alignment:m,imagePickerTab:f,aspectRatio:b,href:C}){var oe,ne;const y=a.useRef(null),[g,k]=a.useState(!0),[p]=$.useLexicalComposerContext(),[L,E]=a.useState(!0),[D,T]=a.useState({width:0,height:0}),{start:S}=o.useCancelUpload(),[Ne,z]=a.useState(0),{fetchUploadMedia:P,fetchDeleteMedia:G,maxFileSize:Se,imperativeHandleRef:O,disable:se}=a.useContext(o.Context),M=o.mediaMap.has(e)&&(((oe=o.mediaMap.get(e))==null?void 0:oe.mediaNodeKeys.length)===0||((ne=o.mediaMap.get(e))==null?void 0:ne.mediaNodeKeys.length)===void 0||e.trim()===""),{t:U}=R.useTranslation(),X=i=>{if(typeof i=="number")return i>0?i:null;if(typeof i=="string"&&!i.includes("%")){const h=parseFloat(i);return Number.isFinite(h)&&h>0?h:null}return null},Y=X(s),Z=X(l),J=Y&&Z?Y/Z:void 0,[le,ce]=a.useState(void 0),Q=a.useMemo(()=>{try{const i=parseFloat(localStorage.getItem("layers-img-ratio:"+e)||"");return Number.isFinite(i)&&i>0?i:void 0}catch{return}},[e]),de=J??b??Q??le,[ue,K]=a.useState(!1),ge=!ue&&!J&&(b??Q)!=null,[Le,pe]=a.useState(0);a.useEffect(()=>p.registerDecoratorListener(()=>{pe(i=>i+1)}),[M]),a.useEffect(()=>{const i=p.getElementByKey(n);i&&(i.style.removeProperty("aspect-ratio"),i.style.removeProperty("width"))},[p,n]),a.useEffect(()=>{if(!e||e.startsWith("data:image/")||!e.trim()){k(!1);return}const i=new Image;i.src=e,i.onload=()=>{if(k(!1),i.naturalWidth){const h=i.naturalWidth/i.naturalHeight;if(ce(h),i.naturalWidth>=100)try{localStorage.setItem("layers-img-ratio:"+e,String(h))}catch{}!b&&i.naturalWidth>=100&&p.update(()=>{const w=N.$getNodeByKey(n);o.$isImageNode(w)&&w.getAspectRatio()==null&&w.setAspectRatio(h)},{tag:"history-merge"})}},i.onerror=()=>{k(!1)}},[e,M]);const me=(i,h)=>{p.update(()=>{N.$setSelection(null);const w=N.$getNodeByKey(n);o.$isImageNode(w)&&w.setWidthAndHeight(i,h)})},{historyState:ee}=o.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:te}}=o.useSettings();function fe(i){return i.endsWith(".svg")||i.includes("image/svg+xml")}function he(i){return new Promise((h,w)=>{if(fe(i)){h(0);return}const j=new Image;j.src=i,j.onload=()=>{h(j.width)},j.onerror=()=>{w(new Error("Failed to load image"))}})}a.useEffect(()=>{let i=s,h=l,w=100;(e.includes("unsplash")?e.trim():!M&&e.trim()||e.includes("upload-src-editor"))&&e!=="upload"&&he(e).then(j=>{typeof i=="number"&&i<w&&j<w?(E(!0),T({width:i,height:h})):j<w?(E(!0),T({width:"auto",height:"auto"})):(T({width:j,height:j}),E(!1)),K(!0)}).catch(j=>{K(!0),console.warn("Ошибка при загрузке изображения:",j.message)})},[e,M]),a.useEffect(()=>{D.width&&D.height&&L&&p.update(()=>{const i=N.$getNodeByKey(n);o.$isImageNode(i)&&i.setWidthAndHeight(D.width,D.height)})},[D.width,D.height,L]);const we=a.useCallback(i=>o.$writeImagePickerTabToNode(p,n,i),[p,n]),W=a.useCallback((i,h)=>{k(!1),p.update(()=>{const w=N.$getNodeByKey(n);o.$isImageNode(w)&&(w.setSrc(i),w.setId(h))})},[p,n]),_=a.useCallback(i=>{k(!0);const h=S();P&&P(i[0],(w,j)=>{W(w,j),z(0)},w=>{w&&F.showErrorNotification({message:U("editor.gallery.errorFile")}),z(0),W(e.startsWith("blob:")?"upload":"","")},h,w=>{z(w)})},[P,S,U,W,e]);return a.useEffect(()=>p.registerCommand(o.UPLOAD_IMAGE_COMMAND,i=>!e.startsWith("blob:")&&e!=="upload"||i.targetNodeKey!==n?!1:(_(i.files),!0),N.COMMAND_PRIORITY_LOW),[p,_,n,e]),!e||e==="upload"?t.jsx(x.Box,{"data-editor-image-picker-drop-root":!0,w:"100%",children:t.jsx(o.ImagePicker,{inline:!0,nodeKey:n,defaultTabValue:f,onWriteTabToNode:we,uploading:!1,onUpload:i=>{!P||!i.length||_(i)},popoverProps:{opened:!0,position:"bottom",zIndex:o.EDITOR_UI_MIN_Z_INDEX},onChange:i=>{p.update(()=>{const h=N.$getNodeByKey(n);o.$isImageNode(h)&&h.setSrc(i)})}})}):L&&!ge?t.jsx(ie,{width:D.width,height:D.height,isLoading:g,isError:!1,isIcon:L,src:e,id:I,editor:p,nodeKey:n,fetchDeleteMedia:G,altText:r,imageRef:y,maxWidth:d,showCaption:c,caption:u,isCollabActive:!1,historyState:ee,showNestedEditorTreeView:te,t:U,href:C}):t.jsx(o.ResizableContainer,{editor:p,isIcon:L,width:o.parseContainerSize(s),height:o.parseContainerSize(l),initialWidth:D.width||"",initialHeight:D.height||"",onResizeEnd:me,alignment:m,disable:se,onRegisterDecoratorEnter:i=>{O!=null&&O.current&&(O.current.decoratorEnterAction=i)},onActivate:()=>p.dispatchCommand(o.ON_CHANGE_COMMAND,"show_menu"),children:t.jsx(ie,{width:"inherit",height:"inherit",aspectRatio:de,isLoading:g,isError:!1,isIcon:L,src:e,id:I,editor:p,nodeKey:n,fetchDeleteMedia:G,altText:r,imageRef:y,maxWidth:d,showCaption:c,caption:u,isCollabActive:!1,historyState:ee,showNestedEditorTreeView:te,t:U,href:C})})}exports.default=je;
|