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
@@ -1,14 +1,16 @@
1
- import { C as U, aa as rt, q as Mt, N as jt, m as Wt, ab as Bt, u as Ft } from "./index-sVScpCFG.js";
1
+ import { B as U, aa as rt, o as Mt, N as jt, m as Wt, ab as Bt, s as Ft } from "./clsx-DmuN0U_8.js";
2
2
  import { jsx as r, jsxs as h, Fragment as Pt } from "react/jsx-runtime";
3
3
  import Be, { useState as se, Fragment as Ut, useEffect as Fe, useMemo as Pe, createContext as zt, useLayoutEffect as Ht, useContext as Gt, useRef as K, useCallback as Te, useDebugValue as Xt } from "react";
4
- import { A as Kt } from "./index-C3zg3DPB.js";
5
- import { u as Qt } from "./index-0OnGZkVF.js";
6
- import { L as Jt } from "./label-DsOYPjAo.js";
7
- import { I as Yt } from "./input-CvyMYMZG.js";
8
- import { B as Zt } from "./button-RnHbJfd-.js";
9
- import { c as en, u as tn, a as nn } from "./useButtonProps-cMoicZgd.js";
10
- import { P as rn, a as on, b as an } from "./popover-B7ec5-u2.js";
11
- import { I as sn } from "./Icon-DRuJhcHK.js";
4
+ import { A as Kt } from "./toggle-Bxwwb_Kp.js";
5
+ import "./index-D9JOHlso.js";
6
+ import "./theme.js";
7
+ import { P as Qt, a as Jt, b as Yt } from "./popover-CWmTzHSy.js";
8
+ import { B as Zt } from "./button-9_8t7ca7.js";
9
+ import { I as en } from "./input-YoheBL2D.js";
10
+ import { L as tn } from "./label-C8PLcjFI.js";
11
+ import { u as nn } from "./index-BDX1uE62.js";
12
+ import { c as rn, u as on, a as an } from "./useButtonProps-CfYtuEnd.js";
13
+ import { I as sn } from "./Icon-ONE1AwKo.js";
12
14
  const cn = "_verified_lvyh0_1", Ue = {
13
15
  verified: cn
14
16
  }, ln = () => /* @__PURE__ */ r("svg", {
@@ -157,7 +159,7 @@ const cn = "_verified_lvyh0_1", Ue = {
157
159
  alt: o.description
158
160
  })
159
161
  }) : null;
160
- }, wn = "_header_nqq4j_1", yn = "_avatar_nqq4j_11", bn = "_avatarOverflow_nqq4j_16", Tn = "_avatarSquare_nqq4j_23", xn = "_avatarShadow_nqq4j_26", Nn = "_author_nqq4j_37", In = "_authorLink_nqq4j_44", Rn = "_authorVerified_nqq4j_53", Sn = "_authorLinkText_nqq4j_56", kn = "_authorMeta_nqq4j_63", En = "_authorFollow_nqq4j_66", Cn = "_username_nqq4j_69", On = "_follow_nqq4j_74", Ln = "_separator_nqq4j_82", qn = "_brand_nqq4j_86", $n = "_twitterIcon_nqq4j_90", N = {
162
+ }, wn = "_header_nqq4j_1", yn = "_avatar_nqq4j_11", bn = "_avatarOverflow_nqq4j_16", Tn = "_avatarSquare_nqq4j_23", xn = "_avatarShadow_nqq4j_26", Nn = "_author_nqq4j_37", In = "_authorLink_nqq4j_44", Rn = "_authorVerified_nqq4j_53", Sn = "_authorLinkText_nqq4j_56", kn = "_authorMeta_nqq4j_63", En = "_authorFollow_nqq4j_66", Cn = "_username_nqq4j_69", On = "_follow_nqq4j_74", Ln = "_separator_nqq4j_82", $n = "_brand_nqq4j_86", qn = "_twitterIcon_nqq4j_90", N = {
161
163
  header: wn,
162
164
  avatar: yn,
163
165
  avatarOverflow: bn,
@@ -172,8 +174,8 @@ const cn = "_verified_lvyh0_1", Ue = {
172
174
  username: Cn,
173
175
  follow: On,
174
176
  separator: Ln,
175
- brand: qn,
176
- twitterIcon: $n
177
+ brand: $n,
178
+ twitterIcon: qn
177
179
  }, Dn = ({ tweet: e, components: t }) => {
178
180
  var n;
179
181
  const o = (n = t == null ? void 0 : t.AvatarImg) != null ? n : vt, { user: a } = e;
@@ -642,13 +644,13 @@ const or = (e) => ({
642
644
  })
643
645
  })
644
646
  ]
