react-reason-editor 1.0.24 → 1.0.26

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 (99) hide show
  1. package/README.md +24 -0
  2. package/dist/{Attachment-DGzsbPZZ.js → Attachment-FN0H4pdR.js} +2 -2
  3. package/dist/Attachment.js +1 -1
  4. package/dist/BulletList.cjs +1 -1
  5. package/dist/{Callout-heY7R-Zu.js → Callout-C6kKHIbW.js} +2 -2
  6. package/dist/Callout.js +1 -1
  7. package/dist/{CodeBlock-B7Wklup8.js → CodeBlock-DLhI2Guf.js} +1 -1
  8. package/dist/{CodeBlock-D2OKvGCF.cjs → CodeBlock-zh4cX5EA.cjs} +1 -1
  9. package/dist/CodeBlock.cjs +1 -1
  10. package/dist/CodeBlock.js +1 -1
  11. package/dist/CodeView.cjs +1 -1
  12. package/dist/CodeView.js +1 -1
  13. package/dist/{Color-BxzxtvJH.cjs → Color-D5zLljFV.cjs} +1 -1
  14. package/dist/Color.cjs +1 -1
  15. package/dist/{Drawer-DxCO6TBr.cjs → Drawer-B0QvuSOf.cjs} +1 -1
  16. package/dist/{Drawer-Dunw22Q1.js → Drawer-bqo2XUCW.js} +12 -12
  17. package/dist/Drawer.cjs +1 -1
  18. package/dist/Drawer.js +1 -1
  19. package/dist/{Drawio-eqEGDkwW.js → Drawio-CIXM-WGy.js} +4 -4
  20. package/dist/Drawio.js +1 -1
  21. package/dist/{Emoji-BU-itkPp.js → Emoji-CTvSFbHz.js} +3 -3
  22. package/dist/Emoji.js +1 -1
  23. package/dist/FontFamily.js +2 -2
  24. package/dist/{Highlight-BeqLxfbY.cjs → Highlight-DQxtCrNN.cjs} +1 -1
  25. package/dist/Highlight.cjs +1 -1
  26. package/dist/{History-C6yBYB2w.js → History-PbMa-usl.js} +1 -1
  27. package/dist/History.js +1 -1
  28. package/dist/Image.js +1 -1
  29. package/dist/{ImageCropper-Dlz4nJQu.js → ImageCropper-CN_GzBBG.js} +5 -5
  30. package/dist/{ImageGif-D5Qw_Xf-.js → ImageGif-D9goI48J.js} +3 -3
  31. package/dist/ImageGif.js +1 -1
  32. package/dist/{ImportWord-BCcs3dYp.js → ImportWord-Bux3L57d.js} +1 -1
  33. package/dist/ImportWord.js +1 -1
  34. package/dist/{Indent-DpTPoZMk.js → Indent-fBwkYx_q.js} +1 -1
  35. package/dist/Indent.js +1 -1
  36. package/dist/{Katex-D_vF5gsD.cjs → Katex-B1xls7hE.cjs} +1 -1
  37. package/dist/{Katex-Bo_vfXrd.js → Katex-D2g86C-B.js} +3 -3
  38. package/dist/Katex.cjs +1 -1
  39. package/dist/Katex.js +1 -1
  40. package/dist/LineHeight.js +1 -1
  41. package/dist/{Link-C0cNnjXo.js → Link-Dpaom2jX.js} +1 -1
  42. package/dist/Link.js +1 -1
  43. package/dist/{Mention-DEkbeL04.js → Mention-D0HVk1SC.js} +1 -1
  44. package/dist/Mention.js +1 -1
  45. package/dist/{Mermaid-BB15qd24.cjs → Mermaid-3vSlkOlc.cjs} +1 -1
  46. package/dist/Mermaid-B3KGZMBo.js +5 -0
  47. package/dist/Mermaid.cjs +1 -1
  48. package/dist/Mermaid.js +1 -1
  49. package/dist/MoreMark.js +1 -1
  50. package/dist/OrderedList.cjs +1 -1
  51. package/dist/SearchAndReplace.cjs +1 -1
  52. package/dist/SearchAndReplace.js +1 -1
  53. package/dist/{SlashCommand-8LkH8bHy.js → SlashCommand-ZFZhrxKb.js} +1 -1
  54. package/dist/SlashCommand.js +1 -1
  55. package/dist/{Table-C9t-k9Qu.js → Table-6kM52sUH.js} +2 -2
  56. package/dist/Table.js +1 -1
  57. package/dist/TaskList.cjs +1 -1
  58. package/dist/{TextAlign-C75gn_OM.js → TextAlign-BKo82ocx.js} +1 -1
  59. package/dist/TextAlign.js +1 -1
  60. package/dist/TextDirection.js +1 -1
  61. package/dist/{Twitter-DyrQT0n4.cjs → Twitter-3yCP2UdP.cjs} +1 -1
  62. package/dist/{Twitter-D5UNfT-K.js → Twitter-D38giVew.js} +2 -2
  63. package/dist/Twitter.cjs +1 -1
  64. package/dist/Twitter.js +1 -1
  65. package/dist/{Video-_YlAC2R_.js → Video-DcfPDZLP.js} +3 -3
  66. package/dist/Video.js +1 -1
  67. package/dist/WordCount.js +1 -1
  68. package/dist/{bubble---c27x7L.js → bubble-4RecyKlX.js} +1 -1
  69. package/dist/bubble.cjs +1 -1
  70. package/dist/bubble.js +1 -1
  71. package/dist/editor-kit.cjs +1 -0
  72. package/dist/editor-kit.d.ts +13 -0
  73. package/dist/editor-kit.js +1 -0
  74. package/dist/editor-views/components/AlignToolbar.d.ts +4 -0
  75. package/dist/editor-views/components/BubbleMenus.d.ts +4 -0
  76. package/dist/editor-views/components/EditorContainer.d.ts +10 -0
  77. package/dist/editor-views/components/Header.d.ts +8 -0
  78. package/dist/editor-views/components/Toolbar.d.ts +26 -0
  79. package/dist/editor-views/components/constants.d.ts +14 -0
  80. package/dist/editor-views/components/extensions.d.ts +8 -0
  81. package/dist/editor-views/components/index.d.ts +9 -0
  82. package/dist/editor-views/config/baseKit.d.ts +7 -0
  83. package/dist/editor-views/config/editorConfig.d.ts +37 -0
  84. package/dist/editor-views/config/pluginRegistry.d.ts +43 -0
  85. package/dist/editorConfig-Cgs4P8O5.js +184 -0
  86. package/dist/editorConfig-CnzPmOCy.cjs +1 -0
  87. package/dist/html-to-docx.esm-DkztZsL5-BqrjWkoQ.cjs +1 -0
  88. package/dist/index.cjs +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/reason-docs.cjs +1 -1
  91. package/dist/reason-docs.js +1 -1
  92. package/dist/{separator-BHN46aj5.cjs → separator-CXjMk9dM.cjs} +1 -1
  93. package/dist/src-73l1pSjp.js +463 -0
  94. package/dist/src-CF0U82SA.cjs +1 -0
  95. package/package.json +12 -2
  96. package/dist/Mermaid-DxpFRVu0.js +0 -5
  97. package/dist/html-to-docx.esm-DkztZsL5-DQYdhD3B.cjs +0 -1
  98. package/dist/src-C7k3RYxJ.js +0 -646
  99. package/dist/src-DYbBlAjR.cjs +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-reason-editor",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -253,6 +253,16 @@
