@use-kona/editor 0.1.0-rc.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 (401) hide show
  1. package/README.md +23 -0
  2. package/dist/constants.d.ts +1 -0
  3. package/dist/constants.js +2 -0
  4. package/dist/core/createEditable.d.ts +7 -0
  5. package/dist/core/createEditable.js +110 -0
  6. package/dist/core/createEditor.d.ts +2 -0
  7. package/dist/core/createEditor.js +167 -0
  8. package/dist/core/deserialize.d.ts +3 -0
  9. package/dist/core/deserialize.js +33 -0
  10. package/dist/core/queries.d.ts +2 -0
  11. package/dist/core/queries.js +10 -0
  12. package/dist/core/serialize.d.ts +3 -0
  13. package/dist/core/serialize.js +13 -0
  14. package/dist/core/styles.module.js +6 -0
  15. package/dist/core/styles_module.css +29 -0
  16. package/dist/defaultValue.d.ts +4 -0
  17. package/dist/defaultValue.js +13 -0
  18. package/dist/editor.d.ts +10 -0
  19. package/dist/editor.js +43 -0
  20. package/dist/elements/BaseElement.d.ts +2 -0
  21. package/dist/elements/BaseElement.js +6 -0
  22. package/dist/examples/Backdrop.d.ts +5 -0
  23. package/dist/examples/Backdrop.js +13 -0
  24. package/dist/examples/Backdrop.module.js +5 -0
  25. package/dist/examples/Backdrop_module.css +6 -0
  26. package/dist/examples/DragBlock.d.ts +11 -0
  27. package/dist/examples/DragBlock.js +38 -0
  28. package/dist/examples/DragBlock.module.js +9 -0
  29. package/dist/examples/DragBlock_module.css +43 -0
  30. package/dist/examples/DragHandler.d.ts +2 -0
  31. package/dist/examples/DragHandler.js +44 -0
  32. package/dist/examples/DragHandler.module.js +8 -0
  33. package/dist/examples/DragHandler_module.css +18 -0
  34. package/dist/examples/Editor.d.ts +2 -0
  35. package/dist/examples/Editor.js +23 -0
  36. package/dist/examples/Editor.module.js +12 -0
  37. package/dist/examples/Editor_module.css +128 -0
  38. package/dist/examples/FloatingMenu.d.ts +17 -0
  39. package/dist/examples/FloatingMenu.js +244 -0
  40. package/dist/examples/FloatingMenu.module.js +9 -0
  41. package/dist/examples/FloatingMenu_module.css +75 -0
  42. package/dist/examples/LanguageSelector.d.ts +10 -0
  43. package/dist/examples/LanguageSelector.js +154 -0
  44. package/dist/examples/LanguageSelector.module.js +7 -0
  45. package/dist/examples/LanguageSelector_module.css +52 -0
  46. package/dist/examples/LinksHint.d.ts +7 -0
  47. package/dist/examples/LinksHint.js +50 -0
  48. package/dist/examples/LinksHint.module.js +6 -0
  49. package/dist/examples/LinksHint_module.css +28 -0
  50. package/dist/examples/Menu.d.ts +6 -0
  51. package/dist/examples/Menu.js +79 -0
  52. package/dist/examples/Menu.module.js +8 -0
  53. package/dist/examples/Menu_module.css +38 -0
  54. package/dist/examples/colors.d.ts +10 -0
  55. package/dist/examples/colors.js +12 -0
  56. package/dist/examples/getCommands.d.ts +2 -0
  57. package/dist/examples/getCommands.js +87 -0
  58. package/dist/examples/getPlugins.d.ts +2 -0
  59. package/dist/examples/getPlugins.js +127 -0
  60. package/dist/examples/getShortcuts.d.ts +2 -0
  61. package/dist/examples/getShortcuts.js +90 -0
  62. package/dist/examples/icons/bold.d.ts +2 -0
  63. package/dist/examples/icons/bold.js +27 -0
  64. package/dist/examples/icons/check.d.ts +2 -0
  65. package/dist/examples/icons/check.js +24 -0
  66. package/dist/examples/icons/chevronRight.d.ts +2 -0
  67. package/dist/examples/icons/chevronRight.js +24 -0
  68. package/dist/examples/icons/color.d.ts +2 -0
  69. package/dist/examples/icons/color.js +30 -0
  70. package/dist/examples/icons/copy.d.ts +2 -0
  71. package/dist/examples/icons/copy.js +27 -0
  72. package/dist/examples/icons/cross.d.ts +2 -0
  73. package/dist/examples/icons/cross.js +27 -0
  74. package/dist/examples/icons/drag.d.ts +2 -0
  75. package/dist/examples/icons/drag.js +39 -0
  76. package/dist/examples/icons/edit.d.ts +2 -0
  77. package/dist/examples/icons/edit.js +30 -0
  78. package/dist/examples/icons/external.d.ts +2 -0
  79. package/dist/examples/icons/external.js +30 -0
  80. package/dist/examples/icons/heading1.d.ts +2 -0
  81. package/dist/examples/icons/heading1.js +45 -0
  82. package/dist/examples/icons/heading2.d.ts +2 -0
  83. package/dist/examples/icons/heading2.js +45 -0
  84. package/dist/examples/icons/heading3.d.ts +2 -0
  85. package/dist/examples/icons/heading3.js +48 -0
  86. package/dist/examples/icons/italic.d.ts +2 -0
  87. package/dist/examples/icons/italic.js +30 -0
  88. package/dist/examples/icons/link.d.ts +2 -0
  89. package/dist/examples/icons/link.js +30 -0
  90. package/dist/examples/icons/ol.d.ts +2 -0
  91. package/dist/examples/icons/ol.js +36 -0
  92. package/dist/examples/icons/strikethrough.d.ts +2 -0
  93. package/dist/examples/icons/strikethrough.js +27 -0
  94. package/dist/examples/icons/text.d.ts +2 -0
  95. package/dist/examples/icons/text.js +22 -0
  96. package/dist/examples/icons/types.d.ts +3 -0
  97. package/dist/examples/icons/types.js +0 -0
  98. package/dist/examples/icons/ul.d.ts +2 -0
  99. package/dist/examples/icons/ul.js +39 -0
  100. package/dist/examples/icons/underline.d.ts +2 -0
  101. package/dist/examples/icons/underline.js +27 -0
  102. package/dist/examples/store.d.ts +8 -0
  103. package/dist/examples/store.js +6 -0
  104. package/dist/examples/styles.module.js +11 -0
  105. package/dist/examples/styles_module.css +78 -0
  106. package/dist/examples/text.d.ts +3 -0
  107. package/dist/examples/text.js +60 -0
  108. package/dist/examples/ui/Button/Button.d.ts +8 -0
  109. package/dist/examples/ui/Button/Button.js +15 -0
  110. package/dist/examples/ui/Button/ButtonWrapper.d.ts +4 -0
  111. package/dist/examples/ui/Button/ButtonWrapper.js +14 -0
  112. package/dist/examples/ui/Button/index.d.ts +2 -0
  113. package/dist/examples/ui/Button/index.js +3 -0
  114. package/dist/examples/ui/Button/styles.module.js +10 -0
  115. package/dist/examples/ui/Button/styles_module.css +72 -0
  116. package/dist/examples/ui/Button/types.d.ts +1 -0
  117. package/dist/examples/ui/Button/types.js +0 -0
  118. package/dist/examples/ui/Dropdown/Dropdown.d.ts +16 -0
  119. package/dist/examples/ui/Dropdown/Dropdown.js +75 -0
  120. package/dist/examples/ui/Dropdown/index.d.ts +1 -0
  121. package/dist/examples/ui/Dropdown/index.js +2 -0
  122. package/dist/examples/ui/Menu/Menu.d.ts +41 -0
  123. package/dist/examples/ui/Menu/Menu.js +404 -0
  124. package/dist/examples/ui/Menu/MenuDelimiter.d.ts +1 -0
  125. package/dist/examples/ui/Menu/MenuDelimiter.js +6 -0
  126. package/dist/examples/ui/Menu/MenuHotkey.d.ts +6 -0
  127. package/dist/examples/ui/Menu/MenuHotkey.js +12 -0
  128. package/dist/examples/ui/Menu/MenuIcon.d.ts +6 -0
  129. package/dist/examples/ui/Menu/MenuIcon.js +12 -0
  130. package/dist/examples/ui/Menu/MenuItem.d.ts +6 -0
  131. package/dist/examples/ui/Menu/MenuItem.js +17 -0
  132. package/dist/examples/ui/Menu/MenuTitle.d.ts +6 -0
  133. package/dist/examples/ui/Menu/MenuTitle.js +12 -0
  134. package/dist/examples/ui/Menu/SafeSpace.d.ts +6 -0
  135. package/dist/examples/ui/Menu/SafeSpace.js +65 -0
  136. package/dist/examples/ui/Menu/index.d.ts +2 -0
  137. package/dist/examples/ui/Menu/index.js +2 -0
  138. package/dist/examples/ui/Menu/styles.module.js +21 -0
  139. package/dist/examples/ui/Menu/styles_module.css +140 -0
  140. package/dist/examples/ui/Menu/types.d.ts +16 -0
  141. package/dist/examples/ui/Menu/types.js +0 -0
  142. package/dist/examples/ui/useMenuPosition.d.ts +18 -0
  143. package/dist/examples/ui/useMenuPosition.js +51 -0
  144. package/dist/examples/ui/useMergeRefs.d.ts +23 -0
  145. package/dist/examples/ui/useMergeRefs.js +11 -0
  146. package/dist/index.d.ts +2 -0
  147. package/dist/index.js +3 -0
  148. package/dist/plugins/AttachmentsPlugin/AttachmentsPlugin.d.ts +17 -0
  149. package/dist/plugins/AttachmentsPlugin/AttachmentsPlugin.js +37 -0
  150. package/dist/plugins/AttachmentsPlugin/index.d.ts +1 -0
  151. package/dist/plugins/AttachmentsPlugin/index.js +2 -0
  152. package/dist/plugins/AttachmentsPlugin/types.d.ts +11 -0
  153. package/dist/plugins/AttachmentsPlugin/types.js +0 -0
  154. package/dist/plugins/BasicFormattingPlugin/BasicFormattingPlugin.d.ts +20 -0
  155. package/dist/plugins/BasicFormattingPlugin/BasicFormattingPlugin.js +76 -0
  156. package/dist/plugins/BasicFormattingPlugin/index.d.ts +1 -0
  157. package/dist/plugins/BasicFormattingPlugin/index.js +2 -0
  158. package/dist/plugins/BreaksPlugin/BreaksPlugin.d.ts +15 -0
  159. package/dist/plugins/BreaksPlugin/BreaksPlugin.js +50 -0
  160. package/dist/plugins/BreaksPlugin/index.d.ts +1 -0
  161. package/dist/plugins/BreaksPlugin/index.js +2 -0
  162. package/dist/plugins/CodeBlockPlugin/CodeBlock.d.ts +9 -0
  163. package/dist/plugins/CodeBlockPlugin/CodeBlock.js +18 -0
  164. package/dist/plugins/CodeBlockPlugin/CodeBlockLine.d.ts +2 -0
  165. package/dist/plugins/CodeBlockPlugin/CodeBlockLine.js +9 -0
  166. package/dist/plugins/CodeBlockPlugin/CodeBlockPlugin.d.ts +55 -0
  167. package/dist/plugins/CodeBlockPlugin/CodeBlockPlugin.js +224 -0
  168. package/dist/plugins/CodeBlockPlugin/index.d.ts +1 -0
  169. package/dist/plugins/CodeBlockPlugin/index.js +2 -0
  170. package/dist/plugins/CodeBlockPlugin/styles.module.js +6 -0
  171. package/dist/plugins/CodeBlockPlugin/styles_module.css +12 -0
  172. package/dist/plugins/CodeBlockPlugin/types.d.ts +8 -0
  173. package/dist/plugins/CodeBlockPlugin/types.js +0 -0
  174. package/dist/plugins/CodeBlockPlugin/utils.d.ts +13 -0
  175. package/dist/plugins/CodeBlockPlugin/utils.js +87 -0
  176. package/dist/plugins/CommandsPlugin/CommandsPlugin.d.ts +11 -0
  177. package/dist/plugins/CommandsPlugin/CommandsPlugin.js +65 -0
  178. package/dist/plugins/CommandsPlugin/Menu.d.ts +11 -0
  179. package/dist/plugins/CommandsPlugin/Menu.js +153 -0
  180. package/dist/plugins/CommandsPlugin/actions.d.ts +7 -0
  181. package/dist/plugins/CommandsPlugin/actions.js +29 -0
  182. package/dist/plugins/CommandsPlugin/index.d.ts +2 -0
  183. package/dist/plugins/CommandsPlugin/index.js +2 -0
  184. package/dist/plugins/CommandsPlugin/styles.module.js +9 -0
  185. package/dist/plugins/CommandsPlugin/styles_module.css +66 -0
  186. package/dist/plugins/CommandsPlugin/types.d.ts +27 -0
  187. package/dist/plugins/CommandsPlugin/types.js +0 -0
  188. package/dist/plugins/DnDPlugin/DnDPlugin.d.ts +33 -0
  189. package/dist/plugins/DnDPlugin/DnDPlugin.js +110 -0
  190. package/dist/plugins/DnDPlugin/index.d.ts +1 -0
  191. package/dist/plugins/DnDPlugin/index.js +2 -0
  192. package/dist/plugins/DnDPlugin/styles.module.js +9 -0
  193. package/dist/plugins/DnDPlugin/styles_module.css +43 -0
  194. package/dist/plugins/FloatingMenuPlugin/FloatingMenu.d.ts +9 -0
  195. package/dist/plugins/FloatingMenuPlugin/FloatingMenu.js +89 -0
  196. package/dist/plugins/FloatingMenuPlugin/FloatingMenuPlugin.d.ts +15 -0
  197. package/dist/plugins/FloatingMenuPlugin/FloatingMenuPlugin.js +36 -0
  198. package/dist/plugins/FloatingMenuPlugin/index.d.ts +2 -0
  199. package/dist/plugins/FloatingMenuPlugin/index.js +2 -0
  200. package/dist/plugins/FloatingMenuPlugin/styles.module.js +7 -0
  201. package/dist/plugins/FloatingMenuPlugin/styles_module.css +23 -0
  202. package/dist/plugins/FloatingMenuPlugin/types.d.ts +16 -0
  203. package/dist/plugins/FloatingMenuPlugin/types.js +0 -0
  204. package/dist/plugins/HeadingsPlugin/HeadingsPlugin.d.ts +19 -0
  205. package/dist/plugins/HeadingsPlugin/HeadingsPlugin.js +64 -0
  206. package/dist/plugins/HeadingsPlugin/index.d.ts +1 -0
  207. package/dist/plugins/HeadingsPlugin/index.js +2 -0
  208. package/dist/plugins/HighlightsPlugin/HighlightsPlugin.d.ts +16 -0
  209. package/dist/plugins/HighlightsPlugin/HighlightsPlugin.js +36 -0
  210. package/dist/plugins/HighlightsPlugin/index.d.ts +1 -0
  211. package/dist/plugins/HighlightsPlugin/index.js +2 -0
  212. package/dist/plugins/LinksPlugin/Link.d.ts +11 -0
  213. package/dist/plugins/LinksPlugin/Link.js +89 -0
  214. package/dist/plugins/LinksPlugin/LinksPlugin.d.ts +17 -0
  215. package/dist/plugins/LinksPlugin/LinksPlugin.js +102 -0
  216. package/dist/plugins/LinksPlugin/constants.d.ts +1 -0
  217. package/dist/plugins/LinksPlugin/constants.js +2 -0
  218. package/dist/plugins/LinksPlugin/index.d.ts +2 -0
  219. package/dist/plugins/LinksPlugin/index.js +2 -0
  220. package/dist/plugins/LinksPlugin/styles.module.js +11 -0
  221. package/dist/plugins/LinksPlugin/styles_module.css +71 -0
  222. package/dist/plugins/LinksPlugin/types.d.ts +18 -0
  223. package/dist/plugins/LinksPlugin/types.js +0 -0
  224. package/dist/plugins/ListsPlugin/ListsPlugin.d.ts +32 -0
  225. package/dist/plugins/ListsPlugin/ListsPlugin.js +218 -0
  226. package/dist/plugins/ListsPlugin/index.d.ts +1 -0
  227. package/dist/plugins/ListsPlugin/index.js +2 -0
  228. package/dist/plugins/ListsPlugin/styles.module.js +6 -0
  229. package/dist/plugins/ListsPlugin/styles_module.css +8 -0
  230. package/dist/plugins/MenuPlugin/Menu.d.ts +2 -0
  231. package/dist/plugins/MenuPlugin/Menu.js +14 -0
  232. package/dist/plugins/MenuPlugin/MenuPlugin.d.ts +7 -0
  233. package/dist/plugins/MenuPlugin/MenuPlugin.js +19 -0
  234. package/dist/plugins/MenuPlugin/index.d.ts +1 -0
  235. package/dist/plugins/MenuPlugin/index.js +2 -0
  236. package/dist/plugins/MenuPlugin/styles.module.js +6 -0
  237. package/dist/plugins/MenuPlugin/styles_module.css +33 -0
  238. package/dist/plugins/MenuPlugin/types.d.ts +4 -0
  239. package/dist/plugins/MenuPlugin/types.js +0 -0
  240. package/dist/plugins/NodeIdPlugin/NodeIdPlugin.d.ts +15 -0
  241. package/dist/plugins/NodeIdPlugin/NodeIdPlugin.js +36 -0
  242. package/dist/plugins/NodeIdPlugin/index.d.ts +1 -0
  243. package/dist/plugins/NodeIdPlugin/index.js +2 -0
  244. package/dist/plugins/PlaceholderPlugin/PlaceholderPlugin.d.ts +16 -0
  245. package/dist/plugins/PlaceholderPlugin/PlaceholderPlugin.js +44 -0
  246. package/dist/plugins/PlaceholderPlugin/index.d.ts +1 -0
  247. package/dist/plugins/PlaceholderPlugin/index.js +2 -0
  248. package/dist/plugins/PlaceholderPlugin/styles.module.js +5 -0
  249. package/dist/plugins/PlaceholderPlugin/styles_module.css +14 -0
  250. package/dist/plugins/ShortcutsPlugin/ShortcutsPlugin.d.ts +24 -0
  251. package/dist/plugins/ShortcutsPlugin/ShortcutsPlugin.js +55 -0
  252. package/dist/plugins/ShortcutsPlugin/index.d.ts +2 -0
  253. package/dist/plugins/ShortcutsPlugin/index.js +2 -0
  254. package/dist/plugins/TableOfContentsPlugin/TableOfContentsPlugin.d.ts +18 -0
  255. package/dist/plugins/TableOfContentsPlugin/TableOfContentsPlugin.js +76 -0
  256. package/dist/plugins/TableOfContentsPlugin/index.d.ts +1 -0
  257. package/dist/plugins/TableOfContentsPlugin/index.js +2 -0
  258. package/dist/plugins/TableOfContentsPlugin/styles.module.js +10 -0
  259. package/dist/plugins/TableOfContentsPlugin/styles_module.css +114 -0
  260. package/dist/plugins/index.d.ts +16 -0
  261. package/dist/plugins/index.js +17 -0
  262. package/dist/queries/getMatchedGroups.d.ts +0 -0
  263. package/dist/queries/getMatchedGroups.js +0 -0
  264. package/dist/types.d.ts +50 -0
  265. package/dist/types.js +0 -0
  266. package/dist/utils.d.ts +2 -0
  267. package/dist/utils.js +8 -0
  268. package/package.json +71 -0
  269. package/src/constants.ts +1 -0
  270. package/src/core/createEditable.tsx +159 -0
  271. package/src/core/createEditor.ts +244 -0
  272. package/src/core/deserialize.ts +57 -0
  273. package/src/core/queries.ts +10 -0
  274. package/src/core/serialize.ts +38 -0
  275. package/src/core/styles.module.css +28 -0
  276. package/src/defaultValue.ts +10 -0
  277. package/src/editor.tsx +55 -0
  278. package/src/elements/BaseElement.tsx +5 -0
  279. package/src/examples/Backdrop.module.css +8 -0
  280. package/src/examples/Backdrop.tsx +16 -0
  281. package/src/examples/DragBlock.module.css +42 -0
  282. package/src/examples/DragBlock.tsx +57 -0
  283. package/src/examples/DragHandler.module.css +17 -0
  284. package/src/examples/DragHandler.tsx +39 -0
  285. package/src/examples/Editor.module.css +130 -0
  286. package/src/examples/Editor.tsx +26 -0
  287. package/src/examples/FloatingMenu.module.css +74 -0
  288. package/src/examples/FloatingMenu.tsx +274 -0
  289. package/src/examples/LanguageSelector.module.css +51 -0
  290. package/src/examples/LanguageSelector.tsx +99 -0
  291. package/src/examples/LinksHint.module.css +27 -0
  292. package/src/examples/LinksHint.tsx +58 -0
  293. package/src/examples/Menu.module.css +37 -0
  294. package/src/examples/Menu.tsx +80 -0
  295. package/src/examples/colors.ts +11 -0
  296. package/src/examples/getCommands.tsx +76 -0
  297. package/src/examples/getPlugins.tsx +143 -0
  298. package/src/examples/getShortcuts.ts +107 -0
  299. package/src/examples/icons/bold.tsx +20 -0
  300. package/src/examples/icons/check.tsx +19 -0
  301. package/src/examples/icons/chevronRight.tsx +19 -0
  302. package/src/examples/icons/color.tsx +23 -0
  303. package/src/examples/icons/copy.tsx +20 -0
  304. package/src/examples/icons/cross.tsx +20 -0
  305. package/src/examples/icons/drag.tsx +24 -0
  306. package/src/examples/icons/edit.tsx +21 -0
  307. package/src/examples/icons/external.tsx +21 -0
  308. package/src/examples/icons/heading1.tsx +26 -0
  309. package/src/examples/icons/heading2.tsx +26 -0
  310. package/src/examples/icons/heading3.tsx +27 -0
  311. package/src/examples/icons/italic.tsx +21 -0
  312. package/src/examples/icons/link.tsx +21 -0
  313. package/src/examples/icons/ol.tsx +23 -0
  314. package/src/examples/icons/strikethrough.tsx +20 -0
  315. package/src/examples/icons/text.tsx +18 -0
  316. package/src/examples/icons/types.ts +3 -0
  317. package/src/examples/icons/ul.tsx +24 -0
  318. package/src/examples/icons/underline.tsx +20 -0
  319. package/src/examples/store.ts +14 -0
  320. package/src/examples/styles.module.css +77 -0
  321. package/src/examples/text.tsx +133 -0
  322. package/src/examples/ui/Button/Button.tsx +34 -0
  323. package/src/examples/ui/Button/ButtonWrapper.tsx +22 -0
  324. package/src/examples/ui/Button/index.ts +2 -0
  325. package/src/examples/ui/Button/styles.module.css +75 -0
  326. package/src/examples/ui/Button/types.ts +1 -0
  327. package/src/examples/ui/Dropdown/Dropdown.tsx +101 -0
  328. package/src/examples/ui/Dropdown/index.ts +1 -0
  329. package/src/examples/ui/Menu/Menu.tsx +576 -0
  330. package/src/examples/ui/Menu/MenuDelimiter.tsx +3 -0
  331. package/src/examples/ui/Menu/MenuHotkey.tsx +17 -0
  332. package/src/examples/ui/Menu/MenuIcon.tsx +17 -0
  333. package/src/examples/ui/Menu/MenuItem.tsx +45 -0
  334. package/src/examples/ui/Menu/MenuTitle.tsx +17 -0
  335. package/src/examples/ui/Menu/SafeSpace.tsx +84 -0
  336. package/src/examples/ui/Menu/index.ts +2 -0
  337. package/src/examples/ui/Menu/styles.module.css +143 -0
  338. package/src/examples/ui/Menu/types.ts +18 -0
  339. package/src/examples/ui/useMenuPosition.ts +72 -0
  340. package/src/examples/ui/useMergeRefs.ts +39 -0
  341. package/src/index.ts +2 -0
  342. package/src/plugins/AttachmentsPlugin/AttachmentsPlugin.tsx +41 -0
  343. package/src/plugins/AttachmentsPlugin/index.ts +1 -0
  344. package/src/plugins/AttachmentsPlugin/types.ts +12 -0
  345. package/src/plugins/BasicFormattingPlugin/BasicFormattingPlugin.tsx +100 -0
  346. package/src/plugins/BasicFormattingPlugin/index.ts +1 -0
  347. package/src/plugins/BreaksPlugin/BreaksPlugin.tsx +70 -0
  348. package/src/plugins/BreaksPlugin/index.ts +1 -0
  349. package/src/plugins/CodeBlockPlugin/CodeBlock.tsx +20 -0
  350. package/src/plugins/CodeBlockPlugin/CodeBlockLine.tsx +7 -0
  351. package/src/plugins/CodeBlockPlugin/CodeBlockPlugin.tsx +304 -0
  352. package/src/plugins/CodeBlockPlugin/index.ts +1 -0
  353. package/src/plugins/CodeBlockPlugin/styles.module.css +11 -0
  354. package/src/plugins/CodeBlockPlugin/types.ts +10 -0
  355. package/src/plugins/CodeBlockPlugin/utils.ts +117 -0
  356. package/src/plugins/CommandsPlugin/CommandsPlugin.tsx +99 -0
  357. package/src/plugins/CommandsPlugin/Menu.tsx +205 -0
  358. package/src/plugins/CommandsPlugin/actions.ts +41 -0
  359. package/src/plugins/CommandsPlugin/index.ts +2 -0
  360. package/src/plugins/CommandsPlugin/styles.module.css +69 -0
  361. package/src/plugins/CommandsPlugin/types.ts +32 -0
  362. package/src/plugins/DnDPlugin/DnDPlugin.tsx +200 -0
  363. package/src/plugins/DnDPlugin/index.ts +1 -0
  364. package/src/plugins/DnDPlugin/styles.module.css +42 -0
  365. package/src/plugins/FloatingMenuPlugin/FloatingMenu.tsx +144 -0
  366. package/src/plugins/FloatingMenuPlugin/FloatingMenuPlugin.tsx +44 -0
  367. package/src/plugins/FloatingMenuPlugin/index.ts +2 -0
  368. package/src/plugins/FloatingMenuPlugin/styles.module.css +22 -0
  369. package/src/plugins/FloatingMenuPlugin/types.ts +18 -0
  370. package/src/plugins/HeadingsPlugin/HeadingsPlugin.tsx +75 -0
  371. package/src/plugins/HeadingsPlugin/index.ts +1 -0
  372. package/src/plugins/HighlightsPlugin/HighlightsPlugin.tsx +56 -0
  373. package/src/plugins/HighlightsPlugin/index.ts +1 -0
  374. package/src/plugins/LinksPlugin/Link.tsx +90 -0
  375. package/src/plugins/LinksPlugin/LinksPlugin.tsx +128 -0
  376. package/src/plugins/LinksPlugin/constants.ts +1 -0
  377. package/src/plugins/LinksPlugin/index.ts +2 -0
  378. package/src/plugins/LinksPlugin/styles.module.css +73 -0
  379. package/src/plugins/LinksPlugin/types.ts +19 -0
  380. package/src/plugins/ListsPlugin/ListsPlugin.tsx +355 -0
  381. package/src/plugins/ListsPlugin/index.ts +1 -0
  382. package/src/plugins/ListsPlugin/styles.module.css +7 -0
  383. package/src/plugins/MenuPlugin/Menu.tsx +9 -0
  384. package/src/plugins/MenuPlugin/MenuPlugin.tsx +20 -0
  385. package/src/plugins/MenuPlugin/index.ts +1 -0
  386. package/src/plugins/MenuPlugin/styles.module.css +33 -0
  387. package/src/plugins/MenuPlugin/types.ts +5 -0
  388. package/src/plugins/NodeIdPlugin/NodeIdPlugin.ts +62 -0
  389. package/src/plugins/NodeIdPlugin/index.ts +1 -0
  390. package/src/plugins/PlaceholderPlugin/PlaceholderPlugin.tsx +66 -0
  391. package/src/plugins/PlaceholderPlugin/index.ts +1 -0
  392. package/src/plugins/PlaceholderPlugin/styles.module.css +17 -0
  393. package/src/plugins/ShortcutsPlugin/ShortcutsPlugin.tsx +133 -0
  394. package/src/plugins/ShortcutsPlugin/index.ts +2 -0
  395. package/src/plugins/TableOfContentsPlugin/TableOfContentsPlugin.tsx +102 -0
  396. package/src/plugins/TableOfContentsPlugin/index.ts +1 -0
  397. package/src/plugins/TableOfContentsPlugin/styles.module.css +113 -0
  398. package/src/plugins/index.ts +20 -0
  399. package/src/queries/getMatchedGroups.ts +0 -0
  400. package/src/types.ts +87 -0
  401. package/src/utils.ts +15 -0