645
- }), Er = "_actions_n2anf_1", Cr = "_like_n2anf_13", Or = "_reply_n2anf_14", Lr = "_copy_n2anf_15", qr = "_likeIconWrapper_n2anf_27", $r = "_likeCount_n2anf_30", Dr = "_replyIconWrapper_n2anf_35", Ar = "_copyIconWrapper_n2anf_36", Vr = "_likeIcon_n2anf_27", Mr = "_replyIcon_n2anf_35", jr = "_copyIcon_n2anf_36", Wr = "_replyText_n2anf_56", Br = "_copyText_n2anf_57", k = {
647
+ }), Er = "_actions_n2anf_1", Cr = "_like_n2anf_13", Or = "_reply_n2anf_14", Lr = "_copy_n2anf_15", $r = "_likeIconWrapper_n2anf_27", qr = "_likeCount_n2anf_30", Dr = "_replyIconWrapper_n2anf_35", Ar = "_copyIconWrapper_n2anf_36", Vr = "_likeIcon_n2anf_27", Mr = "_replyIcon_n2anf_35", jr = "_copyIcon_n2anf_36", Wr = "_replyText_n2anf_56", Br = "_copyText_n2anf_57", k = {
646
648
  actions: Er,
647
649
  like: Cr,
648
650
  reply: Or,
649
651
  copy: Lr,
650
- likeIconWrapper: qr,
651
- likeCount: $r,
652
+ likeIconWrapper: $r,
653
+ likeCount: qr,
652
654
  replyIconWrapper: Dr,
653
655
  copyIconWrapper: Ar,
654
656
  likeIcon: Vr,
@@ -975,7 +977,7 @@ const or = (e) => ({
975
977
  ]
976
978
  }), Nt = 0, It = 1, Rt = 2, lt = 3;
977
979
  var dt = Object.prototype.hasOwnProperty;
