reactjs-tiptap-editor 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/lib/{ActionMenuButton-DTXFBdGX.js → ActionMenuButton-BKqin6Kz.js} +17 -13
  2. package/lib/ActionMenuButton-CPPHERbq.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +24 -21
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +7 -5
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +11 -9
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +14 -12
  11. package/lib/Clear.cjs +1 -1
  12. package/lib/Clear.js +3 -3
  13. package/lib/Code.cjs +1 -1
  14. package/lib/Code.js +11 -9
  15. package/lib/CodeBlock.cjs +39 -39
  16. package/lib/CodeBlock.js +842 -948
  17. package/lib/CodeView.cjs +1 -1
  18. package/lib/CodeView.js +10 -8
  19. package/lib/Color.cjs +1 -1
  20. package/lib/Color.js +20 -18
  21. package/lib/Column.cjs +1 -1
  22. package/lib/Column.js +7 -5
  23. package/lib/{Drawer-D0yQ0wR7.js → Drawer-DUPsBE0H.js} +18 -17
  24. package/lib/Drawer-fplzqNI6.cjs +1 -0
  25. package/lib/Drawer.cjs +1 -1
  26. package/lib/Drawer.js +3 -3
  27. package/lib/Emoji.cjs +1 -1
  28. package/lib/Emoji.js +19 -17
  29. package/lib/{Excalidraw-CO4IRHmG.js → Excalidraw-BEzpvRLx.js} +33 -32
  30. package/lib/Excalidraw-qjnQspLq.cjs +1 -0
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +2 -2
  33. package/lib/ExportPdf.cjs +2 -2
  34. package/lib/ExportPdf.js +7 -5
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +7 -5
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +9 -8
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +13 -12
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +25 -24
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +9 -7
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +18 -15
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +7 -5
  49. package/lib/Icon-CiR8RqdQ.cjs +1 -0
  50. package/lib/Icon-ONE1AwKo.js +12 -0
  51. package/lib/{Iframe-BEO28NPs.js → Iframe-CBTnv2mk.js} +45 -43
  52. package/lib/Iframe-DsUNJ2n2.cjs +1 -0
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +2 -2
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +52 -50
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +55 -53
  59. package/lib/ImportWord.cjs +31 -31
  60. package/lib/ImportWord.js +12 -10
  61. package/lib/{Indent-CXurBbOr.js → Indent-B00o0P0M.js} +26 -24
  62. package/lib/Indent-CaGP0qTp.cjs +1 -0
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +12 -10
  67. package/lib/Katex-XsfpKgJU.cjs +4 -0
  68. package/lib/{Katex-Bvj469K1.js → Katex-x370CSXZ.js} +27 -25
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +2 -2
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +17 -15
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/{LinkEditBlock-DjXUEubR.js → LinkEditBlock-C_ipl3EA.js} +27 -25
  76. package/lib/{LinkEditBlock-8ePAZ-G1.cjs → LinkEditBlock-xt88G5fb.cjs} +2 -2
  77. package/lib/Mention.cjs +1 -1
  78. package/lib/Mention.js +3 -3
  79. package/lib/Mermaid.cjs +2 -2
  80. package/lib/Mermaid.js +29 -28
  81. package/lib/MoreMark.cjs +1 -1
  82. package/lib/MoreMark.js +25 -22
  83. package/lib/OrderedList.cjs +1 -1
  84. package/lib/OrderedList.js +10 -8
  85. package/lib/SearchAndReplace.cjs +1 -1
  86. package/lib/SearchAndReplace.js +48 -46
  87. package/lib/SlashCommand.cjs +1 -1
  88. package/lib/SlashCommand.js +6 -6
  89. package/lib/SlashCommandNodeView-BT5ystah.cjs +1 -0
  90. package/lib/{SlashCommandNodeView-CcqL8ymb.js → SlashCommandNodeView-DX6axvLs.js} +74 -65
  91. package/lib/Strike.cjs +1 -1
  92. package/lib/Strike.js +7 -5
  93. package/lib/Table-DSRSwtXx.cjs +9 -0
  94. package/lib/{Table-9Y0Cg8Ab.js → Table-DidusYID.js} +10 -8
  95. package/lib/Table.cjs +1 -1
  96. package/lib/Table.js +1 -1
  97. package/lib/TaskList.cjs +1 -1
  98. package/lib/TaskList.js +15 -13
  99. package/lib/TextAlign.cjs +1 -1
  100. package/lib/TextAlign.js +20 -17
  101. package/lib/TextDirection.cjs +1 -1
  102. package/lib/TextDirection.js +20 -17
  103. package/lib/TextUnderline.cjs +1 -1
  104. package/lib/TextUnderline.js +7 -5
  105. package/lib/Twitter-CBuVBQM1.cjs +1 -0
  106. package/lib/{Twitter-DWwd0vHR.js → Twitter-D58T0Zt3.js} +59 -57
  107. package/lib/Twitter.cjs +1 -1
  108. package/lib/Twitter.js +2 -2
  109. package/lib/Video.cjs +1 -1
  110. package/lib/Video.js +27 -25
  111. package/lib/bubble.cjs +4 -4
  112. package/lib/bubble.js +70 -68
  113. package/lib/{button-RnHbJfd-.js → button-9_8t7ca7.js} +4 -3
  114. package/lib/button-Cs9TroWr.cjs +1 -0
  115. package/lib/{checkbox-CTEN0q4y.cjs → checkbox-BQRKTXXr.cjs} +1 -1
  116. package/lib/{checkbox-CLSoR1Qj.js → checkbox-DnkkV6qo.js} +1 -1
  117. package/lib/{index-BBNITgNi.cjs → clsx-CXbNJWDD.cjs} +13 -13
  118. package/lib/{index-sVScpCFG.js → clsx-DmuN0U_8.js} +228 -228
  119. package/lib/{dialog-CMC9hsCo.cjs → dialog-BS3zm-T9.cjs} +1 -1
  120. package/lib/{dialog-D_HCtKvc.js → dialog-DhayAPvV.js} +1 -1
  121. package/lib/{dropdown-menu-DKSAS-w_.cjs → dropdown-menu-CxwWX0yj.cjs} +1 -1
  122. package/lib/{dropdown-menu-66q7Ofc5.js → dropdown-menu-DQqKeZcx.js} +1 -1
  123. package/lib/events.constant-Dq21NPdV.cjs +1 -0
  124. package/lib/events.constant-do95b767.js +21 -0
  125. package/lib/{index-CApXPpjF.cjs → index-BCzvbrf5.cjs} +1 -1
  126. package/lib/{index-0OnGZkVF.js → index-BDX1uE62.js} +78 -312
  127. package/lib/index-CBFmXCcU.cjs +1 -0
  128. package/lib/{index-DmPwbBqm.js → index-CKmT9KAQ.js} +1 -1
  129. package/lib/index-CVFzP1Dc.cjs +1 -0
  130. package/lib/index-CX4pNJlH.cjs +1 -0
  131. package/lib/index-CjhjjJsN.cjs +1 -0
  132. package/lib/index-Cs6cp0Y6.cjs +1 -0
  133. package/lib/{index-9A6-kVBM.js → index-D1jd7elj.js} +1 -1
  134. package/lib/{index-C3zg3DPB.js → index-D9JOHlso.js} +493 -1186
  135. package/lib/{index-DRHrDScg.js → index-DdEmgiAA.js} +1 -1
  136. package/lib/{index-DKt5wfAc.js → index-DvvwJvau.js} +23 -23
  137. package/lib/index-EAK64CCA.js +425 -0
  138. package/lib/{index--nUS7Y66.cjs → index-neeeY2o7.cjs} +3 -3
  139. package/lib/index.cjs +9 -2
  140. package/lib/index.js +142 -26
  141. package/lib/{input-D555880-.cjs → input-BJ7ihMq-.cjs} +1 -1
  142. package/lib/{input-CvyMYMZG.js → input-YoheBL2D.js} +1 -1
  143. package/lib/{isNumber-Bv1Qhmw8.cjs → isNumber-BTYSVlKo.cjs} +1 -1
  144. package/lib/{isNumber-DF0fU3ob.js → isNumber-DmQXlKp3.js} +1 -1
  145. package/lib/label-C8PLcjFI.js +19 -0
  146. package/lib/label-Y7_hvqf2.cjs +1 -0
  147. package/lib/locale-bundle.cjs +1 -1
  148. package/lib/locale-bundle.js +6 -7
  149. package/lib/locales/index.d.ts +3 -4316
  150. package/lib/{popover-BSzR_R01.cjs → popover-BiSrlM4j.cjs} +1 -1
  151. package/lib/{popover-B7ec5-u2.js → popover-CWmTzHSy.js} +1 -1
  152. package/lib/react-BEoMZB61.cjs +1 -0
  153. package/lib/react-c9FSfB30.js +27 -0
  154. package/lib/separator-C-DKMYmg.js +329 -0
  155. package/lib/separator-CJ_adziN.cjs +1 -0
  156. package/lib/store/EditorEditableReactive.d.ts +1 -0
  157. package/lib/store/ThemeColorReactive.d.ts +1 -0
  158. package/lib/store/commandList.d.ts +1 -1
  159. package/lib/store/store.d.ts +6 -7
  160. package/lib/store-BKMaw1AW.cjs +1 -0
  161. package/lib/store-DG7cMfET.js +10 -0
  162. package/lib/{tabs-BTwiZkWd.cjs → tabs-DpHSMyF_.cjs} +1 -1
  163. package/lib/{tabs-CWr9HYaM.js → tabs-DxlKKM-N.js} +1 -1
  164. package/lib/{textarea-BdeLXbp8.js → textarea-D7m-apUh.js} +1 -1
  165. package/lib/{textarea-Yetl_PZi.cjs → textarea-DU9RMi6u.cjs} +1 -1
  166. package/lib/theme/theme.d.ts +5 -0
  167. package/lib/theme.cjs +1 -1
  168. package/lib/theme.js +37 -8
  169. package/lib/{throttle-DsowOft0.js → throttle-BRtichEP.js} +1 -1
  170. package/lib/throttle-gTTvqDTW.cjs +1 -0
  171. package/lib/toggle-BYvLnjCL.cjs +1 -0
  172. package/lib/toggle-Bxwwb_Kp.js +99 -0
  173. package/lib/tooltip-BTy5CRrN.js +24 -0
  174. package/lib/tooltip-COvf4_R-.cjs +1 -0
  175. package/lib/{updatePosition-Bbd8ETMv.js → updatePosition-CUukgu-Q.js} +2 -2
  176. package/lib/updatePosition-Cjuj2E26.cjs +1 -0
  177. package/lib/{useButtonProps-cMoicZgd.js → useButtonProps-CfYtuEnd.js} +48 -36
  178. package/lib/useButtonProps-CydzndG1.cjs +1 -0
  179. package/lib/utils/customEvents/events.constant.d.ts +0 -5
  180. package/package.json +3 -3
  181. package/lib/ActionMenuButton-BLlse5KO.cjs +0 -1
  182. package/lib/Drawer-kv6BU_6O.cjs +0 -1
  183. package/lib/Excalidraw-B82ThkJA.cjs +0 -1
  184. package/lib/Icon-DRuJhcHK.js +0 -10
  185. package/lib/Icon-DXePECFW.cjs +0 -1
  186. package/lib/Iframe-03dn9wcM.cjs +0 -1
  187. package/lib/Indent-Cqjdn3Jt.cjs +0 -1
  188. package/lib/Katex-DdWTV5NJ.cjs +0 -4
  189. package/lib/SlashCommandNodeView-Bl_gwZJB.cjs +0 -1
  190. package/lib/Table-DBGjezZK.cjs +0 -9
  191. package/lib/Twitter-Cnvt7GBg.cjs +0 -1
  192. package/lib/button-BW5bDPz_.cjs +0 -1
  193. package/lib/events.constant-DQYeJpu5.cjs +0 -1
  194. package/lib/events.constant-wrlJ_7JZ.js +0 -26
  195. package/lib/index-BZ6DfR2r.cjs +0 -1
  196. package/lib/index-C838s-or.cjs +0 -8
  197. package/lib/index-Cv9Z6dyV.cjs +0 -1
  198. package/lib/index-FSRjMsxW.cjs +0 -1
  199. package/lib/label-DsOYPjAo.js +0 -18
  200. package/lib/label-E6jF3Xud.cjs +0 -1
  201. package/lib/separator-JaTTqb3J.js +0 -241
  202. package/lib/separator-PGnA-6Hr.cjs +0 -1
  203. package/lib/store/ProviderUniqueId.d.ts +0 -6
  204. package/lib/store-Cf7tFiiI.js +0 -10
  205. package/lib/store-oDk-lTPM.cjs +0 -1
  206. package/lib/throttle-BM3Bmbf_.cjs +0 -1
  207. package/lib/updatePosition-M2IyqkI1.cjs +0 -1
  208. package/lib/useButtonProps-DfnJiJLV.cjs +0 -1
