@layers-app/editor 0.4.1 → 0.5.0

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.
Files changed (230) hide show
  1. package/README.md +37 -1
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +2 -2
  5. package/dist/{layers.C3-Awt80.js → layers.0GV8bqI4.js} +6 -6
  6. package/dist/{layers.B51TBzz6.js → layers.2-v72gXD.js} +1 -1
  7. package/dist/{layers.DBgQS_TD.js → layers.271NUg7u.js} +1 -1
  8. package/dist/{layers.C00McVdb.js → layers.2YgiancJ.js} +1 -1
  9. package/dist/{layers.DiAtOpGJ.js → layers.3DEO2eFX.js} +1 -1
  10. package/dist/{layers._uJVChzG.js → layers.3PKeLS62.js} +6 -6
  11. package/dist/{layers.Bxuc5Ku1.js → layers.6M02Y2O6.js} +1 -1
  12. package/dist/{layers.Ctcl9I58.js → layers.7DTJccah.js} +3 -3
  13. package/dist/{layers.BGXN8iGN.js → layers.7geZ_Z3x.js} +1 -1
  14. package/dist/{layers.Q933nYVT.js → layers.88aO_Zsd.js} +2 -2
  15. package/dist/{layers.BVhV_yLo.js → layers.8hFVbiPY.js} +12 -12
  16. package/dist/{layers.TP-LPR2e.js → layers.9KaBpXFA.js} +5 -5
  17. package/dist/layers.AIKsYMqL.js +8 -0
  18. package/dist/{layers.CEW7Z5oj.js → layers.B-0J3b5U.js} +1 -1
  19. package/dist/{layers.DMXwnUhk.js → layers.B4yEsxVs.js} +1 -1
  20. package/dist/{layers.DGfERl47.js → layers.B5Xhxhbr.js} +1 -1
  21. package/dist/{layers.C6ueRaWn.js → layers.B6jgTP72.js} +1 -1
  22. package/dist/{layers.Dr9AgtBT.js → layers.B8a2ydDI.js} +2 -2
  23. package/dist/layers.B9EoV4pJ.js +1 -0
  24. package/dist/{layers.BU0ouPbJ.js → layers.BAI7Z-Wd.js} +1 -1
  25. package/dist/{layers.NLvydYLt.js → layers.BB24KMYM.js} +6 -6
  26. package/dist/{layers.DlH0lUyY.js → layers.BBWAKePM.js} +1 -1
  27. package/dist/{layers.C6FZDcP0.js → layers.BBWcXYuR.js} +1 -1
  28. package/dist/{layers.BVLHr0fv.js → layers.BC3JkNtz.js} +4 -4
  29. package/dist/{layers.oLym9I6R.js → layers.BFKY-mk1.js} +1 -1
  30. package/dist/{layers.BeXV53PI.js → layers.BGnHNrIw.js} +1 -1
  31. package/dist/{layers.OqM7Ogm0.js → layers.BIF7gnlw.js} +1 -1
  32. package/dist/layers.BJDrjORS.js +244 -0
  33. package/dist/{layers.BdxgA5Mh.js → layers.BJtqK_fc.js} +1 -1
  34. package/dist/layers.BLMsv5-v.js +295 -0
  35. package/dist/layers.BLd2spTm.js +1 -0
  36. package/dist/{layers.CP7ZgLdQ.js → layers.BLj5XN2k.js} +4 -4
  37. package/dist/{layers.Dr-_us97.js → layers.BMzZVoyQ.js} +1 -1
  38. package/dist/{layers.9--aZzKT.js → layers.BN0X-mKK.js} +1 -1
  39. package/dist/{layers.D3PBqBbY.js → layers.BNP0J0MG.js} +1 -1
  40. package/dist/{layers.D37kPodI.js → layers.BQgrfzZU.js} +1 -1
  41. package/dist/{layers.CX4-2iW9.js → layers.BRFujA4d.js} +1 -1
  42. package/dist/{layers.BIATzXuT.js → layers.BSXvhEG5.js} +1 -1
  43. package/dist/{layers.j4D7aRnj.js → layers.BSzdascH.js} +1 -1
  44. package/dist/{layers.BXGZ-IPG.js → layers.BTsJAbTY.js} +1 -1
  45. package/dist/{layers.DsIrXvQc.js → layers.BUpmCmqT.js} +1 -1
  46. package/dist/{layers.Cmeg2JEe.js → layers.BVAnEpZl.js} +1 -1
  47. package/dist/{layers.DRd1i4Pe.js → layers.BW84v3Ox.js} +2 -2
  48. package/dist/layers.B_Lan92M.js +1 -0
  49. package/dist/{layers.l7Uj4NoM.js → layers.BaW-t_Zc.js} +1 -1
  50. package/dist/{layers.BR9erYvc.js → layers.BapT0txt.js} +1 -1
  51. package/dist/{layers.BK7Umu5k.js → layers.BdqQLuaK.js} +1 -1
  52. package/dist/{layers.CZianMah.js → layers.Bdwk_Ggl.js} +1 -1
  53. package/dist/{layers.DIW19mY0.js → layers.Bg7-KHZC.js} +3 -3
  54. package/dist/{layers._uHasBFO.js → layers.BkFD_pHb.js} +1 -1
  55. package/dist/{layers.C8WU47YC.js → layers.BlN6GnRT.js} +1 -1
  56. package/dist/{layers.C8Lyyff8.js → layers.Bm84E1I5.js} +1 -1
  57. package/dist/{layers.Doo3HAhr.js → layers.Bo3tMbEB.js} +1 -1
  58. package/dist/{layers.BATSJhNp.js → layers.BoOcWXFs.js} +1 -1
  59. package/dist/{layers.CusXQPSP.js → layers.BrHN_kMd.js} +1 -1
  60. package/dist/{layers.B4Jcovwh.js → layers.BruMG2wy.js} +1 -1
  61. package/dist/{layers.Cg0Puk92.js → layers.BsWPnWD1.js} +1 -1
  62. package/dist/{layers.99J97lec.js → layers.Bu9ZoRYM.js} +1 -1
  63. package/dist/{layers.DSiVxrm-.js → layers.BvjpCDHj.js} +1 -1
  64. package/dist/{layers.P0RFt4vw.js → layers.Bwb7QBBL.js} +1 -1
  65. package/dist/{layers.BoUDsd20.js → layers.Bx0DgrIz.js} +1 -1
  66. package/dist/{layers.CJdGap0M.js → layers.By8wynAO.js} +1 -1
  67. package/dist/{layers.B2AGu32C.js → layers.C0Lgw_Sx.js} +1107 -1111
  68. package/dist/{layers.Ih_DycCa.js → layers.C3me1AOA.js} +3 -3
  69. package/dist/{layers.DOjcR2u6.js → layers.C5XL_KJW.js} +1 -1
  70. package/dist/{layers.wRnSjyfZ.js → layers.C65tYhLf.js} +1 -1
  71. package/dist/{layers.DKhnUElF.js → layers.C67fBVg3.js} +1 -1
  72. package/dist/{layers.B7uv8aVq.js → layers.C6HmVi2T.js} +1 -1
  73. package/dist/{layers.BL7PsAnh.js → layers.C8oO_BiQ.js} +1 -1
  74. package/dist/{layers.CdPjGs2x.js → layers.C9AvvTRV.js} +1 -1
  75. package/dist/{layers.CXoz8wje.js → layers.CA3DQGmO.js} +1 -1
  76. package/dist/{layers.Clo5oIEO.js → layers.CCoWlQxf.js} +1 -1
  77. package/dist/{layers.CeESKes4.js → layers.CCy49ah1.js} +1 -1
  78. package/dist/{layers.OF4XgnEn.js → layers.CDftR5Kg.js} +2 -2
  79. package/dist/{layers.BHEN4Zl8.js → layers.CDw-iNbj.js} +1 -1
  80. package/dist/{layers.De4i5Pzr.js → layers.CEDfv2oj.js} +1 -1
  81. package/dist/{layers.DV0u_-wO.js → layers.CGeTu6ph.js} +1 -1
  82. package/dist/{layers.BOY6DvLj.js → layers.CJlWYRtk.js} +1 -1
  83. package/dist/{layers.DdULzc5-.js → layers.CKy_DRKv.js} +1 -1
  84. package/dist/{layers.Dx7QSKbZ.js → layers.COEorZbZ.js} +1 -1
  85. package/dist/{layers.CIkcRflS.js → layers.CP2_7vUR.js} +1 -1
  86. package/dist/{layers.rSvdeOjc.js → layers.CPEzOey-.js} +1 -1
  87. package/dist/{layers.hzJoyUwS.js → layers.CSY_lOK0.js} +6 -6
  88. package/dist/{layers.pRFngToG.js → layers.CT_bvOgC.js} +1 -1
  89. package/dist/{layers.CX4mdDUE.js → layers.CUWVPrVU.js} +1 -1
  90. package/dist/{layers.BChBzZgi.js → layers.CVCC2rNb.js} +1 -1
  91. package/dist/{layers.DE8kdoob.js → layers.CXbK6Z0C.js} +1 -1
  92. package/dist/{layers.gSOgK4cv.js → layers.CXzpm8-U.js} +1 -1
  93. package/dist/{layers.UPBrkQqm.js → layers.CYwLZCUi.js} +3 -3
  94. package/dist/{layers.CHMDrzTP.js → layers.CZ6FLSh1.js} +1 -1
  95. package/dist/{layers.7aWFCBDk.js → layers.CZzvHupu.js} +1 -1
  96. package/dist/{layers.C5th-3Bk.js → layers.CaZJgSbm.js} +1 -1
  97. package/dist/{layers.B5HV5CkN.js → layers.CcX1e4Cb.js} +1 -1
  98. package/dist/{layers.Bl2uWPK5.js → layers.CgHCxAKJ.js} +1 -1
  99. package/dist/{layers.HnnZ9X3g.js → layers.CgyRf-4B.js} +1 -1
  100. package/dist/{layers.rwvkqrdF.js → layers.ChtNiFGR.js} +1 -1
  101. package/dist/{layers.Cj5o49qm.js → layers.CiYt11kd.js} +1 -1
  102. package/dist/{layers.BI-S-U1z.js → layers.Cik9ty7R.js} +1 -1
  103. package/dist/{layers.PWkD3FXd.js → layers.Cizp88rb.js} +1 -1
  104. package/dist/{layers.MXTL7J0X.js → layers.Cjxg13wd.js} +24330 -23129
  105. package/dist/{layers.BkDwnhF3.js → layers.Cl6-9OBf.js} +1 -1
  106. package/dist/{layers.d0donhTp.js → layers.ClExSsZJ.js} +1 -1
  107. package/dist/{layers.BXIQjroR.js → layers.CqE1nYk3.js} +1 -1
  108. package/dist/{layers.G0qyEFRn.js → layers.CsNI3f74.js} +1 -1
  109. package/dist/{layers.C6vMG-T6.js → layers.CuAECIsO.js} +1 -1
  110. package/dist/{layers.BxCLnc_z.js → layers.CuVNrIcW.js} +1 -1
  111. package/dist/{layers.DYJhYqR2.js → layers.Cv-z4RwC.js} +1 -1
  112. package/dist/{layers.BWppdp8z.js → layers.CvPdAUZN.js} +1 -1
  113. package/dist/{layers.CyaiBxcg.js → layers.CvQiknH6.js} +1 -1
  114. package/dist/{layers.D0t24lyP.js → layers.Cwn1D7F6.js} +1 -1
  115. package/dist/{layers.CdZEenM8.js → layers.CyOP0v_-.js} +1 -1
  116. package/dist/{layers.BCtnSgBi.js → layers.CyvQNQUj.js} +1 -1
  117. package/dist/layers.Cyzu9PKQ.js +1 -0
  118. package/dist/{layers.BldgpPoA.js → layers.Cz4E3Gls.js} +8 -8
  119. package/dist/{layers.NQOujqxE.js → layers.D-rCo5dz.js} +1 -1
  120. package/dist/{layers.B5VQ5ysd.js → layers.D11yimAp.js} +7 -7
  121. package/dist/{layers.DczwzPio.js → layers.D1sBwAcX.js} +1 -1
  122. package/dist/{layers.BH9NvW2c.js → layers.D22AIgry.js} +1 -1
  123. package/dist/{layers.D3eSioXs.js → layers.D2Y56Lcj.js} +1 -1
  124. package/dist/{layers.Bf4maS9l.js → layers.D2sjiqI3.js} +1 -1
  125. package/dist/{layers.Dg_ubB5o.js → layers.D3OtVkCp.js} +1 -1
  126. package/dist/{layers.CbrkK8Nl.js → layers.D3pymTps.js} +1 -1
  127. package/dist/{layers.C4Z2eV4H.js → layers.D44d_6CD.js} +4 -4
  128. package/dist/layers.D4T8fTcj.js +1223 -0
  129. package/dist/{layers.N0KTyT8H.js → layers.D9umovmT.js} +1 -1
  130. package/dist/{layers.BkZl0e9Y.js → layers.DE-6jvOp.js} +1 -1
  131. package/dist/{layers.BzufRV9o.js → layers.DFWypiYS.js} +1 -1
  132. package/dist/{layers.DaA4pT9g.js → layers.DFZcoBfL.js} +1 -1
  133. package/dist/{layers.fjvgvmUK.js → layers.DGHPyPPP.js} +1 -1
  134. package/dist/{layers.BAe6u370.js → layers.DL_hhIIR.js} +3 -3
  135. package/dist/{layers.Cl9YbTGP.js → layers.DMkqdBNu.js} +1 -1
  136. package/dist/{layers.DYR-z4Xd.js → layers.DNpGJLyQ.js} +2 -2
  137. package/dist/{layers.CXFcyuib.js → layers.DPumOFMF.js} +1 -1
  138. package/dist/{layers.CSKgny-q.js → layers.DQ9duwtV.js} +5 -5
  139. package/dist/{layers.U8d2vvil.js → layers.DQSx2qqb.js} +1 -1
  140. package/dist/{layers.D_KjhW7m.js → layers.DRj2t11p.js} +1 -1
  141. package/dist/{layers.CKyZ6fil.js → layers.DWvD3vql.js} +6 -6
  142. package/dist/{layers.C5fqgGR6.js → layers.DXVNKM5t.js} +1 -1
  143. package/dist/{layers.-23sKdPr.js → layers.DXg_yjAg.js} +1 -1
  144. package/dist/{layers.UHdtuNW7.js → layers.DYXNu8ur.js} +1 -1
  145. package/dist/layers.Da3-MQaS.js +315 -0
  146. package/dist/{layers.Dwrpihyi.js → layers.DbEYtfVc.js} +2249 -2231
  147. package/dist/{layers.DyIa2FAJ.js → layers.Dc79Ci3K.js} +3 -3
  148. package/dist/{layers.C-S1uftF.js → layers.DdaAmsdK.js} +1 -1
  149. package/dist/{layers.CDmsB9ui.js → layers.DeGb7buU.js} +1 -1
  150. package/dist/{layers.mS0YwpDF.js → layers.DeUrAJLR.js} +4 -4
  151. package/dist/{layers.C46xOyCn.js → layers.DfLG2r9J.js} +1 -1
  152. package/dist/{layers.DuC5Q-Uc.js → layers.DfVTedYs.js} +1 -1
  153. package/dist/{layers.BLha5Ags.js → layers.DgM9vwax.js} +1 -1
  154. package/dist/layers.Dhzc98B1.js +1 -0
  155. package/dist/{layers.BId9R-tt.js → layers.Dit1Y-a1.js} +1 -1
  156. package/dist/{layers.BXe2f2v0.js → layers.Dj4g5Vb5.js} +1 -1
  157. package/dist/{layers.6xiY7Dmk.js → layers.DkOYepgq.js} +1 -1
  158. package/dist/{layers.Dq7WsWG1.js → layers.Dld8CjhI.js} +1 -1
  159. package/dist/{layers.DEMbeDH5.js → layers.Dlp-dPD8.js} +28 -28
  160. package/dist/{layers.DnvdN9TC.js → layers.DlrAk6DA.js} +1 -1
  161. package/dist/{layers.Bxx3QiqH.js → layers.Dm5fcqXE.js} +1 -1
  162. package/dist/{layers.CHE9Vv0w.js → layers.DpuQVg48.js} +1 -1
  163. package/dist/{layers.B16HCOzz.js → layers.DqT5Jouj.js} +1 -1
  164. package/dist/{layers.CJgtfrlM.js → layers.DrlOZ3DT.js} +1 -1
  165. package/dist/{layers.BQ5pHr1t.js → layers.DsSMSFyE.js} +1 -1
  166. package/dist/layers.DtcuZ6vs.js +187 -0
  167. package/dist/{layers.CAZF51iw.js → layers.DuGoIpLS.js} +5 -5
  168. package/dist/{layers.BTjqsj2D.js → layers.DxS_nrN5.js} +1 -1
  169. package/dist/{layers.xbymChc4.js → layers.DxhSwb8B.js} +320 -319
  170. package/dist/{layers.rK-vslvx.js → layers.DxwOJMY_.js} +1 -1
  171. package/dist/{layers.D0fuzbA_.js → layers.DyPFKCS6.js} +3 -3
  172. package/dist/{layers.Ck_m9yBu.js → layers.DyydDZDU.js} +1 -1
  173. package/dist/{layers.ChLLCYeV.js → layers.GaSOetZx.js} +1 -1
  174. package/dist/{layers.O7rgjuxq.js → layers.IAZiYFRK.js} +1 -1
  175. package/dist/layers.JgqeK3h7.js +1 -0
  176. package/dist/layers.K2rcpzhY.js +4 -0
  177. package/dist/{layers.BCMyc6dl.js → layers.KIWs25tZ.js} +1 -1
  178. package/dist/{layers.BiK_NhRx.js → layers.LLke4z7b.js} +1 -1
  179. package/dist/{layers.B1VWPJr7.js → layers.Marfmnqs.js} +1 -1
  180. package/dist/{layers.2Zh_Eqge.js → layers.OFho5MbN.js} +1 -1
  181. package/dist/layers.R8QN7W65.js +1 -0
  182. package/dist/{layers.CESONz7C.js → layers.RT_eBoD-.js} +1 -1
  183. package/dist/{layers.BgXRgBMD.js → layers.SbloXQp4.js} +1 -1
  184. package/dist/{layers.ShoHTpWp.js → layers.SvUN62A9.js} +1 -1
  185. package/dist/{layers.CENOzW4d.js → layers.TGEy1wS6.js} +1 -1
  186. package/dist/{layers.DhtUpSvn.js → layers.TdE-jeZL.js} +1 -1
  187. package/dist/{layers.C5pjkDUm.js → layers.UWRNxgT8.js} +1 -1
  188. package/dist/{layers.B4o4Yght.js → layers.VA5efHzM.js} +1 -1
  189. package/dist/layers._2_sfSMa.js +1 -0
  190. package/dist/{layers.D-4MyOv6.js → layers.ajIRcGd4.js} +1 -1
  191. package/dist/{layers.BvQfT02S.js → layers.cjE12qw2.js} +1 -1
  192. package/dist/{layers.BNcxqXDY.js → layers.dJvyCZ1b.js} +1 -1
  193. package/dist/{layers.h2SsCt7w.js → layers.da887to_.js} +1 -1
  194. package/dist/{layers.B9ypkXfB.js → layers.dhxVHEDE.js} +1 -1
  195. package/dist/{layers.BkkBEMI4.js → layers.ejvu1U9t.js} +1 -1
  196. package/dist/{layers.C7md-mpb.js → layers.epvyXTdV.js} +5 -5
  197. package/dist/layers.fm_nJlxH.js +6 -0
  198. package/dist/{layers.xlbtHZsv.js → layers.guGfRsPS.js} +1 -1
  199. package/dist/layers.hweLqW3I.js +261 -0
  200. package/dist/{layers.BmdNYA8O.js → layers.j04tfCKj.js} +1 -1
  201. package/dist/{layers.C5vdiuk-.js → layers.kzDq9Q-l.js} +1 -1
  202. package/dist/{layers.B1GsQlw2.js → layers.ldz4asX5.js} +6 -6
  203. package/dist/{layers.BaREUEpY.js → layers.ov1rbOW3.js} +1 -1
  204. package/dist/{layers.CK15u90j.js → layers.pHVqEwm3.js} +1 -1
  205. package/dist/{layers.D56jgM5P.js → layers.rgYI6gus.js} +2 -2
  206. package/dist/{layers.BjIrZvhA.js → layers.sTUiyAuM.js} +1 -1
  207. package/dist/{layers.DIsd_eLu.js → layers.uMaAjCOP.js} +5 -5
  208. package/dist/{layers.Dpl-_pRd.js → layers.vJ0fdhPp.js} +78 -78
  209. package/dist/{layers.ChG4YWfr.js → layers.vqKLXMfn.js} +1 -1
  210. package/dist/{layers.DyrpParn.js → layers.wSBHMHgW.js} +1 -1
  211. package/dist/{layers.Dms1jgA7.js → layers.yquOOwF7.js} +1 -1
  212. package/dist/{layers.Bqy_BDRk.js → layers.zJTwyIu5.js} +1 -1
  213. package/package.json +6 -7
  214. package/dist/layers.9QK1wiQj.js +0 -1
  215. package/dist/layers.BIj1zRV6.js +0 -8
  216. package/dist/layers.Bgx4q6Yl.js +0 -1
  217. package/dist/layers.C7lIplJU.js +0 -247
  218. package/dist/layers.COAF7f8g.js +0 -1
  219. package/dist/layers.CQ_KfkMs.js +0 -1
  220. package/dist/layers.CXnC6LGK.js +0 -1
  221. package/dist/layers.CebNnxUV.js +0 -185
  222. package/dist/layers.Cs24L6er.js +0 -261
  223. package/dist/layers.Cuf8LL65.js +0 -4
  224. package/dist/layers.D4fGb2cV.js +0 -1272
  225. package/dist/layers.DGhEo4ps.js +0 -6
  226. package/dist/layers.DHbgl38J.js +0 -1
  227. package/dist/layers.DcGuLvyP.js +0 -1
  228. package/dist/layers.Y1n_hIuc.js +0 -1
  229. package/dist/layers.b_l02tem.js +0 -319
  230. package/dist/layers.pGJnLNqj.js +0 -285
