@multiplatform.one/rich-text 6.0.0

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 (450) hide show
  1. package/LICENSE +201 -0
  2. package/dist/cjs/RichEditor.cjs +132 -0
  3. package/dist/cjs/RichEditor.native.js +120 -0
  4. package/dist/cjs/RichEditor.native.js.map +1 -0
  5. package/dist/cjs/RichEditor.stories.cjs +327 -0
  6. package/dist/cjs/RichEditor.stories.native.js +342 -0
  7. package/dist/cjs/RichEditor.stories.native.js.map +1 -0
  8. package/dist/cjs/RichTextEditor/index.cjs +148 -0
  9. package/dist/cjs/RichTextEditor/index.native.js +160 -0
  10. package/dist/cjs/RichTextEditor/index.native.js.map +1 -0
  11. package/dist/cjs/constants.cjs +135 -0
  12. package/dist/cjs/constants.native.js +138 -0
  13. package/dist/cjs/constants.native.js.map +1 -0
  14. package/dist/cjs/context.cjs +33 -0
  15. package/dist/cjs/context.native.js +36 -0
  16. package/dist/cjs/context.native.js.map +1 -0
  17. package/dist/cjs/editor/BlockDragHandle.cjs +137 -0
  18. package/dist/cjs/editor/BlockDragHandle.native.js +142 -0
  19. package/dist/cjs/editor/BlockDragHandle.native.js.map +1 -0
  20. package/dist/cjs/editor/MarkdownPaste.cjs +65 -0
  21. package/dist/cjs/editor/MarkdownPaste.native.js +68 -0
  22. package/dist/cjs/editor/MarkdownPaste.native.js.map +1 -0
  23. package/dist/cjs/editor/SlashCommands.cjs +369 -0
  24. package/dist/cjs/editor/SlashCommands.native.js +424 -0
  25. package/dist/cjs/editor/SlashCommands.native.js.map +1 -0
  26. package/dist/cjs/editor/TentapEditor.native.js +242 -0
  27. package/dist/cjs/editor/TentapEditor.native.js.map +1 -0
  28. package/dist/cjs/editor/TiptapEditor.cjs +578 -0
  29. package/dist/cjs/editor/TiptapEditor.native.js +661 -0
  30. package/dist/cjs/editor/TiptapEditor.native.js.map +1 -0
  31. package/dist/cjs/editor/editorStyles.cjs +272 -0
  32. package/dist/cjs/editor/editorStyles.native.js +276 -0
  33. package/dist/cjs/editor/editorStyles.native.js.map +1 -0
  34. package/dist/cjs/editor/index.cjs +33 -0
  35. package/dist/cjs/editor/index.native.js +36 -0
  36. package/dist/cjs/editor/index.native.js.map +1 -0
  37. package/dist/cjs/editor/types.cjs +54 -0
  38. package/dist/cjs/editor/types.native.js +57 -0
  39. package/dist/cjs/editor/types.native.js.map +1 -0
  40. package/dist/cjs/editor/useEditorState.cjs +129 -0
  41. package/dist/cjs/editor/useEditorState.native.js +135 -0
  42. package/dist/cjs/editor/useEditorState.native.js.map +1 -0
  43. package/dist/cjs/index.cjs +30 -0
  44. package/dist/cjs/index.native.js +33 -0
  45. package/dist/cjs/index.native.js.map +1 -0
  46. package/dist/cjs/styled.cjs +173 -0
  47. package/dist/cjs/styled.native.js +185 -0
  48. package/dist/cjs/styled.native.js.map +1 -0
  49. package/dist/cjs/toolbar/BubbleToolbar.cjs +130 -0
  50. package/dist/cjs/toolbar/BubbleToolbar.native.js +159 -0
  51. package/dist/cjs/toolbar/BubbleToolbar.native.js.map +1 -0
  52. package/dist/cjs/toolbar/CodeBlockBubble.cjs +211 -0
  53. package/dist/cjs/toolbar/CodeBlockBubble.native.js +228 -0
  54. package/dist/cjs/toolbar/CodeBlockBubble.native.js.map +1 -0
  55. package/dist/cjs/toolbar/ColorPicker.cjs +217 -0
  56. package/dist/cjs/toolbar/ColorPicker.native.js +234 -0
  57. package/dist/cjs/toolbar/ColorPicker.native.js.map +1 -0
  58. package/dist/cjs/toolbar/FixedToolbar.cjs +221 -0
  59. package/dist/cjs/toolbar/FixedToolbar.native.js +322 -0
  60. package/dist/cjs/toolbar/FixedToolbar.native.js.map +1 -0
  61. package/dist/cjs/toolbar/HeadingPicker.cjs +158 -0
  62. package/dist/cjs/toolbar/HeadingPicker.native.js +167 -0
  63. package/dist/cjs/toolbar/HeadingPicker.native.js.map +1 -0
  64. package/dist/cjs/toolbar/ImageBubble.cjs +156 -0
  65. package/dist/cjs/toolbar/ImageBubble.native.js +165 -0
  66. package/dist/cjs/toolbar/ImageBubble.native.js.map +1 -0
  67. package/dist/cjs/toolbar/ImageDialog.cjs +115 -0
  68. package/dist/cjs/toolbar/ImageDialog.native.js +122 -0
  69. package/dist/cjs/toolbar/ImageDialog.native.js.map +1 -0
  70. package/dist/cjs/toolbar/LinkBubble.cjs +195 -0
  71. package/dist/cjs/toolbar/LinkBubble.native.js +204 -0
  72. package/dist/cjs/toolbar/LinkBubble.native.js.map +1 -0
  73. package/dist/cjs/toolbar/LinkDialog.cjs +138 -0
  74. package/dist/cjs/toolbar/LinkDialog.native.js +146 -0
  75. package/dist/cjs/toolbar/LinkDialog.native.js.map +1 -0
  76. package/dist/cjs/toolbar/ListPicker.cjs +117 -0
  77. package/dist/cjs/toolbar/ListPicker.native.js +124 -0
  78. package/dist/cjs/toolbar/ListPicker.native.js.map +1 -0
  79. package/dist/cjs/toolbar/MoreDropdown.cjs +201 -0
  80. package/dist/cjs/toolbar/MoreDropdown.native.js +224 -0
  81. package/dist/cjs/toolbar/MoreDropdown.native.js.map +1 -0
  82. package/dist/cjs/toolbar/ResizeHandle.cjs +105 -0
  83. package/dist/cjs/toolbar/ResizeHandle.native.js +109 -0
  84. package/dist/cjs/toolbar/ResizeHandle.native.js.map +1 -0
  85. package/dist/cjs/toolbar/StatusBar.cjs +91 -0
  86. package/dist/cjs/toolbar/StatusBar.native.js +100 -0
  87. package/dist/cjs/toolbar/StatusBar.native.js.map +1 -0
  88. package/dist/cjs/toolbar/TableBubble.cjs +232 -0
  89. package/dist/cjs/toolbar/TableBubble.native.js +273 -0
  90. package/dist/cjs/toolbar/TableBubble.native.js.map +1 -0
  91. package/dist/cjs/toolbar/ToolbarButton.cjs +105 -0
  92. package/dist/cjs/toolbar/ToolbarButton.native.js +97 -0
  93. package/dist/cjs/toolbar/ToolbarButton.native.js.map +1 -0
  94. package/dist/cjs/toolbar/ToolbarGroup.cjs +41 -0
  95. package/dist/cjs/toolbar/ToolbarGroup.native.js +45 -0
  96. package/dist/cjs/toolbar/ToolbarGroup.native.js.map +1 -0
  97. package/dist/cjs/toolbar/icons.cjs +601 -0
  98. package/dist/cjs/toolbar/icons.native.js +165 -0
  99. package/dist/cjs/toolbar/icons.native.js.map +1 -0
  100. package/dist/cjs/toolbar/shortcuts.cjs +62 -0
  101. package/dist/cjs/toolbar/shortcuts.native.js +66 -0
  102. package/dist/cjs/toolbar/shortcuts.native.js.map +1 -0
  103. package/dist/cjs/toolbar/useHorizontalScroll.cjs +250 -0
  104. package/dist/cjs/toolbar/useHorizontalScroll.native.js +260 -0
  105. package/dist/cjs/toolbar/useHorizontalScroll.native.js.map +1 -0
  106. package/dist/cjs/types.cjs +56 -0
  107. package/dist/cjs/types.native.js +59 -0
  108. package/dist/cjs/types.native.js.map +1 -0
  109. package/dist/esm/RichEditor.mjs +107 -0
  110. package/dist/esm/RichEditor.mjs.map +1 -0
  111. package/dist/esm/RichEditor.native.js +92 -0
  112. package/dist/esm/RichEditor.native.js.map +1 -0
  113. package/dist/esm/RichEditor.stories.mjs +291 -0
  114. package/dist/esm/RichEditor.stories.mjs.map +1 -0
  115. package/dist/esm/RichEditor.stories.native.js +303 -0
  116. package/dist/esm/RichEditor.stories.native.js.map +1 -0
  117. package/dist/esm/RichTextEditor/index.mjs +123 -0
  118. package/dist/esm/RichTextEditor/index.mjs.map +1 -0
  119. package/dist/esm/RichTextEditor/index.native.js +132 -0
  120. package/dist/esm/RichTextEditor/index.native.js.map +1 -0
  121. package/dist/esm/constants.mjs +108 -0
  122. package/dist/esm/constants.mjs.map +1 -0
  123. package/dist/esm/constants.native.js +108 -0
  124. package/dist/esm/constants.native.js.map +1 -0
  125. package/dist/esm/context.mjs +8 -0
  126. package/dist/esm/context.mjs.map +1 -0
  127. package/dist/esm/context.native.js +8 -0
  128. package/dist/esm/context.native.js.map +1 -0
  129. package/dist/esm/editor/BlockDragHandle.mjs +112 -0
  130. package/dist/esm/editor/BlockDragHandle.mjs.map +1 -0
  131. package/dist/esm/editor/BlockDragHandle.native.js +114 -0
  132. package/dist/esm/editor/BlockDragHandle.native.js.map +1 -0
  133. package/dist/esm/editor/MarkdownPaste.mjs +40 -0
  134. package/dist/esm/editor/MarkdownPaste.mjs.map +1 -0
  135. package/dist/esm/editor/MarkdownPaste.native.js +40 -0
  136. package/dist/esm/editor/MarkdownPaste.native.js.map +1 -0
  137. package/dist/esm/editor/SlashCommands.mjs +333 -0
  138. package/dist/esm/editor/SlashCommands.mjs.map +1 -0
  139. package/dist/esm/editor/SlashCommands.native.js +385 -0
  140. package/dist/esm/editor/SlashCommands.native.js.map +1 -0
  141. package/dist/esm/editor/TentapEditor.native.js +214 -0
  142. package/dist/esm/editor/TentapEditor.native.js.map +1 -0
  143. package/dist/esm/editor/TiptapEditor.mjs +542 -0
  144. package/dist/esm/editor/TiptapEditor.mjs.map +1 -0
  145. package/dist/esm/editor/TiptapEditor.native.js +622 -0
  146. package/dist/esm/editor/TiptapEditor.native.js.map +1 -0
  147. package/dist/esm/editor/editorStyles.mjs +247 -0
  148. package/dist/esm/editor/editorStyles.mjs.map +1 -0
  149. package/dist/esm/editor/editorStyles.native.js +248 -0
  150. package/dist/esm/editor/editorStyles.native.js.map +1 -0
  151. package/dist/esm/editor/index.mjs +5 -0
  152. package/dist/esm/editor/index.mjs.map +1 -0
  153. package/dist/esm/editor/index.native.js +5 -0
  154. package/dist/esm/editor/index.native.js.map +1 -0
  155. package/dist/esm/editor/types.mjs +29 -0
  156. package/dist/esm/editor/types.mjs.map +1 -0
  157. package/dist/esm/editor/types.native.js +29 -0
  158. package/dist/esm/editor/types.native.js.map +1 -0
  159. package/dist/esm/editor/useEditorState.mjs +102 -0
  160. package/dist/esm/editor/useEditorState.mjs.map +1 -0
  161. package/dist/esm/editor/useEditorState.native.js +105 -0
  162. package/dist/esm/editor/useEditorState.native.js.map +1 -0
  163. package/dist/esm/index.mjs +4 -0
  164. package/dist/esm/index.mjs.map +1 -0
  165. package/dist/esm/index.native.js +4 -0
  166. package/dist/esm/index.native.js.map +1 -0
  167. package/dist/esm/styled.mjs +144 -0
  168. package/dist/esm/styled.mjs.map +1 -0
  169. package/dist/esm/styled.native.js +153 -0
  170. package/dist/esm/styled.native.js.map +1 -0
  171. package/dist/esm/toolbar/BubbleToolbar.mjs +105 -0
  172. package/dist/esm/toolbar/BubbleToolbar.mjs.map +1 -0
  173. package/dist/esm/toolbar/BubbleToolbar.native.js +131 -0
  174. package/dist/esm/toolbar/BubbleToolbar.native.js.map +1 -0
  175. package/dist/esm/toolbar/CodeBlockBubble.mjs +186 -0
  176. package/dist/esm/toolbar/CodeBlockBubble.mjs.map +1 -0
  177. package/dist/esm/toolbar/CodeBlockBubble.native.js +200 -0
  178. package/dist/esm/toolbar/CodeBlockBubble.native.js.map +1 -0
  179. package/dist/esm/toolbar/ColorPicker.mjs +191 -0
  180. package/dist/esm/toolbar/ColorPicker.mjs.map +1 -0
  181. package/dist/esm/toolbar/ColorPicker.native.js +205 -0
  182. package/dist/esm/toolbar/ColorPicker.native.js.map +1 -0
  183. package/dist/esm/toolbar/FixedToolbar.mjs +196 -0
  184. package/dist/esm/toolbar/FixedToolbar.mjs.map +1 -0
  185. package/dist/esm/toolbar/FixedToolbar.native.js +294 -0
  186. package/dist/esm/toolbar/FixedToolbar.native.js.map +1 -0
  187. package/dist/esm/toolbar/HeadingPicker.mjs +133 -0
  188. package/dist/esm/toolbar/HeadingPicker.mjs.map +1 -0
  189. package/dist/esm/toolbar/HeadingPicker.native.js +139 -0
  190. package/dist/esm/toolbar/HeadingPicker.native.js.map +1 -0
  191. package/dist/esm/toolbar/ImageBubble.mjs +131 -0
  192. package/dist/esm/toolbar/ImageBubble.mjs.map +1 -0
  193. package/dist/esm/toolbar/ImageBubble.native.js +137 -0
  194. package/dist/esm/toolbar/ImageBubble.native.js.map +1 -0
  195. package/dist/esm/toolbar/ImageDialog.mjs +90 -0
  196. package/dist/esm/toolbar/ImageDialog.mjs.map +1 -0
  197. package/dist/esm/toolbar/ImageDialog.native.js +94 -0
  198. package/dist/esm/toolbar/ImageDialog.native.js.map +1 -0
  199. package/dist/esm/toolbar/LinkBubble.mjs +170 -0
  200. package/dist/esm/toolbar/LinkBubble.mjs.map +1 -0
  201. package/dist/esm/toolbar/LinkBubble.native.js +176 -0
  202. package/dist/esm/toolbar/LinkBubble.native.js.map +1 -0
  203. package/dist/esm/toolbar/LinkDialog.mjs +112 -0
  204. package/dist/esm/toolbar/LinkDialog.mjs.map +1 -0
  205. package/dist/esm/toolbar/LinkDialog.native.js +117 -0
  206. package/dist/esm/toolbar/LinkDialog.native.js.map +1 -0
  207. package/dist/esm/toolbar/ListPicker.mjs +92 -0
  208. package/dist/esm/toolbar/ListPicker.mjs.map +1 -0
  209. package/dist/esm/toolbar/ListPicker.native.js +96 -0
  210. package/dist/esm/toolbar/ListPicker.native.js.map +1 -0
  211. package/dist/esm/toolbar/MoreDropdown.mjs +176 -0
  212. package/dist/esm/toolbar/MoreDropdown.mjs.map +1 -0
  213. package/dist/esm/toolbar/MoreDropdown.native.js +196 -0
  214. package/dist/esm/toolbar/MoreDropdown.native.js.map +1 -0
  215. package/dist/esm/toolbar/ResizeHandle.mjs +80 -0
  216. package/dist/esm/toolbar/ResizeHandle.mjs.map +1 -0
  217. package/dist/esm/toolbar/ResizeHandle.native.js +81 -0
  218. package/dist/esm/toolbar/ResizeHandle.native.js.map +1 -0
  219. package/dist/esm/toolbar/StatusBar.mjs +66 -0
  220. package/dist/esm/toolbar/StatusBar.mjs.map +1 -0
  221. package/dist/esm/toolbar/StatusBar.native.js +72 -0
  222. package/dist/esm/toolbar/StatusBar.native.js.map +1 -0
  223. package/dist/esm/toolbar/TableBubble.mjs +207 -0
  224. package/dist/esm/toolbar/TableBubble.mjs.map +1 -0
  225. package/dist/esm/toolbar/TableBubble.native.js +245 -0
  226. package/dist/esm/toolbar/TableBubble.native.js.map +1 -0
  227. package/dist/esm/toolbar/ToolbarButton.mjs +79 -0
  228. package/dist/esm/toolbar/ToolbarButton.mjs.map +1 -0
  229. package/dist/esm/toolbar/ToolbarButton.native.js +68 -0
  230. package/dist/esm/toolbar/ToolbarButton.native.js.map +1 -0
  231. package/dist/esm/toolbar/ToolbarGroup.mjs +16 -0
  232. package/dist/esm/toolbar/ToolbarGroup.mjs.map +1 -0
  233. package/dist/esm/toolbar/ToolbarGroup.native.js +17 -0
  234. package/dist/esm/toolbar/ToolbarGroup.native.js.map +1 -0
  235. package/dist/esm/toolbar/icons.mjs +554 -0
  236. package/dist/esm/toolbar/icons.mjs.map +1 -0
  237. package/dist/esm/toolbar/icons.native.js +115 -0
  238. package/dist/esm/toolbar/icons.native.js.map +1 -0
  239. package/dist/esm/toolbar/shortcuts.mjs +36 -0
  240. package/dist/esm/toolbar/shortcuts.mjs.map +1 -0
  241. package/dist/esm/toolbar/shortcuts.native.js +37 -0
  242. package/dist/esm/toolbar/shortcuts.native.js.map +1 -0
  243. package/dist/esm/toolbar/useHorizontalScroll.mjs +223 -0
  244. package/dist/esm/toolbar/useHorizontalScroll.mjs.map +1 -0
  245. package/dist/esm/toolbar/useHorizontalScroll.native.js +230 -0
  246. package/dist/esm/toolbar/useHorizontalScroll.native.js.map +1 -0
  247. package/dist/esm/types.mjs +31 -0
  248. package/dist/esm/types.mjs.map +1 -0
  249. package/dist/esm/types.native.js +31 -0
  250. package/dist/esm/types.native.js.map +1 -0
  251. package/dist/jsx/RichEditor.mjs +107 -0
  252. package/dist/jsx/RichEditor.mjs.map +1 -0
  253. package/dist/jsx/RichEditor.native.js +120 -0
  254. package/dist/jsx/RichEditor.native.js.map +1 -0
  255. package/dist/jsx/RichEditor.stories.mjs +291 -0
  256. package/dist/jsx/RichEditor.stories.mjs.map +1 -0
  257. package/dist/jsx/RichEditor.stories.native.js +342 -0
  258. package/dist/jsx/RichEditor.stories.native.js.map +1 -0
  259. package/dist/jsx/RichTextEditor/index.mjs +123 -0
  260. package/dist/jsx/RichTextEditor/index.mjs.map +1 -0
  261. package/dist/jsx/RichTextEditor/index.native.js +160 -0
  262. package/dist/jsx/RichTextEditor/index.native.js.map +1 -0
  263. package/dist/jsx/constants.mjs +108 -0
  264. package/dist/jsx/constants.mjs.map +1 -0
  265. package/dist/jsx/constants.native.js +138 -0
  266. package/dist/jsx/constants.native.js.map +1 -0
  267. package/dist/jsx/context.mjs +8 -0
  268. package/dist/jsx/context.mjs.map +1 -0
  269. package/dist/jsx/context.native.js +36 -0
  270. package/dist/jsx/context.native.js.map +1 -0
  271. package/dist/jsx/editor/BlockDragHandle.mjs +112 -0
  272. package/dist/jsx/editor/BlockDragHandle.mjs.map +1 -0
  273. package/dist/jsx/editor/BlockDragHandle.native.js +142 -0
  274. package/dist/jsx/editor/BlockDragHandle.native.js.map +1 -0
  275. package/dist/jsx/editor/MarkdownPaste.mjs +40 -0
  276. package/dist/jsx/editor/MarkdownPaste.mjs.map +1 -0
  277. package/dist/jsx/editor/MarkdownPaste.native.js +68 -0
  278. package/dist/jsx/editor/MarkdownPaste.native.js.map +1 -0
  279. package/dist/jsx/editor/SlashCommands.mjs +333 -0
  280. package/dist/jsx/editor/SlashCommands.mjs.map +1 -0
  281. package/dist/jsx/editor/SlashCommands.native.js +424 -0
  282. package/dist/jsx/editor/SlashCommands.native.js.map +1 -0
  283. package/dist/jsx/editor/TentapEditor.native.js +242 -0
  284. package/dist/jsx/editor/TentapEditor.native.js.map +1 -0
  285. package/dist/jsx/editor/TiptapEditor.mjs +542 -0
  286. package/dist/jsx/editor/TiptapEditor.mjs.map +1 -0
  287. package/dist/jsx/editor/TiptapEditor.native.js +661 -0
  288. package/dist/jsx/editor/TiptapEditor.native.js.map +1 -0
  289. package/dist/jsx/editor/editorStyles.mjs +247 -0
  290. package/dist/jsx/editor/editorStyles.mjs.map +1 -0
  291. package/dist/jsx/editor/editorStyles.native.js +276 -0
  292. package/dist/jsx/editor/editorStyles.native.js.map +1 -0
  293. package/dist/jsx/editor/index.mjs +5 -0
  294. package/dist/jsx/editor/index.mjs.map +1 -0
  295. package/dist/jsx/editor/index.native.js +36 -0
  296. package/dist/jsx/editor/index.native.js.map +1 -0
  297. package/dist/jsx/editor/types.mjs +29 -0
  298. package/dist/jsx/editor/types.mjs.map +1 -0
  299. package/dist/jsx/editor/types.native.js +57 -0
  300. package/dist/jsx/editor/types.native.js.map +1 -0
  301. package/dist/jsx/editor/useEditorState.mjs +102 -0
  302. package/dist/jsx/editor/useEditorState.mjs.map +1 -0
  303. package/dist/jsx/editor/useEditorState.native.js +135 -0
  304. package/dist/jsx/editor/useEditorState.native.js.map +1 -0
  305. package/dist/jsx/index.js +4 -0
  306. package/dist/jsx/index.js.map +1 -0
  307. package/dist/jsx/index.mjs +4 -0
  308. package/dist/jsx/index.mjs.map +1 -0
  309. package/dist/jsx/index.native.js +33 -0
  310. package/dist/jsx/index.native.js.map +1 -0
  311. package/dist/jsx/styled.mjs +144 -0
  312. package/dist/jsx/styled.mjs.map +1 -0
  313. package/dist/jsx/styled.native.js +185 -0
  314. package/dist/jsx/styled.native.js.map +1 -0
  315. package/dist/jsx/toolbar/BubbleToolbar.mjs +105 -0
  316. package/dist/jsx/toolbar/BubbleToolbar.mjs.map +1 -0
  317. package/dist/jsx/toolbar/BubbleToolbar.native.js +159 -0
  318. package/dist/jsx/toolbar/BubbleToolbar.native.js.map +1 -0
  319. package/dist/jsx/toolbar/CodeBlockBubble.mjs +186 -0
  320. package/dist/jsx/toolbar/CodeBlockBubble.mjs.map +1 -0
  321. package/dist/jsx/toolbar/CodeBlockBubble.native.js +228 -0
  322. package/dist/jsx/toolbar/CodeBlockBubble.native.js.map +1 -0
  323. package/dist/jsx/toolbar/ColorPicker.mjs +191 -0
  324. package/dist/jsx/toolbar/ColorPicker.mjs.map +1 -0
  325. package/dist/jsx/toolbar/ColorPicker.native.js +234 -0
  326. package/dist/jsx/toolbar/ColorPicker.native.js.map +1 -0
  327. package/dist/jsx/toolbar/FixedToolbar.mjs +196 -0
  328. package/dist/jsx/toolbar/FixedToolbar.mjs.map +1 -0
  329. package/dist/jsx/toolbar/FixedToolbar.native.js +322 -0
  330. package/dist/jsx/toolbar/FixedToolbar.native.js.map +1 -0
  331. package/dist/jsx/toolbar/HeadingPicker.mjs +133 -0
  332. package/dist/jsx/toolbar/HeadingPicker.mjs.map +1 -0
  333. package/dist/jsx/toolbar/HeadingPicker.native.js +167 -0
  334. package/dist/jsx/toolbar/HeadingPicker.native.js.map +1 -0
  335. package/dist/jsx/toolbar/ImageBubble.mjs +131 -0
  336. package/dist/jsx/toolbar/ImageBubble.mjs.map +1 -0
  337. package/dist/jsx/toolbar/ImageBubble.native.js +165 -0
  338. package/dist/jsx/toolbar/ImageBubble.native.js.map +1 -0
  339. package/dist/jsx/toolbar/ImageDialog.mjs +90 -0
  340. package/dist/jsx/toolbar/ImageDialog.mjs.map +1 -0
  341. package/dist/jsx/toolbar/ImageDialog.native.js +122 -0
  342. package/dist/jsx/toolbar/ImageDialog.native.js.map +1 -0
  343. package/dist/jsx/toolbar/LinkBubble.mjs +170 -0
  344. package/dist/jsx/toolbar/LinkBubble.mjs.map +1 -0
  345. package/dist/jsx/toolbar/LinkBubble.native.js +204 -0
  346. package/dist/jsx/toolbar/LinkBubble.native.js.map +1 -0
  347. package/dist/jsx/toolbar/LinkDialog.mjs +112 -0
  348. package/dist/jsx/toolbar/LinkDialog.mjs.map +1 -0
  349. package/dist/jsx/toolbar/LinkDialog.native.js +146 -0
  350. package/dist/jsx/toolbar/LinkDialog.native.js.map +1 -0
  351. package/dist/jsx/toolbar/ListPicker.mjs +92 -0
  352. package/dist/jsx/toolbar/ListPicker.mjs.map +1 -0
  353. package/dist/jsx/toolbar/ListPicker.native.js +124 -0
  354. package/dist/jsx/toolbar/ListPicker.native.js.map +1 -0
  355. package/dist/jsx/toolbar/MoreDropdown.mjs +176 -0
  356. package/dist/jsx/toolbar/MoreDropdown.mjs.map +1 -0
  357. package/dist/jsx/toolbar/MoreDropdown.native.js +224 -0
  358. package/dist/jsx/toolbar/MoreDropdown.native.js.map +1 -0
  359. package/dist/jsx/toolbar/ResizeHandle.mjs +80 -0
  360. package/dist/jsx/toolbar/ResizeHandle.mjs.map +1 -0
  361. package/dist/jsx/toolbar/ResizeHandle.native.js +109 -0
  362. package/dist/jsx/toolbar/ResizeHandle.native.js.map +1 -0
  363. package/dist/jsx/toolbar/StatusBar.mjs +66 -0
  364. package/dist/jsx/toolbar/StatusBar.mjs.map +1 -0
  365. package/dist/jsx/toolbar/StatusBar.native.js +100 -0
  366. package/dist/jsx/toolbar/StatusBar.native.js.map +1 -0
  367. package/dist/jsx/toolbar/TableBubble.mjs +207 -0
  368. package/dist/jsx/toolbar/TableBubble.mjs.map +1 -0
  369. package/dist/jsx/toolbar/TableBubble.native.js +273 -0
  370. package/dist/jsx/toolbar/TableBubble.native.js.map +1 -0
  371. package/dist/jsx/toolbar/ToolbarButton.mjs +79 -0
  372. package/dist/jsx/toolbar/ToolbarButton.mjs.map +1 -0
  373. package/dist/jsx/toolbar/ToolbarButton.native.js +97 -0
  374. package/dist/jsx/toolbar/ToolbarButton.native.js.map +1 -0
  375. package/dist/jsx/toolbar/ToolbarGroup.mjs +16 -0
  376. package/dist/jsx/toolbar/ToolbarGroup.mjs.map +1 -0
  377. package/dist/jsx/toolbar/ToolbarGroup.native.js +45 -0
  378. package/dist/jsx/toolbar/ToolbarGroup.native.js.map +1 -0
  379. package/dist/jsx/toolbar/icons.mjs +554 -0
  380. package/dist/jsx/toolbar/icons.mjs.map +1 -0
  381. package/dist/jsx/toolbar/icons.native.js +165 -0
  382. package/dist/jsx/toolbar/icons.native.js.map +1 -0
  383. package/dist/jsx/toolbar/shortcuts.mjs +36 -0
  384. package/dist/jsx/toolbar/shortcuts.mjs.map +1 -0
  385. package/dist/jsx/toolbar/shortcuts.native.js +66 -0
  386. package/dist/jsx/toolbar/shortcuts.native.js.map +1 -0
  387. package/dist/jsx/toolbar/useHorizontalScroll.mjs +223 -0
  388. package/dist/jsx/toolbar/useHorizontalScroll.mjs.map +1 -0
  389. package/dist/jsx/toolbar/useHorizontalScroll.native.js +260 -0
  390. package/dist/jsx/toolbar/useHorizontalScroll.native.js.map +1 -0
  391. package/dist/jsx/types.mjs +31 -0
  392. package/dist/jsx/types.mjs.map +1 -0
  393. package/dist/jsx/types.native.js +59 -0
  394. package/dist/jsx/types.native.js.map +1 -0
  395. package/package.json +117 -0
  396. package/src/RichEditor.native.tsx +161 -0
  397. package/src/RichEditor.stories.tsx +324 -0
  398. package/src/RichEditor.tsx +185 -0
  399. package/src/RichTextEditor/index.tsx +245 -0
  400. package/src/RichTextEditor/richTextEditor.spec.tsx +239 -0
  401. package/src/constants.ts +100 -0
  402. package/src/context.spec.ts +9 -0
  403. package/src/context.ts +16 -0
  404. package/src/editor/BlockDragHandle.ts +141 -0
  405. package/src/editor/MarkdownPaste.ts +50 -0
  406. package/src/editor/SlashCommands.tsx +357 -0
  407. package/src/editor/TentapEditor.native.tsx +269 -0
  408. package/src/editor/TiptapEditor.tsx +616 -0
  409. package/src/editor/editorStyles.spec.ts +24 -0
  410. package/src/editor/editorStyles.ts +260 -0
  411. package/src/editor/index.ts +10 -0
  412. package/src/editor/tentapEditor.spec.ts +125 -0
  413. package/src/editor/tiptapEditor.spec.tsx +169 -0
  414. package/src/editor/types.ts +142 -0
  415. package/src/editor/useEditorState.spec.ts +93 -0
  416. package/src/editor/useEditorState.ts +125 -0
  417. package/src/exports.spec.ts +128 -0
  418. package/src/index.ts +13 -0
  419. package/src/integration.spec.tsx +430 -0
  420. package/src/richEditor.spec.tsx +169 -0
  421. package/src/styled.spec.tsx +42 -0
  422. package/src/styled.ts +177 -0
  423. package/src/toolbar/BubbleToolbar.tsx +151 -0
  424. package/src/toolbar/CodeBlockBubble.tsx +141 -0
  425. package/src/toolbar/ColorPicker.tsx +211 -0
  426. package/src/toolbar/FixedToolbar.native.tsx +381 -0
  427. package/src/toolbar/FixedToolbar.tsx +252 -0
  428. package/src/toolbar/HeadingPicker.tsx +169 -0
  429. package/src/toolbar/ImageBubble.tsx +126 -0
  430. package/src/toolbar/ImageDialog.tsx +93 -0
  431. package/src/toolbar/LinkBubble.tsx +166 -0
  432. package/src/toolbar/LinkDialog.tsx +124 -0
  433. package/src/toolbar/ListPicker.tsx +121 -0
  434. package/src/toolbar/MoreDropdown.tsx +185 -0
  435. package/src/toolbar/ResizeHandle.tsx +80 -0
  436. package/src/toolbar/StatusBar.tsx +76 -0
  437. package/src/toolbar/TableBubble.tsx +197 -0
  438. package/src/toolbar/ToolbarButton.native.tsx +105 -0
  439. package/src/toolbar/ToolbarButton.tsx +114 -0
  440. package/src/toolbar/ToolbarGroup.tsx +38 -0
  441. package/src/toolbar/bubbleToolbar.spec.tsx +93 -0
  442. package/src/toolbar/fixedToolbar.spec.tsx +127 -0
  443. package/src/toolbar/icons.native.tsx +112 -0
  444. package/src/toolbar/icons.tsx +417 -0
  445. package/src/toolbar/shortcuts.ts +42 -0
  446. package/src/toolbar/toolbarPrimitives.spec.tsx +118 -0
  447. package/src/toolbar/toolbarSubComponents.spec.tsx +115 -0
  448. package/src/toolbar/useHorizontalScroll.tsx +270 -0
  449. package/src/types.spec.ts +102 -0
  450. package/src/types.ts +217 -0
