reactjs-tiptap-editor 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/lib/{ActionMenuButton-LnZiD_hs.cjs → ActionMenuButton-DWudb-EA.cjs} +1 -1
  2. package/lib/{ActionMenuButton-X9t23Kr1.js → ActionMenuButton-_fmUfylg.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +12 -0
  5. package/lib/Attachment.d.ts +12 -0
  6. package/lib/Attachment.js +2 -2
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +12 -0
  9. package/lib/Blockquote.d.ts +12 -0
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +12 -0
  13. package/lib/Bold.d.ts +12 -0
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +12 -0
  17. package/lib/BulletList.d.ts +12 -0
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +12 -0
  21. package/lib/Clear.d.ts +12 -0
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +12 -0
  25. package/lib/Code.d.ts +12 -0
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +12 -0
  29. package/lib/CodeBlock.d.ts +12 -0
  30. package/lib/CodeBlock.js +1 -1
  31. package/lib/CodeView.cjs +1 -0
  32. package/lib/CodeView.d.cts +354 -0
  33. package/lib/CodeView.d.ts +354 -0
  34. package/lib/CodeView.js +53 -0
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +12 -0
  37. package/lib/Color.d.ts +12 -0
  38. package/lib/Color.js +2 -2
  39. package/lib/Document.d.cts +12 -0
  40. package/lib/Document.d.ts +12 -0
  41. package/lib/{Drawer-CqizRDVf.js → Drawer-C9nzP3w1.js} +18 -18
  42. package/lib/{Drawer-BbWFl6BS.cjs → Drawer-y2uXLloa.cjs} +1 -1
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +12 -0
  45. package/lib/Drawer.d.ts +12 -0
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +12 -0
  49. package/lib/Emoji.d.ts +12 -0
  50. package/lib/Emoji.js +2 -2
  51. package/lib/{Excalidraw-XwpYLfpI.js → Excalidraw-BihHDjEo.js} +2 -2
  52. package/lib/{Excalidraw-7uXZDsmD.cjs → Excalidraw-DMKzooX1.cjs} +1 -1
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +12 -0
  55. package/lib/Excalidraw.d.ts +12 -0
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +12 -0
  59. package/lib/ExportPdf.d.ts +12 -0
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +12 -0
  63. package/lib/ExportWord.d.ts +12 -0
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +12 -0
  67. package/lib/FontFamily.d.ts +12 -0
  68. package/lib/FontFamily.js +3 -3
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +12 -0
  71. package/lib/FontSize.d.ts +12 -0
  72. package/lib/FontSize.js +3 -3
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +12 -0
  75. package/lib/FormatPainter.d.ts +12 -0
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +12 -0
  79. package/lib/Heading.d.ts +12 -0
  80. package/lib/Heading.js +2 -2
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +12 -0
  83. package/lib/Highlight.d.ts +12 -0
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +12 -0
  87. package/lib/History.d.ts +12 -0
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +12 -0
  91. package/lib/HorizontalRule.d.ts +12 -0
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +12 -0
  95. package/lib/Iframe.d.ts +12 -0
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +12 -0
  99. package/lib/Image.d.ts +12 -0
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +12 -0
  103. package/lib/ImageGif.d.ts +12 -0
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +1 -1
  106. package/lib/ImportWord.d.cts +12 -0
  107. package/lib/ImportWord.d.ts +12 -0
  108. package/lib/ImportWord.js +2 -2
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +12 -0
  111. package/lib/Indent.d.ts +12 -0
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +12 -0
  115. package/lib/Italic.d.ts +12 -0
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +12 -0
  119. package/lib/Katex.d.ts +12 -0
  120. package/lib/Katex.js +3 -3
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +12 -0
  123. package/lib/LineHeight.d.ts +12 -0
  124. package/lib/LineHeight.js +8 -8
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +12 -0
  127. package/lib/Link.d.ts +12 -0
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +12 -0
  130. package/lib/ListItem.d.ts +12 -0
  131. package/lib/Mention.d.cts +12 -0
  132. package/lib/Mention.d.ts +12 -0
  133. package/lib/Mermaid.cjs +1 -1
  134. package/lib/Mermaid.d.cts +12 -0
  135. package/lib/Mermaid.d.ts +12 -0
  136. package/lib/Mermaid.js +14 -14
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +12 -0
  139. package/lib/MoreMark.d.ts +12 -0
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +12 -0
  143. package/lib/MultiColumn.d.ts +12 -0
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +12 -0
  147. package/lib/OrderedList.d.ts +12 -0
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-BhzFkRcp.js → RichTextEditor-D5VO1y1d.js} +766 -743
  150. package/lib/RichTextEditor-qp9T7xuG.cjs +137 -0
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +12 -0
  153. package/lib/SearchAndReplace.d.ts +12 -0
  154. package/lib/SearchAndReplace.js +2 -2
  155. package/lib/Selection.d.cts +12 -0
  156. package/lib/Selection.d.ts +12 -0
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +12 -0
  159. package/lib/SlashCommand.d.ts +12 -0
  160. package/lib/SlashCommand.js +2 -2
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +12 -0
  163. package/lib/Strike.d.ts +12 -0
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +12 -0
  167. package/lib/SubAndSuperScript.d.ts +12 -0
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +12 -0
  171. package/lib/Table.d.ts +12 -0
  172. package/lib/Table.js +2 -2
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +12 -0
  175. package/lib/TableOfContent.d.ts +12 -0
  176. package/lib/TableOfContent.js +4 -4
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +12 -0
  179. package/lib/TaskList.d.ts +12 -0
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +12 -0
  183. package/lib/TextAlign.d.ts +12 -0
  184. package/lib/TextAlign.js +1 -1
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +12 -0
  187. package/lib/TextBubble.d.ts +12 -0
  188. package/lib/TextBubble.js +2 -2
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +12 -0
  191. package/lib/TextDirection.d.ts +12 -0
  192. package/lib/TextDirection.js +1 -1
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +12 -0
  195. package/lib/TextUnderline.d.ts +12 -0
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +12 -0
  198. package/lib/TrailingNode.d.ts +12 -0
  199. package/lib/{Twitter-CzT2PGy6.js → Twitter-CH7Z4Iof.js} +2 -2
  200. package/lib/{Twitter-R32iSHHD.cjs → Twitter-CgVy5oQW.cjs} +1 -1
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +12 -0
  203. package/lib/Twitter.d.ts +12 -0
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +19 -0
  207. package/lib/Video.d.ts +19 -0
  208. package/lib/Video.js +2 -2
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +12 -0
  211. package/lib/bubble-extra.d.ts +12 -0
  212. package/lib/bubble-extra.js +6 -6
  213. package/lib/{index-D9llIWB5.js → index-D-DR0FPY.js} +18 -13
  214. package/lib/index-Dz3YxLE7.cjs +1 -0
  215. package/lib/index.cjs +1 -1
  216. package/lib/index.d.cts +13 -0
  217. package/lib/index.d.ts +13 -0
  218. package/lib/index.js +3 -3
  219. package/lib/locale-bundle.cjs +1 -1
  220. package/lib/locale-bundle.d.cts +17 -0
  221. package/lib/locale-bundle.d.ts +17 -0
  222. package/lib/locale-bundle.js +1 -1
  223. package/lib/{textarea-BIWEJWC6.js → textarea-CDp8O87y.js} +1 -1
  224. package/lib/{textarea-BMlBzzR0.cjs → textarea-CqMUEJEj.cjs} +1 -1
  225. package/package.json +14 -1
  226. package/lib/RichTextEditor-BulGh0GP.cjs +0 -137
  227. package/lib/index-LbrE7K9i.cjs +0 -1
