reactjs-tiptap-editor 1.0.10 → 1.0.12

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 (209) hide show
  1. package/lib/{ActionMenuButton-CKTxYtl7.js → ActionMenuButton-BKqin6Kz.js} +17 -13
  2. package/lib/ActionMenuButton-CPPHERbq.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +24 -21
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +7 -5
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +11 -9
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +14 -12
  11. package/lib/Clear.cjs +1 -1
  12. package/lib/Clear.js +3 -3
  13. package/lib/Code.cjs +1 -1
  14. package/lib/Code.js +11 -9
  15. package/lib/CodeBlock.cjs +22 -22
  16. package/lib/CodeBlock.js +102 -100
  17. package/lib/CodeView.cjs +1 -1
  18. package/lib/CodeView.js +10 -8
  19. package/lib/Color.cjs +1 -1
  20. package/lib/Color.js +20 -18
  21. package/lib/Column.cjs +1 -1
  22. package/lib/Column.js +7 -5
  23. package/lib/{Drawer-Cfx115up.js → Drawer-DUPsBE0H.js} +10 -9
  24. package/lib/Drawer-fplzqNI6.cjs +1 -0
  25. package/lib/Drawer.cjs +1 -1
  26. package/lib/Drawer.js +3 -3
  27. package/lib/Emoji.cjs +1 -1
  28. package/lib/Emoji.js +11 -9
  29. package/lib/{Excalidraw-CO93Tsmb.js → Excalidraw-BEzpvRLx.js} +20 -19
  30. package/lib/Excalidraw-qjnQspLq.cjs +1 -0
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +2 -2
  33. package/lib/ExportPdf.cjs +2 -2
  34. package/lib/ExportPdf.js +7 -5
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +7 -5
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +9 -8
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +13 -12
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +25 -24
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +9 -7
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +18 -15
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +7 -5
  49. package/lib/Icon-CiR8RqdQ.cjs +1 -0
  50. package/lib/Icon-ONE1AwKo.js +12 -0
  51. package/lib/{Iframe-DwhclppJ.js → Iframe-CBTnv2mk.js} +41 -39
  52. package/lib/Iframe-DsUNJ2n2.cjs +1 -0
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +2 -2
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +25 -23
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +53 -51
  59. package/lib/ImportWord.cjs +31 -31
  60. package/lib/ImportWord.js +8 -6
  61. package/lib/{Indent-BOsymiZ7.js → Indent-B00o0P0M.js} +26 -24
  62. package/lib/Indent-CaGP0qTp.cjs +1 -0
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +12 -10
  67. package/lib/Katex-XsfpKgJU.cjs +4 -0
  68. package/lib/{Katex-BYK-b9X2.js → Katex-x370CSXZ.js} +12 -10
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +2 -2
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +10 -8
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/{LinkEditBlock-DgrLUMsJ.js → LinkEditBlock-C_ipl3EA.js} +23 -21
  76. package/lib/{LinkEditBlock-4-iRXH7m.cjs → LinkEditBlock-xt88G5fb.cjs} +2 -2
  77. package/lib/Mention.cjs +1 -1
  78. package/lib/Mention.js +3 -3
  79. package/lib/Mermaid.cjs +2 -2
  80. package/lib/Mermaid.js +18 -17
  81. package/lib/MoreMark.cjs +1 -1
  82. package/lib/MoreMark.js +25 -22
  83. package/lib/OrderedList.cjs +1 -1
  84. package/lib/OrderedList.js +10 -8
  85. package/lib/SearchAndReplace.cjs +1 -1
  86. package/lib/SearchAndReplace.js +43 -41
  87. package/lib/SlashCommand.cjs +1 -1
  88. package/lib/SlashCommand.js +6 -6
  89. package/lib/SlashCommandNodeView-BT5ystah.cjs +1 -0
  90. package/lib/{SlashCommandNodeView-BpNNU7Sm.js → SlashCommandNodeView-DX6axvLs.js} +75 -66
  91. package/lib/Strike.cjs +1 -1
  92. package/lib/Strike.js +7 -5
  93. package/lib/Table-DSRSwtXx.cjs +9 -0
  94. package/lib/{Table-CT9R9Sdq.js → Table-DidusYID.js} +10 -8
  95. package/lib/Table.cjs +1 -1
  96. package/lib/Table.js +1 -1
  97. package/lib/TaskList.cjs +1 -1
  98. package/lib/TaskList.js +15 -13
  99. package/lib/TextAlign.cjs +1 -1
  100. package/lib/TextAlign.js +20 -17
  101. package/lib/TextDirection.cjs +1 -1
  102. package/lib/TextDirection.js +20 -17
  103. package/lib/TextUnderline.cjs +1 -1
  104. package/lib/TextUnderline.js +7 -5
  105. package/lib/Twitter-CBuVBQM1.cjs +1 -0
  106. package/lib/{Twitter-mowilxRd.js → Twitter-D58T0Zt3.js} +51 -49
  107. package/lib/Twitter.cjs +1 -1
  108. package/lib/Twitter.js +2 -2
  109. package/lib/Video.cjs +1 -1
  110. package/lib/Video.js +13 -11
  111. package/lib/bubble.cjs +4 -4
  112. package/lib/bubble.js +403 -407
  113. package/lib/{button-CBO-WDXK.js → button-9_8t7ca7.js} +4 -3
  114. package/lib/button-Cs9TroWr.cjs +1 -0
  115. package/lib/{checkbox-DUcLSGZD.cjs → checkbox-BQRKTXXr.cjs} +1 -1
  116. package/lib/{checkbox-D1h32VWM.js → checkbox-DnkkV6qo.js} +1 -1
  117. package/lib/{index-BBNITgNi.cjs → clsx-CXbNJWDD.cjs} +13 -13
  118. package/lib/{index-sVScpCFG.js → clsx-DmuN0U_8.js} +228 -228
  119. package/lib/{dialog-DY868Uji.cjs → dialog-BS3zm-T9.cjs} +1 -1
  120. package/lib/{dialog-DSvgtlDI.js → dialog-DhayAPvV.js} +1 -1
  121. package/lib/{dropdown-menu-BripAeGB.cjs → dropdown-menu-CxwWX0yj.cjs} +1 -1
  122. package/lib/{dropdown-menu-B88Qn2KR.js → dropdown-menu-DQqKeZcx.js} +1 -1
  123. package/lib/events.constant-Dq21NPdV.cjs +1 -0
  124. package/lib/events.constant-do95b767.js +21 -0
  125. package/lib/{index-CApXPpjF.cjs → index-BCzvbrf5.cjs} +1 -1
  126. package/lib/{index-0OnGZkVF.js → index-BDX1uE62.js} +78 -312
  127. package/lib/index-CBFmXCcU.cjs +1 -0
  128. package/lib/{index-DmPwbBqm.js → index-CKmT9KAQ.js} +1 -1
  129. package/lib/index-CVFzP1Dc.cjs +1 -0
  130. package/lib/index-CX4pNJlH.cjs +1 -0
  131. package/lib/index-CjhjjJsN.cjs +1 -0
  132. package/lib/index-Cs6cp0Y6.cjs +1 -0
  133. package/lib/{index-9A6-kVBM.js → index-D1jd7elj.js} +1 -1
  134. package/lib/{index-BIqaogQg.js → index-D9JOHlso.js} +449 -1216
  135. package/lib/{index-DRHrDScg.js → index-DdEmgiAA.js} +1 -1
  136. package/lib/{index-DKt5wfAc.js → index-DvvwJvau.js} +23 -23
  137. package/lib/index-EAK64CCA.js +425 -0
  138. package/lib/{index--nUS7Y66.cjs → index-neeeY2o7.cjs} +3 -3
  139. package/lib/index.cjs +9 -2
  140. package/lib/index.js +142 -26
  141. package/lib/{input-BeD5GdMv.cjs → input-BJ7ihMq-.cjs} +1 -1
  142. package/lib/{input-Bx4uo4gO.js → input-YoheBL2D.js} +1 -1
  143. package/lib/{isNumber-Bv1Qhmw8.cjs → isNumber-BTYSVlKo.cjs} +1 -1
  144. package/lib/{isNumber-DF0fU3ob.js → isNumber-DmQXlKp3.js} +1 -1
  145. package/lib/label-C8PLcjFI.js +19 -0
  146. package/lib/label-Y7_hvqf2.cjs +1 -0
  147. package/lib/locale-bundle.cjs +1 -1
  148. package/lib/locale-bundle.js +6 -7
  149. package/lib/locales/index.d.ts +3 -4316
  150. package/lib/{popover-Csk538NC.cjs → popover-BiSrlM4j.cjs} +1 -1
  151. package/lib/{popover-BVX8otO9.js → popover-CWmTzHSy.js} +1 -1
  152. package/lib/react-BEoMZB61.cjs +1 -0
  153. package/lib/react-c9FSfB30.js +27 -0
  154. package/lib/separator-C-DKMYmg.js +329 -0
  155. package/lib/separator-CJ_adziN.cjs +1 -0
  156. package/lib/store/EditorEditableReactive.d.ts +1 -0
  157. package/lib/store/ThemeColorReactive.d.ts +1 -0
  158. package/lib/store/commandList.d.ts +1 -1
  159. package/lib/store/store.d.ts +6 -7
  160. package/lib/store-BKMaw1AW.cjs +1 -0
  161. package/lib/store-DG7cMfET.js +10 -0
  162. package/lib/style.css +1 -1
  163. package/lib/{tabs-DOasUMDU.cjs → tabs-DpHSMyF_.cjs} +1 -1
  164. package/lib/{tabs-BKpr0QQB.js → tabs-DxlKKM-N.js} +1 -1
  165. package/lib/{textarea-Ba9OOzba.js → textarea-D7m-apUh.js} +1 -1
  166. package/lib/{textarea-D9egO4qC.cjs → textarea-DU9RMi6u.cjs} +1 -1
  167. package/lib/theme/theme.d.ts +5 -0
  168. package/lib/theme.cjs +1 -1
  169. package/lib/theme.js +37 -8
  170. package/lib/{throttle-DsowOft0.js → throttle-BRtichEP.js} +1 -1
  171. package/lib/throttle-gTTvqDTW.cjs +1 -0
  172. package/lib/toggle-BYvLnjCL.cjs +1 -0
  173. package/lib/toggle-Bxwwb_Kp.js +99 -0
  174. package/lib/tooltip-BTy5CRrN.js +24 -0
  175. package/lib/tooltip-COvf4_R-.cjs +1 -0
  176. package/lib/{updatePosition-Bbd8ETMv.js → updatePosition-CUukgu-Q.js} +2 -2
  177. package/lib/updatePosition-Cjuj2E26.cjs +1 -0
  178. package/lib/{useButtonProps-C_bqxmHi.js → useButtonProps-CfYtuEnd.js} +48 -36
  179. package/lib/useButtonProps-CydzndG1.cjs +1 -0
  180. package/lib/utils/customEvents/events.constant.d.ts +0 -5
  181. package/package.json +3 -3
  182. package/lib/ActionMenuButton-BPdRqzDX.cjs +0 -1
  183. package/lib/Drawer-hHj4Opkg.cjs +0 -1
  184. package/lib/Excalidraw-8pWJ17Ye.cjs +0 -1
  185. package/lib/Icon-D7GJZzoa.js +0 -10
  186. package/lib/Icon-gtc3g-VK.cjs +0 -1
  187. package/lib/Iframe-BmXO2c65.cjs +0 -1
  188. package/lib/Indent-DPkMWfcv.cjs +0 -1
  189. package/lib/Katex-B1XbT8-X.cjs +0 -4
  190. package/lib/SlashCommandNodeView-CQvMTXys.cjs +0 -1
  191. package/lib/Table-LnWGm2m8.cjs +0 -9
  192. package/lib/Twitter-Bo4JkBTL.cjs +0 -1
  193. package/lib/button-wt49IYwP.cjs +0 -1
  194. package/lib/events.constant-DQYeJpu5.cjs +0 -1
  195. package/lib/events.constant-wrlJ_7JZ.js +0 -26
  196. package/lib/index-BZ6DfR2r.cjs +0 -1
  197. package/lib/index-BvIJKpX1.cjs +0 -8
  198. package/lib/index-Cv9Z6dyV.cjs +0 -1
  199. package/lib/index-FSRjMsxW.cjs +0 -1
  200. package/lib/label--161UPH6.cjs +0 -1
  201. package/lib/label-uKG7RzFU.js +0 -18
  202. package/lib/separator-DLRVddHS.cjs +0 -1
  203. package/lib/separator-DtrEdjAF.js +0 -241
  204. package/lib/store/ProviderUniqueId.d.ts +0 -6
  205. package/lib/store-B8IkVz1J.cjs +0 -1
  206. package/lib/store-CsIFDUKR.js +0 -10
  207. package/lib/throttle-BM3Bmbf_.cjs +0 -1
  208. package/lib/updatePosition-M2IyqkI1.cjs +0 -1
  209. package/lib/useButtonProps-DEtmDVPr.cjs +0 -1