@@ -1,6 +0,0 @@
1
- import { e as o, j as s, o as f } from "./layers.BldgpPoA.js";
2
- export {
3
- o as default,
4
- s as en,
5
- f as kaa
6
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),r=require("react"),e=require("./layers.CebNnxUV.js"),S=require("./layers.B5VQ5ysd.js"),l=e.oe("INSERT_EXCALIDRAW_COMMAND");function w(){const[n]=e.o(),[c,i]=r.useState(!1),[t,d]=r.useState(null),a=r.useRef(null);r.useEffect(()=>{if(!n.hasNodes([e.ExcalidrawNode]))throw new Error("ExcalidrawPlugin: ExcalidrawNode not registered on editor");return n.registerCommand(l,()=>{i(!0);const s=e.getCurrentElement();return d(s),!0},e.Li)},[n]);const u=()=>{i(!1),a.current=!1},E=()=>{i(!1)},f=(s,N,x)=>{n.update(()=>{const o=e.$createExcalidrawNode();o.setData(JSON.stringify({appState:N,elements:s,files:x})),t&&t.getParent()&&(t==null||t.replace(o))}),i(!1)};return C.jsx(S.ExcalidrawModal,{initialElements:[],initialAppState:{},initialFiles:{},isShown:c,onDelete:E,onClose:u,onSave:f,closeOnClickOutside:!1,isEdited:a})}exports.INSERT_EXCALIDRAW_COMMAND=l;exports.default=w;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),e=require("./layers.CebNnxUV.js"),M=require("@mantine/core");function R(t){const a=t.transform();return new Set(a?[a]:[])}function P({initialEditor:t,children:a,initialNodes:r,initialTheme:p,skipCollabChecks:i,skipEditableListener:c}){const l=o.useRef(!1),E=o.useContext(e.r);E==null&&(function(g,...s){const v=new URL("https://lexical.dev/docs/error"),j=new URLSearchParams;j.append("code",g);for(const u of s)j.append("v",u);throw v.search=j.toString(),Error(`Minified Lexical error #${g}; visit ${v.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(9);const[f,{getTheme:k}]=E,_=o.useMemo((()=>{const g=p||k()||void 0,s=e.t(E,g);g!==void 0&&(t._config.theme=g),t._parentEditor=t._parentEditor||f;const v=t._createEditorArgs,j=v&&v.namespace;if(r){j||(t._config.namespace=f._config.namespace);for(let u of r){let C=null,x=null;if(typeof u!="function"){const N=u;u=N.replace,C=N.with,x=N.withKlass||null}const w=t._nodes.get(u.getType());t._nodes.set(u.getType(),{exportDOM:w?w.exportDOM:void 0,klass:u,replace:C,replaceWithKlass:x,transforms:R(u)})}}else if(v&&v.nodes)j||(t._config.namespace=f._config.namespace);else{const u=t._nodes=new Map(f._nodes);j||(t._config.namespace=f._config.namespace);for(const[C,x]of u)t._nodes.set(C,{exportDOM:x.exportDOM,klass:x.klass,replace:x.replace,replaceWithKlass:x.replaceWithKlass,transforms:R(x.klass)})}return[t,s]}),[]),{isCollabActive:S,yjsDocMap:h}=e.l(),m=i||l.current||h.has(t.getKey());return o.useEffect((()=>{m&&(l.current=!0)}),[m]),o.useEffect((()=>{if(!c){const g=s=>t.setEditable(s);return g(f.isEditable()),f.registerEditableListener(g)}}),[t,f,c]),n.jsx(e.r.Provider,{value:_,children:!S||m?a:null})}function L({"data-test-id":t,children:a,className:r,onClick:p,disabled:i,small:c,title:l}){return n.jsx(M.Button,{onClick:p,disabled:i,variant:"filled",children:a})}function O({children:t,className:a}){return n.jsx("div",{className:a||"Placeholder__root",children:t})}function A({label:t,value:a,onChange:r,placeholder:p="","data-test-id":i,type:c="text"}){return n.jsx(M.TextInput,{type:c,placeholder:p,value:a,onChange:l=>{r(l.target.value)},label:t,"data-test-id":i,mb:10})}const T=new Set;function F(t){if(!T.has(t))throw new Promise(a=>{const r=new Image;r.src=t,r.onload=()=>{T.add(t),a(null)}})}function U({altText:t,className:a,imageRef:r,src:p,width:i,height:c,position:l}){return F(p),n.jsx("img",{className:a||void 0,src:p,alt:t,ref:r,"data-position":l,style:{display:"block",height:c,width:i},draggable:"false"})}function y({activeEditor:t,nodeKey:a,onClose:r}){const i=t.getEditorState().read(()=>e.us(a)),[c,l]=o.useState(i.getAltText()),[E,f]=o.useState(i.getShowCaption()),[k,_]=o.useState(i.getPosition()),S=m=>{f(m.target.checked)},h=()=>{const m={altText:c,position:k,showCaption:E};i&&t.update(()=>{i.update(m)}),r()};return n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{marginBottom:"1em"},children:n.jsx(A,{label:"Alt-текст",placeholder:"Альтернативный текст",onChange:l,value:c,"data-test-id":"image-modal-alt-text-input"})}),n.jsxs("div",{className:"Input__wrapper",children:[n.jsx("input",{id:"caption",type:"checkbox",checked:E,onChange:S}),n.jsx("label",{htmlFor:"caption",children:"Show Caption"})]}),n.jsx(L,{"data-test-id":"image-modal-file-upload-btn",onClick:()=>h(),children:"Применить"})]})}function B({src:t,altText:a,nodeKey:r,width:p,height:i,showCaption:c,caption:l,position:E}){const[f,k]=e.useModal(),_=o.useRef(null),S=o.useRef(null),[h,m,g]=e.u(r),[s]=e.o(),[v,j]=o.useState(null),u=o.useRef(null),C=o.useCallback(b=>{if(h&&e.ur(e.Nr())){b.preventDefault();const d=e.us(r);e.$isInlineImageNode(d)&&d.remove()}return!1},[h,r]),x=o.useCallback(b=>{const I=e.Nr(),d=S.current;if(h&&e.ur(I)&&I.getNodes().length===1){if(c)return e.ms(null),b.preventDefault(),l.focus(),!0;if(d!==null&&d!==document.activeElement)return b.preventDefault(),d.focus(),!0}return!1},[l,h,c]),w=o.useCallback(b=>u.current===l||S.current===b.target?(e.ms(null),s.update(()=>{m(!0);const I=s.getRootElement();I!==null&&I.focus()}),!0):!1,[l,s,m]);o.useEffect(()=>{let b=!0;const I=e.j(s.registerUpdateListener(({editorState:d})=>{b&&j(d.read(()=>e.Nr()))}),s.registerCommand(e.le,(d,D)=>(u.current=D,!1),e.Ii),s.registerCommand(e.ae,d=>{const D=d;return D.target===_.current?(D.shiftKey?m(!h):(g(),m(!0)),!0):!1},e.Ii),s.registerCommand(e.Be,d=>d.target===_.current?(d.preventDefault(),!0):!1,e.Ii),s.registerCommand(e.De,C,e.Ii),s.registerCommand(e.Ae,C,e.Ii),s.registerCommand(e.Ee,x,e.Ii),s.registerCommand(e.Oe,w,e.Ii));return()=>{b=!1,I()}},[g,s,h,r,C,x,w,m]);const N=h;return n.jsxs(o.Suspense,{fallback:null,children:[n.jsxs(n.Fragment,{children:[n.jsxs("div",{draggable:!1,children:[n.jsx("button",{className:"image-edit-button",ref:S,onClick:()=>{k("Update Inline Image",b=>n.jsx(y,{activeEditor:s,nodeKey:r,onClose:b}))},children:"Edit"}),n.jsx(U,{className:N?`focused ${e.ur(v)?"draggable":""}`:null,src:t,altText:a,imageRef:_,width:p,height:i,position:E})]}),c&&n.jsx("div",{className:"image-caption-container",children:n.jsxs(P,{initialEditor:l,children:[n.jsx(e.LinkPlugin,{}),n.jsx(e.FloatingTextFormatToolbarPlugin,{}),n.jsx(e.h,{contentEditable:n.jsx(e.LexicalContentEditable,{className:"InlineImageNode__contentEditable"}),placeholder:n.jsx(O,{className:"InlineImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:e.a$1})]})})]}),f]})}exports.UpdateInlineImageDialog=y;exports.default=B;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("react"),F=require("react-i18next"),i=require("./layers.CebNnxUV.js"),B=require("@mantine/core"),G=require("@layers-app/shared"),k=t=>{const{width:c,height:r,isLoading:h,isError:w,src:f,id:m,altText:p,imageRef:I,maxWidth:g}=t;return u.jsxs("div",{className:"media-wrapper",style:{width:c,height:r,display:"inline-flex",position:"relative"},children:[u.jsx(B.LoadingOverlay,{visible:h,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),u.jsx(V,{className:null,src:f,altText:p,imageRef:I,width:"inherit",height:"inherit",maxWidth:g||"auto",id:m})]})};function V({altText:t,className:c,imageRef:r,src:h,width:w,height:f,maxWidth:m,id:p}){const[I,g]=n.useState(!1);return u.jsx("img",{className:`${c||void 0} ${I?"":"loading"}`,src:h,alt:t,ref:r,style:{height:f,maxWidth:m,width:w},onLoad:()=>{h.includes("splash")?setTimeout(()=>{g(!0)},100):g(!0)},draggable:"false","data-id":p})}function J({src:t,altText:c,nodeKey:r,width:h,height:w,maxWidth:f,showCaption:m,caption:p,id:I,create:g,alignment:H}){var A,$;const M=n.useRef(null),[v,S]=n.useState(!0),{isCollabActive:W}=i.l(),[l]=i.o(),[x,j]=n.useState(!0),[d,y]=n.useState({width:0,height:0}),{fetchUploadMedia:L,fetchDeleteMedia:z,maxFileSize:Q}=n.useContext(i.Context),N=i.mediaMap.has(t)&&(((A=i.mediaMap.get(t))==null?void 0:A.mediaNodeKeys.length)===0||(($=i.mediaMap.get(t))==null?void 0:$.mediaNodeKeys.length)===void 0||t.trim()===""),{t:C}=F.useTranslation(),[X,U]=n.useState(0);n.useEffect(()=>l.registerDecoratorListener(()=>{U(e=>e+1)}),[N]),n.useEffect(()=>{if(!t||t.startsWith("data:image/")||!t.trim()){S(!1);return}const e=new Image;e.src=t,e.onload=()=>S(!1),e.onerror=()=>{S(!1)}},[t,N]);const D=(e,o)=>{l.update(()=>{i.ms(null);const s=i.us(r);i.$isImageNode(s)&&s.setWidthAndHeight(e,o)})},{historyState:P}=i.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:R}}=i.useSettings(),[b,E]=n.useState(!1);function T(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function _(e){return new Promise((o,s)=>{if(T(e)){o(0);return}const a=new Image;a.src=e,a.onload=()=>{o(a.width)},a.onerror=()=>{s(new Error("Failed to load image"))}})}n.useEffect(()=>{g&&E(!0)},[g]),n.useEffect(()=>{let e=h,o=w,s=100;(t.includes("unsplash")?t.trim():!N&&t.trim()||t.includes("upload-src-editor"))&&t!=="upload"&&_(t).then(a=>{typeof e=="number"&&e<s&&a<s?(j(!0),y({width:e,height:o})):a<s?(j(!0),y({width:"auto",height:"auto"})):(y({width:a,height:a}),j(!1))}).catch(a=>{console.warn("Ошибка при загрузке изображения:",a.message)})},[t,N]),n.useEffect(()=>{d.width&&d.height&&x&&l.update(()=>{const e=i.us(r);i.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,x]),n.useEffect(()=>{const e=document.documentElement;i.toggleLockScroll(b,e)},[b]),n.useEffect(()=>l.registerCommand(i.UPLOAD_IMAGE_COMMAND,e=>(t==="upload"&&q(e),!1),i.Ii),[t,v]);const O=(e,o)=>{S(!1),l.update(()=>{const s=i.us(r);i.$isImageNode(s)&&(s.setSrc(e),s.setId(o))})},q=e=>{S(!0),L&&L(e[0],(o,s)=>{O(o,s)},o=>{o&&G.showErrorNotification({message:C("editor.gallery.errorFile")}),O("","")})};return!t||t==="upload"?u.jsx(i.ImagePicker,{uploading:!1,onUpload:e=>{!L||!e.length||(q(e),E(!1))},popoverProps:{opened:b,position:"bottom",onChange:E},onChange:e=>{E(!1),l.update(()=>{const o=i.us(r);i.$isImageNode(o)&&o.setSrc(e)})},children:u.jsx(i.EmptyNodeButton,{title:C("editor.image.add_photo"),icon:"photo",onClick:()=>E(!b),isLoading:v})}):x?u.jsx(k,{width:d.width,height:d.height,isLoading:v,isError:!1,isIcon:x,src:t,id:I,editor:l,nodeKey:r,fetchDeleteMedia:z,altText:c,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:W,historyState:P,showNestedEditorTreeView:R,t:C}):u.jsx(i.ResizableContainer,{editor:l,isIcon:x,width:i.parseContainerSize(h),height:i.parseContainerSize(w),initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:D,alignment:H,children:u.jsx(k,{width:"inherit",height:"inherit",isLoading:v,isError:!1,isIcon:x,src:t,id:I,editor:l,nodeKey:r,fetchDeleteMedia:z,altText:c,imageRef:M,maxWidth:f,showCaption:m,caption:p,isCollabActive:W,historyState:P,showNestedEditorTreeView:R,t:C})})}exports.default=J;
@@ -1,319 +0,0 @@
1
- import { jsx as n, jsxs as w, Fragment as U } from "react/jsx-runtime";
2
- import { useRef as M, useContext as K, useMemo as W, useEffect as $, useState as y, useCallback as P, Suspense as z } from "react";
3
- import { y as B, z as q, l as G, B as H, q as J, a as Q, F as L, N as R, c as j, G as V, h as F, r as X, O as Y, I, H as Z, s as ee, D as te, J as ne, v as ae, K as se, M as oe, P as re, Q as le, S as ie, T as ce } from "./layers.MXTL7J0X.js";
4
- import { Button as de, TextInput as ue } from "@mantine/core";
5
- function O(e) {
6
- const a = e.transform();
7
- return new Set(a ? [a] : []);
8
- }
9
- function me({ initialEditor: e, children: a, initialNodes: s, initialTheme: f, skipCollabChecks: o, skipEditableListener: l }) {
10
- const r = M(!1), b = K(B);
11
- b == null && (function(m, ...t) {
12
- const v = new URL("https://lexical.dev/docs/error"), E = new URLSearchParams();
13
- E.append("code", m);
14
- for (const i of t) E.append("v", i);
15
- throw v.search = E.toString(), Error(`Minified Lexical error #${m}; visit ${v.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
16
- })(9);
17
- const [u, { getTheme: k }] = b, S = W((() => {
18
- const m = f || k() || void 0, t = q(b, m);
19
- m !== void 0 && (e._config.theme = m), e._parentEditor = e._parentEditor || u;
20
- const v = e._createEditorArgs, E = v && v.namespace;
21
- if (s) {
22
- E || (e._config.namespace = u._config.namespace);
23
- for (let i of s) {
24
- let C = null, g = null;
25
- if (typeof i != "function") {
26
- const T = i;
27
- i = T.replace, C = T.with, g = T.withKlass || null;
28
- }
29
- const N = e._nodes.get(i.getType());
30
- e._nodes.set(i.getType(), { exportDOM: N ? N.exportDOM : void 0, klass: i, replace: C, replaceWithKlass: g, transforms: O(i) });
31
- }
32
- } else if (v && v.nodes) E || (e._config.namespace = u._config.namespace);
33
- else {
34
- const i = e._nodes = new Map(u._nodes);
35
- E || (e._config.namespace = u._config.namespace);
36
- for (const [C, g] of i) e._nodes.set(C, { exportDOM: g.exportDOM, klass: g.klass, replace: g.replace, replaceWithKlass: g.replaceWithKlass, transforms: O(g.klass) });
37
- }
38
- return [e, t];
39
- }), []), { isCollabActive: x, yjsDocMap: p } = G(), d = o || r.current || p.has(e.getKey());
40
- return $((() => {
41
- d && (r.current = !0);
42
- }), [d]), $((() => {
43
- if (!l) {
44
- const m = (t) => e.setEditable(t);
45
- return m(u.isEditable()), u.registerEditableListener(m);
46
- }
47
- }), [e, u, l]), n(B.Provider, { value: S, children: !x || d ? a : null });
48
- }
49
- function fe({
50
- "data-test-id": e,
51
- children: a,
52
- className: s,
53
- onClick: f,
54
- disabled: o,
55
- small: l,
56
- title: r
57
- }) {
58
- return /* @__PURE__ */ n(de, { onClick: f, disabled: o, variant: "filled", children: a });
59
- }
60
- function pe({
61
- children: e,
62
- className: a
63
- }) {
64
- return /* @__PURE__ */ n("div", { className: a || "Placeholder__root", children: e });
65
- }
66
- function ge({
67
- label: e,
68
- value: a,
69
- onChange: s,
70
- placeholder: f = "",
71
- "data-test-id": o,
72
- type: l = "text"
73
- }) {
74
- return /* @__PURE__ */ n(
75
- ue,
76
- {
77
- type: l,
78
- placeholder: f,
79
- value: a,
80
- onChange: (r) => {
81
- s(r.target.value);
82
- },
83
- label: e,
84
- "data-test-id": o,
85
- mb: 10
86
- }
87
- );
88
- }
89
- const A = /* @__PURE__ */ new Set();
90
- function he(e) {
91
- if (!A.has(e))
92
- throw new Promise((a) => {
93
- const s = new Image();
94
- s.src = e, s.onload = () => {
95
- A.add(e), a(null);
96
- };
97
- });
98
- }
99
- function ve({
100
- altText: e,
101
- className: a,
102
- imageRef: s,
103
- src: f,
104
- width: o,
105
- height: l,
106
- position: r
107
- }) {
108
- return he(f), /* @__PURE__ */ n(
109
- "img",
110
- {
111
- className: a || void 0,
112
- src: f,
113
- alt: e,
114
- ref: s,
115
- "data-position": r,
116
- style: {
117
- display: "block",
118
- height: l,
119
- width: o
120
- },
121
- draggable: "false"
122
- }
123
- );
124
- }
125
- function Ee({
126
- activeEditor: e,
127
- nodeKey: a,
128
- onClose: s
129
- }) {
130
- const o = e.getEditorState().read(
131
- () => j(a)
132
- ), [l, r] = y(o.getAltText()), [b, u] = y(o.getShowCaption()), [k, S] = y(o.getPosition()), x = (d) => {
133
- u(d.target.checked);
134
- }, p = () => {
135
- const d = { altText: l, position: k, showCaption: b };
136
- o && e.update(() => {
137
- o.update(d);
138
- }), s();
139
- };
140
- return /* @__PURE__ */ w(U, { children: [
141
- /* @__PURE__ */ n("div", { style: { marginBottom: "1em" }, children: /* @__PURE__ */ n(
142
- ge,
143
- {
144
- label: "Alt-текст",
145
- placeholder: "Альтернативный текст",
146
- onChange: r,
147
- value: l,
148
- "data-test-id": "image-modal-alt-text-input"
149
- }
150
- ) }),
151
- /* @__PURE__ */ w("div", { className: "Input__wrapper", children: [
152
- /* @__PURE__ */ n(
153
- "input",
154
- {
155
- id: "caption",
156
- type: "checkbox",
157
- checked: b,
158
- onChange: x
159
- }
160
- ),
161
- /* @__PURE__ */ n("label", { htmlFor: "caption", children: "Show Caption" })
162
- ] }),
163
- /* @__PURE__ */ n(
164
- fe,
165
- {
166
- "data-test-id": "image-modal-file-upload-btn",
167
- onClick: () => p(),
168
- children: "Применить"
169
- }
170
- )
171
- ] });
172
- }
173
- function Ie({
174
- src: e,
175
- altText: a,
176
- nodeKey: s,
177
- width: f,
178
- height: o,
179
- showCaption: l,
180
- caption: r,
181
- position: b
182
- }) {
183
- const [u, k] = H(), S = M(null), x = M(null), [p, d, m] = J(s), [t] = Q(), [v, E] = y(null), i = M(null), C = P(
184
- (h) => {
185
- if (p && L(R())) {
186
- h.preventDefault();
187
- const c = j(s);
188
- V(c) && c.remove();
189
- }
190
- return !1;
191
- },
192
- [p, s]
193
- ), g = P(
194
- (h) => {
195
- const _ = R(), c = x.current;
196
- if (p && L(_) && _.getNodes().length === 1) {
197
- if (l)
198
- return F(null), h.preventDefault(), r.focus(), !0;
199
- if (c !== null && c !== document.activeElement)
200
- return h.preventDefault(), c.focus(), !0;
201
- }
202
- return !1;
203
- },
204
- [r, p, l]
205
- ), N = P(
206
- (h) => i.current === r || x.current === h.target ? (F(null), t.update(() => {
207
- d(!0);
208
- const _ = t.getRootElement();
209
- _ !== null && _.focus();
210
- }), !0) : !1,
211
- [r, t, d]
212
- );
213
- return $(() => {
214
- let h = !0;
215
- const _ = X(
216
- t.registerUpdateListener(({ editorState: c }) => {
217
- h && E(c.read(() => R()));
218
- }),
219
- t.registerCommand(
220
- se,
221
- (c, D) => (i.current = D, !1),
222
- I
223
- ),
224
- t.registerCommand(
225
- ae,
226
- (c) => {
227
- const D = c;
228
- return D.target === S.current ? (D.shiftKey ? d(!p) : (m(), d(!0)), !0) : !1;
229
- },
230
- I
231
- ),
232
- t.registerCommand(
233
- ne,
234
- (c) => c.target === S.current ? (c.preventDefault(), !0) : !1,
235
- I
236
- ),
237
- t.registerCommand(
238
- te,
239
- C,
240
- I
241
- ),
242
- t.registerCommand(
243
- ee,
244
- C,
245
- I
246
- ),
247
- t.registerCommand(Z, g, I),
248
- t.registerCommand(
249
- Y,
250
- N,
251
- I
252
- )
253
- );
254
- return () => {
255
- h = !1, _();
256
- };
257
- }, [
258
- m,
259
- t,
260
- p,
261
- s,
262
- C,
263
- g,
264
- N,
265
- d
266
- ]), /* @__PURE__ */ w(z, { fallback: null, children: [
267
- /* @__PURE__ */ w(U, { children: [
268
- /* @__PURE__ */ w("div", { draggable: !1, children: [
269
- /* @__PURE__ */ n(
270
- "button",
271
- {
272
- className: "image-edit-button",
273
- ref: x,
274
- onClick: () => {
275
- k("Update Inline Image", (h) => /* @__PURE__ */ n(
276
- Ee,
277
- {
278
- activeEditor: t,
279
- nodeKey: s,
280
- onClose: h
281
- }
282
- ));
283
- },
284
- children: "Edit"
285
- }
286
- ),
287
- /* @__PURE__ */ n(
288
- ve,
289
- {
290
- className: p ? `focused ${L(v) ? "draggable" : ""}` : null,
291
- src: e,
292
- altText: a,
293
- imageRef: S,
294
- width: f,
295
- height: o,
296
- position: b
297
- }
298
- )
299
- ] }),
300
- l && /* @__PURE__ */ n("div", { className: "image-caption-container", children: /* @__PURE__ */ w(me, { initialEditor: r, children: [
301
- /* @__PURE__ */ n(oe, {}),
302
- /* @__PURE__ */ n(re, {}),
303
- /* @__PURE__ */ n(
304
- le,
305
- {
306
- contentEditable: /* @__PURE__ */ n(ce, { className: "InlineImageNode__contentEditable" }),
307
- placeholder: /* @__PURE__ */ n(pe, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
308
- ErrorBoundary: ie
309
- }
310
- )
311
- ] }) })
312
- ] }),
313
- u
314
- ] });
315
- }
316
- export {
317
- Ee as UpdateInlineImageDialog,
318
- Ie as default
319
- };
@@ -1,285 +0,0 @@
1
- import { jsx as d, jsxs as J } from "react/jsx-runtime";
2
- import { useRef as Q, useState as I, useContext as X, useEffect as g } from "react";
3
- import { useTranslation as Y } from "react-i18next";
4
- import { l as Z, a as K, C as ee, m as P, u as te, b as ie, c as L, d as W, t as oe, U as ae, I as ne, e as se, f as re, R as de, p as T, h as le } from "./layers.MXTL7J0X.js";
5
- import { LoadingOverlay as he } from "@mantine/core";
6
- import { showErrorNotification as ge } from "@layers-app/shared";
7
- const $ = (t) => {
8
- const {
9
- width: u,
10
- height: n,
11
- isLoading: l,
12
- isError: v,
13
- src: m,
14
- id: f,
15
- altText: c,
16
- imageRef: p,
17
- maxWidth: h
18
- } = t;
19
- return /* @__PURE__ */ J(
20
- "div",
21
- {
22
- className: "media-wrapper",
23
- style: {
24
- width: u,
25
- height: n,
26
- display: "inline-flex",
27
- position: "relative"
28
- },
29
- children: [
30
- /* @__PURE__ */ d(
31
- he,
32
- {
33
- visible: l,
34
- zIndex: 1e3,
35
- overlayProps: { backgroundOpacity: 0.5 },
36
- loaderProps: { size: 24, color: "black" }
37
- }
38
- ),
39
- /* @__PURE__ */ d(
40
- ue,
41
- {
42
- className: null,
43
- src: m,
44
- altText: c,
45
- imageRef: p,
46
- width: "inherit",
47
- height: "inherit",
48
- maxWidth: h || "auto",
49
- id: f
50
- }
51
- )
52
- ]
53
- }
54
- );
55
- };
56
- function ue({
57
- altText: t,
58
- className: u,
59
- imageRef: n,
60
- src: l,
61
- width: v,
62
- height: m,
63
- maxWidth: f,
64
- id: c
65
- }) {
66
- const [p, h] = I(!1);
67
- return /* @__PURE__ */ d(
68
- "img",
69
- {
70
- className: `${u || void 0} ${p ? "" : "loading"}`,
71
- src: l,
72
- alt: t,
73
- ref: n,
74
- style: {
75
- height: m,
76
- maxWidth: f,
77
- width: v
78
- },
79
- onLoad: () => {
80
- l.includes("splash") ? setTimeout(() => {
81
- h(!0);
82
- }, 100) : h(!0);
83
- },
84
- draggable: "false",
85
- "data-id": c
86
- }
87
- );
88
- }
89
- function xe({
90
- src: t,
91
- altText: u,
92
- nodeKey: n,
93
- width: l,
94
- height: v,
95
- maxWidth: m,
96
- showCaption: f,
97
- caption: c,
98
- id: p,
99
- create: h,
100
- alignment: j
101
- }) {
102
- var _, F;
103
- const R = Q(null), [b, C] = I(!0), { isCollabActive: A } = Z(), [r] = K(), [w, y] = I(!0), [s, z] = I({
104
- width: 0,
105
- height: 0
106
- }), { fetchUploadMedia: M, fetchDeleteMedia: O, maxFileSize: me } = X(ee), E = P.has(t) && (((_ = P.get(t)) == null ? void 0 : _.mediaNodeKeys.length) === 0 || ((F = P.get(t)) == null ? void 0 : F.mediaNodeKeys.length) === void 0 || t.trim() === ""), { t: N } = Y(), [fe, B] = I(0);
107
- g(() => r.registerDecoratorListener(() => {
108
- B((e) => e + 1);
109
- }), [E]), g(() => {
110
- if (!t || t.startsWith("data:image/") || !t.trim()) {
111
- C(!1);
112
- return;
113
- }
114
- const e = new Image();
115
- e.src = t, e.onload = () => C(!1), e.onerror = () => {
116
- C(!1);
117
- };
118
- }, [t, E]);
119
- const G = (e, i) => {
120
- r.update(() => {
121
- le(null);
122
- const o = L(n);
123
- W(o) && o.setWidthAndHeight(e, i);
124
- });
125
- }, { historyState: U } = te(), {
126
- settings: { showNestedEditorTreeView: k }
127
- } = ie(), [S, x] = I(!1);
128
- function V(e) {
129
- return e.endsWith(".svg") || e.includes("image/svg+xml");
130
- }
131
- function q(e) {
132
- return new Promise((i, o) => {
133
- if (V(e)) {
134
- i(0);
135
- return;
136
- }
137
- const a = new Image();
138
- a.src = e, a.onload = () => {
139
- i(a.width);
140
- }, a.onerror = () => {
141
- o(new Error("Failed to load image"));
142
- };
143
- });
144
- }
145
- g(() => {
146
- h && x(!0);
147
- }, [h]), g(() => {
148
- let e = l, i = v, o = 100;
149
- (t.includes("unsplash") ? t.trim() : !E && t.trim() || t.includes("upload-src-editor")) && t !== "upload" && q(t).then((a) => {
150
- typeof e == "number" && e < o && a < o ? (y(!0), z({
151
- width: e,
152
- height: i
153
- })) : a < o ? (y(!0), z({
154
- width: "auto",
155
- height: "auto"
156
- })) : (z({
157
- width: a,
158
- height: a
159
- }), y(!1));
160
- }).catch((a) => {
161
- console.warn("Ошибка при загрузке изображения:", a.message);
162
- });
163
- }, [t, E]), g(() => {
164
- s.width && s.height && w && r.update(() => {
165
- const e = L(n);
166
- W(e) && e.setWidthAndHeight(s.width, s.height);
167
- });
168
- }, [s.width, s.height, w]), g(() => {
169
- const e = document.documentElement;
170
- oe(S, e);
171
- }, [S]), g(() => r.registerCommand(
172
- ae,
173
- (e) => (t === "upload" && D(e), !1),
174
- ne
175
- ), [t, b]);
176
- const H = (e, i) => {
177
- C(!1), r.update(() => {
178
- const o = L(n);
179
- W(o) && (o.setSrc(e), o.setId(i));
180
- });
181
- }, D = (e) => {
182
- C(!0), M && M(
183
- e[0],
184
- (i, o) => {
185
- H(i, o);
186
- },
187
- (i) => {
188
- i && ge({
189
- message: N("editor.gallery.errorFile")
190
- }), H("", "");
191
- }
192
- );
193
- };
194
- return !t || t === "upload" ? /* @__PURE__ */ d(
195
- se,
196
- {
197
- uploading: !1,
198
- onUpload: (e) => {
199
- !M || !e.length || (D(e), x(!1));
200
- },
201
- popoverProps: {
202
- opened: S,
203
- position: "bottom",
204
- onChange: x
205
- },
206
- onChange: (e) => {
207
- x(!1), r.update(() => {
208
- const i = L(n);
209
- W(i) && i.setSrc(e);
210
- });
211
- },
212
- children: /* @__PURE__ */ d(
213
- re,
214
- {
215
- title: N("editor.image.add_photo"),
216
- icon: "photo",
217
- onClick: () => x(!S),
218
- isLoading: b
219
- }
220
- )
221
- }
222
- ) : w ? /* @__PURE__ */ d(
223
- $,
224
- {
225
- width: s.width,
226
- height: s.height,
227
- isLoading: b,
228
- isError: !1,
229
- isIcon: w,
230
- src: t,
231
- id: p,
232
- editor: r,
233
- nodeKey: n,
234
- fetchDeleteMedia: O,
235
- altText: u,
236
- imageRef: R,
237
- maxWidth: m,
238
- showCaption: f,
239
- caption: c,
240
- isCollabActive: A,
241
- historyState: U,
242
- showNestedEditorTreeView: k,
243
- t: N
244
- }
245
- ) : /* @__PURE__ */ d(
246
- de,
247
- {
248
- editor: r,
249
- isIcon: w,
250
- width: T(l),
251
- height: T(v),
252
- initialWidth: s.width || "",
253
- initialHeight: s.height || "",
254
- onResizeEnd: G,
255
- alignment: j,
256
- children: /* @__PURE__ */ d(
257
- $,
258
- {
259
- width: "inherit",
260
- height: "inherit",
261
- isLoading: b,
262
- isError: !1,
263
- isIcon: w,
264
- src: t,
265
- id: p,
266
- editor: r,
267
- nodeKey: n,
268
- fetchDeleteMedia: O,
269
- altText: u,
270
- imageRef: R,
271
- maxWidth: m,
272
- showCaption: f,
273
- caption: c,
274
- isCollabActive: A,
275
- historyState: U,
276
- showNestedEditorTreeView: k,
277
- t: N
278
- }
279
- )
280
- }
281
- );
282
- }
283
- export {
284
- xe as default
285
- };