978
- function qe(e, t) {
980
+ function $e(e, t) {
979
981
  var n, o;
980
982
  if (e === t) return !0;
981
983
  if (e && t && (n = e.constructor) === t.constructor) {
@@ -983,13 +985,13 @@ function qe(e, t) {
983
985
  if (n === RegExp) return e.toString() === t.toString();
984
986
  if (n === Array) {
985
987
  if ((o = e.length) === t.length)
986
- for (; o-- && qe(e[o], t[o]); ) ;
988
+ for (; o-- && $e(e[o], t[o]); ) ;
987
989
  return o === -1;
988
990
  }
989
991
  if (!n || typeof e == "object") {
990
992
  o = 0;
991
993
  for (n in e)
992
- if (dt.call(e, n) && ++o && !dt.call(t, n) || !(n in t) || !qe(e[n], t[n])) return !1;
994
+ if (dt.call(e, n) && ++o && !dt.call(t, n) || !(n in t) || !$e(e[n], t[n])) return !1;
993
995
  return Object.keys(t).length === o;
994
996
  }
995
997
  }
@@ -999,7 +1001,7 @@ const F = /* @__PURE__ */ new WeakMap(), P = () => {
999
1001
  }, R = (
1000
1002
  /*#__NOINLINE__*/
1001
1003
  P()
1002
- ), $e = Object, u = (e) => e === R, j = (e) => typeof e == "function", z = (e, t) => ({
1004
+ ), qe = Object, u = (e) => e === R, j = (e) => typeof e == "function", z = (e, t) => ({
1003
1005
  ...e,
1004
1006
  ...t
1005
1007
  }), St = (e) => j(e.then), Re = {}, ve = {}, He = "undefined", ue = typeof window != He, De = typeof document != He, wo = ue && "Deno" in window, yo = () => ue && typeof window.requestAnimationFrame != He, kt = (e, t) => {
@@ -1050,12 +1052,12 @@ const bo = () => Ae, [Ve, Me] = ue && window.addEventListener ? [
1050
1052
  }, ut = !Be.useId, ie = !ue || wo, So = (e) => yo() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Se = ie ? Fe : Ht, ke = typeof navigator < "u" && navigator.connection, ft = !ie && ke && ([
1051
1053
  "slow-2g",
1052
1054
  "2g"
1053
- ].includes(ke.effectiveType) || ke.saveData), ge = /* @__PURE__ */ new WeakMap(), ko = (e) => $e.prototype.toString.call(e), Ee = (e, t) => e === `[object ${t}]`;
1055
+ ].includes(ke.effectiveType) || ke.saveData), ge = /* @__PURE__ */ new WeakMap(), ko = (e) => qe.prototype.toString.call(e), Ee = (e, t) => e === `[object ${t}]`;
1054
1056
  let Eo = 0;
1055
1057
  const je = (e) => {
1056
1058
  const t = typeof e, n = ko(e), o = Ee(n, "Date"), a = Ee(n, "RegExp"), i = Ee(n, "Object");
1057
1059
  let s, c;
1058
- if ($e(e) === e && !o && !a) {
1060
+ if (qe(e) === e && !o && !a) {
1059
1061
  if (s = ge.get(e), s) return s;
1060
1062
  if (s = ++Eo + "~", ge.set(e, s), Array.isArray(e)) {
1061
1063
  for (s = "@", c = 0; c < e.length; c++)
@@ -1064,7 +1066,7 @@ const je = (e) => {
1064
1066
  }
1065
1067
  if (i) {
1066
1068
  s = "#";
1067
- const f = $e.keys(e).sort();
1069
+ const f = qe.keys(e).sort();
1068
1070
  for (; !u(c = f.pop()); )
1069
1071
  u(e[c]) || (s += c + ":" + je(e[c]) + ",");
1070
1072
  ge.set(e, s);
@@ -1110,8 +1112,8 @@ async function Et(...e) {
1110
1112
  const [I] = Ge(b);
1111
1113
  if (!I) return;
1112
1114
  const [E, L] = kt(t, I), [D, ce, l, fe] = F.get(t), J = () => {
1113
- const q = D[I];
1114
- return (j(i.revalidate) ? i.revalidate(E().data, b) : i.revalidate !== !1) && (delete l[I], delete fe[I], q && q[0]) ? q[0](Rt).then(() => E().data) : E().data;
1115
+ const $ = D[I];
1116
+ return (j(i.revalidate) ? i.revalidate(E().data, b) : i.revalidate !== !1) && (delete l[I], delete fe[I], $ && $[0]) ? $[0](Rt).then(() => E().data) : E().data;
1115
1117
  };
1116
1118
  if (e.length < 3)
1117
1119
  return J();
@@ -1128,12 +1130,12 @@ async function Et(...e) {
1128
1130
  })), j(T))
1129
1131
  try {
1130
1132
  T = T(H);
1131
- } catch (q) {
1132
- A = q, V = !0;
1133
+ } catch ($) {
1134
+ A = $, V = !0;
1133
1135
  }
1134
1136
  if (T && St(T))
1135
- if (T = await T.catch((q) => {
1136
- A = q, V = !0;
1137
+ if (T = await T.catch(($) => {
1138
+ A = $, V = !0;
1137
1139
  }), Y !== ce[I][0]) {
1138
1140
  if (V) throw A;
1139
1141
  return T;
@@ -1143,9 +1145,9 @@ async function Et(...e) {
1143
1145
  }));
1144
1146
  if (s && !V)
1145
1147
  if (j(s)) {
1146
- const q = s(T, H);
1148
+ const $ = s(T, H);
1147
1149
  L({
1148
- data: q,
1150
+ data: $,
1149
1151
  error: R,
1150
1152
  _c: R
1151
1153
  });
@@ -1212,7 +1214,7 @@ const ht = (e, t) => {
1212
1214
  }, Lo = (e, t, n, o, a) => {
1213
1215
  const i = n.errorRetryCount, s = a.retryCount, c = ~~((Math.random() + 0.5) * (1 << (s < 8 ? s : 8))) * n.errorRetryInterval;
1214
1216
  !u(i) && s > i || setTimeout(o, c, a);
1215
- }, qo = qe, [Ct, $o] = Oo(/* @__PURE__ */ new Map()), Do = z(
1217
+ }, $o = $e, [Ct, qo] = Oo(/* @__PURE__ */ new Map()), Do = z(
1216
1218
  {
1217
1219
  // events
1218
1220
  onLoadingSlow: P,
@@ -1231,10 +1233,10 @@ const ht = (e, t) => {
1231
1233
  dedupingInterval: 2 * 1e3,
1232
1234
  loadingTimeout: ft ? 5e3 : 3e3,
1233
1235
  // providers
1234
- compare: qo,
1236
+ compare: $o,
1235
1237
  isPaused: () => !1,
1236
1238
  cache: Ct,
1237
- mutate: $o,
1239
+ mutate: qo,
1238
1240
  fallback: {}
1239
1241
  },
1240
1242
  // use web preset by default
@@ -1304,7 +1306,7 @@ const Ce = Be.use || // This extra generic is to avoid TypeScript mixing up the
1304
1306
  }), Oe = {
1305
1307
  dedupe: !0
1306
1308
  }, _t = Promise.resolve(R), Go = (e, t, n) => {
1307
- const { cache: o, compare: a, suspense: i, fallbackData: s, revalidateOnMount: c, revalidateIfStale: f, refreshInterval: d, refreshWhenHidden: g, refreshWhenOffline: m, keepPreviousData: b, strictServerPrefetchWarning: I } = n, [E, L, D, ce] = F.get(o), [l, fe] = Ge(e), J = K(!1), T = K(!1), A = K(l), V = K(t), Y = K(n), p = () => Y.current, Z = () => p().isVisible() && p().isOnline(), [M, ee, H, q] = kt(o, l), te = K({}).current, he = u(s) ? u(n.fallback) ? R : n.fallback[l] : s, Xe = (_, v) => {
1309
+ const { cache: o, compare: a, suspense: i, fallbackData: s, revalidateOnMount: c, revalidateIfStale: f, refreshInterval: d, refreshWhenHidden: g, refreshWhenOffline: m, keepPreviousData: b, strictServerPrefetchWarning: I } = n, [E, L, D, ce] = F.get(o), [l, fe] = Ge(e), J = K(!1), T = K(!1), A = K(l), V = K(t), Y = K(n), p = () => Y.current, Z = () => p().isVisible() && p().isOnline(), [M, ee, H, $] = kt(o, l), te = K({}).current, he = u(s) ? u(n.fallback) ? R : n.fallback[l] : s, Xe = (_, v) => {
1308
1310
  for (const y in te) {
1309
1311
  const w = y;
1310
1312
  if (w === "data") {
@@ -1322,8 +1324,8 @@ const Ce = Be.use || // This extra generic is to avoid TypeScript mixing up the
1322
1324
  isLoading: !0,
1323
1325
  ...W
1324
1326
  } : W;
1325
- }, y = M(), w = q(), $ = v(y), oe = y === w ? $ : v(w);
1326
- let x = $;
1327
+ }, y = M(), w = $(), q = v(y), oe = y === w ? q : v(w);
1328
+ let x = q;
1327
1329
  return [
1328
1330
  () => {
1329
1331
  const S = v(M());
@@ -1343,15 +1345,15 @@ const Ce = Be.use || // This extra generic is to avoid TypeScript mixing up the
1343
1345
  o,
1344
1346
  l
1345
1347
  ]
1346
- ), Ke[0], Ke[1]), Qe = !J.current, qt = E[l] && E[l].length > 0, re = ne.data, G = u(re) ? he && St(he) ? Ce(he) : he : re, _e = ne.error, we = K(G), me = b ? u(re) ? u(we.current) ? G : we.current : re : G, X = l && u(G), $t = !ie && // eslint-disable-next-line react-hooks/rules-of-hooks
1348
+ ), Ke[0], Ke[1]), Qe = !J.current, $t = E[l] && E[l].length > 0, re = ne.data, G = u(re) ? he && St(he) ? Ce(he) : he : re, _e = ne.error, we = K(G), me = b ? u(re) ? u(we.current) ? G : we.current : re : G, X = l && u(G), qt = !ie && // eslint-disable-next-line react-hooks/rules-of-hooks
1347
1349
  rt.useSyncExternalStore(() => P, () => !1, () => !0);
1348
- I && $t && !i && X && console.warn(`Missing pre-initiated data for serialized key "${l}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);
1349
- const Je = qt && !u(_e) ? !1 : Qe && !u(c) ? c : p().isPaused() ? !1 : i ? u(G) ? !1 : f : u(G) || f, Ye = !!(l && t && Qe && Je), Dt = u(ne.isValidating) ? Ye : ne.isValidating, At = u(ne.isLoading) ? Ye : ne.isLoading, le = Te(
1350
+ I && qt && !i && X && console.warn(`Missing pre-initiated data for serialized key "${l}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);
1351
+ const Je = $t && !u(_e) ? !1 : Qe && !u(c) ? c : p().isPaused() ? !1 : i ? u(G) ? !1 : f : u(G) || f, Ye = !!(l && t && Qe && Je), Dt = u(ne.isValidating) ? Ye : ne.isValidating, At = u(ne.isLoading) ? Ye : ne.isLoading, le = Te(
1350
1352
  async (_) => {
1351
1353
  const v = V.current;
1352
1354
  if (!l || !v || T.current || p().isPaused())
1353
1355
  return !1;
1354
- let y, w, $ = !0;
1356
+ let y, w, q = !0;
1355
1357
  const oe = _ || {}, x = !D[l] || !oe.dedupe, S = () => ut ? !T.current && l === A.current && J.current : l === A.current, W = {
1356
1358
  isValidating: !1,
1357
1359
  isLoading: !1
@@ -1366,7 +1368,7 @@ const Ce = Be.use || // This extra generic is to avoid TypeScript mixing up the
1366
1368
  u(M().data) && (nt.isLoading = !0);
1367
1369
  try {
1368
1370
  if (x && (ee(nt), n.loadingTimeout && u(M().data) && setTimeout(() => {
1369
- $ && S() && p().onLoadingSlow(l, n);
1371
+ q && S() && p().onLoadingSlow(l, n);
1370
1372
  }, n.loadingTimeout), D[l] = [
1371
1373
  v(fe),
1372
1374
  We()
@@ -1392,7 +1394,7 @@ const Ce = Be.use || // This extra generic is to avoid TypeScript mixing up the
1392
1394
  dedupe: !0
1393
1395
  })));
1394
1396
  }
1395
- return $ = !1, et(), !0;
1397
+ return q = !1, et(), !0;
1396
1398
  },
1397
1399
  // `setState` is immutable, and `eventsCallback`, `fnArg`, and
1398
1400
  // `keyValidating` are depending on `key`, so we can exclude them from
@@ -1422,16 +1424,16 @@ const Ce = Be.use || // This extra generic is to avoid TypeScript mixing up the
1422
1424
  const _ = le.bind(R, Oe);
1423
1425
  let v = 0;
1424
1426
  p().revalidateOnFocus && (v = Date.now() + p().focusThrottleInterval);
1425
- const w = Ho(l, E, ($, oe = {}) => {
1426
- if ($ == Nt) {
1427
+ const w = Ho(l, E, (q, oe = {}) => {
1428
+ if (q == Nt) {
1427
1429
  const x = Date.now();
1428
1430
  p().revalidateOnFocus && x > v && Z() && (v = x + p().focusThrottleInterval, _());
1429
- } else if ($ == It)
1431
+ } else if (q == It)
1430
1432
  p().revalidateOnReconnect && Z() && _();
1431
1433
  else {
1432
- if ($ == Rt)
1434
+ if (q == Rt)
1433
1435
  return le();
1434
- if ($ == lt)
1436
+ if (q == lt)
1435
1437
  return le(oe);
1436
1438
  }
1437
1439
  });
@@ -1536,7 +1538,7 @@ function ea({ node: e }) {
1536
1538
  return n ? /* @__PURE__ */ r(Mt, { children: /* @__PURE__ */ r("div", { "data-twitter": "", children: /* @__PURE__ */ r(Zo, { id: n }) }) }) : null;
1537
1539
  }
1538
1540
  function ta(e) {
1539
- const { t } = Qt(), [n, o] = se("");
1541
+ const { t } = nn(), [n, o] = se("");
1540
1542
  Fe(() => {
1541
1543
  var i;
1542
1544
  if (e != null && e.editor) {
@@ -1553,9 +1555,9 @@ function ta(e) {
1553
1555
  className: "richtext-flex richtext-flex-col richtext-gap-2",
1554
1556
  onSubmit: a,
1555
1557
  children: [
1556
- /* @__PURE__ */ r(Jt, { className: "mb-[6px]", children: t("editor.link.dialog.text") }),
1558
+ /* @__PURE__ */ r(tn, { className: "mb-[6px]", children: t("editor.link.dialog.text") }),
1557
1559
  /* @__PURE__ */ r("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ r("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ r(
1558
- Yt,
1560
+ en,
1559
1561
  {
1560
1562
  className: "richtext-w-80",
1561
1563
  onChange: (i) => o(i.target.value),
@@ -1577,25 +1579,25 @@ function ta(e) {
1577
1579
  }
1578
1580
  );
1579
1581
  }
1580
- function pa() {
1581
- const [e, t] = se(!1), n = en(), o = tn(Lt.name), {
1582
+ function ga() {
1583
+ const [e, t] = se(!1), n = rn(), o = on(Lt.name), {
1582
1584
  icon: a = void 0,
1583
1585
  tooltip: i = void 0,
1584
1586
  tooltipOptions: s = {},
1585
1587
  action: c = void 0,
1586
1588
  isActive: f = void 0
1587
- } = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: d } = nn(f);
1589
+ } = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: d } = an(f);
1588
1590
  function g(m) {
1589
1591
  d || c && (c(m), t(!1));
1590
1592
  }
1591
1593
  return /* @__PURE__ */ h(
1592
- rn,
1594
+ Qt,
1593
1595
  {
1594
1596
  modal: !0,
1595
1597
  onOpenChange: t,
1596
1598
  open: e,
1597
1599
  children: [
1598
- /* @__PURE__ */ r(on, { asChild: !0, children: /* @__PURE__ */ r(
1600
+ /* @__PURE__ */ r(Jt, { asChild: !0, children: /* @__PURE__ */ r(
1599
1601
  Kt,
1600
1602
  {
1601
1603
  disabled: d,
@@ -1606,7 +1608,7 @@ function pa() {
1606
1608
  }
1607
1609
  ) }),
1608
1610
  /* @__PURE__ */ r(
1609
- an,
1611
+ Yt,
1610
1612
  {
1611
1613
  align: "start",
1612
1614
  className: "richtext-w-full",
@@ -1700,6 +1702,6 @@ const Lt = /* @__PURE__ */ jt.create({
1700
1702
  });
1701
1703
  export {
1702
1704
  ta as F,
1703
- pa as R,
1705
+ ga as R,
1704
1706
  Lt as T
1705
1707
  };
package/lib/Twitter.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-BBNITgNi.cjs");const t=require("./Twitter-Cnvt7GBg.cjs");exports.RichTextTwitter=t.RichTextTwitter;exports.Twitter=t.Twitter;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const t=require("./Twitter-CBuVBQM1.cjs");exports.RichTextTwitter=t.RichTextTwitter;exports.Twitter=t.Twitter;
package/lib/Twitter.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./index-sVScpCFG.js";
2
- import { R as i, T } from "./Twitter-DWwd0vHR.js";
1
+ import "./clsx-DmuN0U_8.js";
2
+ import { R as i, T } from "./Twitter-D58T0Zt3.js";
3
3
  export {
4
4
  i as RichTextTwitter,
5
5
  T as Twitter
package/lib/Video.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("./index-BBNITgNi.cjs"),k=require("./index-FSRjMsxW.cjs"),p=require("./useButtonProps-DfnJiJLV.cjs"),o=require("react/jsx-runtime"),d=require("react"),E=require("./index-C838s-or.cjs"),g=require("./dialog-CMC9hsCo.cjs"),M=require("./events.constant-DQYeJpu5.cjs"),u=require("./tabs-BTwiZkWd.cjs"),D=require("./button-BW5bDPz_.cjs"),I=require("./input-D555880-.cjs");function R(e,t){let n;try{n=new URL(e)}catch{return!1}return!(t!=null&&t.length)||t.length===1&&t[0]==="."?!0:t.some(s=>{if(s.includes("*")){const l=s.replace(/\./g,String.raw`\.`).replace(/\*/g,".*");return new RegExp(`^${l}$`).test(n.hostname)}return n.hostname.includes(s)})}function H(){const{t:e}=k.useLocale(),t=p.useEditorInstance(),n=p.useButtonProps(T.name),{icon:s,tooltip:l}=(n==null?void 0:n.componentProps)??{},{editorDisabled:c}=p.useToggleActive(),[f,x]=d.useState(""),w=d.useRef(null),[y,m]=d.useState(""),[V,h]=d.useState(!1),v=p.useExtension(T.name),C=r=>{h(r.detail)};d.useEffect(()=>{const r=M.listenEvent(M.EVENTS.UPLOAD_VIDEO(t.id),C);return()=>{r()}},[t]);const i=d.useMemo(()=>(v==null?void 0:v.options)??{},[v]);async function S(r){var L;const a=(L=r==null?void 0:r.target)==null?void 0:L.files;if(!t||t.isDestroyed||a.length===0)return;const b=a[0];let j="";i.upload?j=await i.upload(b):j=URL.createObjectURL(b),t.chain().focus().setVideo({src:j,width:"100%"}).run(),h(!1)}function A(r){r.preventDefault(),r.stopPropagation(),f&&(t.chain().focus().setVideo({src:f,width:"100%"}).run(),h(!1),x(""))}function q(r){var a;r.preventDefault(),(a=w.current)==null||a.click()}return o.jsxs(g.Dialog,{onOpenChange:h,open:V,children:[o.jsx(g.DialogTrigger,{asChild:!0,children:o.jsx(E.ActionButton,{disabled:c,icon:s,tooltip:l,action:()=>{c||h(!0)}})}),o.jsxs(g.DialogContent,{children:[o.jsx(g.DialogTitle,{children:e("editor.video.dialog.title")}),o.jsxs(u.Tabs,{activationMode:"manual",defaultValue:(i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="upload"?"upload":"link",children:[o.jsxs(u.TabsList,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="upload")&&o.jsx(u.TabsTrigger,{value:"upload",children:e("editor.video.dialog.tab.upload")}),((i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="link")&&o.jsx(u.TabsTrigger,{value:"link",children:e("editor.video.dialog.link")})]}),o.jsxs(u.TabsContent,{value:"upload",children:[o.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:o.jsx(D.Button,{className:"richtext-mt-1 richtext-w-full",onClick:q,size:"sm",children:e("editor.video.dialog.tab.upload")})}),o.jsx("input",{accept:"video/*",multiple:!0,onChange:S,ref:w,type:"file",style:{display:"none"}})]}),o.jsxs(u.TabsContent,{value:"link",children:[o.jsx("div",{children:o.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[o.jsx(I.Input,{autoFocus:!0,placeholder:e("editor.video.dialog.placeholder"),required:!0,type:"url",value:f,onBlur:r=>{const a=r.target.value,b=i.videoProviders||["."];a&&!R(a,b)?m("Invalid video URL"):m("")},onChange:r=>{x(r.target.value)}}),o.jsx(D.Button,{onClick:A,type:"button",children:e("editor.video.dialog.button.apply")})]})}),y&&o.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:y})]})]})]})]})}function B(e){e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/");const t=e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);t&&(e=`https://www.youtube.com/embed/${t[1]}`);const n=e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);if(n){const l=n[1],c=n[2];c?e=`https://player.vimeo.com/video/${l}?h=${c}`:e=`https://player.vimeo.com/video/${l}`}return/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const T=$.Node3.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:k.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper"},button:({editor:e,t})=>{var n,s;return{componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((s=(n=e.can()).setVideo)!=null&&s.call(n,{})),icon:"Video",tooltip:t("editor.video.tooltip"),videoProviders:["."],editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?B(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:p.getCssUnitWithDefault(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},align:{default:"center",renderHTML:({align:e})=>({align:e})}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%",align:n="center"}=e??{},s={...e,width:"100%",height:"100%"},l=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,c=`flex: 1;padding-bottom: ${9/16*100}%;`,m=["div",{style:`display: flex; justify-content: ${n};`},["div",{style:l},["div",{style:c}],["iframe",s]]];return["div",{...this.options.HTMLAttributes,class:"iframe-wrapper","data-video":""},m]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}});exports.RichTextVideo=H;exports.Video=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./clsx-CXbNJWDD.cjs"),k=require("./index-CVFzP1Dc.cjs"),p=require("./useButtonProps-CydzndG1.cjs"),o=require("react/jsx-runtime"),d=require("react"),I=require("./toggle-BYvLnjCL.cjs");require("./index-CX4pNJlH.cjs");require("./theme.cjs");const M=require("./button-Cs9TroWr.cjs"),R=require("./input-BJ7ihMq-.cjs"),u=require("./tabs-DpHSMyF_.cjs"),b=require("./dialog-BS3zm-T9.cjs"),D=require("./events.constant-Dq21NPdV.cjs");function $(e,t){let s;try{s=new URL(e)}catch{return!1}return!(t!=null&&t.length)||t.length===1&&t[0]==="."?!0:t.some(n=>{if(n.includes("*")){const l=n.replace(/\./g,String.raw`\.`).replace(/\*/g,".*");return new RegExp(`^${l}$`).test(s.hostname)}return s.hostname.includes(n)})}function H(){const{t:e}=k.useLocale(),t=p.useEditorInstance(),s=p.useButtonProps(T.name),{icon:n,tooltip:l}=(s==null?void 0:s.componentProps)??{},{editorDisabled:c}=p.useToggleActive(),[f,x]=d.useState(""),w=d.useRef(null),[y,m]=d.useState(""),[V,h]=d.useState(!1),v=p.useExtension(T.name),q=r=>{h(r.detail)};d.useEffect(()=>{const r=D.listenEvent(D.EVENTS.UPLOAD_VIDEO(t.id),q);return()=>{r()}},[t]);const i=d.useMemo(()=>(v==null?void 0:v.options)??{},[v]);async function C(r){var L;const a=(L=r==null?void 0:r.target)==null?void 0:L.files;if(!t||t.isDestroyed||a.length===0)return;const g=a[0];let j="";i.upload?j=await i.upload(g):j=URL.createObjectURL(g),t.chain().focus().setVideo({src:j,width:"100%"}).run(),h(!1)}function S(r){r.preventDefault(),r.stopPropagation(),f&&(t.chain().focus().setVideo({src:f,width:"100%"}).run(),h(!1),x(""))}function A(r){var a;r.preventDefault(),(a=w.current)==null||a.click()}return o.jsxs(b.Dialog,{onOpenChange:h,open:V,children:[o.jsx(b.DialogTrigger,{asChild:!0,children:o.jsx(I.ActionButton,{disabled:c,icon:n,tooltip:l,action:()=>{c||h(!0)}})}),o.jsxs(b.DialogContent,{children:[o.jsx(b.DialogTitle,{children:e("editor.video.dialog.title")}),o.jsxs(u.Tabs,{activationMode:"manual",defaultValue:(i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="upload"?"upload":"link",children:[o.jsxs(u.TabsList,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="upload")&&o.jsx(u.TabsTrigger,{value:"upload",children:e("editor.video.dialog.tab.upload")}),((i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="link")&&o.jsx(u.TabsTrigger,{value:"link",children:e("editor.video.dialog.link")})]}),o.jsxs(u.TabsContent,{value:"upload",children:[o.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:o.jsx(M.Button,{className:"richtext-mt-1 richtext-w-full",onClick:A,size:"sm",children:e("editor.video.dialog.tab.upload")})}),o.jsx("input",{accept:"video/*",multiple:!0,onChange:C,ref:w,type:"file",style:{display:"none"}})]}),o.jsxs(u.TabsContent,{value:"link",children:[o.jsx("div",{children:o.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[o.jsx(R.Input,{autoFocus:!0,placeholder:e("editor.video.dialog.placeholder"),required:!0,type:"url",value:f,onBlur:r=>{const a=r.target.value,g=i.videoProviders||["."];a&&!$(a,g)?m("Invalid video URL"):m("")},onChange:r=>{x(r.target.value)}}),o.jsx(M.Button,{onClick:S,type:"button",children:e("editor.video.dialog.button.apply")})]})}),y&&o.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:y})]})]})]})]})}function B(e){e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/");const t=e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);t&&(e=`https://www.youtube.com/embed/${t[1]}`);const s=e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);if(s){const l=s[1],c=s[2];c?e=`https://player.vimeo.com/video/${l}?h=${c}`:e=`https://player.vimeo.com/video/${l}`}return/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const T=E.Node3.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:k.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper"},button:({editor:e,t})=>{var s,n;return{componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((n=(s=e.can()).setVideo)!=null&&n.call(s,{})),icon:"Video",tooltip:t("editor.video.tooltip"),videoProviders:["."],editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?B(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:p.getCssUnitWithDefault(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},align:{default:"center",renderHTML:({align:e})=>({align:e})}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%",align:s="center"}=e??{},n={...e,width:"100%",height:"100%"},l=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,c=`flex: 1;padding-bottom: ${9/16*100}%;`,m=["div",{style:`display: flex; justify-content: ${s};`},["div",{style:l},["div",{style:c}],["iframe",n]]];return["div",{...this.options.HTMLAttributes,class:"iframe-wrapper","data-video":""},m]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}});exports.RichTextVideo=H;exports.Video=T;
package/lib/Video.js CHANGED
@@ -1,14 +1,16 @@
1
- import { N as I } from "./index-sVScpCFG.js";
2
- import { u as S, V as $ } from "./index-0OnGZkVF.js";
3
- import { c as H, u as N, a as U, d as z, g as B } from "./useButtonProps-cMoicZgd.js";
1
+ import { N as I } from "./clsx-DmuN0U_8.js";
2
+ import { u as S, V as $ } from "./index-BDX1uE62.js";
3
+ import { c as H, u as N, a as U, d as z, f as B } from "./useButtonProps-CfYtuEnd.js";
4
4
  import { jsxs as d, jsx as s } from "react/jsx-runtime";
5
5
  import { useState as y, useRef as R, useEffect as j, useMemo as F } from "react";
6
- import { A as O } from "./index-C3zg3DPB.js";
7
- import { D as Z, a as _, b as q, c as W } from "./dialog-D_HCtKvc.js";
8
- import { l as G, E as J } from "./events.constant-wrlJ_7JZ.js";
9
- import { T as K, a as P, b as D, c as L } from "./tabs-CWr9HYaM.js";
10
- import { B as T } from "./button-RnHbJfd-.js";
11
- import { I as Q } from "./input-CvyMYMZG.js";
6
+ import { A as O } from "./toggle-Bxwwb_Kp.js";
7
+ import "./index-D9JOHlso.js";
8
+ import "./theme.js";
9
+ import { B as D } from "./button-9_8t7ca7.js";
10
+ import { I as Z } from "./input-YoheBL2D.js";
11
+ import { T as _, a as q, b as L, c as T } from "./tabs-DxlKKM-N.js";
12
+ import { D as W, a as G, b as J, c as K } from "./dialog-DhayAPvV.js";
13
+ import { l as P, E as Q } from "./events.constant-do95b767.js";
12
14
  function X(e, t) {
13
15
  let r;
14
16
  try {
@@ -24,7 +26,7 @@ function X(e, t) {
24
26
  return r.hostname.includes(n);
25
27
  });
26
28
  }
27
- function ue() {
29
+ function pe() {
28
30
  const { t: e } = S(), t = H(), r = N(M.name), {
29
31
  icon: n,
30
32
  tooltip: a
@@ -32,7 +34,7 @@ function ue() {
32
34
  u(o.detail);
33
35
  };
34
36
  j(() => {
35
- const o = G(J.UPLOAD_VIDEO(t.id), k);
37
+ const o = P(Q.UPLOAD_VIDEO(t.id), k);
36
38
  return () => {
37
39
  o();
38
40
  };
@@ -61,12 +63,12 @@ function ue() {
61
63
  o.preventDefault(), (l = b.current) == null || l.click();
62
64
  }
63
65
  return /* @__PURE__ */ d(
64
- Z,
66
+ W,
65
67
  {
66
68
  onOpenChange: u,
67
69
  open: x,
68
70
  children: [
69
- /* @__PURE__ */ s(_, { asChild: !0, children: /* @__PURE__ */ s(
71
+ /* @__PURE__ */ s(G, { asChild: !0, children: /* @__PURE__ */ s(
70
72
  O,
71
73
  {
72
74
  disabled: c,
@@ -77,21 +79,21 @@ function ue() {
77
79
  }
78
80
  }
79
81
  ) }),
80
- /* @__PURE__ */ d(q, { children: [
81
- /* @__PURE__ */ s(W, { children: e("editor.video.dialog.title") }),
82
+ /* @__PURE__ */ d(J, { children: [
83
+ /* @__PURE__ */ s(K, { children: e("editor.video.dialog.title") }),
82
84
  /* @__PURE__ */ d(
83
- K,
85
+ _,
84
86
  {
85
87
  activationMode: "manual",
86
88
  defaultValue: (i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "upload" ? "upload" : "link",
87
89
  children: [
88
- /* @__PURE__ */ d(P, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
89
- ((i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "upload") && /* @__PURE__ */ s(D, { value: "upload", children: e("editor.video.dialog.tab.upload") }),
90
- ((i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "link") && /* @__PURE__ */ s(D, { value: "link", children: e("editor.video.dialog.link") })
90
+ /* @__PURE__ */ d(q, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
91
+ ((i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "upload") && /* @__PURE__ */ s(L, { value: "upload", children: e("editor.video.dialog.tab.upload") }),
92
+ ((i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "link") && /* @__PURE__ */ s(L, { value: "link", children: e("editor.video.dialog.link") })
91
93
  ] }),
92
- /* @__PURE__ */ d(L, { value: "upload", children: [
94
+ /* @__PURE__ */ d(T, { value: "upload", children: [
93
95
  /* @__PURE__ */ s("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: /* @__PURE__ */ s(
94
- T,
96
+ D,
95
97
  {
96
98
  className: "richtext-mt-1 richtext-w-full",
97
99
  onClick: E,
@@ -113,10 +115,10 @@ function ue() {
113
115
  }
114
116
  )
115
117
  ] }),
116
- /* @__PURE__ */ d(L, { value: "link", children: [
118
+ /* @__PURE__ */ d(T, { value: "link", children: [
117
119
  /* @__PURE__ */ s("div", { children: /* @__PURE__ */ d("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
118
120
  /* @__PURE__ */ s(
119
- Q,
121
+ Z,
120
122
  {
121
123
  autoFocus: !0,
122
124
  placeholder: e("editor.video.dialog.placeholder"),
@@ -133,7 +135,7 @@ function ue() {
133
135
  }
134
136
  ),
135
137
  /* @__PURE__ */ s(
136
- T,
138
+ D,
137
139
  {
138
140
  onClick: C,
139
141
  type: "button",
@@ -265,6 +267,6 @@ const M = /* @__PURE__ */ I.create({
265
267
  }
266
268
  });
267
269
  export {
268
- ue as RichTextVideo,
270
+ pe as RichTextVideo,
269
271
  M as Video
270
272
  };