reactjs-tiptap-editor 1.0.4 → 1.0.6

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 (155) hide show
  1. package/lib/{ActionMenuButton-Bzr6ICxv.cjs → ActionMenuButton-DYT5chmX.cjs} +1 -1
  2. package/lib/{ActionMenuButton-71gCEVbv.js → ActionMenuButton-htJNI0Fa.js} +4 -4
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +4 -4
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +3 -3
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +3 -3
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +3 -3
  11. package/lib/Clear.cjs +1 -1
  12. package/lib/Clear.js +2 -2
  13. package/lib/Code.cjs +1 -1
  14. package/lib/Code.js +3 -3
  15. package/lib/CodeBlock.cjs +1 -1
  16. package/lib/CodeBlock.js +4 -4
  17. package/lib/CodeView.cjs +1 -1
  18. package/lib/CodeView.js +3 -3
  19. package/lib/Color.cjs +1 -1
  20. package/lib/Color.js +5 -5
  21. package/lib/Column.cjs +1 -1
  22. package/lib/Column.js +3 -3
  23. package/lib/{Drawer-GRyIh2y1.js → Drawer-1211urKj.js} +6 -6
  24. package/lib/{Drawer-DlX87Cl4.cjs → Drawer-DUFUd5BW.cjs} +1 -1
  25. package/lib/Drawer.cjs +1 -1
  26. package/lib/Drawer.js +1 -1
  27. package/lib/Emoji.cjs +1 -1
  28. package/lib/Emoji.js +5 -5
  29. package/lib/{Excalidraw-Bkq1fXLL.cjs → Excalidraw-CajgZDjU.cjs} +1 -1
  30. package/lib/{Excalidraw-BmyhdJCU.js → Excalidraw-Du3hBR8t.js} +5 -5
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +1 -1
  33. package/lib/ExportPdf.cjs +1 -1
  34. package/lib/ExportPdf.js +3 -3
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +3 -3
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +5 -5
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +5 -5
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +5 -5
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +5 -5
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +3 -3
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +3 -3
  49. package/lib/{Icon-ztD4g9N4.cjs → Icon-BjR_or8V.cjs} +1 -1
  50. package/lib/{Icon-1z7VnLgz.js → Icon-C-qYUAS1.js} +1 -1
  51. package/lib/{Iframe-DhUlC9-Y.cjs → Iframe-CM6mRQmv.cjs} +1 -1
  52. package/lib/{Iframe-AiP8qPGF.js → Iframe-DTYTLQE6.js} +5 -5
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +1 -1
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +13 -13
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +6 -6
  59. package/lib/ImportWord.cjs +1 -1
  60. package/lib/ImportWord.js +4 -4
  61. package/lib/{Indent-fphgO8Eo.cjs → Indent-BmhiEb0S.cjs} +1 -1
  62. package/lib/{Indent-CBoQDISv.js → Indent-jOPn3eUM.js} +3 -3
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +1 -1
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +3 -3
  67. package/lib/{Katex-n2PVzaMd.js → Katex-CERSrcTP.js} +7 -7
  68. package/lib/{Katex-AfmTUUNS.cjs → Katex-CUd3LxLh.cjs} +1 -1
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +1 -1
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +6 -6
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +1 -1
  75. package/lib/{LinkEditBlock-CoXwYHlj.js → LinkEditBlock-B5SdhOfa.js} +10 -10
  76. package/lib/{LinkEditBlock-sADc32hF.cjs → LinkEditBlock-DaxljgJC.cjs} +1 -1
  77. package/lib/Mermaid.cjs +1 -1
  78. package/lib/Mermaid.js +6 -6
  79. package/lib/MoreMark.cjs +1 -1
  80. package/lib/MoreMark.js +5 -5
  81. package/lib/OrderedList.cjs +1 -1
  82. package/lib/OrderedList.js +3 -3
  83. package/lib/SearchAndReplace.cjs +1 -1
  84. package/lib/SearchAndReplace.js +10 -10
  85. package/lib/SlashCommand.cjs +1 -1
  86. package/lib/SlashCommand.js +40 -38
  87. package/lib/Strike.cjs +1 -1
  88. package/lib/Strike.js +3 -3
  89. package/lib/{Table-BshvoFRh.js → Table-39OkCQbu.js} +5 -5
  90. package/lib/{Table-BLb5576a.cjs → Table-3VstSlg4.cjs} +1 -1
  91. package/lib/Table.cjs +1 -1
  92. package/lib/Table.js +1 -1
  93. package/lib/TaskList.cjs +1 -1
  94. package/lib/TaskList.js +3 -3
  95. package/lib/TextAlign.cjs +1 -1
  96. package/lib/TextAlign.js +6 -6
  97. package/lib/TextDirection.cjs +1 -1
  98. package/lib/TextDirection.js +6 -6
  99. package/lib/TextUnderline.cjs +1 -1
  100. package/lib/TextUnderline.js +3 -3
  101. package/lib/{Twitter-CLVet4OM.js → Twitter-D7PhLycr.js} +9 -9
  102. package/lib/{Twitter-DEKTLWO5.cjs → Twitter-DuHPeVW1.cjs} +1 -1
  103. package/lib/Twitter.cjs +1 -1
  104. package/lib/Twitter.js +1 -1
  105. package/lib/Video.cjs +1 -1
  106. package/lib/Video.js +9 -9
  107. package/lib/bubble.cjs +4 -4
  108. package/lib/bubble.js +276 -263
  109. package/lib/{button-BnN1L5_T.js → button-Crm67hfl.js} +1 -1
  110. package/lib/{button-CjAogRMZ.cjs → button-xNppt_aK.cjs} +1 -1
  111. package/lib/{checkbox-sSQSzjls.js → checkbox-DViVmgJ6.js} +1 -1
  112. package/lib/{checkbox-BFgaCetY.cjs → checkbox-NQC2MdGT.cjs} +1 -1
  113. package/lib/{dialog-CzZSyyxS.js → dialog-Ce9Cjfft.js} +1 -1
  114. package/lib/{dialog-CUP7QBaG.cjs → dialog-DaHBd2zw.cjs} +1 -1
  115. package/lib/{dropdown-menu-y1rPk4dr.js → dropdown-menu-CQykJhBs.js} +1 -1
  116. package/lib/{dropdown-menu-CwHOwzLr.cjs → dropdown-menu-CSCDQtq0.cjs} +1 -1
  117. package/lib/events.constant-DQYeJpu5.cjs +1 -0
  118. package/lib/{events.constant-CBPIqO_g.js → events.constant-wrlJ_7JZ.js} +5 -4
  119. package/lib/{index-DGihe-wH.js → index-0OnGZkVF.js} +19 -16
  120. package/lib/{index-CnbtiTqP.cjs → index-CNzHZDls.cjs} +3 -3
  121. package/lib/{index--XZPCi0O.js → index-DuZCJJSp.js} +203 -179
  122. package/lib/{index-D4d-0Hqh.cjs → index-FSRjMsxW.cjs} +1 -1
  123. package/lib/index.cjs +1 -1
  124. package/lib/index.js +2 -2
  125. package/lib/{input-Byg4PPou.js → input-DfqFAyKo.js} +1 -1
  126. package/lib/{input-Dikmsjjj.cjs → input-tU3H__39.cjs} +1 -1
  127. package/lib/{label-BX7OqM6p.js → label-DC33TZy_.js} +1 -1
  128. package/lib/{label-ChxDmW-K.cjs → label-DkDE77kc.cjs} +1 -1
  129. package/lib/locale-bundle.cjs +1 -1
  130. package/lib/locale-bundle.js +1 -1
  131. package/lib/locales/index.d.ts +2 -1
  132. package/lib/{popover-DVD1y8Z_.cjs → popover-CZWSQZ0q.cjs} +1 -1
  133. package/lib/{popover-CheVmqgb.js → popover-CoepUobG.js} +1 -1
  134. package/lib/{separator-Y_Pbpi-5.js → separator-6SnwzytZ.js} +5 -5
  135. package/lib/{separator-CSuS-D6T.cjs → separator-DCQD8P6s.cjs} +1 -1
  136. package/lib/store-726Zjszt.cjs +1 -0
  137. package/lib/store-ibARMQ3h.js +10 -0
  138. package/lib/style.css +1 -1
  139. package/lib/{tabs-B9ooipwg.cjs → tabs-B_ArrG09.cjs} +1 -1
  140. package/lib/{tabs-p4pJGb6o.js → tabs-DrkJL_C2.js} +1 -1
  141. package/lib/{textarea-Byts1Pn0.js → textarea-CIs52G8B.js} +1 -1
  142. package/lib/{textarea-L53EceuF.cjs → textarea-CmZVZKOo.cjs} +1 -1
  143. package/lib/theme.cjs +1 -1
  144. package/lib/theme.js +1 -1
  145. package/lib/{toggle-DUPu3nnZ.cjs → toggle-DVCNvcqp.cjs} +1 -1
  146. package/lib/{toggle-WBgzE8Jm.js → toggle-xchtz-Kf.js} +3 -3
  147. package/lib/{tooltip-BOMwAoO1.js → tooltip-BTFcHrd9.js} +1 -1
  148. package/lib/{tooltip-DD5Ii8qI.cjs → tooltip-DFjcKu9a.cjs} +1 -1
  149. package/lib/{useButtonProps-BIOoOg6h.js → useButtonProps-D0SrPzuG.js} +2 -2
  150. package/lib/{useButtonProps-C4SCmCVo.cjs → useButtonProps-bei1vI37.cjs} +1 -1
  151. package/lib/utils/customEvents/events.constant.d.ts +1 -0
  152. package/package.json +1 -1
  153. package/lib/events.constant-B-VGURJp.cjs +0 -1
  154. package/lib/store-BVm_SgvL.js +0 -10
  155. package/lib/store-DznMm4Ug.cjs +0 -1
@@ -3,11 +3,11 @@ import { jsxs as f, jsx as d, Fragment as P } from "react/jsx-runtime";
3
3
  import { useState as R, useCallback as M } from "react";
4
4
  import { Resizable as N } from "re-resizable";
5
5
  import { g as l } from "./dom-dataset-CIEeltF6.js";
