reactjs-tiptap-editor 0.3.30 → 0.3.31

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 (224) hide show
  1. package/lib/{ActionMenuButton-wiDnIxE2.cjs → ActionMenuButton-BCgqJsST.cjs} +1 -1
  2. package/lib/{ActionMenuButton-B6fitGKu.js → ActionMenuButton-D97K0UWT.js} +5 -5
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +15 -15
  5. package/lib/Attachment.d.ts +15 -15
  6. package/lib/Attachment.js +1 -1
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +15 -15
  9. package/lib/Blockquote.d.ts +15 -15
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +15 -15
  13. package/lib/Bold.d.ts +15 -15
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +15 -15
  17. package/lib/BulletList.d.ts +15 -15
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +15 -15
  21. package/lib/Clear.d.ts +15 -15
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +15 -15
  25. package/lib/Code.d.ts +15 -15
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +15 -15
  29. package/lib/CodeBlock.d.ts +15 -15
  30. package/lib/CodeBlock.js +3 -2
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +15 -15
  33. package/lib/CodeView.d.ts +15 -15
  34. package/lib/CodeView.js +1 -1
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +15 -15
  37. package/lib/Color.d.ts +15 -15
  38. package/lib/Color.js +2 -2
  39. package/lib/Document.d.cts +15 -15
  40. package/lib/Document.d.ts +15 -15
  41. package/lib/Drawer-5Q_-WRhc.cjs +1 -0
  42. package/lib/{Drawer-BKTU9CpU.js → Drawer-BHkje8ys.js} +250 -249
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +15 -15
  45. package/lib/Drawer.d.ts +15 -15
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +15 -15
  49. package/lib/Emoji.d.ts +15 -15
  50. package/lib/Emoji.js +22 -21
  51. package/lib/Excalidraw-CG498239.js +290 -0
  52. package/lib/Excalidraw-GUVW-IqC.cjs +1 -0
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +15 -15
  55. package/lib/Excalidraw.d.ts +15 -15
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +15 -15
  59. package/lib/ExportPdf.d.ts +15 -15
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +15 -15
  63. package/lib/ExportWord.d.ts +15 -15
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +15 -15
  67. package/lib/FontFamily.d.ts +15 -15
  68. package/lib/FontFamily.js +11 -10
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +15 -15
  71. package/lib/FontSize.d.ts +15 -15
  72. package/lib/FontSize.js +6 -5
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +15 -15
  75. package/lib/FormatPainter.d.ts +15 -15
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +15 -15
  79. package/lib/Heading.d.ts +15 -15
  80. package/lib/Heading.js +32 -31
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +15 -15
  83. package/lib/Highlight.d.ts +15 -15
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +15 -15
  87. package/lib/History.d.ts +15 -15
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +15 -15
  91. package/lib/HorizontalRule.d.ts +15 -15
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +15 -15
  95. package/lib/Iframe.d.ts +15 -15
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +15 -15
  99. package/lib/Image.d.ts +15 -15
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +15 -15
  103. package/lib/ImageGif.d.ts +15 -15
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +2 -2
  106. package/lib/ImportWord.d.cts +15 -15
  107. package/lib/ImportWord.d.ts +15 -15
  108. package/lib/ImportWord.js +3 -2
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +15 -15
  111. package/lib/Indent.d.ts +15 -15
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +15 -15
  115. package/lib/Italic.d.ts +15 -15
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +15 -15
  119. package/lib/Katex.d.ts +15 -15
  120. package/lib/Katex.js +41 -40
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +15 -15
  123. package/lib/LineHeight.d.ts +15 -15
  124. package/lib/LineHeight.js +17 -16
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +15 -15
  127. package/lib/Link.d.ts +15 -15
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +15 -15
  130. package/lib/ListItem.d.ts +15 -15
  131. package/lib/Mention.d.cts +15 -15
  132. package/lib/Mention.d.ts +15 -15
  133. package/lib/Mermaid.cjs +2 -2
  134. package/lib/Mermaid.d.cts +15 -15
  135. package/lib/Mermaid.d.ts +15 -15
  136. package/lib/Mermaid.js +138 -137
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +15 -15
  139. package/lib/MoreMark.d.ts +15 -15
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +15 -15
  143. package/lib/MultiColumn.d.ts +15 -15
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +15 -15
  147. package/lib/OrderedList.d.ts +15 -15
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-C8Sm1E6J.cjs → RichTextEditor-DWlLqTl9.cjs} +4 -4
  150. package/lib/{RichTextEditor-BQN2eLD_.js → RichTextEditor-KP2Rgcqe.js} +15 -39
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +15 -15
  153. package/lib/SearchAndReplace.d.ts +15 -15
  154. package/lib/SearchAndReplace.js +68 -67
  155. package/lib/Selection.d.cts +15 -15
  156. package/lib/Selection.d.ts +15 -15
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +15 -15
  159. package/lib/SlashCommand.d.ts +15 -15
  160. package/lib/SlashCommand.js +1 -1
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +15 -15
  163. package/lib/Strike.d.ts +15 -15
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +15 -15
  167. package/lib/SubAndSuperScript.d.ts +15 -15
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +15 -15
  171. package/lib/Table.d.ts +15 -15
  172. package/lib/Table.js +2 -1
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +15 -15
  175. package/lib/TableOfContent.d.ts +15 -15
  176. package/lib/TableOfContent.js +50 -49
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +15 -15
  179. package/lib/TaskList.d.ts +15 -15
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +15 -15
  183. package/lib/TextAlign.d.ts +15 -15
  184. package/lib/TextAlign.js +8 -7
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +15 -15
  187. package/lib/TextBubble.d.ts +15 -15
  188. package/lib/TextBubble.js +1 -1
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +15 -15
  191. package/lib/TextDirection.d.ts +15 -15
  192. package/lib/TextDirection.js +14 -13
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +15 -15
  195. package/lib/TextUnderline.d.ts +15 -15
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +15 -15
  198. package/lib/TrailingNode.d.ts +15 -15
  199. package/lib/{Twitter-Dg6WWauX.js → Twitter-99ivY5qv.js} +62 -61
  200. package/lib/{Twitter-CL2pu4QM.cjs → Twitter-BvfvUtNT.cjs} +2 -2
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +15 -15
  203. package/lib/Twitter.d.ts +15 -15
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +15 -15
  207. package/lib/Video.d.ts +15 -15
  208. package/lib/Video.js +1 -1
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +15 -15
  211. package/lib/bubble-extra.d.ts +15 -15
  212. package/lib/bubble-extra.js +5 -5
  213. package/lib/index.cjs +1 -1
  214. package/lib/index.d.cts +16 -15
  215. package/lib/index.d.ts +16 -15
  216. package/lib/index.js +2 -2
  217. package/lib/locale-bundle.d.cts +15 -15
  218. package/lib/locale-bundle.d.ts +15 -15
  219. package/lib/{textarea-BglwYF6b.js → textarea-CktfkXNe.js} +1 -1
  220. package/lib/{textarea-D5WVZMgt.cjs → textarea-DdH64g04.cjs} +1 -1
  221. package/package.json +1 -1
  222. package/lib/Drawer-CmoEF-Zg.cjs +0 -1
  223. package/lib/Excalidraw-CM74U5tG.js +0 -289
  224. package/lib/Excalidraw-DAPP9qgY.cjs +0 -1