253
253
  "default": "./dist/reason-docs.js"
254
254
  }
255
255
  },
256
+ "./editor-kit": {
257
+ "require": {
258
+ "types": "./dist/editor-kit.d.cts",
259
+ "default": "./dist/editor-kit.cjs"
260
+ },
261
+ "import": {
262
+ "types": "./dist/editor-kit.d.ts",
263
+ "default": "./dist/editor-kit.js"
264
+ }
265
+ },
256
266
  "./dist/*": "./dist/*",
257
267
  "./package.json": "./package.json",
258
268
  "./*": "./dist/*",
@@ -909,4 +919,4 @@
909
919
  "prosemirror-view": "1.41.1"
910
920
  }
911
921
  }
912
- }
922
+ }
@@ -1,5 +0,0 @@
1
- import{n as t}from"./toggle-BXl_NYYh.js";import{g as e}from"./locales-DfkG6-1b.js";import{t as i}from"./button-CXcuJkiM.js";import{a as r,n as a,o as n,r as o,t as s}from"./dialog-DgdVbRUv.js";import{t as d}from"./textarea-uEPOPNqf.js";import{o as l,t as h}from"./throttle-BpbN7uB1.js";import{c,d as m,n as u,t as g}from"./useButtonProps-DSIajp_B.js";import{t as p}from"./file-aBzFF1LO.js";import{n as b,t as f}from"./shortId-COE42cHb.js";import{NodeViewWrapper as v,ReactNodeViewRenderer as w,isNumber as x}from"@tiptap/react";import y,{useCallback as M,useEffect as A,useMemo as L,useRef as N,useState as _}from"react";import{Fragment as T,jsx as H,jsxs as j}from"react/jsx-runtime";import{mergeAttributes as C}from"@tiptap/core";var I="tl",S="tr",k="bl",z="br";function $({editor:t,node:i,updateAttributes:r,getPos:a,selected:n}){const[o,s]=_({width:e,height:e}),[d,l]=_({width:0,height:0}),[c]=_([I,S,k,z]),[m,g]=_(!1),[p,b]=_({x:0,y:0,w:0,h:0,dir:""}),{align:f}=i.attrs,w=L(()=>{const{src:t,alt:e,width:r,height:a}=i.attrs;return{src:t||void 0,alt:e||void 0,style:{width:(x(r)?`${r}px`:r)||void 0,height:(x(a)?`${a}px`:a)||void 0}}},[i?.attrs]),y=L(()=>{const{style:{width:t}}=w;return{width:"100%"===t?t:void 0}},[w]);function N(){t.commands.setNodeSelection(a())}const T=M(h(()=>{const{width:e}=getComputedStyle(t.view.dom);s(t=>({...t,width:Number.parseInt(e,10)}))},16),[t]);const C=M(h(t=>{if(t.preventDefault(),t.stopPropagation(),!m)return;const{x:e,w:a,dir:n}=p,s=(t.clientX-e)*(/l/.test(n)?-1:1),{width:d,height:l}=i.attrs,h=d/l,c=u(a+s,20,o.width);r({width:c,height:Math.round(c/h)})},16),[m,p,o,r,i?.attrs]),$=M(t=>{t.preventDefault(),t.stopPropagation(),m&&(b({x:0,y:0,w:0,h:0,dir:""}),g(!1),N())},[m,N]),P=M(()=>{document?.addEventListener("mousemove",C,!0),document?.addEventListener("mouseup",$,!0)},[C,$]),q=M(()=>{document?.removeEventListener("mousemove",C,!0),document?.removeEventListener("mouseup",$,!0)},[C,$]);A(()=>(m?P():q(),()=>{q()}),[m,P,q]);const O=L(()=>new ResizeObserver(()=>T()),[T]);return A(()=>(O.observe(t.view.dom),()=>{O.disconnect()}),[t.view.dom,O]),/* @__PURE__ */H(v,{className:"image-view",style:{...y,width:"100%",textAlign:f},children:/* @__PURE__ */j("div",{"data-drag-handle":!0,draggable:"true",style:{...y,background:"#fff"},className:`image-view__body ${n?"image-view__body--focused":""} ${m?"image-view__body--resizing":""}`,children:[/* @__PURE__ */H("img",{alt:w.alt,className:"image-view__body__image block",height:"auto",onClick:N,onLoad:function(t){l({width:t.target.width,height:t.target.height})},src:w.src,style:w.style}),t.view.editable&&(n||m)&&/* @__PURE__ */H("div",{className:"image-resizer",children:c?.map(t=>/* @__PURE__ */H("span",{className:`image-resizer__handler image-resizer__handler--${t}`,onMouseDown:e=>function(t,e){t.preventDefault(),t.stopPropagation();const r=d.width,a=r/d.height;let n=Number(i.attrs.width),s=Number(i.attrs.height);const l=o.width;n&&!s?(n=n>l?l:n,s=Math.round(n/a)):s&&!n?(n=Math.round(s*a),n=n>l?l:n):n||s?n=n>l?l:n:(n=r>l?l:r,s=Math.round(n/a)),g(!0),b({x:t.clientX,y:t.clientY,w:n,h:s,dir:e})}(e,t)},`image-dir-${t}`))})]})})}function P(){const e=m(),{tooltipOptions:l={},isActive:h,upload:u}=g(q.name)?.componentProps??{},{editorDisabled:v}=c(h),[w,x]=_("graph TB\na--\x3eb"),[y,L]=_(""),[C,I]=_(!1),S=N(null),[k,z]=_(null),[$,P]=_(!0),O=M(t=>{t&&import("./cdn-loader-w67sLKk9.js").then(t=>t.t).then(({loadMermaid:t})=>t()).then(t=>{z(t)}).finally(()=>P(!1))},[]),D=async t=>{try{const{svg:e}=await k.render("mermaid-svg",t);L(e)}catch{L("")}};A(()=>{!$&&k&&C&&(k.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),D(w))},[k,C]),A(()=>{!$&&k&&C&&D(w)},[k&&w]);/* @__PURE__ */
2
- return j(s,{onOpenChange:I,open:C,children:[/* @__PURE__ */H(n,{asChild:!0,children:/* @__PURE__ */H(t,{disabled:v,icon:"Mermaid",tooltip:"Mermaid",tooltipOptions:l,action:()=>{v||I(!0)}})}),/* @__PURE__ */j(a,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[
3
- /* @__PURE__ */H(r,{children:"Mermaid"}),
4
- /* @__PURE__ */H("div",{ref:O,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:$?/* @__PURE__ */H("p",{children:"Loading..."}):/* @__PURE__ */H(T,{children:/* @__PURE__ */j("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[/* @__PURE__ */H(d,{autoFocus:!0,className:"richtext-flex-1",onChange:t=>x(t.target.value),placeholder:"Text",required:!0,rows:10,value:w,style:{color:"hsl(var(--foreground))"}}),/* @__PURE__ */H("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:y},ref:S,style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})})}),
5
- /* @__PURE__ */H(o,{children:/* @__PURE__ */H(i,{disabled:!k,onClick:async()=>{if(""!==w){if(w){const t=S.current.querySelector("svg"),{width:i,height:r}=t.getBoundingClientRect(),a=`mermaid-${f()}.svg`;let n=b(t.outerHTML);if(u){const t=p(n,a);n=await u(t)}e?.chain().focus().setMermaid({type:"mermaid",src:n,alt:encodeURIComponent(w),width:i,height:r},!!w).run()}I(!1)}},type:"button",children:"Save changes"})})]})]})}var q=l.extend({name:"mermaid",addOptions(){return{...this.parent?.(),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"mermaid"},button:({editor:t,t:e,extension:i})=>({componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,editor:t,icon:"Mermaid",tooltip:e("editor.mermaid.tooltip"),upload:i?.options?.upload}})}},addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:t=>{const e=t.querySelector("img")?.getAttribute("width");return e?Number.parseInt(e,10):320},renderHTML:t=>({width:t.width})},height:{default:null,parseHTML:t=>{const e=t.querySelector("img")?.getAttribute("height");return e?Number.parseInt(e,10):212},renderHTML:t=>({height:t.height})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView:()=>w($),addCommands(){return{setMermaid:(t,e)=>({commands:i,editor:r})=>e?i.insertContent({type:this.name,attrs:t}):i.insertContentAt(r.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageMermaid:t=>({commands:e})=>e.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:e}=t;return["div",{style:e?`text-align: ${e};`:"",class:"imageMermaid"},["img",C(this.options.HTMLAttributes,t)]]},parseHTML:()=>[{tag:"div[class=imageMermaid]",getAttrs:t=>{const e=t.querySelector("img"),i=e?.getAttribute("width"),r=e?.getAttribute("height");return{src:e?.getAttribute("src"),alt:e?.getAttribute("alt"),width:i?Number.parseInt(i,10):null,height:r?Number.parseInt(r,10):null,align:e?.getAttribute("align")||t.style.textAlign||null}}}]});export{P as n,q as t};