package/lib/Image.js CHANGED
@@ -1,23 +1,25 @@
1
- import { q as he, m as fe, u as ge } from "./index-sVScpCFG.js";
2
- import { a as q, c as pe } from "./throttle-DsowOft0.js";
1
+ import { o as he, m as fe, s as ge } from "./clsx-DmuN0U_8.js";
2
+ import { a as q, c as pe } from "./throttle-BRtichEP.js";
3
3
  import { jsx as o, jsxs as b, Fragment as H } from "react/jsx-runtime";
4
4
  import j, { useState as L, useMemo as P, useCallback as F, useEffect as W, useRef as ae } from "react";
5
- import { I as Z, j as J, k as be, u as ne } from "./index-0OnGZkVF.js";
6
- import { i as K, c as xe } from "./isNumber-DF0fU3ob.js";
7
- import { A as ye } from "./index-BIqaogQg.js";
8
- import { B } from "./button-CBO-WDXK.js";
9
- import { I as Q } from "./input-Bx4uo4gO.js";
10
- import { L as ee } from "./label-uKG7RzFU.js";
11
- import { T as we, a as Ie, b as te, c as ie } from "./tabs-BKpr0QQB.js";
5
+ import { I as Z, i as J, j as be, u as ne } from "./index-BDX1uE62.js";
6
+ import { i as K, c as xe } from "./isNumber-DmQXlKp3.js";
7
+ import { A as ye } from "./toggle-Bxwwb_Kp.js";
8
+ import "./index-D9JOHlso.js";
9
+ import "./theme.js";
10
+ import { B } from "./button-9_8t7ca7.js";
11
+ import { I as Q } from "./input-YoheBL2D.js";
12
+ import { L as ee } from "./label-C8PLcjFI.js";
13
+ import { T as we, a as Ie, b as te, c as ie } from "./tabs-DxlKKM-N.js";
12
14
  import { u as re } from "./use-toast-Crf7-q5H.js";