@@ -5900,6 +5900,7 @@ function ix(e) {
5900
5900
  F,
5901
5901
  {
5902
5902
  tooltip: e == null ? void 0 : e.tooltip,
5903
+ tooltipOptions: e == null ? void 0 : e.tooltipOptions,
5903
5904
  isActive: e == null ? void 0 : e.isActive,
5904
5905
  disabled: e == null ? void 0 : e.disabled,
5905
5906
  children: /* @__PURE__ */ l(ye, { name: e == null ? void 0 : e.icon })
@@ -6800,7 +6801,8 @@ function xx(e) {
6800
6801
  {
6801
6802
  action: () => i(!0),
6802
6803
  icon: e.icon,
6803
- tooltip: e.tooltip
6804
+ tooltip: e.tooltip,
6805
+ tooltipOptions: e.tooltipOptions
6804
6806
  }
6805
6807
  ) }),
6806
6808
  /* @__PURE__ */ R(Rr, { children: [
@@ -7344,41 +7346,9 @@ const Rx = {
7344
7346
  props: {
7345
7347
  handlePaste: (r, n) => {
7346
7348
  var a;
7347
- if (!(n.clipboardData && n.clipboardData.files && ((a = n.clipboardData.files) == null ? void 0 : a.length)))
7348
- return;
7349
- if ([...n.clipboardData.files || []].some((s) => s.type === "text/html"))
7350
- return !1;
7351
- if (n.clipboardData.items.length == 2) {
7352
- n.clipboardData.items[0].getAsString((s) => {
7353
- let c = "";
7354
- if (s.replace(/src\s*=\s*"(.*)"/, (u, f) => c = f), c && typeof c == "string") {
7355
- const u = r.state.schema.nodes.image.create({
7356
- src: c
7357
- }), f = r.state.tr.replaceSelectionWith(u);
7358
- r.dispatch(f);
7359
- }
7360
- });
7361
- return;
7362
- }
7363
- return Tx(r, n, t);
7349
+ return n.clipboardData && n.clipboardData.files && ((a = n.clipboardData.files) == null ? void 0 : a.length) ? [...n.clipboardData.files || []].some((s) => s.type === "text/html") ? !1 : Tx(r, n, t) : void 0;
7364
7350
  },
7365
- handleDrop: (r, n, i, o) => {
7366
- if (!(n instanceof DragEvent) || !n.dataTransfer)
7367
- return !1;
7368
- if (n.dataTransfer.items.length == 2) {
7369
- n.dataTransfer.items[0].getAsString((a) => {
7370
- let s = "";
7371
- if (a.replace(/src\s*=\s*"(.*)"/, (c, u) => s = u), s && typeof s == "string") {
7372
- const c = r.state.schema.nodes.image.create({
7373
- src: s
7374
- }), u = r.state.tr.replaceSelectionWith(c);
7375
- r.dispatch(u);
7376
- }
7377
- });
7378
- return;
7379
- }
7380
- return Ex(r, n, o, t), !1;
7381
- }
7351
+ handleDrop: (r, n, i, o) => (!(n instanceof DragEvent) || !n.dataTransfer || Ex(r, n, o, t), !1)
7382
7352
  }
7383
7353
  })
7384
7354
  ];
@@ -7510,7 +7480,8 @@ function Lx({ editor: e, icon: t, provider: r, apiKey: n, ...i }) {
7510
7480
  F,
7511
7481
  {
7512
7482
  icon: t,
7513
- tooltip: i == null ? void 0 : i.tooltip
7483
+ tooltip: i == null ? void 0 : i.tooltip,
7484
+ tooltipOptions: i == null ? void 0 : i.tooltipOptions
7514
7485
  }
7515
7486
  )
7516
7487
  }
@@ -7840,7 +7811,8 @@ function Dx(e) {
7840
7811
  {
7841
7812
  action: () => c(!0),
7842
7813
  icon: e.icon,
7843
- tooltip: e.tooltip
7814
+ tooltip: e.tooltip,
7815
+ tooltipOptions: e.tooltipOptions
7844
7816
  }
7845
7817
  ) }),