@@ -0,0 +1,20 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const BoldIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-bold"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M7 5h6a3.5 3.5 0 0 1 0 7h-6z" />
18
+ <path d="M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" />
19
+ </svg>
20
+ );
@@ -0,0 +1,19 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const CheckIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-check"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M5 12l5 5l10 -10" />
18
+ </svg>
19
+ );
@@ -0,0 +1,19 @@
1
+ import type { IconProps } from './types';
2
+
3
+ export const ChevronRightIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ stroke-width="1.25"
12
+ stroke-linecap="round"
13
+ stroke-linejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M9 6l6 6l-6 6" />
18
+ </svg>
19
+ );
@@ -0,0 +1,23 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const ColorIcon = ({ size }: IconProps) => {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ width={size}
8
+ height={size}
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ stroke="currentColor"
12
+ strokeWidth={1.5}
13
+ strokeLinecap="round"
14
+ strokeLinejoin="round"
15
+ className="icon icon-tabler icons-tabler-outline icon-tabler-paint"
16
+ >
17
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
18
+ <path d="M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z" />
19
+ <path d="M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2" />
20
+ <path d="M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" />
21
+ </svg>
22
+ );
23
+ };
@@ -0,0 +1,20 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const CopyIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-copy"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" />
18
+ <path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" />
19
+ </svg>
20
+ );
@@ -0,0 +1,20 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const CrossIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-x"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M18 6l-12 12" />
18
+ <path d="M6 6l12 12" />
19
+ </svg>
20
+ );
@@ -0,0 +1,24 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const DragIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-grip-vertical"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
18
+ <path d="M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
19
+ <path d="M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
20
+ <path d="M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
21
+ <path d="M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
22
+ <path d="M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
23
+ </svg>
24
+ );
@@ -0,0 +1,21 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const EditIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-edit"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1" />
18
+ <path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z" />
19
+ <path d="M16 5l3 3" />
20
+ </svg>
21
+ );
@@ -0,0 +1,21 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const ExternalIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-external-link"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6" />
18
+ <path d="M11 13l9 -9" />
19
+ <path d="M15 4h5v5" />
20
+ </svg>
21
+ );
@@ -0,0 +1,26 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const Heading1Icon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-h-1"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M19 18v-8l-2 2" />
18
+ <path d="M4 6v12" />
19
+ <path d="M12 6v12" />
20
+ <path d="M11 18h2" />
21
+ <path d="M3 18h2" />
22
+ <path d="M4 12h8" />
23
+ <path d="M3 6h2" />
24
+ <path d="M11 6h2" />
25
+ </svg>
26
+ );
@@ -0,0 +1,26 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const Heading2Icon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-h-2"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0" />
18
+ <path d="M4 6v12" />
19
+ <path d="M12 6v12" />
20
+ <path d="M11 18h2" />
21
+ <path d="M3 18h2" />
22
+ <path d="M4 12h8" />
23
+ <path d="M3 6h2" />
24
+ <path d="M11 6h2" />
25
+ </svg>
26
+ );
@@ -0,0 +1,27 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const Heading3Icon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-h-3"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M19 14a2 2 0 1 0 -2 -2" />
18
+ <path d="M17 16a2 2 0 1 0 2 -2" />
19
+ <path d="M4 6v12" />
20
+ <path d="M12 6v12" />
21
+ <path d="M11 18h2" />
22
+ <path d="M3 18h2" />
23
+ <path d="M4 12h8" />
24
+ <path d="M3 6h2" />
25
+ <path d="M11 6h2" />
26
+ </svg>
27
+ );
@@ -0,0 +1,21 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const ItalicIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-italic"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M11 5l6 0" />
18
+ <path d="M7 19l6 0" />
19
+ <path d="M14 5l-4 14" />
20
+ </svg>
21
+ );
@@ -0,0 +1,21 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const LinkIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-link"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M9 15l6 -6" />
18
+ <path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464" />
19
+ <path d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463" />
20
+ </svg>
21
+ );
@@ -0,0 +1,23 @@
1
+ import type { IconProps } from './types';
2
+
3
+ export const OlIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-list-numbers"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M11 6h9" />
18
+ <path d="M11 12h9" />
19
+ <path d="M12 18h8" />
20
+ <path d="M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" />
21
+ <path d="M6 10v-6l-2 2" />
22
+ </svg>
23
+ );
@@ -0,0 +1,20 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const StrikethroughIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M5 12l14 0" />
18
+ <path d="M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5" />
19
+ </svg>
20
+ );
@@ -0,0 +1,18 @@
1
+ import type { IconProps } from './types';
2
+
3
+ export const TextIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ strokeWidth={1.25}
13
+ viewBox="0 0 24 24"
14
+ >
15
+ <path stroke="none" d="M0 0h24v24H0z" />
16
+ <path d="M4 6h16M4 12h10M4 18h14" />
17
+ </svg>
18
+ );
@@ -0,0 +1,3 @@
1
+ export type IconProps = {
2
+ size?: number;
3
+ };
@@ -0,0 +1,24 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const UlIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-list"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M9 6l11 0" />
18
+ <path d="M9 12l11 0" />
19
+ <path d="M9 18l11 0" />
20
+ <path d="M5 6l0 .01" />
21
+ <path d="M5 12l0 .01" />
22
+ <path d="M5 18l0 .01" />
23
+ </svg>
24
+ );
@@ -0,0 +1,20 @@
1
+ import { IconProps } from './types';
2
+
3
+ export const UnderlineIcon = ({ size }: IconProps) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ strokeWidth={1.5}
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ className="icon icon-tabler icons-tabler-outline icon-tabler-underline"
15
+ >
16
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
17
+ <path d="M7 5v5a5 5 0 0 0 10 0v-5" />
18
+ <path d="M5 19h14" />
19
+ </svg>
20
+ );
@@ -0,0 +1,14 @@
1
+ import { map } from 'nanostores';
2
+
3
+ type FloatingMenuMode = 'main' | 'link' | 'colors';
4
+
5
+ type Store = {
6
+ isFloatingMenuOpen: boolean;
7
+ floatingMenuMode: FloatingMenuMode;
8
+ url?: string;
9
+ };
10
+
11
+ export const $store = map<Store>({
12
+ isFloatingMenuOpen: false,
13
+ floatingMenuMode: 'main',
14
+ });
@@ -0,0 +1,77 @@
1
+ body {
2
+ --background-color: #fff;
3
+ --kona-editor-background-color: #fff;
4
+ --text-color: #444;
5
+ --kona-editor-text-color: #444;
6
+ --border-color: #ddd;
7
+ --kona-editor-border-color: #ddd;
8
+ }
9
+
10
+ :global(body.dark-theme) {
11
+ background-color: #222;
12
+ color: #eee;
13
+ --background-color: #222;
14
+ --text-color: #eee;
15
+ --border-color: #000;
16
+ }
17
+
18
+ .root {
19
+ width: 600px;
20
+ height: calc(100vh - 128px * 2);
21
+ overflow: hidden;
22
+ max-height: 100vh;
23
+ margin: 32px auto;
24
+ border: 1px solid var(--border-color);
25
+ border-radius: 4px;
26
+
27
+ [role="textbox"] {
28
+ outline: none;
29
+ }
30
+ }
31
+
32
+ .menu {
33
+ padding: 8px;
34
+ display: flex;
35
+ column-gap: 4px;
36
+ }
37
+
38
+ .button {
39
+ width: 24px;
40
+ height: 24px;
41
+ border-radius: 4px;
42
+ cursor: pointer;
43
+ padding: 0;
44
+ margin: 0;
45
+ outline: none;
46
+ background-color: transparent;
47
+ border: none;
48
+ display: inline-flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ color: inherit;
52
+ transition: background-color 0.25s;
53
+ }
54
+
55
+ .button.active {
56
+ background-color: #eee;
57
+ }
58
+
59
+ .divider {
60
+ display: inline-block;
61
+ background-color: #ccc;
62
+ width: 1px;
63
+ height: 24px;
64
+ }
65
+
66
+ .floating {
67
+ height: 24px;
68
+ }
69
+
70
+ .hint {
71
+ background-color: #fff;
72
+ color: #444;
73
+ padding: 2px;
74
+ border-radius: 4px;
75
+ border: 1px solid #ccc;
76
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06);
77
+ }
@@ -0,0 +1,133 @@
1
+ /** @jsxRuntime classic */
2
+ /** @jsx jsx */
3
+
4
+ import {
5
+ createHyperscript,
6
+ createText,
7
+ type HyperscriptShorthands,
8
+ } from 'slate-hyperscript';
9
+ import {
10
+ CodeBlockPlugin,
11
+ HeadingsPlugin,
12
+ LinksPlugin,
13
+ ListsPlugin,
14
+ } from '../plugins';
15
+
16
+ const elements: HyperscriptShorthands = {
17
+ paragraph: { type: 'paragraph' },
18
+ heading1: { type: HeadingsPlugin.HeadingLevel1 },
19
+ heading2: { type: HeadingsPlugin.HeadingLevel2 },
20
+ heading3: { type: HeadingsPlugin.HeadingLevel3 },
21
+ numberedList: { type: ListsPlugin.NUMBERED_LIST_ELEMENT },
22
+ bulletedList: { type: ListsPlugin.BULLETED_LIST_ELEMENT },
23
+ listItem: { type: ListsPlugin.LIST_ITEM_ELEMENT },
24
+ codeBlock: { type: CodeBlockPlugin.CODE_ELEMENT },
25
+ codeBlockLine: { type: CodeBlockPlugin.CODE_LINE_ELEMENT },
26
+ hlink: { type: LinksPlugin.LINK_TYPE },
27
+ };
28
+
29
+ const creators = {
30
+ htext: createText,
31
+ };
32
+
33
+ const jsx = createHyperscript({ elements, creators });
34
+
35
+ export const text = (
36
+ <fragment>
37
+ <heading1>About</heading1>
38
+ <paragraph>
39
+ <htext bold italic>
40
+ Kona Editor
41
+ </htext>{' '}
42
+ is a text editor based on Slate.js that I use in{' '}
43
+ <hlink url="https://kona.to">Kona application</hlink> for notes and event
44
+ descriptions. I decided to open-source the editor for a few reasons:
45
+ </paragraph>
46
+ <numberedList>
47
+ <listItem>
48
+ I had a lot of <htext strikethrough>difficulties</htext> fun while
49
+ building this editor and there were always not enough examples of how to
50
+ do it right. I wanted to make a little contribution to the community, so
51
+ others could use my code as a reference.
52
+ </listItem>
53
+ <listItem>
54
+ I have always wanted to try to build something open-sourced, but there
55
+ have not been enough good ideas on what to build. I think that an editor
56
+ is a pretty decent starting point.
57
+ </listItem>
58
+ </numberedList>
59
+ <heading2>Usage</heading2>
60
+ <codeBlock language="tsx">
61
+ <codeBlockLine>{`import { KonaEditor } from '@use-kona/editor';`}</codeBlockLine>
62
+ <codeBlockLine> </codeBlockLine>
63
+ <codeBlockLine>{`const App = () => {`}</codeBlockLine>
64
+ <codeBlockLine>{` return (`}</codeBlockLine>
65
+ <codeBlockLine>{` <KonaEditor`}</codeBlockLine>
66
+ <codeBlockLine>{` initialValue={initialValue}`}</codeBlockLine>
67
+ <codeBlockLine>{` plugins={plugins}`}</codeBlockLine>
68
+ <codeBlockLine>{` onChange={handleChange}`}</codeBlockLine>
69
+ <codeBlockLine>{` />`}</codeBlockLine>
70
+ <codeBlockLine>{` )`}</codeBlockLine>
71
+ <codeBlockLine>{`}`}</codeBlockLine>
72
+ </codeBlock>
73
+ <paragraph>
74
+ Defining the list of plugins might be a little tricky, but I've tried to
75
+ cover everything you'll need in docs.
76
+ </paragraph>
77
+ <heading2>List of plugins</heading2>
78
+ <heading3>BasicFormattingPlugin</heading3>
79
+ <paragraph>
80
+ Allows to use <htext bold>bold</htext>, <htext italic>italic</htext>,{' '}
81
+ <htext underline>underlined</htext> and{' '}
82
+ <htext strikethrough>strikethrough</htext> text
83
+ </paragraph>
84
+
85
+ <heading3>BreaksPlugin</heading3>
86
+ <paragraph>
87
+ Overrides default Slate behavior by breaking custom block types when user
88
+ presses Enter.
89
+ </paragraph>
90
+
91
+ <heading3>CodeBlockPlugin</heading3>
92
+ <paragraph>Adds support for code blocks.</paragraph>
93
+
94
+ <heading3>CommandsPlugin</heading3>
95
+ <paragraph>Adds Notion-style menu with custom list of commands</paragraph>
96
+
97
+ <heading3>DnDPlugin</heading3>
98
+ <paragraph>Allows reordering blocks by drag'n'dropping them</paragraph>
99
+
100
+ <heading3>FloatingMenuPlugin</heading3>
101
+ <paragraph>Adds menu which is shown when user selects a text</paragraph>
102
+
103
+ <heading3>HeadingsPlugin</heading3>
104
+ <paragraph>Adds three levels of headings</paragraph>
105
+
106
+ <heading3>HighlightsPlugin</heading3>
107
+ <paragraph>Allows highlighting selected text with a custom color</paragraph>
108
+
109
+ <heading3>LinksPlugin</heading3>
110
+ <paragraph>
111
+ Gives user ability to convert the selected text into a link
112
+ </paragraph>
113
+
114
+ <heading3>MenuPlugin</heading3>
115
+ <paragraph>Adds pinned to the top menu with custom commands</paragraph>
116
+
117
+ <heading3>NodeIdPlugin</heading3>
118
+ <paragraph>Assigns a unique id to each block</paragraph>
119
+
120
+ <heading3>PlaceholderPlugin</heading3>
121
+ <paragraph>
122
+ Allows to setup a custom placeholder for the selected line
123
+ </paragraph>
124
+
125
+ <heading3>ShortcutsPlugin</heading3>
126
+ <paragraph>
127
+ Converts some popular markdown shortcuts to a custom node
128
+ </paragraph>
129
+
130
+ <heading3>TableOfContentsPlugin</heading3>
131
+ <paragraph>Shows a quick map of headings inside the document</paragraph>
132
+ </fragment>
133
+ );