@@ -0,0 +1,417 @@
1
+ /**
2
+ * SVG icon components for the rich text editor toolbar
3
+ *
4
+ * All icons use currentColor for fill/stroke to inherit text color.
5
+ */
6
+
7
+ import { Text, styled } from "tamagui";
8
+
9
+ // ===========================================================================
10
+ // SVG Wrapper
11
+ // ===========================================================================
12
+
13
+ const SvgWrapper = styled(Text, {
14
+ name: "SvgWrapper",
15
+ display: "flex",
16
+ alignItems: "center",
17
+ justifyContent: "center",
18
+ });
19
+
20
+ // ===========================================================================
21
+ // Text Style Icons
22
+ // ===========================================================================
23
+
24
+ export const BoldIcon = styled(Text, {
25
+ fontWeight: "bold",
26
+ });
27
+
28
+ export const ItalicIcon = styled(Text, {
29
+ fontStyle: "italic",
30
+ });
31
+
32
+ export const UnderlineIcon = styled(Text, {
33
+ textDecorationLine: "underline",
34
+ });
35
+
36
+ export const StrikeIcon = styled(Text, {
37
+ textDecorationLine: "line-through",
38
+ });
39
+
40
+ // ===========================================================================
41
+ // SVG Icons
42
+ // ===========================================================================
43
+
44
+ export function UndoIcon() {
45
+ return (
46
+ <SvgWrapper>
47
+ <svg
48
+ width="16"
49
+ height="16"
50
+ viewBox="0 0 24 24"
51
+ fill="none"
52
+ stroke="currentColor"
53
+ strokeWidth="2"
54
+ strokeLinecap="round"
55
+ strokeLinejoin="round"
56
+ >
57
+ <polyline points="1 4 1 10 7 10" />
58
+ <path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10" />
59
+ </svg>
60
+ </SvgWrapper>
61
+ );
62
+ }
63
+
64
+ export function RedoIcon() {
65
+ return (
66
+ <SvgWrapper>
67
+ <svg
68
+ width="16"
69
+ height="16"
70
+ viewBox="0 0 24 24"
71
+ fill="none"
72
+ stroke="currentColor"
73
+ strokeWidth="2"
74
+ strokeLinecap="round"
75
+ strokeLinejoin="round"
76
+ >
77
+ <polyline points="23 4 23 10 17 10" />
78
+ <path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10" />
79
+ </svg>
80
+ </SvgWrapper>
81
+ );
82
+ }
83
+
84
+ export function AlignLeftIcon() {
85
+ return (
86
+ <SvgWrapper>
87
+ <svg
88
+ width="16"
89
+ height="16"
90
+ viewBox="0 0 24 24"
91
+ fill="none"
92
+ stroke="currentColor"
93
+ strokeWidth="2"
94
+ >
95
+ <line x1="3" y1="6" x2="21" y2="6" />
96
+ <line x1="3" y1="12" x2="15" y2="12" />
97
+ <line x1="3" y1="18" x2="21" y2="18" />
98
+ </svg>
99
+ </SvgWrapper>
100
+ );
101
+ }
102
+
103
+ export function AlignCenterIcon() {
104
+ return (
105
+ <SvgWrapper>
106
+ <svg
107
+ width="16"
108
+ height="16"
109
+ viewBox="0 0 24 24"
110
+ fill="none"
111
+ stroke="currentColor"
112
+ strokeWidth="2"
113
+ >
114
+ <line x1="3" y1="6" x2="21" y2="6" />
115
+ <line x1="6" y1="12" x2="18" y2="12" />
116
+ <line x1="3" y1="18" x2="21" y2="18" />
117
+ </svg>
118
+ </SvgWrapper>
119
+ );
120
+ }
121
+
122
+ export function AlignRightIcon() {
123
+ return (
124
+ <SvgWrapper>
125
+ <svg
126
+ width="16"
127
+ height="16"
128
+ viewBox="0 0 24 24"
129
+ fill="none"
130
+ stroke="currentColor"
131
+ strokeWidth="2"
132
+ >
133
+ <line x1="3" y1="6" x2="21" y2="6" />
134
+ <line x1="9" y1="12" x2="21" y2="12" />
135
+ <line x1="3" y1="18" x2="21" y2="18" />
136
+ </svg>
137
+ </SvgWrapper>
138
+ );
139
+ }
140
+
141
+ export function AlignJustifyIcon() {
142
+ return (
143
+ <SvgWrapper>
144
+ <svg
145
+ width="16"
146
+ height="16"
147
+ viewBox="0 0 24 24"
148
+ fill="none"
149
+ stroke="currentColor"
150
+ strokeWidth="2"
151
+ >
152
+ <line x1="3" y1="6" x2="21" y2="6" />
153
+ <line x1="3" y1="12" x2="21" y2="12" />
154
+ <line x1="3" y1="18" x2="21" y2="18" />
155
+ </svg>
156
+ </SvgWrapper>
157
+ );
158
+ }
159
+
160
+ export function LinkIcon() {
161
+ return (
162
+ <SvgWrapper>
163
+ <svg
164
+ width="16"
165
+ height="16"
166
+ viewBox="0 0 24 24"
167
+ fill="none"
168
+ stroke="currentColor"
169
+ strokeWidth="2"
170
+ >
171
+ <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
172
+ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
173
+ </svg>
174
+ </SvgWrapper>
175
+ );
176
+ }
177
+
178
+ export function TextColorIcon({ color }: { color?: string | null }) {
179
+ return (
180
+ <SvgWrapper>
181
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none">
182
+ <text x="12" y="14" textAnchor="middle" fontSize="14" fontWeight="bold" fill="currentColor">
183
+ A
184
+ </text>
185
+ <rect x="4" y="18" width="16" height="3" rx="1" fill={color || "currentColor"} />
186
+ </svg>
187
+ </SvgWrapper>
188
+ );
189
+ }
190
+
191
+ export function HighlightIcon({ color }: { color?: string | null }) {
192
+ return (
193
+ <SvgWrapper>
194
+ <svg
195
+ width="16"
196
+ height="16"
197
+ viewBox="0 0 24 24"
198
+ fill="none"
199
+ stroke="currentColor"
200
+ strokeWidth="2"
201
+ >
202
+ <path d="M12 20h9" />
203
+ <path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" />
204
+ {color && <rect x="2" y="18" width="8" height="4" rx="1" fill={color} stroke="none" />}
205
+ </svg>
206
+ </SvgWrapper>
207
+ );
208
+ }
209
+
210
+ export function HorizontalRuleIcon() {
211
+ return (
212
+ <SvgWrapper>
213
+ <svg
214
+ width="16"
215
+ height="16"
216
+ viewBox="0 0 24 24"
217
+ fill="none"
218
+ stroke="currentColor"
219
+ strokeWidth="2"
220
+ >
221
+ <line x1="3" y1="12" x2="21" y2="12" />
222
+ </svg>
223
+ </SvgWrapper>
224
+ );
225
+ }
226
+
227
+ export function ClearFormattingIcon() {
228
+ return (
229
+ <SvgWrapper>
230
+ <svg
231
+ width="16"
232
+ height="16"
233
+ viewBox="0 0 24 24"
234
+ fill="none"
235
+ stroke="currentColor"
236
+ strokeWidth="2"
237
+ >
238
+ <path d="M4 7h6.5l-2.5 9h-4" />
239
+ <path d="M13.5 7l-2.5 9" />
240
+ <path d="M17 7h3" />
241
+ <line x1="4" y1="20" x2="20" y2="4" strokeWidth="2.5" />
242
+ </svg>
243
+ </SvgWrapper>
244
+ );
245
+ }
246
+
247
+ export function SubscriptIcon() {
248
+ return (
249
+ <SvgWrapper>
250
+ <svg
251
+ width="16"
252
+ height="16"
253
+ viewBox="0 0 24 24"
254
+ fill="none"
255
+ stroke="currentColor"
256
+ strokeWidth="2"
257
+ >
258
+ <path d="M4 5l8 8" />
259
+ <path d="M12 5l-8 8" />
260
+ <text x="18" y="20" fontSize="10" fontWeight="bold" fill="currentColor" stroke="none">
261
+ 2
262
+ </text>
263
+ </svg>
264
+ </SvgWrapper>
265
+ );
266
+ }
267
+
268
+ export function SuperscriptIcon() {
269
+ return (
270
+ <SvgWrapper>
271
+ <svg
272
+ width="16"
273
+ height="16"
274
+ viewBox="0 0 24 24"
275
+ fill="none"
276
+ stroke="currentColor"
277
+ strokeWidth="2"
278
+ >
279
+ <path d="M4 11l8 8" />
280
+ <path d="M12 11l-8 8" />
281
+ <text x="18" y="10" fontSize="10" fontWeight="bold" fill="currentColor" stroke="none">
282
+ 2
283
+ </text>
284
+ </svg>
285
+ </SvgWrapper>
286
+ );
287
+ }
288
+
289
+ export function BulletListIcon() {
290
+ return (
291
+ <SvgWrapper>
292
+ <svg
293
+ width="16"
294
+ height="16"
295
+ viewBox="0 0 24 24"
296
+ fill="none"
297
+ stroke="currentColor"
298
+ strokeWidth="2"
299
+ >
300
+ <line x1="9" y1="6" x2="20" y2="6" />
301
+ <line x1="9" y1="12" x2="20" y2="12" />
302
+ <line x1="9" y1="18" x2="20" y2="18" />
303
+ <circle cx="4" cy="6" r="1.5" fill="currentColor" stroke="none" />
304
+ <circle cx="4" cy="12" r="1.5" fill="currentColor" stroke="none" />
305
+ <circle cx="4" cy="18" r="1.5" fill="currentColor" stroke="none" />
306
+ </svg>
307
+ </SvgWrapper>
308
+ );
309
+ }
310
+
311
+ export function OrderedListIcon() {
312
+ return (
313
+ <SvgWrapper>
314
+ <svg
315
+ width="16"
316
+ height="16"
317
+ viewBox="0 0 24 24"
318
+ fill="none"
319
+ stroke="currentColor"
320
+ strokeWidth="2"
321
+ >
322
+ <line x1="10" y1="6" x2="20" y2="6" />
323
+ <line x1="10" y1="12" x2="20" y2="12" />
324
+ <line x1="10" y1="18" x2="20" y2="18" />
325
+ <text x="4" y="8" fontSize="8" fontWeight="bold" fill="currentColor" stroke="none">
326
+ 1
327
+ </text>
328
+ <text x="4" y="14" fontSize="8" fontWeight="bold" fill="currentColor" stroke="none">
329
+ 2
330
+ </text>
331
+ <text x="4" y="20" fontSize="8" fontWeight="bold" fill="currentColor" stroke="none">
332
+ 3
333
+ </text>
334
+ </svg>
335
+ </SvgWrapper>
336
+ );
337
+ }
338
+
339
+ export function TaskListIcon() {
340
+ return (
341
+ <SvgWrapper>
342
+ <svg
343
+ width="16"
344
+ height="16"
345
+ viewBox="0 0 24 24"
346
+ fill="none"
347
+ stroke="currentColor"
348
+ strokeWidth="2"
349
+ >
350
+ <line x1="10" y1="6" x2="20" y2="6" />
351
+ <line x1="10" y1="12" x2="20" y2="12" />
352
+ <line x1="10" y1="18" x2="20" y2="18" />
353
+ <rect x="3" y="4" width="4" height="4" rx="0.5" />
354
+ <rect x="3" y="10" width="4" height="4" rx="0.5" />
355
+ <rect x="3" y="16" width="4" height="4" rx="0.5" />
356
+ <path d="M4 12l1 1 2-2" strokeWidth="1.5" />
357
+ </svg>
358
+ </SvgWrapper>
359
+ );
360
+ }
361
+
362
+ export function ImageIcon() {
363
+ return (
364
+ <SvgWrapper>
365
+ <svg
366
+ width="16"
367
+ height="16"
368
+ viewBox="0 0 24 24"
369
+ fill="none"
370
+ stroke="currentColor"
371
+ strokeWidth="2"
372
+ >
373
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
374
+ <circle cx="8.5" cy="8.5" r="1.5" />
375
+ <polyline points="21 15 16 10 5 21" />
376
+ </svg>
377
+ </SvgWrapper>
378
+ );
379
+ }
380
+
381
+ export function BlockquoteIcon() {
382
+ return (
383
+ <SvgWrapper>
384
+ <svg
385
+ width="16"
386
+ height="16"
387
+ viewBox="0 0 24 24"
388
+ fill="none"
389
+ stroke="currentColor"
390
+ strokeWidth="2"
391
+ >
392
+ <path d="M3 6h18" />
393
+ <path d="M3 12h18" />
394
+ <path d="M3 18h18" />
395
+ <rect x="2" y="4" width="2" height="16" rx="1" fill="currentColor" stroke="none" />
396
+ </svg>
397
+ </SvgWrapper>
398
+ );
399
+ }
400
+
401
+ export function CodeBlockIcon() {
402
+ return (
403
+ <SvgWrapper>
404
+ <svg
405
+ width="16"
406
+ height="16"
407
+ viewBox="0 0 24 24"
408
+ fill="none"
409
+ stroke="currentColor"
410
+ strokeWidth="2"
411
+ >
412
+ <polyline points="16 18 22 12 16 6" />
413
+ <polyline points="8 6 2 12 8 18" />
414
+ </svg>
415
+ </SvgWrapper>
416
+ );
417
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Platform-aware keyboard shortcut labels for toolbar tooltips.
3
+ */
4
+
5
+ const isMac =
6
+ typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? "");
7
+
8
+ const MOD = isMac ? "⌘" : "Ctrl+";
9
+ const SHIFT = isMac ? "⇧" : "Shift+";
10
+ const ALT = isMac ? "⌥" : "Alt+";
11
+
12
+ export function shortcut(label: string, keys?: string): string {
13
+ if (!keys) return label;
14
+ return `${label} (${keys})`;
15
+ }
16
+
17
+ export const SHORTCUTS = {
18
+ bold: shortcut("Bold", `${MOD}B`),
19
+ italic: shortcut("Italic", `${MOD}I`),
20
+ underline: shortcut("Underline", `${MOD}U`),
21
+ strike: shortcut("Strikethrough", `${MOD}${SHIFT}X`),
22
+ code: shortcut("Code", `${MOD}E`),
23
+ subscript: "Subscript",
24
+ superscript: "Superscript",
25
+ undo: shortcut("Undo", `${MOD}Z`),
26
+ redo: shortcut("Redo", `${MOD}${SHIFT}Z`),
27
+ alignLeft: shortcut("Align Left", `${MOD}${SHIFT}L`),
28
+ alignCenter: shortcut("Align Center", `${MOD}${SHIFT}E`),
29
+ alignRight: shortcut("Align Right", `${MOD}${SHIFT}R`),
30
+ alignJustify: shortcut("Justify", `${MOD}${SHIFT}J`),
31
+ blockquote: shortcut("Blockquote", `${MOD}${SHIFT}B`),
32
+ codeBlock: shortcut("Code Block", `${MOD}${ALT}C`),
33
+ bulletList: shortcut("Bullet List", `${MOD}${SHIFT}8`),
34
+ orderedList: shortcut("Ordered List", `${MOD}${SHIFT}7`),
35
+ taskList: shortcut("Task List", `${MOD}${SHIFT}9`),
36
+ link: shortcut("Link", `${MOD}K`),
37
+ horizontalRule: "Horizontal Rule",
38
+ image: "Image",
39
+ textColor: "Text Color",
40
+ highlight: "Highlight",
41
+ clearFormatting: "Clear Formatting",
42
+ } as const;
@@ -0,0 +1,118 @@
1
+ import { describe, it, expect, vi } from "vitest";
2
+ import { renderWithProviders } from "@multiplatform.one/test-utils";
3
+ import { RichEditorContext } from "../context";
4
+ import { ToolbarGroup } from "./ToolbarGroup";
5
+ import {
6
+ UndoIcon,
7
+ RedoIcon,
8
+ BoldIcon,
9
+ AlignLeftIcon,
10
+ LinkIcon,
11
+ TextColorIcon,
12
+ HighlightIcon,
13
+ BulletListIcon,
14
+ ImageIcon,
15
+ } from "./icons";
16
+
17
+ vi.mock("@multiplatform.one/forms", () => ({
18
+ Button: (props: any) => (
19
+ <button
20
+ role="button"
21
+ aria-label={props["aria-label"]}
22
+ disabled={props.disabled}
23
+ onClick={props.onPress}
24
+ data-active={props.theme === "active" ? "true" : undefined}
25
+ >
26
+ {props.children}
27
+ </button>
28
+ ),
29
+ }));
30
+
31
+ vi.mock("@multiplatform.one/components", () => ({
32
+ Tooltip: ({ children }: any) => children,
33
+ }));
34
+
35
+ // Import after mocks
36
+ const { ToolbarButton, ToolbarDropdownButton } = await import("./ToolbarButton");
37
+
38
+ describe("ToolbarButton", () => {
39
+ it("renders with required aria-label and applies active state", () => {
40
+ const onPress = vi.fn();
41
+ const { getByRole } = renderWithProviders(
42
+ <RichEditorContext.Provider size="$true" compact={false} disabled={false}>
43
+ <ToolbarButton active onPress={onPress} aria-label="Bold" tooltip="Bold">
44
+ <BoldIcon>B</BoldIcon>
45
+ </ToolbarButton>
46
+ </RichEditorContext.Provider>,
47
+ );
48
+ const button = getByRole("button");
49
+ expect(button).toBeTruthy();
50
+ expect(button.getAttribute("aria-label")).toBe("Bold");
51
+ });
52
+
53
+ it("reads size/compact from RichEditorContext", () => {
54
+ const { container } = renderWithProviders(
55
+ <RichEditorContext.Provider size="$2" compact disabled={false}>
56
+ <ToolbarButton onPress={() => {}} aria-label="Test Button">
57
+ Test
58
+ </ToolbarButton>
59
+ </RichEditorContext.Provider>,
60
+ );
61
+ expect(container.firstChild).toBeTruthy();
62
+ });
63
+ });
64
+
65
+ describe("ToolbarDropdownButton", () => {
66
+ it("renders with caret icon", () => {
67
+ const { container } = renderWithProviders(
68
+ <RichEditorContext.Provider size="$true" compact={false} disabled={false}>
69
+ <ToolbarDropdownButton onPress={() => {}} aria-label="Heading">
70
+ H1
71
+ </ToolbarDropdownButton>
72
+ </RichEditorContext.Provider>,
73
+ );
74
+ // ToolbarDropdownButton renders a caret (CaretDownIcon from phosphor)
75
+ const svgs = container.querySelectorAll("svg");
76
+ expect(svgs.length).toBeGreaterThan(0);
77
+ });
78
+ });
79
+
80
+ describe("ToolbarGroup", () => {
81
+ it("hides children when visible is false", () => {
82
+ const { container } = renderWithProviders(
83
+ <ToolbarGroup visible={false}>
84
+ <span data-testid="child">Should not render</span>
85
+ </ToolbarGroup>,
86
+ );
87
+ expect(container.querySelector("[data-testid='child']")).toBeNull();
88
+ });
89
+
90
+ it("renders children when visible is true", () => {
91
+ const { container } = renderWithProviders(
92
+ <ToolbarGroup visible>
93
+ <span data-testid="child">Should render</span>
94
+ </ToolbarGroup>,
95
+ );
96
+ expect(container.querySelector("[data-testid='child']")).toBeTruthy();
97
+ });
98
+ });
99
+
100
+ describe("icons", () => {
101
+ it("all icon components render without error", () => {
102
+ const { container } = renderWithProviders(
103
+ <>
104
+ <UndoIcon />
105
+ <RedoIcon />
106
+ <AlignLeftIcon />
107
+ <LinkIcon />
108
+ <TextColorIcon />
109
+ <HighlightIcon />
110
+ <BulletListIcon />
111
+ <ImageIcon />
112
+ </>,
113
+ );
114
+ // Each SVG icon should produce an svg element
115
+ const svgs = container.querySelectorAll("svg");
116
+ expect(svgs.length).toBeGreaterThanOrEqual(8);
117
+ });
118
+ });
@@ -0,0 +1,115 @@
1
+ import { describe, it, expect, vi } from "vitest";
2
+ import { renderWithProviders } from "@multiplatform.one/test-utils";
3
+ import { RichEditorContext } from "../context";
4
+ import { defaultEditorState } from "../types";
5
+ import { TEXT_COLORS, HIGHLIGHT_COLORS } from "../constants";
6
+ import { normalizeUrl } from "./LinkDialog";
7
+
8
+ vi.mock("@multiplatform.one/forms", () => ({
9
+ Button: (props: any) => (
10
+ <button
11
+ role="button"
12
+ aria-label={props["aria-label"]}
13
+ disabled={props.disabled}
14
+ onClick={props.onPress}
15
+ >
16
+ {props.children}
17
+ </button>
18
+ ),
19
+ }));
20
+
21
+ vi.mock("@multiplatform.one/components", () => ({
22
+ Tooltip: ({ children }: any) => children,
23
+ }));
24
+
25
+ const { TextColorPicker, HighlightColorPicker } = await import("./ColorPicker");
26
+ const { HeadingPicker } = await import("./HeadingPicker");
27
+ const { ListPicker } = await import("./ListPicker");
28
+ const { ImageDialog } = await import("./ImageDialog");
29
+
30
+ function withContext(ui: React.ReactElement) {
31
+ return (
32
+ <RichEditorContext.Provider size="$true" compact={false} disabled={false}>
33
+ {ui}
34
+ </RichEditorContext.Provider>
35
+ );
36
+ }
37
+
38
+ describe("ColorPicker", () => {
39
+ it("renders text color picker trigger button", () => {
40
+ const editorRef = { current: null };
41
+ const { getByRole } = renderWithProviders(
42
+ withContext(<TextColorPicker editorRef={editorRef} state={defaultEditorState} />),
43
+ );
44
+ const button = getByRole("button");
45
+ expect(button).toBeTruthy();
46
+ expect(button.getAttribute("aria-label")).toBe("Text Color");
47
+ });
48
+
49
+ it("renders highlight color picker trigger button", () => {
50
+ const editorRef = { current: null };
51
+ const { getByRole } = renderWithProviders(
52
+ withContext(<HighlightColorPicker editorRef={editorRef} state={defaultEditorState} />),
53
+ );
54
+ const button = getByRole("button");
55
+ expect(button).toBeTruthy();
56
+ expect(button.getAttribute("aria-label")).toBe("Highlight Color");
57
+ });
58
+
59
+ it("uses TEXT_COLORS and HIGHLIGHT_COLORS from constants", () => {
60
+ expect(TEXT_COLORS.length).toBeGreaterThan(5);
61
+ expect(HIGHLIGHT_COLORS.length).toBeGreaterThan(3);
62
+ });
63
+ });
64
+
65
+ describe("LinkDialog normalizeUrl", () => {
66
+ it("auto-prepends https:// to URLs without protocol", () => {
67
+ expect(normalizeUrl("example.com")).toBe("https://example.com");
68
+ expect(normalizeUrl("www.test.org/path")).toBe("https://www.test.org/path");
69
+ });
70
+
71
+ it("preserves URLs that already have a protocol", () => {
72
+ expect(normalizeUrl("https://example.com")).toBe("https://example.com");
73
+ expect(normalizeUrl("http://example.com")).toBe("http://example.com");
74
+ expect(normalizeUrl("mailto:user@example.com")).toBe("mailto:user@example.com");
75
+ });
76
+
77
+ it("returns empty string for empty input", () => {
78
+ expect(normalizeUrl("")).toBe("");
79
+ expect(normalizeUrl(" ")).toBe("");
80
+ });
81
+ });
82
+
83
+ describe("HeadingPicker", () => {
84
+ it("renders H1-H6 plus Paragraph options (7 total) in trigger", () => {
85
+ const editorRef = { current: null };
86
+ const { getByRole } = renderWithProviders(
87
+ withContext(<HeadingPicker editorRef={editorRef} state={defaultEditorState} />),
88
+ );
89
+ const button = getByRole("button");
90
+ expect(button).toBeTruthy();
91
+ expect(button.getAttribute("aria-label")).toBe("Heading");
92
+ });
93
+ });
94
+
95
+ describe("ListPicker", () => {
96
+ it("renders list picker trigger button", () => {
97
+ const editorRef = { current: null };
98
+ const { getByRole } = renderWithProviders(
99
+ withContext(<ListPicker editorRef={editorRef} state={defaultEditorState} />),
100
+ );
101
+ const button = getByRole("button");
102
+ expect(button).toBeTruthy();
103
+ expect(button.getAttribute("aria-label")).toBe("Lists");
104
+ });
105
+ });
106
+
107
+ describe("ImageDialog", () => {
108
+ it("renders image dialog trigger button with URL input", () => {
109
+ const editorRef = { current: null };
110
+ const { getByRole } = renderWithProviders(withContext(<ImageDialog editorRef={editorRef} />));
111
+ const button = getByRole("button");
112
+ expect(button).toBeTruthy();
113
+ expect(button.getAttribute("aria-label")).toBe("Insert Image");
114
+ });
115
+ });