package/lib/Heading.js CHANGED
@@ -1,11 +1,12 @@
1
- import { N as f, t as m, m as A } from "./index-sVScpCFG.js";
2
- import { u as M, H } from "./index-0OnGZkVF.js";
1
+ import { N as f, t as m, m as A } from "./clsx-DmuN0U_8.js";
2
+ import { u as M, H } from "./index-BDX1uE62.js";
3
3
  import { jsx as d, Fragment as b, jsxs as g } from "react/jsx-runtime";
4
4
  import { useMemo as $, Fragment as w } from "react";
5
- import { c as x, h as D } from "./index-C3zg3DPB.js";
6
- import { A as y } from "./ActionMenuButton-DTXFBdGX.js";
7
- import { u as N, b as k } from "./useButtonProps-cMoicZgd.js";
8
- import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-66q7Ofc5.js";
5
+ import { A as x } from "./ActionMenuButton-BKqin6Kz.js";
6
+ import { c as D } from "./index-D9JOHlso.js";
7
+ import "./theme.js";
8
+ import { D as y, a as N, b as k, c as L, e as C, d as T } from "./dropdown-menu-DQqKeZcx.js";
9
+ import { u as I, b as K, h as P } from "./useButtonProps-CfYtuEnd.js";
9
10
  var R = f.create({
10
11
  name: "heading",
11
12
  addOptions() {
@@ -65,23 +66,23 @@ var R = f.create({
65
66
  }));
66
67
  }
67
68
  });