7846
7818
  /* @__PURE__ */ R(Rr, { children: [
@@ -12322,7 +12294,7 @@ function Z2({ editor: e, disabled: t, toolbar: r }) {
12322
12294
  children: /* @__PURE__ */ l("div", { className: "richtext-relative richtext-flex richtext-flex-wrap richtext-h-auto richtext-gap-y-1 richtext-gap-x-1", children: c })
12323
12295
  }
12324
12296
  ), s = o.map((c, u) => {
12325
- var d, h;
12297
+ var d, h, p, m;
12326
12298
  const f = c.button.component;
12327
12299
  return /* @__PURE__ */ R("div", { className: "richtext-flex richtext-items-center", children: [
12328
12300
  (c == null ? void 0 : c.spacer) && /* @__PURE__ */ l(Ge, { orientation: "vertical", className: "!richtext-h-[16px] !richtext-mx-[10px]" }),
@@ -12330,7 +12302,11 @@ function Z2({ editor: e, disabled: t, toolbar: r }) {
12330
12302
  f,
12331
12303
  {
12332
12304
  ...c.button.componentProps,
12333
- disabled: t || ((h = (d = c == null ? void 0 : c.button) == null ? void 0 : d.componentProps) == null ? void 0 : h.disabled)
12305
+ disabled: t || ((h = (d = c == null ? void 0 : c.button) == null ? void 0 : d.componentProps) == null ? void 0 : h.disabled),
12306
+ tooltipOptions: {
12307
+ ...(m = (p = c == null ? void 0 : c.button) == null ? void 0 : p.componentProps) == null ? void 0 : m.tooltipOptions,
12308
+ side: (r == null ? void 0 : r.tooltipSide) ?? "top"
12309
+ }
12334
12310
  }
12335
12311
  ),
12336
12312
  (c == null ? void 0 : c.divider) && /* @__PURE__ */ l(Ge, { orientation: "vertical", className: "!richtext-h-auto !richtext-mx-2" })
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-ByRfqzMr.cjs"),P=require("scroll-into-view-if-needed"),i=require("react/jsx-runtime"),f=require("react"),c=require("./RichTextEditor-C8Sm1E6J.cjs"),A=require("./index-D_A0TBRA.cjs");function w({editor:e,...t}){const{t:s}=A.useLocale(),[a,n]=f.useState(-1),[r,l]=f.useState([]),[o,x]=f.useState(""),[u,h]=f.useState(""),[m,C]=f.useState(!1),[p,I]=f.useState(!1);return f.useEffect(()=>{m||(x(""),h(""),n(-1),l([]),e.commands.setSearchTerm(""),e.commands.setReplaceTerm(""))},[e,m]),f.useEffect(()=>{m&&e&&e.commands&&e.commands.setSearchTerm&&e.commands.setSearchTerm(o)},[m,o,e]),f.useEffect(()=>{m&&e&&e.commands&&e.commands.setReplaceTerm&&e.commands.setReplaceTerm(u)},[m,u,e]),f.useEffect(()=>{if(!e)return;const d=e.extensionManager.extensions.find(R=>R.name===j.name);if(!d)return;const T=()=>{if(!m)return;const R=d?d.storage.currentIndex:-1,v=d?d.storage.results:[];n(E=>E!==R?R:E),l(E=>c.deepEqual(E,v)?E:v)};return c.listenEvent(c.EVENTS.SEARCH_REPLCE,T),()=>{d&&c.listenEvent(c.EVENTS.SEARCH_REPLCE,T)}},[m,e]),i.jsxs(c.Popover,{onOpenChange:C,open:m,children:[i.jsx(c.PopoverTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:i.jsx(c.ActionButton,{disabled:t==null?void 0:t.disabled,isActive:t==null?void 0:t.isActive,tooltip:t==null?void 0:t.tooltip,children:i.jsx(c.IconComponent,{name:t==null?void 0:t.icon})})}),i.jsxs(c.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:[i.jsxs("div",{className:"richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between",children:[i.jsx(c.Label,{children:s("editor.search.dialog.text")}),i.jsx("span",{className:"richtext-font-semibold",children:r.length>0?`${a+1}/${r.length}`:"0/0"})]}),i.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:[i.jsx(c.Input,{autoFocus:!0,className:"richtext-w-full",onChange:d=>x(d.target.value),placeholder:"Text",required:!0,type:"text",value:o}),i.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.goToPrevSearchResult,children:i.jsx(c.IconComponent,{name:"ChevronUp"})}),i.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.goToNextSearchResult,children:i.jsx(c.IconComponent,{name:"ChevronDown"})})]}),i.jsx(c.Label,{className:"richtext-mb-[6px]",children:s("editor.replace.dialog.text")}),i.jsx("div",{className:"richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:i.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:i.jsx(c.Input,{className:"richtext-w-80",onChange:d=>h(d.target.value),placeholder:"Text",required:!0,type:"text",value:u})})}),i.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-items-center richtext-space-x-2",children:[i.jsx(c.Switch,{checked:p,onCheckedChange:d=>{I(d),e.commands.setCaseSensitive(d)}}),i.jsx(c.Label,{children:s("editor.replace.caseSensitive")})]}),i.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[i.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.replace,children:s("editor.replace.dialog.text")}),i.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.replaceAll,children:s("editor.replaceAll.dialog.text")})]})]})]})}const S=(e,t)=>t(e.tr);function V(e,t,s){return RegExp(t?e.replace(/[$()*+./?[\\\]^{|}-]/g,String.raw`\$&`):e,s?"gu":"gui")}function L(e,t,s){const a=[];let n=[];const r=[];let l=0;if(!t)return{decorationsToReturn:[],results:[]};e==null||e.descendants((o,x)=>{o.isText?n[l]?n[l]={text:n[l].text+o.text,pos:n[l].pos}:n[l]={text:`${o.text}`,pos:x}:l+=1}),n=n.filter(Boolean);for(const{text:o,pos:x}of n){const u=[...o.matchAll(t)];for(const h of u){if(h[0]==="")break;h.index!==void 0&&r.push({from:x+h.index,to:x+h.index+h[0].length})}}for(const o of r)a.push(g.Decoration.inline(o.from,o.to,{class:s}));return{decorationsToReturn:a,results:r}}function b(e,t,{state:s,dispatch:a}){if(!t[0])return;const{from:r,to:l}=t[0];a&&a(s.tr.insertText(e,r,l))}function y(e,t,s,a){const n=t+1;if(!a[n])return null;const{from:r,to:l}=a[t],o=l-r-e.length+s,{from:x,to:u}=a[n];return a[n]={to:u-o,from:x-o},[o,a]}function D(e,t,{tr:s,dispatch:a}){let n=0,r=t.slice();if(r.length===0)return!1;for(let l=0;l<r.length;l+=1){const{from:o,to:x}=r[l];s.insertText(e,o,x);const u=y(e,l,n,r);u&&(n=u[0],r=u[1])}return a(s),!0}function N({view:e,tr:t,searchResults:s,searchResultCurrentClass:a,gotoIndex:n}){const r=s[n];if(r){const l=t.setMeta("directDecoration",{fromPos:r.from,toPos:r.to,attrs:{class:a}});return e==null||e.dispatch(l),setTimeout(()=>{const o=window.document.querySelector(`.${a}`);o&&P(o,{behavior:"smooth",scrollMode:"if-needed"})},0),!0}return!1}const j=g.Extension.create({name:"search",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),searchTerm:"",replaceTerm:"",results:[],currentIndex:0,searchResultClass:"search-result",searchResultCurrentClass:"search-result-current",caseSensitive:!1,disableRegex:!1,onChange:()=>{},button:({editor:t,t:s})=>({component:w,componentProps:{action:()=>{},icon:"SearchAndReplace",tooltip:s("editor.searchAndReplace.tooltip"),isActive:()=>!1,disabled:!1,editor:t}})}},addStorage(){return{results:[],currentIndex:-1}},addCommands(){return{setSearchTerm:e=>({state:t,dispatch:s})=>(this.options.searchTerm=e,this.storage.results=[],this.storage.currentIndex=0,c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(t,s),!1),setReplaceTerm:e=>({state:t,dispatch:s})=>(this.options.replaceTerm=e,S(t,s),!1),setCaseSensitive:e=>({state:t,dispatch:s})=>(this.options.caseSensitive=e,S(t,s),!1),replace:()=>({state:e,dispatch:t})=>{const{replaceTerm:s}=this.options,{currentIndex:a,results:n}=this.storage,r=n[a];return r?(b(s,[r],{state:e,dispatch:t}),this.storage.results.splice(a,1)):(b(s,n,{state:e,dispatch:t}),this.storage.results.shift()),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(e,t),!1},replaceAll:()=>({state:e,tr:t,dispatch:s})=>{const{replaceTerm:a}=this.options,{results:n}=this.storage;return D(a,n,{tr:t,dispatch:s}),this.storage.currentIndex=-1,this.storage.results=[],c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(e,s),!1},goToPrevSearchResult:()=>({view:e,tr:t})=>{const{searchResultCurrentClass:s}=this.options,{currentIndex:a,results:n}=this.storage,r=(a+n.length-1)%n.length;return this.storage.currentIndex=r,c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),N({view:e,tr:t,searchResults:n,searchResultCurrentClass:s,gotoIndex:r})},goToNextSearchResult:()=>({view:e,tr:t})=>{const{searchResultCurrentClass:s}=this.options,{currentIndex:a,results:n}=this.storage,r=(a+1)%n.length;return this.storage.currentIndex=r,this.options.onChange&&this.options.onChange(),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),N({view:e,tr:t,searchResults:n,searchResultCurrentClass:s,gotoIndex:r})}}},addProseMirrorPlugins(){const e=this;return[new g.Plugin({key:new g.PluginKey("search"),state:{init(){return g.DecorationSet.empty},apply(t){const{doc:s,docChanged:a}=t,{searchTerm:n,searchResultClass:r,searchResultCurrentClass:l,disableRegex:o,caseSensitive:x}=e.options;if(a||n){const{decorationsToReturn:u,results:h}=L(s,V(n,o,x),r);if(e.storage.results=h,e.storage.currentIndex>h.length-1&&(e.storage.currentIndex=0),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),t.getMeta("directDecoration")){const{fromPos:m,toPos:C,attrs:p}=t.getMeta("directDecoration");u.push(g.Decoration.inline(m,C,p))}else h.length>0&&(u[0]=g.Decoration.inline(h[0].from,h[0].to,{class:l}));return g.DecorationSet.create(s,u)}return g.DecorationSet.empty}},props:{decorations(t){return this.getState(t)}}})]}});exports.SearchAndReplace=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-ByRfqzMr.cjs"),P=require("scroll-into-view-if-needed"),a=require("react/jsx-runtime"),f=require("react"),c=require("./RichTextEditor-DWlLqTl9.cjs"),A=require("./index-D_A0TBRA.cjs");function w({editor:e,...t}){const{t:s}=A.useLocale(),[i,n]=f.useState(-1),[r,l]=f.useState([]),[o,x]=f.useState(""),[u,h]=f.useState(""),[m,C]=f.useState(!1),[T,I]=f.useState(!1);return f.useEffect(()=>{m||(x(""),h(""),n(-1),l([]),e.commands.setSearchTerm(""),e.commands.setReplaceTerm(""))},[e,m]),f.useEffect(()=>{m&&e&&e.commands&&e.commands.setSearchTerm&&e.commands.setSearchTerm(o)},[m,o,e]),f.useEffect(()=>{m&&e&&e.commands&&e.commands.setReplaceTerm&&e.commands.setReplaceTerm(u)},[m,u,e]),f.useEffect(()=>{if(!e)return;const d=e.extensionManager.extensions.find(R=>R.name===j.name);if(!d)return;const p=()=>{if(!m)return;const R=d?d.storage.currentIndex:-1,v=d?d.storage.results:[];n(E=>E!==R?R:E),l(E=>c.deepEqual(E,v)?E:v)};return c.listenEvent(c.EVENTS.SEARCH_REPLCE,p),()=>{d&&c.listenEvent(c.EVENTS.SEARCH_REPLCE,p)}},[m,e]),a.jsxs(c.Popover,{onOpenChange:C,open:m,children:[a.jsx(c.PopoverTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:a.jsx(c.ActionButton,{disabled:t==null?void 0:t.disabled,isActive:t==null?void 0:t.isActive,tooltip:t==null?void 0:t.tooltip,tooltipOptions:t==null?void 0:t.tooltipOptions,children:a.jsx(c.IconComponent,{name:t==null?void 0:t.icon})})}),a.jsxs(c.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:[a.jsxs("div",{className:"richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between",children:[a.jsx(c.Label,{children:s("editor.search.dialog.text")}),a.jsx("span",{className:"richtext-font-semibold",children:r.length>0?`${i+1}/${r.length}`:"0/0"})]}),a.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:[a.jsx(c.Input,{autoFocus:!0,className:"richtext-w-full",onChange:d=>x(d.target.value),placeholder:"Text",required:!0,type:"text",value:o}),a.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.goToPrevSearchResult,children:a.jsx(c.IconComponent,{name:"ChevronUp"})}),a.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.goToNextSearchResult,children:a.jsx(c.IconComponent,{name:"ChevronDown"})})]}),a.jsx(c.Label,{className:"richtext-mb-[6px]",children:s("editor.replace.dialog.text")}),a.jsx("div",{className:"richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:a.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:a.jsx(c.Input,{className:"richtext-w-80",onChange:d=>h(d.target.value),placeholder:"Text",required:!0,type:"text",value:u})})}),a.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-items-center richtext-space-x-2",children:[a.jsx(c.Switch,{checked:T,onCheckedChange:d=>{I(d),e.commands.setCaseSensitive(d)}}),a.jsx(c.Label,{children:s("editor.replace.caseSensitive")})]}),a.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[a.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.replace,children:s("editor.replace.dialog.text")}),a.jsx(c.Button,{className:"richtext-flex-1",disabled:r.length===0,onClick:e.commands.replaceAll,children:s("editor.replaceAll.dialog.text")})]})]})]})}const S=(e,t)=>t(e.tr);function V(e,t,s){return RegExp(t?e.replace(/[$()*+./?[\\\]^{|}-]/g,String.raw`\$&`):e,s?"gu":"gui")}function L(e,t,s){const i=[];let n=[];const r=[];let l=0;if(!t)return{decorationsToReturn:[],results:[]};e==null||e.descendants((o,x)=>{o.isText?n[l]?n[l]={text:n[l].text+o.text,pos:n[l].pos}:n[l]={text:`${o.text}`,pos:x}:l+=1}),n=n.filter(Boolean);for(const{text:o,pos:x}of n){const u=[...o.matchAll(t)];for(const h of u){if(h[0]==="")break;h.index!==void 0&&r.push({from:x+h.index,to:x+h.index+h[0].length})}}for(const o of r)i.push(g.Decoration.inline(o.from,o.to,{class:s}));return{decorationsToReturn:i,results:r}}function b(e,t,{state:s,dispatch:i}){if(!t[0])return;const{from:r,to:l}=t[0];i&&i(s.tr.insertText(e,r,l))}function y(e,t,s,i){const n=t+1;if(!i[n])return null;const{from:r,to:l}=i[t],o=l-r-e.length+s,{from:x,to:u}=i[n];return i[n]={to:u-o,from:x-o},[o,i]}function D(e,t,{tr:s,dispatch:i}){let n=0,r=t.slice();if(r.length===0)return!1;for(let l=0;l<r.length;l+=1){const{from:o,to:x}=r[l];s.insertText(e,o,x);const u=y(e,l,n,r);u&&(n=u[0],r=u[1])}return i(s),!0}function N({view:e,tr:t,searchResults:s,searchResultCurrentClass:i,gotoIndex:n}){const r=s[n];if(r){const l=t.setMeta("directDecoration",{fromPos:r.from,toPos:r.to,attrs:{class:i}});return e==null||e.dispatch(l),setTimeout(()=>{const o=window.document.querySelector(`.${i}`);o&&P(o,{behavior:"smooth",scrollMode:"if-needed"})},0),!0}return!1}const j=g.Extension.create({name:"search",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),searchTerm:"",replaceTerm:"",results:[],currentIndex:0,searchResultClass:"search-result",searchResultCurrentClass:"search-result-current",caseSensitive:!1,disableRegex:!1,onChange:()=>{},button:({editor:t,t:s})=>({component:w,componentProps:{action:()=>{},icon:"SearchAndReplace",tooltip:s("editor.searchAndReplace.tooltip"),isActive:()=>!1,disabled:!1,editor:t}})}},addStorage(){return{results:[],currentIndex:-1}},addCommands(){return{setSearchTerm:e=>({state:t,dispatch:s})=>(this.options.searchTerm=e,this.storage.results=[],this.storage.currentIndex=0,c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(t,s),!1),setReplaceTerm:e=>({state:t,dispatch:s})=>(this.options.replaceTerm=e,S(t,s),!1),setCaseSensitive:e=>({state:t,dispatch:s})=>(this.options.caseSensitive=e,S(t,s),!1),replace:()=>({state:e,dispatch:t})=>{const{replaceTerm:s}=this.options,{currentIndex:i,results:n}=this.storage,r=n[i];return r?(b(s,[r],{state:e,dispatch:t}),this.storage.results.splice(i,1)):(b(s,n,{state:e,dispatch:t}),this.storage.results.shift()),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(e,t),!1},replaceAll:()=>({state:e,tr:t,dispatch:s})=>{const{replaceTerm:i}=this.options,{results:n}=this.storage;return D(i,n,{tr:t,dispatch:s}),this.storage.currentIndex=-1,this.storage.results=[],c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),S(e,s),!1},goToPrevSearchResult:()=>({view:e,tr:t})=>{const{searchResultCurrentClass:s}=this.options,{currentIndex:i,results:n}=this.storage,r=(i+n.length-1)%n.length;return this.storage.currentIndex=r,c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),N({view:e,tr:t,searchResults:n,searchResultCurrentClass:s,gotoIndex:r})},goToNextSearchResult:()=>({view:e,tr:t})=>{const{searchResultCurrentClass:s}=this.options,{currentIndex:i,results:n}=this.storage,r=(i+1)%n.length;return this.storage.currentIndex=r,this.options.onChange&&this.options.onChange(),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),N({view:e,tr:t,searchResults:n,searchResultCurrentClass:s,gotoIndex:r})}}},addProseMirrorPlugins(){const e=this;return[new g.Plugin({key:new g.PluginKey("search"),state:{init(){return g.DecorationSet.empty},apply(t){const{doc:s,docChanged:i}=t,{searchTerm:n,searchResultClass:r,searchResultCurrentClass:l,disableRegex:o,caseSensitive:x}=e.options;if(i||n){const{decorationsToReturn:u,results:h}=L(s,V(n,o,x),r);if(e.storage.results=h,e.storage.currentIndex>h.length-1&&(e.storage.currentIndex=0),c.dispatchEvent(c.EVENTS.SEARCH_REPLCE),t.getMeta("directDecoration")){const{fromPos:m,toPos:C,attrs:T}=t.getMeta("directDecoration");u.push(g.Decoration.inline(m,C,T))}else h.length>0&&(u[0]=g.Decoration.inline(h[0].from,h[0].to,{class:l}));return g.DecorationSet.create(s,u)}return g.DecorationSet.empty}},props:{decorations(t){return this.getState(t)}}})]}});exports.SearchAndReplace=j;
@@ -201,6 +201,21 @@ declare module '@tiptap/core' {
201
201
  }