package/lib/Table.d.ts CHANGED
@@ -119,6 +119,18 @@ declare module '@tiptap/core' {
119
119
  }
120
120
 
121
121
 
122
+ declare module '@tiptap/core' {
123
+ interface Commands<ReturnType> {
124
+ codeView: {
125
+ /**
126
+ * Toggle code view mode
127
+ */
128
+ toggleCodeView: () => ReturnType;
129
+ };
130
+ }
131
+ }
132
+
133
+
122
134
  declare module '@tiptap/core' {
123
135
  interface Commands<ReturnType> {
124
136
  drawer: {
package/lib/Table.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { a as de, S as N, y as Pe, T as E, z as Ie, F as R, B as H, P as ke, D as ne, b as oe, f as Oe, C as Fe, N as U, G as je, H as Ve, m as J, I as Ke, E as Xe } from "./index-Drmyqk9P.js";
2
2
  import { jsxs as Q, jsx as k } from "react/jsx-runtime";
3
- import { P as Ge, m as qe, n as Ue, A as Je } from "./RichTextEditor-BhzFkRcp.js";
3
+ import { P as Ge, m as qe, n as Ue, A as Je } from "./RichTextEditor-D5VO1y1d.js";
4
4
  import { useState as ee } from "react";
5
- import { T as I, o as O, p as F } from "./index-D9llIWB5.js";
5
+ import { T as I, o as O, p as F } from "./index-D-DR0FPY.js";
6
6
  var le, re;
7
7
  if (typeof WeakMap < "u") {
8
8
  let t = /* @__PURE__ */ new WeakMap();
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-COecBbaE.cjs"),p=require("./dom-dataset-CAXnsjYE.cjs"),r=require("react/jsx-runtime"),c=require("react"),C=require("./index-LbrE7K9i.cjs"),b=require("./RichTextEditor-BulGh0GP.cjs"),g="_toc_aag8a_1",x="_visible_aag8a_7",T="_list_aag8a_11",O="_item_aag8a_16",f={toc:g,visible:x,list:T,item:O};function y(e){const o=[],a=[o];return e.forEach(n=>{let t=-1,s=a[n.level+t];for(;!s;)t-=1,s=a[n.level+t];s.push({...n,children:a[n.level]=[]})}),o}function N({editor:e}){const o=b.useEditableEditor(),[a,n]=c.useState([]),{t}=C.useLocale(),s=c.useCallback(()=>{const i=[],l=e.state.tr;e.state.doc.descendants((u,v)=>{if(u.type.name==="heading"){const d=`heading-${i.length+1}`;u.attrs.id!==d&&l.setNodeMarkup(v,void 0,{...u.attrs,id:d}),i.push({level:u.attrs.level,text:u.textContent,id:d})}}),l.setMeta("addToHistory",!1),l.setMeta("preventUpdate",!0),e.view.dispatch(l),n(i),e.eventEmitter&&e.eventEmitter.emit("TableOfContents",y(i))},[e]);return c.useEffect(()=>{if(e){if(!e.options.editable){s();return}return e.on("update",s),()=>{e.off("update",s)}}},[e,s]),c.useEffect(()=>{s()},[]),r.jsx(p.NodeViewWrapper,{className:p.clsx("tableOfContent",f.toc,o&&f.visible),children:o?r.jsxs("div",{style:{position:"relative"},children:[r.jsx("p",{className:"text-[20px] richtext-mb-[8px] richtext-font-semibold",children:t("editor.table_of_content")}),r.jsx("ul",{className:f.list,children:a.map((i,l)=>r.jsx("li",{className:f.item,style:{paddingLeft:`${i.level-1}rem`},children:r.jsx("a",{href:`#${i.id}`,children:i.text})},`table-of-content-${l}`))})]}):null})}function _(e,...o){const[a,n]=c.useState(!1);return c.useEffect(()=>{const t=()=>{n(e.isActive.apply(e,o))};return e.on("selectionUpdate",t),e.on("transaction",t),()=>{e.off("selectionUpdate",t),e.off("transaction",t)}},[e,o,n]),a}function A({editor:e,icon:o,tooltip:a}){const n=_(e,m.name),t=c.useCallback(()=>{if(n){e.chain().focus().removeTableOfContents().run();return}e.chain().focus().setTableOfContents().run()},[e,n]);return r.jsx(b.ActionButton,{action:t,isActive:()=>n||!1,icon:o,tooltip:a})}function j(e){return e&&e.type.name==="title"}function E(e,o){const n=[e.getJSON()],t=[];for(;n.length>0;){const s=n.shift();s.type===o&&t.push(s),s.content&&s.content.length>0&&n.push(...s.content)}return t}const m=h.Node.create({name:"tableOfContents",group:"block",atom:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),onHasOneBeforeInsert:()=>{},resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:o,t:a})=>({component:A,componentProps:{disabled:!1,icon:"BookMarked",tooltip:a("editor.table.tooltip"),editor:o}})}},parseHTML(){return[{tag:"toc"}]},renderHTML({HTMLAttributes:e}){return["toc",h.mergeAttributes(e)]},addNodeView(){return p.ReactNodeViewRenderer(N)},addCommands(){return{setTableOfContents:()=>({commands:e,editor:o,view:a})=>{if(E(o,this.name).length>0){this.options.onHasOneBeforeInsert();return}const t=a.props.state.doc.content.firstChild;if(j(t)){const s=(t.firstChild&&t.firstChild.nodeSize||0)+1;return e.insertContentAt(s,{type:this.name})}return e.insertContent({type:this.name})},removeTableOfContents:()=>({state:e,dispatch:o})=>{const{tr:a}=e,n=e.schema.nodes.tableOfContents;return e.doc.descendants((t,s)=>{if(t.type===n){const i=s,l=s+t.nodeSize;a.delete(i,l)}}),a.docChanged?(o(a),!0):!1}}},addGlobalAttributes(){return[{types:["heading"],attributes:{id:{default:null}}}]}});exports.TableOfContents=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-COecBbaE.cjs"),p=require("./dom-dataset-CAXnsjYE.cjs"),l=require("react/jsx-runtime"),c=require("react"),C=require("./index-Dz3YxLE7.cjs"),b=require("./RichTextEditor-qp9T7xuG.cjs"),g="_toc_aag8a_1",x="_visible_aag8a_7",T="_list_aag8a_11",O="_item_aag8a_16",f={toc:g,visible:x,list:T,item:O};function _(e){const o=[],a=[o];return e.forEach(n=>{let t=-1,s=a[n.level+t];for(;!s;)t-=1,s=a[n.level+t];s.push({...n,children:a[n.level]=[]})}),o}function y({editor:e}){const o=b.useEditableEditor(),[a,n]=c.useState([]),{t}=C.useLocale(),s=c.useCallback(()=>{const i=[],r=e.state.tr;e.state.doc.descendants((u,v)=>{if(u.type.name==="heading"){const d=`heading-${i.length+1}`;u.attrs.id!==d&&r.setNodeMarkup(v,void 0,{...u.attrs,id:d}),i.push({level:u.attrs.level,text:u.textContent,id:d})}}),r.setMeta("addToHistory",!1),r.setMeta("preventUpdate",!0),e.view.dispatch(r),n(i),e.eventEmitter&&e.eventEmitter.emit("TableOfContents",_(i))},[e]);return c.useEffect(()=>{if(e){if(!e.options.editable){s();return}return e.on("update",s),()=>{e.off("update",s)}}},[e,s]),c.useEffect(()=>{s()},[]),l.jsx(p.NodeViewWrapper,{className:p.clsx("tableOfContent",f.toc,o&&f.visible),children:o?l.jsxs("div",{style:{position:"relative"},children:[l.jsx("p",{className:"text-[20px] richtext-mb-[8px] richtext-font-semibold",children:t("editor.table_of_content")}),l.jsx("ul",{className:f.list,children:a.map((i,r)=>l.jsx("li",{className:f.item,style:{paddingLeft:`${i.level-1}rem`},children:l.jsx("a",{href:`#${i.id}`,children:i.text})},`table-of-content-${r}`))})]}):null})}function N(e,...o){const[a,n]=c.useState(!1);return c.useEffect(()=>{const t=()=>{n(e.isActive.apply(e,o))};return e.on("selectionUpdate",t),e.on("transaction",t),()=>{e.off("selectionUpdate",t),e.off("transaction",t)}},[e,o,n]),a}function A({editor:e,icon:o,tooltip:a}){const n=N(e,m.name),t=c.useCallback(()=>{if(n){e.chain().focus().removeTableOfContents().run();return}e.chain().focus().setTableOfContents().run()},[e,n]);return l.jsx(b.ActionButton,{action:t,isActive:()=>n||!1,icon:o,tooltip:a})}function j(e){return e&&e.type.name==="title"}function E(e,o){const n=[e.getJSON()],t=[];for(;n.length>0;){const s=n.shift();s.type===o&&t.push(s),s.content&&s.content.length>0&&n.push(...s.content)}return t}const m=h.Node.create({name:"tableOfContents",group:"block",atom:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),onHasOneBeforeInsert:()=>{},resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:o,t:a})=>({component:A,componentProps:{disabled:!1,icon:"BookMarked",tooltip:a("editor.table_of_content"),editor:o}})}},parseHTML(){return[{tag:"toc"}]},renderHTML({HTMLAttributes:e}){return["toc",h.mergeAttributes(e)]},addNodeView(){return p.ReactNodeViewRenderer(y)},addCommands(){return{setTableOfContents:()=>({commands:e,editor:o,view:a})=>{if(E(o,this.name).length>0){this.options.onHasOneBeforeInsert();return}const t=a.props.state.doc.content.firstChild;if(j(t)){const s=(t.firstChild&&t.firstChild.nodeSize||0)+1;return e.insertContentAt(s,{type:this.name})}return e.insertContent({type:this.name})},removeTableOfContents:()=>({state:e,dispatch:o})=>{const{tr:a}=e,n=e.schema.nodes.tableOfContents;return e.doc.descendants((t,s)=>{if(t.type===n){const i=s,r=s+t.nodeSize;a.delete(i,r)}}),a.docChanged?(o(a),!0):!1}}},addGlobalAttributes(){return[{types:["heading"],attributes:{id:{default:null}}}]}});exports.TableOfContents=m;
@@ -27,6 +27,18 @@ declare module '@tiptap/core' {
27
27
  }