68
- function z() {
69
- const { t: e } = M(), t = N(S.name), {
69
+ function J() {
70
+ const { t: e } = M(), t = I(S.name), {
70
71
  icon: a = void 0,
71
72
  tooltip: s = void 0,
72
73
  isActive: i = void 0,
73
74
  items: o = []
74
- } = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: h, dataState: l } = k(i), r = $(() => (l == null ? void 0 : l.title) || e("editor.paragraph.tooltip"), [l]);
75
- return t ? /* @__PURE__ */ g(L, { children: [
75
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: p, dataState: l } = K(i), r = $(() => (l == null ? void 0 : l.title) || e("editor.paragraph.tooltip"), [l]);
76
+ return t ? /* @__PURE__ */ g(y, { children: [
76
77
  /* @__PURE__ */ d(
77
- C,
78
+ N,
78
79
  {
79
80
  asChild: !0,
80
- disabled: h,
81
+ disabled: p,
81
82
  children: /* @__PURE__ */ d(
82
- y,
83
+ x,
83
84
  {
84
- disabled: h,
85
+ disabled: p,
85
86
  icon: a,
86
87
  title: r,
87
88
  tooltip: s
@@ -89,11 +90,11 @@ function z() {
89
90
  )
90
91
  }
91
92
  ),
92
- /* @__PURE__ */ d(T, { className: "richtext-w-full", children: o == null ? void 0 : o.map((n, c) => {
93
- var u, p;
93
+ /* @__PURE__ */ d(k, { className: "richtext-w-full", children: o == null ? void 0 : o.map((n, c) => {
94
+ var u, h;
94
95
  return /* @__PURE__ */ g(w, { children: [
95
96
  /* @__PURE__ */ g(
96
- I,
97
+ L,
97
98
  {
98
99
  checked: r === n.title,
99
100
  onClick: n.action,
@@ -101,7 +102,7 @@ function z() {
101
102
  /* @__PURE__ */ d(
102
103
  "div",
103
104
  {
104
- className: x("richtext-ml-1 richtext-h-full", {
105
+ className: D("richtext-ml-1 richtext-h-full", {
105
106
  "": n.level === "Paragraph",
106
107
  "heading-1": n.level === 1,
107
108
  "heading-2": n.level === 2,
@@ -113,11 +114,11 @@ function z() {
113
114
  children: n.title
114
115
  }
115
116
  ),
116
- !!((u = n == null ? void 0 : n.shortcutKeys) != null && u.length) && /* @__PURE__ */ d(K, { className: "richtext-pl-4", children: (p = n == null ? void 0 : n.shortcutKeys) == null ? void 0 : p.map((v) => D(v)).join(" ") })
117
+ !!((u = n == null ? void 0 : n.shortcutKeys) != null && u.length) && /* @__PURE__ */ d(C, { className: "richtext-pl-4", children: (h = n == null ? void 0 : n.shortcutKeys) == null ? void 0 : h.map((v) => P(v)).join(" ") })
117
118
  ]
118
119
  }
119
120
  ),
120
- n.level === "Paragraph" && /* @__PURE__ */ d(P, {})
121
+ n.level === "Paragraph" && /* @__PURE__ */ d(T, {})
121
122
  ] }, `heading-k-${c}`);
122
123
  }) })
123
124
  ] }) : /* @__PURE__ */ d(b, {});
@@ -138,7 +139,7 @@ const S = /* @__PURE__ */ R.extend({
138
139
  return {
139
140
  action: () => {
140
141
  if (n) {
141
- const u = i.find((p) => t.isActive("heading", { level: p }));
142
+ const u = i.find((h) => t.isActive("heading", { level: h }));
142
143
  u && u !== "Paragraph" && t.commands.toggleHeading({ level: u });
143
144
  return;
144
145
  }
@@ -151,12 +152,12 @@ const S = /* @__PURE__ */ R.extend({
151
152
  shortcutKeys: ((c = a.options.shortcutKeys) == null ? void 0 : c[r]) ?? ["alt", "mod", `${r}`],
152
153
  default: n
153
154
  };
154
- }), h = o.filter((r) => r.disabled).length === o.length;
155
+ }), p = o.filter((r) => r.disabled).length === o.length;
155
156
  return {
156
157
  // component: HeadingButton,
157
158
  componentProps: {
158
159
  tooltip: s("editor.heading.tooltip"),
159
- disabled: h,
160
+ disabled: p,
160
161
  items: o,
161
162
  icon: "MenuDown",
162
163
  isActive: () => {
@@ -176,5 +177,5 @@ const S = /* @__PURE__ */ R.extend({
176
177
  });
177
178
  export {
178
179
  S as Heading,
179
- z as RichTextHeading
180
+ J as RichTextHeading
180
181
  };
package/lib/Highlight.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-BBNITgNi.cjs"),e=require("react/jsx-runtime"),x=require("react"),C=require("./index-C838s-or.cjs"),m=require("./separator-PGnA-6Hr.cjs"),a=require("./useButtonProps-DfnJiJLV.cjs"),L=require("./Icon-DXePECFW.cjs"),H=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,M=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,v=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",l.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:r})=>r.setMark(this.name,t),toggleHighlight:t=>({commands:r})=>r.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[l.markInputRule({find:H,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:M,type:this.type})]}});function j({fill:t}){return e.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:e.jsxs("g",{id:"icon/背景颜色",children:[e.jsx("g",{fill:"currentColor",children:e.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[e.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),e.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),e.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),e.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:typeof t=="string"?t:"none",id:"矩形"})]})})})}function y(){const t=a.useButtonProps(d.name),{tooltip:r=void 0,isActive:s=void 0,defaultColor:i=void 0,colors:o,action:n,shortcutKeys:g}=(t==null?void 0:t.componentProps)??{},{editorDisabled:h}=a.useActive(s),[u,f]=x.useState(i);function p(c){h||n&&(n==null||n(c),f(c))}return t?e.jsx(m.ColorPicker,{colors:o,disabled:h,highlight:!0,onChange:p,value:u,children:e.jsx(C.ActionButton,{disabled:h,tooltip:r,shortcutKeys:g,children:e.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[e.jsx(j,{fill:u}),e.jsx(L.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):e.jsx(e.Fragment,{})}const d=v.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:r,t:s,extension:i})=>({componentProps:{action:o=>{if(typeof o=="string"){r.storage.highlight.currentColor=o,r.chain().focus().setHighlight({color:o}).run();return}r.chain().focus().unsetHighlight().run()},isActive:()=>r.isActive("highlight")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:i.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const r=this.storage.currentColor||this.options.defaultColor;if(!r){const{color:i}=this.editor.getAttributes("highlight");return i?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:r})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:r}).run()}}}});exports.Highlight=d;exports.RichTextHighlight=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./clsx-CXbNJWDD.cjs"),e=require("react/jsx-runtime"),x=require("react"),C=require("./toggle-BYvLnjCL.cjs"),m=require("./separator-CJ_adziN.cjs");require("./index-CX4pNJlH.cjs");require("./theme.cjs");const a=require("./useButtonProps-CydzndG1.cjs"),L=require("./Icon-CiR8RqdQ.cjs"),H=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,M=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,v=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",l.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:r})=>r.setMark(this.name,t),toggleHighlight:t=>({commands:r})=>r.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[l.markInputRule({find:H,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:M,type:this.type})]}});function j({fill:t}){return e.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:e.jsxs("g",{id:"icon/背景颜色",children:[e.jsx("g",{fill:"currentColor",children:e.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[e.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),e.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),e.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),e.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:typeof t=="string"?t:"none",id:"矩形"})]})})})}function y(){const t=a.useButtonProps(g.name),{tooltip:r=void 0,isActive:s=void 0,defaultColor:i=void 0,colors:o,action:n,shortcutKeys:d}=(t==null?void 0:t.componentProps)??{},{editorDisabled:h}=a.useActive(s),[u,f]=x.useState(i);function p(c){h||n&&(n==null||n(c),f(c))}return t?e.jsx(m.ColorPicker,{colors:o,disabled:h,highlight:!0,onChange:p,value:u,children:e.jsx(C.ActionButton,{disabled:h,tooltip:r,shortcutKeys:d,children:e.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[e.jsx(j,{fill:u}),e.jsx(L.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):e.jsx(e.Fragment,{})}const g=v.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:r,t:s,extension:i})=>({componentProps:{action:o=>{if(typeof o=="string"){r.storage.highlight.currentColor=o,r.chain().focus().setHighlight({color:o}).run();return}r.chain().focus().unsetHighlight().run()},isActive:()=>r.isActive("highlight")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:i.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const r=this.storage.currentColor||this.options.defaultColor;if(!r){const{color:i}=this.editor.getAttributes("highlight");return i?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:r})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:r}).run()}}}});exports.Highlight=g;exports.RichTextHighlight=y;
package/lib/Highlight.js CHANGED
@@ -1,10 +1,12 @@
1
- import { M as f, f as p, h as m, m as C } from "./index-sVScpCFG.js";
1
+ import { M as f, e as p, f as m, m as C } from "./clsx-DmuN0U_8.js";
2
2
  import { jsx as r, jsxs as h, Fragment as L } from "react/jsx-runtime";
