reactjs-tiptap-editor 1.0.14 → 1.0.16

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 (186) hide show
  1. package/lib/{ActionMenuButton-DNj0f_A4.cjs → ActionMenuButton-BYu0NyVo.cjs} +1 -1
  2. package/lib/{ActionMenuButton-l5rSmAO_.js → ActionMenuButton-a8LhmHXe.js} +5 -5
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +6 -6
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +4 -4
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +4 -4
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +4 -4
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +36 -40
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +3 -3
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +4 -4
  17. package/lib/CodeBlock.cjs +1 -1
  18. package/lib/CodeBlock.js +6 -6
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +4 -4
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +6 -6
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +4 -4
  25. package/lib/{Drawer-Cbi_MURj.js → Drawer-CbOJ1Igo.js} +8 -8
  26. package/lib/{Drawer-DKU32YW_.cjs → Drawer-DNaDMoAk.cjs} +1 -1
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +3 -3
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +212 -2076
  31. package/lib/{Excalidraw-CWrVL5hs.js → Excalidraw-DnHTVOj8.js} +6 -6
  32. package/lib/{Excalidraw-Kb-TRcWY.cjs → Excalidraw-DxfO1lQ_.cjs} +1 -1
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +2 -2
  35. package/lib/ExportPdf.cjs +1 -1
  36. package/lib/ExportPdf.js +4 -4
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +4 -4
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +6 -6
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +6 -6
  43. package/lib/Heading.cjs +1 -1
  44. package/lib/Heading.js +6 -6
  45. package/lib/Highlight.cjs +1 -1
  46. package/lib/Highlight.js +6 -6
  47. package/lib/History.cjs +1 -1
  48. package/lib/History.js +22 -22
  49. package/lib/HorizontalRule.cjs +1 -1
  50. package/lib/HorizontalRule.js +4 -4
  51. package/lib/{Icon-Ctva8VeB.js → Icon-C0TJMAOm.js} +2 -2
  52. package/lib/{Icon-yqCglrdK.cjs → Icon-DzK0_ztP.cjs} +1 -1
  53. package/lib/{Iframe-BczF8Hex.cjs → Iframe-BSNCsofW.cjs} +1 -1
  54. package/lib/{Iframe-C942bNjs.js → Iframe-CmjbQQcz.js} +6 -6
  55. package/lib/Iframe.cjs +1 -1
  56. package/lib/Iframe.js +2 -2
  57. package/lib/Image-BZEFuS0P.js +925 -0
  58. package/lib/Image-iKsGKjvg.cjs +1 -0
  59. package/lib/Image.cjs +1 -1
  60. package/lib/Image.js +5 -828
  61. package/lib/ImageGif.cjs +1 -1
  62. package/lib/ImageGif.js +9 -9
  63. package/lib/ImportWord.cjs +1 -231
  64. package/lib/ImportWord.js +91 -16623
  65. package/lib/{Indent-C_O5WdyR.js → Indent-BoG-vpIE.js} +4 -4
  66. package/lib/{Indent-CkEC7x36.cjs → Indent-Bou16OcB.cjs} +1 -1
  67. package/lib/Indent.cjs +1 -1
  68. package/lib/Indent.js +2 -2
  69. package/lib/Italic.cjs +1 -1
  70. package/lib/Italic.js +4 -4
  71. package/lib/Katex-BqDocr3a.cjs +4 -0
  72. package/lib/{Katex-D3PEWimM.js → Katex-ByL9snce.js} +369 -347
  73. package/lib/Katex.cjs +1 -1
  74. package/lib/Katex.js +2 -2
  75. package/lib/LineHeight.cjs +1 -1
  76. package/lib/LineHeight.js +7 -7
  77. package/lib/Link.cjs +1 -1
  78. package/lib/Link.js +2 -2
  79. package/lib/{LinkEditBlock-DL1e2ILk.cjs → LinkEditBlock-B0I0EUrt.cjs} +1 -1
  80. package/lib/{LinkEditBlock-h5054QDo.js → LinkEditBlock-Ckih17pU.js} +11 -11
  81. package/lib/Mention.cjs +1 -1
  82. package/lib/Mention.js +41 -63
  83. package/lib/Mermaid.cjs +1 -1
  84. package/lib/Mermaid.js +16 -16
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +7 -7
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +4 -4
  89. package/lib/SearchAndReplace.cjs +1 -1
  90. package/lib/SearchAndReplace.js +11 -11
  91. package/lib/SlashCommand.cjs +1 -1
  92. package/lib/SlashCommand.js +9 -9
  93. package/lib/{SlashCommandNodeView-DXUqkx82.js → SlashCommandNodeView-B2g1MbgN.js} +76 -83
  94. package/lib/SlashCommandNodeView-BEJhEzba.cjs +1 -0
  95. package/lib/Strike.cjs +1 -1
  96. package/lib/Strike.js +4 -4
  97. package/lib/{Table-DdrY4jcM.js → Table-BEwrZVup.js} +22 -22
  98. package/lib/{Table-kY0nbqJo.cjs → Table-BclWwp6P.cjs} +1 -1
  99. package/lib/Table.cjs +1 -1
  100. package/lib/Table.js +1 -1
  101. package/lib/TaskList.cjs +1 -1
  102. package/lib/TaskList.js +4 -4
  103. package/lib/TextAlign.cjs +1 -1
  104. package/lib/TextAlign.js +7 -7
  105. package/lib/TextDirection.cjs +1 -1
  106. package/lib/TextDirection.js +7 -7
  107. package/lib/TextUnderline.cjs +1 -1
  108. package/lib/TextUnderline.js +4 -4
  109. package/lib/{Twitter-B-JQ3ZJ1.js → Twitter-4U_ZBhpv.js} +10 -10
  110. package/lib/{Twitter-DjZcVa3l.cjs → Twitter-Dtq6PEMC.cjs} +1 -1
  111. package/lib/Twitter.cjs +1 -1
  112. package/lib/Twitter.js +2 -2
  113. package/lib/Video.cjs +1 -1
  114. package/lib/Video.js +9 -9
  115. package/lib/bubble.cjs +1 -1
  116. package/lib/bubble.js +27 -27
  117. package/lib/{button-Uv01FNnd.js → button-Bwn6gUuS.js} +2 -2
  118. package/lib/{button-BS3n6_Aq.cjs → button-CqJztfH2.cjs} +1 -1
  119. package/lib/{checkbox-C8ByRi7-.cjs → checkbox-BAzbZY2Y.cjs} +1 -1
  120. package/lib/{checkbox-DEFNwGwb.js → checkbox-B_rpz5Xq.js} +1 -1
  121. package/lib/{clsx-BWSGDJNJ.js → clsx-DSzxBzvL.js} +11 -11
  122. package/lib/{dialog-DwTMZSt6.js → dialog-CJvpoeMm.js} +1 -1
  123. package/lib/{dialog-Bt5zwGYB.cjs → dialog-CWYTvz5J.cjs} +1 -1
  124. package/lib/{dropdown-menu-BetI14G6.js → dropdown-menu-CW3Kthwy.js} +1 -1
  125. package/lib/{dropdown-menu-Bo68IEOT.cjs → dropdown-menu-eUeBXQeA.cjs} +1 -1
  126. package/lib/extensions/Emoji/Emoji.d.ts +3 -1
  127. package/lib/extensions/Emoji/components/EmojiList/EmojiNodeView.d.ts +9 -1
  128. package/lib/{index-CHKWG6E8.js → index-4bHF5ovf.js} +1 -1
  129. package/lib/index-BG0kQamI.js +285 -0
  130. package/lib/{index-Doks9cbR.cjs → index-BsFvo9PG.cjs} +1 -1
  131. package/lib/{index-Dujzr6bY.js → index-C07N8gA1.js} +69 -73
  132. package/lib/{index-CcoWj0mF.js → index-CL7JP-Xz.js} +1 -1
  133. package/lib/index-Cn-t3Zxw.cjs +1 -0
  134. package/lib/{index-mR8PNv5P.js → index-CpTykZBR.js} +1 -1
  135. package/lib/{index-BDKHXe7R.js → index-D8li6EQ4.js} +1 -1
  136. package/lib/{index-DJbmnBzK.js → index-DR5tIdL7.js} +1 -1
  137. package/lib/{index-DF5ZPtWM.js → index-DoiuU6VA.js} +54 -56
  138. package/lib/index-NsYff_Ni.cjs +1 -0
  139. package/lib/index.cjs +2 -2
  140. package/lib/index.js +4 -4
  141. package/lib/{input-DUBdJD3L.js → input-B1egKb-t.js} +1 -1
  142. package/lib/{input-Dt_BA_9B.cjs → input-ZGRt7lWR.cjs} +1 -1
  143. package/lib/{isNumber-CIgubz2e.js → isNumber-ClwLypY2.js} +1 -1
  144. package/lib/{label-topD46-u.js → label-Cjrzc5H2.js} +2 -2
  145. package/lib/{label-JNOksCA-.cjs → label-tzSPdqui.cjs} +1 -1
  146. package/lib/locale-bundle.cjs +1 -1
  147. package/lib/locale-bundle.js +1 -1
  148. package/lib/locales/index.d.ts +5 -1
  149. package/lib/{popover-mL-2sX5r.cjs → popover-C6Cya3Cz.cjs} +1 -1
  150. package/lib/{popover-LfNBhRyz.js → popover-CeY3RbI5.js} +1 -1
  151. package/lib/renderNodeView-CSazLrKF.js +28 -0
  152. package/lib/renderNodeView-DfLmGrgA.cjs +1 -0
  153. package/lib/{select-CwGYPsPq.cjs → select-Doa_-jkZ.cjs} +1 -1
  154. package/lib/{select-DctYuHLH.js → select-F0ZZ3VZB.js} +1 -1
  155. package/lib/{separator-NoH_SLRW.cjs → separator-CUh5Y7Rh.cjs} +1 -1
  156. package/lib/{separator-Ddfrhn4D.js → separator-Cjn4YH8a.js} +5 -5
  157. package/lib/store/commandList.d.ts +1 -1
  158. package/lib/store/store.d.ts +7 -6
  159. package/lib/{store-DNpS8vXA.js → store-BsJz5QRC.js} +1 -1
  160. package/lib/{store-CkjKIgjQ.cjs → store-DjkMIIEN.cjs} +1 -1
  161. package/lib/{tabs-DRSwUeKP.cjs → tabs-BP8ypR_m.cjs} +1 -1
  162. package/lib/{tabs-BT3AeqQQ.js → tabs-CBDjOLl_.js} +1 -1
  163. package/lib/{textarea-BDO6XQoF.cjs → textarea-BAolHF_W.cjs} +1 -1
  164. package/lib/{textarea-DZzMEDfZ.js → textarea-tOsPnxHf.js} +1 -1
  165. package/lib/theme.cjs +1 -1
  166. package/lib/theme.js +21 -27
  167. package/lib/{throttle-IERhwcLa.js → throttle-D040PfWL.js} +1 -1
  168. package/lib/{toggle-BQHMh_Q-.cjs → toggle-C_SSvDRy.cjs} +1 -1
  169. package/lib/{toggle-DKHg5sLm.js → toggle-DEerYRil.js} +4 -4
  170. package/lib/{tooltip-DNKq7zgN.js → tooltip-BJIvosho.js} +1 -1
  171. package/lib/{tooltip-BYtGp6FM.cjs → tooltip-FS1rsvd3.cjs} +1 -1
  172. package/lib/{updatePosition-Bie75EFq.js → updatePosition-CDK7OR0i.js} +2 -2
  173. package/lib/{useButtonProps-DVP4s_ER.js → useButtonProps-CtZCbMQu.js} +5 -5
  174. package/lib/{useButtonProps-DBJkNDS2.cjs → useButtonProps-Cz4W5dC8.cjs} +1 -1
  175. package/lib/utils/renderNodeView.d.ts +6 -0
  176. package/package.json +4 -4
  177. package/lib/Katex-DW_HjgNM.cjs +0 -4
  178. package/lib/SlashCommandNodeView-BqrmHCpu.cjs +0 -1
  179. package/lib/_commonjsHelpers-BItOPCY9.js +0 -28
  180. package/lib/_commonjsHelpers-BTDuMlIz.cjs +0 -1
  181. package/lib/extensions/Emoji/components/EmojiList/emojis.d.ts +0 -4
  182. package/lib/index-D3RLYf-J.cjs +0 -1
  183. package/lib/react-BEoMZB61.cjs +0 -1
  184. package/lib/react-c9FSfB30.js +0 -27
  185. package/lib/use-toast-Bz3QCOtE.cjs +0 -1
  186. package/lib/use-toast-Crf7-q5H.js +0 -98