6
- import { A as j } from "./toggle-WBgzE8Jm.js";
7
- import { b as U } from "./index--XZPCi0O.js";
8
- import { u as q, a as A } from "./useButtonProps-BIOoOg6h.js";
9
- import { I as L } from "./input-Byg4PPou.js";
10
- import { B as D } from "./button-BnN1L5_T.js";
6
+ import { A as j } from "./toggle-xchtz-Kf.js";
7
+ import { b as U } from "./index-DuZCJJSp.js";
8
+ import { u as q, a as A } from "./useButtonProps-D0SrPzuG.js";
9
+ import { I as L } from "./input-DfqFAyKo.js";
10
+ import { B as D } from "./button-Crm67hfl.js";
11
11
  const m = {
12
12
  youtube: {
13
13
  example: "https://www.youtube.com/watch?v=I4sMhHbHYXM",
package/lib/Iframe.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DLqogznp.cjs");const e=require("./Iframe-DhUlC9-Y.cjs");require("./dom-dataset-BqoJhJXt.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DLqogznp.cjs");const e=require("./Iframe-CM6mRQmv.cjs");require("./dom-dataset-BqoJhJXt.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
package/lib/Iframe.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./index-nFjllrEl.js";
2
- import { I as o, R as t } from "./Iframe-AiP8qPGF.js";
2
+ import { I as o, R as t } from "./Iframe-DTYTLQE6.js";
3
3
  import "./dom-dataset-CIEeltF6.js";
4
4
  export {
5
5
  o as Iframe,
package/lib/Image.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index-DLqogznp.cjs"),W=require("./throttle-DXN-aiH5.cjs"),n=require("react/jsx-runtime"),o=require("react"),q=require("./index-D4d-0Hqh.cjs"),Y=require("./isNumber-C2saEiG2.cjs"),ie=require("./toggle-DUPu3nnZ.cjs");require("./index-CnbtiTqP.cjs");const z=require("./dialog-CUP7QBaG.cjs"),ae=require("react-image-crop"),B=require("./button-CjAogRMZ.cjs"),Z=require("./file-i7e4nQY2.cjs"),U=require("./useButtonProps-C4SCmCVo.cjs"),ee=require("./use-toast-Bz3QCOtE.cjs"),P=require("./Icon-ztD4g9N4.cjs"),re=require("./store-DznMm4Ug.cjs"),J=require("./events.constant-B-VGURJp.cjs"),O=require("./tabs-B9ooipwg.cjs"),se=require("./checkbox-BFgaCetY.cjs"),K=require("./label-ChxDmW-K.cjs"),Q=require("./input-Dikmsjjj.cjs"),H={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function le(e){var F,d,E;const[t,a]=o.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[c,f]=o.useState({width:0,height:0}),[h]=o.useState([H.TOP_LEFT,H.TOP_RIGHT,H.BOTTOM_LEFT,H.BOTTOM_RIGHT]),[x,T]=o.useState(!1),[g,b]=o.useState({x:0,y:0,w:0,h:0,dir:""}),{align:A,inline:j}=(F=e==null?void 0:e.node)==null?void 0:F.attrs,L=j&&(A==="left"||A==="right"),M=o.useMemo(()=>{var V;const{src:r,alt:I,width:i,height:s,flipX:m,flipY:l}=(V=e==null?void 0:e.node)==null?void 0:V.attrs,y=Y.isNumber(i)?`${i}px`:i,w=Y.isNumber(s)?`${s}px`:s,X=[];m&&X.push("rotateX(180deg)"),l&&X.push("rotateY(180deg)");const ne=X.join(" ");return{src:r||void 0,alt:I||void 0,style:{width:y||void 0,height:w||void 0,transform:ne||"none",...L?{float:A}:{}}}},[(d=e==null?void 0:e.node)==null?void 0:d.attrs]),R=o.useMemo(()=>{const{style:{width:r}}=M;return{width:r==="100%"?r:void 0}},[M]);function _(r){f({width:r.target.width,height:r.target.height})}function C(){const{editor:r,getPos:I}=e;r.commands.setNodeSelection(I())}const S=o.useCallback(W.throttle(()=>{const{editor:r}=e,{width:I}=getComputedStyle(r.view.dom);a(i=>({...i,width:Number.parseInt(I,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function N(r,I){r.preventDefault(),r.stopPropagation();const i=c.width,s=c.height,m=i/s;let l=Number(e.node.attrs.width),y=Number(e.node.attrs.height);const w=t.width;l&&!y?(l=l>w?w:l,y=Math.round(l/m)):y&&!l?(l=Math.round(y*m),l=l>w?w:l):!l&&!y?(l=i>w?w:i,y=Math.round(l/m)):l=l>w?w:l,T(!0),b({x:r.clientX,y:r.clientY,w:l,h:y,dir:I})}const v=o.useCallback(W.throttle(r=>{if(r.preventDefault(),r.stopPropagation(),!x)return;const{x:I,w:i,dir:s}=g,m=(r.clientX-I)*(/l/.test(s)?-1:1),l=Y.clamp(i+m,q.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:l,height:null})},q.IMAGE_THROTTLE_WAIT_TIME),[x,g,t,e.updateAttributes]),p=o.useCallback(r=>{r.preventDefault(),r.stopPropagation(),x&&(b({x:0,y:0,w:0,h:0,dir:""}),T(!1),C())},[x,C]),u=o.useCallback(()=>{document==null||document.addEventListener("mousemove",v,!0),document==null||document.addEventListener("mouseup",p,!0)},[v,p]),k=o.useCallback(()=>{document==null||document.removeEventListener("mousemove",v,!0),document==null||document.removeEventListener("mouseup",p,!0)},[v,p]);o.useEffect(()=>(x?u():k(),()=>{k()}),[x,u,k]);const D=o.useMemo(()=>new ResizeObserver(()=>S()),[S]);return o.useEffect(()=>(D.observe(e.editor.view.dom),()=>{D.disconnect()}),[e.editor.view.dom,D]),n.jsx(G.NodeViewWrapper,{as:j?"span":"div",className:"image-view",style:{float:L?A:void 0,margin:L?A==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:j?"inline":"block",textAlign:L?void 0:A,width:((E=M.style)==null?void 0:E.width)??"auto",...L?{}:R},children:n.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:R,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${x?"image-view__body--resizing":""}`,children:[n.jsx("img",{alt:M.alt,className:"image-view__body__image block",height:"auto",onClick:C,onLoad:_,src:M.src,style:M.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||x)&&n.jsx("div",{className:"image-resizer",children:h==null?void 0:h.map(r=>n.jsx("span",{className:`image-resizer__handler image-resizer__handler--${r}`,onMouseDown:I=>N(I,r)},`image-dir-${r}`))})]})})}function oe(e,t){const a=e.type,c=e.name.toLowerCase(),f=c.split(".").pop();if(!f)return!1;const x=a||{heif:"image/heif",heic:"image/heic",dng:"image/x-adobe-dng",cr2:"image/x-canon-cr2",nef:"image/x-nikon-nef",arw:"image/x-sony-arw",raf:"image/x-fuji-raf",orf:"image/x-olympus-orf"}[f];return t.some(T=>{if(T.startsWith("."))return c.endsWith(T);if(T.endsWith("/*")){const g=T.split("/")[0];return x==null?void 0:x.startsWith(g+"/")}return x===T})}function te(e,t){const{acceptMimes:a,maxSize:c,t:f,toast:h}=t,x=[];return(Array.isArray(e)?e:Object.values(e)).forEach(g=>{if(!oe(g,a)){t.onError?t.onError({type:"type",message:f("editor.upload.fileTypeNotSupported",{fileName:g.name}),file:g}):h({variant:"default",title:f("editor.upload.fileTypeNotSupported",{fileName:g.name})});return}if(g.size>c){const b=(c/1024/1024).toFixed(2);t.onError?t.onError({type:"size",message:f("editor.upload.fileSizeTooBig",{fileName:g.name,size:b}),file:g}):h({variant:"default",title:f("editor.upload.fileSizeTooBig",{fileName:g.name,size:b})});return}x.push(g)}),x}function ce({editor:e,imageInline:t,onClose:a,disabled:c,alt:f}){var r,I;const{t:h}=q.useLocale(),{toast:x}=ee.useToast(),[T,g]=o.useState(!1),[b,A]=o.useState(!1),j=o.useRef(null),[L,M]=o.useState(),[R,_]=o.useState(""),C=o.useRef(null),[S,N]=o.useState({src:"",file:null}),v=U.useExtension($.name),p=o.useMemo(()=>(v==null?void 0:v.options)??{},[v]);function u(i){if(j.current&&i.width&&i.height){const s=k(j.current,i);_(s)}}function k(i,s){const m=document.createElement("canvas"),l=i.naturalWidth/i.width,y=i.naturalHeight/i.height;m.width=s.width*l,m.height=s.height*y;const w=m.getContext("2d");return w&&(w.imageSmoothingEnabled=!1,w.drawImage(i,s.x*l,s.y*y,s.width*l,s.height*y,0,0,s.width*l,s.height*y)),m.toDataURL("image/png",1)}const D=o.useCallback(async()=>{var i;if(!b){A(!0);try{const s=Z.dataURLtoFile(R,((i=S==null?void 0:S.file)==null?void 0:i.name)||"image.png");let m="";p.upload?m=await p.upload(s):m=URL.createObjectURL(s),e.chain().focus().setImageInline({src:m,inline:t,alt:f}).run(),g(!1),N({src:"",file:null}),E(),a()}catch(s){console.log("Error cropping image",s)}finally{A(!1)}}},[R,e,t,b,a,(r=S==null?void 0:S.file)==null?void 0:r.name,p]);function F(i){var s;i.preventDefault(),(s=C.current)==null||s.click()}const d=async i=>{var w;const s=(w=i==null?void 0:i.target)==null?void 0:w.files;if(!e||e.isDestroyed||s.length===0){i.target.value="";return}const m=te(s,{acceptMimes:p==null?void 0:p.acceptMimes,maxSize:p==null?void 0:p.maxSize,t:h,toast:x,onError:p.onError});if(m.length<=0){i.target.value="";return}const l=m[0],y=await Z.readImageAsBase64(l);g(!0),N({src:y.src,file:l})},E=()=>{C.current&&(C.current.value="")};return n.jsxs(n.Fragment,{children:[n.jsx(B.Button,{className:"richtext-mt-1 richtext-w-full",disabled:c,onClick:F,size:"sm",children:h("editor.image.dialog.tab.uploadCrop")}),n.jsxs(z.Dialog,{open:T,onOpenChange:i=>{g(i),i||(N({src:"",file:null}),E())},children:[n.jsx(z.DialogTrigger,{}),n.jsxs(z.DialogContent,{children:[n.jsx(z.DialogTitle,{children:h("editor.image.dialog.tab.uploadCrop")}),n.jsx("div",{children:S.src&&n.jsx(ae,{className:"richtext-w-full",crop:L,onChange:i=>M(i),onComplete:i=>u(i),children:n.jsx("img",{alt:"Crop me",ref:j,src:S.src})})}),n.jsxs(z.DialogFooter,{children:[n.jsxs(B.Button,{disabled:b,onClick:()=>{g(!1),N({src:"",file:null}),E()},children:[h("editor.imageUpload.cancel"),n.jsx(P.IconComponent,{className:"richtext-ml-1",name:"Trash2"})]}),n.jsx(B.Button,{className:"richtext-w-fit",disabled:b||!L,onClick:D,children:b?n.jsxs(n.Fragment,{children:[h("editor.imageUpload.uploading"),n.jsx(P.IconComponent,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):n.jsxs(n.Fragment,{children:[h("editor.imageUpload.crop"),n.jsx(P.IconComponent,{className:"richtext-ml-1",name:"Crop"})]})})]})]})]}),n.jsx("input",{accept:((I=p==null?void 0:p.acceptMimes)==null?void 0:I.join(","))||"image/*",multiple:!1,onChange:d,ref:C,style:{display:"none"},type:"file"})]})}function ue(){const{t:e}=q.useLocale(),{toast:t}=ee.useToast(),a=U.useEditorInstance(),c=U.useButtonProps($.name),{icon:f,tooltip:h}=(c==null?void 0:c.componentProps)??{},{editorDisabled:x}=U.useToggleActive(),[T,g]=o.useState(!1),[b,A]=o.useState(!1),j=U.useExtension($.name),L=d=>{g(d.detail)},[M,R]=o.useState(""),[_,C]=o.useState(""),S=o.useRef(null),N=(j==null?void 0:j.options.defaultInline)||!1,[v,p]=o.useState(N),u=o.useMemo(()=>j==null?void 0:j.options,[j]);o.useEffect(()=>{const d=J.listenEvent(J.EVENTS.UPLOAD_IMAGE(a.id),L);return()=>{d()}},[]);async function k(d){var I;const E=(I=d==null?void 0:d.target)==null?void 0:I.files;if(!a||a.isDestroyed||E.length===0||b){d.target.value="";return}const r=te(E,{acceptMimes:u==null?void 0:u.acceptMimes,maxSize:u==null?void 0:u.maxSize,t:e,toast:t,onError:u.onError});if(r.length<=0){d.target.value="";return}A(!0);try{if(u!=null&&u.multiple){const i=r.map(async m=>{let l="";return u.upload?l=await u.upload(m):l=URL.createObjectURL(m),l});(await Promise.all(i)).forEach(m=>{a.chain().focus().setImageInline({src:m,inline:v,alt:_}).run()})}else{const i=r[0];let s="";u.upload?s=await u.upload(i):s=URL.createObjectURL(i),a.chain().focus().setImageInline({src:s,inline:v,alt:_}).run()}g(!1),C(""),p(N)}catch(i){console.error("Error uploading image",i),u.onError?u.onError({type:"upload",message:e("editor.upload.error")}):t({variant:"destructive",title:e("editor.upload.error")})}finally{A(!1),d.target.value=""}}function D(d){d.preventDefault(),d.stopPropagation(),a.chain().focus().setImageInline({src:M,inline:v,alt:_}).run(),g(!1),p(N),R(""),C("")}function F(d){var E;d.preventDefault(),(E=S.current)==null||E.click()}return c?n.jsxs(z.Dialog,{onOpenChange:g,open:T,children:[n.jsx(z.DialogTrigger,{asChild:!0,children:n.jsx(ie.ActionButton,{disabled:x,icon:f,tooltip:h,action:()=>{x||g(!0)}})}),n.jsxs(z.DialogContent,{children:[n.jsx(z.DialogTitle,{children:e("editor.image.dialog.title")}),n.jsxs(O.Tabs,{activationMode:"manual",defaultValue:u.resourceImage==="both"||u.resourceImage==="upload"?"upload":"link",children:[u.resourceImage==="both"&&n.jsxs(O.TabsList,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[n.jsx(O.TabsTrigger,{value:"upload",children:e("editor.image.dialog.tab.upload")}),n.jsx(O.TabsTrigger,{value:"link",children:e("editor.image.dialog.tab.url")})]}),n.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]",children:[n.jsx(se.Checkbox,{checked:v,onCheckedChange:d=>{p(d)}}),n.jsx(K.Label,{children:e("editor.link.dialog.inline")})]}),u.enableAlt&&n.jsxs("div",{className:"richtext-my-[10px] ",children:[n.jsx(K.Label,{className:"mb-[6px]",children:e("editor.imageUpload.alt")}),n.jsx(Q.Input,{onChange:d=>C(d.target.value),required:!0,type:"text",value:_})]}),n.jsxs(O.TabsContent,{value:"upload",children:[n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[n.jsx(B.Button,{className:"richtext-mt-1 richtext-w-full",disabled:b,onClick:F,size:"sm",children:b?n.jsxs(n.Fragment,{children:[e("editor.imageUpload.uploading"),n.jsx(P.IconComponent,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):e("editor.image.dialog.tab.upload")}),n.jsx(ce,{alt:_,disabled:b,editor:a,imageInline:v,onClose:()=>{re.actionDialogImage.setOpen(a.id,!1),C("")}})]}),n.jsx("input",{accept:u.acceptMimes.join(",")||"image/*",multiple:u.multiple,onChange:k,ref:S,style:{display:"none"},type:"file"})]}),n.jsx(O.TabsContent,{value:"link",children:n.jsx("form",{onSubmit:D,children:n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[n.jsx(Q.Input,{autoFocus:!0,onChange:d=>R(d.target.value),placeholder:e("editor.image.dialog.placeholder"),required:!0,type:"url",value:M}),n.jsx(B.Button,{type:"submit",children:e("editor.image.dialog.button.apply")})]})})})]})]})]}):n.jsx(n.Fragment,{})}const de={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,multiple:!0,resourceImage:"both",defaultInline:!1,enableAlt:!0},$=W.index_default.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var e;return{...de,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:a,t:c})=>{var f,h;return{componentProps:{action:()=>!0,upload:a.options.upload,disabled:!((h=(f=t.can()).setImage)!=null&&h.call(f,{})),icon:"ImageUp",tooltip:c("editor.image.tooltip")}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:t=>{const a=t.style.width||t.getAttribute("width")||null;return a?Number.parseInt(a,10):null},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})},inline:{default:!1,parseHTML:t=>!!t.getAttribute("inline"),renderHTML:t=>({inline:t.inline})},alt:{default:"",parseHTML:t=>t.getAttribute("alt"),renderHTML:t=>({alt:t.alt})}}},addNodeView(){return G.ReactNodeViewRenderer(le)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageInline:t=>({commands:a})=>a.insertContent({type:this.name,attrs:{...t,inline:t.inline??this.options.defaultInline}}),updateImage:t=>({commands:a})=>a.updateAttributes(this.name,t),setAlignImage:t=>({commands:a})=>a.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{flipX:t,flipY:a,align:c,inline:f}=e,h=f&&(c==="left"||c==="right"),x=t||a?`transform: rotateX(${t?"180":"0"}deg) rotateY(${a?"180":"0"}deg);`:"",T=h?"":`text-align: ${c};`,A=`${h?`float: ${c};`:""}${h?c==="left"?"margin: 1em 1em 1em 0;":"margin: 1em 0 1em 1em;":""}${x}`;return[f?"span":"div",{style:T,class:"image"},["img",G.mergeAttributes({height:"auto",style:A},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"span.image img",getAttrs:e=>{var h;const t=e==null?void 0:e.parentElement,a=e==null?void 0:e.getAttribute("width"),c=(e==null?void 0:e.getAttribute("flipx"))||!1,f=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:a?Number.parseInt(a,10):null,align:(e==null?void 0:e.getAttribute("align"))||((h=t==null?void 0:t.style)==null?void 0:h.textAlign)||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:c==="true",flipY:f==="true"}}},{tag:"div[class=image]",getAttrs:e=>{const t=e.querySelector("img"),a=t==null?void 0:t.getAttribute("width"),c=(t==null?void 0:t.getAttribute("flipx"))||!1,f=(t==null?void 0:t.getAttribute("flipy"))||!1;return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),caption:t==null?void 0:t.getAttribute("caption"),width:a?Number.parseInt(a,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null,inline:(t==null?void 0:t.getAttribute("inline"))||!1,flipX:c==="true",flipY:f==="true"}}},{tag:'img[src]:not([src^="data:"])'}]}});exports.Image=$;exports.RichTextImage=ue;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index-DLqogznp.cjs"),W=require("./throttle-DXN-aiH5.cjs"),n=require("react/jsx-runtime"),o=require("react"),q=require("./index-FSRjMsxW.cjs"),Y=require("./isNumber-C2saEiG2.cjs"),ie=require("./toggle-DVCNvcqp.cjs");require("./index-CNzHZDls.cjs");const z=require("./dialog-DaHBd2zw.cjs"),ae=require("react-image-crop"),B=require("./button-xNppt_aK.cjs"),Z=require("./file-i7e4nQY2.cjs"),U=require("./useButtonProps-bei1vI37.cjs"),ee=require("./use-toast-Bz3QCOtE.cjs"),P=require("./Icon-BjR_or8V.cjs"),re=require("./store-726Zjszt.cjs"),J=require("./events.constant-DQYeJpu5.cjs"),O=require("./tabs-B_ArrG09.cjs"),se=require("./checkbox-NQC2MdGT.cjs"),K=require("./label-DkDE77kc.cjs"),Q=require("./input-tU3H__39.cjs"),H={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function le(e){var F,d,E;const[t,a]=o.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[c,f]=o.useState({width:0,height:0}),[h]=o.useState([H.TOP_LEFT,H.TOP_RIGHT,H.BOTTOM_LEFT,H.BOTTOM_RIGHT]),[x,T]=o.useState(!1),[g,b]=o.useState({x:0,y:0,w:0,h:0,dir:""}),{align:A,inline:j}=(F=e==null?void 0:e.node)==null?void 0:F.attrs,L=j&&(A==="left"||A==="right"),M=o.useMemo(()=>{var V;const{src:r,alt:I,width:i,height:s,flipX:m,flipY:l}=(V=e==null?void 0:e.node)==null?void 0:V.attrs,y=Y.isNumber(i)?`${i}px`:i,w=Y.isNumber(s)?`${s}px`:s,X=[];m&&X.push("rotateX(180deg)"),l&&X.push("rotateY(180deg)");const ne=X.join(" ");return{src:r||void 0,alt:I||void 0,style:{width:y||void 0,height:w||void 0,transform:ne||"none",...L?{float:A}:{}}}},[(d=e==null?void 0:e.node)==null?void 0:d.attrs]),R=o.useMemo(()=>{const{style:{width:r}}=M;return{width:r==="100%"?r:void 0}},[M]);function _(r){f({width:r.target.width,height:r.target.height})}function C(){const{editor:r,getPos:I}=e;r.commands.setNodeSelection(I())}const S=o.useCallback(W.throttle(()=>{const{editor:r}=e,{width:I}=getComputedStyle(r.view.dom);a(i=>({...i,width:Number.parseInt(I,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function N(r,I){r.preventDefault(),r.stopPropagation();const i=c.width,s=c.height,m=i/s;let l=Number(e.node.attrs.width),y=Number(e.node.attrs.height);const w=t.width;l&&!y?(l=l>w?w:l,y=Math.round(l/m)):y&&!l?(l=Math.round(y*m),l=l>w?w:l):!l&&!y?(l=i>w?w:i,y=Math.round(l/m)):l=l>w?w:l,T(!0),b({x:r.clientX,y:r.clientY,w:l,h:y,dir:I})}const v=o.useCallback(W.throttle(r=>{if(r.preventDefault(),r.stopPropagation(),!x)return;const{x:I,w:i,dir:s}=g,m=(r.clientX-I)*(/l/.test(s)?-1:1),l=Y.clamp(i+m,q.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:l,height:null})},q.IMAGE_THROTTLE_WAIT_TIME),[x,g,t,e.updateAttributes]),p=o.useCallback(r=>{r.preventDefault(),r.stopPropagation(),x&&(b({x:0,y:0,w:0,h:0,dir:""}),T(!1),C())},[x,C]),u=o.useCallback(()=>{document==null||document.addEventListener("mousemove",v,!0),document==null||document.addEventListener("mouseup",p,!0)},[v,p]),k=o.useCallback(()=>{document==null||document.removeEventListener("mousemove",v,!0),document==null||document.removeEventListener("mouseup",p,!0)},[v,p]);o.useEffect(()=>(x?u():k(),()=>{k()}),[x,u,k]);const D=o.useMemo(()=>new ResizeObserver(()=>S()),[S]);return o.useEffect(()=>(D.observe(e.editor.view.dom),()=>{D.disconnect()}),[e.editor.view.dom,D]),n.jsx(G.NodeViewWrapper,{as:j?"span":"div",className:"image-view",style:{float:L?A:void 0,margin:L?A==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:j?"inline":"block",textAlign:L?void 0:A,width:((E=M.style)==null?void 0:E.width)??"auto",...L?{}:R},children:n.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:R,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${x?"image-view__body--resizing":""}`,children:[n.jsx("img",{alt:M.alt,className:"image-view__body__image block",height:"auto",onClick:C,onLoad:_,src:M.src,style:M.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||x)&&n.jsx("div",{className:"image-resizer",children:h==null?void 0:h.map(r=>n.jsx("span",{className:`image-resizer__handler image-resizer__handler--${r}`,onMouseDown:I=>N(I,r)},`image-dir-${r}`))})]})})}function oe(e,t){const a=e.type,c=e.name.toLowerCase(),f=c.split(".").pop();if(!f)return!1;const x=a||{heif:"image/heif",heic:"image/heic",dng:"image/x-adobe-dng",cr2:"image/x-canon-cr2",nef:"image/x-nikon-nef",arw:"image/x-sony-arw",raf:"image/x-fuji-raf",orf:"image/x-olympus-orf"}[f];return t.some(T=>{if(T.startsWith("."))return c.endsWith(T);if(T.endsWith("/*")){const g=T.split("/")[0];return x==null?void 0:x.startsWith(g+"/")}return x===T})}function te(e,t){const{acceptMimes:a,maxSize:c,t:f,toast:h}=t,x=[];return(Array.isArray(e)?e:Object.values(e)).forEach(g=>{if(!oe(g,a)){t.onError?t.onError({type:"type",message:f("editor.upload.fileTypeNotSupported",{fileName:g.name}),file:g}):h({variant:"default",title:f("editor.upload.fileTypeNotSupported",{fileName:g.name})});return}if(g.size>c){const b=(c/1024/1024).toFixed(2);t.onError?t.onError({type:"size",message:f("editor.upload.fileSizeTooBig",{fileName:g.name,size:b}),file:g}):h({variant:"default",title:f("editor.upload.fileSizeTooBig",{fileName:g.name,size:b})});return}x.push(g)}),x}function ce({editor:e,imageInline:t,onClose:a,disabled:c,alt:f}){var r,I;const{t:h}=q.useLocale(),{toast:x}=ee.useToast(),[T,g]=o.useState(!1),[b,A]=o.useState(!1),j=o.useRef(null),[L,M]=o.useState(),[R,_]=o.useState(""),C=o.useRef(null),[S,N]=o.useState({src:"",file:null}),v=U.useExtension($.name),p=o.useMemo(()=>(v==null?void 0:v.options)??{},[v]);function u(i){if(j.current&&i.width&&i.height){const s=k(j.current,i);_(s)}}function k(i,s){const m=document.createElement("canvas"),l=i.naturalWidth/i.width,y=i.naturalHeight/i.height;m.width=s.width*l,m.height=s.height*y;const w=m.getContext("2d");return w&&(w.imageSmoothingEnabled=!1,w.drawImage(i,s.x*l,s.y*y,s.width*l,s.height*y,0,0,s.width*l,s.height*y)),m.toDataURL("image/png",1)}const D=o.useCallback(async()=>{var i;if(!b){A(!0);try{const s=Z.dataURLtoFile(R,((i=S==null?void 0:S.file)==null?void 0:i.name)||"image.png");let m="";p.upload?m=await p.upload(s):m=URL.createObjectURL(s),e.chain().focus().setImageInline({src:m,inline:t,alt:f}).run(),g(!1),N({src:"",file:null}),E(),a()}catch(s){console.log("Error cropping image",s)}finally{A(!1)}}},[R,e,t,b,a,(r=S==null?void 0:S.file)==null?void 0:r.name,p]);function F(i){var s;i.preventDefault(),(s=C.current)==null||s.click()}const d=async i=>{var w;const s=(w=i==null?void 0:i.target)==null?void 0:w.files;if(!e||e.isDestroyed||s.length===0){i.target.value="";return}const m=te(s,{acceptMimes:p==null?void 0:p.acceptMimes,maxSize:p==null?void 0:p.maxSize,t:h,toast:x,onError:p.onError});if(m.length<=0){i.target.value="";return}const l=m[0],y=await Z.readImageAsBase64(l);g(!0),N({src:y.src,file:l})},E=()=>{C.current&&(C.current.value="")};return n.jsxs(n.Fragment,{children:[n.jsx(B.Button,{className:"richtext-mt-1 richtext-w-full",disabled:c,onClick:F,size:"sm",children:h("editor.image.dialog.tab.uploadCrop")}),n.jsxs(z.Dialog,{open:T,onOpenChange:i=>{g(i),i||(N({src:"",file:null}),E())},children:[n.jsx(z.DialogTrigger,{}),n.jsxs(z.DialogContent,{children:[n.jsx(z.DialogTitle,{children:h("editor.image.dialog.tab.uploadCrop")}),n.jsx("div",{children:S.src&&n.jsx(ae,{className:"richtext-w-full",crop:L,onChange:i=>M(i),onComplete:i=>u(i),children:n.jsx("img",{alt:"Crop me",ref:j,src:S.src})})}),n.jsxs(z.DialogFooter,{children:[n.jsxs(B.Button,{disabled:b,onClick:()=>{g(!1),N({src:"",file:null}),E()},children:[h("editor.imageUpload.cancel"),n.jsx(P.IconComponent,{className:"richtext-ml-1",name:"Trash2"})]}),n.jsx(B.Button,{className:"richtext-w-fit",disabled:b||!L,onClick:D,children:b?n.jsxs(n.Fragment,{children:[h("editor.imageUpload.uploading"),n.jsx(P.IconComponent,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):n.jsxs(n.Fragment,{children:[h("editor.imageUpload.crop"),n.jsx(P.IconComponent,{className:"richtext-ml-1",name:"Crop"})]})})]})]})]}),n.jsx("input",{accept:((I=p==null?void 0:p.acceptMimes)==null?void 0:I.join(","))||"image/*",multiple:!1,onChange:d,ref:C,style:{display:"none"},type:"file"})]})}function ue(){const{t:e}=q.useLocale(),{toast:t}=ee.useToast(),a=U.useEditorInstance(),c=U.useButtonProps($.name),{icon:f,tooltip:h}=(c==null?void 0:c.componentProps)??{},{editorDisabled:x}=U.useToggleActive(),[T,g]=o.useState(!1),[b,A]=o.useState(!1),j=U.useExtension($.name),L=d=>{g(d.detail)},[M,R]=o.useState(""),[_,C]=o.useState(""),S=o.useRef(null),N=(j==null?void 0:j.options.defaultInline)||!1,[v,p]=o.useState(N),u=o.useMemo(()=>j==null?void 0:j.options,[j]);o.useEffect(()=>{const d=J.listenEvent(J.EVENTS.UPLOAD_IMAGE(a.id),L);return()=>{d()}},[]);async function k(d){var I;const E=(I=d==null?void 0:d.target)==null?void 0:I.files;if(!a||a.isDestroyed||E.length===0||b){d.target.value="";return}const r=te(E,{acceptMimes:u==null?void 0:u.acceptMimes,maxSize:u==null?void 0:u.maxSize,t:e,toast:t,onError:u.onError});if(r.length<=0){d.target.value="";return}A(!0);try{if(u!=null&&u.multiple){const i=r.map(async m=>{let l="";return u.upload?l=await u.upload(m):l=URL.createObjectURL(m),l});(await Promise.all(i)).forEach(m=>{a.chain().focus().setImageInline({src:m,inline:v,alt:_}).run()})}else{const i=r[0];let s="";u.upload?s=await u.upload(i):s=URL.createObjectURL(i),a.chain().focus().setImageInline({src:s,inline:v,alt:_}).run()}g(!1),C(""),p(N)}catch(i){console.error("Error uploading image",i),u.onError?u.onError({type:"upload",message:e("editor.upload.error")}):t({variant:"destructive",title:e("editor.upload.error")})}finally{A(!1),d.target.value=""}}function D(d){d.preventDefault(),d.stopPropagation(),a.chain().focus().setImageInline({src:M,inline:v,alt:_}).run(),g(!1),p(N),R(""),C("")}function F(d){var E;d.preventDefault(),(E=S.current)==null||E.click()}return c?n.jsxs(z.Dialog,{onOpenChange:g,open:T,children:[n.jsx(z.DialogTrigger,{asChild:!0,children:n.jsx(ie.ActionButton,{disabled:x,icon:f,tooltip:h,action:()=>{x||g(!0)}})}),n.jsxs(z.DialogContent,{children:[n.jsx(z.DialogTitle,{children:e("editor.image.dialog.title")}),n.jsxs(O.Tabs,{activationMode:"manual",defaultValue:u.resourceImage==="both"||u.resourceImage==="upload"?"upload":"link",children:[u.resourceImage==="both"&&n.jsxs(O.TabsList,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[n.jsx(O.TabsTrigger,{value:"upload",children:e("editor.image.dialog.tab.upload")}),n.jsx(O.TabsTrigger,{value:"link",children:e("editor.image.dialog.tab.url")})]}),n.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]",children:[n.jsx(se.Checkbox,{checked:v,onCheckedChange:d=>{p(d)}}),n.jsx(K.Label,{children:e("editor.link.dialog.inline")})]}),u.enableAlt&&n.jsxs("div",{className:"richtext-my-[10px] ",children:[n.jsx(K.Label,{className:"mb-[6px]",children:e("editor.imageUpload.alt")}),n.jsx(Q.Input,{onChange:d=>C(d.target.value),required:!0,type:"text",value:_})]}),n.jsxs(O.TabsContent,{value:"upload",children:[n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[n.jsx(B.Button,{className:"richtext-mt-1 richtext-w-full",disabled:b,onClick:F,size:"sm",children:b?n.jsxs(n.Fragment,{children:[e("editor.imageUpload.uploading"),n.jsx(P.IconComponent,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):e("editor.image.dialog.tab.upload")}),n.jsx(ce,{alt:_,disabled:b,editor:a,imageInline:v,onClose:()=>{re.actionDialogImage.setOpen(a.id,!1),C("")}})]}),n.jsx("input",{accept:u.acceptMimes.join(",")||"image/*",multiple:u.multiple,onChange:k,ref:S,style:{display:"none"},type:"file"})]}),n.jsx(O.TabsContent,{value:"link",children:n.jsx("form",{onSubmit:D,children:n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[n.jsx(Q.Input,{autoFocus:!0,onChange:d=>R(d.target.value),placeholder:e("editor.image.dialog.placeholder"),required:!0,type:"url",value:M}),n.jsx(B.Button,{type:"submit",children:e("editor.image.dialog.button.apply")})]})})})]})]})]}):n.jsx(n.Fragment,{})}const de={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,multiple:!0,resourceImage:"both",defaultInline:!1,enableAlt:!0},$=W.index_default.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var e;return{...de,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:a,t:c})=>{var f,h;return{componentProps:{action:()=>!0,upload:a.options.upload,disabled:!((h=(f=t.can()).setImage)!=null&&h.call(f,{})),icon:"ImageUp",tooltip:c("editor.image.tooltip")}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:t=>{const a=t.style.width||t.getAttribute("width")||null;return a?Number.parseInt(a,10):null},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})},inline:{default:!1,parseHTML:t=>!!t.getAttribute("inline"),renderHTML:t=>({inline:t.inline})},alt:{default:"",parseHTML:t=>t.getAttribute("alt"),renderHTML:t=>({alt:t.alt})}}},addNodeView(){return G.ReactNodeViewRenderer(le)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageInline:t=>({commands:a})=>a.insertContent({type:this.name,attrs:{...t,inline:t.inline??this.options.defaultInline}}),updateImage:t=>({commands:a})=>a.updateAttributes(this.name,t),setAlignImage:t=>({commands:a})=>a.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{flipX:t,flipY:a,align:c,inline:f}=e,h=f&&(c==="left"||c==="right"),x=t||a?`transform: rotateX(${t?"180":"0"}deg) rotateY(${a?"180":"0"}deg);`:"",T=h?"":`text-align: ${c};`,A=`${h?`float: ${c};`:""}${h?c==="left"?"margin: 1em 1em 1em 0;":"margin: 1em 0 1em 1em;":""}${x}`;return[f?"span":"div",{style:T,class:"image"},["img",G.mergeAttributes({height:"auto",style:A},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"span.image img",getAttrs:e=>{var h;const t=e==null?void 0:e.parentElement,a=e==null?void 0:e.getAttribute("width"),c=(e==null?void 0:e.getAttribute("flipx"))||!1,f=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:a?Number.parseInt(a,10):null,align:(e==null?void 0:e.getAttribute("align"))||((h=t==null?void 0:t.style)==null?void 0:h.textAlign)||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:c==="true",flipY:f==="true"}}},{tag:"div[class=image]",getAttrs:e=>{const t=e.querySelector("img"),a=t==null?void 0:t.getAttribute("width"),c=(t==null?void 0:t.getAttribute("flipx"))||!1,f=(t==null?void 0:t.getAttribute("flipy"))||!1;return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),caption:t==null?void 0:t.getAttribute("caption"),width:a?Number.parseInt(a,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null,inline:(t==null?void 0:t.getAttribute("inline"))||!1,flipX:c==="true",flipY:f==="true"}}},{tag:'img[src]:not([src^="data:"])'}]}});exports.Image=$;exports.RichTextImage=ue;
package/lib/Image.js CHANGED
@@ -2,23 +2,23 @@ import { s as he, m as fe, R as ge } from "./index-nFjllrEl.js";
2
2
  import { a as q, c as pe } from "./throttle-CGM5M2yG.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-DGihe-wH.js";
5
+ import { I as Z, j as J, k as be, u as ne } from "./index-0OnGZkVF.js";
6
6
  import { i as K, c as xe } from "./isNumber-CTm1pIvN.js";
7
- import { A as ye } from "./toggle-WBgzE8Jm.js";
8
- import "./index--XZPCi0O.js";
9
- import { D as re, a as le, b as oe, c as se, d as we } from "./dialog-CzZSyyxS.js";
7
+ import { A as ye } from "./toggle-xchtz-Kf.js";
8
+ import "./index-DuZCJJSp.js";
9
+ import { D as re, a as le, b as oe, c as se, d as we } from "./dialog-Ce9Cjfft.js";
10
10
  import Ie from "react-image-crop";
11
- import { B } from "./button-BnN1L5_T.js";
11
+ import { B } from "./button-Crm67hfl.js";
12
12
  import { d as ve, r as Te } from "./file-BLas99n7.js";
13
- import { d as ce, c as Ae, u as Ce, a as Ee } from "./useButtonProps-BIOoOg6h.js";
13
+ import { d as ce, c as Ae, u as Ce, a as Ee } from "./useButtonProps-D0SrPzuG.js";
14
14
  import { u as de } from "./use-toast-Crf7-q5H.js";
15
- import { I as $ } from "./Icon-1z7VnLgz.js";
16
- import { a as Me } from "./store-BVm_SgvL.js";
17
- import { l as Le, E as Ne } from "./events.constant-CBPIqO_g.js";
18
- import { T as Se, a as _e, b as Q, c as ee } from "./tabs-p4pJGb6o.js";
19
- import { C as ze } from "./checkbox-sSQSzjls.js";
20
- import { L as te } from "./label-BX7OqM6p.js";
21
- import { I as ie } from "./input-Byg4PPou.js";
15
+ import { I as $ } from "./Icon-C-qYUAS1.js";
16
+ import { a as Me } from "./store-ibARMQ3h.js";
17
+ import { l as Le, E as Ne } from "./events.constant-wrlJ_7JZ.js";
18
+ import { T as Se, a as _e, b as Q, c as ee } from "./tabs-DrkJL_C2.js";
19
+ import { C as ze } from "./checkbox-DViVmgJ6.js";
20
+ import { L as te } from "./label-DC33TZy_.js";
21
+ import { I as ie } from "./input-DfqFAyKo.js";
22
22
  const X = {
23
23
  TOP_LEFT: "tl",
24
24
  TOP_RIGHT: "tr",
package/lib/ImageGif.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("./index-DLqogznp.cjs"),N=require("./throttle-DXN-aiH5.cjs"),l=require("react/jsx-runtime"),u=require("react"),G=require("./index-D4d-0Hqh.cjs"),L=require("./isNumber-C2saEiG2.cjs"),W=require("./toggle-DUPu3nnZ.cjs");require("./index-CnbtiTqP.cjs");const k=require("./useButtonProps-C4SCmCVo.cjs"),P=require("./popover-DVD1y8Z_.cjs"),D=require("./input-Dikmsjjj.cjs"),S={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function B(e){var z,C;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}=(z=e==null?void 0:e.node)==null?void 0:z.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}}},[(C=e==null?void 0:e.node)==null?void 0:C.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,_]),q=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?q():O(),()=>{O()}),[s,q,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 $=require("./index-DLqogznp.cjs"),N=require("./throttle-DXN-aiH5.cjs"),l=require("react/jsx-runtime"),u=require("react"),G=require("./index-FSRjMsxW.cjs"),L=require("./isNumber-C2saEiG2.cjs"),W=require("./toggle-DVCNvcqp.cjs");require("./index-CNzHZDls.cjs");const k=require("./useButtonProps-bei1vI37.cjs"),P=require("./popover-CZWSQZ0q.cjs"),D=require("./input-tU3H__39.cjs"),S={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function B(e){var z,C;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}=(z=e==null?void 0:e.node)==null?void 0:z.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}}},[(C=e==null?void 0:e.node)==null?void 0:C.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,_]),q=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?q():O(),()=>{O()}),[s,q,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;
package/lib/ImageGif.js CHANGED
@@ -2,13 +2,13 @@ import { s as B, m as q, R as V } from "./index-nFjllrEl.js";
2
2
  import { a as H, d as X, c as Y } from "./throttle-CGM5M2yG.js";
3
3
  import { jsx as u, jsxs as P, Fragment as Z } from "react/jsx-runtime";
4
4
  import { useState as G, useMemo as L, useCallback as M, useEffect as z, useRef as U } from "react";
5
- import { I as C, j, k as J } from "./index-DGihe-wH.js";
5
+ import { I as C, j, k as J } from "./index-0OnGZkVF.js";
6
6
  import { i as W, c as Q } from "./isNumber-CTm1pIvN.js";
7
- import { A as K } from "./toggle-WBgzE8Jm.js";
8
- import "./index--XZPCi0O.js";
9
- import { u as ee, a as D } from "./useButtonProps-BIOoOg6h.js";
10
- import { P as te, a as re, b as ne } from "./popover-CheVmqgb.js";
11
- import { I as ie } from "./input-Byg4PPou.js";
7
+ import { A as K } from "./toggle-xchtz-Kf.js";
8
+ import "./index-DuZCJJSp.js";
9
+ import { u as ee, a as D } from "./useButtonProps-D0SrPzuG.js";
10
+ import { P as te, a as re, b as ne } from "./popover-CoepUobG.js";
11
+ import { I as ie } from "./input-DfqFAyKo.js";
12
12
  const O = {
13
13
  TOP_LEFT: "tl",
14
14
  TOP_RIGHT: "tr",
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Cs=require("./index-DLqogznp.cjs"),Wn=require("react/jsx-runtime"),xa=require("react"),nn=require("./_commonjsHelpers-BTDuMlIz.cjs"),Ss=require("./toggle-DUPu3nnZ.cjs");require("./index-CnbtiTqP.cjs");const Xn=require("./useButtonProps-C4SCmCVo.cjs"),Bs=require("./index-D4d-0Hqh.cjs"),ks=require("./use-toast-Bz3QCOtE.cjs");var Ve={},Si="1.13.7",_a=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},Yt=Array.prototype,Bi=Object.prototype,Ua=typeof Symbol<"u"?Symbol.prototype:null,Ws=Yt.push,ct=Yt.slice,nt=Bi.toString,Rs=Bi.hasOwnProperty,jc=typeof ArrayBuffer<"u",Os=typeof DataView<"u",Ns=Array.isArray,Ta=Object.keys,wa=Object.create,Ea=jc&&ArrayBuffer.isView,Is=isNaN,Ls=isFinite,Xc=!{toString:null}.propertyIsEnumerable("toString"),Aa=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Ms=Math.pow(2,53)-1;function Me(e,n){return n=n==null?e.length-1:+n,function(){for(var t=Math.max(arguments.length-n,0),r=Array(t),c=0;c<t;c++)r[c]=arguments[c+n];switch(n){case 0:return e.call(this,r);case 1:return e.call(this,arguments[0],r);case 2:return e.call(this,arguments[0],arguments[1],r)}var i=Array(n+1);for(c=0;c<n;c++)i[c]=arguments[c];return i[n]=r,e.apply(this,i)}}function pn(e){var n=typeof e;return n==="function"||n==="object"&&!!e}function Vc(e){return e===null}function ki(e){return e===void 0}function Wi(e){return e===!0||e===!1||nt.call(e)==="[object Boolean]"}function Hc(e){return!!(e&&e.nodeType===1)}function Le(e){var n="[object "+e+"]";return function(t){return nt.call(t)===n}}const $t=Le("String"),Ri=Le("Number"),Gc=Le("Date"),Zc=Le("RegExp"),Yc=Le("Error"),Oi=Le("Symbol"),Ni=Le("ArrayBuffer");var $c=Le("Function"),qs=_a.document&&_a.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof qs!="function"&&($c=function(e){return typeof e=="function"||!1});const Ie=$c,Kc=Le("Object");var Qc=Os&&(!/\[native code\]/.test(String(DataView))||Kc(new DataView(new ArrayBuffer(8)))),Ii=typeof Map<"u"&&Kc(new Map),Ps=Le("DataView");function zs(e){return e!=null&&Ie(e.getInt8)&&Ni(e.buffer)}const tt=Qc?zs:Ps,gn=Ns||Le("Array");function mn(e,n){return e!=null&&Rs.call(e,n)}var Ei=Le("Arguments");(function(){Ei(arguments)||(Ei=function(e){return mn(e,"callee")})})();const Kt=Ei;function Jc(e){return!Oi(e)&&Ls(e)&&!isNaN(parseFloat(e))}function Li(e){return Ri(e)&&Is(e)}function Mi(e){return function(){return e}}function eu(e){return function(n){var t=e(n);return typeof t=="number"&&t>=0&&t<=Ms}}function nu(e){return function(n){return n==null?void 0:n[e]}}const Xt=nu("byteLength"),js=eu(Xt);var Xs=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function Vs(e){return Ea?Ea(e)&&!tt(e):js(e)&&Xs.test(nt.call(e))}const qi=jc?Vs:Mi(!1),Pe=nu("length");function Hs(e){for(var n={},t=e.length,r=0;r<t;++r)n[e[r]]=!0;return{contains:function(c){return n[c]===!0},push:function(c){return n[c]=!0,e.push(c)}}}function tu(e,n){n=Hs(n);var t=Aa.length,r=e.constructor,c=Ie(r)&&r.prototype||Bi,i="constructor";for(mn(e,i)&&!n.contains(i)&&n.push(i);t--;)i=Aa[t],i in e&&e[i]!==c[i]&&!n.contains(i)&&n.push(i)}function We(e){if(!pn(e))return[];if(Ta)return Ta(e);var n=[];for(var t in e)mn(e,t)&&n.push(t);return Xc&&tu(e,n),n}function ru(e){if(e==null)return!0;var n=Pe(e);return typeof n=="number"&&(gn(e)||$t(e)||Kt(e))?n===0:Pe(We(e))===0}function Pi(e,n){var t=We(n),r=t.length;if(e==null)return!r;for(var c=Object(e),i=0;i<r;i++){var o=t[i];if(n[o]!==c[o]||!(o in c))return!1}return!0}function Ae(e){if(e instanceof Ae)return e;if(!(this instanceof Ae))return new Ae(e);this._wrapped=e}Ae.VERSION=Si;Ae.prototype.value=function(){return this._wrapped};Ae.prototype.valueOf=Ae.prototype.toJSON=Ae.prototype.value;Ae.prototype.toString=function(){return String(this._wrapped)};function Fa(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,Xt(e))}var Ca="[object DataView]";function Ai(e,n,t,r){if(e===n)return e!==0||1/e===1/n;if(e==null||n==null)return!1;if(e!==e)return n!==n;var c=typeof e;return c!=="function"&&c!=="object"&&typeof n!="object"?!1:iu(e,n,t,r)}function iu(e,n,t,r){e instanceof Ae&&(e=e._wrapped),n instanceof Ae&&(n=n._wrapped);var c=nt.call(e);if(c!==nt.call(n))return!1;if(Qc&&c=="[object Object]"&&tt(e)){if(!tt(n))return!1;c=Ca}switch(c){case"[object RegExp]":case"[object String]":return""+e==""+n;case"[object Number]":return+e!=+e?+n!=+n:+e==0?1/+e===1/n:+e==+n;case"[object Date]":case"[object Boolean]":return+e==+n;case"[object Symbol]":return Ua.valueOf.call(e)===Ua.valueOf.call(n);case"[object ArrayBuffer]":case Ca:return iu(Fa(e),Fa(n),t,r)}var i=c==="[object Array]";if(!i&&qi(e)){var o=Xt(e);if(o!==Xt(n))return!1;if(e.buffer===n.buffer&&e.byteOffset===n.byteOffset)return!0;i=!0}if(!i){if(typeof e!="object"||typeof n!="object")return!1;var a=e.constructor,u=n.constructor;if(a!==u&&!(Ie(a)&&a instanceof a&&Ie(u)&&u instanceof u)&&"constructor"in e&&"constructor"in n)return!1}t=t||[],r=r||[];for(var f=t.length;f--;)if(t[f]===e)return r[f]===n;if(t.push(e),r.push(n),i){if(f=e.length,f!==n.length)return!1;for(;f--;)if(!Ai(e[f],n[f],t,r))return!1}else{var b=We(e),g;if(f=b.length,We(n).length!==f)return!1;for(;f--;)if(g=b[f],!(mn(n,g)&&Ai(e[g],n[g],t,r)))return!1}return t.pop(),r.pop(),!0}function au(e,n){return Ai(e,n)}function Pn(e){if(!pn(e))return[];var n=[];for(var t in e)n.push(t);return Xc&&tu(e,n),n}function zi(e){var n=Pe(e);return function(t){if(t==null)return!1;var r=Pn(t);if(Pe(r))return!1;for(var c=0;c<n;c++)if(!Ie(t[e[c]]))return!1;return e!==uu||!Ie(t[ji])}}var ji="forEach",ou="has",Xi=["clear","delete"],cu=["get",ou,"set"],Gs=Xi.concat(ji,cu),uu=Xi.concat(cu),Zs=["add"].concat(Xi,ji,ou);const su=Ii?zi(Gs):Le("Map"),du=Ii?zi(uu):Le("WeakMap"),lu=Ii?zi(Zs):Le("Set"),fu=Le("WeakSet");function Fn(e){for(var n=We(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=e[n[c]];return r}function hu(e){for(var n=We(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=[n[c],e[n[c]]];return r}function Vi(e){for(var n={},t=We(e),r=0,c=t.length;r<c;r++)n[e[t[r]]]=t[r];return n}function rt(e){var n=[];for(var t in e)Ie(e[t])&&n.push(t);return n.sort()}function Hi(e,n){return function(t){var r=arguments.length;if(n&&(t=Object(t)),r<2||t==null)return t;for(var c=1;c<r;c++)for(var i=arguments[c],o=e(i),a=o.length,u=0;u<a;u++){var f=o[u];(!n||t[f]===void 0)&&(t[f]=i[f])}return t}}const Gi=Hi(Pn),Mn=Hi(We),Zi=Hi(Pn,!0);function Ys(){return function(){}}function pu(e){if(!pn(e))return{};if(wa)return wa(e);var n=Ys();n.prototype=e;var t=new n;return n.prototype=null,t}function gu(e,n){var t=pu(e);return n&&Mn(t,n),t}function mu(e){return pn(e)?gn(e)?e.slice():Gi({},e):e}function bu(e,n){return n(e),e}function Yi(e){return gn(e)?e:[e]}Ae.toPath=Yi;function ut(e){return Ae.toPath(e)}function $i(e,n){for(var t=n.length,r=0;r<t;r++){if(e==null)return;e=e[n[r]]}return t?e:void 0}function Ki(e,n,t){var r=$i(e,ut(n));return ki(r)?t:r}function yu(e,n){n=ut(n);for(var t=n.length,r=0;r<t;r++){var c=n[r];if(!mn(e,c))return!1;e=e[c]}return!!t}function Qt(e){return e}function An(e){return e=Mn({},e),function(n){return Pi(n,e)}}function Jt(e){return e=ut(e),function(n){return $i(n,e)}}function st(e,n,t){if(n===void 0)return e;switch(t??3){case 1:return function(r){return e.call(n,r)};case 3:return function(r,c,i){return e.call(n,r,c,i)};case 4:return function(r,c,i,o){return e.call(n,r,c,i,o)}}return function(){return e.apply(n,arguments)}}function Du(e,n,t){return e==null?Qt:Ie(e)?st(e,n,t):pn(e)&&!gn(e)?An(e):Jt(e)}function er(e,n){return Du(e,n,1/0)}Ae.iteratee=er;function ze(e,n,t){return Ae.iteratee!==er?Ae.iteratee(e,n):Du(e,n,t)}function vu(e,n,t){n=ze(n,t);for(var r=We(e),c=r.length,i={},o=0;o<c;o++){var a=r[o];i[a]=n(e[a],a,e)}return i}function Qi(){}function xu(e){return e==null?Qi:function(n){return Ki(e,n)}}function _u(e,n,t){var r=Array(Math.max(0,e));n=st(n,t,1);for(var c=0;c<e;c++)r[c]=n(c);return r}function Vt(e,n){return n==null&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))}const qn=Date.now||function(){return new Date().getTime()};function Uu(e){var n=function(i){return e[i]},t="(?:"+We(e).join("|")+")",r=RegExp(t),c=RegExp(t,"g");return function(i){return i=i==null?"":""+i,r.test(i)?i.replace(c,n):i}}const Tu={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},wu=Uu(Tu),$s=Vi(Tu),Eu=Uu($s),Au=Ae.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var vr=/(.)^/,Ks={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Qs=/\\|'|\r|\n|\u2028|\u2029/g;function Js(e){return"\\"+Ks[e]}var ed=/^\s*(\w|\$)+\s*$/;function Fu(e,n,t){!n&&t&&(n=t),n=Zi({},n,Ae.templateSettings);var r=RegExp([(n.escape||vr).source,(n.interpolate||vr).source,(n.evaluate||vr).source].join("|")+"|$","g"),c=0,i="__p+='";e.replace(r,function(f,b,g,m,h){return i+=e.slice(c,h).replace(Qs,Js),c=h+f.length,b?i+=`'+
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Cs=require("./index-DLqogznp.cjs"),Wn=require("react/jsx-runtime"),xa=require("react"),nn=require("./_commonjsHelpers-BTDuMlIz.cjs"),Ss=require("./toggle-DVCNvcqp.cjs");require("./index-CNzHZDls.cjs");const Xn=require("./useButtonProps-bei1vI37.cjs"),Bs=require("./index-FSRjMsxW.cjs"),ks=require("./use-toast-Bz3QCOtE.cjs");var Ve={},Si="1.13.7",_a=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},Yt=Array.prototype,Bi=Object.prototype,Ua=typeof Symbol<"u"?Symbol.prototype:null,Ws=Yt.push,ct=Yt.slice,nt=Bi.toString,Rs=Bi.hasOwnProperty,jc=typeof ArrayBuffer<"u",Os=typeof DataView<"u",Ns=Array.isArray,Ta=Object.keys,wa=Object.create,Ea=jc&&ArrayBuffer.isView,Is=isNaN,Ls=isFinite,Xc=!{toString:null}.propertyIsEnumerable("toString"),Aa=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Ms=Math.pow(2,53)-1;function Me(e,n){return n=n==null?e.length-1:+n,function(){for(var t=Math.max(arguments.length-n,0),r=Array(t),c=0;c<t;c++)r[c]=arguments[c+n];switch(n){case 0:return e.call(this,r);case 1:return e.call(this,arguments[0],r);case 2:return e.call(this,arguments[0],arguments[1],r)}var i=Array(n+1);for(c=0;c<n;c++)i[c]=arguments[c];return i[n]=r,e.apply(this,i)}}function pn(e){var n=typeof e;return n==="function"||n==="object"&&!!e}function Vc(e){return e===null}function ki(e){return e===void 0}function Wi(e){return e===!0||e===!1||nt.call(e)==="[object Boolean]"}function Hc(e){return!!(e&&e.nodeType===1)}function Le(e){var n="[object "+e+"]";return function(t){return nt.call(t)===n}}const $t=Le("String"),Ri=Le("Number"),Gc=Le("Date"),Zc=Le("RegExp"),Yc=Le("Error"),Oi=Le("Symbol"),Ni=Le("ArrayBuffer");var $c=Le("Function"),qs=_a.document&&_a.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof qs!="function"&&($c=function(e){return typeof e=="function"||!1});const Ie=$c,Kc=Le("Object");var Qc=Os&&(!/\[native code\]/.test(String(DataView))||Kc(new DataView(new ArrayBuffer(8)))),Ii=typeof Map<"u"&&Kc(new Map),Ps=Le("DataView");function zs(e){return e!=null&&Ie(e.getInt8)&&Ni(e.buffer)}const tt=Qc?zs:Ps,gn=Ns||Le("Array");function mn(e,n){return e!=null&&Rs.call(e,n)}var Ei=Le("Arguments");(function(){Ei(arguments)||(Ei=function(e){return mn(e,"callee")})})();const Kt=Ei;function Jc(e){return!Oi(e)&&Ls(e)&&!isNaN(parseFloat(e))}function Li(e){return Ri(e)&&Is(e)}function Mi(e){return function(){return e}}function eu(e){return function(n){var t=e(n);return typeof t=="number"&&t>=0&&t<=Ms}}function nu(e){return function(n){return n==null?void 0:n[e]}}const Xt=nu("byteLength"),js=eu(Xt);var Xs=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function Vs(e){return Ea?Ea(e)&&!tt(e):js(e)&&Xs.test(nt.call(e))}const qi=jc?Vs:Mi(!1),Pe=nu("length");function Hs(e){for(var n={},t=e.length,r=0;r<t;++r)n[e[r]]=!0;return{contains:function(c){return n[c]===!0},push:function(c){return n[c]=!0,e.push(c)}}}function tu(e,n){n=Hs(n);var t=Aa.length,r=e.constructor,c=Ie(r)&&r.prototype||Bi,i="constructor";for(mn(e,i)&&!n.contains(i)&&n.push(i);t--;)i=Aa[t],i in e&&e[i]!==c[i]&&!n.contains(i)&&n.push(i)}function We(e){if(!pn(e))return[];if(Ta)return Ta(e);var n=[];for(var t in e)mn(e,t)&&n.push(t);return Xc&&tu(e,n),n}function ru(e){if(e==null)return!0;var n=Pe(e);return typeof n=="number"&&(gn(e)||$t(e)||Kt(e))?n===0:Pe(We(e))===0}function Pi(e,n){var t=We(n),r=t.length;if(e==null)return!r;for(var c=Object(e),i=0;i<r;i++){var o=t[i];if(n[o]!==c[o]||!(o in c))return!1}return!0}function Ae(e){if(e instanceof Ae)return e;if(!(this instanceof Ae))return new Ae(e);this._wrapped=e}Ae.VERSION=Si;Ae.prototype.value=function(){return this._wrapped};Ae.prototype.valueOf=Ae.prototype.toJSON=Ae.prototype.value;Ae.prototype.toString=function(){return String(this._wrapped)};function Fa(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,Xt(e))}var Ca="[object DataView]";function Ai(e,n,t,r){if(e===n)return e!==0||1/e===1/n;if(e==null||n==null)return!1;if(e!==e)return n!==n;var c=typeof e;return c!=="function"&&c!=="object"&&typeof n!="object"?!1:iu(e,n,t,r)}function iu(e,n,t,r){e instanceof Ae&&(e=e._wrapped),n instanceof Ae&&(n=n._wrapped);var c=nt.call(e);if(c!==nt.call(n))return!1;if(Qc&&c=="[object Object]"&&tt(e)){if(!tt(n))return!1;c=Ca}switch(c){case"[object RegExp]":case"[object String]":return""+e==""+n;case"[object Number]":return+e!=+e?+n!=+n:+e==0?1/+e===1/n:+e==+n;case"[object Date]":case"[object Boolean]":return+e==+n;case"[object Symbol]":return Ua.valueOf.call(e)===Ua.valueOf.call(n);case"[object ArrayBuffer]":case Ca:return iu(Fa(e),Fa(n),t,r)}var i=c==="[object Array]";if(!i&&qi(e)){var o=Xt(e);if(o!==Xt(n))return!1;if(e.buffer===n.buffer&&e.byteOffset===n.byteOffset)return!0;i=!0}if(!i){if(typeof e!="object"||typeof n!="object")return!1;var a=e.constructor,u=n.constructor;if(a!==u&&!(Ie(a)&&a instanceof a&&Ie(u)&&u instanceof u)&&"constructor"in e&&"constructor"in n)return!1}t=t||[],r=r||[];for(var f=t.length;f--;)if(t[f]===e)return r[f]===n;if(t.push(e),r.push(n),i){if(f=e.length,f!==n.length)return!1;for(;f--;)if(!Ai(e[f],n[f],t,r))return!1}else{var b=We(e),g;if(f=b.length,We(n).length!==f)return!1;for(;f--;)if(g=b[f],!(mn(n,g)&&Ai(e[g],n[g],t,r)))return!1}return t.pop(),r.pop(),!0}function au(e,n){return Ai(e,n)}function Pn(e){if(!pn(e))return[];var n=[];for(var t in e)n.push(t);return Xc&&tu(e,n),n}function zi(e){var n=Pe(e);return function(t){if(t==null)return!1;var r=Pn(t);if(Pe(r))return!1;for(var c=0;c<n;c++)if(!Ie(t[e[c]]))return!1;return e!==uu||!Ie(t[ji])}}var ji="forEach",ou="has",Xi=["clear","delete"],cu=["get",ou,"set"],Gs=Xi.concat(ji,cu),uu=Xi.concat(cu),Zs=["add"].concat(Xi,ji,ou);const su=Ii?zi(Gs):Le("Map"),du=Ii?zi(uu):Le("WeakMap"),lu=Ii?zi(Zs):Le("Set"),fu=Le("WeakSet");function Fn(e){for(var n=We(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=e[n[c]];return r}function hu(e){for(var n=We(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=[n[c],e[n[c]]];return r}function Vi(e){for(var n={},t=We(e),r=0,c=t.length;r<c;r++)n[e[t[r]]]=t[r];return n}function rt(e){var n=[];for(var t in e)Ie(e[t])&&n.push(t);return n.sort()}function Hi(e,n){return function(t){var r=arguments.length;if(n&&(t=Object(t)),r<2||t==null)return t;for(var c=1;c<r;c++)for(var i=arguments[c],o=e(i),a=o.length,u=0;u<a;u++){var f=o[u];(!n||t[f]===void 0)&&(t[f]=i[f])}return t}}const Gi=Hi(Pn),Mn=Hi(We),Zi=Hi(Pn,!0);function Ys(){return function(){}}function pu(e){if(!pn(e))return{};if(wa)return wa(e);var n=Ys();n.prototype=e;var t=new n;return n.prototype=null,t}function gu(e,n){var t=pu(e);return n&&Mn(t,n),t}function mu(e){return pn(e)?gn(e)?e.slice():Gi({},e):e}function bu(e,n){return n(e),e}function Yi(e){return gn(e)?e:[e]}Ae.toPath=Yi;function ut(e){return Ae.toPath(e)}function $i(e,n){for(var t=n.length,r=0;r<t;r++){if(e==null)return;e=e[n[r]]}return t?e:void 0}function Ki(e,n,t){var r=$i(e,ut(n));return ki(r)?t:r}function yu(e,n){n=ut(n);for(var t=n.length,r=0;r<t;r++){var c=n[r];if(!mn(e,c))return!1;e=e[c]}return!!t}function Qt(e){return e}function An(e){return e=Mn({},e),function(n){return Pi(n,e)}}function Jt(e){return e=ut(e),function(n){return $i(n,e)}}function st(e,n,t){if(n===void 0)return e;switch(t??3){case 1:return function(r){return e.call(n,r)};case 3:return function(r,c,i){return e.call(n,r,c,i)};case 4:return function(r,c,i,o){return e.call(n,r,c,i,o)}}return function(){return e.apply(n,arguments)}}function Du(e,n,t){return e==null?Qt:Ie(e)?st(e,n,t):pn(e)&&!gn(e)?An(e):Jt(e)}function er(e,n){return Du(e,n,1/0)}Ae.iteratee=er;function ze(e,n,t){return Ae.iteratee!==er?Ae.iteratee(e,n):Du(e,n,t)}function vu(e,n,t){n=ze(n,t);for(var r=We(e),c=r.length,i={},o=0;o<c;o++){var a=r[o];i[a]=n(e[a],a,e)}return i}function Qi(){}function xu(e){return e==null?Qi:function(n){return Ki(e,n)}}function _u(e,n,t){var r=Array(Math.max(0,e));n=st(n,t,1);for(var c=0;c<e;c++)r[c]=n(c);return r}function Vt(e,n){return n==null&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))}const qn=Date.now||function(){return new Date().getTime()};function Uu(e){var n=function(i){return e[i]},t="(?:"+We(e).join("|")+")",r=RegExp(t),c=RegExp(t,"g");return function(i){return i=i==null?"":""+i,r.test(i)?i.replace(c,n):i}}const Tu={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},wu=Uu(Tu),$s=Vi(Tu),Eu=Uu($s),Au=Ae.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var vr=/(.)^/,Ks={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Qs=/\\|'|\r|\n|\u2028|\u2029/g;function Js(e){return"\\"+Ks[e]}var ed=/^\s*(\w|\$)+\s*$/;function Fu(e,n,t){!n&&t&&(n=t),n=Zi({},n,Ae.templateSettings);var r=RegExp([(n.escape||vr).source,(n.interpolate||vr).source,(n.evaluate||vr).source].join("|")+"|$","g"),c=0,i="__p+='";e.replace(r,function(f,b,g,m,h){return i+=e.slice(c,h).replace(Qs,Js),c=h+f.length,b?i+=`'+
2
2
  ((__t=(`+b+`))==null?'':_.escape(__t))+
3
3
  '`:g?i+=`'+
4
4
  ((__t=(`+g+`))==null?'':__t)+
package/lib/ImportWord.js CHANGED
@@ -2,10 +2,10 @@ import { E as Fs } from "./index-nFjllrEl.js";
2
2
  import { jsx as yr, Fragment as Da, jsxs as Cs } from "react/jsx-runtime";
3
3
  import { useState as Ss, useRef as Bs } from "react";
4
4
  import { g as ks, c as ln, a as Ws } from "./_commonjsHelpers-BItOPCY9.js";
5
- import { A as Rs } from "./toggle-WBgzE8Jm.js";
6
- import "./index--XZPCi0O.js";
7
- import { c as Ns, u as Os, a as Is, d as Ls, j as Ms } from "./useButtonProps-BIOoOg6h.js";
8
- import { u as qs } from "./index-DGihe-wH.js";
5
+ import { A as Rs } from "./toggle-xchtz-Kf.js";
6
+ import "./index-DuZCJJSp.js";
7
+ import { c as Ns, u as Os, a as Is, d as Ls, j as Ms } from "./useButtonProps-D0SrPzuG.js";
8
+ import { u as qs } from "./index-0OnGZkVF.js";
9
9
  import { u as Ps } from "./use-toast-Crf7-q5H.js";
10
10
  var Ve = {}, Fi = "1.13.7", va = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || Function("return this")() || {}, Gt = Array.prototype, Ci = Object.prototype, xa = typeof Symbol < "u" ? Symbol.prototype : null, zs = Gt.push, at = Gt.slice, Jn = Ci.toString, js = Ci.hasOwnProperty, zc = typeof ArrayBuffer < "u", Xs = typeof DataView < "u", Vs = Array.isArray, _a = Object.keys, Ua = Object.create, Ta = zc && ArrayBuffer.isView, Hs = isNaN, Gs = isFinite, jc = !{ toString: null }.propertyIsEnumerable("toString"), wa = [
11
11
  "valueOf",
@@ -1 +1 @@
1
- "use strict";const h=require("./index-DLqogznp.cjs"),m=require("@tiptap/pm/state"),c=require("react/jsx-runtime"),l=require("./toggle-DUPu3nnZ.cjs");require("react");require("./index-CnbtiTqP.cjs");const p=require("./useButtonProps-C4SCmCVo.cjs");var a=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(a||{});function T(t,e,n){return t<e?e:t>n?n:t}function g(t,e,n,o){const{doc:s,selection:r}=t;if(!s||!r||!(r instanceof m.TextSelection||r instanceof m.AllSelection))return t;const{from:i,to:u}=r;return s.nodesBetween(i,u,(d,I)=>{const b=d.type;return n.includes(b.name)?(t=y(t,I,e),!1):!h.isList(d.type.name,o.extensionManager.extensions)}),t}function y(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o)return t;const i=T((o.attrs.indent||0)+n,0,7);if(i===o.attrs.indent)return t;const u={...o.attrs,indent:i};return t.setNodeMarkup(e,o.type,u,o.marks)}function f({delta:t,types:e}){return({state:n,dispatch:o,editor:s})=>{const{selection:r}=n;let{tr:i}=n;return i=i.setSelection(r),i=g(i,t,e,s),i.docChanged?(o&&o(i),!0):!1}}function A(){const t=p.useButtonProps(x.name),{indent:e,outdent:n}=(t==null?void 0:t.componentProps)??{},{editorDisabled:o}=p.useToggleActive(),s=()=>{o||e!=null&&e.action&&(e==null||e.action())},r=()=>{o||n!=null&&n.action&&(n==null||n.action())};return t?c.jsxs(c.Fragment,{children:[c.jsx(l.ActionButton,{action:s,disabled:o,icon:e==null?void 0:e.icon,shortcutKeys:e==null?void 0:e.shortcutKeys,tooltip:e==null?void 0:e.tooltip}),c.jsx(l.ActionButton,{action:r,disabled:o,icon:n==null?void 0:n.icon,shortcutKeys:n==null?void 0:n.shortcutKeys,tooltip:n==null?void 0:n.tooltip})]}):c.jsx(c.Fragment,{})}const x=h.Extension.create({name:"richtextIndentOutdent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:a.min,maxIndent:a.max,button({editor:e,t:n,extension:o}){var s,r;return{componentProps:{indent:{action:()=>{e.commands.indent()},shortcutKeys:((s=o.options.shortcutKeys)==null?void 0:s[0])??["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")},outdent:{action:()=>{e.commands.outdent()},shortcutKeys:((r=o.options.shortcutKeys)==null?void 0:r[1])??["Shift","Tab"],icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.dataset.indent;return(e?Number.parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>f({delta:a.more,types:this.options.types}),outdent:()=>f({delta:a.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});exports.Indent=x;exports.IndentProps=a;exports.RichTextIndent=A;exports.setNodeIndentMarkup=y;
1
+ "use strict";const h=require("./index-DLqogznp.cjs"),m=require("@tiptap/pm/state"),c=require("react/jsx-runtime"),l=require("./toggle-DVCNvcqp.cjs");require("react");require("./index-CNzHZDls.cjs");const p=require("./useButtonProps-bei1vI37.cjs");var a=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(a||{});function T(t,e,n){return t<e?e:t>n?n:t}function g(t,e,n,o){const{doc:s,selection:r}=t;if(!s||!r||!(r instanceof m.TextSelection||r instanceof m.AllSelection))return t;const{from:i,to:u}=r;return s.nodesBetween(i,u,(d,I)=>{const b=d.type;return n.includes(b.name)?(t=y(t,I,e),!1):!h.isList(d.type.name,o.extensionManager.extensions)}),t}function y(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o)return t;const i=T((o.attrs.indent||0)+n,0,7);if(i===o.attrs.indent)return t;const u={...o.attrs,indent:i};return t.setNodeMarkup(e,o.type,u,o.marks)}function f({delta:t,types:e}){return({state:n,dispatch:o,editor:s})=>{const{selection:r}=n;let{tr:i}=n;return i=i.setSelection(r),i=g(i,t,e,s),i.docChanged?(o&&o(i),!0):!1}}function A(){const t=p.useButtonProps(x.name),{indent:e,outdent:n}=(t==null?void 0:t.componentProps)??{},{editorDisabled:o}=p.useToggleActive(),s=()=>{o||e!=null&&e.action&&(e==null||e.action())},r=()=>{o||n!=null&&n.action&&(n==null||n.action())};return t?c.jsxs(c.Fragment,{children:[c.jsx(l.ActionButton,{action:s,disabled:o,icon:e==null?void 0:e.icon,shortcutKeys:e==null?void 0:e.shortcutKeys,tooltip:e==null?void 0:e.tooltip}),c.jsx(l.ActionButton,{action:r,disabled:o,icon:n==null?void 0:n.icon,shortcutKeys:n==null?void 0:n.shortcutKeys,tooltip:n==null?void 0:n.tooltip})]}):c.jsx(c.Fragment,{})}const x=h.Extension.create({name:"richtextIndentOutdent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:a.min,maxIndent:a.max,button({editor:e,t:n,extension:o}){var s,r;return{componentProps:{indent:{action:()=>{e.commands.indent()},shortcutKeys:((s=o.options.shortcutKeys)==null?void 0:s[0])??["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")},outdent:{action:()=>{e.commands.outdent()},shortcutKeys:((r=o.options.shortcutKeys)==null?void 0:r[1])??["Shift","Tab"],icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.dataset.indent;return(e?Number.parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>f({delta:a.more,types:this.options.types}),outdent:()=>f({delta:a.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});exports.Indent=x;exports.IndentProps=a;exports.RichTextIndent=A;exports.setNodeIndentMarkup=y;
@@ -1,10 +1,10 @@
1
1
  import { q as y, E as x } from "./index-nFjllrEl.js";
2
2
  import { TextSelection as b, AllSelection as I } from "@tiptap/pm/state";
3
3
  import { jsx as u, Fragment as m, jsxs as A } from "react/jsx-runtime";
4
- import { A as p } from "./toggle-WBgzE8Jm.js";
4
+ import { A as p } from "./toggle-xchtz-Kf.js";
5
5
  import "react";
6
- import "./index--XZPCi0O.js";
7
- import { u as T, a as K } from "./useButtonProps-BIOoOg6h.js";
6
+ import "./index-DuZCJJSp.js";
7
+ import { u as T, a as K } from "./useButtonProps-D0SrPzuG.js";
8
8
  var a = /* @__PURE__ */ ((t) => (t[t.max = 7] = "max", t[t.min = 0] = "min", t[t.more = 1] = "more", t[t.less = -1] = "less", t))(a || {});
9
9
  function g(t, n, e) {
10
10
  return t < n ? n : t > e ? e : t;
package/lib/Indent.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DLqogznp.cjs");const e=require("./Indent-fphgO8Eo.cjs");exports.Indent=e.Indent;exports.RichTextIndent=e.RichTextIndent;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DLqogznp.cjs");const e=require("./Indent-BmhiEb0S.cjs");exports.Indent=e.Indent;exports.RichTextIndent=e.RichTextIndent;
package/lib/Indent.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./index-nFjllrEl.js";
2
- import { I as o, R as r } from "./Indent-CBoQDISv.js";
2
+ import { I as o, R as r } from "./Indent-jOPn3eUM.js";
3
3
  export {
4
4
  o as Indent,
5
5
  r as RichTextIndent
package/lib/Italic.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),y=require("./toggle-DUPu3nnZ.cjs");require("react");require("./index-CnbtiTqP.cjs");const u=require("./useButtonProps-C4SCmCVo.cjs");var I=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,h=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,v=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,f=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,k=r.Mark.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",r.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[r.markInputRule({find:I,type:this.type}),r.markInputRule({find:v,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:h,type:this.type}),r.markPasteRule({find:f,type:this.type})]}}),M=k;function R(){const t=u.useButtonProps(c.name),{icon:e=void 0,tooltip:n=void 0,shortcutKeys:i=void 0,tooltipOptions:l={},action:a=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:o,update:m}=u.useToggleActive(d),g=()=>{o||a&&(a(),m())};return t?s.jsx(y.ActionButton,{action:g,dataState:p,disabled:o,icon:e,shortcutKeys:i,tooltip:n,tooltipOptions:l}):s.jsx(s.Fragment,{})}const c=M.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,t:n,extension:i}){return{componentProps:{action:()=>e.commands.toggleItalic(),isActive:()=>e.isActive("italic")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["mod","I"],icon:"Italic",tooltip:n("editor.italic.tooltip")}}}}}});exports.Italic=c;exports.RichTextItalic=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),y=require("./toggle-DVCNvcqp.cjs");require("react");require("./index-CNzHZDls.cjs");const u=require("./useButtonProps-bei1vI37.cjs");var I=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,h=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,v=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,f=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,k=r.Mark.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",r.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[r.markInputRule({find:I,type:this.type}),r.markInputRule({find:v,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:h,type:this.type}),r.markPasteRule({find:f,type:this.type})]}}),M=k;function R(){const t=u.useButtonProps(c.name),{icon:e=void 0,tooltip:n=void 0,shortcutKeys:i=void 0,tooltipOptions:l={},action:a=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:o,update:m}=u.useToggleActive(d),g=()=>{o||a&&(a(),m())};return t?s.jsx(y.ActionButton,{action:g,dataState:p,disabled:o,icon:e,shortcutKeys:i,tooltip:n,tooltipOptions:l}):s.jsx(s.Fragment,{})}const c=M.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,t:n,extension:i}){return{componentProps:{action:()=>e.commands.toggleItalic(),isActive:()=>e.isActive("italic")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["mod","I"],icon:"Italic",tooltip:n("editor.italic.tooltip")}}}}}});exports.Italic=c;exports.RichTextItalic=R;
package/lib/Italic.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { M as g, h as n, j as o, m as y } from "./index-nFjllrEl.js";
2
2
  import { jsx as d, Fragment as f } from "react/jsx-runtime";