202
202
 
203
203
 
204
+ declare module '@tiptap/core' {
205
+ interface Commands<ReturnType> {
206
+ iframe: {
207
+ /**
208
+ * Add an iframe
209
+ */
210
+ setIframe: (options: {
211
+ src: string;
212
+ service: string;
213
+ }) => ReturnType;
214
+ };
215
+ }
216
+ }
217
+
218
+
204
219
  declare module '@tiptap/core' {
205
220
  interface Commands<ReturnType> {
206
221
  imageUpload: {
@@ -221,21 +236,6 @@ declare module '@tiptap/core' {
221
236
  }
222
237
 
223
238
 
224
- declare module '@tiptap/core' {
225
- interface Commands<ReturnType> {
226
- iframe: {
227
- /**
228
- * Add an iframe
229
- */
230
- setIframe: (options: {
231
- src: string;
232
- service: string;
233
- }) => ReturnType;
234
- };
235
- }
236
- }
237
-
238
-
239
239
  declare module '@tiptap/core' {
240
240
  interface Commands<ReturnType> {
241
241
  imageGifUpload: {
@@ -201,6 +201,21 @@ declare module '@tiptap/core' {
201
201
  }
202
202
 
203
203
 
204
+ declare module '@tiptap/core' {
205
+ interface Commands<ReturnType> {
206
+ iframe: {
207
+ /**
208
+ * Add an iframe
209
+ */
210
+ setIframe: (options: {
211
+ src: string;
212
+ service: string;
213
+ }) => ReturnType;
214
+ };
215
+ }
216
+ }
217
+
218
+
204
219
  declare module '@tiptap/core' {
205
220
  interface Commands<ReturnType> {
206
221
  imageUpload: {
@@ -221,21 +236,6 @@ declare module '@tiptap/core' {
221
236
  }
222
237
 
223
238
 
224
- declare module '@tiptap/core' {
225
- interface Commands<ReturnType> {
226
- iframe: {
227
- /**
228
- * Add an iframe
229
- */
230
- setIframe: (options: {
231
- src: string;
232
- service: string;
233
- }) => ReturnType;
234
- };
235
- }
236
- }
237
-
238
-
239
239
  declare module '@tiptap/core' {
240
240
  interface Commands<ReturnType> {
241
241
  imageGifUpload: {
@@ -1,28 +1,28 @@
1
1
  import { E as _, P as M, a as $, b as N, D as P } from "./index-DI9T3iLd.js";
2
2
  import q from "scroll-into-view-if-needed";
3
3
  import { jsxs as f, jsx as o } from "react/jsx-runtime";
4
- import { useState as g, useEffect as E } from "react";
5
- import { l as k, E as d, P as B, m as j, A as F, k as A, n as O, L as I, o as y, B as T, S as W, p as K, q as R } from "./RichTextEditor-BQN2eLD_.js";
4
+ import { useState as g, useEffect as p } from "react";
5
+ import { l as k, E as d, P as B, m as O, A as j, k as A, n as F, L as I, o as y, B as T, S as W, p as K, q as R } from "./RichTextEditor-KP2Rgcqe.js";
6
6
  import { u as U } from "./index-CsK90iVd.js";
7
7
  function z({ editor: e, ...t }) {
8
- const { t: s } = U(), [c, r] = g(-1), [n, i] = g([]), [a, u] = g(""), [l, h] = g(""), [x, v] = g(!1), [b, V] = g(!1);
9
- return E(() => {
10
- x || (u(""), h(""), r(-1), i([]), e.commands.setSearchTerm(""), e.commands.setReplaceTerm(""));
11
- }, [e, x]), E(() => {
8
+ const { t: s } = U(), [c, n] = g(-1), [r, i] = g([]), [a, u] = g(""), [l, h] = g(""), [x, v] = g(!1), [b, V] = g(!1);
9
+ return p(() => {
10
+ x || (u(""), h(""), n(-1), i([]), e.commands.setSearchTerm(""), e.commands.setReplaceTerm(""));
11
+ }, [e, x]), p(() => {
12
12
  x && e && e.commands && e.commands.setSearchTerm && e.commands.setSearchTerm(a);
13
- }, [x, a, e]), E(() => {
13
+ }, [x, a, e]), p(() => {
14
14
  x && e && e.commands && e.commands.setReplaceTerm && e.commands.setReplaceTerm(l);
15
- }, [x, l, e]), E(() => {
15
+ }, [x, l, e]), p(() => {
16
16
  if (!e)
17
17
  return;
18
- const m = e.extensionManager.extensions.find((S) => S.name === Y.name);
18
+ const m = e.extensionManager.extensions.find((E) => E.name === Y.name);
19
19
  if (!m)
20
20
  return;
21
21
  const w = () => {
22
22
  if (!x)
23
23
  return;
24
- const S = m ? m.storage.currentIndex : -1, L = m ? m.storage.results : [];
25
- r((C) => C !== S ? S : C), i((C) => K(C, L) ? C : L);
24
+ const E = m ? m.storage.currentIndex : -1, L = m ? m.storage.results : [];
25
+ n((C) => C !== E ? E : C), i((C) => K(C, L) ? C : L);
26
26
  };
27
27
  return k(d.SEARCH_REPLCE, w), () => {
28
28
  m && k(d.SEARCH_REPLCE, w);
@@ -34,23 +34,24 @@ function z({ editor: e, ...t }) {
34
34
  open: x,
35
35
  children: [
36
36
  /* @__PURE__ */ o(
37
- j,
37
+ O,
38
38
  {
39
39
  asChild: !0,
40
40
  disabled: t == null ? void 0 : t.disabled,
41
41
  children: /* @__PURE__ */ o(
42
- F,
42
+ j,
43
43
  {
44
44
  disabled: t == null ? void 0 : t.disabled,
45
45
  isActive: t == null ? void 0 : t.isActive,
46
46
  tooltip: t == null ? void 0 : t.tooltip,
47
+ tooltipOptions: t == null ? void 0 : t.tooltipOptions,
47
48
  children: /* @__PURE__ */ o(A, { name: t == null ? void 0 : t.icon })
48
49
  }
49
50
  )
50
51
  }
51
52
  ),
52
53
  /* @__PURE__ */ f(
53
- O,
54
+ F,
54
55
  {
55
56
  align: "start",
56
57
  className: "richtext-w-full",
@@ -59,7 +60,7 @@ function z({ editor: e, ...t }) {
59
60
  children: [
60
61
  /* @__PURE__ */ f("div", { className: "richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between", children: [
61
62
  /* @__PURE__ */ o(I, { children: s("editor.search.dialog.text") }),
62
- /* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: n.length > 0 ? `${c + 1}/${n.length}` : "0/0" })
63
+ /* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: r.length > 0 ? `${c + 1}/${r.length}` : "0/0" })
63
64
  ] }),
64
65
  /* @__PURE__ */ f("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: [
65
66
  /* @__PURE__ */ o(
@@ -78,7 +79,7 @@ function z({ editor: e, ...t }) {
78
79
  T,
79
80
  {
80
81
  className: "richtext-flex-1",
81
- disabled: n.length === 0,
82
+ disabled: r.length === 0,
82
83
  onClick: e.commands.goToPrevSearchResult,
83
84
  children: /* @__PURE__ */ o(A, { name: "ChevronUp" })
84
85
  }
@@ -87,7 +88,7 @@ function z({ editor: e, ...t }) {
87
88
  T,
88
89
  {
89
90
  className: "richtext-flex-1",
90
- disabled: n.length === 0,
91
+ disabled: r.length === 0,
91
92
  onClick: e.commands.goToNextSearchResult,
92
93
  children: /* @__PURE__ */ o(A, { name: "ChevronDown" })
93
94
  }
@@ -122,7 +123,7 @@ function z({ editor: e, ...t }) {
122
123
  T,
123
124
  {
124
125
  className: "richtext-flex-1",
125
- disabled: n.length === 0,
126
+ disabled: r.length === 0,
126
127
  onClick: e.commands.replace,
127
128
  children: s("editor.replace.dialog.text")
128
129
  }
@@ -131,7 +132,7 @@ function z({ editor: e, ...t }) {
131
132
  T,
132
133
  {
133
134
  className: "richtext-flex-1",
134
- disabled: n.length === 0,
135
+ disabled: r.length === 0,
135
136
  onClick: e.commands.replaceAll,
136
137
  children: s("editor.replaceAll.dialog.text")
137
138
  }
@@ -144,78 +145,78 @@ function z({ editor: e, ...t }) {
144
145
  }
145
146
  );
146
147
  }
147
- const p = (e, t) => t(e.tr);
148
+ const S = (e, t) => t(e.tr);
148
149
  function G(e, t, s) {
149
150
  return RegExp(t ? e.replace(/[$()*+./?[\\\]^{|}-]/g, String.raw`\$&`) : e, s ? "gu" : "gui");
150
151
  }
151
152
  function J(e, t, s) {
152
153
  const c = [];
153
- let r = [];
154
- const n = [];
154
+ let n = [];
155
+ const r = [];
155
156
  let i = 0;
156
157
  if (!t)
157
158
  return { decorationsToReturn: [], results: [] };
158
159
  e == null || e.descendants((a, u) => {
159
- a.isText ? r[i] ? r[i] = {
160
- text: r[i].text + a.text,
161
- pos: r[i].pos
162
- } : r[i] = {
160
+ a.isText ? n[i] ? n[i] = {
161
+ text: n[i].text + a.text,
162
+ pos: n[i].pos
163
+ } : n[i] = {
163
164
  text: `${a.text}`,
164
165
  pos: u
165
166
  } : i += 1;
166
- }), r = r.filter(Boolean);
167
- for (const { text: a, pos: u } of r) {
167
+ }), n = n.filter(Boolean);
168
+ for (const { text: a, pos: u } of n) {
168
169
  const l = [...a.matchAll(t)];
169
170
  for (const h of l) {
170
171
  if (h[0] === "")
171
172
  break;
172
- h.index !== void 0 && n.push({
173
+ h.index !== void 0 && r.push({
173
174
  from: u + h.index,
174
175
  to: u + h.index + h[0].length
175
176
  });
176
177
  }
177
178
  }
178
- for (const a of n)
179
+ for (const a of r)
179
180
  c.push(N.inline(a.from, a.to, { class: s }));
180
181
  return {
181
182
  decorationsToReturn: c,
182
- results: n
183
+ results: r
183
184
  };
184
185
  }
185
186
  function D(e, t, { state: s, dispatch: c }) {
186
187
  if (!t[0])
187
188
  return;
188
- const { from: n, to: i } = t[0];
189
- c && c(s.tr.insertText(e, n, i));
189
+ const { from: r, to: i } = t[0];
190
+ c && c(s.tr.insertText(e, r, i));
190
191
  }
191
192
  function Q(e, t, s, c) {
192
- const r = t + 1;
193
- if (!c[r])
193
+ const n = t + 1;
194
+ if (!c[n])
194
195
  return null;
195
- const { from: n, to: i } = c[t], a = i - n - e.length + s, { from: u, to: l } = c[r];
196
- return c[r] = {
196
+ const { from: r, to: i } = c[t], a = i - r - e.length + s, { from: u, to: l } = c[n];
197
+ return c[n] = {
197
198
  to: l - a,
198
199
  from: u - a
199
200
  }, [a, c];
200
201
  }
201
202
  function X(e, t, { tr: s, dispatch: c }) {
202
- let r = 0, n = t.slice();
203
- if (n.length === 0)
203
+ let n = 0, r = t.slice();
204
+ if (r.length === 0)
204
205
  return !1;
205
- for (let i = 0; i < n.length; i += 1) {
206
- const { from: a, to: u } = n[i];
206
+ for (let i = 0; i < r.length; i += 1) {
207
+ const { from: a, to: u } = r[i];
207
208
  s.insertText(e, a, u);
208
- const l = Q(e, i, r, n);
209
- l && (r = l[0], n = l[1]);
209
+ const l = Q(e, i, n, r);
210
+ l && (n = l[0], r = l[1]);
210
211
  }
211
212
  return c(s), !0;
212
213
  }
213
- function H({ view: e, tr: t, searchResults: s, searchResultCurrentClass: c, gotoIndex: r }) {
214
- const n = s[r];
215
- if (n) {
214
+ function H({ view: e, tr: t, searchResults: s, searchResultCurrentClass: c, gotoIndex: n }) {
215
+ const r = s[n];
216
+ if (r) {
216
217
  const i = t.setMeta("directDecoration", {
217
- fromPos: n.from,
218
- toPos: n.to,
218
+ fromPos: r.from,
219
+ toPos: r.to,
219
220
  attrs: { class: c }
220
221
  });
221
222
  return e == null || e.dispatch(i), setTimeout(() => {
@@ -263,35 +264,35 @@ const Y = /* @__PURE__ */ _.create({
263
264
  },
264
265
  addCommands() {
265
266
  return {
266
- setSearchTerm: (e) => ({ state: t, dispatch: s }) => (this.options.searchTerm = e, this.storage.results = [], this.storage.currentIndex = 0, R(d.SEARCH_REPLCE), p(t, s), !1),
267
- setReplaceTerm: (e) => ({ state: t, dispatch: s }) => (this.options.replaceTerm = e, p(t, s), !1),
268
- setCaseSensitive: (e) => ({ state: t, dispatch: s }) => (this.options.caseSensitive = e, p(t, s), !1),
267
+ setSearchTerm: (e) => ({ state: t, dispatch: s }) => (this.options.searchTerm = e, this.storage.results = [], this.storage.currentIndex = 0, R(d.SEARCH_REPLCE), S(t, s), !1),
268
+ setReplaceTerm: (e) => ({ state: t, dispatch: s }) => (this.options.replaceTerm = e, S(t, s), !1),
269
+ setCaseSensitive: (e) => ({ state: t, dispatch: s }) => (this.options.caseSensitive = e, S(t, s), !1),
269
270
  replace: () => ({ state: e, dispatch: t }) => {
270
- const { replaceTerm: s } = this.options, { currentIndex: c, results: r } = this.storage, n = r[c];
271
- return n ? (D(s, [n], { state: e, dispatch: t }), this.storage.results.splice(c, 1)) : (D(s, r, { state: e, dispatch: t }), this.storage.results.shift()), R(d.SEARCH_REPLCE), p(e, t), !1;
271
+ const { replaceTerm: s } = this.options, { currentIndex: c, results: n } = this.storage, r = n[c];
272
+ return r ? (D(s, [r], { state: e, dispatch: t }), this.storage.results.splice(c, 1)) : (D(s, n, { state: e, dispatch: t }), this.storage.results.shift()), R(d.SEARCH_REPLCE), S(e, t), !1;
272
273
  },
273
274
  replaceAll: () => ({ state: e, tr: t, dispatch: s }) => {
274
- const { replaceTerm: c } = this.options, { results: r } = this.storage;
275
- return X(c, r, { tr: t, dispatch: s }), this.storage.currentIndex = -1, this.storage.results = [], R(d.SEARCH_REPLCE), p(e, s), !1;
275
+ const { replaceTerm: c } = this.options, { results: n } = this.storage;
276
+ return X(c, n, { tr: t, dispatch: s }), this.storage.currentIndex = -1, this.storage.results = [], R(d.SEARCH_REPLCE), S(e, s), !1;
276
277
  },
277
278
  goToPrevSearchResult: () => ({ view: e, tr: t }) => {
278
- const { searchResultCurrentClass: s } = this.options, { currentIndex: c, results: r } = this.storage, n = (c + r.length - 1) % r.length;
279
- return this.storage.currentIndex = n, R(d.SEARCH_REPLCE), H({
279
+ const { searchResultCurrentClass: s } = this.options, { currentIndex: c, results: n } = this.storage, r = (c + n.length - 1) % n.length;
280
+ return this.storage.currentIndex = r, R(d.SEARCH_REPLCE), H({
280
281
  view: e,
281
282
  tr: t,
282
- searchResults: r,
283
+ searchResults: n,
283
284
  searchResultCurrentClass: s,
284
- gotoIndex: n
285
+ gotoIndex: r
285
286
  });
286
287
  },
287
288
  goToNextSearchResult: () => ({ view: e, tr: t }) => {
288
- const { searchResultCurrentClass: s } = this.options, { currentIndex: c, results: r } = this.storage, n = (c + 1) % r.length;
289
- return this.storage.currentIndex = n, this.options.onChange && this.options.onChange(), R(d.SEARCH_REPLCE), H({
289
+ const { searchResultCurrentClass: s } = this.options, { currentIndex: c, results: n } = this.storage, r = (c + 1) % n.length;
290
+ return this.storage.currentIndex = r, this.options.onChange && this.options.onChange(), R(d.SEARCH_REPLCE), H({
290
291
  view: e,
291
292
  tr: t,
292
- searchResults: r,
293
+ searchResults: n,
293
294
  searchResultCurrentClass: s,
294
- gotoIndex: n
295
+ gotoIndex: r
295
296
  });
296
297
  }
297
298
  };
@@ -306,12 +307,12 @@ const Y = /* @__PURE__ */ _.create({
306
307
  return P.empty;
307
308
  },
308
309
  apply(t) {
309
- const { doc: s, docChanged: c } = t, { searchTerm: r, searchResultClass: n, searchResultCurrentClass: i, disableRegex: a, caseSensitive: u } = e.options;
310
- if (c || r) {
310
+ const { doc: s, docChanged: c } = t, { searchTerm: n, searchResultClass: r, searchResultCurrentClass: i, disableRegex: a, caseSensitive: u } = e.options;
311
+ if (c || n) {
311
312
  const { decorationsToReturn: l, results: h } = J(
312
313
  s,
313
- G(r, a, u),
314
- n
314
+ G(n, a, u),
315
+ r
315
316
  );
316
317
  if (e.storage.results = h, e.storage.currentIndex > h.length - 1 && (e.storage.currentIndex = 0), R(d.SEARCH_REPLCE), t.getMeta("directDecoration")) {
317
318
  const { fromPos: x, toPos: v, attrs: b } = t.getMeta("directDecoration");
@@ -113,6 +113,21 @@ declare module '@tiptap/core' {
113
113
  }
114
114
 
115
115
 
116
+ declare module '@tiptap/core' {
117
+ interface Commands<ReturnType> {
118
+ iframe: {
119
+ /**
120
+ * Add an iframe
121
+ */
122
+ setIframe: (options: {
123
+ src: string;
124
+ service: string;
125
+ }) => ReturnType;
126
+ };
127
+ }
128
+ }
129
+
130
+
116
131
  declare module '@tiptap/core' {
117
132
  interface Commands<ReturnType> {
118
133
  imageUpload: {
@@ -133,21 +148,6 @@ declare module '@tiptap/core' {
133
148
  }
134
149
 
135
150
 
136
- declare module '@tiptap/core' {
137
- interface Commands<ReturnType> {
138
- iframe: {
139
- /**
140
- * Add an iframe
141
- */
142
- setIframe: (options: {
143
- src: string;
144
- service: string;
145
- }) => ReturnType;
146
- };
147
- }
148
- }
149
-
150
-
151
151
  declare module '@tiptap/core' {
152
152
  interface Commands<ReturnType> {
153
153
  imageGifUpload: {
@@ -113,6 +113,21 @@ declare module '@tiptap/core' {
113
113
  }
114
114
 
115
115
 
116
+ declare module '@tiptap/core' {
117
+ interface Commands<ReturnType> {
118
+ iframe: {
119
+ /**
120
+ * Add an iframe
121
+ */
122
+ setIframe: (options: {
123
+ src: string;
124
+ service: string;
125
+ }) => ReturnType;
126
+ };
127
+ }
128
+ }
129
+
130
+
116
131
  declare module '@tiptap/core' {
117
132
  interface Commands<ReturnType> {
118
133
  imageUpload: {
@@ -133,21 +148,6 @@ declare module '@tiptap/core' {
133
148
  }
134
149
 
135
150
 
136
- declare module '@tiptap/core' {
137
- interface Commands<ReturnType> {
138
- iframe: {
139
- /**
140
- * Add an iframe
141
- */
142
- setIframe: (options: {
143
- src: string;
144
- service: string;
145
- }) => ReturnType;
146
- };
147
- }
148
- }
149
-
150
-
151
151
  declare module '@tiptap/core' {
152
152
  interface Commands<ReturnType> {
153
153
  imageGifUpload: {