@@ -1 +1 @@
1
- "use strict";const c=require("react/jsx-runtime");require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const i=require("./index-VhKd73hZ.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;
1
+ "use strict";const c=require("react/jsx-runtime");require("react");require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const i=require("./index-VhKd73hZ.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;
@@ -1 +1 @@
1
- "use strict";const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),b=require("react"),y=require("re-resizable"),h=require("./dom-dataset-BqoJhJXt.cjs"),S=require("./toggle-BQHMh_Q-.cjs"),I=require("./index-D3RLYf-J.cjs");require("./theme.cjs");const g=require("./useButtonProps-DBJkNDS2.cjs"),P=require("./input-Dt_BA_9B.cjs"),R=require("./button-BS3n6_Aq.cjs"),m={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function j(e){const t=m.youtube,i=e.matchedUrl;e.validLink=!0;const r=i.split("="),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}/${c}`,e.validId=!0}return e}function q(e){const t=m.youku,i=e.matchedUrl,r=t.idRule,n=new RegExp(r),c=i.match(n);if(c&&c.length>0){const o=c[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${o}`}else e.validId=!1;return e}function M(e){const t=m.bilibili,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function N(e){const t=m.qqvideo,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function U(e,t){return t.src=e,t.validId=!0,t}function A(e,t){return t.src=e,t.validId=!0,t}function D(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function L(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function _(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function $(e){const t=m.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function T(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function z(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Y(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function C(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function E(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function H(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=m[e].linkRule;for(const c of n){const o=new RegExp(c),a=t.match(o);if(a&&a.length>0)return i.validLink=!0,i.matchedUrl=e==="youtube"?a[1]:a[0],i}return i}function B(e){var i,r;let t="iframe";return((i=e.includes)!=null&&i.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function x(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const i=B(e);if(t=H(i,e,t),!t.validLink)return t;switch(i){case"youtube":return j(t);case"youku":return q(t);case"bilibili":return M(t);case"qqvideo":return N(t);case"amap":return U(e,t);case"baidu_map":return A(e,t);case"googlemaps":return D(e,t);case"modao":return L(t);case"lanhu":return _(t);case"figma":return $(t);case"canva":return T(e,t);case"processon":return z(e,t);case"codepen":return Y(t);case"jinshuju":return C(e,t);case"iframe":return E(e,t);default:return e}}const V="_wrap_5y04w_1",K="_innerWrap_5y04w_15",v={wrap:V,innerWrap:K};function O({editor:e,node:t,updateAttributes:i}){const r=I.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,p]=b.useState("");function l(){if(!a)return;const d=x(a);e.chain().updateAttributes(f.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const k=b.useCallback(d=>{i({width:d.width,height:d.height})},[i]);return s.jsxs(u.NodeViewWrapper,{children:[!n&&s.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-border richtext-p-[10px]",children:[s.jsx(P.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>p(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(R.Button,{className:"richtext-w-[60px]",onClick:l,children:"OK"})]}),n&&s.jsx(y.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,J,W,w)=>{k({width:Number.parseInt(c)+w.width,height:Number.parseInt(o)+w.height})},children:s.jsx("div",{className:u.clsx(v.wrap,"render-wrapper"),children:s.jsx("div",{className:v.innerWrap,style:{pointerEvents:r?"none":"auto"},children:s.jsx("iframe",{className:"richtext-my-[12px] ",src:n})})})})]})}function X(){const e=g.useButtonProps(f.name),{icon:t=void 0,tooltip:i=void 0,shortcutKeys:r=void 0,tooltipOptions:n={},action:c=void 0,isActive:o=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:p}=g.useToggleActive(o),l=()=>{a||c&&(c(),p())};return e?s.jsx(S.ActionButton,{action:l,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const f=u.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({componentProps:{action:n=>t.commands.setIframe(n),upload:i.options.upload,icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:h.getDatasetAttribute("width")},height:{default:300,parseHTML:h.getDatasetAttribute("height")},src:{default:null,parseHTML:h.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",u.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var c,o,a;if(((a=(o=(c=t.selection)==null?void 0:c.node)==null?void 0:o.type)==null?void 0:a.name)==this.name)return i.updateAttributes(this.name,e);const n=e||{url:""};return r().insertContent({type:this.name,attrs:n}).run()}}},addInputRules(){return[u.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return u.ReactNodeViewRenderer(O)}});exports.Iframe=f;exports.RichTextIframe=X;exports.getServiceSrc=x;
1
+ "use strict";const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),b=require("react"),y=require("re-resizable"),h=require("./dom-dataset-BqoJhJXt.cjs"),S=require("./toggle-C_SSvDRy.cjs"),I=require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const g=require("./useButtonProps-Cz4W5dC8.cjs"),P=require("./input-ZGRt7lWR.cjs"),R=require("./button-CqJztfH2.cjs"),m={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function j(e){const t=m.youtube,i=e.matchedUrl;e.validLink=!0;const r=i.split("="),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}/${c}`,e.validId=!0}return e}function q(e){const t=m.youku,i=e.matchedUrl,r=t.idRule,n=new RegExp(r),c=i.match(n);if(c&&c.length>0){const o=c[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${o}`}else e.validId=!1;return e}function M(e){const t=m.bilibili,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function N(e){const t=m.qqvideo,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function U(e,t){return t.src=e,t.validId=!0,t}function A(e,t){return t.src=e,t.validId=!0,t}function D(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function L(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function _(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function $(e){const t=m.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function T(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function z(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Y(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function C(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function E(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function H(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=m[e].linkRule;for(const c of n){const o=new RegExp(c),a=t.match(o);if(a&&a.length>0)return i.validLink=!0,i.matchedUrl=e==="youtube"?a[1]:a[0],i}return i}function B(e){var i,r;let t="iframe";return((i=e.includes)!=null&&i.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function x(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const i=B(e);if(t=H(i,e,t),!t.validLink)return t;switch(i){case"youtube":return j(t);case"youku":return q(t);case"bilibili":return M(t);case"qqvideo":return N(t);case"amap":return U(e,t);case"baidu_map":return A(e,t);case"googlemaps":return D(e,t);case"modao":return L(t);case"lanhu":return _(t);case"figma":return $(t);case"canva":return T(e,t);case"processon":return z(e,t);case"codepen":return Y(t);case"jinshuju":return C(e,t);case"iframe":return E(e,t);default:return e}}const V="_wrap_5y04w_1",K="_innerWrap_5y04w_15",v={wrap:V,innerWrap:K};function O({editor:e,node:t,updateAttributes:i}){const r=I.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,p]=b.useState("");function l(){if(!a)return;const d=x(a);e.chain().updateAttributes(f.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const k=b.useCallback(d=>{i({width:d.width,height:d.height})},[i]);return s.jsxs(u.NodeViewWrapper,{children:[!n&&s.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-border richtext-p-[10px]",children:[s.jsx(P.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>p(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(R.Button,{className:"richtext-w-[60px]",onClick:l,children:"OK"})]}),n&&s.jsx(y.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,J,W,w)=>{k({width:Number.parseInt(c)+w.width,height:Number.parseInt(o)+w.height})},children:s.jsx("div",{className:u.clsx(v.wrap,"render-wrapper"),children:s.jsx("div",{className:v.innerWrap,style:{pointerEvents:r?"none":"auto"},children:s.jsx("iframe",{className:"richtext-my-[12px] ",src:n})})})})]})}function X(){const e=g.useButtonProps(f.name),{icon:t=void 0,tooltip:i=void 0,shortcutKeys:r=void 0,tooltipOptions:n={},action:c=void 0,isActive:o=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:p}=g.useToggleActive(o),l=()=>{a||c&&(c(),p())};return e?s.jsx(S.ActionButton,{action:l,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const f=u.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({componentProps:{action:n=>t.commands.setIframe(n),upload:i.options.upload,icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:h.getDatasetAttribute("width")},height:{default:300,parseHTML:h.getDatasetAttribute("height")},src:{default:null,parseHTML:h.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",u.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var c,o,a;if(((a=(o=(c=t.selection)==null?void 0:c.node)==null?void 0:o.type)==null?void 0:a.name)==this.name)return i.updateAttributes(this.name,e);const n=e||{url:""};return r().insertContent({type:this.name,attrs:n}).run()}}},addInputRules(){return[u.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return u.ReactNodeViewRenderer(O)}});exports.Iframe=f;exports.RichTextIframe=X;exports.getServiceSrc=x;
@@ -1,14 +1,14 @@
1
- import { h as v, j as x, N as k, k as y, n as S, m as I } from "./clsx-BWSGDJNJ.js";
1
+ import { h as v, j as x, N as k, k as y, n as S, m as I } from "./clsx-DSzxBzvL.js";
2
2
  import { jsxs as f, jsx as d, Fragment as P } from "react/jsx-runtime";
3
3
  import { useState as M, useCallback as R } from "react";
4
4
  import { Resizable as N } from "re-resizable";
5
5
  import { g as l } from "./dom-dataset-CIEeltF6.js";
6
- import { A as j } from "./toggle-DKHg5sLm.js";
7
- import { a as U } from "./index-DF5ZPtWM.js";
6
+ import { A as j } from "./toggle-DEerYRil.js";
7
+ import { a as U } from "./index-DoiuU6VA.js";
8
8
  import "./theme.js";
9
- import { u as q, a as A } from "./useButtonProps-DVP4s_ER.js";
10
- import { I as L } from "./input-DUBdJD3L.js";
11
- import { B as D } from "./button-Uv01FNnd.js";
9
+ import { u as q, a as A } from "./useButtonProps-CtZCbMQu.js";
10
+ import { I as L } from "./input-B1egKb-t.js";
11
+ import { B as D } from "./button-Bwn6gUuS.js";
12
12
  const m = {
13
13
  youtube: {
14
14
  example: "https://www.youtube.com/watch?v=I4sMhHbHYXM",
package/lib/Iframe.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Iframe-BczF8Hex.cjs");require("./dom-dataset-BqoJhJXt.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Iframe-BSNCsofW.cjs");require("./dom-dataset-BqoJhJXt.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
package/lib/Iframe.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./clsx-BWSGDJNJ.js";
2
- import { I as o, R as t } from "./Iframe-C942bNjs.js";
1
+ import "./clsx-DSzxBzvL.js";
2
+ import { I as o, R as t } from "./Iframe-CmjbQQcz.js";
3
3
  import "./dom-dataset-CIEeltF6.js";
4
4
  export {
5
5
  o as Iframe,