3
3
  import { useState as x } from "react";
4
- import { A as H } from "./index-C3zg3DPB.js";
5
- import { C as M } from "./separator-JaTTqb3J.js";
6
- import { u as v, b as A } from "./useButtonProps-cMoicZgd.js";
7
- import { I as y } from "./Icon-DRuJhcHK.js";
4
+ import { A as H } from "./toggle-Bxwwb_Kp.js";
5
+ import { C as M } from "./separator-C-DKMYmg.js";
6
+ import "./index-D9JOHlso.js";
7
+ import "./theme.js";
8
+ import { u as v, b as A } from "./useButtonProps-CfYtuEnd.js";
9
+ import { I as y } from "./Icon-ONE1AwKo.js";
8
10
  const b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, k = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, R = f.create({
9
11
  name: "highlight",
10
12
  addOptions() {
@@ -124,7 +126,7 @@ function w({ fill: t }) {
124
126
  }
125
127
  );
126
128
  }
127
- function B() {
129
+ function D() {
128
130
  const t = v(T.name), {
129
131
  tooltip: e = void 0,
130
132
  isActive: n = void 0,
@@ -213,5 +215,5 @@ const T = /* @__PURE__ */ R.extend({
213
215
  });
214
216
  export {
215
217
  T as Highlight,
216
- B as RichTextHighlight
218
+ D as RichTextHighlight
217
219
  };
package/lib/History.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-BBNITgNi.cjs"),C=require("@tiptap/pm/state"),x=require("@tiptap/pm/view"),R=require("./index--nUS7Y66.cjs"),S=require("react/jsx-runtime"),z=require("./index-C838s-or.cjs");require("react");const A=require("./useButtonProps-DfnJiJLV.cjs");function W(r={}){return new p.Plugin({view(e){return new U(e,r)}})}class U{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let c=e.nodeBefore,h=e.nodeAfter;if(c||h){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),M=c?v.bottom:v.top;c&&h&&(M=(M+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*l;n={left:v.left,right:v.right,top:M-b,bottom:M+b}}}}if(!n){let c=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;n={left:c.left-h,right:c.left+h,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),h=c.width/a.offsetWidth,m=c.height/a.offsetHeight;d=c.left-a.scrollLeft*h,u=c.top-a.scrollTop*m}this.element.style.left=(n.left-d)/s+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=p.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends p.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return f.valid(n)?new f(n):p.Selection.near(n)}content(){return p.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new N(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!q(e)||!X(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&f.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(f.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!p.NodeSelection.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),n=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;p.Selection.jsonID("gapcursor",f);class N{constructor(e){this.pos=e}map(e){return new N(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):p.Selection.near(t)}}function B(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function q(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function X(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Y(){return new p.Plugin({props:{decorations:$,createSelectionBetween(r,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:Z,handleKeyDown:J,handleDOMEvents:{beforeinput:Q}}})}const J=R.keydownHandler({ArrowLeft:I("horiz",-1),ArrowRight:I("horiz",1),ArrowUp:I("vert",-1),ArrowDown:I("vert",1)});function I(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,o){let s=n.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof p.TextSelection){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let d=f.findGapCursorFrom(l,e,a);return d?(i&&i(n.tr.setSelection(new f(d))),!0):!1}}function Z(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!f.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&p.NodeSelection.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new f(n))),!0)}function Q(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof f))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=p.Fragment.empty;for(let s=n.length-1;s>=0;s--)i=p.Fragment.from(n[s].createAndFill(null,i));let o=r.state.tr.replace(t.pos,t.pos,new p.Slice(i,0,0));return o.setSelection(p.TextSelection.near(o.doc.resolve(t.pos+1))),r.dispatch(o),!1}function $(r){if(!(r.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",R.DecorationSet.create(r.doc,[R.Decoration.widget(r.selection.head,e,{key:"gapcursor"})])}var O=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<O&&this.leafAppend(e)||this.length<O&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new ee(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};g.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,n),i};g.from=function(e){return e instanceof g?e:e&&e.length?new j(e):g.empty};var j=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=O)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=O)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new j([]);var ee=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(n,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(n,i):n>=o?this.right.slice(n-o,i-o):this.left.slice(n,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(g);const te=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,o;t&&(i=this.remapping(n,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,h)=>{if(!c.step){i||(i=this.remapping(n,h+1),o=i.maps.length),o--,u.push(c);return}if(i){u.push(new y(c.map));let m=c.step.map(i.slice(o)),v;m&&s.maybeStep(m).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new y(v,void 0,void 0,d.length+u.length))),o--,v&&i.appendMap(v,o)}else s.maybeStep(c.step);if(c.selection)return l=i?c.selection.map(i.slice(o)):c.selection,a=new w(this.items.slice(0,n).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,n,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),h=new y(e.mapping.maps[u],c,t),m;(m=a&&a.merge(h))&&(h=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let d=s-n.depth;return d>ie&&(l=ne(l,d),s-=d),new w(l.append(o),s)}remapping(e,t){let n=new p.Mapping;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,t),n}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let v=o.maps[m];if(h.step){let M=e.steps[m].invert(e.docs[m]),b=h.selection&&h.selection.map(o.slice(a+1,m));b&&l++,n.push(new y(v,M,b))}else n.push(new y(v))},i);let d=[];for(let h=t;h<s;h++)d.push(new y(o.maps[h]));let u=this.items.slice(0,i).append(d).append(n),c=new w(u,l);return c.emptyItemCount()>te&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(n)),d=a&&a.getMap();if(n--,d&&t.appendMap(d,n),a){let u=s.selection&&s.selection.map(t.slice(n));u&&o++;let c=new y(d.invert(),a,u),h,m=i.length-1;(h=i.length&&i[m].merge(c))?i[m]=h:i.push(c)}}else s.map&&n--},this.items.length,0),new w(g.from(i.reverse()),o)}}w.empty=new w(g.empty,0);function ne(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class y{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class P{constructor(e,t,n,i,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=o}}const ie=20;function re(r,e,t,n){let i=t.getMeta(E),o;if(i)return i.historyState;t.getMeta(le)&&(r=new P(r.done,r.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(s&&s.getMeta(E))return s.getMeta(E).redo?new P(r.done.addTransform(t,void 0,n,T(e)),r.undone,V(t.mapping.maps),r.prevTime,r.prevComposition):new P(r.done,r.undone.addTransform(t,void 0,n,T(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!s&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!oe(t,r.prevRanges)),d=s?D(r.prevRanges,t.mapping):V(t.mapping.maps);return new P(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,T(e)),w.empty,d,t.time,l??r.prevComposition)}else return(o=t.getMeta("rebased"))?new P(r.done.rebased(t,o),r.undone.rebased(t,o),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new P(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function oe(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let o=0;o<e.length;o+=2)n<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function V(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,o,s)=>e.push(o,s));return e}function D(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),o=e.map(r[n+1],-1);i<=o&&t.push(i,o)}return t}function se(r,e,t){let n=T(e),i=E.get(e).spec.config,o=(t?r.undone:r.done).popEvent(e,n);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?r.done:r.undone).addTransform(o.transform,e.selection.getBookmark(),i,n),a=new P(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(E,{redo:t,historyState:a})}let k=!1,K=null;function T(r){let e=r.plugins;if(K!=e){k=!1,K=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const E=new p.PluginKey("history"),le=new p.PluginKey("closeHistory");function ae(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new p.Plugin({key:E,state:{init(){return new P(w.empty,w.empty,null,0,-1)},apply(e,t,n){return re(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?G:n=="historyRedo"?_:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function H(r,e){return(t,n)=>{let i=E.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let o=se(i,t,r);o&&n(e?o.scrollIntoView():o)}return!0}}const G=H(!1,!0),_=H(!0,!0);p.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc;if(((r==null?void 0:r.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const o=this.storage.characters({node:n.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=n.tr.deleteRange(l,a);return r=!0,d}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n||i>n&&o>n&&o<=i)return!0;if(i>n&&o>n&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-n,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>n)}})]}});p.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[W(this.options)]}});p.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,o=[];if(!t||!n)return x.DecorationSet.create(r,[]);let s=0;this.options.mode==="deepest"&&r.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return r.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(x.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),x.DecorationSet.create(r,o)}}})]}});p.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[Y()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=p.callOrReturn(p.getExtensionField(r,"allowGapCursor",t)))!=null?e:null}}});p.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return r.descendants((s,l)=>{const a=n>=l&&n<=l+s.nodeSize,d=!s.isLeaf&&p.isNodeEmpty(s);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const c=x.Decoration.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});i.push(c)}return this.options.includeChildren}),x.DecorationSet.create(r,i)}}})]}});p.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||p.isNodeSelection(t.selection)||r.view.dragging?null:x.DecorationSet.create(t.doc,[x.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function L({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||(e==null?void 0:e.type)===r}p.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new C.PluginKey(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new C.Plugin({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,h=d.nodes[t];if(u)return a.insert(c,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!L({node:s,types:n})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!L({node:s,types:n})}}})]}});var de=p.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>G(r,e),redo:()=>({state:r,dispatch:e})=>_(r,e)}},addProseMirrorPlugins(){return[ae(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function ce(){var u;const r=A.useButtonProps(F.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((u=r==null?void 0:r.componentProps)==null?void 0:u.undo)??{},{disabled:l}=A.useActive(s),a=z.icons[e],d=()=>{l||o&&o()};return!r||!a?S.jsx(S.Fragment,{}):S.jsx(z.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i})}function ue(){var d;const r=A.useButtonProps(F.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((d=r==null?void 0:r.componentProps)==null?void 0:d.redo)??{},{disabled:l}=A.useActive(s),a=()=>{l||o&&o()};return r?S.jsx(z.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i}):S.jsx(S.Fragment,{})}const F=de.extend({addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:n})=>{var i,o;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=n.options.shortcutKeys)==null?void 0:i[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((o=n.options.shortcutKeys)==null?void 0:o[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=F;exports.RichTextRedo=ue;exports.RichTextUndo=ce;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./clsx-CXbNJWDD.cjs"),C=require("@tiptap/pm/state"),x=require("@tiptap/pm/view"),R=require("./index-neeeY2o7.cjs"),S=require("react/jsx-runtime"),L=require("./toggle-BYvLnjCL.cjs");require("react");require("./index-CX4pNJlH.cjs");require("./theme.cjs");const A=require("./useButtonProps-CydzndG1.cjs"),W=require("./index-CBFmXCcU.cjs");function q(r={}){return new p.Plugin({view(e){return new U(e,r)}})}class U{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let c=e.nodeBefore,h=e.nodeAfter;if(c||h){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),M=c?v.bottom:v.top;c&&h&&(M=(M+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*l;n={left:v.left,right:v.right,top:M-b,bottom:M+b}}}}if(!n){let c=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;n={left:c.left-h,right:c.left+h,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),h=c.width/a.offsetWidth,m=c.height/a.offsetHeight;d=c.left-a.scrollLeft*h,u=c.top-a.scrollTop*m}this.element.style.left=(n.left-d)/s+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=p.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends p.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return f.valid(n)?new f(n):p.Selection.near(n)}content(){return p.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new z(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!X(e)||!Y(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&f.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(f.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!p.NodeSelection.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),n=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;p.Selection.jsonID("gapcursor",f);class z{constructor(e){this.pos=e}map(e){return new z(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):p.Selection.near(t)}}function B(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function X(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Y(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function J(){return new p.Plugin({props:{decorations:ee,createSelectionBetween(r,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:Q,handleKeyDown:Z,handleDOMEvents:{beforeinput:$}}})}const Z=R.keydownHandler({ArrowLeft:I("horiz",-1),ArrowRight:I("horiz",1),ArrowUp:I("vert",-1),ArrowDown:I("vert",1)});function I(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,o){let s=n.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof p.TextSelection){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let d=f.findGapCursorFrom(l,e,a);return d?(i&&i(n.tr.setSelection(new f(d))),!0):!1}}function Q(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!f.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&p.NodeSelection.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new f(n))),!0)}function $(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof f))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=p.Fragment.empty;for(let s=n.length-1;s>=0;s--)i=p.Fragment.from(n[s].createAndFill(null,i));let o=r.state.tr.replace(t.pos,t.pos,new p.Slice(i,0,0));return o.setSelection(p.TextSelection.near(o.doc.resolve(t.pos+1))),r.dispatch(o),!1}function ee(r){if(!(r.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",R.DecorationSet.create(r.doc,[R.Decoration.widget(r.selection.head,e,{key:"gapcursor"})])}var O=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<O&&this.leafAppend(e)||this.length<O&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new te(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};g.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,n),i};g.from=function(e){return e instanceof g?e:e&&e.length?new j(e):g.empty};var j=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=O)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=O)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new j([]);var te=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(n,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(n,i):n>=o?this.right.slice(n-o,i-o):this.left.slice(n,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(g);const ne=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,o;t&&(i=this.remapping(n,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,h)=>{if(!c.step){i||(i=this.remapping(n,h+1),o=i.maps.length),o--,u.push(c);return}if(i){u.push(new y(c.map));let m=c.step.map(i.slice(o)),v;m&&s.maybeStep(m).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new y(v,void 0,void 0,d.length+u.length))),o--,v&&i.appendMap(v,o)}else s.maybeStep(c.step);if(c.selection)return l=i?c.selection.map(i.slice(o)):c.selection,a=new w(this.items.slice(0,n).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,n,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),h=new y(e.mapping.maps[u],c,t),m;(m=a&&a.merge(h))&&(h=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let d=s-n.depth;return d>re&&(l=ie(l,d),s-=d),new w(l.append(o),s)}remapping(e,t){let n=new p.Mapping;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,t),n}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let v=o.maps[m];if(h.step){let M=e.steps[m].invert(e.docs[m]),b=h.selection&&h.selection.map(o.slice(a+1,m));b&&l++,n.push(new y(v,M,b))}else n.push(new y(v))},i);let d=[];for(let h=t;h<s;h++)d.push(new y(o.maps[h]));let u=this.items.slice(0,i).append(d).append(n),c=new w(u,l);return c.emptyItemCount()>ne&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(n)),d=a&&a.getMap();if(n--,d&&t.appendMap(d,n),a){let u=s.selection&&s.selection.map(t.slice(n));u&&o++;let c=new y(d.invert(),a,u),h,m=i.length-1;(h=i.length&&i[m].merge(c))?i[m]=h:i.push(c)}}else s.map&&n--},this.items.length,0),new w(g.from(i.reverse()),o)}}w.empty=new w(g.empty,0);function ie(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class y{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class P{constructor(e,t,n,i,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=o}}const re=20;function oe(r,e,t,n){let i=t.getMeta(E),o;if(i)return i.historyState;t.getMeta(ae)&&(r=new P(r.done,r.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(s&&s.getMeta(E))return s.getMeta(E).redo?new P(r.done.addTransform(t,void 0,n,T(e)),r.undone,F(t.mapping.maps),r.prevTime,r.prevComposition):new P(r.done,r.undone.addTransform(t,void 0,n,T(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!s&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!se(t,r.prevRanges)),d=s?D(r.prevRanges,t.mapping):F(t.mapping.maps);return new P(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,T(e)),w.empty,d,t.time,l??r.prevComposition)}else return(o=t.getMeta("rebased"))?new P(r.done.rebased(t,o),r.undone.rebased(t,o),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new P(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function se(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let o=0;o<e.length;o+=2)n<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function F(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,o,s)=>e.push(o,s));return e}function D(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),o=e.map(r[n+1],-1);i<=o&&t.push(i,o)}return t}function le(r,e,t){let n=T(e),i=E.get(e).spec.config,o=(t?r.undone:r.done).popEvent(e,n);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?r.done:r.undone).addTransform(o.transform,e.selection.getBookmark(),i,n),a=new P(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(E,{redo:t,historyState:a})}let k=!1,V=null;function T(r){let e=r.plugins;if(V!=e){k=!1,V=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const E=new p.PluginKey("history"),ae=new p.PluginKey("closeHistory");function de(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new p.Plugin({key:E,state:{init(){return new P(w.empty,w.empty,null,0,-1)},apply(e,t,n){return oe(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?G:n=="historyRedo"?_:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function H(r,e){return(t,n)=>{let i=E.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let o=le(i,t,r);o&&n(e?o.scrollIntoView():o)}return!0}}const G=H(!1,!0),_=H(!0,!0);p.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc;if(((r==null?void 0:r.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const o=this.storage.characters({node:n.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=n.tr.deleteRange(l,a);return r=!0,d}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n||i>n&&o>n&&o<=i)return!0;if(i>n&&o>n&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-n,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>n)}})]}});p.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[q(this.options)]}});p.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,o=[];if(!t||!n)return x.DecorationSet.create(r,[]);let s=0;this.options.mode==="deepest"&&r.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return r.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(x.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),x.DecorationSet.create(r,o)}}})]}});p.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[J()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=p.callOrReturn(p.getExtensionField(r,"allowGapCursor",t)))!=null?e:null}}});p.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return r.descendants((s,l)=>{const a=n>=l&&n<=l+s.nodeSize,d=!s.isLeaf&&p.isNodeEmpty(s);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const c=x.Decoration.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});i.push(c)}return this.options.includeChildren}),x.DecorationSet.create(r,i)}}})]}});p.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||p.isNodeSelection(t.selection)||r.view.dragging?null:x.DecorationSet.create(t.doc,[x.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function K({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||(e==null?void 0:e.type)===r}p.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new C.PluginKey(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new C.Plugin({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,h=d.nodes[t];if(u)return a.insert(c,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!K({node:s,types:n})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!K({node:s,types:n})}}})]}});var ce=p.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>G(r,e),redo:()=>({state:r,dispatch:e})=>_(r,e)}},addProseMirrorPlugins(){return[de(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function ue(){var u;const r=A.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((u=r==null?void 0:r.componentProps)==null?void 0:u.undo)??{},{disabled:l}=A.useActive(s),a=W.icons[e],d=()=>{l||o&&o()};return!r||!a?S.jsx(S.Fragment,{}):S.jsx(L.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i})}function pe(){var d;const r=A.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((d=r==null?void 0:r.componentProps)==null?void 0:d.redo)??{},{disabled:l}=A.useActive(s),a=()=>{l||o&&o()};return r?S.jsx(L.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i}):S.jsx(S.Fragment,{})}const N=ce.extend({addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:n})=>{var i,o;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=n.options.shortcutKeys)==null?void 0:i[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((o=n.options.shortcutKeys)==null?void 0:o[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=N;exports.RichTextRedo=pe;exports.RichTextUndo=ue;
package/lib/History.js CHANGED
@@ -1,11 +1,14 @@
1
- import { Q as N, y as te, F as V, x as G, T as H, v as _, S as A, U as W, V as ne, E as C, W as re, X as ie, Y as oe, l as se } from "./index-sVScpCFG.js";
1
+ import { Q as N, x as te, F as V, v as G, T as H, u as _, S as A, U as W, V as ne, E as C, W as re, X as ie, Y as oe, k as se } from "./clsx-DmuN0U_8.js";
2
2
  import { Plugin as I, PluginKey as b } from "@tiptap/pm/state";
3
3
  import { DecorationSet as O, Decoration as R } from "@tiptap/pm/view";
4
- import { k as le, D as ae, a as de } from "./index-DKt5wfAc.js";
4
+ import { k as le, D as ae, a as de } from "./index-DvvwJvau.js";
5
5
  import { jsx as T, Fragment as j } from "react/jsx-runtime";
6
- import { A as U, i as ce } from "./index-C3zg3DPB.js";
6
+ import { A as U } from "./toggle-Bxwwb_Kp.js";
7
7
  import "react";
8
- import { u as X, b as Y } from "./useButtonProps-cMoicZgd.js";
8
+ import "./index-D9JOHlso.js";
9
+ import "./theme.js";
10
+ import { u as X, b as Y } from "./useButtonProps-CfYtuEnd.js";
11
+ import { i as ce } from "./index-EAK64CCA.js";
9
12
  function ue(i = {}) {
10
13
  return new N({
11
14
  view(e) {
@@ -283,10 +286,10 @@ function ye(i) {
283
286
  let e = document.createElement("div");
284
287
  return e.className = "ProseMirror-gapcursor", ae.create(i.doc, [de.widget(i.selection.head, e, { key: "gapcursor" })]);
285
288
  }
286
- var D = 200, m = function() {
289
+ var k = 200, m = function() {
287
290
  };
288
291
  m.prototype.append = function(e) {
289
- return e.length ? (e = m.from(e), !this.length && e || e.length < D && this.leafAppend(e) || this.length < D && e.leafPrepend(this) || this.appendInner(e)) : this;
292
+ return e.length ? (e = m.from(e), !this.length && e || e.length < k && this.leafAppend(e) || this.length < k && e.leafPrepend(this) || this.appendInner(e)) : this;
290
293
  };
291
294
  m.prototype.prepend = function(e) {
292
295
  return e.length ? m.from(e).append(this) : this;
@@ -335,10 +338,10 @@ var Z = /* @__PURE__ */ (function(i) {
335
338
  if (r(this.values[a], l + a) === !1)
336
339
  return !1;
337
340
  }, e.prototype.leafAppend = function(r) {
338
- if (this.length + r.length <= D)
341
+ if (this.length + r.length <= k)
339
342
  return new e(this.values.concat(r.flatten()));
340
343
  }, e.prototype.leafPrepend = function(r) {
341
- if (this.length + r.length <= D)
344
+ if (this.length + r.length <= k)
342
345
  return new e(r.flatten().concat(this.values));
343
346
  }, t.length.get = function() {
344
347
  return this.values.length;
@@ -530,9 +533,9 @@ function Ie(i, e, t, n) {
530
533
  if (s && s.getMeta(E))
531
534
  return s.getMeta(E).redo ? new y(i.done.addTransform(t, void 0, n, S(e)), i.undone, L(t.mapping.maps), i.prevTime, i.prevComposition) : new y(i.done, i.undone.addTransform(t, void 0, n, S(e)), null, i.prevTime, i.prevComposition);
532
535
  if (t.getMeta("addToHistory") !== !1 && !(s && s.getMeta("addToHistory") === !1)) {
533
- let l = t.getMeta("composition"), a = i.prevTime == 0 || !s && i.prevComposition != l && (i.prevTime < (t.time || 0) - n.newGroupDelay || !be(t, i.prevRanges)), d = s ? k(i.prevRanges, t.mapping) : L(t.mapping.maps);
536
+ let l = t.getMeta("composition"), a = i.prevTime == 0 || !s && i.prevComposition != l && (i.prevTime < (t.time || 0) - n.newGroupDelay || !be(t, i.prevRanges)), d = s ? D(i.prevRanges, t.mapping) : L(t.mapping.maps);
534
537
  return new y(i.done.addTransform(t, a ? e.selection.getBookmark() : void 0, n, S(e)), v.empty, d, t.time, l ?? i.prevComposition);
535
- } else return (o = t.getMeta("rebased")) ? new y(i.done.rebased(t, o), i.undone.rebased(t, o), k(i.prevRanges, t.mapping), i.prevTime, i.prevComposition) : new y(i.done.addMaps(t.mapping.maps), i.undone.addMaps(t.mapping.maps), k(i.prevRanges, t.mapping), i.prevTime, i.prevComposition);
538
+ } else return (o = t.getMeta("rebased")) ? new y(i.done.rebased(t, o), i.undone.rebased(t, o), D(i.prevRanges, t.mapping), i.prevTime, i.prevComposition) : new y(i.done.addMaps(t.mapping.maps), i.undone.addMaps(t.mapping.maps), D(i.prevRanges, t.mapping), i.prevTime, i.prevComposition);
536
539
  }
537
540
  function be(i, e) {
538
541
  if (!e)
@@ -551,7 +554,7 @@ function L(i) {
551
554
  i[t].forEach((n, r, o, s) => e.push(o, s));
552
555
  return e;
553
556
  }
554
- function k(i, e) {
557
+ function D(i, e) {
555
558
  if (!i)
556
559
  return null;
557
560
  let t = [];
@@ -899,7 +902,7 @@ var Oe = C.create({
899
902
  };
900
903
  }
901
904
  });
902
- function Le() {
905
+ function Ge() {
903
906
  var u;
904
907
  const i = X(ee.name), {
905
908
  icon: e = void 0,
@@ -923,7 +926,7 @@ function Le() {
923
926
  }
924
927
  );
925
928
  }
926
- function Be() {
929
+ function He() {
927
930
  var d;
928
931
  const i = X(ee.name), {
929
932
  icon: e = void 0,
@@ -986,6 +989,6 @@ const ee = /* @__PURE__ */ Oe.extend({
986
989
  });
987
990
  export {
988
991
  ee as History,
989
- Be as RichTextRedo,
990
- Le as RichTextUndo
992
+ He as RichTextRedo,
993
+ Ge as RichTextUndo
991
994
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-BBNITgNi.cjs"),l=require("@tiptap/pm/state"),f=require("./index-C838s-or.cjs"),h=require("react/jsx-runtime");require("react");const T=require("./useButtonProps-DfnJiJLV.cjs");var A=i.Node3.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",i.mergeAttributes(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,n)=>n.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:n})=>{if(!i.canInsertNode(n,n.schema.nodes[this.name]))return!1;const{selection:r}=n,{$to:s}=r,c=t();return i.isNodeSelection(r)?c.insertContentAt(s.pos,{type:this.name}):c.insertContent({type:this.name}),c.command(({state:a,tr:e,dispatch:p})=>{if(p){const{$to:o}=e.selection,u=o.end();if(o.nodeAfter)o.nodeAfter.isTextblock?e.setSelection(l.TextSelection.create(e.doc,o.pos+1)):o.nodeAfter.isBlock?e.setSelection(l.NodeSelection.create(e.doc,o.pos)):e.setSelection(l.TextSelection.create(e.doc,o.pos));else{const d=a.schema.nodes[this.options.nextNodeType]||o.parent.type.contentMatch.defaultType,m=d==null?void 0:d.create();m&&(e.insert(u,m),e.setSelection(l.TextSelection.create(e.doc,u+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[i.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});function R(){const t=T.useButtonProps(y.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:e=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:o,update:u}=T.useToggleActive(e),d=()=>{o||a&&(a(),u())};return t?h.jsx(f.ActionButton,{action:d,dataState:p,disabled:o,icon:n,shortcutKeys:s,tooltip:r,tooltipOptions:c}):h.jsx(h.Fragment,{})}const y=A.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:n,t:r,extension:s})=>({component:f.ActionButton,componentProps:{action:()=>n.commands.setHorizontalRule(),disabled:!n.can().setHorizontalRule(),icon:"Minus",shortcutKeys:s.options.shortcutKeys??["mod","alt","S"],tooltip:r("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}},renderHTML(){return["div",i.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}});exports.HorizontalRule=y;exports.RichTextHorizontalRule=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),d=require("@tiptap/pm/state"),f=require("./toggle-BYvLnjCL.cjs"),h=require("react/jsx-runtime");require("react");require("./index-CX4pNJlH.cjs");require("./theme.cjs");const T=require("./useButtonProps-CydzndG1.cjs");var A=i.Node3.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",i.mergeAttributes(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,n)=>n.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:n})=>{if(!i.canInsertNode(n,n.schema.nodes[this.name]))return!1;const{selection:r}=n,{$to:s}=r,c=t();return i.isNodeSelection(r)?c.insertContentAt(s.pos,{type:this.name}):c.insertContent({type:this.name}),c.command(({state:a,tr:e,dispatch:p})=>{if(p){const{$to:o}=e.selection,u=o.end();if(o.nodeAfter)o.nodeAfter.isTextblock?e.setSelection(d.TextSelection.create(e.doc,o.pos+1)):o.nodeAfter.isBlock?e.setSelection(d.NodeSelection.create(e.doc,o.pos)):e.setSelection(d.TextSelection.create(e.doc,o.pos));else{const l=a.schema.nodes[this.options.nextNodeType]||o.parent.type.contentMatch.defaultType,m=l==null?void 0:l.create();m&&(e.insert(u,m),e.setSelection(d.TextSelection.create(e.doc,u+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[i.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});function R(){const t=T.useButtonProps(y.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:e=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:o,update:u}=T.useToggleActive(e),l=()=>{o||a&&(a(),u())};return t?h.jsx(f.ActionButton,{action:l,dataState:p,disabled:o,icon:n,shortcutKeys:s,tooltip:r,tooltipOptions:c}):h.jsx(h.Fragment,{})}const y=A.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:n,t:r,extension:s})=>({component:f.ActionButton,componentProps:{action:()=>n.commands.setHorizontalRule(),disabled:!n.can().setHorizontalRule(),icon:"Minus",shortcutKeys:s.options.shortcutKeys??["mod","alt","S"],tooltip:r("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}},renderHTML(){return["div",i.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}});exports.HorizontalRule=y;exports.RichTextHorizontalRule=R;
@@ -1,9 +1,11 @@
1
- import { N as T, n as A, k as y, l as H, m as h } from "./index-sVScpCFG.js";
1
+ import { N as T, n as A, j as y, k as H, m as h } from "./clsx-DmuN0U_8.js";
2
2
  import { TextSelection as u, NodeSelection as R } from "@tiptap/pm/state";
3
- import { A as f } from "./index-C3zg3DPB.js";
3
+ import { A as f } from "./toggle-Bxwwb_Kp.js";
4
4
  import { jsx as m, Fragment as M } from "react/jsx-runtime";
5
5
  import "react";
6
- import { u as v, a as z } from "./useButtonProps-cMoicZgd.js";
6
+ import "./index-D9JOHlso.js";
7
+ import "./theme.js";
8
+ import { u as v, a as z } from "./useButtonProps-CfYtuEnd.js";
7
9
  var S = T.create({
8
10
  name: "horizontalRule",
9
11
  addOptions() {
@@ -55,7 +57,7 @@ var S = T.create({
55
57
  ];
56
58
  }
57
59
  });
58
- function w() {
60
+ function I() {
59
61
  const t = v(b.name), {
60
62
  icon: n = void 0,
61
63
  tooltip: r = void 0,
@@ -115,5 +117,5 @@ const b = /* @__PURE__ */ S.extend({
115
117
  });
116
118
  export {
117
119
  b as HorizontalRule,
118
- w as RichTextHorizontalRule
120
+ I as RichTextHorizontalRule
119
121
  };
@@ -0,0 +1 @@
1
+ "use strict";const c=require("react/jsx-runtime");require("react");require("./index-CX4pNJlH.cjs");require("./theme.cjs");const i=require("./index-CBFmXCcU.cjs");function t(e){const n=i.icons[e.name];return n?c.jsx(n,{onClick:e==null?void 0:e.onClick,className:`richtext-w-4 richtext-h-4 ${(e==null?void 0:e.className)||""}`}):null}exports.IconComponent=t;
@@ -0,0 +1,12 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import "react";
3
+ import "./index-D9JOHlso.js";
4
+ import "./theme.js";
5
+ import { i as c } from "./index-EAK64CCA.js";
6
+ function x(t) {
7
+ const n = c[t.name];
8
+ return n ? /* @__PURE__ */ i(n, { onClick: t == null ? void 0 : t.onClick, className: `richtext-w-4 richtext-h-4 ${(t == null ? void 0 : t.className) || ""}` }) : null;
9
+ }
10
+ export {
11
+ x as I
12
+ };