@layers-app/editor 0.7.91 → 0.7.92

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 (227) hide show
  1. package/README.md +831 -831
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.d.ts +65 -5
  4. package/dist/index.js +14 -12
  5. package/dist/{layers.BxJNNCy-.js → layers.-cNYa8FH.js} +1 -1
  6. package/dist/layers.-go0yqrB.js +346 -0
  7. package/dist/{layers.CzZEhYA6.js → layers.-mDZECmb.js} +1 -1
  8. package/dist/{layers.L1TtWkmC.js → layers.2HPpqSIH.js} +1 -1
  9. package/dist/{layers.DmU5Anc4.js → layers.8fnCtugI.js} +1 -1
  10. package/dist/{layers.CGShHrLT.js → layers.8jZXu6Rm.js} +1 -1
  11. package/dist/{layers.CBdEFdre.js → layers.9mcMwZEW.js} +4 -4
  12. package/dist/{layers.Bmn-T0aX.js → layers.9mdVpQdh.js} +1 -1
  13. package/dist/{layers.C31JBznY.js → layers.B1ARxIqB.js} +1 -1
  14. package/dist/{layers.CY8jpw3v.js → layers.B1oYEFZP.js} +1 -1
  15. package/dist/{layers.DvGS-SSz.js → layers.B3UEoC3V.js} +1 -1
  16. package/dist/{layers.BNymP4r3.js → layers.B3mTVCFZ.js} +1 -1
  17. package/dist/{layers.Dzk6fJM5.js → layers.B5DNqRLR.js} +1 -1
  18. package/dist/{layers.DQTLb9d2.js → layers.B67YEwi2.js} +1 -1
  19. package/dist/{layers.DNhCU6s5.js → layers.B6iDa8RT.js} +1 -1
  20. package/dist/{layers.9m-q7HMz.js → layers.B8MrCT1B.js} +1 -1
  21. package/dist/{layers.yxXv8-qx.js → layers.B8Y8jR5X.js} +1 -1
  22. package/dist/{layers.DfTfRyZ2.js → layers.B9Jm8gWZ.js} +8 -8
  23. package/dist/{layers.DvIGamVW.js → layers.BA-Hn-8i.js} +1 -1
  24. package/dist/{layers.D6LPAQ3H.js → layers.BAJ2-bXH.js} +1 -1
  25. package/dist/{layers.CSBT0zCi.js → layers.BBvJZ2gd.js} +2 -2
  26. package/dist/{layers.a9shJm0-.js → layers.BFBYRXUj.js} +1 -1
  27. package/dist/layers.BFiBXBMU.js +1 -0
  28. package/dist/{layers.Cx9vuthZ.js → layers.BHIb7oOU.js} +1 -1
  29. package/dist/{layers.jj3JxHzF.js → layers.BJ9hFtJT.js} +1 -1
  30. package/dist/{layers.CnipcMUo.js → layers.BNQ1MOkD.js} +1 -1
  31. package/dist/{layers.BBPVs8ke.js → layers.BNi48siA.js} +1 -1
  32. package/dist/{layers.C_BuSOXV.js → layers.BOh-DK5k.js} +1 -1
  33. package/dist/{layers.xYDGOBJ7.js → layers.BQ-H3YLY.js} +4 -4
  34. package/dist/{layers.DVxOlwho.js → layers.BR01ua_4.js} +1 -1
  35. package/dist/{layers.cbsF3ABe.js → layers.BUGORd_C.js} +4 -4
  36. package/dist/{layers.CbOy6iuh.js → layers.BV5O3Yjr.js} +1 -1
  37. package/dist/{layers.DpPj0eFu.js → layers.BX4qFBHZ.js} +2 -2
  38. package/dist/layers.BYU-0xYT.js +6 -0
  39. package/dist/{layers.Dq14e8um.js → layers.BYtl3t4o.js} +1 -1
  40. package/dist/{layers.DjtdjeMN.js → layers.Ba0lsCQC.js} +1 -1
  41. package/dist/{layers.C82DUOIJ.js → layers.BcpQT2YY.js} +1 -1
  42. package/dist/{layers.C1-KIcV0.js → layers.BcsRLUTx.js} +1 -1
  43. package/dist/{layers.DXhEw3Uf.js → layers.BeWDYex5.js} +1 -1
  44. package/dist/{layers.BRXB2ojy.js → layers.BexTNd-c.js} +1 -1
  45. package/dist/{layers.BQ9IFWJb.js → layers.BfpJiswu.js} +65 -65
  46. package/dist/{layers.BhkVL0ec.js → layers.BgVF9Tny.js} +1 -1
  47. package/dist/{layers.EsSJyH4p.js → layers.BhE4ByBZ.js} +1 -1
  48. package/dist/{layers.B99-M2Pq.js → layers.BhIZgvhm.js} +1 -1
  49. package/dist/{layers.QFXdXzNC.js → layers.BhjR9hmy.js} +1 -1
  50. package/dist/{layers.ptSKSnsM.js → layers.BjSFrA4f.js} +2 -2
  51. package/dist/{layers.DZffch6Z.js → layers.BltC4xgl.js} +1 -1
  52. package/dist/{layers.CF0Pm8JW.js → layers.Bmk77Nl5.js} +1 -1
  53. package/dist/{layers.DwW9jbSa.js → layers.Bn8tW8p5.js} +1 -1
  54. package/dist/{layers.iq2p8hfe.js → layers.BoPR0wQt.js} +3 -3
  55. package/dist/{layers.VNpx-j2F.js → layers.BoX_Wqae.js} +1 -1
  56. package/dist/{layers.DKl4VJpC.js → layers.BqCSz12w.js} +1 -1
  57. package/dist/{layers.A_9hYuUz.js → layers.Bqqt2WZE.js} +1 -1
  58. package/dist/{layers.D9t5OjhB.js → layers.BrsKNoq-.js} +1 -1
  59. package/dist/{layers.DKEvxn4N.js → layers.BvhzLRzG.js} +1 -1
  60. package/dist/{layers.BsqLCh4g.js → layers.Bvv96FkK.js} +7 -7
  61. package/dist/layers.Bvxpmu-2.js +1 -0
  62. package/dist/{layers.B4bx8nL1.js → layers.BvzEdEXm.js} +1 -1
  63. package/dist/{layers.DE6n2lbB.js → layers.Bx8how39.js} +1 -1
  64. package/dist/{layers.GHHvJWs7.js → layers.BxFztpj5.js} +1 -1
  65. package/dist/{layers.CvjBGGpq.js → layers.BxH_KvZM.js} +1 -1
  66. package/dist/{layers.D8oafJyy.js → layers.BxY27rS7.js} +1 -1
  67. package/dist/{layers.BuXkQfJs.js → layers.By_kFoy7.js} +1 -1
  68. package/dist/{layers.lyzv8Tdh.js → layers.BzC8fzb9.js} +1 -1
  69. package/dist/{layers.CDLqv7ym.js → layers.BzRIellV.js} +1 -1
  70. package/dist/{layers.CBNU_L8B.js → layers.BzZqZM22.js} +1 -1
  71. package/dist/layers.C-hhGDUy.js +8 -0
  72. package/dist/{layers.DnF_P606.js → layers.C3l4W4QY.js} +1 -1
  73. package/dist/{layers.CrxxaDR8.js → layers.C4ZTYVln.js} +3 -3
  74. package/dist/{layers.BPq549HI.js → layers.C5LXz2Dt.js} +1 -1
  75. package/dist/{layers.Bok_R4HJ.js → layers.C5Oq8KLD.js} +1 -1
  76. package/dist/{layers.K82Ix00Q.js → layers.C68ajHa1.js} +1 -1
  77. package/dist/{layers.BqGhYWCx.js → layers.C6i05MYQ.js} +1 -1
  78. package/dist/{layers.DelKapFT.js → layers.C9OSt3-B.js} +1 -1
  79. package/dist/{layers.Di_ebgPq.js → layers.CA75s71W.js} +1 -1
  80. package/dist/{layers.C-Lpwe6Y.js → layers.CARdVtYx.js} +1 -1
  81. package/dist/{layers.Bjl1_R6Z.js → layers.CAoP3DTW.js} +1 -1
  82. package/dist/{layers.BAvL9Vgi.js → layers.CCCrplmS.js} +1 -1
  83. package/dist/{layers.BF7lqemv.js → layers.CCeryKPD.js} +1 -1
  84. package/dist/{layers.Bq29Ll-w.js → layers.CCyI84zh.js} +1 -1
  85. package/dist/{layers.Cwv-pH3r.js → layers.CD8wS95C.js} +1 -1
  86. package/dist/{layers.Btx_w26T.js → layers.CE94zD9l.js} +1 -1
  87. package/dist/{layers.C0yjCiag.js → layers.CEResW_R.js} +1 -1
  88. package/dist/{layers.B51O0bab.js → layers.CEoeaJQD.js} +1 -1
  89. package/dist/{layers.D_cWd6Ci.js → layers.CFzM74P5.js} +1 -1
  90. package/dist/{layers.DmrZirR9.js → layers.CHC4RiFK.js} +1 -1
  91. package/dist/{layers.B7QYOT88.js → layers.CI16GYp5.js} +1 -1
  92. package/dist/layers.CIg6bGPB.js +1 -0
  93. package/dist/{layers.COnQtCRG.js → layers.CJ6TVAfM.js} +1 -1
  94. package/dist/{layers.DWTB01CF.js → layers.CJfAmCMO.js} +1 -1
  95. package/dist/{layers.C9Uu962e.js → layers.CKZ6gFse.js} +1 -1
  96. package/dist/{layers.BkOUTv0-.js → layers.CMnu34_U.js} +1 -1
  97. package/dist/{layers.BG_57mAh.js → layers.CNUeObBK.js} +1 -1
  98. package/dist/{layers.BXY3dau8.js → layers.CPaiSNny.js} +1 -1
  99. package/dist/{layers.BMyYO1L4.js → layers.CRW9Fwvq.js} +1 -1
  100. package/dist/{layers.B8ydiUV_.js → layers.CTpPpYwM.js} +1 -1
  101. package/dist/{layers.B2E3vOjo.js → layers.CTsI8G5d.js} +1 -1
  102. package/dist/layers.CVCmClj2.js +1 -0
  103. package/dist/{layers.BesXTWr4.js → layers.CVFxZSWW.js} +1 -1
  104. package/dist/{layers.asoCYFXt.js → layers.CVH7bHbB.js} +1 -1
  105. package/dist/{layers.DruYzHRH.js → layers.CcvQrhZG.js} +4 -4
  106. package/dist/{layers.C7bBkyxI.js → layers.CdTCz5Y3.js} +1 -1
  107. package/dist/{layers.CDWdO4TY.js → layers.CeayngSI.js} +1 -1
  108. package/dist/{layers.VASPkGuF.js → layers.Cfdr-h4O.js} +1 -1
  109. package/dist/{layers.0MCDA6GD.js → layers.CgkVp4lC.js} +1 -1
  110. package/dist/{layers.DU_eOKX_.js → layers.ChzgxWon.js} +1 -1
  111. package/dist/{layers.BbTVs0hb.js → layers.Cj01jo54.js} +1 -1
  112. package/dist/{layers.BhKW4lnv.js → layers.ClQJRYXj.js} +1 -1
  113. package/dist/layers.CmmYt3Ou.js +1 -0
  114. package/dist/{layers.CCbAhdPE.js → layers.CmyRYGoE.js} +3 -3
  115. package/dist/{layers.CS6GZ0E2.js → layers.CpZ9aPMO.js} +3 -3
  116. package/dist/{layers.xoXACb1H.js → layers.Cpw6B803.js} +1 -1
  117. package/dist/{layers.te3QRbJL.js → layers.CqyzxURh.js} +1 -1
  118. package/dist/{layers.CfKCx5re.js → layers.Cs7GlunF.js} +1 -1
  119. package/dist/{layers.B7VSWicC.js → layers.CsEfNhVM.js} +1 -1
  120. package/dist/{layers.Cp-q47r3.js → layers.CsMhgQ1t.js} +1 -1
  121. package/dist/{layers.DbHjUv0g.js → layers.CsWdKhEu.js} +1 -1
  122. package/dist/{layers.DL_w_37d.js → layers.CsvDJIZ7.js} +1 -1
  123. package/dist/{layers.BoqksHF8.js → layers.CuPX21JA.js} +1 -1
  124. package/dist/{layers.DGhDlf0S.js → layers.CwB1NQbd.js} +1 -1
  125. package/dist/{layers.C-5u25tX.js → layers.Cx-9Emh6.js} +1 -1
  126. package/dist/{layers.Ci-ifSxX.js → layers.D1bCzAYq.js} +1 -1
  127. package/dist/{layers.D4-FlYEh.js → layers.D1dsXFS0.js} +1 -1
  128. package/dist/{layers.1FQfuwxk.js → layers.D24Anxjv.js} +1 -1
  129. package/dist/layers.D3uB-jsE.js +1 -0
  130. package/dist/{layers.BpAsaaWJ.js → layers.D4MDjmxL.js} +1 -1
  131. package/dist/{layers.BZ1tehAT.js → layers.D5hpoy9h.js} +2 -2
  132. package/dist/{layers.B9i3jaXy.js → layers.D6oKUbDE.js} +1 -1
  133. package/dist/{layers.jtSThhXP.js → layers.D8An70uL.js} +1 -1
  134. package/dist/{layers.D5Bmkzi7.js → layers.D8yufb88.js} +1 -1
  135. package/dist/{layers.Dwx_G-uM.js → layers.D9FgdobB.js} +1 -1
  136. package/dist/{layers.B7EDfju3.js → layers.D9OpTLfE.js} +1 -1
  137. package/dist/{layers.BfLRCTr_.js → layers.D9VTCVI3.js} +1 -1
  138. package/dist/{layers.DIpIP-Vy.js → layers.DCMj-1Uf.js} +1 -1
  139. package/dist/{layers.Bi62ky0O.js → layers.DCv5ETXp.js} +1 -1
  140. package/dist/{layers.oIWwbEC6.js → layers.DEKzHuSi.js} +1 -1
  141. package/dist/layers.DF05j1M2.js +17 -0
  142. package/dist/{layers.CB0yKett.js → layers.DFYEVVfs.js} +1 -1
  143. package/dist/{layers.Ci06Jg5Q.js → layers.DFfOmmco.js} +1 -1
  144. package/dist/{layers.DpEgNhvJ.js → layers.DFjAixjy.js} +6 -6
  145. package/dist/{layers.BfatF7Hh.js → layers.DHa8WGDC.js} +1 -1
  146. package/dist/{layers.CyzIJ83u.js → layers.DN0u5Yg6.js} +1 -1
  147. package/dist/{layers.DJEz0fJY.js → layers.DOrY9DYv.js} +24 -24
  148. package/dist/{layers.Dk4MxNnO.js → layers.DPgn17B0.js} +1 -1
  149. package/dist/{layers.DrEFOohr.js → layers.DVpWFLjR.js} +1 -1
  150. package/dist/{layers.7M4dPalp.js → layers.DZT2dQyG.js} +1 -1
  151. package/dist/{layers.DIHJym5q.js → layers.D_H6PF0v.js} +1 -1
  152. package/dist/{layers.CqUy9knK.js → layers.D_YdTiFW.js} +1 -1
  153. package/dist/{layers.BJW0cUVW.js → layers.DbF4xVBE.js} +3 -3
  154. package/dist/{layers.DkBfU7g-.js → layers.Ddribg71.js} +1 -1
  155. package/dist/{layers.znb6JaWQ.js → layers.Dfq7GSQ2.js} +3 -3
  156. package/dist/{layers.DhS8fXO1.js → layers.DhHQZIJN.js} +1 -1
  157. package/dist/layers.DilA0qnM.js +54 -0
  158. package/dist/layers.DjVLYoWg.js +1 -0
  159. package/dist/{layers.CsZAMBb_.js → layers.DkaXOqLh.js} +1 -1
  160. package/dist/{layers.PnPB2nn8.js → layers.DnVwZ2Cw.js} +1 -1
  161. package/dist/{layers.CneI2StO.js → layers.Do_EHOq8.js} +1 -1
  162. package/dist/{layers.CIBowC3x.js → layers.DowbTgQm.js} +1 -1
  163. package/dist/{layers.Dh4wDGq5.js → layers.DpBgVacc.js} +1 -1
  164. package/dist/{layers.BvXPsusn.js → layers.DpQ_bWul.js} +1 -1
  165. package/dist/{layers.hF5ho8rn.js → layers.DqC47xCC.js} +3 -3
  166. package/dist/layers.Drh9XlcG.js +309 -0
  167. package/dist/{layers.BvtO_PCS.js → layers.Du1TNcZd.js} +1 -1
  168. package/dist/{layers.21eP602X.js → layers.DuAvgcNM.js} +1 -1
  169. package/dist/{layers.BiQGJYlX.js → layers.DuE9Eexi.js} +3 -3
  170. package/dist/{layers.BY2JPIgs.js → layers.DvHXCGpY.js} +1 -1
  171. package/dist/{layers.4lM2vICA.js → layers.DvSpirXT.js} +1 -1
  172. package/dist/{layers.CIZONehB.js → layers.Dvto57We.js} +1 -1
  173. package/dist/layers.DxydmUP3.js +533 -0
  174. package/dist/{layers.BJdjhfwW.js → layers.DyTr0iC-.js} +3 -3
  175. package/dist/{layers.B3-3ASbV.js → layers.EDqAD98V.js} +1 -1
  176. package/dist/{layers.DZVHqfks.js → layers.Fdk6MvMH.js} +1 -1
  177. package/dist/{layers.CeWOvOd5.js → layers.Kal-YH7y.js} +1 -1
  178. package/dist/{layers.Dga6kbUR.js → layers.L5G2E32S.js} +5 -5
  179. package/dist/{layers.D0lUHuZS.js → layers.PxPuzt12.js} +1 -1
  180. package/dist/{layers.4nL2QJu6.js → layers.QABnXFIR.js} +1 -1
  181. package/dist/{layers.rQCzuZCk.js → layers.QXq1glLQ.js} +3 -3
  182. package/dist/{layers.sKwo4Pse.js → layers.Rd4Aez_o.js} +1 -1
  183. package/dist/layers.UCGv1oR7.js +46553 -0
  184. package/dist/{layers.FYZb1Qxa.js → layers.UNs4NPL2.js} +1 -1
  185. package/dist/{layers.DSu3h3GW.js → layers.VteHR-nD.js} +2 -2
  186. package/dist/{layers.C7KfPjce.js → layers.WS0tOiF9.js} +1 -1
  187. package/dist/layers.Wc4s15q8.js +500 -0
  188. package/dist/{layers.Drht2cx0.js → layers.YmVu7Jyc.js} +1 -1
  189. package/dist/{layers.BH8Of-0h.js → layers.c1g3UUys.js} +4 -4
  190. package/dist/{layers.CmPS8wik.js → layers.cHiyhRv0.js} +1 -1
  191. package/dist/{layers.BNuDloNS.js → layers.e4WMAP8p.js} +4 -4
  192. package/dist/{layers.NUGtVi9X.js → layers.gkJkfBXX.js} +1 -1
  193. package/dist/{layers.B9zBXz3c.js → layers.iUn6qHX-.js} +1 -1
  194. package/dist/{layers.CoWmapX6.js → layers.jJYSd22J.js} +1 -1
  195. package/dist/{layers.CT9Hxk6p.js → layers.jNpPtSYq.js} +1 -1
  196. package/dist/{layers.CviNHuzh.js → layers.nh-jugfR.js} +1 -1
  197. package/dist/{layers.BcRyWi7P.js → layers.noEAcBug.js} +1 -1
  198. package/dist/{layers.BWCOE2r1.js → layers.o8IUzzuA.js} +4 -4
  199. package/dist/{layers.DH4ld0eM.js → layers.poSPbB9X.js} +4 -4
  200. package/dist/{layers.4c98ipgw.js → layers.qH1Kvygt.js} +3 -3
  201. package/dist/{layers.DWKg8Tij.js → layers.qfL_NxUA.js} +1 -1
  202. package/dist/{layers.BmcaRPr9.js → layers.sxqdU83h.js} +1 -1
  203. package/dist/{layers.BRy_5-TU.js → layers.t-FrNIBD.js} +1 -1
  204. package/dist/{layers.dCqlJwEm.js → layers.uLbLjX8b.js} +1 -1
  205. package/dist/{layers.BYen0VP_.js → layers.wZ8wbCG9.js} +1 -1
  206. package/dist/{layers.CMBnoQyb.js → layers.xI63-j2d.js} +1 -1
  207. package/dist/{layers.Ca70aMup.js → layers.yAPrlce6.js} +1 -1
  208. package/dist/{layers.BwN7ktiY.js → layers.zbHQRaAA.js} +5 -5
  209. package/package.json +192 -166
  210. package/dist/layers.3wlp4P9d.js +0 -215
  211. package/dist/layers.B7J5CFj0.js +0 -1
  212. package/dist/layers.BOHsW04t.js +0 -304
  213. package/dist/layers.Bb4irhn2.js +0 -1
  214. package/dist/layers.BdLFy1LQ.js +0 -32095
  215. package/dist/layers.BwrHLbyv.js +0 -1
  216. package/dist/layers.C6_k8TfY.js +0 -1
  217. package/dist/layers.CnXsot8z.js +0 -1
  218. package/dist/layers.CuAZuCaF.js +0 -6
  219. package/dist/layers.D8ExizU5.js +0 -1
  220. package/dist/layers.DNXYPucT.js +0 -8
  221. package/dist/layers.DR5BxOug.js +0 -295
  222. package/dist/layers.DXn4_Q99.js +0 -276
  223. package/dist/layers.DZEfCyxo.js +0 -76
  224. package/dist/layers.DlSzD9N_.js +0 -271
  225. package/dist/layers.EQZJkcCG.js +0 -1
  226. package/dist/layers.gHJCNsHM.js +0 -300
  227. package/dist/layers.jrsVz6PC.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),T=require("react-dom"),l=require("./layers.BOHsW04t.js"),$=require("@lexical/react/LexicalComposerContext"),R=require("@lexical/react/LexicalErrorBoundary"),H=require("@lexical/react/useLexicalEditable"),g=require("@mantine/core"),b=require("lexical"),F=require("./layers.R8mPlCA0.js");function _({equation:s,inline:a,onDoubleClick:c}){const r=o.useRef(null);return o.useEffect(()=>{const d=r.current;d!==null&&F.default.render(s,d,{displayMode:!a,errorColor:"#cc0000",output:"html",strict:"warn",throwOnError:!1,trust:!1})},[s,a]),n.jsxs(n.Fragment,{children:[n.jsx("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",width:0,height:0,alt:""}),n.jsx("span",{role:"button",tabIndex:-1,onDoubleClick:c,ref:r}),n.jsx("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",width:0,height:0,alt:""})]})}let B=!1;const N=new Map;function U(s){B||(B=!0,s.registerCommand(l.OPEN_EQUATION_POPUP_COMMAND,a=>{const c=N.get(a);return c?(c(),!0):!1},b.COMMAND_PRIORITY_EDITOR))}function z({equation:s,inline:a,nodeKey:c}){const[r]=$.useLexicalComposerContext(),d=H.useLexicalEditable(),p=o.useRef(null),P=o.useRef(null),[A,C]=o.useState(s),[u,f]=o.useState(!1),[v,D]=o.useState({top:0,left:0}),[L,y]=o.useState(!1),h=o.useCallback(()=>{const e=p.current;if(!e)return;const i=(e.closest(".editor-equation")||e).getBoundingClientRect();D({top:i.bottom+18,left:i.left}),y(!0)},[]);o.useEffect(()=>{U(r)},[r]),o.useEffect(()=>{const e=()=>{d&&f(!0)};return N.set(c,e),()=>{N.delete(c)}},[d,c]);const m=o.useCallback(()=>{if(d){if(u){f(!1);return}h(),f(!0)}},[d,u,h]),q=o.useCallback(()=>{const e=A.trim();r.update(()=>{const t=b.$getNodeByKey(c);if(l.$isEquationNode(t)){if(t.isInline&&t.isInline()&&e===""){t.remove();return}t.setEquation(e)}}),f(!1)},[r,c,A]),j=o.useCallback(()=>{if(!s&&a){r.update(()=>{const e=b.$getNodeByKey(c);l.$isEquationNode(e)&&e.remove()}),f(!1);return}C(s),s&&f(!1)},[r,s,a,c]);o.useEffect(()=>{u||C(s)},[s,u]),o.useEffect(()=>{if(!u){y(!1);return}l.blockScroll(),h();const e=window.requestAnimationFrame(()=>{const t=P.current;if(!t)return;const i=t.value.length;t.focus(),t.setSelectionRange(i,i)});return()=>{window.cancelAnimationFrame(e),l.unblockScroll()}},[u,h]),o.useEffect(()=>{if(!u)return;const e=t=>{const i=t.target,E=p.current,I=document.querySelector(".equation-block__popup");i&&(E!=null&&E.contains(i)||I instanceof HTMLElement&&I.contains(i))||(a&&!A.trim()&&r.update(()=>{const w=b.$getNodeByKey(c);l.$isEquationNode(w)&&w.remove()}),f(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r,a,u,c,A]);const x=(u?A:s).trim(),k=x.length>0;o.useEffect(()=>{const e=p.current;if(!e)return;const t=e.closest(".editor-equation"),i=x;if(t){if(!i){t.removeAttribute("data-lexical-equation");return}try{const E=btoa(unescape(encodeURIComponent(i)));t.setAttribute("data-lexical-equation",E)}catch{t.setAttribute("data-lexical-equation",i)}}},[x]);const O=a&&!d?n.jsx("span",{className:"equation-inline-trigger",children:n.jsx(R.LexicalErrorBoundary,{onError:e=>{var t;return(t=r._onError)==null?void 0:t.call(r,e)},children:n.jsx(_,{equation:s,inline:a,onDoubleClick:m})})}):a?n.jsx("span",{className:`equation-inline-trigger${k?"":" equation-inline-trigger--empty"}`,onClick:m,ref:p,children:k?n.jsx(R.LexicalErrorBoundary,{onError:e=>{var t;return(t=r._onError)==null?void 0:t.call(r,e)},children:n.jsx(_,{equation:x,inline:a,onDoubleClick:m})}):n.jsxs("span",{className:"equation-inline-placeholder",children:[n.jsx(l.HugeiconsIcon,{icon:l.$tr,size:24}),n.jsx("span",{children:"New equation"})]})}):n.jsx("div",{className:"equation-block",ref:p,children:n.jsx("div",{className:"equation-block__container",onClick:m,style:{cursor:d?"pointer":"default"},children:k?n.jsx(R.LexicalErrorBoundary,{onError:e=>{var t;return(t=r._onError)==null?void 0:t.call(r,e)},children:n.jsx(_,{equation:x,inline:a,onDoubleClick:m})}):n.jsx("div",{className:"equation-block__placeholder",children:"Add a TeX equation"})})}),S=o.useCallback(e=>{e.stopPropagation(),C(e.currentTarget.value)},[]),M=o.useCallback(l.createPopupKeyDownHandler({onConfirm:q,onCancel:j}),[q,j]);return n.jsxs(n.Fragment,{children:[O,u&&L&&T.createPortal(n.jsx("div",{className:"equation-block__popup",style:{position:"fixed",top:v.top,left:v.left,zIndex:l.EDITOR_UI_MIN_Z_INDEX},children:n.jsxs("div",{className:"equation-block__editor",children:[n.jsx(g.Textarea,{autosize:!0,minRows:2,variant:"unstyled",value:A,onChange:S,onKeyDown:M,placeholder:"x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",classNames:{wrapper:"equation-block__textarea-wrapper"},autoFocus:!0,ref:P}),n.jsxs(g.Group,{justify:"flex-end",gap:"sm",children:[n.jsx(g.Button,{variant:"subtle",color:"gray",onClick:j,children:"Cancel"}),n.jsx(g.Button,{onClick:q,children:"Save"})]})]})}),document.body)]})}exports.default=z;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./layers.CmPS8wik.js");require("./layers.BsqLCh4g.js");exports.Commands=e.CB;exports.subsetToBase64=e.QB;exports.subsetToBinary=e.NQ;exports.toBase64=e.AI;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("react"),p=require("@lexical/react/LexicalComposerContext"),C=require("lexical"),l=require("./layers.BOHsW04t.js"),u=require("./layers.B7J5CFj0.js"),f=C.createCommand("INSERT_EXCALIDRAW_COMMAND");function A(){const[s]=p.useLexicalComposerContext(),[x,n]=t.useState(!1),[e,E]=t.useState(null),r=t.useRef(null),[M,i]=t.useState(!1);t.useEffect(()=>{if(!s.hasNodes([l.ExcalidrawNode]))throw new Error("ExcalidrawPlugin: ExcalidrawNode not registered on editor");return s.registerCommand(f,()=>{n(!0);const a=l.getCurrentElement();return E(a),!0},C.COMMAND_PRIORITY_EDITOR)},[s]);const c=()=>{n(!1),i(!1),r.current=!1},m=()=>{r.current?i(!0):c()},O=()=>{n(!1)},N=(a,S,R,g)=>{s.update(()=>{const d=l.$createExcalidrawNode();d.setData(JSON.stringify({appState:S,elements:a,files:R,previewSVG:g})),e&&e.getParent()&&(e==null||e.replace(d))}),n(!1)};return o.jsxs(o.Fragment,{children:[o.jsx(u.ConfirmModal,{isCloseModal:M,confirmClose:c,setCloseModalOpen:i}),o.jsx(u.ExcalidrawModal,{initialElements:[],initialAppState:{},initialFiles:{},isShown:x,onDelete:O,onClose:m,onSave:N,closeOnClickOutside:!1,isEdited:r})]})}exports.INSERT_EXCALIDRAW_COMMAND=f;exports.default=A;
@@ -1,6 +0,0 @@
1
- import { e as o, j as s, o as f } from "./layers.DfTfRyZ2.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 s=require("react/jsx-runtime"),i=require("react"),B=require("@lexical/react/LexicalComposerContext"),P=require("@lexical/react/useLexicalEditable"),Y=require("@lexical/react/useLexicalNodeSelection"),W=require("@lexical/utils"),a=require("lexical"),c=require("./layers.BOHsW04t.js"),v=require("./layers.B7J5CFj0.js"),F=require("react-i18next"),C=require("@mantine/core"),G=require("@tabler/icons-react");function H({imageContainerRef:n,editor:u,rootClassName:N=null,width:O="inherit",height:h="inherit",nodeKey:e,alignment:E,setModalOpen:d,previewSVG:M}){const j=i.useMemo(()=>M??"",[M]),[f,S]=i.useState(!1),{t:x}=F.useTranslation(),b=(r,m)=>{u.update(()=>{a.$setSelection(null);const g=a.$getNodeByKey(e);return c.$isExcalidrawNode(g)&&g.setWidthAndHeight(r,m),!0})},I=()=>{c.deleteNode(u,e)};return s.jsx(c.ResizableContainer,{editor:u,isIcon:!1,isEmbed:!0,width:c.parseContainerSize(O),height:c.parseContainerSize(h),onResizeEnd:b,alignment:E,children:s.jsxs(C.Box,{className:"media-wrapper excaildraw",children:[s.jsxs("div",{className:"media-actions",children:[s.jsx(C.Tooltip,{label:x("editor.link.edit"),children:s.jsx(C.ActionIcon,{color:"gray","aria-label":"Settings",className:"media-action",variant:"default",size:32,radius:8,onClick:()=>{S(!1),d(!0)},children:s.jsx(G.IconEdit,{size:16})})}),s.jsx(c.AlignmentImage,{opened:f,setOpened:S,t:x,editor:u,nodeKey:e}),s.jsx(C.Tooltip,{label:x("editor.actions.delete"),children:s.jsx(C.ActionIcon,{color:"gray","aria-label":"Settings",className:"media-action",variant:"default",size:32,radius:8,onClick:I,children:s.jsx(c.Icon,{name:"trash",size:"16"})})})]}),s.jsx(C.Box,{w:"100%",ref:r=>{r&&n&&(n.current=r)},className:N??"",dangerouslySetInnerHTML:{__html:j}})]})})}function V({nodeKey:n,data:u,width:N,height:O,alignment:h}){var q;const[e]=B.useLexicalComposerContext(),E=P.useLexicalEditable(),d=i.useMemo(()=>v.parseExcalidrawData(u),[u]),M=((q=d==null?void 0:d.elements)==null?void 0:q.length)===0&&!d.previewSVG,[j,f]=i.useState(M&&e.isEditable()),[S,x]=i.useState(!1),b=i.useRef(null),I=i.useRef(null),r=i.useRef(null),[m,g,R]=Y.useLexicalNodeSelection(n),w=i.useCallback(t=>(m&&(t.preventDefault(),e.update(()=>{const o=a.$getNodeByKey(n);o&&o.remove()})),!1),[e,m,n]);i.useEffect(()=>{if(!E){m&&R();return}return W.mergeRegister(e.registerCommand(a.CLICK_COMMAND,t=>{const o=I.current,p=t.target;return o!==null&&o.contains(p)?(t.shiftKey||R(),g(!m),t.detail>1&&f(!0),!0):!1},a.COMMAND_PRIORITY_LOW),e.registerCommand(a.KEY_DELETE_COMMAND,w,a.COMMAND_PRIORITY_LOW),e.registerCommand(a.KEY_BACKSPACE_COMMAND,w,a.COMMAND_PRIORITY_LOW))},[R,e,m,w,g,E]);const y=i.useCallback(()=>(f(!1),e.update(()=>{const t=a.$getNodeByKey(n);t&&t.remove()})),[e,n]),L=(t,o,p,A)=>e.update(()=>{const D=a.$getNodeByKey(n);c.$isExcalidrawNode(D)&&(t&&t.length>0||Object.keys(p).length>0?D.setData(JSON.stringify({appState:o,elements:t,files:p,previewSVG:A})):D.remove())}),{elements:l=[],files:k={},appState:T={},previewSVG:$}=d,_=i.useCallback(()=>{f(!1),x(!1),r.current=!1,(l==null?void 0:l.length)===0&&e.update(()=>{const t=a.$getNodeByKey(n);t&&t.remove()})},[e,n,l==null?void 0:l.length]),z=i.useCallback(()=>{r.current?x(!0):_()},[]);return s.jsxs(s.Fragment,{children:[s.jsx(v.ConfirmModal,{isCloseModal:S,confirmClose:_,setCloseModalOpen:x}),s.jsx(v.ExcalidrawModal,{initialElements:l,isEdited:r,initialFiles:k,initialAppState:T,isShown:j,onDelete:y,onClose:z,onSave:(t,o,p,A)=>{L(t,o,p,A),f(!1)},closeOnClickOutside:!1}),(l==null?void 0:l.length)&&s.jsx("div",{style:{display:"flex",justifyContent:h},children:s.jsx(H,{imageContainerRef:b,className:"image",width:N,height:O,editor:e,nodeKey:n,alignment:h,setModalOpen:f,previewSVG:$})})]})}exports.default=V;
@@ -1,8 +0,0 @@
1
- import { C as e, Q as t, N as m, A as r } from "./layers.Bq29Ll-w.js";
2
- import "./layers.DfTfRyZ2.js";
3
- export {
4
- e as Commands,
5
- t as subsetToBase64,
6
- m as subsetToBinary,
7
- r as toBase64
8
- };
@@ -1,295 +0,0 @@
1
- import { jsx as u, jsxs as L } from "react/jsx-runtime";
2
- import { useTranslation as D } from "react-i18next";
3
- import { Modal as U, Text as X, Flex as J, Button as R, useMantineColorScheme as Y, Loader as Z } from "@mantine/core";
4
- import { useRef as $, useState as T, useEffect as y, useCallback as j, Suspense as Q, lazy as P } from "react";
5
- import { BottomDrawerWithoutHeader as ee } from "@layers-app/shared";
6
- const ce = ({
7
- isCloseModal: l,
8
- setCloseModalOpen: t,
9
- confirmClose: c
10
- }) => {
11
- const { t: d } = D();
12
- return /* @__PURE__ */ u(
13
- U,
14
- {
15
- opened: l,
16
- onClose: () => {
17
- t(!1);
18
- },
19
- centered: !0,
20
- title: d("editor.unsavedChanges.title"),
21
- closeOnClickOutside: !0,
22
- closeOnEscape: !0,
23
- size: "500",
24
- zIndex: 999,
25
- children: /* @__PURE__ */ L("div", { children: [
26
- /* @__PURE__ */ u(X, { mb: "md", children: d("editor.unsavedChanges.message") }),
27
- /* @__PURE__ */ L(J, { justify: "flex-end", gap: "sm", children: [
28
- /* @__PURE__ */ u(
29
- R,
30
- {
31
- variant: "default",
32
- onClick: () => {
33
- t(!1);
34
- },
35
- fullWidth: !0,
36
- children: d("editor.unsavedChanges.cancel")
37
- }
38
- ),
39
- /* @__PURE__ */ u(R, { color: "red", onClick: c, fullWidth: !0, children: d("editor.unsavedChanges.closeWithoutSaving") })
40
- ] })
41
- ] })
42
- }
43
- );
44
- }, A = {
45
- elements: [],
46
- files: {},
47
- appState: {},
48
- previewSVG: null
49
- }, de = (l) => {
50
- try {
51
- const t = JSON.parse(l);
52
- if (Array.isArray(t))
53
- return { ...A, elements: t };
54
- if (t && typeof t == "object")
55
- return {
56
- elements: Array.isArray(t.elements) ? t.elements : [],
57
- files: t.files && typeof t.files == "object" ? t.files : {},
58
- appState: t.appState && typeof t.appState == "object" ? t.appState : {},
59
- previewSVG: typeof t.previewSVG == "string" ? t.previewSVG : typeof t.previewSvg == "string" ? t.previewSvg : null
60
- };
61
- } catch {
62
- }
63
- return { ...A };
64
- }, te = {
65
- en: "en-US",
66
- ru: "ru-RU",
67
- fr: "fr-FR",
68
- de: "de-DE",
69
- es: "es-ES",
70
- it: "it-IT",
71
- pt: "pt-BR",
72
- zh: "zh-CN",
73
- ja: "ja-JP",
74
- ko: "ko-KR",
75
- ar: "ar-SA",
76
- hi: "hi-IN",
77
- nl: "nl-NL",
78
- tr: "tr-TR",
79
- pl: "pl-PL",
80
- sv: "sv-SE",
81
- cs: "cs-CZ",
82
- uk: "uk-UA",
83
- ro: "ro-RO",
84
- fi: "fi-FI",
85
- da: "da-DK",
86
- no: "no-NO",
87
- el: "el-GR",
88
- he: "he-IL",
89
- th: "th-TH",
90
- id: "id-ID",
91
- ms: "ms-MY",
92
- vi: "vi-VN"
93
- };
94
- let w = null;
95
- const re = /* @__PURE__ */ P(async () => {
96
- var t;
97
- const l = await import("./layers.DfTfRyZ2.js").then((c) => c.M);
98
- return !w && l && (w = l.exportToSvg || ((t = l.default) == null ? void 0 : t.exportToSvg) || l.default), { default: l.Excalidraw };
99
- }), oe = () => {
100
- const [l, t] = T(
101
- null
102
- ), c = j(
103
- (d) => t(d),
104
- []
105
- );
106
- return [l, c];
107
- };
108
- function ue({
109
- onSave: l,
110
- initialElements: t,
111
- initialAppState: c,
112
- initialFiles: d,
113
- isShown: i = !1,
114
- onDelete: B,
115
- onClose: N,
116
- isEdited: W
117
- }) {
118
- const [n, z] = oe(), { i18n: f, t: _ } = D(), { colorScheme: O } = Y(), E = $(!1), [g, G] = T(t), [C, V] = T(d), [F, H] = T(i);
119
- y(() => {
120
- i && H(!0);
121
- }, [i]), y(() => {
122
- !i || E.current || (E.current = !0, Promise.resolve({ }));
123
- }, [i]), y(() => {
124
- i && setTimeout(() => {
125
- var e;
126
- (e = n == null ? void 0 : n.refresh) == null || e.call(n);
127
- }, 500);
128
- }, [i, n]), y(() => {
129
- if (!i)
130
- return;
131
- const e = (r, a) => {
132
- const s = _(r);
133
- return s.startsWith("editor.menu") ? a : s;
134
- }, m = e(
135
- "editor.menu.excalidraw.tools.frameTool",
136
- f.language === "ru" ? "Инструмент рамки" : f.language === "es" ? "Herramienta de marco" : "Frame tool"
137
- ), o = e(
138
- "editor.menu.excalidraw.tools.webEmbed",
139
- f.language === "ru" ? "Веб-встраивание" : f.language === "es" ? "Incrustación web" : "Web Embed"
140
- ), h = e(
141
- "editor.menu.excalidraw.tools.generate",
142
- f.language === "ru" ? "Генерировать" : f.language === "es" ? "Generar" : "Generate"
143
- ), p = {
144
- "Frame tool": m,
145
- "Web Embed": o,
146
- "Web embeded": o,
147
- Generate: h
148
- }, v = () => {
149
- const r = document.querySelector(".App-toolbar__extra-tools-dropdown");
150
- if (!r)
151
- return;
152
- const a = document.createTreeWalker(
153
- r,
154
- NodeFilter.SHOW_TEXT,
155
- null
156
- );
157
- let s;
158
- for (; s = a.nextNode(); )
159
- if (s.nodeType === Node.TEXT_NODE && s.textContent) {
160
- const M = s.textContent.trim();
161
- for (const [S, k] of Object.entries(p))
162
- if (M === S && k && !M.includes(k)) {
163
- s.textContent = s.textContent.replace(S, k);
164
- break;
165
- }
166
- }
167
- }, x = () => {
168
- setTimeout(() => {
169
- v();
170
- }, 0);
171
- }, b = setTimeout(() => {
172
- const r = document.querySelector(
173
- ".excalidraw-container"
174
- );
175
- if (r) {
176
- const a = r.querySelector(
177
- ".App-toolbar__extra-tools-trigger"
178
- );
179
- a && a.addEventListener("click", x);
180
- }
181
- }, 300);
182
- return () => {
183
- clearTimeout(b);
184
- const r = document.querySelector(
185
- ".excalidraw-container"
186
- );
187
- if (r) {
188
- const a = r.querySelector(
189
- ".App-toolbar__extra-tools-trigger"
190
- );
191
- a && a.removeEventListener("click", x);
192
- }
193
- };
194
- }, [i, f.language]);
195
- const q = j(async () => {
196
- var v, x, b;
197
- let e = w;
198
- if (!e || typeof e != "function") {
199
- const r = await import("./layers.DfTfRyZ2.js").then((a) => a.M);
200
- e = r.exportToSvg || ((v = r.default) == null ? void 0 : v.exportToSvg) || r.default, e && typeof e == "function" && (w = e);
201
- }
202
- if (!e || typeof e != "function") {
203
- const r = await import("./layers.DfTfRyZ2.js").then((s) => s.M), a = r ? Object.keys(r) : [];
204
- throw console.error("Excalidraw module structure:", {
205
- keys: a,
206
- hasExportToSvg: r && "exportToSvg" in r,
207
- hasDefault: r && "default" in r,
208
- moduleType: typeof r,
209
- module: r
210
- }), new Error(
211
- `exportToSvg is not available from @excalidraw/excalidraw. Module keys: ${a.join(", ")}. Please ensure @excalidraw/excalidraw is properly installed.`
212
- );
213
- }
214
- const m = ((x = n == null ? void 0 : n.getAppState) == null ? void 0 : x.call(n)) ?? c, o = await e({
215
- appState: m,
216
- elements: g,
217
- files: C
218
- }), h = (b = o == null ? void 0 : o.firstElementChild) == null ? void 0 : b.firstElementChild, p = o.getAttribute("viewBox");
219
- if (p != null) {
220
- const r = p.split(" ");
221
- o.setAttribute("width", r[2]), o.setAttribute("height", r[3]);
222
- }
223
- return h && h.tagName === "style" && h.remove(), o.setAttribute("width", "100%"), o.setAttribute("height", "100%"), o.setAttribute("display", "block"), o.classList.add("excalidraw-svg"), o.outerHTML;
224
- }, [g, C, n, c]), I = () => {
225
- if (g && g.filter((e) => !e.isDeleted).length > 0) {
226
- const e = n == null ? void 0 : n.getAppState(), m = {
227
- exportBackground: e == null ? void 0 : e.exportBackground,
228
- exportScale: e == null ? void 0 : e.exportScale,
229
- exportWithDarkMode: (e == null ? void 0 : e.theme) === "dark",
230
- isBindingEnabled: e == null ? void 0 : e.isBindingEnabled,
231
- isLoading: e == null ? void 0 : e.isLoading,
232
- name: e == null ? void 0 : e.name,
233
- theme: e == null ? void 0 : e.theme,
234
- viewBackgroundColor: e == null ? void 0 : e.viewBackgroundColor,
235
- viewModeEnabled: e == null ? void 0 : e.viewModeEnabled,
236
- zenModeEnabled: e == null ? void 0 : e.zenModeEnabled,
237
- zoom: e == null ? void 0 : e.zoom
238
- };
239
- (async () => {
240
- const o = await q();
241
- l(g, m, C, o);
242
- })();
243
- } else
244
- B();
245
- }, K = (e, m, o) => {
246
- (e == null ? void 0 : e.length) !== (t == null ? void 0 : t.length) && (W.current = !0), G(e), V(o);
247
- };
248
- return /* @__PURE__ */ u(
249
- ee,
250
- {
251
- opened: i,
252
- onClose: N,
253
- onSave: I,
254
- className: "excaildraw-modal",
255
- closeOnEscape: !1,
256
- children: F && /* @__PURE__ */ u(
257
- Q,
258
- {
259
- fallback: /* @__PURE__ */ u(
260
- "div",
261
- {
262
- style: {
263
- display: "flex",
264
- justifyContent: "center",
265
- alignItems: "center",
266
- height: "100%",
267
- minHeight: "400px"
268
- },
269
- children: /* @__PURE__ */ u(Z, { size: "sm" })
270
- }
271
- ),
272
- children: /* @__PURE__ */ u(
273
- re,
274
- {
275
- langCode: te[f.language],
276
- theme: O,
277
- onChange: K,
278
- excalidrawAPI: z,
279
- initialData: {
280
- appState: { ...c || { isLoading: !1 } },
281
- elements: t,
282
- files: d
283
- }
284
- }
285
- )
286
- }
287
- )
288
- }
289
- );
290
- }
291
- export {
292
- ce as C,
293
- ue as E,
294
- de as p
295
- };
@@ -1,276 +0,0 @@
1
- import { jsxs as E, Fragment as T, jsx as r } from "react/jsx-runtime";
2
- import { useRef as w, useEffect as d, useState as C, useCallback as m } from "react";
3
- import { createPortal as z } from "react-dom";
4
- import { i as P, c as G, d as Q, j as X, E as V, H as Y, k as Z, O as J } from "./layers.BdLFy1LQ.js";
5
- import { useLexicalComposerContext as W } from "@lexical/react/LexicalComposerContext";
6
- import { LexicalErrorBoundary as I } from "@lexical/react/LexicalErrorBoundary";
7
- import { useLexicalEditable as K } from "@lexical/react/useLexicalEditable";
8
- import { Textarea as ee, Group as te, Button as M } from "@mantine/core";
9
- import { $getNodeByKey as R, COMMAND_PRIORITY_EDITOR as ne } from "lexical";
10
- import re from "./layers.b9B2NY7n.js";
11
- function v({
12
- equation: o,
13
- inline: a,
14
- onDoubleClick: s
15
- }) {
16
- const n = w(null);
17
- return d(() => {
18
- const l = n.current;
19
- l !== null && re.render(o, l, {
20
- displayMode: !a,
21
- errorColor: "#cc0000",
22
- output: "html",
23
- strict: "warn",
24
- throwOnError: !1,
25
- trust: !1
26
- });
27
- }, [o, a]), /* @__PURE__ */ E(T, { children: [
28
- /* @__PURE__ */ r(
29
- "img",
30
- {
31
- src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
32
- width: 0,
33
- height: 0,
34
- alt: ""
35
- }
36
- ),
37
- /* @__PURE__ */ r(
38
- "span",
39
- {
40
- role: "button",
41
- tabIndex: -1,
42
- onDoubleClick: s,
43
- ref: n
44
- }
45
- ),
46
- /* @__PURE__ */ r(
47
- "img",
48
- {
49
- src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
50
- width: 0,
51
- height: 0,
52
- alt: ""
53
- }
54
- )
55
- ] });
56
- }
57
- let S = !1;
58
- const N = /* @__PURE__ */ new Map();
59
- function oe(o) {
60
- S || (S = !0, o.registerCommand(
61
- J,
62
- (a) => {
63
- const s = N.get(a);
64
- return s ? (s(), !0) : !1;
65
- },
66
- ne
67
- ));
68
- }
69
- function Ae({
70
- equation: o,
71
- inline: a,
72
- nodeKey: s
73
- }) {
74
- const [n] = W(), l = K(), p = w(null), D = w(null), [f, _] = C(o), [c, u] = C(!1), [O, H] = C({ top: 0, left: 0 }), [j, B] = C(!1), b = m(() => {
75
- const e = p.current;
76
- if (!e) return;
77
- const i = (e.closest(
78
- ".editor-equation"
79
- ) || e).getBoundingClientRect();
80
- H({
81
- top: i.bottom + 18,
82
- left: i.left
83
- }), B(!0);
84
- }, []);
85
- d(() => {
86
- oe(n);
87
- }, [n]), d(() => {
88
- const e = () => {
89
- l && u(!0);
90
- };
91
- return N.set(s, e), () => {
92
- N.delete(s);
93
- };
94
- }, [l, s]);
95
- const A = m(() => {
96
- if (l) {
97
- if (c) {
98
- u(!1);
99
- return;
100
- }
101
- b(), u(!0);
102
- }
103
- }, [l, c, b]), x = m(() => {
104
- const e = f.trim();
105
- n.update(() => {
106
- const t = R(s);
107
- if (P(t)) {
108
- if (t.isInline && t.isInline() && e === "") {
109
- t.remove();
110
- return;
111
- }
112
- t.setEquation(e);
113
- }
114
- }), u(!1);
115
- }, [n, s, f]), k = m(() => {
116
- if (!o && a) {
117
- n.update(() => {
118
- const e = R(s);
119
- P(e) && e.remove();
120
- }), u(!1);
121
- return;
122
- }
123
- _(o), o && u(!1);
124
- }, [n, o, a, s]);
125
- d(() => {
126
- c || _(o);
127
- }, [o, c]), d(() => {
128
- if (!c) {
129
- B(!1);
130
- return;
131
- }
132
- G(), b();
133
- const e = window.requestAnimationFrame(() => {
134
- const t = D.current;
135
- if (!t) return;
136
- const i = t.value.length;
137
- t.focus(), t.setSelectionRange(i, i);
138
- });
139
- return () => {
140
- window.cancelAnimationFrame(e), Q();
141
- };
142
- }, [c, b]), d(() => {
143
- if (!c) return;
144
- const e = (t) => {
145
- const i = t.target, g = p.current, y = document.querySelector(".equation-block__popup");
146
- i && (g != null && g.contains(i) || y instanceof HTMLElement && y.contains(i)) || (a && !f.trim() && n.update(() => {
147
- const L = R(s);
148
- P(L) && L.remove();
149
- }), u(!1));
150
- };
151
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
152
- }, [n, a, c, s, f]);
153
- const h = (c ? f : o).trim(), q = h.length > 0;
154
- d(() => {
155
- const e = p.current;
156
- if (!e) return;
157
- const t = e.closest(".editor-equation"), i = h;
158
- if (t) {
159
- if (!i) {
160
- t.removeAttribute("data-lexical-equation");
161
- return;
162
- }
163
- try {
164
- const g = btoa(unescape(encodeURIComponent(i)));
165
- t.setAttribute("data-lexical-equation", g);
166
- } catch {
167
- t.setAttribute("data-lexical-equation", i);
168
- }
169
- }
170
- }, [h]);
171
- const F = a && !l ? /* @__PURE__ */ r("span", { className: "equation-inline-trigger", children: /* @__PURE__ */ r(I, { onError: (e) => {
172
- var t;
173
- return (t = n._onError) == null ? void 0 : t.call(n, e);
174
- }, children: /* @__PURE__ */ r(
175
- v,
176
- {
177
- equation: o,
178
- inline: a,
179
- onDoubleClick: A
180
- }
181
- ) }) }) : a ? /* @__PURE__ */ r(
182
- "span",
183
- {
184
- className: `equation-inline-trigger${q ? "" : " equation-inline-trigger--empty"}`,
185
- onClick: A,
186
- ref: p,
187
- children: q ? /* @__PURE__ */ r(I, { onError: (e) => {
188
- var t;
189
- return (t = n._onError) == null ? void 0 : t.call(n, e);
190
- }, children: /* @__PURE__ */ r(
191
- v,
192
- {
193
- equation: h,
194
- inline: a,
195
- onDoubleClick: A
196
- }
197
- ) }) : /* @__PURE__ */ E("span", { className: "equation-inline-placeholder", children: [
198
- /* @__PURE__ */ r(Y, { icon: Z, size: 24 }),
199
- /* @__PURE__ */ r("span", { children: "New equation" })
200
- ] })
201
- }
202
- ) : /* @__PURE__ */ r("div", { className: "equation-block", ref: p, children: /* @__PURE__ */ r(
203
- "div",
204
- {
205
- className: "equation-block__container",
206
- onClick: A,
207
- style: { cursor: l ? "pointer" : "default" },
208
- children: q ? /* @__PURE__ */ r(I, { onError: (e) => {
209
- var t;
210
- return (t = n._onError) == null ? void 0 : t.call(n, e);
211
- }, children: /* @__PURE__ */ r(
212
- v,
213
- {
214
- equation: h,
215
- inline: a,
216
- onDoubleClick: A
217
- }
218
- ) }) : /* @__PURE__ */ r("div", { className: "equation-block__placeholder", children: "Add a TeX equation" })
219
- }
220
- ) }), U = m(
221
- (e) => {
222
- e.stopPropagation(), _(e.currentTarget.value);
223
- },
224
- []
225
- ), $ = m(
226
- X({
227
- onConfirm: x,
228
- onCancel: k
229
- }),
230
- [x, k]
231
- );
232
- return /* @__PURE__ */ E(T, { children: [
233
- F,
234
- c && j && z(
235
- /* @__PURE__ */ r(
236
- "div",
237
- {
238
- className: "equation-block__popup",
239
- style: {
240
- position: "fixed",
241
- top: O.top,
242
- left: O.left,
243
- zIndex: V
244
- },
245
- children: /* @__PURE__ */ E("div", { className: "equation-block__editor", children: [
246
- /* @__PURE__ */ r(
247
- ee,
248
- {
249
- autosize: !0,
250
- minRows: 2,
251
- variant: "unstyled",
252
- value: f,
253
- onChange: U,
254
- onKeyDown: $,
255
- placeholder: "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",
256
- classNames: {
257
- wrapper: "equation-block__textarea-wrapper"
258
- },
259
- autoFocus: !0,
260
- ref: D
261
- }
262
- ),
263
- /* @__PURE__ */ E(te, { justify: "flex-end", gap: "sm", children: [
264
- /* @__PURE__ */ r(M, { variant: "subtle", color: "gray", onClick: k, children: "Cancel" }),
265
- /* @__PURE__ */ r(M, { onClick: x, children: "Save" })
266
- ] })
267
- ] })
268
- }
269
- ),
270
- document.body
271
- )
272
- ] });
273
- }
274
- export {
275
- Ae as default
276
- };
@@ -1,76 +0,0 @@
1
- import { jsxs as p, Fragment as M, jsx as c } from "react/jsx-runtime";
2
- import { useState as n, useRef as x, useEffect as O } from "react";
3
- import { useLexicalComposerContext as N } from "@lexical/react/LexicalComposerContext";
4
- import { createCommand as g, COMMAND_PRIORITY_EDITOR as w } from "lexical";
5
- import { f as D, g as S, h as A } from "./layers.BdLFy1LQ.js";
6
- import { C as R, E as I } from "./layers.DR5BxOug.js";
7
- const h = g(
8
- "INSERT_EXCALIDRAW_COMMAND"
9
- );
10
- function k() {
11
- const [o] = N(), [d, t] = n(!1), [e, f] = n(
12
- null
13
- ), s = x(null), [m, a] = n(!1);
14
- O(() => {
15
- if (!o.hasNodes([D]))
16
- throw new Error(
17
- "ExcalidrawPlugin: ExcalidrawNode not registered on editor"
18
- );
19
- return o.registerCommand(
20
- h,
21
- () => {
22
- t(!0);
23
- const r = S();
24
- return f(r), !0;
25
- },
26
- w
27
- );
28
- }, [o]);
29
- const l = () => {
30
- t(!1), a(!1), s.current = !1;
31
- };
32
- return /* @__PURE__ */ p(M, { children: [
33
- /* @__PURE__ */ c(
34
- R,
35
- {
36
- isCloseModal: m,
37
- confirmClose: l,
38
- setCloseModalOpen: a
39
- }
40
- ),
41
- /* @__PURE__ */ c(
42
- I,
43
- {
44
- initialElements: [],
45
- initialAppState: {},
46
- initialFiles: {},
47
- isShown: d,
48
- onDelete: () => {
49
- t(!1);
50
- },
51
- onClose: () => {
52
- s.current ? a(!0) : l();
53
- },
54
- onSave: (r, u, C, E) => {
55
- o.update(() => {
56
- const i = A();
57
- i.setData(
58
- JSON.stringify({
59
- appState: u,
60
- elements: r,
61
- files: C,
62
- previewSVG: E
63
- })
64
- ), e && e.getParent() && (e == null || e.replace(i));
65
- }), t(!1);
66
- },
67
- closeOnClickOutside: !1,
68
- isEdited: s
69
- }
70
- )
71
- ] });
72
- }
73
- export {
74
- h as INSERT_EXCALIDRAW_COMMAND,
75
- k as default
76
- };