13
- import { C as ve } from "./checkbox-D1h32VWM.js";
14
- import { D as le, a as oe, b as se, c as ce, d as Te } from "./dialog-DSvgtlDI.js";
15
+ import { C as ve } from "./checkbox-DnkkV6qo.js";
16
+ import { D as le, a as oe, b as se, c as ce, d as Te } from "./dialog-DhayAPvV.js";
15
17
  import Ae from "react-image-crop";
16
- import { d as Ce, r as Ee } from "./file-BLas99n7.js";
17
- import { d as de, c as Me, u as Le, a as Ne } from "./useButtonProps-C_bqxmHi.js";
18
- import { I as $ } from "./Icon-D7GJZzoa.js";
19
- import { a as Se } from "./store-CsIFDUKR.js";
20
- import { l as _e, E as ze } from "./events.constant-wrlJ_7JZ.js";
18
+ import { d as de, c as Ce, u as Ee, a as Me } from "./useButtonProps-CfYtuEnd.js";
19
+ import { d as Le, r as Ne } from "./file-BLas99n7.js";
20
+ import { I as $ } from "./Icon-ONE1AwKo.js";
21
+ import { a as Se } from "./store-DG7cMfET.js";
22
+ import { l as _e, E as ze } from "./events.constant-do95b767.js";
21
23
  const X = {
22
24
  TOP_LEFT: "tl",
23
25
  TOP_RIGHT: "tr",
@@ -262,14 +264,14 @@ function Ue({ editor: e, imageInline: t, onClose: a, disabled: s, alt: f }) {
262
264
  if (!x) {
263
265
  C(!0);
264
266
  try {
265
- const r = Ce(k, ((i = E == null ? void 0 : E.file) == null ? void 0 : i.name) || "image.png");
267
+ const r = Le(k, ((i = E == null ? void 0 : E.file) == null ? void 0 : i.name) || "image.png");
266
268
  let h = "";
267
269
  p.upload ? h = await p.upload(r) : h = URL.createObjectURL(r), e.chain().focus().setImageInline({ src: h, inline: t, alt: f }).run(), m(!1), z({
268
270
  src: "",
269
271
  file: null
270
272
  }), N(), a();
271
273
  } catch (r) {
272
- console.log("Error cropping image", r);
274
+ console.error("Error cropping image", r);
273
275
  } finally {
274
276
  C(!1);
275
277
  }
@@ -297,7 +299,7 @@ function Ue({ editor: e, imageInline: t, onClose: a, disabled: s, alt: f }) {
297
299
  i.target.value = "";
298
300
  return;
299
301
  }
300
- const l = h[0], w = await Ee(l);
302
+ const l = h[0], w = await Ne(l);
301
303
  m(!0), z({
302
304
  src: w.src,
303
305
  file: l
@@ -412,11 +414,11 @@ function Ue({ editor: e, imageInline: t, onClose: a, disabled: s, alt: f }) {
412
414
  )
413
415
  ] });
414
416
  }
415
- function nt() {
416
- const { t: e } = ne(), { toast: t } = re(), a = Me(), s = Le(G.name), {
417
+ function lt() {
418
+ const { t: e } = ne(), { toast: t } = re(), a = Ce(), s = Ee(G.name), {
417
419
  icon: f,
418
420
  tooltip: u
419
- } = (s == null ? void 0 : s.componentProps) ?? {}, { editorDisabled: g } = Ne(), [v, m] = L(!1), [x, C] = L(!1), T = de(G.name), _ = (d) => {
421
+ } = (s == null ? void 0 : s.componentProps) ?? {}, { editorDisabled: g } = Me(), [v, m] = L(!1), [x, C] = L(!1), T = de(G.name), _ = (d) => {
420
422
  m(d.detail);
421
423
  }, [S, k] = L(""), [R, M] = L(""), E = ae(null), z = (T == null ? void 0 : T.options.defaultInline) || !1, [A, p] = L(z), c = P(() => T == null ? void 0 : T.options, [T]);
422
424
  W(() => {
@@ -824,5 +826,5 @@ const De = {
824
826
  });
825
827
  export {
826
828
  G as Image,
827
- nt as RichTextImage
829
+ lt as RichTextImage
828
830
  };
package/lib/ImageGif.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("./index-BBNITgNi.cjs"),N=require("./throttle-BM3Bmbf_.cjs"),l=require("react/jsx-runtime"),u=require("react"),G=require("./index-FSRjMsxW.cjs"),L=require("./isNumber-Bv1Qhmw8.cjs"),W=require("./index-BvIJKpX1.cjs"),D=require("./input-BeD5GdMv.cjs"),P=require("./popover-Csk538NC.cjs"),k=require("./useButtonProps-DEtmDVPr.cjs"),S={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function B(e){var C,q;const[t,r]=u.useState({width:G.IMAGE_MAX_SIZE,height:G.IMAGE_MAX_SIZE}),[c,i]=u.useState({width:0,height:0}),[n]=u.useState([S.TOP_LEFT,S.TOP_RIGHT,S.BOTTOM_LEFT,S.BOTTOM_RIGHT]),[s,a]=u.useState(!1),[h,b]=u.useState({x:0,y:0,w:0,h:0,dir:""}),{align:x}=(C=e==null?void 0:e.node)==null?void 0:C.attrs,m=u.useMemo(()=>{var v;const{src:o,alt:f,width:w,height:M}=(v=e==null?void 0:e.node)==null?void 0:v.attrs,A=L.isNumber(w)?`${w}px`:w,d=L.isNumber(M)?`${M}px`:M;return{src:o||void 0,alt:f||void 0,style:{width:A||void 0,height:d||void 0}}},[(q=e==null?void 0:e.node)==null?void 0:q.attrs]),T=u.useMemo(()=>{const{style:{width:o}}=m;return{width:o==="100%"?o:void 0}},[m]);function g(o){i({width:o.target.width,height:o.target.height})}function _(){const{editor:o,getPos:f}=e;o.commands.setNodeSelection(f())}const y=u.useCallback(N.throttle(()=>{const{editor:o}=e,{width:f}=getComputedStyle(o.view.dom);r(w=>({...w,width:Number.parseInt(f,10)}))},G.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function p(o,f){o.preventDefault(),o.stopPropagation();const w=c.width,M=c.height,A=w/M;let d=Number(e.node.attrs.width),v=Number(e.node.attrs.height);const I=t.width;d&&!v?(d=d>I?I:d,v=Math.round(d/A)):v&&!d?(d=Math.round(v*A),d=d>I?I:d):!d&&!v?(d=w>I?I:w,v=Math.round(d/A)):d=d>I?I:d,a(!0),b({x:o.clientX,y:o.clientY,w:d,h:v,dir:f})}const j=u.useCallback(N.throttle(o=>{if(o.preventDefault(),o.stopPropagation(),!s)return;const{x:f,w,dir:M}=h,A=(o.clientX-f)*(/l/.test(M)?-1:1),d=L.clamp(w+A,G.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:d,height:null})},G.IMAGE_THROTTLE_WAIT_TIME),[s,h,t,e.updateAttributes]),E=u.useCallback(o=>{o.preventDefault(),o.stopPropagation(),s&&(b({x:0,y:0,w:0,h:0,dir:""}),a(!1),_())},[s,_]),z=u.useCallback(()=>{document==null||document.addEventListener("mousemove",j,!0),document==null||document.addEventListener("mouseup",E,!0)},[j,E]),O=u.useCallback(()=>{document==null||document.removeEventListener("mousemove",j,!0),document==null||document.removeEventListener("mouseup",E,!0)},[j,E]);u.useEffect(()=>(s?z():O(),()=>{O()}),[s,z,O]);const R=u.useMemo(()=>new ResizeObserver(()=>y()),[y]);return u.useEffect(()=>(R.observe(e.editor.view.dom),()=>{R.disconnect()}),[e.editor.view.dom,R]),l.jsx($.NodeViewWrapper,{className:"image-view",style:{...T,width:"100%",textAlign:x},children:l.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:T,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[l.jsx("img",{alt:m.alt,className:"image-view__body__image block",height:"auto",onClick:_,onLoad:g,src:m.src,style:m.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&l.jsx("div",{className:"image-resizer",children:n==null?void 0:n.map(o=>l.jsx("span",{className:`image-resizer__handler image-resizer__handler--${o}`,onMouseDown:f=>p(f,o)},`image-dir-${o}`))})]})})}async function F(e){var c;const r=await(await fetch(`https://api.giphy.com/v1/gifs/trending?q=&limit=15&api_key=${e}`)).json();return(c=r==null?void 0:r.data)==null?void 0:c.map(i=>{var n,s,a;return{id:i==null?void 0:i.id,src:(n=i==null?void 0:i.images.original)==null?void 0:n.url,width:+((s=i==null?void 0:i.images.original)==null?void 0:s.width),height:+((a=i==null?void 0:i.images.original)==null?void 0:a.width)}})}async function V(e,t){var i;const c=await(await fetch(`https://api.giphy.com/v1/gifs/search?q=${e}&limit=15&api_key=${t}`)).json();return(i=c==null?void 0:c.data)==null?void 0:i.map(n=>{var s,a,h;return{id:n==null?void 0:n.id,src:(s=n==null?void 0:n.images.original)==null?void 0:s.url,width:+((a=n==null?void 0:n.images.original)==null?void 0:a.width),height:+((h=n==null?void 0:n.images.original)==null?void 0:h.width)}})}async function X(e){var n,s;const t=await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`),r=await(t==null?void 0:t.json()),i=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(n=r==null?void 0:r.results)==null?void 0:n[0]}&limit=15`)).json();return(s=i==null?void 0:i.results)==null?void 0:s.map(a=>{var h,b,x,m,T,g,_,y;return{id:a==null?void 0:a.id,src:(b=(h=a==null?void 0:a.media_formats)==null?void 0:h.gif)==null?void 0:b.url,width:(T=(m=(x=a==null?void 0:a.media_formats)==null?void 0:x.gif)==null?void 0:m.dims)==null?void 0:T[0],height:(y=(_=(g=a==null?void 0:a.media_formats)==null?void 0:g.gif)==null?void 0:_.dims)==null?void 0:y[1]}})}async function Y(e,t){var i;const c=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();return(i=c==null?void 0:c.results)==null?void 0:i.map(n=>{var s,a,h,b,x,m,T,g;return{id:n==null?void 0:n.id,src:(a=(s=n==null?void 0:n.media_formats)==null?void 0:s.gif)==null?void 0:a.url,width:(x=(b=(h=n==null?void 0:n.media_formats)==null?void 0:h.gif)==null?void 0:b.dims)==null?void 0:x[0],height:(g=(T=(m=n==null?void 0:n.media_formats)==null?void 0:m.gif)==null?void 0:T.dims)==null?void 0:g[1]}})}function Z(e,t){return{searchTrending:async()=>t?e==="giphy"?F(t):e==="tenor"?X(t):[]:[],searchWord:async i=>t?e==="giphy"?V(i,t):e==="tenor"?Y(i,t):[]:[]}}function U({selectImage:e,apiKey:t,provider:r,children:c}){const[i,n]=u.useState(!1),[s,a]=u.useState([]),{editorDisabled:h}=k.useToggleActive(),b=u.useRef(null),{searchTrending:x,searchWord:m}=Z(r,t);u.useEffect(()=>{(async()=>{const g=await x();a(g)})()},[]);const T=u.useCallback(N.debounce(async g=>{if(!g.target.value){const y=await x();a(y);return}const _=await m(g.target.value);a(_)},350),[]);return l.jsxs(P.Popover,{modal:!0,onOpenChange:n,open:i,children:[l.jsx(P.PopoverTrigger,{asChild:!0,disabled:h,children:c}),l.jsx(P.PopoverContent,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:t?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"richtext-mb-[10px] richtext-w-full",children:l.jsx(D.Input,{onChange:T,placeholder:"Search GIF",ref:b,type:"text"})}),l.jsx("div",{className:"richtext-max-h-[280px] !richtext-max-w-[400px] richtext-overflow-y-auto",children:l.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1 ",children:s!=null&&s.length?s==null?void 0:s.map(g=>l.jsx("img",{alt:"",className:"richtext-cursor-pointer richtext-object-contain richtext-text-center",src:g.src,onClick:()=>{e(g.src),n(!1)}},g.id)):l.jsx("p",{children:"No GIFs found"})})})]}):l.jsx("div",{children:l.jsx("p",{children:"Missing Giphy API Key"})})})]})}function J(){const e=k.useButtonProps(H.name),{action:t,icon:r,tooltip:c,apiKey:i,provider:n}=(e==null?void 0:e.componentProps)??{},{editorDisabled:s}=k.useToggleActive(),a=h=>{s||t&&t(h)};return l.jsx(U,{apiKey:i,provider:n,selectImage:a,children:l.jsx(W.ActionButton,{disabled:s,icon:r,tooltip:c})})}const H=N.index_default.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",API_KEY:"",provider:"giphy",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:r,t:c})=>{var s,a;const i=((s=r==null?void 0:r.options)==null?void 0:s.provider)||"",n=((a=r==null?void 0:r.options)==null?void 0:a.API_KEY)||"";return{componentProps:{action:h=>{t.chain().focus().setImageGif({src:h}).run()},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:c("editor.imageGif.tooltip"),apiKey:n,provider:i}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||"10";return r===void 0?null:Number.parseInt(`${r}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return $.ReactNodeViewRenderer(B)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:r})=>r.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:r})=>r.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",$.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});exports.ImageGif=H;exports.RichTextImageGif=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./clsx-CXbNJWDD.cjs"),N=require("./throttle-gTTvqDTW.cjs"),l=require("react/jsx-runtime"),d=require("react"),G=require("./index-CVFzP1Dc.cjs"),L=require("./isNumber-BTYSVlKo.cjs"),W=require("./toggle-BYvLnjCL.cjs");require("./index-CX4pNJlH.cjs");require("./theme.cjs");const D=require("./input-BJ7ihMq-.cjs"),P=require("./popover-BiSrlM4j.cjs"),k=require("./useButtonProps-CydzndG1.cjs"),S={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function B(e){var C,$;const[t,n]=d.useState({width:G.IMAGE_MAX_SIZE,height:G.IMAGE_MAX_SIZE}),[c,i]=d.useState({width:0,height:0}),[r]=d.useState([S.TOP_LEFT,S.TOP_RIGHT,S.BOTTOM_LEFT,S.BOTTOM_RIGHT]),[s,a]=d.useState(!1),[h,b]=d.useState({x:0,y:0,w:0,h:0,dir:""}),{align:x}=(C=e==null?void 0:e.node)==null?void 0:C.attrs,m=d.useMemo(()=>{var v;const{src:o,alt:f,width:w,height:M}=(v=e==null?void 0:e.node)==null?void 0:v.attrs,A=L.isNumber(w)?`${w}px`:w,u=L.isNumber(M)?`${M}px`:M;return{src:o||void 0,alt:f||void 0,style:{width:A||void 0,height:u||void 0}}},[($=e==null?void 0:e.node)==null?void 0:$.attrs]),T=d.useMemo(()=>{const{style:{width:o}}=m;return{width:o==="100%"?o:void 0}},[m]);function g(o){i({width:o.target.width,height:o.target.height})}function _(){const{editor:o,getPos:f}=e;o.commands.setNodeSelection(f())}const y=d.useCallback(N.throttle(()=>{const{editor:o}=e,{width:f}=getComputedStyle(o.view.dom);n(w=>({...w,width:Number.parseInt(f,10)}))},G.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function p(o,f){o.preventDefault(),o.stopPropagation();const w=c.width,M=c.height,A=w/M;let u=Number(e.node.attrs.width),v=Number(e.node.attrs.height);const I=t.width;u&&!v?(u=u>I?I:u,v=Math.round(u/A)):v&&!u?(u=Math.round(v*A),u=u>I?I:u):!u&&!v?(u=w>I?I:w,v=Math.round(u/A)):u=u>I?I:u,a(!0),b({x:o.clientX,y:o.clientY,w:u,h:v,dir:f})}const j=d.useCallback(N.throttle(o=>{if(o.preventDefault(),o.stopPropagation(),!s)return;const{x:f,w,dir:M}=h,A=(o.clientX-f)*(/l/.test(M)?-1:1),u=L.clamp(w+A,G.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:u,height:null})},G.IMAGE_THROTTLE_WAIT_TIME),[s,h,t,e.updateAttributes]),E=d.useCallback(o=>{o.preventDefault(),o.stopPropagation(),s&&(b({x:0,y:0,w:0,h:0,dir:""}),a(!1),_())},[s,_]),z=d.useCallback(()=>{document==null||document.addEventListener("mousemove",j,!0),document==null||document.addEventListener("mouseup",E,!0)},[j,E]),O=d.useCallback(()=>{document==null||document.removeEventListener("mousemove",j,!0),document==null||document.removeEventListener("mouseup",E,!0)},[j,E]);d.useEffect(()=>(s?z():O(),()=>{O()}),[s,z,O]);const R=d.useMemo(()=>new ResizeObserver(()=>y()),[y]);return d.useEffect(()=>(R.observe(e.editor.view.dom),()=>{R.disconnect()}),[e.editor.view.dom,R]),l.jsx(q.NodeViewWrapper,{className:"image-view",style:{...T,width:"100%",textAlign:x},children:l.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:T,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[l.jsx("img",{alt:m.alt,className:"image-view__body__image block",height:"auto",onClick:_,onLoad:g,src:m.src,style:m.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&l.jsx("div",{className:"image-resizer",children:r==null?void 0:r.map(o=>l.jsx("span",{className:`image-resizer__handler image-resizer__handler--${o}`,onMouseDown:f=>p(f,o)},`image-dir-${o}`))})]})})}async function F(e){var c;const n=await(await fetch(`https://api.giphy.com/v1/gifs/trending?q=&limit=15&api_key=${e}`)).json();return(c=n==null?void 0:n.data)==null?void 0:c.map(i=>{var r,s,a;return{id:i==null?void 0:i.id,src:(r=i==null?void 0:i.images.original)==null?void 0:r.url,width:+((s=i==null?void 0:i.images.original)==null?void 0:s.width),height:+((a=i==null?void 0:i.images.original)==null?void 0:a.width)}})}async function V(e,t){var i;const c=await(await fetch(`https://api.giphy.com/v1/gifs/search?q=${e}&limit=15&api_key=${t}`)).json();return(i=c==null?void 0:c.data)==null?void 0:i.map(r=>{var s,a,h;return{id:r==null?void 0:r.id,src:(s=r==null?void 0:r.images.original)==null?void 0:s.url,width:+((a=r==null?void 0:r.images.original)==null?void 0:a.width),height:+((h=r==null?void 0:r.images.original)==null?void 0:h.width)}})}async function X(e){var r,s;const t=await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`),n=await(t==null?void 0:t.json()),i=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(r=n==null?void 0:n.results)==null?void 0:r[0]}&limit=15`)).json();return(s=i==null?void 0:i.results)==null?void 0:s.map(a=>{var h,b,x,m,T,g,_,y;return{id:a==null?void 0:a.id,src:(b=(h=a==null?void 0:a.media_formats)==null?void 0:h.gif)==null?void 0:b.url,width:(T=(m=(x=a==null?void 0:a.media_formats)==null?void 0:x.gif)==null?void 0:m.dims)==null?void 0:T[0],height:(y=(_=(g=a==null?void 0:a.media_formats)==null?void 0:g.gif)==null?void 0:_.dims)==null?void 0:y[1]}})}async function Y(e,t){var i;const c=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();return(i=c==null?void 0:c.results)==null?void 0:i.map(r=>{var s,a,h,b,x,m,T,g;return{id:r==null?void 0:r.id,src:(a=(s=r==null?void 0:r.media_formats)==null?void 0:s.gif)==null?void 0:a.url,width:(x=(b=(h=r==null?void 0:r.media_formats)==null?void 0:h.gif)==null?void 0:b.dims)==null?void 0:x[0],height:(g=(T=(m=r==null?void 0:r.media_formats)==null?void 0:m.gif)==null?void 0:T.dims)==null?void 0:g[1]}})}function Z(e,t){return{searchTrending:async()=>t?e==="giphy"?F(t):e==="tenor"?X(t):[]:[],searchWord:async i=>t?e==="giphy"?V(i,t):e==="tenor"?Y(i,t):[]:[]}}function U({selectImage:e,apiKey:t,provider:n,children:c}){const[i,r]=d.useState(!1),[s,a]=d.useState([]),{editorDisabled:h}=k.useToggleActive(),b=d.useRef(null),{searchTrending:x,searchWord:m}=Z(n,t);d.useEffect(()=>{(async()=>{const g=await x();a(g)})()},[]);const T=d.useCallback(N.debounce(async g=>{if(!g.target.value){const y=await x();a(y);return}const _=await m(g.target.value);a(_)},350),[]);return l.jsxs(P.Popover,{modal:!0,onOpenChange:r,open:i,children:[l.jsx(P.PopoverTrigger,{asChild:!0,disabled:h,children:c}),l.jsx(P.PopoverContent,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:t?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"richtext-mb-[10px] richtext-w-full",children:l.jsx(D.Input,{onChange:T,placeholder:"Search GIF",ref:b,type:"text"})}),l.jsx("div",{className:"richtext-max-h-[280px] !richtext-max-w-[400px] richtext-overflow-y-auto",children:l.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1 ",children:s!=null&&s.length?s==null?void 0:s.map(g=>l.jsx("img",{alt:"",className:"richtext-cursor-pointer richtext-object-contain richtext-text-center",src:g.src,onClick:()=>{e(g.src),r(!1)}},g.id)):l.jsx("p",{children:"No GIFs found"})})})]}):l.jsx("div",{children:l.jsx("p",{children:"Missing Giphy API Key"})})})]})}function J(){const e=k.useButtonProps(H.name),{action:t,icon:n,tooltip:c,apiKey:i,provider:r}=(e==null?void 0:e.componentProps)??{},{editorDisabled:s}=k.useToggleActive(),a=h=>{s||t&&t(h)};return l.jsx(U,{apiKey:i,provider:r,selectImage:a,children:l.jsx(W.ActionButton,{disabled:s,icon:n,tooltip:c})})}const H=N.index_default.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",API_KEY:"",provider:"giphy",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:n,t:c})=>{var s,a;const i=((s=n==null?void 0:n.options)==null?void 0:s.provider)||"",r=((a=n==null?void 0:n.options)==null?void 0:a.API_KEY)||"";return{componentProps:{action:h=>{t.chain().focus().setImageGif({src:h}).run()},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:c("editor.imageGif.tooltip"),apiKey:r,provider:i}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const n=t.style.width||t.getAttribute("width")||"10";return n===void 0?null:Number.parseInt(`${n}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return q.ReactNodeViewRenderer(B)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:n})=>n.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:n})=>n.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:n})=>n.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",q.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),n=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:n?Number.parseInt(n,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});exports.ImageGif=H;exports.RichTextImageGif=J;
package/lib/ImageGif.js CHANGED
@@ -1,13 +1,15 @@
1
- import { q, m as B, u as V } from "./index-sVScpCFG.js";
2
- import { a as H, d as X, c as Y } from "./throttle-DsowOft0.js";
3
- import { jsx as u, jsxs as p, Fragment as Z } from "react/jsx-runtime";
4
- import { useState as G, useMemo as P, useCallback as M, useEffect as z, useRef as U } from "react";
5
- import { I as C, j, k as J } from "./index-0OnGZkVF.js";
6
- import { i as W, c as Q } from "./isNumber-DF0fU3ob.js";
7
- import { A as K } from "./index-BIqaogQg.js";
8
- import { I as ee } from "./input-Bx4uo4gO.js";
9
- import { P as te, a as re, b as ne } from "./popover-BVX8otO9.js";
10
- import { u as ie, a as D } from "./useButtonProps-C_bqxmHi.js";
1
+ import { o as B, m as q, s as V } from "./clsx-DmuN0U_8.js";
2
+ import { a as k, d as X, c as Y } from "./throttle-BRtichEP.js";
3
+ import { jsx as u, jsxs as P, Fragment as Z } from "react/jsx-runtime";
4
+ import { useState as G, useMemo as L, useCallback as M, useEffect as z, useRef as U } from "react";
5
+ import { I as C, i as j, j as J } from "./index-BDX1uE62.js";
6
+ import { i as W, c as Q } from "./isNumber-DmQXlKp3.js";
7
+ import { A as K } from "./toggle-Bxwwb_Kp.js";
8
+ import "./index-D9JOHlso.js";
9
+ import "./theme.js";
10
+ import { I as ee } from "./input-YoheBL2D.js";
11
+ import { P as te, a as re, b as ne } from "./popover-CWmTzHSy.js";
12
+ import { u as ie, a as D } from "./useButtonProps-CfYtuEnd.js";
11
13
  const O = {
12
14
  TOP_LEFT: "tl",
13
15
  TOP_RIGHT: "tr",
@@ -15,7 +17,7 @@ const O = {
15
17
  BOTTOM_RIGHT: "br"
16
18
  };
17
19
  function ae(e) {
18
- var R, k;
20
+ var R, H;
19
21
  const [t, n] = G({
20
22
  width: C,
21
23
  height: C
@@ -33,23 +35,23 @@ function ae(e) {
33
35
  w: 0,
34
36
  h: 0,
35
37
  dir: ""
36
- }), { align: b } = (R = e == null ? void 0 : e.node) == null ? void 0 : R.attrs, g = P(() => {
38
+ }), { align: b } = (R = e == null ? void 0 : e.node) == null ? void 0 : R.attrs, m = L(() => {
37
39
  var w;
38
- const { src: o, alt: m, width: f, height: x } = (w = e == null ? void 0 : e.node) == null ? void 0 : w.attrs, A = W(f) ? `${f}px` : f, d = W(x) ? `${x}px` : x;
40
+ const { src: o, alt: g, width: f, height: x } = (w = e == null ? void 0 : e.node) == null ? void 0 : w.attrs, A = W(f) ? `${f}px` : f, d = W(x) ? `${x}px` : x;
39
41
  return {
40
42
  src: o || void 0,
41
- alt: m || void 0,
43
+ alt: g || void 0,
42
44
  style: {
43
45
  width: A || void 0,
44
46
  height: d || void 0
45
47
  }
46
48
  };
47
- }, [(k = e == null ? void 0 : e.node) == null ? void 0 : k.attrs]), _ = P(() => {
49
+ }, [(H = e == null ? void 0 : e.node) == null ? void 0 : H.attrs]), _ = L(() => {
48
50
  const {
49
51
  style: { width: o }
50
- } = g;
52
+ } = m;
51
53
  return { width: o === "100%" ? o : void 0 };
52
- }, [g]);
54
+ }, [m]);
53
55
  function h(o) {
54
56
  i({
55
57
  width: o.target.width,
@@ -57,20 +59,20 @@ function ae(e) {
57
59
  });
58
60
  }
59
61
  function y() {
60
- const { editor: o, getPos: m } = e;
61
- o.commands.setNodeSelection(m());
62
+ const { editor: o, getPos: g } = e;
63
+ o.commands.setNodeSelection(g());
62
64
  }
63
65
  const T = M(
64
- H(() => {
65
- const { editor: o } = e, { width: m } = getComputedStyle(o.view.dom);
66
+ k(() => {
67
+ const { editor: o } = e, { width: g } = getComputedStyle(o.view.dom);
66
68
  n((f) => ({
67
69
  ...f,
68
- width: Number.parseInt(m, 10)
70
+ width: Number.parseInt(g, 10)
69
71
  }));
70
72
  }, j),
71
73
  [e == null ? void 0 : e.editor]
72
74
  );
73
- function F(o, m) {
75
+ function F(o, g) {
74
76
  o.preventDefault(), o.stopPropagation();
75
77
  const f = c.width, x = c.height, A = f / x;
76
78
  let d = Number(e.node.attrs.width), w = Number(e.node.attrs.height);
@@ -80,14 +82,14 @@ function ae(e) {
80
82
  y: o.clientY,
81
83
  w: d,
82
84
  h: w,
83
- dir: m
85
+ dir: g
84
86
  });
85
87
  }
86
88
  const N = M(
87
- H((o) => {
89
+ k((o) => {
88
90
  if (o.preventDefault(), o.stopPropagation(), !a)
89
91
  return;
90
- const { x: m, w: f, dir: x } = l, A = (o.clientX - m) * (/l/.test(x) ? -1 : 1), d = Q(f + A, J, t.width);
92
+ const { x: g, w: f, dir: x } = l, A = (o.clientX - g) * (/l/.test(x) ? -1 : 1), d = Q(f + A, J, t.width);
91
93
  e.updateAttributes({
92
94
  width: d,
93
95
  height: null
@@ -107,21 +109,21 @@ function ae(e) {
107
109
  [a, y]
108
110
  ), $ = M(() => {
109
111
  document == null || document.addEventListener("mousemove", N, !0), document == null || document.addEventListener("mouseup", E, !0);
110
- }, [N, E]), S = M(() => {
112
+ }, [N, E]), p = M(() => {
111
113
  document == null || document.removeEventListener("mousemove", N, !0), document == null || document.removeEventListener("mouseup", E, !0);
112
114
  }, [N, E]);
113
- z(() => (a ? $() : S(), () => {
114
- S();
115
- }), [a, $, S]);
116
- const L = P(() => new ResizeObserver(() => T()), [T]);
117
- return z(() => (L.observe(e.editor.view.dom), () => {
118
- L.disconnect();
119
- }), [e.editor.view.dom, L]), /* @__PURE__ */ u(
120
- q,
115
+ z(() => (a ? $() : p(), () => {
116
+ p();
117
+ }), [a, $, p]);
118
+ const S = L(() => new ResizeObserver(() => T()), [T]);
119
+ return z(() => (S.observe(e.editor.view.dom), () => {
120
+ S.disconnect();
121
+ }), [e.editor.view.dom, S]), /* @__PURE__ */ u(
122
+ B,
121
123
  {
122
124
  className: "image-view",
123
125
  style: { ..._, width: "100%", textAlign: b },
124
- children: /* @__PURE__ */ p(
126
+ children: /* @__PURE__ */ P(
125
127
  "div",
126
128
  {
127
129
  "data-drag-handle": !0,
@@ -132,20 +134,20 @@ function ae(e) {
132
134
  /* @__PURE__ */ u(
133
135
  "img",
134
136
  {
135
- alt: g.alt,
137
+ alt: m.alt,
136
138
  className: "image-view__body__image block",
137
139
  height: "auto",
138
140
  onClick: y,
139
141
  onLoad: h,
140
- src: g.src,
141
- style: g.style
142
+ src: m.src,
143
+ style: m.style
142
144
  }
143
145
  ),
144
146
  (e == null ? void 0 : e.editor.view.editable) && ((e == null ? void 0 : e.selected) || a) && /* @__PURE__ */ u("div", { className: "image-resizer", children: r == null ? void 0 : r.map((o) => /* @__PURE__ */ u(
145
147
  "span",
146
148
  {
147
149
  className: `image-resizer__handler image-resizer__handler--${o}`,
148
- onMouseDown: (m) => F(m, o)
150
+ onMouseDown: (g) => F(g, o)
149
151
  },
150
152
  `image-dir-${o}`
151
153
  )) })
@@ -185,11 +187,11 @@ async function ce(e) {
185
187
  var r, a;
186
188
  const t = await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`), n = await (t == null ? void 0 : t.json()), i = await (await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(r = n == null ? void 0 : n.results) == null ? void 0 : r[0]}&limit=15`)).json();
187
189
  return (a = i == null ? void 0 : i.results) == null ? void 0 : a.map((s) => {
188
- var l, v, b, g, _, h, y, T;
190
+ var l, v, b, m, _, h, y, T;
189
191
  return {
190
192
  id: s == null ? void 0 : s.id,
191
193
  src: (v = (l = s == null ? void 0 : s.media_formats) == null ? void 0 : l.gif) == null ? void 0 : v.url,
192
- width: (_ = (g = (b = s == null ? void 0 : s.media_formats) == null ? void 0 : b.gif) == null ? void 0 : g.dims) == null ? void 0 : _[0],
194
+ width: (_ = (m = (b = s == null ? void 0 : s.media_formats) == null ? void 0 : b.gif) == null ? void 0 : m.dims) == null ? void 0 : _[0],
193
195
  height: (T = (y = (h = s == null ? void 0 : s.media_formats) == null ? void 0 : h.gif) == null ? void 0 : y.dims) == null ? void 0 : T[1]
194
196
  };
195
197
  });
@@ -198,12 +200,12 @@ async function de(e, t) {
198
200
  var i;
199
201
  const c = await (await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();
200
202
  return (i = c == null ? void 0 : c.results) == null ? void 0 : i.map((r) => {
201
- var a, s, l, v, b, g, _, h;
203
+ var a, s, l, v, b, m, _, h;
202
204
  return {
203
205
  id: r == null ? void 0 : r.id,
204
206
  src: (s = (a = r == null ? void 0 : r.media_formats) == null ? void 0 : a.gif) == null ? void 0 : s.url,
205
207
  width: (b = (v = (l = r == null ? void 0 : r.media_formats) == null ? void 0 : l.gif) == null ? void 0 : v.dims) == null ? void 0 : b[0],
206
- height: (h = (_ = (g = r == null ? void 0 : r.media_formats) == null ? void 0 : g.gif) == null ? void 0 : _.dims) == null ? void 0 : h[1]
208
+ height: (h = (_ = (m = r == null ? void 0 : r.media_formats) == null ? void 0 : m.gif) == null ? void 0 : _.dims) == null ? void 0 : h[1]
207
209
  };
208
210
  });
209
211
  }
@@ -214,7 +216,7 @@ function le(e, t) {
214
216
  };
215
217
  }
216
218
  function he({ selectImage: e, apiKey: t, provider: n, children: c }) {
217
- const [i, r] = G(!1), [a, s] = G([]), { editorDisabled: l } = D(), v = U(null), { searchTrending: b, searchWord: g } = le(n, t);
219
+ const [i, r] = G(!1), [a, s] = G([]), { editorDisabled: l } = D(), v = U(null), { searchTrending: b, searchWord: m } = le(n, t);
218
220
  z(() => {
219
221
  (async () => {
220
222
  const h = await b();
@@ -228,13 +230,13 @@ function he({ selectImage: e, apiKey: t, provider: n, children: c }) {
228
230
  s(T);
229
231
  return;
230
232
  }
231
- const y = await g(h.target.value);
233
+ const y = await m(h.target.value);
232
234
  s(y);
233
235
  }, 350),
234
236
  // Adjust the debounce delay as needed
235
237
  []
236
238
  );
237
- return /* @__PURE__ */ p(
239
+ return /* @__PURE__ */ P(
238
240
  te,
239
241
  {
240
242
  modal: !0,
@@ -256,7 +258,7 @@ function he({ selectImage: e, apiKey: t, provider: n, children: c }) {
256
258
  className: "richtext-size-full richtext-p-2",
257
259
  hideWhenDetached: !0,
258
260
  side: "bottom",
259
- children: t ? /* @__PURE__ */ p(Z, { children: [
261
+ children: t ? /* @__PURE__ */ P(Z, { children: [
260
262
  /* @__PURE__ */ u("div", { className: "richtext-mb-[10px] richtext-w-full", children: /* @__PURE__ */ u(
261
263
  ee,
262
264
  {
@@ -285,7 +287,7 @@ function he({ selectImage: e, apiKey: t, provider: n, children: c }) {
285
287
  }
286
288
  );
287
289
  }
288
- function xe() {
290
+ function Ge() {
289
291
  const e = ie(ue.name), {
290
292
  action: t,
291
293
  icon: n,
@@ -397,7 +399,7 @@ const ue = /* @__PURE__ */ Y.extend({
397
399
  },
398
400
  [
399
401
  "img",
400
- B(
402
+ q(
401
403
  // Always render the `height="auto"`
402
404
  {
403
405
  height: "auto"
@@ -428,5 +430,5 @@ const ue = /* @__PURE__ */ Y.extend({
428
430
  });
429
431
  export {
430
432
  ue as ImageGif,
431
- xe as RichTextImageGif
433
+ Ge as RichTextImageGif
432
434
  };