28
28
 
29
29
 
30
+ declare module '@tiptap/core' {
31
+ interface Commands<ReturnType> {
32
+ codeView: {
33
+ /**
34
+ * Toggle code view mode
35
+ */
36
+ toggleCodeView: () => ReturnType;
37
+ };
38
+ }
39
+ }
40
+
41
+
30
42
  declare module '@tiptap/core' {
31
43
  interface Commands<ReturnType> {
32
44
  drawer: {
@@ -27,6 +27,18 @@ declare module '@tiptap/core' {
27
27
  }
28
28
 
29
29
 
30
+ declare module '@tiptap/core' {
31
+ interface Commands<ReturnType> {
32
+ codeView: {
33
+ /**
34
+ * Toggle code view mode
35
+ */
36
+ toggleCodeView: () => ReturnType;
37
+ };
38
+ }
39
+ }
40
+
41
+
30
42
  declare module '@tiptap/core' {
31
43
  interface Commands<ReturnType> {
32
44
  drawer: {
@@ -2,8 +2,8 @@ import { N as b, m as v } from "./index-Drmyqk9P.js";
2
2
  import { N as C, c as g, R as N } from "./dom-dataset-CJ7GyQ2E.js";
3
3
  import { jsx as l, jsxs as T } from "react/jsx-runtime";
4
4
  import { useState as p, useCallback as m, useEffect as d } from "react";
5
- import { u as O } from "./index-D9llIWB5.js";
6
- import { _, A as y } from "./RichTextEditor-BhzFkRcp.js";
5
+ import { u as _ } from "./index-D-DR0FPY.js";
6
+ import { _ as O, A as y } from "./RichTextEditor-D5VO1y1d.js";
7
7
  const x = "_toc_aag8a_1", A = "_visible_aag8a_7", w = "_list_aag8a_11", E = "_item_aag8a_16", f = {
8
8
  toc: x,
9
9
  visible: A,
@@ -20,7 +20,7 @@ function k(t) {
20
20
  }), o;
21
21
  }
22
22
  function M({ editor: t }) {
23
- const o = _(), [a, n] = p([]), { t: e } = O(), s = m(() => {
23
+ const o = O(), [a, n] = p([]), { t: e } = _(), s = m(() => {
24
24
  const i = [], r = t.state.tr;
25
25
  t.state.doc.descendants((c, h) => {
26
26
  if (c.type.name === "heading") {
@@ -119,7 +119,7 @@ const z = /* @__PURE__ */ b.create({
119
119
  componentProps: {
120
120
  disabled: !1,
121
121
  icon: "BookMarked",
122
- tooltip: a("editor.table.tooltip"),
122
+ tooltip: a("editor.table_of_content"),
123
123
  editor: o
124
124
  }
125
125
  })
package/lib/TaskList.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-COecBbaE.cjs"),k=require("./RichTextEditor-BulGh0GP.cjs"),b=/^\s*(\[([( |x])?\])\s$/,f=a.Node.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const n=t.getAttribute("data-checked");return n===""||n==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:n}){return["li",a.mergeAttributes(this.options.HTMLAttributes,n,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:n,getPos:c,editor:o})=>{const i=document.createElement("li"),d=document.createElement("label"),m=document.createElement("span"),s=document.createElement("input"),p=document.createElement("div");return d.contentEditable="false",s.type="checkbox",s.addEventListener("mousedown",e=>e.preventDefault()),s.addEventListener("change",e=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}const{checked:r}=e.target;o.isEditable&&typeof c=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:l})=>{const u=c();if(typeof u!="number")return!1;const h=l.doc.nodeAt(u);return l.setNodeMarkup(u,void 0,{...h==null?void 0:h.attrs,checked:r}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,r)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,r])=>{i.setAttribute(e,r)}),i.dataset.checked=t.attrs.checked,s.checked=t.attrs.checked,d.append(s,m),i.append(d,p),Object.entries(n).forEach(([e,r])=>{i.setAttribute(e,r)}),{dom:i,contentDOM:p,update:e=>e.type!==this.type?!1:(i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,!0)}}},addInputRules(){return[a.wrappingInputRule({find:b,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),L=a.Node.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",a.mergeAttributes(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),T=L.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:n,t:c})=>({component:k.ActionButton,componentProps:{action:()=>n.commands.toggleTaskList(),isActive:()=>n.isActive("taskList")||!1,disabled:!1,icon:"ListTodo",shortcutKeys:["shift","mod","9"],tooltip:c("editor.tasklist.tooltip")}})}},addExtensions(){return[f.configure(this.options.taskItem)]}});exports.TaskList=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-COecBbaE.cjs"),k=require("./RichTextEditor-qp9T7xuG.cjs"),b=/^\s*(\[([( |x])?\])\s$/,f=a.Node.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const n=t.getAttribute("data-checked");return n===""||n==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:n}){return["li",a.mergeAttributes(this.options.HTMLAttributes,n,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:n,getPos:c,editor:o})=>{const i=document.createElement("li"),d=document.createElement("label"),m=document.createElement("span"),s=document.createElement("input"),p=document.createElement("div");return d.contentEditable="false",s.type="checkbox",s.addEventListener("mousedown",e=>e.preventDefault()),s.addEventListener("change",e=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}const{checked:r}=e.target;o.isEditable&&typeof c=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:l})=>{const u=c();if(typeof u!="number")return!1;const h=l.doc.nodeAt(u);return l.setNodeMarkup(u,void 0,{...h==null?void 0:h.attrs,checked:r}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,r)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,r])=>{i.setAttribute(e,r)}),i.dataset.checked=t.attrs.checked,s.checked=t.attrs.checked,d.append(s,m),i.append(d,p),Object.entries(n).forEach(([e,r])=>{i.setAttribute(e,r)}),{dom:i,contentDOM:p,update:e=>e.type!==this.type?!1:(i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,!0)}}},addInputRules(){return[a.wrappingInputRule({find:b,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),L=a.Node.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",a.mergeAttributes(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),T=L.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:n,t:c})=>({component:k.ActionButton,componentProps:{action:()=>n.commands.toggleTaskList(),isActive:()=>n.isActive("taskList")||!1,disabled:!1,icon:"ListTodo",shortcutKeys:["shift","mod","9"],tooltip:c("editor.tasklist.tooltip")}})}},addExtensions(){return[f.configure(this.options.taskItem)]}});exports.TaskList=T;
@@ -102,6 +102,18 @@ declare module '@tiptap/core' {
102
102
  }
103
103
 
104
104
 
105
+ declare module '@tiptap/core' {
106
+ interface Commands<ReturnType> {
107
+ codeView: {
108
+ /**
109
+ * Toggle code view mode
110
+ */
111
+ toggleCodeView: () => ReturnType;
112
+ };
113
+ }
114
+ }
115
+
116
+
105
117
  declare module '@tiptap/core' {
106
118
  interface Commands<ReturnType> {
107
119
  drawer: {
package/lib/TaskList.d.ts CHANGED
@@ -102,6 +102,18 @@ declare module '@tiptap/core' {
102
102
  }
103
103
 
104
104
 
105
+ declare module '@tiptap/core' {
106
+ interface Commands<ReturnType> {
107
+ codeView: {
108
+ /**
109
+ * Toggle code view mode
110
+ */
111
+ toggleCodeView: () => ReturnType;
112
+ };
113
+ }
114
+ }
115
+
116
+
105
117
  declare module '@tiptap/core' {
106
118
  interface Commands<ReturnType> {
107
119
  drawer: {
package/lib/TaskList.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { N as m, w as b, m as l } from "./index-Drmyqk9P.js";
2
- import { A as f } from "./RichTextEditor-BhzFkRcp.js";
2
+ import { A as f } from "./RichTextEditor-D5VO1y1d.js";
3
3
  const L = /^\s*(\[([( |x])?\])\s$/, T = m.create({
4
4
  name: "taskItem",
5
5
  addOptions() {
package/lib/TextAlign.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index-COecBbaE.cjs"),n=require("react/jsx-runtime"),T=require("react"),l=require("./RichTextEditor-BulGh0GP.cjs"),j=y.Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const i=t.style.textAlign;return this.options.alignments.includes(i)?i:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:i})=>this.options.alignments.includes(t)?this.options.types.map(s=>i.updateAttributes(s,{textAlign:t})).every(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(i=>t.resetAttributes(i,"textAlign")).every(i=>i)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});function b(t){var s;const i=T.useMemo(()=>{var o;const e=(o=t==null?void 0:t.items)==null?void 0:o.find(a=>a.isActive());return e&&!e.default?{...e,icon:e.icon?e.icon:t.icon}:{title:t==null?void 0:t.tooltip,icon:t.icon,isActive:()=>!1}},[t]);return n.jsxs(l.Popover,{modal:!0,children:[n.jsx(l.PopoverTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:n.jsx(l.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:t==null?void 0:t.disabled,icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip,children:n.jsx(l.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),n.jsx(l.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:(s=t==null?void 0:t.items)==null?void 0:s.map((e,d)=>{var o,a;return n.jsxs(l.Tooltip,{children:[n.jsx(l.TooltipTrigger,{asChild:!0,children:n.jsx(l.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":i.title===e.title?"on":"off",onClick:e==null?void 0:e.action,pressed:i.title===e.title,size:"sm",children:(e==null?void 0:e.icon)&&n.jsx(l.IconComponent,{name:e.icon})})}),n.jsxs(l.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[n.jsx("span",{children:e.title}),!!((o=e.shortcutKeys)!=null&&o.length)&&n.jsx("span",{children:(a=e.shortcutKeys)==null?void 0:a.map(r=>l.getShortcutKey(r)).join(" ")})]})]},`text-align-${d}`)})})]})}const M=j.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["heading","paragraph","list_item","title"],button({editor:i,extension:s,t:e}){var u;const d=((u=s.options)==null?void 0:u.alignments)||[],o={left:["mod","Shift","L"],center:["mod","Shift","E"],right:["mod","Shift","R"],justify:["mod","Shift","J"]},a={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},r=d.map(c=>{var g,h,f;return{title:e(`editor.textalign.${c}.tooltip`),icon:a[c],shortcutKeys:o[c],isActive:()=>i.isActive({textAlign:c})||!1,action:()=>{var x,m;return(m=(x=i.commands)==null?void 0:x.setTextAlign)==null?void 0:m.call(x,c)},disabled:!((f=(h=(g=i==null?void 0:i.can)==null?void 0:g.call(i))==null?void 0:h.setTextAlign)!=null&&f.call(h,c))}}),A=r.filter(c=>c.disabled).length===r.length;return{component:b,componentProps:{icon:"AlignJustify",tooltip:e("editor.textalign.tooltip"),disabled:A,items:r}}}}}});exports.TextAlign=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index-COecBbaE.cjs"),n=require("react/jsx-runtime"),T=require("react"),l=require("./RichTextEditor-qp9T7xuG.cjs"),j=y.Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const i=t.style.textAlign;return this.options.alignments.includes(i)?i:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:i})=>this.options.alignments.includes(t)?this.options.types.map(s=>i.updateAttributes(s,{textAlign:t})).every(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(i=>t.resetAttributes(i,"textAlign")).every(i=>i)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});function b(t){var s;const i=T.useMemo(()=>{var o;const e=(o=t==null?void 0:t.items)==null?void 0:o.find(a=>a.isActive());return e&&!e.default?{...e,icon:e.icon?e.icon:t.icon}:{title:t==null?void 0:t.tooltip,icon:t.icon,isActive:()=>!1}},[t]);return n.jsxs(l.Popover,{modal:!0,children:[n.jsx(l.PopoverTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:n.jsx(l.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:t==null?void 0:t.disabled,icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip,children:n.jsx(l.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),n.jsx(l.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:(s=t==null?void 0:t.items)==null?void 0:s.map((e,d)=>{var o,a;return n.jsxs(l.Tooltip,{children:[n.jsx(l.TooltipTrigger,{asChild:!0,children:n.jsx(l.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":i.title===e.title?"on":"off",onClick:e==null?void 0:e.action,pressed:i.title===e.title,size:"sm",children:(e==null?void 0:e.icon)&&n.jsx(l.IconComponent,{name:e.icon})})}),n.jsxs(l.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[n.jsx("span",{children:e.title}),!!((o=e.shortcutKeys)!=null&&o.length)&&n.jsx("span",{children:(a=e.shortcutKeys)==null?void 0:a.map(r=>l.getShortcutKey(r)).join(" ")})]})]},`text-align-${d}`)})})]})}const M=j.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["heading","paragraph","list_item","title"],button({editor:i,extension:s,t:e}){var u;const d=((u=s.options)==null?void 0:u.alignments)||[],o={left:["mod","Shift","L"],center:["mod","Shift","E"],right:["mod","Shift","R"],justify:["mod","Shift","J"]},a={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},r=d.map(c=>{var g,h,f;return{title:e(`editor.textalign.${c}.tooltip`),icon:a[c],shortcutKeys:o[c],isActive:()=>i.isActive({textAlign:c})||!1,action:()=>{var x,m;return(m=(x=i.commands)==null?void 0:x.setTextAlign)==null?void 0:m.call(x,c)},disabled:!((f=(h=(g=i==null?void 0:i.can)==null?void 0:g.call(i))==null?void 0:h.setTextAlign)!=null&&f.call(h,c))}}),A=r.filter(c=>c.disabled).length===r.length;return{component:b,componentProps:{icon:"AlignJustify",tooltip:e("editor.textalign.tooltip"),disabled:A,items:r}}}}}});exports.TextAlign=M;
@@ -106,6 +106,18 @@ declare module '@tiptap/core' {
106
106
  }