3
- import { A as h } from "./toggle-WBgzE8Jm.js";
3
+ import { A as h } from "./toggle-xchtz-Kf.js";
4
4
  import "react";
5
- import "./index--XZPCi0O.js";
6
- import { u as I, a as v } from "./useButtonProps-BIOoOg6h.js";
5
+ import "./index-DuZCJJSp.js";
6
+ import { u as I, a as v } from "./useButtonProps-D0SrPzuG.js";
7
7
  var M = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, k = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, A = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, _ = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, x = g.create({
8
8
  name: "italic",
9
9
  addOptions() {
@@ -2,14 +2,14 @@ import { s as Oo, N as wo, R as qo, n as Po, m as Io } from "./index-nFjllrEl.js
2
2
  import { jsx as ir, jsxs as te } from "react/jsx-runtime";
3
3
  import { useState as Wt, useRef as $o, useEffect as Ka, useMemo as Lr, useCallback as Ro } from "react";
4
4
  import Ja from "katex";
5
- import { A as Eo } from "./toggle-WBgzE8Jm.js";
6
- import "./index--XZPCi0O.js";
7
- import { D as Bo, a as xo, b as To, c as Mo, d as jo } from "./dialog-CzZSyyxS.js";
8
- import { T as Do } from "./textarea-Byts1Pn0.js";
9
- import { u as Co, a as Fo, c as _o } from "./useButtonProps-BIOoOg6h.js";
5
+ import { A as Eo } from "./toggle-xchtz-Kf.js";
6
+ import "./index-DuZCJJSp.js";
7
+ import { D as Bo, a as xo, b as To, c as Mo, d as jo } from "./dialog-Ce9Cjfft.js";
8
+ import { T as Do } from "./textarea-CIs52G8B.js";
9
+ import { u as Co, a as Fo, c as _o } from "./useButtonProps-D0SrPzuG.js";
10
10
  import { g as No, c as Hr, a as Wo } from "./_commonjsHelpers-BItOPCY9.js";
11
- import { u as ko } from "./index-DGihe-wH.js";
12
- import { B as Lo } from "./button-BnN1L5_T.js";
11
+ import { u as ko } from "./index-0OnGZkVF.js";
12
+ import { B as Lo } from "./button-Crm67hfl.js";
13
13
  var ne, fn;
14
14
  function Ya() {
15
15
  if (fn) return ne;