@remarkablejames/editor 0.0.1

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 (456) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/lib/ActionMenuButton-B0EHT9CC.js +35 -0
  4. package/lib/ActionMenuButton-J1el_e6Z.cjs +1 -0
  5. package/lib/Attachment.cjs +19 -0
  6. package/lib/Attachment.js +273 -0
  7. package/lib/Blockquote.cjs +5 -0
  8. package/lib/Blockquote.js +107 -0
  9. package/lib/Bold.cjs +1 -0
  10. package/lib/Bold.js +123 -0
  11. package/lib/BulletList.cjs +1 -0
  12. package/lib/BulletList.js +53 -0
  13. package/lib/Callout.cjs +1 -0
  14. package/lib/Callout.js +225 -0
  15. package/lib/Clear.cjs +1 -0
  16. package/lib/Clear.js +49 -0
  17. package/lib/Code.cjs +1 -0
  18. package/lib/Code.js +100 -0
  19. package/lib/CodeBlock.cjs +44 -0
  20. package/lib/CodeBlock.js +4065 -0
  21. package/lib/CodeView.cjs +1 -0
  22. package/lib/CodeView.js +81 -0
  23. package/lib/Color.cjs +1 -0
  24. package/lib/Color.js +134 -0
  25. package/lib/Column.cjs +1 -0
  26. package/lib/Column.js +230 -0
  27. package/lib/Drawer-BCWVN-4l.js +1125 -0
  28. package/lib/Drawer-BTouEroZ.cjs +2 -0
  29. package/lib/Drawer.cjs +1 -0
  30. package/lib/Drawer.js +7 -0
  31. package/lib/Emoji.cjs +1 -0
  32. package/lib/Emoji.js +19888 -0
  33. package/lib/Excalidraw.cjs +1 -0
  34. package/lib/Excalidraw.js +276 -0
  35. package/lib/ExportPdf.cjs +39 -0
  36. package/lib/ExportPdf.js +142 -0
  37. package/lib/ExportWord.cjs +1 -0
  38. package/lib/ExportWord.js +107 -0
  39. package/lib/FontFamily.cjs +1 -0
  40. package/lib/FontFamily.js +84 -0
  41. package/lib/FontSize.cjs +1 -0
  42. package/lib/FontSize.js +106 -0
  43. package/lib/Heading.cjs +1 -0
  44. package/lib/Heading.js +167 -0
  45. package/lib/Highlight.cjs +1 -0
  46. package/lib/Highlight.js +203 -0
  47. package/lib/History.cjs +1 -0
  48. package/lib/History.js +990 -0
  49. package/lib/HorizontalRule.cjs +1 -0
  50. package/lib/HorizontalRule.js +118 -0
  51. package/lib/Iframe-BdgiWGml.js +416 -0
  52. package/lib/Iframe-BfBLILDA.cjs +1 -0
  53. package/lib/Iframe.cjs +1 -0
  54. package/lib/Iframe.js +7 -0
  55. package/lib/Image.cjs +1 -0
  56. package/lib/Image.js +6 -0
  57. package/lib/ImageGif.cjs +1 -0
  58. package/lib/ImageGif.js +400 -0
  59. package/lib/ImportWord.cjs +1 -0
  60. package/lib/ImportWord.js +145 -0
  61. package/lib/Indent-BpMcZKok.js +148 -0
  62. package/lib/Indent-Dvqz_WEn.cjs +1 -0
  63. package/lib/Indent.cjs +1 -0
  64. package/lib/Indent.js +6 -0
  65. package/lib/Italic.cjs +1 -0
  66. package/lib/Italic.js +123 -0
  67. package/lib/Katex-B8_uprkO.js +2753 -0
  68. package/lib/Katex-BQyeCeQ0.cjs +4 -0
  69. package/lib/Katex.cjs +1 -0
  70. package/lib/Katex.js +6 -0
  71. package/lib/LineHeight.cjs +1 -0
  72. package/lib/LineHeight.js +89 -0
  73. package/lib/Link.cjs +1 -0
  74. package/lib/Link.js +6 -0
  75. package/lib/LinkEditBlock-BX0fXXpF.js +1185 -0
  76. package/lib/LinkEditBlock-CIshn_8F.cjs +5 -0
  77. package/lib/Mention.cjs +1 -0
  78. package/lib/Mention.js +265 -0
  79. package/lib/Mermaid-0GiGVxn0.cjs +2 -0
  80. package/lib/Mermaid-D8bbIgAl.js +381 -0
  81. package/lib/Mermaid.cjs +1 -0
  82. package/lib/Mermaid.js +7 -0
  83. package/lib/MoreMark.cjs +1 -0
  84. package/lib/MoreMark.js +157 -0
  85. package/lib/OrderedList.cjs +1 -0
  86. package/lib/OrderedList.js +52 -0
  87. package/lib/SearchAndReplace.cjs +1 -0
  88. package/lib/SearchAndReplace.js +305 -0
  89. package/lib/SlashCommand.cjs +1 -0
  90. package/lib/SlashCommand.js +90 -0
  91. package/lib/SlashCommandNodeView-BcmtKbEE.js +249 -0
  92. package/lib/SlashCommandNodeView-rDJ7OjRd.cjs +1 -0
  93. package/lib/Strike.cjs +1 -0
  94. package/lib/Strike.js +112 -0
  95. package/lib/Table-BEhNBeuA.cjs +5 -0
  96. package/lib/Table-DbxuP5xh.js +1939 -0
  97. package/lib/Table.cjs +1 -0
  98. package/lib/Table.js +5 -0
  99. package/lib/TaskList.cjs +1 -0
  100. package/lib/TaskList.js +63 -0
  101. package/lib/TextAlign.cjs +1 -0
  102. package/lib/TextAlign.js +165 -0
  103. package/lib/TextDirection.cjs +1 -0
  104. package/lib/TextDirection.js +110 -0
  105. package/lib/TextUnderline.cjs +1 -0
  106. package/lib/TextUnderline.js +115 -0
  107. package/lib/Twitter-9I6BLNmg.js +1666 -0
  108. package/lib/Twitter-BuEBgpi9.cjs +1 -0
  109. package/lib/Twitter.cjs +1 -0
  110. package/lib/Twitter.js +6 -0
  111. package/lib/Video.cjs +1 -0
  112. package/lib/Video.js +7 -0
  113. package/lib/bubble.cjs +3 -0
  114. package/lib/bubble.d.ts +1 -0
  115. package/lib/bubble.js +9533 -0
  116. package/lib/clsx-CDyrfCnw.js +7391 -0
  117. package/lib/clsx-CXbNJWDD.cjs +54 -0
  118. package/lib/components/ActionButton.d.ts +23 -0
  119. package/lib/components/ActionMenuButton.d.ts +28 -0
  120. package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -0
  121. package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -0
  122. package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -0
  123. package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -0
  124. package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -0
  125. package/lib/components/Bubble/RichTextBubbleKatex.d.ts +1 -0
  126. package/lib/components/Bubble/RichTextBubbleLink.d.ts +6 -0
  127. package/lib/components/Bubble/RichTextBubbleMedia.d.ts +4 -0
  128. package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +1 -0
  129. package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -0
  130. package/lib/components/Bubble/RichTextBubbleTable.d.ts +5 -0
  131. package/lib/components/Bubble/RichTextBubbleText.d.ts +5 -0
  132. package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -0
  133. package/lib/components/Bubble/formatBubble.d.ts +55 -0
  134. package/lib/components/Bubble/index.d.ts +13 -0
  135. package/lib/components/ColorPicker.d.ts +11 -0
  136. package/lib/components/ReactBus.d.ts +11 -0
  137. package/lib/components/RichTextProvider.d.ts +8 -0
  138. package/lib/components/SizeSetter/SizeSetter.d.ts +13 -0
  139. package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -0
  140. package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -0
  141. package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +5 -0
  142. package/lib/components/icons/Activity.d.ts +2 -0
  143. package/lib/components/icons/Animas.d.ts +2 -0
  144. package/lib/components/icons/AspectRatio.d.ts +2 -0
  145. package/lib/components/icons/Blockquote.d.ts +2 -0
  146. package/lib/components/icons/CodeView.d.ts +1 -0
  147. package/lib/components/icons/ColumnAddLeft.d.ts +1 -0
  148. package/lib/components/icons/ColumnAddRight.d.ts +1 -0
  149. package/lib/components/icons/DeleteColumn.d.ts +2 -0
  150. package/lib/components/icons/DeleteRow.d.ts +2 -0
  151. package/lib/components/icons/Direction.d.ts +1 -0
  152. package/lib/components/icons/Excalidraw.d.ts +1 -0
  153. package/lib/components/icons/ExportPdf.d.ts +1 -0
  154. package/lib/components/icons/ExportWord.d.ts +2 -0
  155. package/lib/components/icons/FileWordOutline.d.ts +2 -0
  156. package/lib/components/icons/Flag.d.ts +2 -0
  157. package/lib/components/icons/Food.d.ts +2 -0
  158. package/lib/components/icons/GIfIcon.d.ts +1 -0
  159. package/lib/components/icons/Html.d.ts +1 -0
  160. package/lib/components/icons/Icon.d.ts +8 -0
  161. package/lib/components/icons/IconColorFill.d.ts +5 -0
  162. package/lib/components/icons/IconHighlightFill.d.ts +3 -0
  163. package/lib/components/icons/ImportWord.d.ts +2 -0
  164. package/lib/components/icons/LeftToRight.d.ts +1 -0
  165. package/lib/components/icons/LineHeight.d.ts +2 -0
  166. package/lib/components/icons/MenuDown.d.ts +2 -0
  167. package/lib/components/icons/Mermaid.d.ts +1 -0
  168. package/lib/components/icons/NoFill.d.ts +1 -0
  169. package/lib/components/icons/Object.d.ts +2 -0
  170. package/lib/components/icons/RightToLeft.d.ts +1 -0
  171. package/lib/components/icons/SizeL.d.ts +2 -0
  172. package/lib/components/icons/SizeM.d.ts +2 -0
  173. package/lib/components/icons/SizeS.d.ts +2 -0
  174. package/lib/components/icons/Symbol.d.ts +2 -0
  175. package/lib/components/icons/Travel.d.ts +2 -0
  176. package/lib/components/icons/Twitter.d.ts +1 -0
  177. package/lib/components/icons/icons.d.ts +1 -0
  178. package/lib/components/icons/index.d.ts +12 -0
  179. package/lib/components/index.d.ts +6 -0
  180. package/lib/components/ui/button.d.ts +11 -0
  181. package/lib/components/ui/checkbox.d.ts +4 -0
  182. package/lib/components/ui/dialog.d.ts +19 -0
  183. package/lib/components/ui/dropdown-menu.d.ts +27 -0
  184. package/lib/components/ui/emoji-picker.d.ts +7 -0
  185. package/lib/components/ui/index.d.ts +15 -0
  186. package/lib/components/ui/input.d.ts +5 -0
  187. package/lib/components/ui/label.d.ts +5 -0
  188. package/lib/components/ui/popover.d.ts +6 -0
  189. package/lib/components/ui/select.d.ts +13 -0
  190. package/lib/components/ui/separator.d.ts +4 -0
  191. package/lib/components/ui/switch.d.ts +4 -0
  192. package/lib/components/ui/tabs.d.ts +7 -0
  193. package/lib/components/ui/textarea.d.ts +5 -0
  194. package/lib/components/ui/toast.d.ts +15 -0
  195. package/lib/components/ui/toaster.d.ts +1 -0
  196. package/lib/components/ui/toggle.d.ts +12 -0
  197. package/lib/components/ui/tooltip.d.ts +7 -0
  198. package/lib/components/ui/use-toast.d.ts +44 -0
  199. package/lib/constants/index.d.ts +47 -0
  200. package/lib/constants/resetCSS.d.ts +1 -0
  201. package/lib/delete-node-CosiBes5.cjs +1 -0
  202. package/lib/delete-node-eQHsyyhR.js +24 -0
  203. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  204. package/lib/dom-dataset-CIEeltF6.js +47 -0
  205. package/lib/dropdown-menu-Bs69ZBbO.js +143 -0
  206. package/lib/dropdown-menu-DjWlG2-J.cjs +1 -0
  207. package/lib/extensions/Attachment/Attachment.d.ts +15 -0
  208. package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -0
  209. package/lib/extensions/Attachment/components/NodeViewAttachment/FileIconString.d.ts +1 -0
  210. package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -0
  211. package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -0
  212. package/lib/extensions/Attachment/index.d.ts +1 -0
  213. package/lib/extensions/Blockquote/Blockquote.d.ts +6 -0
  214. package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -0
  215. package/lib/extensions/Blockquote/index.d.ts +1 -0
  216. package/lib/extensions/Bold/Bold.d.ts +6 -0
  217. package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -0
  218. package/lib/extensions/Bold/index.d.ts +1 -0
  219. package/lib/extensions/BulletList/BulletList.d.ts +6 -0
  220. package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -0
  221. package/lib/extensions/BulletList/index.d.ts +1 -0
  222. package/lib/extensions/Callout/Callout.d.ts +18 -0
  223. package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -0
  224. package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -0
  225. package/lib/extensions/Callout/index.d.ts +1 -0
  226. package/lib/extensions/Clear/Clear.d.ts +6 -0
  227. package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -0
  228. package/lib/extensions/Clear/index.d.ts +1 -0
  229. package/lib/extensions/Code/Code.d.ts +6 -0
  230. package/lib/extensions/Code/components/RichTextCode.d.ts +1 -0
  231. package/lib/extensions/Code/index.d.ts +1 -0
  232. package/lib/extensions/CodeBlock/CodeBlock.d.ts +21 -0
  233. package/lib/extensions/CodeBlock/components/NodeViewCodeBlock/NodeViewCodeBlock.d.ts +1 -0
  234. package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +1 -0
  235. package/lib/extensions/CodeBlock/index.d.ts +1 -0
  236. package/lib/extensions/CodeView/CodeView.d.ts +17 -0
  237. package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -0
  238. package/lib/extensions/CodeView/index.d.ts +1 -0
  239. package/lib/extensions/Color/Color.d.ts +22 -0
  240. package/lib/extensions/Color/components/RichTextColor.d.ts +1 -0
  241. package/lib/extensions/Color/index.d.ts +1 -0
  242. package/lib/extensions/Column/Column.d.ts +17 -0
  243. package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -0
  244. package/lib/extensions/Column/index.d.ts +1 -0
  245. package/lib/extensions/Drawer/Drawer.d.ts +15 -0
  246. package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -0
  247. package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +28 -0
  248. package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -0
  249. package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +1 -0
  250. package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -0
  251. package/lib/extensions/Drawer/index.d.ts +1 -0
  252. package/lib/extensions/Emoji/Emoji.d.ts +5 -0
  253. package/lib/extensions/Emoji/components/EmojiList/EmojiNodeView.d.ts +11 -0
  254. package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +1 -0
  255. package/lib/extensions/Emoji/index.d.ts +1 -0
  256. package/lib/extensions/Excalidraw/Excalidraw.d.ts +17 -0
  257. package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -0
  258. package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -0
  259. package/lib/extensions/Excalidraw/index.d.ts +1 -0
  260. package/lib/extensions/ExportPdf/ExportPdf.d.ts +21 -0
  261. package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -0
  262. package/lib/extensions/ExportPdf/index.d.ts +1 -0
  263. package/lib/extensions/ExportWord/ExportWord.d.ts +13 -0
  264. package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -0
  265. package/lib/extensions/ExportWord/index.d.ts +1 -0
  266. package/lib/extensions/FontFamily/FontFamily.d.ts +10 -0
  267. package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +15 -0
  268. package/lib/extensions/FontFamily/index.d.ts +1 -0
  269. package/lib/extensions/FontSize/FontSize.d.ts +32 -0
  270. package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +12 -0
  271. package/lib/extensions/FontSize/index.d.ts +1 -0
  272. package/lib/extensions/Heading/Heading.d.ts +6 -0
  273. package/lib/extensions/Heading/components/RichTextHeading.d.ts +15 -0
  274. package/lib/extensions/Heading/index.d.ts +1 -0
  275. package/lib/extensions/Highlight/Highlight.d.ts +18 -0
  276. package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +1 -0
  277. package/lib/extensions/Highlight/index.d.ts +1 -0
  278. package/lib/extensions/History/History.d.ts +6 -0
  279. package/lib/extensions/History/components/RichTextHistory.d.ts +2 -0
  280. package/lib/extensions/History/index.d.ts +1 -0
  281. package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +6 -0
  282. package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -0
  283. package/lib/extensions/HorizontalRule/index.d.ts +1 -0
  284. package/lib/extensions/Iframe/Iframe.d.ts +16 -0
  285. package/lib/extensions/Iframe/components/IframeNodeView.d.ts +2 -0
  286. package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -0
  287. package/lib/extensions/Iframe/index.d.ts +1 -0
  288. package/lib/extensions/Iframe/utils.d.ts +9 -0
  289. package/lib/extensions/Image/Image.d.ts +64 -0
  290. package/lib/extensions/Image/components/ImageCropper.d.ts +1 -0
  291. package/lib/extensions/Image/components/ImageView.d.ts +2 -0
  292. package/lib/extensions/Image/components/RichTextImage.d.ts +1 -0
  293. package/lib/extensions/Image/index.d.ts +1 -0
  294. package/lib/extensions/ImageGif/ImageGif.d.ts +39 -0
  295. package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -0
  296. package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +1 -0
  297. package/lib/extensions/ImageGif/components/services.d.ts +458 -0
  298. package/lib/extensions/ImageGif/index.d.ts +1 -0
  299. package/lib/extensions/ImportWord/ImportWord.d.ts +18 -0
  300. package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -0
  301. package/lib/extensions/ImportWord/index.d.ts +1 -0
  302. package/lib/extensions/Indent/Indent.d.ts +23 -0
  303. package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -0
  304. package/lib/extensions/Indent/index.d.ts +1 -0
  305. package/lib/extensions/Italic/Italic.d.ts +6 -0
  306. package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -0
  307. package/lib/extensions/Italic/index.d.ts +1 -0
  308. package/lib/extensions/Katex/Katex.d.ts +17 -0
  309. package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -0
  310. package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -0
  311. package/lib/extensions/Katex/index.d.ts +1 -0
  312. package/lib/extensions/LineHeight/LineHeight.d.ts +7 -0
  313. package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -0
  314. package/lib/extensions/LineHeight/index.d.ts +1 -0
  315. package/lib/extensions/Link/Link.d.ts +6 -0
  316. package/lib/extensions/Link/components/LinkEditBlock.d.ts +9 -0
  317. package/lib/extensions/Link/components/LinkViewBlock.d.ts +8 -0
  318. package/lib/extensions/Link/components/RichTextLink.d.ts +1 -0
  319. package/lib/extensions/Link/index.d.ts +1 -0
  320. package/lib/extensions/Mention/Mention.d.ts +3 -0
  321. package/lib/extensions/Mention/components/NodeViewMentionList.d.ts +16 -0
  322. package/lib/extensions/Mention/index.d.ts +1 -0
  323. package/lib/extensions/Mermaid/Mermaid.d.ts +27 -0
  324. package/lib/extensions/Mermaid/components/EditMermaidBlock.d.ts +9 -0
  325. package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +9 -0
  326. package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -0
  327. package/lib/extensions/Mermaid/index.d.ts +1 -0
  328. package/lib/extensions/MoreMark/MoreMark.d.ts +20 -0
  329. package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +14 -0
  330. package/lib/extensions/MoreMark/index.d.ts +1 -0
  331. package/lib/extensions/OrderedList/OrderedList.d.ts +6 -0
  332. package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -0
  333. package/lib/extensions/OrderedList/index.d.ts +1 -0
  334. package/lib/extensions/SearchAndReplace/SearchAndReplace.d.ts +36 -0
  335. package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -0
  336. package/lib/extensions/SearchAndReplace/index.d.ts +1 -0
  337. package/lib/extensions/SlashCommand/SlashCommand.d.ts +4 -0
  338. package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +6 -0
  339. package/lib/extensions/SlashCommand/components/SlashCommandNodeView.d.ts +3 -0
  340. package/lib/extensions/SlashCommand/index.d.ts +1 -0
  341. package/lib/extensions/SlashCommand/renderCommandListDefault.d.ts +7 -0
  342. package/lib/extensions/SlashCommand/types.d.ts +20 -0
  343. package/lib/extensions/Strike/Strike.d.ts +6 -0
  344. package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -0
  345. package/lib/extensions/Strike/index.d.ts +1 -0
  346. package/lib/extensions/Table/Table.d.ts +21 -0
  347. package/lib/extensions/Table/TableCellBackground.d.ts +14 -0
  348. package/lib/extensions/Table/components/CreateTablePopover.d.ts +7 -0
  349. package/lib/extensions/Table/components/RichTextTable.d.ts +1 -0
  350. package/lib/extensions/Table/index.d.ts +1 -0
  351. package/lib/extensions/TaskList/TaskList.d.ts +11 -0
  352. package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -0
  353. package/lib/extensions/TaskList/index.d.ts +1 -0
  354. package/lib/extensions/TextAlign/TextAlign.d.ts +17 -0
  355. package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +14 -0
  356. package/lib/extensions/TextAlign/index.d.ts +1 -0
  357. package/lib/extensions/TextDirection/TextDirection.d.ts +5 -0
  358. package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +15 -0
  359. package/lib/extensions/TextDirection/index.d.ts +1 -0
  360. package/lib/extensions/TextUnderline/TextUnderline.d.ts +6 -0
  361. package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -0
  362. package/lib/extensions/TextUnderline/index.d.ts +1 -0
  363. package/lib/extensions/Twitter/Twitter.d.ts +46 -0
  364. package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +6 -0
  365. package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +8 -0
  366. package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -0
  367. package/lib/extensions/Twitter/index.d.ts +1 -0
  368. package/lib/extensions/Video/Video.d.ts +66 -0
  369. package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -0
  370. package/lib/extensions/Video/index.d.ts +1 -0
  371. package/lib/hooks/useActive.d.ts +21 -0
  372. package/lib/hooks/useAttributes.d.ts +2 -0
  373. package/lib/hooks/useButtonProps.d.ts +1 -0
  374. package/lib/hooks/useCopy.d.ts +5 -0
  375. package/lib/hooks/useExtension.d.ts +1 -0
  376. package/lib/hooks/useLocalStorage.d.ts +13 -0
  377. package/lib/index-4Q5IhypJ.js +1349 -0
  378. package/lib/index-BCzvbrf5.cjs +12 -0
  379. package/lib/index-BG0kQamI.js +285 -0
  380. package/lib/index-C-tDsIKJ.js +1631 -0
  381. package/lib/index-C1WCZhyA.js +237 -0
  382. package/lib/index-CjhjjJsN.cjs +1 -0
  383. package/lib/index-Cs6cp0Y6.cjs +1 -0
  384. package/lib/index-CsSfYR30.js +1351 -0
  385. package/lib/index-D9oM__YW.cjs +1 -0
  386. package/lib/index-DjDf4BK8.js +707 -0
  387. package/lib/index-NsYff_Ni.cjs +1 -0
  388. package/lib/index-bVGIXhRg.cjs +1 -0
  389. package/lib/index-lj3VWExo.js +4883 -0
  390. package/lib/index-neeeY2o7.cjs +4 -0
  391. package/lib/index.cjs +115 -0
  392. package/lib/index.d.ts +2 -0
  393. package/lib/index.js +338 -0
  394. package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
  395. package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
  396. package/lib/lib/utils.d.ts +2 -0
  397. package/lib/locale-bundle.cjs +1 -0
  398. package/lib/locale-bundle.d.ts +1 -0
  399. package/lib/locale-bundle.js +11 -0
  400. package/lib/locales/en.d.ts +196 -0
  401. package/lib/locales/fi.d.ts +196 -0
  402. package/lib/locales/hu.d.ts +196 -0
  403. package/lib/locales/index.d.ts +1198 -0
  404. package/lib/locales/pt-br.d.ts +196 -0
  405. package/lib/locales/vi.d.ts +196 -0
  406. package/lib/locales/zh-cn.d.ts +196 -0
  407. package/lib/plugins/image-upload.d.ts +13 -0
  408. package/lib/popover-CPr9bHYn.js +24 -0
  409. package/lib/popover-D-hUKDYu.cjs +1 -0
  410. package/lib/renderNodeView-BJSrgyGj.js +28 -0
  411. package/lib/renderNodeView-DfLmGrgA.cjs +1 -0
  412. package/lib/select-C2KF4RNg.cjs +1 -0
  413. package/lib/select-CuE_HaQJ.js +120 -0
  414. package/lib/separator-CHzYNMVt.js +293 -0
  415. package/lib/separator-_gvUNba_.cjs +1 -0
  416. package/lib/store/EditorEditableReactive.d.ts +1 -0
  417. package/lib/store/ThemeColorReactive.d.ts +1 -0
  418. package/lib/store/commandList.d.ts +2 -0
  419. package/lib/store/editor.d.ts +21 -0
  420. package/lib/store/store.d.ts +3 -0
  421. package/lib/style.css +1 -0
  422. package/lib/textarea-DZj6EY-N.cjs +1 -0
  423. package/lib/textarea-gEoNp9CA.js +20 -0
  424. package/lib/theme/theme.d.ts +369 -0
  425. package/lib/theme.cjs +1 -0
  426. package/lib/theme.js +395 -0
  427. package/lib/types.d.ts +230 -0
  428. package/lib/updatePosition-Cjuj2E26.cjs +1 -0
  429. package/lib/updatePosition-e90ZrFWW.js +16 -0
  430. package/lib/utils/base64.d.ts +2 -0
  431. package/lib/utils/checkIsVideoUrl.d.ts +1 -0
  432. package/lib/utils/color.d.ts +7 -0
  433. package/lib/utils/columns.d.ts +14 -0
  434. package/lib/utils/customEvents/events.constant.d.ts +6 -0
  435. package/lib/utils/delete-node.d.ts +2 -0
  436. package/lib/utils/dom-dataset.d.ts +28 -0
  437. package/lib/utils/download.d.ts +1 -0
  438. package/lib/utils/dynamicCSS.d.ts +25 -0
  439. package/lib/utils/editor-container-size.d.ts +4 -0
  440. package/lib/utils/file.d.ts +30 -0
  441. package/lib/utils/getRenderContainer.d.ts +3 -0
  442. package/lib/utils/indent.d.ts +14 -0
  443. package/lib/utils/is-mobile.d.ts +19 -0
  444. package/lib/utils/json.d.ts +2 -0
  445. package/lib/utils/lru-cache.d.ts +31 -0
  446. package/lib/utils/mitt.d.ts +24 -0
  447. package/lib/utils/node.d.ts +15 -0
  448. package/lib/utils/pdf.d.ts +3 -0
  449. package/lib/utils/plateform.d.ts +11 -0
  450. package/lib/utils/renderNodeView.d.ts +6 -0
  451. package/lib/utils/shortId.d.ts +1 -0
  452. package/lib/utils/storage.d.ts +2 -0
  453. package/lib/utils/updatePosition.d.ts +1 -0
  454. package/lib/utils/utils.d.ts +20 -0
  455. package/lib/utils/validateFile.d.ts +16 -0
  456. package/package.json +845 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),l=require("@tiptap/pm/state"),p=require("./index-D9oM__YW.cjs"),m=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=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:h})=>{if(h){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,T=d==null?void 0:d.create();T&&(e.insert(u,T),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 A(){const t=p.useButtonProps(f.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:h,disabled:o,update:u}=p.useToggleActive(e),d=()=>{o||a&&(a(),u())};return t?m.jsx(p.ActionButton,{action:d,dataState:h,disabled:o,icon:n,shortcutKeys:s,tooltip:r,tooltipOptions:c}):m.jsx(m.Fragment,{})}const f=y.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:n,t:r,extension:s})=>({component:p.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=f;exports.RichTextHorizontalRule=A;
@@ -0,0 +1,118 @@
1
+ import { N as T, n as A, o as y, q as H, m as h } from "./clsx-CDyrfCnw.js";
2
+ import { TextSelection as u, NodeSelection as R } from "@tiptap/pm/state";
3
+ import { u as M, d as v, A as f } from "./index-lj3VWExo.js";
4
+ import { jsx as m, Fragment as z } from "react/jsx-runtime";
5
+ import "react";
6
+ import "./theme.js";
7
+ var S = T.create({
8
+ name: "horizontalRule",
9
+ addOptions() {
10
+ return {
11
+ HTMLAttributes: {},
12
+ nextNodeType: "paragraph"
13
+ };
14
+ },
15
+ group: "block",
16
+ parseHTML() {
17
+ return [{ tag: "hr" }];
18
+ },
19
+ renderHTML({ HTMLAttributes: t }) {
20
+ return ["hr", h(this.options.HTMLAttributes, t)];
21
+ },
22
+ markdownTokenName: "hr",
23
+ parseMarkdown: (t, n) => n.createNode("horizontalRule"),
24
+ renderMarkdown: () => "---",
25
+ addCommands() {
26
+ return {
27
+ setHorizontalRule: () => ({ chain: t, state: n }) => {
28
+ if (!y(n, n.schema.nodes[this.name]))
29
+ return !1;
30
+ const { selection: r } = n, { $to: s } = r, i = t();
31
+ return H(r) ? i.insertContentAt(s.pos, {
32
+ type: this.name
33
+ }) : i.insertContent({ type: this.name }), i.command(({ state: a, tr: e, dispatch: l }) => {
34
+ if (l) {
35
+ const { $to: o } = e.selection, c = o.end();
36
+ if (o.nodeAfter)
37
+ o.nodeAfter.isTextblock ? e.setSelection(u.create(e.doc, o.pos + 1)) : o.nodeAfter.isBlock ? e.setSelection(R.create(e.doc, o.pos)) : e.setSelection(u.create(e.doc, o.pos));
38
+ else {
39
+ const d = a.schema.nodes[this.options.nextNodeType] || o.parent.type.contentMatch.defaultType, p = d == null ? void 0 : d.create();
40
+ p && (e.insert(c, p), e.setSelection(u.create(e.doc, c + 1)));
41
+ }
42
+ e.scrollIntoView();
43
+ }
44
+ return !0;
45
+ }).run();
46
+ }
47
+ };
48
+ },
49
+ addInputRules() {
50
+ return [
51
+ A({
52
+ find: /^(?:---|—-|___\s|\*\*\*\s)$/,
53
+ type: this.type
54
+ })
55
+ ];
56
+ }
57
+ });
58
+ function w() {
59
+ const t = M(b.name), {
60
+ icon: n = void 0,
61
+ tooltip: r = void 0,
62
+ shortcutKeys: s = void 0,
63
+ tooltipOptions: i = {},
64
+ action: a = void 0,
65
+ isActive: e = void 0
66
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: l, disabled: o, update: c } = v(e), d = () => {
67
+ o || a && (a(), c());
68
+ };
69
+ return t ? /* @__PURE__ */ m(
70
+ f,
71
+ {
72
+ action: d,
73
+ dataState: l,
74
+ disabled: o,
75
+ icon: n,
76
+ shortcutKeys: s,
77
+ tooltip: r,
78
+ tooltipOptions: i
79
+ }
80
+ ) : /* @__PURE__ */ m(z, {});
81
+ }
82
+ const b = /* @__PURE__ */ S.extend({
83
+ //@ts-expect-error
84
+ addOptions() {
85
+ var t;
86
+ return {
87
+ ...(t = this.parent) == null ? void 0 : t.call(this),
88
+ button: ({ editor: n, t: r, extension: s }) => ({
89
+ component: f,
90
+ componentProps: {
91
+ action: () => n.commands.setHorizontalRule(),
92
+ disabled: !n.can().setHorizontalRule(),
93
+ icon: "Minus",
94
+ shortcutKeys: s.options.shortcutKeys ?? ["mod", "alt", "S"],
95
+ tooltip: r("editor.horizontalrule.tooltip")
96
+ }
97
+ })
98
+ };
99
+ },
100
+ addKeyboardShortcuts() {
101
+ return {
102
+ "Mod-Alt-s": () => this.editor.commands.setHorizontalRule()
103
+ };
104
+ },
105
+ renderHTML() {
106
+ return [
107
+ "div",
108
+ h(this.options.HTMLAttributes, {
109
+ "data-type": this.name
110
+ }),
111
+ ["hr"]
112
+ ];
113
+ }
114
+ });
115
+ export {
116
+ b as HorizontalRule,
117
+ w as RichTextHorizontalRule
118
+ };
@@ -0,0 +1,416 @@
1
+ import { h as v, j as x, N as k, k as y, n as S, m as I } from "./clsx-CDyrfCnw.js";
2
+ import { jsxs as f, jsx as d, Fragment as P } from "react/jsx-runtime";
3
+ import { Resizable as M } from "re-resizable";
4
+ import { useState as R, useCallback as N } from "react";
5
+ import { g as l } from "./dom-dataset-CIEeltF6.js";
6
+ import { J as j, j as U, B as q, u as A, d as L, A as D } from "./index-lj3VWExo.js";
7
+ import "./theme.js";
8
+ const m = {
9
+ youtube: {
10
+ example: "https://www.youtube.com/watch?v=I4sMhHbHYXM",
11
+ src: "https://www.youtube.com/embed/I4sMhHbHYXM",
12
+ srcPrefix: "https://www.youtube.com/embed",
13
+ linkRule: [
14
+ /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/
15
+ ]
16
+ },
17
+ youku: {
18
+ example: "https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",
19
+ src: "https://player.youku.com/embed/XNDM0NDM4MTcy",
20
+ srcPrefix: "https://player.youku.com/embed",
21
+ linkRule: [String.raw`v.youku.com\/v_show\/id_\w+\=*`],
22
+ idRule: String.raw`id_\w+\=*`
23
+ },
24
+ bilibili: {
25
+ example: "https://www.bilibili.com/video/BV1EJ411u7DN",
26
+ src: "https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",
27
+ srcPrefix: "https://player.bilibili.com/player.html?bvid",
28
+ linkRule: [String.raw`www.bilibili.com\/video\/\w+`]
29
+ },
30
+ qqvideo: {
31
+ example: "https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",
32
+ src: "https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",
33
+ srcPrefix: "https://v.qq.com/txp/iframe/player.html?vid",
34
+ linkRule: [String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]
35
+ },
36
+ amap: {
37
+ example: "https://ditu.amap.com/",
38
+ src: "https://www.amap.com/place/B000A45467",
39
+ srcPrefix: "",
40
+ linkRule: [String.raw`\.amap\.com`]
41
+ },
42
+ baidu_map: {
43
+ example: "https://j.map.baidu.com/15/fo",
44
+ src: "https://j.map.baidu.com/15/fo",
45
+ srcPrefix: "",
46
+ linkRule: [String.raw`map\.baidu\.com`]
47
+ },
48
+ modao: {
49
+ example: "https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",
50
+ src: "https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",
51
+ srcPrefix: "",
52
+ linkRule: [String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],
53
+ tips: "Modao > More > Share > Embed > COPY"
54
+ },
55
+ lanhu: {
56
+ example: "https://lanhuapp.com/link/#/invite?sid=evP7L",
57
+ src: "https://lanhuapp.com/url/evP7L",
58
+ srcPrefix: "",
59
+ linkRule: [String.raw`https:\/\/lanhuapp.com\/url\/\w+`],
60
+ tips: "Lanhu > Project > Share > Copy Link"
61
+ },
62
+ figma: {
63
+ example: "https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",
64
+ src: "https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",
65
+ srcPrefix: "https://www.figma.com/embed?embed_host=share&url",
66
+ linkRule: [String.raw`https:\/\/www.figma.com\/file\/\w+`]
67
+ },
68
+ canva: {
69
+ example: "https://www.canva.cn/design/DAD61-t29UI/view",
70
+ src: "https://www.canva.cn/design/DAD61-t29UI/view",
71
+ srcPrefix: "",
72
+ linkRule: [String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]
73
+ },
74
+ processon: {
75
+ example: "https://www.processon.com/embed/5ea99d8607912948b0e6fe78",
76
+ src: "https://www.processon.com/embed/5ea99d8607912948b0e6fe78",
77
+ srcPrefix: "",
78
+ linkRule: [String.raw`https:\/\/www.processon.com\/embed\/\w+`]
79
+ },
80
+ codepen: {
81
+ example: "https://codepen.io/mekery/embed/YzyrKOJ",
82
+ src: "https://codepen.io/mekery/embed/YzyrKOJ",
83
+ srcPrefix: "",
84
+ linkRule: [String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]
85
+ },
86
+ jinshuju: {
87
+ example: "https://jinshuju.net/f/q9YvVf",
88
+ src: "https://jinshuju.net/f/q9YvVf",
89
+ srcPrefix: "",
90
+ linkRule: [String.raw`https:\/\/jinshuju.net\/f\/\w+`]
91
+ },
92
+ iframe: {
93
+ example: "https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",
94
+ src: "https://player.youku.com/embed/XNDM0NDM4MTcy",
95
+ srcPrefix: "",
96
+ linkRule: [".+"]
97
+ },
98
+ googlemaps: {
99
+ example: "https://goo.gl/maps/8Ys8b4K1ZJY2",
100
+ src: "https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",
101
+ srcPrefix: "",
102
+ linkRule: [String.raw`https:\/\/goo.gl\/maps\/\w+`]
103
+ }
104
+ };
105
+ function _(e) {
106
+ const t = m.youtube, i = e.matchedUrl;
107
+ e.validLink = !0;
108
+ const r = i.split("="), n = r.length;
109
+ if (n > 0) {
110
+ const c = r[n - 1];
111
+ e.src = `${t.srcPrefix}/${c}`, e.validId = !0;
112
+ }
113
+ return e;
114
+ }
115
+ function $(e) {
116
+ const t = m.youku, i = e.matchedUrl, r = t.idRule, n = new RegExp(r), c = i.match(n);
117
+ if (c && c.length > 0) {
118
+ const o = c[0].slice(3);
119
+ e.validId = !0, e.src = `${t.srcPrefix}/${o}`;
120
+ } else
121
+ e.validId = !1;
122
+ return e;
123
+ }
124
+ function T(e) {
125
+ const t = m.bilibili, r = e.matchedUrl.split("/"), n = r.length;
126
+ if (n > 0) {
127
+ const c = r[n - 1];
128
+ e.src = `${t.srcPrefix}=${c}`, e.validId = !0;
129
+ }
130
+ return e;
131
+ }
132
+ function Y(e) {
133
+ const t = m.qqvideo, r = e.matchedUrl.split("/"), n = r.length;
134
+ if (n > 0) {
135
+ const c = r[n - 1];
136
+ e.src = `${t.srcPrefix}=${c}`, e.validId = !0;
137
+ }
138
+ return e;
139
+ }
140
+ function z(e, t) {
141
+ return t.src = e, t.validId = !0, t;
142
+ }
143
+ function C(e, t) {
144
+ return t.src = e, t.validId = !0, t;
145
+ }
146
+ function E(e, t) {
147
+ return t.src = e, t.validId = !0, t.originalLink = e, t;
148
+ }
149
+ function H(e) {
150
+ return e.src = e.matchedUrl, e.validId = !0, e.originalLink = e.src, e;
151
+ }
152
+ function B(e) {
153
+ return e.src = e.matchedUrl, e.validId = !0, e.originalLink = e.src, e;
154
+ }
155
+ function V(e) {
156
+ const t = m.figma;
157
+ return e.src = `${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`, e.validId = !0, e.originalLink = e.matchedUrl, e;
158
+ }
159
+ function J(e, t) {
160
+ return t.src = `${t.matchedUrl}?embed`, t.validId = !0, t.originalLink = e, t;
161
+ }
162
+ function K(e, t) {
163
+ return t.src = `${t.matchedUrl}`, t.validId = !0, t.originalLink = e, t;
164
+ }
165
+ function O(e) {
166
+ return e.src = `${e.matchedUrl}`, e.validId = !0, e.originalLink = e.src, e;
167
+ }
168
+ function X(e, t) {
169
+ return t.src = `${t.matchedUrl}?background=white&banner=show&embedded=true`, t.validId = !0, t.originalLink = e, t;
170
+ }
171
+ function W(e, t) {
172
+ return t.src = `${t.matchedUrl}`, t.validId = !0, t.originalLink = e, t;
173
+ }
174
+ function F(e, t, i) {
175
+ if (e === "googlemaps")
176
+ return i.validLink = !0, i.matchedUrl = t, i;
177
+ const n = m[e].linkRule;
178
+ for (const c of n) {
179
+ const o = new RegExp(c), a = t.match(o);
180
+ if (a && a.length > 0)
181
+ return i.validLink = !0, i.matchedUrl = e === "youtube" ? a[1] : a[0], i;
182
+ }
183
+ return i;
184
+ }
185
+ function G(e) {
186
+ var i, r;
187
+ let t = "iframe";
188
+ 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;
189
+ }
190
+ function Z(e) {
191
+ let t = {
192
+ validLink: !1,
193
+ validId: !1,
194
+ matchedUrl: "",
195
+ originalLink: e,
196
+ src: ""
197
+ };
198
+ const i = G(e);
199
+ if (t = F(i, e, t), !t.validLink)
200
+ return t;
201
+ switch (i) {
202
+ case "youtube":
203
+ return _(t);
204
+ case "youku":
205
+ return $(t);
206
+ case "bilibili":
207
+ return T(t);
208
+ case "qqvideo":
209
+ return Y(t);
210
+ case "amap":
211
+ return z(e, t);
212
+ case "baidu_map":
213
+ return C(e, t);
214
+ case "googlemaps":
215
+ return E(e, t);
216
+ case "modao":
217
+ return H(t);
218
+ case "lanhu":
219
+ return B(t);
220
+ case "figma":
221
+ return V(t);
222
+ case "canva":
223
+ return J(e, t);
224
+ case "processon":
225
+ return K(e, t);
226
+ case "codepen":
227
+ return O(t);
228
+ case "jinshuju":
229
+ return X(e, t);
230
+ case "iframe":
231
+ return W(e, t);
232
+ default:
233
+ return e;
234
+ }
235
+ }
236
+ const Q = "_wrap_5y04w_1", ee = "_innerWrap_5y04w_15", w = {
237
+ wrap: Q,
238
+ innerWrap: ee
239
+ };
240
+ function te({ editor: e, node: t, updateAttributes: i }) {
241
+ const r = j(), { src: n, width: c, height: o } = t.attrs, [a, p] = R("");
242
+ function u() {
243
+ if (!a)
244
+ return;
245
+ const s = Z(a);
246
+ e.chain().updateAttributes(b.name, {
247
+ src: (s == null ? void 0 : s.src) || a
248
+ }).setNodeSelection(e.state.selection.from).focus().run();
249
+ }
250
+ const g = N(
251
+ (s) => {
252
+ i({ width: s.width, height: s.height });
253
+ },
254
+ [i]
255
+ );
256
+ return /* @__PURE__ */ f(v, { children: [
257
+ !n && /* @__PURE__ */ f("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: [
258
+ /* @__PURE__ */ d(
259
+ U,
260
+ {
261
+ autoFocus: !0,
262
+ className: "richtext-flex-1",
263
+ onInput: (s) => p(s.target.value),
264
+ placeholder: "Enter link",
265
+ type: "url",
266
+ value: a
267
+ }
268
+ ),
269
+ /* @__PURE__ */ d(q, { className: "richtext-w-[60px]", onClick: u, children: "OK" })
270
+ ] }),
271
+ n && /* @__PURE__ */ d(
272
+ M,
273
+ {
274
+ size: {
275
+ width: Number.parseInt(c),
276
+ height: Number.parseInt(o)
277
+ },
278
+ onResizeStop: (s, ie, re, h) => {
279
+ g({
280
+ width: Number.parseInt(c) + h.width,
281
+ height: Number.parseInt(o) + h.height
282
+ });
283
+ },
284
+ children: /* @__PURE__ */ d("div", { className: x(w.wrap, "render-wrapper"), children: /* @__PURE__ */ d(
285
+ "div",
286
+ {
287
+ className: w.innerWrap,
288
+ style: { pointerEvents: r ? "none" : "auto" },
289
+ children: /* @__PURE__ */ d("iframe", { className: "richtext-my-[12px]", src: n })
290
+ }
291
+ ) })
292
+ }
293
+ )
294
+ ] });
295
+ }
296
+ function pe() {
297
+ const e = A(b.name), {
298
+ icon: t = void 0,
299
+ tooltip: i = void 0,
300
+ shortcutKeys: r = void 0,
301
+ tooltipOptions: n = {},
302
+ action: c = void 0,
303
+ isActive: o = void 0
304
+ } = (e == null ? void 0 : e.componentProps) ?? {}, { editorDisabled: a, update: p } = L(o), u = () => {
305
+ a || c && (c(), p());
306
+ };
307
+ return e ? /* @__PURE__ */ d(
308
+ D,
309
+ {
310
+ action: u,
311
+ disabled: a,
312
+ icon: t,
313
+ shortcutKeys: r,
314
+ tooltip: i,
315
+ tooltipOptions: n
316
+ }
317
+ ) : /* @__PURE__ */ d(P, {});
318
+ }
319
+ const b = /* @__PURE__ */ k.create({
320
+ name: "iframe",
321
+ content: "",
322
+ marks: "",
323
+ group: "block",
324
+ selectable: !0,
325
+ atom: !0,
326
+ draggable: !0,
327
+ addOptions() {
328
+ var e;
329
+ return {
330
+ ...(e = this.parent) == null ? void 0 : e.call(this),
331
+ HTMLAttributes: {
332
+ class: "iframe"
333
+ },
334
+ button: ({
335
+ editor: t,
336
+ extension: i,
337
+ t: r
338
+ }) => ({
339
+ componentProps: {
340
+ action: (n) => t.commands.setIframe(n),
341
+ upload: i.options.upload,
342
+ // isActive: () => editor.can().setIframe({}),
343
+ icon: "Iframe",
344
+ tooltip: r("editor.iframe.tooltip")
345
+ }
346
+ })
347
+ };
348
+ },
349
+ addAttributes() {
350
+ return {
351
+ width: {
352
+ default: 600,
353
+ parseHTML: l("width")
354
+ },
355
+ height: {
356
+ default: 300,
357
+ parseHTML: l("height")
358
+ },
359
+ src: {
360
+ default: null,
361
+ parseHTML: l("src")
362
+ },
363
+ defaultShowPicker: {
364
+ default: !1
365
+ },
366
+ frameborder: {
367
+ default: 0
368
+ },
369
+ allowfullscreen: {
370
+ default: this.options.allowFullscreen,
371
+ parseHTML: () => this.options.allowFullscreen
372
+ }
373
+ };
374
+ },
375
+ parseHTML() {
376
+ return [
377
+ {
378
+ tag: "iframe"
379
+ }
380
+ ];
381
+ },
382
+ renderHTML({ HTMLAttributes: e }) {
383
+ return ["iframe", I(this.options.HTMLAttributes, e)];
384
+ },
385
+ addCommands() {
386
+ return {
387
+ setIframe: (e) => ({ tr: t, commands: i, chain: r }) => {
388
+ var c, o, a;
389
+ if (((a = (o = (c = t.selection) == null ? void 0 : c.node) == null ? void 0 : o.type) == null ? void 0 : a.name) == this.name)
390
+ return i.updateAttributes(this.name, e);
391
+ const n = e || { url: "" };
392
+ return r().insertContent({
393
+ type: this.name,
394
+ attrs: n
395
+ }).run();
396
+ }
397
+ };
398
+ },
399
+ addInputRules() {
400
+ return [
401
+ S({
402
+ find: /^\$iframe\$$/,
403
+ type: this.type,
404
+ getAttributes: () => ({ width: "100%" })
405
+ })
406
+ ];
407
+ },
408
+ addNodeView() {
409
+ return y(te);
410
+ }
411
+ });
412
+ export {
413
+ b as I,
414
+ pe as R,
415
+ Z as g
416
+ };
@@ -0,0 +1 @@
1
+ "use strict";const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),y=require("re-resizable"),g=require("react"),f=require("./dom-dataset-BqoJhJXt.cjs"),m=require("./index-D9oM__YW.cjs");require("./theme.cjs");const p={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 S(e){const t=p.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 I(e){const t=p.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 R(e){const t=p.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 P(e){const t=p.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 j(e,t){return t.src=e,t.validId=!0,t}function M(e,t){return t.src=e,t.validId=!0,t}function N(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function q(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function U(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function A(e){const t=p.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function D(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function L(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function _(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function $(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function T(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function z(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=p[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 Y(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=Y(e);if(t=z(i,e,t),!t.validLink)return t;switch(i){case"youtube":return S(t);case"youku":return I(t);case"bilibili":return R(t);case"qqvideo":return P(t);case"amap":return j(e,t);case"baidu_map":return M(e,t);case"googlemaps":return N(e,t);case"modao":return q(t);case"lanhu":return U(t);case"figma":return A(t);case"canva":return D(e,t);case"processon":return L(e,t);case"codepen":return _(t);case"jinshuju":return $(e,t);case"iframe":return T(e,t);default:return e}}const C="_wrap_5y04w_1",E="_innerWrap_5y04w_15",v={wrap:C,innerWrap:E};function H({editor:e,node:t,updateAttributes:i}){const r=m.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,l]=g.useState("");function h(){if(!a)return;const d=x(a);e.chain().updateAttributes(w.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const k=g.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(m.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>l(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(m.Button,{className:"richtext-w-[60px]",onClick:h,children:"OK"})]}),n&&s.jsx(y.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,V,K,b)=>{k({width:Number.parseInt(c)+b.width,height:Number.parseInt(o)+b.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 B(){const e=m.useButtonProps(w.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:l}=m.useToggleActive(o),h=()=>{a||c&&(c(),l())};return e?s.jsx(m.ActionButton,{action:h,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const w=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:f.getDatasetAttribute("width")},height:{default:300,parseHTML:f.getDatasetAttribute("height")},src:{default:null,parseHTML:f.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(H)}});exports.Iframe=w;exports.RichTextIframe=B;exports.getServiceSrc=x;
package/lib/Iframe.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Iframe-BfBLILDA.cjs");require("./dom-dataset-BqoJhJXt.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
package/lib/Iframe.js ADDED
@@ -0,0 +1,7 @@
1
+ import "./clsx-CDyrfCnw.js";
2
+ import { I as o, R as t } from "./Iframe-BdgiWGml.js";
3
+ import "./dom-dataset-CIEeltF6.js";
4
+ export {
5
+ o as Iframe,
6
+ t as RichTextIframe
7
+ };
package/lib/Image.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./index-D9oM__YW.cjs");exports.Image=e.Image;exports.RichTextImage=e.RichTextImage;
package/lib/Image.js ADDED
@@ -0,0 +1,6 @@
1
+ import "./clsx-CDyrfCnw.js";
2
+ import { t, $ as o } from "./index-lj3VWExo.js";
3
+ export {
4
+ t as Image,
5
+ o as RichTextImage
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./clsx-CXbNJWDD.cjs"),f=require("./index-D9oM__YW.cjs"),l=require("react/jsx-runtime"),u=require("react"),j=require("./index-bVGIXhRg.cjs");require("./theme.cjs");const L=require("./popover-D-hUKDYu.cjs"),N={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function q(e){var k,z;const[t,r]=u.useState({width:j.IMAGE_MAX_SIZE,height:j.IMAGE_MAX_SIZE}),[o,i]=u.useState({width:0,height:0}),[n]=u.useState([N.TOP_LEFT,N.TOP_RIGHT,N.BOTTOM_LEFT,N.BOTTOM_RIGHT]),[s,a]=u.useState(!1),[h,x]=u.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=(k=e==null?void 0:e.node)==null?void 0:k.attrs,m=u.useMemo(()=>{var b;const{src:c,alt:w,width:v,height:A}=(b=e==null?void 0:e.node)==null?void 0:b.attrs,G=f.isNumber(v)?`${v}px`:v,d=f.isNumber(A)?`${A}px`:A;return{src:c||void 0,alt:w||void 0,style:{width:G||void 0,height:d||void 0}}},[(z=e==null?void 0:e.node)==null?void 0:z.attrs]),_=u.useMemo(()=>{const{style:{width:c}}=m;return{width:c==="100%"?c:void 0}},[m]);function g(c){i({width:c.target.width,height:c.target.height})}function I(){const{editor:c,getPos:w}=e;c.commands.setNodeSelection(w())}const M=u.useCallback(f.throttle(()=>{const{editor:c}=e,{width:w}=getComputedStyle(c.view.dom);r(v=>({...v,width:Number.parseInt(w,10)}))},j.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function H(c,w){c.preventDefault(),c.stopPropagation();const v=o.width,A=o.height,G=v/A;let d=Number(e.node.attrs.width),b=Number(e.node.attrs.height);const y=t.width;d&&!b?(d=d>y?y:d,b=Math.round(d/G)):b&&!d?(d=Math.round(b*G),d=d>y?y:d):!d&&!b?(d=v>y?y:v,b=Math.round(d/G)):d=d>y?y:d,a(!0),x({x:c.clientX,y:c.clientY,w:d,h:b,dir:w})}const E=u.useCallback(f.throttle(c=>{if(c.preventDefault(),c.stopPropagation(),!s)return;const{x:w,w:v,dir:A}=h,G=(c.clientX-w)*(/l/.test(A)?-1:1),d=f.clamp$1(v+G,j.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:d,height:null})},j.IMAGE_THROTTLE_WAIT_TIME),[s,h,t,e.updateAttributes]),S=u.useCallback(c=>{c.preventDefault(),c.stopPropagation(),s&&(x({x:0,y:0,w:0,h:0,dir:""}),a(!1),I())},[s,I]),$=u.useCallback(()=>{document==null||document.addEventListener("mousemove",E,!0),document==null||document.addEventListener("mouseup",S,!0)},[E,S]),O=u.useCallback(()=>{document==null||document.removeEventListener("mousemove",E,!0),document==null||document.removeEventListener("mouseup",S,!0)},[E,S]);u.useEffect(()=>(s?$():O(),()=>{O()}),[s,$,O]);const R=u.useMemo(()=>new ResizeObserver(()=>M()),[M]);return u.useEffect(()=>(R.observe(e.editor.view.dom),()=>{R.disconnect()}),[e.editor.view.dom,R]),l.jsx(P.NodeViewWrapper,{className:"image-view",style:{..._,width:"100%",textAlign:T},children:l.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:_,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[l.jsx("img",{alt:m.alt,className:"image-view__body__image block",height:"auto",onClick:I,onLoad:g,src:m.src,style:m.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&l.jsx("div",{className:"image-resizer",children:n==null?void 0:n.map(c=>l.jsx("span",{className:`image-resizer__handler image-resizer__handler--${c}`,onMouseDown:w=>H(w,c)},`image-dir-${c}`))})]})})}async function W(e){var o;const r=await(await fetch(`https://api.giphy.com/v1/gifs/trending?q=&limit=15&api_key=${e}`)).json();return(o=r==null?void 0:r.data)==null?void 0:o.map(i=>{var n,s,a;return{id:i==null?void 0:i.id,src:(n=i==null?void 0:i.images.original)==null?void 0:n.url,width:+((s=i==null?void 0:i.images.original)==null?void 0:s.width),height:+((a=i==null?void 0:i.images.original)==null?void 0:a.width)}})}async function p(e,t){var i;const o=await(await fetch(`https://api.giphy.com/v1/gifs/search?q=${e}&limit=15&api_key=${t}`)).json();return(i=o==null?void 0:o.data)==null?void 0:i.map(n=>{var s,a,h;return{id:n==null?void 0:n.id,src:(s=n==null?void 0:n.images.original)==null?void 0:s.url,width:+((a=n==null?void 0:n.images.original)==null?void 0:a.width),height:+((h=n==null?void 0:n.images.original)==null?void 0:h.width)}})}async function D(e){var n,s;const t=await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`),r=await(t==null?void 0:t.json()),i=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(n=r==null?void 0:r.results)==null?void 0:n[0]}&limit=15`)).json();return(s=i==null?void 0:i.results)==null?void 0:s.map(a=>{var h,x,T,m,_,g,I,M;return{id:a==null?void 0:a.id,src:(x=(h=a==null?void 0:a.media_formats)==null?void 0:h.gif)==null?void 0:x.url,width:(_=(m=(T=a==null?void 0:a.media_formats)==null?void 0:T.gif)==null?void 0:m.dims)==null?void 0:_[0],height:(M=(I=(g=a==null?void 0:a.media_formats)==null?void 0:g.gif)==null?void 0:I.dims)==null?void 0:M[1]}})}async function F(e,t){var i;const o=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();return(i=o==null?void 0:o.results)==null?void 0:i.map(n=>{var s,a,h,x,T,m,_,g;return{id:n==null?void 0:n.id,src:(a=(s=n==null?void 0:n.media_formats)==null?void 0:s.gif)==null?void 0:a.url,width:(T=(x=(h=n==null?void 0:n.media_formats)==null?void 0:h.gif)==null?void 0:x.dims)==null?void 0:T[0],height:(g=(_=(m=n==null?void 0:n.media_formats)==null?void 0:m.gif)==null?void 0:_.dims)==null?void 0:g[1]}})}function B(e,t){return{searchTrending:async()=>t?e==="giphy"?W(t):e==="tenor"?D(t):[]:[],searchWord:async i=>t?e==="giphy"?p(i,t):e==="tenor"?F(i,t):[]:[]}}function V({selectImage:e,apiKey:t,provider:r,children:o}){const[i,n]=u.useState(!1),[s,a]=u.useState([]),{editorDisabled:h}=f.useToggleActive(),x=u.useRef(null),{searchTrending:T,searchWord:m}=B(r,t);u.useEffect(()=>{(async()=>{const g=await T();a(g)})()},[]);const _=u.useCallback(f.debounce(async g=>{if(!g.target.value){const M=await T();a(M);return}const I=await m(g.target.value);a(I)},350),[]);return l.jsxs(L.Popover,{modal:!0,onOpenChange:n,open:i,children:[l.jsx(L.PopoverTrigger,{asChild:!0,disabled:h,children:o}),l.jsx(L.PopoverContent,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:t?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"richtext-mb-[10px] richtext-w-full",children:l.jsx(f.Input,{onChange:_,placeholder:"Search GIF",ref:x,type:"text"})}),l.jsx("div",{className:"richtext-max-h-[280px] !richtext-max-w-[400px] richtext-overflow-y-auto",children:l.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1",children:s!=null&&s.length?s==null?void 0:s.map(g=>l.jsx("img",{alt:"",className:"richtext-cursor-pointer richtext-object-contain richtext-text-center",src:g.src,onClick:()=>{e(g.src),n(!1)}},g.id)):l.jsx("p",{children:"No GIFs found"})})})]}):l.jsx("div",{children:l.jsx("p",{children:"Missing Giphy API Key"})})})]})}function X(){const e=f.useButtonProps(C.name),{action:t,icon:r,tooltip:o,apiKey:i,provider:n}=(e==null?void 0:e.componentProps)??{},{editorDisabled:s}=f.useToggleActive(),a=h=>{s||t&&t(h)};return l.jsx(V,{apiKey:i,provider:n,selectImage:a,children:l.jsx(f.ActionButton,{disabled:s,icon:r,tooltip:o})})}const C=f.index_default.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",API_KEY:"",provider:"giphy",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:r,t:o})=>{var s,a;const i=((s=r==null?void 0:r.options)==null?void 0:s.provider)||"",n=((a=r==null?void 0:r.options)==null?void 0:a.API_KEY)||"";return{componentProps:{action:h=>{t.chain().focus().setImageGif({src:h}).run()},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:o("editor.imageGif.tooltip"),apiKey:n,provider:i}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||"10";return r===void 0?null:Number.parseInt(`${r}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return P.ReactNodeViewRenderer(q)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:r})=>r.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:r})=>r.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",P.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});exports.ImageGif=C;exports.RichTextImageGif=X;