@layers-app/editor 2.2.20 → 2.2.22
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 +1 -1
- package/dist/index.js +11 -11
- package/dist/{layers.B1Z3FBSW.js → layers.0_o7xyFB.js} +35839 -35861
- package/dist/{layers.D0Z4j1r3.js → layers.46GY3mh_.js} +1 -1
- package/dist/{layers.9E-A35i_.js → layers.5k4kp1K9.js} +1 -1
- package/dist/{layers.B9R0kUwf.js → layers.6szP7wNE.js} +1 -1
- package/dist/layers.8FdK9LMJ.js +6 -0
- package/dist/{layers.nIQkD9ci.js → layers.8un-7X4h.js} +1 -1
- package/dist/{layers.DZoDi3Tr.js → layers.A3TBCQ6E.js} +1 -1
- package/dist/{layers.CpAc8yN6.js → layers.AV_6LgdT.js} +1 -1
- package/dist/{layers.7_mMT6j0.js → layers.B0F9vx_F.js} +1 -1
- package/dist/{layers.BqczWje4.js → layers.B0ToPjF1.js} +1 -1
- package/dist/{layers.6GJr4R5a.js → layers.B2GIc3En.js} +1 -1
- package/dist/{layers.Cd5TfPqd.js → layers.B2bspQy6.js} +1 -1
- package/dist/{layers.DuwP74N5.js → layers.B32NgnPu.js} +4 -4
- package/dist/{layers.Dm3_m-K7.js → layers.B3YVD67D.js} +1 -1
- package/dist/{layers.CUCT67uo.js → layers.B3kATuHh.js} +1 -1
- package/dist/{layers.CXoqcnEu.js → layers.B5Gj1Ue7.js} +1 -1
- package/dist/{layers.a-LARbKt.js → layers.B5bLFKhh.js} +1 -1
- package/dist/{layers.9y0j73C2.js → layers.B63y0Rpn.js} +1 -1
- package/dist/{layers.C6TggUya.js → layers.B7-uOQaL.js} +1 -1
- package/dist/{layers.CVaHbb_-.js → layers.B9ZtxZKD.js} +1 -1
- package/dist/{layers.CcD5luc6.js → layers.BBfhnLOa.js} +1 -1
- package/dist/layers.BBin4uXC.js +1 -0
- package/dist/{layers.C0Y9loxf.js → layers.BCu5Aujs.js} +1 -1
- package/dist/{layers.Bjuy0V1E.js → layers.BENyixGk.js} +7 -7
- package/dist/{layers.DRmkEnhl.js → layers.BEhg58AG.js} +1 -1
- package/dist/{layers.Dn7VKVHU.js → layers.BEmJ1cvD.js} +1 -1
- package/dist/{layers.lAIs4XlW.js → layers.BIG3joYZ.js} +1 -1
- package/dist/{layers.rDvhupy_.js → layers.BIz6anSR.js} +3 -3
- package/dist/{layers.SjMxlWcq.js → layers.BK2hXhTr.js} +1 -1
- package/dist/{layers.BaVFk6SN.js → layers.BL5-YOdb.js} +1 -1
- package/dist/layers.BMHe7FVH.js +1 -0
- package/dist/{layers.BgPqY2JZ.js → layers.BNfpljMH.js} +1 -1
- package/dist/{layers.Dv0670fB.js → layers.BOqcQSvT.js} +1 -1
- package/dist/{layers.BB1IOMSC.js → layers.BPhlKQ1n.js} +1 -1
- package/dist/{layers.DIks0MY9.js → layers.BQT_UW8f.js} +1 -1
- package/dist/{layers.CRtRlfWf.js → layers.BU5vikd4.js} +1 -1
- package/dist/{layers.BFGdqF5_.js → layers.BUHDbScM.js} +3 -3
- package/dist/{layers.C7k7FfgJ.js → layers.BUx-KQN_.js} +4 -4
- package/dist/{layers.CrqbYRzf.js → layers.BV2DfFDz.js} +1 -1
- package/dist/{layers.x9vw7v3U.js → layers.BVqCJpzk.js} +4 -4
- package/dist/{layers.Bmvmyfgx.js → layers.BYTQeRxM.js} +1 -1
- package/dist/{layers.C6G7tcGn.js → layers.BYlILlAo.js} +5 -5
- package/dist/{layers.BI0Qw-Cc.js → layers.B_H13cp_.js} +3 -3
- package/dist/{layers.C5z-O4vl.js → layers.BcDoHGQQ.js} +4 -4
- package/dist/{layers.BoVCwhri.js → layers.BcMFUrsO.js} +1 -1
- package/dist/{layers.CFnqsqIg.js → layers.BcYnshZx.js} +1 -1
- package/dist/{layers.DxuuPlD2.js → layers.BdvKi5m2.js} +3 -3
- package/dist/{layers.-upBSzpx.js → layers.BeB6nS-_.js} +1 -1
- package/dist/{layers.Cz2oCZes.js → layers.Beu7hD93.js} +3 -3
- package/dist/{layers.DhWg6e7n.js → layers.BfG2tfZn.js} +1 -1
- package/dist/layers.BgetbX1j.js +907 -0
- package/dist/{layers.CUHrkUsV.js → layers.BhTzgvsL.js} +1 -1
- package/dist/{layers.Da_0RKZH.js → layers.BiDTOYk_.js} +1 -1
- package/dist/{layers.Uu0_d58r.js → layers.Bj6R7X3_.js} +1 -1
- package/dist/{layers.3tFPy2sk.js → layers.BjnNYmXq.js} +1 -1
- package/dist/{layers.BmZLc04X.js → layers.BndFZ10A.js} +1 -1
- package/dist/{layers.D_C7_fbk.js → layers.BnzemMDf.js} +4 -4
- package/dist/{layers.BkcNUG1w.js → layers.BvEEOMd2.js} +1 -1
- package/dist/{layers.mMhiQdia.js → layers.BwbFeMWp.js} +1 -1
- package/dist/{layers.DobSzbxw.js → layers.C-jjNwxe.js} +1 -1
- package/dist/{layers.BengJoS4.js → layers.C0D2yoIm.js} +1 -1
- package/dist/{layers.CCGtHR4D.js → layers.C3ionHGC.js} +1 -1
- package/dist/{layers.CIrm8gfg.js → layers.C9ylx_8s.js} +1 -1
- package/dist/{layers.CkyjaB8W.js → layers.CBDrbvx3.js} +1 -1
- package/dist/{layers.DEv1V6DU.js → layers.CCCg9AB6.js} +1 -1
- package/dist/{layers.Cxj08exa.js → layers.CFSSdZIo.js} +1 -1
- package/dist/{layers.DAzfB806.js → layers.CGpkaxva.js} +1 -1
- package/dist/{layers.DJbjONgo.js → layers.CI-npuwG.js} +1 -1
- package/dist/{layers.DLIKqcXR.js → layers.CJm6d8s4.js} +1 -1
- package/dist/{layers.IidMqMn2.js → layers.CM0RmSee.js} +1 -1
- package/dist/{layers.C-GOXxAH.js → layers.CMGavDUZ.js} +1 -1
- package/dist/{layers.DZ663X1x.js → layers.CNLeU1dW.js} +1 -1
- package/dist/{layers.Cty8lMmS.js → layers.CPRqBd5z.js} +3 -3
- package/dist/{layers.vuLooH9f.js → layers.CPd7fh0F.js} +1 -1
- package/dist/{layers.CfQPz1Aw.js → layers.CPjId6bM.js} +1 -1
- package/dist/{layers.3vPmC5wY.js → layers.CQpWcfwf.js} +1 -1
- package/dist/{layers.DYwksr5a.js → layers.CSQAIyOl.js} +1 -1
- package/dist/{layers.DLxFKMA6.js → layers.CWLwAnjN.js} +1 -1
- package/dist/{layers.n9EbKm0x.js → layers.C_CamJj8.js} +1 -1
- package/dist/{layers.CwzRnl4s.js → layers.CaMnfmf4.js} +1 -1
- package/dist/{layers.DPDYskll.js → layers.CbD4AjjB.js} +1 -1
- package/dist/{layers.I63XEeky.js → layers.CbbykYL6.js} +1 -1
- package/dist/{layers.BwRjgk3l.js → layers.Cc0bK4Jx.js} +3 -3
- package/dist/{layers.DrNOhvhI.js → layers.CeghDZ5z.js} +2 -2
- package/dist/{layers.B18sbnzv.js → layers.CgevOfiO.js} +1 -1
- package/dist/{layers.cN8x9nW3.js → layers.ChBsXB-p.js} +1 -1
- package/dist/{layers.ClRsT66E.js → layers.Chij3QIH.js} +1 -1
- package/dist/{layers.DrH31GR-.js → layers.CiOgdFrF.js} +1 -1
- package/dist/layers.Cjh9rgCs.js +702 -0
- package/dist/{layers.DYUNvSRB.js → layers.CnLBpo7l.js} +4 -4
- package/dist/{layers.BTaoyA-H.js → layers.CoCdaAtg.js} +1 -1
- package/dist/{layers.CcY2n7aU.js → layers.CoX17XV_.js} +1 -1
- package/dist/{layers.CF2XTKs7.js → layers.CpfZ5k-c.js} +25 -25
- package/dist/{layers.vDS9PGcx.js → layers.CrkOioIF.js} +1 -1
- package/dist/{layers.CTC8zPrF.js → layers.CtgqI59U.js} +1 -1
- package/dist/{layers.CiyxhcNk.js → layers.CucXAsor.js} +1 -1
- package/dist/{layers.CqsG0OBS.js → layers.CwDuD40M.js} +1 -1
- package/dist/{layers.B7JBTHrI.js → layers.CwiM9Q56.js} +1 -1
- package/dist/{layers.C6ZN6GpB.js → layers.CzowIX7V.js} +1 -1
- package/dist/{layers.BfbBFPcu.js → layers.D-WKQteE.js} +1 -1
- package/dist/{layers.NpQzTXqt.js → layers.D-pjbwMg.js} +1 -1
- package/dist/{layers.DqGkxIFj.js → layers.D-vM7CY8.js} +8 -8
- package/dist/{layers.BzKk84BW.js → layers.D-y15iMe.js} +1 -1
- package/dist/{layers.zP72_PG1.js → layers.D0kytx50.js} +1 -1
- package/dist/{layers.D-kTQ9UK.js → layers.D1OQ4q92.js} +1 -1
- package/dist/{layers.p-1j8BER.js → layers.D2rMgNQf.js} +3 -3
- package/dist/{layers.D5CCIEga.js → layers.D31iEZFD.js} +4 -4
- package/dist/{layers.BhSEN6dL.js → layers.D3Kbm5xt.js} +1 -1
- package/dist/{layers.BFP9xss0.js → layers.D4caPv6c.js} +2 -2
- package/dist/{layers.BahyPrPG.js → layers.D6ccqhvx.js} +1 -1
- package/dist/{layers.CmL3QVyb.js → layers.D7iqRuaR.js} +6 -6
- package/dist/{layers.BxlBrqjJ.js → layers.D8rQMbK_.js} +1 -1
- package/dist/{layers.B2dM7Tbt.js → layers.DBh6j3jA.js} +1 -1
- package/dist/{layers.DAVxIkpH.js → layers.DCa5gchg.js} +1 -1
- package/dist/{layers.YEFmzwMw.js → layers.DEL0A8T6.js} +1 -1
- package/dist/{layers.0_51eSVe.js → layers.DEMOp1ku.js} +1 -1
- package/dist/{layers.DcSevYiy.js → layers.DIGkuEI4.js} +1 -1
- package/dist/{layers.bR2nu10Q.js → layers.DJ0z2vMP.js} +1 -1
- package/dist/{layers.PWXwriWA.js → layers.DMby8wC2.js} +1 -1
- package/dist/{layers.1TGJYusT.js → layers.DMjBTphM.js} +1 -1
- package/dist/{layers.lanlvW5Y.js → layers.DMliVl73.js} +1 -1
- package/dist/{layers.C9cyYPQh.js → layers.DOwVCT3y.js} +1 -1
- package/dist/{layers.C9a1xgQe.js → layers.DPQUF5pK.js} +1 -1
- package/dist/{layers.w6Rzpp65.js → layers.DQAvpZ0O.js} +1 -1
- package/dist/{layers.DfQnSjc2.js → layers.DRU3_G6o.js} +1 -1
- package/dist/{layers.BQkXkuk4.js → layers.DTLpDoJM.js} +1 -1
- package/dist/{layers.DluN6hsf.js → layers.DTZf5wR5.js} +1 -1
- package/dist/{layers.BXJxwhsP.js → layers.DTjUi5Le.js} +1 -1
- package/dist/{layers.D0eSoEbO.js → layers.DV1jaZ1i.js} +1 -1
- package/dist/{layers.DxzcPaNN.js → layers.DX62t_IW.js} +1 -1
- package/dist/{layers.DXf4Hpdv.js → layers.DXE6q31f.js} +1 -1
- package/dist/{layers.Cs37Gb-Z.js → layers.DXiYnKzr.js} +1 -1
- package/dist/{layers.np_JJLpj.js → layers.DYUxmJPj.js} +1 -1
- package/dist/{layers.CsY4eDYx.js → layers.DYpl2yr-.js} +1 -1
- package/dist/{layers.Bcb-73eF.js → layers.DaVbJ1LA.js} +1 -1
- package/dist/{layers.BQWSSCZq.js → layers.DbIcuUbL.js} +1 -1
- package/dist/{layers.d2VMyzu0.js → layers.DdecoIKx.js} +1 -1
- package/dist/{layers.3OcJm3Ed.js → layers.DfKCNCmm.js} +1 -1
- package/dist/{layers.GoIyuc8H.js → layers.DfUJwkLk.js} +1 -1
- package/dist/{layers.BaScx_6u.js → layers.DfVVWVAL.js} +4 -4
- package/dist/{layers.JjO2paMU.js → layers.DiIn1rfl.js} +1 -1
- package/dist/{layers.opYuZNud.js → layers.DikXRE8c.js} +1 -1
- package/dist/{layers.CXWcXSX9.js → layers.DjH8T5sT.js} +1 -1
- package/dist/{layers.C3qGR0Em.js → layers.DkAbsvwH.js} +4 -4
- package/dist/{layers.PBduzFW5.js → layers.DnaYWIlB.js} +1 -1
- package/dist/{layers.CwXWh9dp.js → layers.Dnmgptfc.js} +1 -1
- package/dist/{layers.DC_kDhBY.js → layers.DoHhOLdI.js} +2 -2
- package/dist/{layers.Dkx15TQL.js → layers.DqAsBItk.js} +1 -1
- package/dist/{layers.Uf5PZKYh.js → layers.DqM99Lfc.js} +1 -1
- package/dist/{layers.1e5qHm0J.js → layers.DrFvInpg.js} +1 -1
- package/dist/{layers.DiLkFPsw.js → layers.Drf95sgy.js} +1 -1
- package/dist/{layers.BjF2fnON.js → layers.DsUTWT4F.js} +1 -1
- package/dist/{layers.DVJu88V3.js → layers.DtW-qZtE.js} +1 -1
- package/dist/{layers.DNqsTxWV.js → layers.DuUWtAKm.js} +4 -4
- package/dist/{layers.BxtuK-gH.js → layers.Duv1jJK3.js} +1 -1
- package/dist/{layers.uwChRl22.js → layers.DwuTV6GU.js} +1 -1
- package/dist/{layers.DzJlRjgG.js → layers.DzMzUTJI.js} +1 -1
- package/dist/{layers.DmgFUvCA.js → layers.F9IvliIV.js} +1 -1
- package/dist/{layers.B3TU0mEp.js → layers.G2bzJ31m.js} +1 -1
- package/dist/{layers.uWCQyrfS.js → layers.KQ6Ehsbw.js} +1 -1
- package/dist/{layers.BKFMltyU.js → layers.LtObTP4s.js} +1 -1
- package/dist/{layers.Dh0MP18i.js → layers.OjUruzJk.js} +1 -1
- package/dist/{layers.BOushxNJ.js → layers.PZeYBSbk.js} +2 -2
- package/dist/{layers.B5wJPieL.js → layers.RVfenvUo.js} +1 -1
- package/dist/{layers.DcN4v2dG.js → layers.Rtzeh3Fm.js} +5 -5
- package/dist/{layers.B1AhS2mA.js → layers.S5_rh8fp.js} +1 -1
- package/dist/{layers.C3qje6kD.js → layers.T2uzm7S6.js} +1 -1
- package/dist/{layers.0LNf9wea.js → layers.UaLbj79E.js} +1 -1
- package/dist/{layers.C8zsZFqE.js → layers.Up5eEXLJ.js} +1 -1
- package/dist/{layers.9Ln9OibX.js → layers.VX_IrJYt.js} +3 -3
- package/dist/{layers.3wKIhKFs.js → layers.W0rM-0TG.js} +1 -1
- package/dist/{layers.CJEefGZu.js → layers.YHkkWG0S.js} +1 -1
- package/dist/{layers.B2C41f-X.js → layers.ZLCj72_5.js} +1 -1
- package/dist/{layers.qKmpeiA7.js → layers.ZjrSTnp4.js} +1 -1
- package/dist/layers._WQpccnW.js +1 -0
- package/dist/{layers.DFgJMzMf.js → layers._qZ7PmnI.js} +4 -4
- package/dist/{layers.v_prPZ9A.js → layers.b4pXlijt.js} +1 -1
- package/dist/{layers.Cd9LTT03.js → layers.ffUYEwN4.js} +1 -1
- package/dist/{layers.Bn4l8o8h.js → layers.gEgCZvXy.js} +1 -1
- package/dist/layers.kOdq3GQw.js +8 -0
- package/dist/{layers.ERJ1aRjT.js → layers.n9b2hhnM.js} +1 -1
- package/dist/{layers.C-EM8GWm.js → layers.orWxvt3N.js} +1 -1
- package/dist/{layers.CzdcKOzv.js → layers.pRwVCW0G.js} +1 -1
- package/dist/{layers.C_Q6OUQV.js → layers.pRyAFATa.js} +1 -1
- package/dist/{layers.B18yyB-G.js → layers.pr9eyR-Q.js} +1 -1
- package/dist/{layers.BUvl-p6R.js → layers.prfqCpEA.js} +1 -1
- package/dist/{layers.CR-J7X7B.js → layers.psrETnoP.js} +1 -1
- package/dist/{layers.DPjb-zgI.js → layers.rsNk4u5r.js} +1 -1
- package/dist/{layers.CaixRq7v.js → layers.syr3X38H.js} +2 -2
- package/dist/{layers.xyYWgeil.js → layers.u5KGkYXg.js} +1 -1
- package/dist/{layers.DlGDSg5E.js → layers.uCHz6Psq.js} +1 -1
- package/dist/{layers.e-nRxhLh.js → layers.uoQtwjlc.js} +1 -1
- package/dist/{layers.C7BOdhXB.js → layers.vOgpGFIt.js} +1 -1
- package/dist/{layers.CRPM8fya.js → layers.vXA7G7-n.js} +1 -1
- package/dist/{layers.sJHNaLMA.js → layers.wWHl-pSG.js} +2 -2
- package/dist/{layers.C2qyth5A.js → layers.x7UpvoKs.js} +1 -1
- package/dist/{layers.BgFdVBTk.js → layers.xloaPUJ8.js} +1 -1
- package/dist/{layers.CpOzVG7B.js → layers.yWzNrmjk.js} +1 -1
- package/dist/{layers.Bq7Gooda.js → layers.yZ8BxTna.js} +1 -1
- package/dist/{layers.D0eSZ1Ss.js → layers.ysM6MbVz.js} +1 -1
- package/dist/{layers.Da_jnd8_.js → layers.ytxll_qv.js} +1 -1
- package/dist/{layers.fccCpjtd.js → layers.zI-ky_su.js} +3 -3
- package/package.json +80 -80
- package/dist/layers.B-n0tzE6.js +0 -904
- package/dist/layers.BNj2VdZj.js +0 -1
- package/dist/layers.CzjOVTJE.js +0 -6
- package/dist/layers.DUmaVqZq.js +0 -952
- package/dist/layers.Dl5QV_sK.js +0 -8
- package/dist/layers.DmvvbpXX.js +0 -1
- package/dist/layers.O7nYuFCq.js +0 -1
package/dist/layers.BNj2VdZj.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),U=require("react-i18next"),A=require("@lexical/react/LexicalComposerContext"),x=require("@mantine/core"),L=require("lexical"),n=require("./layers.B-n0tzE6.js"),_=require("@layers-app/shared"),re=require("@lexical/react/useLexicalEditable"),P=require("@mantine/hooks");require("@lexical/react/LexicalDecoratorBlockNode");require("@lexical/utils");require("@lexical/mark");require("@lexical/code");require("@lexical/selection");require("@lexical/react/LexicalBlockWithAlignableContents");require("@mantine/notifications");function ae(t,i){const o=document.createElement("a");o.href=t,o.download=i,o.rel="noopener",document.body.appendChild(o),o.click(),o.remove()}function q(t){try{const o=new URL(t,window.location.origin).pathname.split("/").pop()||"image";return o.includes(".")?o:`${o}.png`}catch{return"image"}}async function F(t,i){const o=await fetch(t);if(!o.ok)throw new Error("fetch failed");const a=await o.blob(),s=URL.createObjectURL(a);try{ae(s,i)}finally{setTimeout(()=>URL.revokeObjectURL(s),0)}}function se({editor:t,nodeKey:i,href:o,onClose:a}){const[s,d]=r.useState(()=>n.getLinkTypeFromUrl(o)),[c,g]=r.useState(()=>n.removeProtocol(o)),[f,w]=r.useState(!1),p=r.useCallback(m=>{d(m),w(!1)},[]),b=r.useCallback(m=>{g(m),w(!1)},[]),k=r.useCallback(()=>{const m=n.addProtocolIfNeeded(c.trim(),s);if(!m||!n.isValidUrl(m,s)){w(!0);return}n.$writeImageLinkToNode(t,i,n.sanitizeUrl(m)),a()},[t,i,c,s,a]),v=r.useCallback(()=>{n.$writeImageLinkToNode(t,i,""),a()},[t,i,a]),h=r.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),k()):m.key==="Escape"&&(m.preventDefault(),a())},[k,a]);return{linkType:s,linkUrl:c,error:f,onLinkTypeChange:p,onUrlInputChange:b,onUrlInputKeyDown:h,onSave:k,onRemove:v}}function W({editor:t,nodeKey:i,href:o,onClose:a,mobile:s}){const d=r.useRef(null),c=se({editor:t,nodeKey:i,href:o,onClose:a});return r.useEffect(()=>{var g;(g=d.current)==null||g.focus({preventScroll:!0})},[]),e.jsx(n.CreateMode,{inputRef:d,linkUrl:c.linkUrl,linkType:c.linkType,error:c.error,mobile:s,onLinkTypeChange:c.onLinkTypeChange,onUrlInputChange:c.onUrlInputChange,onUrlInputKeyDown:c.onUrlInputKeyDown,onCancel:a,onSave:c.onSave,onRemove:o?c.onRemove:void 0})}function J({opened:t,onOpenChange:i,t:o,onDownload:a,onDelete:s,hasLink:d,onLinkAction:c}){return e.jsxs(x.Menu,{opened:t,onChange:i,transitionProps:n.animationMenu,shadow:"md",position:"bottom-start",offset:4,withinPortal:!0,closeOnItemClick:!0,children:[e.jsx(x.Menu.Target,{children:e.jsx(n.ActionIcon,{label:o("editor.toolbar.more"),icon:n.K1,iconColor:"var(--mantine-color-gray-text)","aria-label":o("editor.toolbar.more")})}),e.jsxs(x.Menu.Dropdown,{p:4,miw:164,w:"max-content",onMouseDown:g=>g.preventDefault(),children:[c&&e.jsx(x.Menu.Item,{leftSection:e.jsx(x.Flex,{align:"center",justify:"center",c:"gray.6",children:e.jsx(n.Icon,{name:"link",size:16})}),onClick:g=>{g.stopPropagation(),c()},children:o(d?"editor.link.editLink":"editor.link.addLink")}),e.jsx(x.Menu.Item,{leftSection:e.jsx(x.Flex,{align:"center",justify:"center",c:"gray.6",children:e.jsx(n.HugeiconsIcon,{icon:n.Tm,size:16})}),onClick:g=>{g.stopPropagation(),a()},children:o("editor.gallery.download")}),e.jsx(x.Menu.Item,{color:"red",leftSection:e.jsx(x.Flex,{align:"center",justify:"center",c:"red.6",children:e.jsx(n.HugeiconsIcon,{icon:n.lg,size:16})}),onClick:g=>{g.stopPropagation(),s()},children:o("editor.contextMenu.delete")})]})]})}const Q=({t,src:i,setShown:o,id:a})=>{const[s,{open:d,close:c}]=P.useDisclosure(!1),g=r.useMemo(()=>[{id:!a||a==="0"?"":a,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,a]),f=w=>{w?d():c()};return e.jsxs(e.Fragment,{children:[e.jsx(_.AttachmentsGalleryModal,{opened:s,onOpenChange:f,attachments:g}),e.jsx(n.ActionIcon,{label:t("editor.image.preview"),icon:n.gn,iconColor:"var(--mantine-color-gray-text)","aria-label":t("editor.image.preview"),onClick:()=>{o(!1),d()}})]})},le=({nodeKey:t,src:i,href:o})=>{const[a]=A.useLexicalComposerContext(),s=re.useLexicalEditable(),[d,c]=r.useState(!1),[g,f]=r.useState(!1),[w,p]=r.useState(!1),{t:b}=U.useTranslation();r.useEffect(()=>{if(!w)return;const h=m=>{const u=m.target;u!=null&&u.closest(".floating-link-dropdown")||u!=null&&u.closest(".floating-link-type-combobox-dropdown")||p(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[w]);const k=r.useCallback(()=>{a.update(()=>{const h=L.$getNodeByKey(t);n.$isImageNode(h)&&h.remove()})},[a,t]),v=r.useCallback(async()=>{if(i)try{await F(i,q(i))}catch{}},[i]);return e.jsxs(x.Popover,{opened:w,onChange:p,position:"bottom-end",offset:4,shadow:"md",radius:"md",withinPortal:!0,closeOnClickOutside:!1,children:[e.jsx(x.Popover.Target,{children:e.jsxs("div",{className:`media-actions ${s?"":"media-actions--readonly"}`,children:[e.jsx(Q,{t:b,src:i,setShown:()=>{}}),s&&e.jsxs(e.Fragment,{children:[e.jsx(n.NodeAlignmentMenu,{opened:d,setOpened:c,t:b,editor:a,nodeKey:t,setShown:()=>{}}),e.jsx(J,{opened:g,onOpenChange:f,t:b,onDownload:()=>void v(),onDelete:k,hasLink:!!o,onLinkAction:()=>p(!0)})]})]})}),e.jsx(x.Popover.Dropdown,{className:`floating-link-dropdown floating-link-dropdown--${o?"edit":"create"}-mode`,"data-test-id":"floating-link-dropdown",children:e.jsx(W,{editor:a,nodeKey:t,href:o,onClose:()=>p(!1)})})]})},ce=()=>{};function de({nodeKey:t,src:i,id:o,href:a}){const{t:s}=U.useTranslation(),[d]=A.useLexicalComposerContext(),[c,g]=r.useState(!1),[f,w]=r.useState(!1),[p,b]=r.useState(!1);r.useEffect(()=>{if(!p)return;const h=m=>{const u=m.target;u!=null&&u.closest(".floating-link-dropdown")||u!=null&&u.closest(".floating-link-type-combobox-dropdown")||b(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[p]);const k=r.useCallback(()=>{w(!1),d.update(()=>{const h=L.$getNodeByKey(t);if(!n.$isImageNode(h))return;const m=h.getParent();n.$isImageOverlayWrapperNode(m)?m.remove():h.remove()})},[d,t]),v=r.useCallback(async()=>{if(i)try{await F(i,q(i))}catch{}},[i]);return e.jsxs(x.Popover,{opened:p,onChange:b,position:"bottom-end",offset:4,shadow:"md",radius:"md",withinPortal:!0,closeOnClickOutside:!1,children:[e.jsx(x.Popover.Target,{children:e.jsxs("div",{className:"media-actions visible",style:{position:"absolute",top:10,right:10,zIndex:10,pointerEvents:"auto",display:"flex",gap:4},onClick:h=>h.stopPropagation(),children:[e.jsx(Q,{t:s,src:i,setShown:ce,id:o}),e.jsx(n.NodeAlignmentMenu,{opened:c,setOpened:g,t:s,editor:d,nodeKey:t}),e.jsx(J,{opened:f,onOpenChange:w,t:s,onDownload:()=>void v(),onDelete:k,hasLink:!!a,onLinkAction:()=>b(!0)})]})}),e.jsx(x.Popover.Dropdown,{className:`floating-link-dropdown floating-link-dropdown--${a?"edit":"create"}-mode`,"data-test-id":"floating-link-dropdown",children:e.jsx(W,{editor:d,nodeKey:t,href:a,onClose:()=>b(!1)})})]})}function ue({nodeKey:t,src:i,id:o,href:a}){const{t:s}=U.useTranslation(),[d]=A.useLexicalComposerContext(),[c,{open:g,close:f}]=P.useDisclosure(!1),[w,{open:p,close:b}]=P.useDisclosure(!1),[k,{open:v,close:h}]=P.useDisclosure(!1),m=()=>{f(),v()},u=r.useMemo(()=>[{id:!o||o==="0"?"":o,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,o]),S=()=>{f(),p()},N=r.useCallback(async()=>{if(f(),!!i)try{await F(i,q(i))}catch{}},[i,f]),y=r.useCallback(()=>{f(),d.update(()=>{const D=L.$getNodeByKey(t);n.$isImageNode(D)&&D.remove()})},[d,t,f]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"image-touch-actions",style:{position:"absolute",top:8,right:8,zIndex:10,pointerEvents:"auto"},onClick:D=>D.stopPropagation(),children:e.jsx(n.ActionIcon,{label:s("editor.toolbar.more"),icon:n.O1,iconColor:"var(--mantine-color-gray-text)","aria-label":s("editor.toolbar.more"),onClick:g})}),e.jsx(_.AttachmentsGalleryModal,{opened:w,onOpenChange:D=>D?p():b(),attachments:u}),e.jsx(n.MobileDrawer,{opened:c,onClose:f,title:s("editor.image.mobileActions"),children:e.jsxs(x.Stack,{gap:4,p:0,children:[e.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:S,leftSection:e.jsx(n.HugeiconsIcon,{icon:n.gn,size:16,color:"var(--mantine-color-dimmed)"}),children:s("editor.image.previewFullScreen")}),e.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:m,leftSection:e.jsx(n.HugeiconsIcon,{icon:n.zz,size:16,color:"var(--mantine-color-dimmed)"}),children:s(a?"editor.link.editLink":"editor.link.addLink")}),e.jsx(x.Button,{type:"button",variant:"subtle",color:"gray",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:()=>void N(),leftSection:e.jsx(n.HugeiconsIcon,{icon:n.Tm,size:16,color:"var(--mantine-color-dimmed)"}),children:s("editor.gallery.download")}),e.jsx(x.Button,{type:"button",variant:"subtle",color:"red",fullWidth:!0,justify:"flex-start",bg:"var(--editor-action-bg)",onClick:y,leftSection:e.jsx(n.HugeiconsIcon,{icon:n.lg,size:16,color:"var(--mantine-color-red-6)"}),children:s("editor.actions.delete")})]})}),e.jsx(n.MobileDrawer,{opened:k,onClose:h,title:s(a?"editor.link.editLink":"editor.link.addLink"),children:e.jsx(W,{editor:d,nodeKey:t,href:a,onClose:h,mobile:!0})})]})}const Z=t=>{const{width:i,height:o,isLoading:a,isError:s,src:d,id:c,altText:g,imageRef:f,maxWidth:w,href:p}=t,b=r.useRef(null);return e.jsxs("div",{className:"media-wrapper",style:{width:i,height:o,display:"inline-flex",position:"relative"},children:[e.jsx(x.LoadingOverlay,{visible:a,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),e.jsx("a",{className:"editor-image-link","data-link":p?"true":void 0,"data-href":p?n.sanitizeUrl(p):void 0,role:p?"link":void 0,rel:p?"noopener noreferrer":void 0,draggable:!1,onMouseDown:p?k=>{b.current={x:k.clientX,y:k.clientY}}:void 0,onClick:p?k=>{k.preventDefault();const v=b.current;b.current=null,!(v&&Math.hypot(k.clientX-v.x,k.clientY-v.y)>5)&&window.open(n.sanitizeUrl(p),"_blank","noopener,noreferrer")}:void 0,children:e.jsx(ge,{className:null,src:d,altText:g,imageRef:f,width:"inherit",height:"inherit",maxWidth:w||"auto",id:c})}),n.IS_TOUCH_DEVICE&&e.jsx(ue,{nodeKey:t.nodeKey,src:d,id:c,href:p}),n.IS_TOUCH_TABLET&&e.jsx(de,{nodeKey:t.nodeKey,src:d,id:c,href:p}),n.IS_HOVER_CAPABLE&&!n.IS_TOUCH_DEVICE&&!n.IS_TOUCH_TABLET&&e.jsx(le,{nodeKey:t.nodeKey,src:d,href:p})]})};function ge({altText:t,className:i,imageRef:o,src:a,width:s,height:d,maxWidth:c,id:g}){const[f,w]=r.useState(!1);return e.jsx("img",{className:`${i||void 0} ${f?"":"loading"}`,src:a,alt:t,ref:o,style:{height:d,maxWidth:c,width:s},onLoad:()=>{a.includes("splash")?setTimeout(()=>{w(!0)},100):w(!0)},draggable:"false","data-id":g})}function pe(t){const{disable:i}=r.useContext(n.Context);return i&&n.ImageNode.isPlaceholderSrc(t.src)?null:e.jsx(me,{...t})}function me({src:t,altText:i,nodeKey:o,width:a,height:s,maxWidth:d,showCaption:c,caption:g,id:f,create:w,alignment:p,imagePickerTab:b,href:k}){var X,Y;const v=r.useRef(null),[h,m]=r.useState(!0),[u]=A.useLexicalComposerContext(),[S,N]=r.useState(!0),[y,D]=r.useState({width:0,height:0}),{start:H}=n.useCancelUpload(),[fe,z]=r.useState(0),{fetchUploadMedia:T,fetchDeleteMedia:B,maxFileSize:he,imperativeHandleRef:E,disable:K}=r.useContext(n.Context),O=n.mediaMap.has(t)&&(((X=n.mediaMap.get(t))==null?void 0:X.mediaNodeKeys.length)===0||((Y=n.mediaMap.get(t))==null?void 0:Y.mediaNodeKeys.length)===void 0||t.trim()===""),{t:M}=U.useTranslation(),[xe,ee]=r.useState(0);r.useEffect(()=>u.registerDecoratorListener(()=>{ee(l=>l+1)}),[O]),r.useEffect(()=>{if(!t||t.startsWith("data:image/")||!t.trim()){m(!1);return}const l=new Image;l.src=t,l.onload=()=>m(!1),l.onerror=()=>{m(!1)}},[t,O]);const te=(l,I)=>{u.update(()=>{L.$setSelection(null);const C=L.$getNodeByKey(o);n.$isImageNode(C)&&C.setWidthAndHeight(l,I)})},{historyState:V}=n.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:G}}=n.useSettings();function ne(l){return l.endsWith(".svg")||l.includes("image/svg+xml")}function oe(l){return new Promise((I,C)=>{if(ne(l)){I(0);return}const j=new Image;j.src=l,j.onload=()=>{I(j.width)},j.onerror=()=>{C(new Error("Failed to load image"))}})}r.useEffect(()=>{let l=a,I=s,C=100;(t.includes("unsplash")?t.trim():!O&&t.trim()||t.includes("upload-src-editor"))&&t!=="upload"&&oe(t).then(j=>{typeof l=="number"&&l<C&&j<C?(N(!0),D({width:l,height:I})):j<C?(N(!0),D({width:"auto",height:"auto"})):(D({width:j,height:j}),N(!1))}).catch(j=>{console.warn("Ошибка при загрузке изображения:",j.message)})},[t,O]),r.useEffect(()=>{y.width&&y.height&&S&&u.update(()=>{const l=L.$getNodeByKey(o);n.$isImageNode(l)&&l.setWidthAndHeight(y.width,y.height)})},[y.width,y.height,S]);const ie=r.useCallback(l=>n.$writeImagePickerTabToNode(u,o,l),[u,o]),R=r.useCallback((l,I)=>{m(!1),u.update(()=>{const C=L.$getNodeByKey(o);n.$isImageNode(C)&&(C.setSrc(l),C.setId(I))})},[u,o]),$=r.useCallback(l=>{m(!0);const I=H();T&&T(l[0],(C,j)=>{R(C,j),z(0)},C=>{C&&_.showErrorNotification({message:M("editor.gallery.errorFile")}),z(0),R("","")},I,C=>{z(C)})},[T,H,M,R]);return r.useEffect(()=>u.registerCommand(n.UPLOAD_IMAGE_COMMAND,l=>t!=="upload"||l.targetNodeKey!==o?!1:($(l.files),!0),L.COMMAND_PRIORITY_LOW),[u,$,o,t]),!t||t==="upload"?e.jsx(x.Box,{"data-editor-image-picker-drop-root":!0,w:"100%",children:e.jsx(n.ImagePicker,{inline:!0,nodeKey:o,defaultTabValue:b,onWriteTabToNode:ie,uploading:!1,onUpload:l=>{!T||!l.length||$(l)},popoverProps:{opened:!0,position:"bottom",zIndex:n.EDITOR_UI_MIN_Z_INDEX},onChange:l=>{u.update(()=>{const I=L.$getNodeByKey(o);n.$isImageNode(I)&&I.setSrc(l)})}})}):S?e.jsx(Z,{width:y.width,height:y.height,isLoading:h,isError:!1,isIcon:S,src:t,id:f,editor:u,nodeKey:o,fetchDeleteMedia:B,altText:i,imageRef:v,maxWidth:d,showCaption:c,caption:g,isCollabActive:!1,historyState:V,showNestedEditorTreeView:G,t:M,href:k}):e.jsx(n.ResizableContainer,{editor:u,isIcon:S,width:n.parseContainerSize(a),height:n.parseContainerSize(s),initialWidth:y.width||"",initialHeight:y.height||"",onResizeEnd:te,alignment:p,disable:K,onRegisterDecoratorEnter:l=>{E!=null&&E.current&&(E.current.decoratorEnterAction=l)},onActivate:()=>u.dispatchCommand(n.ON_CHANGE_COMMAND,"show_menu"),children:e.jsx(Z,{width:"inherit",height:"inherit",isLoading:h,isError:!1,isIcon:S,src:t,id:f,editor:u,nodeKey:o,fetchDeleteMedia:B,altText:i,imageRef:v,maxWidth:d,showCaption:c,caption:g,isCollabActive:!1,historyState:V,showNestedEditorTreeView:G,t:M,href:k})})}exports.default=pe;
|