107
107
 
108
108
 
109
+ declare module '@tiptap/core' {
110
+ interface Commands<ReturnType> {
111
+ codeView: {
112
+ /**
113
+ * Toggle code view mode
114
+ */
115
+ toggleCodeView: () => ReturnType;
116
+ };
117
+ }
118
+ }
119
+
120
+
109
121
  declare module '@tiptap/core' {
110
122
  interface Commands<ReturnType> {
111
123
  drawer: {
@@ -106,6 +106,18 @@ declare module '@tiptap/core' {
106
106
  }
107
107
 
108
108
 
109
+ declare module '@tiptap/core' {
110
+ interface Commands<ReturnType> {
111
+ codeView: {
112
+ /**
113
+ * Toggle code view mode
114
+ */
115
+ toggleCodeView: () => ReturnType;
116
+ };
117
+ }
118
+ }
119
+
120
+
109
121
  declare module '@tiptap/core' {
110
122
  interface Commands<ReturnType> {
111
123
  drawer: {
package/lib/TextAlign.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { E as T } from "./index-Drmyqk9P.js";
2
2
  import { jsxs as g, jsx as n } from "react/jsx-runtime";
3
3
  import { useMemo as b } from "react";
4
- import { P as M, m as v, A as S, k as A, n as C, T as j, a as K, r as w, b as P, s as z } from "./RichTextEditor-BhzFkRcp.js";
4
+ import { P as M, m as v, A as S, k as A, n as C, T as j, a as K, r as w, b as P, s as z } from "./RichTextEditor-D5VO1y1d.js";
5
5
  const L = T.create({
6
6
  name: "textAlign",
7
7
  addOptions() {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./index-COecBbaE.cjs"),t=require("react/jsx-runtime"),l=require("react"),x=require("lucide-react"),c=require("./RichTextEditor-BulGh0GP.cjs"),g=require("./index-LbrE7K9i.cjs");function b(e){const{t:i}=g.useLocale(),n=l.useMemo(()=>[{name:"paragraph",label:i("editor.paragraph.tooltip"),iconName:"Heading1",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:i("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:i("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:i("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:i("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:i("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:i("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:i("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()}],[e.editor,i]),a=l.useMemo(()=>n.findLast(o=>o.isActive())??{label:"Empty"},[n]);return t.jsxs(c.DropdownMenu,{children:[t.jsx(c.DropdownMenuTrigger,{asChild:!0,children:t.jsxs(c.Button,{className:"richtext-flex richtext-h-[32px] richtext-gap-1 richtext-px-1.5",variant:"ghost",children:[t.jsxs("span",{className:"richtext-whitespace-nowrap richtext-text-sm richtext-font-normal",children:[" ",a==null?void 0:a.label]}),t.jsx(x.ChevronDown,{className:"richtext-size-4"})]})}),t.jsx(c.DropdownMenuContent,{align:"start",className:"richtext-w-full richtext-p-1",hideWhenDetached:!0,sideOffset:5,children:n.map((o,d)=>{var r;const u=c.icons[o.iconName];return t.jsx(c.DropdownMenuCheckboxItem,{checked:((r=o.isActive)==null?void 0:r.call(o))||!1,className:"richtext-cursor-pointer",onClick:()=>o.action(),children:t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-px-2",children:[t.jsx(u,{className:"richtext-h3 richtext-w-3"}),t.jsxs("span",{children:[" ",o.label]})]})},`text-bubble-${d}`)})})]})}const s=h.Extension.create({name:"text-bubble",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),toolbar:!1,button:()=>({component:b,componentProps:{}})}}});exports.TextBubble=s;exports.default=s;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./index-COecBbaE.cjs"),t=require("react/jsx-runtime"),l=require("react"),x=require("lucide-react"),c=require("./RichTextEditor-qp9T7xuG.cjs"),g=require("./index-Dz3YxLE7.cjs");function b(e){const{t:i}=g.useLocale(),n=l.useMemo(()=>[{name:"paragraph",label:i("editor.paragraph.tooltip"),iconName:"Heading1",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:i("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:i("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:i("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:i("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:i("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:i("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:i("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()}],[e.editor,i]),a=l.useMemo(()=>n.findLast(o=>o.isActive())??{label:"Empty"},[n]);return t.jsxs(c.DropdownMenu,{children:[t.jsx(c.DropdownMenuTrigger,{asChild:!0,children:t.jsxs(c.Button,{className:"richtext-flex richtext-h-[32px] richtext-gap-1 richtext-px-1.5",variant:"ghost",children:[t.jsxs("span",{className:"richtext-whitespace-nowrap richtext-text-sm richtext-font-normal",children:[" ",a==null?void 0:a.label]}),t.jsx(x.ChevronDown,{className:"richtext-size-4"})]})}),t.jsx(c.DropdownMenuContent,{align:"start",className:"richtext-w-full richtext-p-1",hideWhenDetached:!0,sideOffset:5,children:n.map((o,d)=>{var r;const u=c.icons[o.iconName];return t.jsx(c.DropdownMenuCheckboxItem,{checked:((r=o.isActive)==null?void 0:r.call(o))||!1,className:"richtext-cursor-pointer",onClick:()=>o.action(),children:t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-px-2",children:[t.jsx(u,{className:"richtext-h3 richtext-w-3"}),t.jsxs("span",{children:[" ",o.label]})]})},`text-bubble-${d}`)})})]})}const s=h.Extension.create({name:"text-bubble",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),toolbar:!1,button:()=>({component:b,componentProps:{}})}}});exports.TextBubble=s;exports.default=s;
@@ -96,6 +96,18 @@ declare module '@tiptap/core' {
96
96
  }
97
97
 
98
98
 
99
+ declare module '@tiptap/core' {
100
+ interface Commands<ReturnType> {
101
+ codeView: {
102
+ /**
103
+ * Toggle code view mode
104
+ */
105
+ toggleCodeView: () => ReturnType;
106
+ };
107
+ }
108
+ }
109
+
110
+
99
111
  declare module '@tiptap/core' {
100
112
  interface Commands<ReturnType> {
101
113
  drawer: {
@@ -96,6 +96,18 @@ declare module '@tiptap/core' {
96
96
  }
97
97
 
98
98
 
99
+ declare module '@tiptap/core' {
100
+ interface Commands<ReturnType> {
101
+ codeView: {
102
+ /**
103
+ * Toggle code view mode
104
+ */
105
+ toggleCodeView: () => ReturnType;
106
+ };
107
+ }
108
+ }
109
+
110
+
99
111
  declare module '@tiptap/core' {
100
112
  interface Commands<ReturnType> {
101
113
  drawer: {
package/lib/TextBubble.js CHANGED
@@ -2,8 +2,8 @@ import { E as h } from "./index-Drmyqk9P.js";
2
2
  import { jsxs as o, jsx as a } from "react/jsx-runtime";
3
3
  import { useMemo as l } from "react";
4
4
  import { ChevronDown as u } from "lucide-react";
5
- import { D as m, e as g, B as x, f as b, i as v, h as f } from "./RichTextEditor-BhzFkRcp.js";
6
- import { u as N } from "./index-D9llIWB5.js";
5
+ import { D as m, e as g, B as x, f as b, i as v, h as f } from "./RichTextEditor-D5VO1y1d.js";
6
+ import { u as N } from "./index-D-DR0FPY.js";
7
7
  function A(e) {
8
8
  const { t } = N(), c = l(() => [
9
9
  {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./index-COecBbaE.cjs"),i=require("react/jsx-runtime"),b=require("react"),n=require("./RichTextEditor-BulGh0GP.cjs");function m(t){var s;const c=b.useMemo(()=>{var r;const e=(r=t==null?void 0:t.items)==null?void 0:r.find(o=>o.isActive());return e&&!e.default?{...e,icon:e.icon?e.icon:t.icon}:{title:t==null?void 0:t.tooltip,icon:t.icon,isActive:()=>!1}},[t]);return i.jsxs(n.Popover,{modal:!0,children:[i.jsx(n.PopoverTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:i.jsx(n.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:t==null?void 0:t.disabled,icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip,children:i.jsx(n.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),i.jsx(n.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:(s=t==null?void 0:t.items)==null?void 0:s.map((e,a)=>{var r,o;return i.jsxs(n.Tooltip,{children:[i.jsx(n.TooltipTrigger,{asChild:!0,children:i.jsx(n.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":c.title===e.title?"on":"off",onClick:e==null?void 0:e.action,pressed:c.title===e.title,size:"sm",children:(e==null?void 0:e.icon)&&i.jsx(n.IconComponent,{name:e.icon})})}),i.jsxs(n.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[i.jsx("span",{children:e.title}),!!((r=e.shortcutKeys)!=null&&r.length)&&i.jsx("span",{children:(o=e.shortcutKeys)==null?void 0:o.map(x=>n.getShortcutKey(x)).join(" ")})]})]},`text-align-${a}`)})})]})}const j=T.Extension.create({name:"text-direction",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["heading","paragraph"],directions:["auto","ltr","rtl"],defaultDirection:"auto",button({editor:c,extension:s,t:e}){var h;const a=((h=s.options)==null?void 0:h.directions)||[],r={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft"},o=a.map(l=>({title:e(`editor.textDirection.${l}.tooltip`),icon:r[l],isActive:()=>!1,action:()=>{var d,f,u,g;if(l==="auto"){(f=(d=c.commands)==null?void 0:d.unsetTextDirection)==null||f.call(d);return}(g=(u=c.commands)==null?void 0:u.setTextDirection)==null||g.call(u,l)},disabled:!1})),x=o.filter(l=>l.disabled).length===o.length;return{component:m,componentProps:{icon:"TextDirection",tooltip:e("editor.textDirection.tooltip"),disabled:x,items:o}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{dir:{default:this.options.defaultDirection,parseHTML:t=>t.attributes.dir&&this.options.directions.includes(t.attributes.dir)?t.attributes.dir.value:this.options.defaultDirection,renderHTML:t=>({dir:t.dir})}}}]},addCommands(){return{setTextDirection:t=>({commands:c})=>this.options.directions.includes(t)?this.options.types.every(s=>c.updateAttributes(s,{dir:t})):!1,unsetTextDirection:()=>({commands:t})=>this.options.types.every(c=>t.resetAttributes(c,"dir"))}}});exports.TextDirection=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./index-COecBbaE.cjs"),i=require("react/jsx-runtime"),b=require("react"),n=require("./RichTextEditor-qp9T7xuG.cjs");function m(t){var s;const c=b.useMemo(()=>{var r;const e=(r=t==null?void 0:t.items)==null?void 0:r.find(o=>o.isActive());return e&&!e.default?{...e,icon:e.icon?e.icon:t.icon}:{title:t==null?void 0:t.tooltip,icon:t.icon,isActive:()=>!1}},[t]);return i.jsxs(n.Popover,{modal:!0,children:[i.jsx(n.PopoverTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:i.jsx(n.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:t==null?void 0:t.disabled,icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip,children:i.jsx(n.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),i.jsx(n.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:(s=t==null?void 0:t.items)==null?void 0:s.map((e,a)=>{var r,o;return i.jsxs(n.Tooltip,{children:[i.jsx(n.TooltipTrigger,{asChild:!0,children:i.jsx(n.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":c.title===e.title?"on":"off",onClick:e==null?void 0:e.action,pressed:c.title===e.title,size:"sm",children:(e==null?void 0:e.icon)&&i.jsx(n.IconComponent,{name:e.icon})})}),i.jsxs(n.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[i.jsx("span",{children:e.title}),!!((r=e.shortcutKeys)!=null&&r.length)&&i.jsx("span",{children:(o=e.shortcutKeys)==null?void 0:o.map(x=>n.getShortcutKey(x)).join(" ")})]})]},`text-align-${a}`)})})]})}const j=T.Extension.create({name:"text-direction",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["heading","paragraph"],directions:["auto","ltr","rtl"],defaultDirection:"auto",button({editor:c,extension:s,t:e}){var h;const a=((h=s.options)==null?void 0:h.directions)||[],r={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft"},o=a.map(l=>({title:e(`editor.textDirection.${l}.tooltip`),icon:r[l],isActive:()=>!1,action:()=>{var d,f,u,g;if(l==="auto"){(f=(d=c.commands)==null?void 0:d.unsetTextDirection)==null||f.call(d);return}(g=(u=c.commands)==null?void 0:u.setTextDirection)==null||g.call(u,l)},disabled:!1})),x=o.filter(l=>l.disabled).length===o.length;return{component:m,componentProps:{icon:"TextDirection",tooltip:e("editor.textDirection.tooltip"),disabled:x,items:o}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{dir:{default:this.options.defaultDirection,parseHTML:t=>t.attributes.dir&&this.options.directions.includes(t.attributes.dir)?t.attributes.dir.value:this.options.defaultDirection,renderHTML:t=>({dir:t.dir})}}}]},addCommands(){return{setTextDirection:t=>({commands:c})=>this.options.directions.includes(t)?this.options.types.every(s=>c.updateAttributes(s,{dir:t})):!1,unsetTextDirection:()=>({commands:t})=>this.options.types.every(c=>t.resetAttributes(c,"dir"))}}});exports.TextDirection=j;
@@ -23,6 +23,18 @@ declare module '@tiptap/core' {
23
23
  }
24
24
 
25
25
 
26
+ declare module '@tiptap/core' {
27
+ interface Commands<ReturnType> {
28
+ codeView: {
29
+ /**
30
+ * Toggle code view mode
31
+ */
32
+ toggleCodeView: () => ReturnType;
33
+ };
34
+ }
35
+ }
36
+
37
+
26
38
  declare module '@tiptap/core' {
27
39
  interface Commands<ReturnType> {
28
40
  drawer: {
@@ -23,6 +23,18 @@ declare module '@tiptap/core' {
23
23
  }
24
24
 
25
25
 
26
+ declare module '@tiptap/core' {
27
+ interface Commands<ReturnType> {
28
+ codeView: {
29
+ /**
30
+ * Toggle code view mode
31
+ */
32
+ toggleCodeView: () => ReturnType;
33
+ };
34
+ }
35
+ }
36
+
37
+
26
38
  declare module '@tiptap/core' {
27
39
  interface Commands<ReturnType> {
28
40
  drawer: {
@@ -1,7 +1,7 @@
1
1
  import { E as b } from "./index-Drmyqk9P.js";
2
2
  import { jsxs as h, jsx as n } from "react/jsx-runtime";
3
3
  import { useMemo as g } from "react";
4
- import { P as D, m as v, A as y, k as T, n as A, T as C, a as w, r as M, b as P, s as z } from "./RichTextEditor-BhzFkRcp.js";
4
+ import { P as D, m as v, A as y, k as T, n as A, T as C, a as w, r as M, b as P, s as z } from "./RichTextEditor-D5VO1y1d.js";
5
5
  function L(t) {
6
6
  var c;
7
7
  const i = g(() => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-COecBbaE.cjs"),i=require("./RichTextEditor-BulGh0GP.cjs"),o=n.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",n.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),s=o.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:r}){return{component:i.ActionButton,componentProps:{action:()=>t.commands.toggleUnderline(),isActive:()=>t.isActive("underline")||!1,disabled:!1,icon:"Underline",shortcutKeys:["mod","U"],tooltip:r("editor.underline.tooltip")}}}}}});exports.TextUnderline=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-COecBbaE.cjs"),i=require("./RichTextEditor-qp9T7xuG.cjs"),o=n.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",n.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),s=o.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:r}){return{component:i.ActionButton,componentProps:{action:()=>t.commands.toggleUnderline(),isActive:()=>t.isActive("underline")||!1,disabled:!1,icon:"Underline",shortcutKeys:["mod","U"],tooltip:r("editor.underline.tooltip")}}}}}});exports.TextUnderline=s;
@@ -96,6 +96,18 @@ declare module '@tiptap/core' {
96
96
  }
97
97
 
98
98
 
99
+ declare module '@tiptap/core' {
100
+ interface Commands<ReturnType> {
101
+ codeView: {
102
+ /**
103
+ * Toggle code view mode
104
+ */
105
+ toggleCodeView: () => ReturnType;
106
+ };
107
+ }
108
+ }
109
+
110
+
99
111
  declare module '@tiptap/core' {
100
112
  interface Commands<ReturnType> {
101
113
  drawer: {
@@ -96,6 +96,18 @@ declare module '@tiptap/core' {
96
96
  }
97
97
 
98
98
 
99
+ declare module '@tiptap/core' {
100
+ interface Commands<ReturnType> {
101
+ codeView: {
102
+ /**
103
+ * Toggle code view mode
104
+ */
105
+ toggleCodeView: () => ReturnType;
106
+ };
107
+ }
108
+ }
109
+
110
+
99
111
  declare module '@tiptap/core' {
100
112
  interface Commands<ReturnType> {
101
113
  drawer: {
@@ -1,5 +1,5 @@
1
1
  import { M as r, m as o } from "./index-Drmyqk9P.js";
2
- import { A as i } from "./RichTextEditor-BhzFkRcp.js";
2
+ import { A as i } from "./RichTextEditor-D5VO1y1d.js";
3
3
  const s = r.create({
4
4
  name: "underline",
5
5
  addOptions() {
@@ -33,6 +33,18 @@ declare module '@tiptap/core' {
33
33
  }
34
34
 
35
35
 
36
+ declare module '@tiptap/core' {
37
+ interface Commands<ReturnType> {
38
+ codeView: {
39
+ /**
40
+ * Toggle code view mode
41
+ */
42
+ toggleCodeView: () => ReturnType;
43
+ };
44
+ }
45
+ }
46
+
47
+
36
48
  declare module '@tiptap/core' {
37
49
  interface Commands<ReturnType> {
38
50
  drawer: {
@@ -33,6 +33,18 @@ declare module '@tiptap/core' {
33
33
  }
34
34
 
35
35
 
36
+ declare module '@tiptap/core' {
37
+ interface Commands<ReturnType> {
38
+ codeView: {
39
+ /**
40
+ * Toggle code view mode
41
+ */
42
+ toggleCodeView: () => ReturnType;
43
+ };
44
+ }
45
+ }
46
+
47
+
36
48
  declare module '@tiptap/core' {
37
49
  interface Commands<ReturnType> {
38
50
  drawer: {
@@ -2,8 +2,8 @@ import { N as $t, m as Vt, L as Mt } from "./index-Drmyqk9P.js";
2
2
  import { c as H, N as jt, R as Bt } from "./dom-dataset-CJ7GyQ2E.js";
3
3
  import { jsx as r, jsxs as g, Fragment as Wt } from "react/jsx-runtime";
4
4
  import de, { useState as ce, Fragment as Ft, useEffect as Pe, useMemo as gt, createContext as Pt, useLayoutEffect as Ut, useContext as Ht, useRef as X, useCallback as Te, useDebugValue as zt } from "react";
5
- import { L as Gt, o as Kt, B as Xt, P as Qt, m as Jt, A as Yt, k as Zt, n as en } from "./RichTextEditor-BhzFkRcp.js";
6
- import { u as tn } from "./index-D9llIWB5.js";
5
+ import { L as Gt, o as Kt, B as Xt, P as Qt, m as Jt, A as Yt, k as Zt, n as en } from "./RichTextEditor-D5VO1y1d.js";
6
+ import { u as tn } from "./index-D-DR0FPY.js";
7
7
  const nn = "_verified_lvyh0_1", Ue = {
8
8
  verified: nn
9
9
  }, rn = () => /* @__PURE__ */ r("svg", {