@use-kona/editor 0.1.2 → 0.1.4

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 (226) hide show
  1. package/README.md +28 -17
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +1 -2
  4. package/dist/plugins/CodeBlockPlugin/CodeBlockPlugin.js +38 -37
  5. package/dist/plugins/CodeBlockPlugin/index.d.ts +1 -0
  6. package/dist/plugins/EmojiPlugin/EmojiPlugin.d.ts +28 -0
  7. package/dist/plugins/EmojiPlugin/EmojiPlugin.js +83 -0
  8. package/dist/plugins/EmojiPlugin/Menu.d.ts +7 -0
  9. package/dist/plugins/EmojiPlugin/Menu.js +51 -0
  10. package/dist/plugins/EmojiPlugin/index.d.ts +1 -0
  11. package/dist/plugins/EmojiPlugin/index.js +2 -0
  12. package/dist/plugins/EmojiPlugin/styles.module.js +7 -0
  13. package/dist/plugins/EmojiPlugin/styles_module.css +11 -0
  14. package/dist/plugins/EmojiPlugin/types.d.ts +7 -0
  15. package/dist/plugins/FloatingMenuPlugin/FloatingMenu.js +15 -28
  16. package/dist/plugins/FloatingMenuPlugin/types.d.ts +4 -1
  17. package/dist/plugins/HighlightsPlugin/HighlightsPlugin.d.ts +1 -0
  18. package/dist/plugins/HighlightsPlugin/HighlightsPlugin.js +3 -0
  19. package/dist/plugins/ListsPlugin/styles_module.css +4 -0
  20. package/dist/plugins/PlaceholderPlugin/PlaceholderPlugin.js +6 -3
  21. package/dist/plugins/PlaceholderPlugin/styles.module.js +1 -0
  22. package/dist/plugins/PlaceholderPlugin/styles_module.css +4 -0
  23. package/dist/plugins/index.d.ts +2 -1
  24. package/dist/plugins/index.js +2 -1
  25. package/package.json +12 -8
  26. package/src/index.ts +0 -1
  27. package/src/plugins/CodeBlockPlugin/CodeBlockPlugin.tsx +51 -48
  28. package/src/plugins/CodeBlockPlugin/index.ts +1 -0
  29. package/src/plugins/EmojiPlugin/EmojiPlugin.tsx +116 -0
  30. package/src/plugins/EmojiPlugin/Menu.tsx +74 -0
  31. package/src/plugins/EmojiPlugin/index.ts +1 -0
  32. package/src/plugins/EmojiPlugin/styles.module.css +10 -0
  33. package/src/plugins/EmojiPlugin/types.ts +5 -0
  34. package/src/plugins/FloatingMenuPlugin/FloatingMenu.tsx +13 -22
  35. package/src/plugins/FloatingMenuPlugin/types.ts +4 -1
  36. package/src/plugins/HighlightsPlugin/HighlightsPlugin.tsx +4 -0
  37. package/src/plugins/ListsPlugin/styles.module.css +4 -0
  38. package/src/plugins/PlaceholderPlugin/PlaceholderPlugin.tsx +13 -3
  39. package/src/plugins/PlaceholderPlugin/styles.module.css +2 -2
  40. package/src/plugins/index.ts +2 -1
  41. package/dist/examples/Backdrop.d.ts +0 -5
  42. package/dist/examples/Backdrop.js +0 -13
  43. package/dist/examples/Backdrop.module.js +0 -5
  44. package/dist/examples/Backdrop_module.css +0 -6
  45. package/dist/examples/CodeBlock.d.ts +0 -12
  46. package/dist/examples/CodeBlock.js +0 -163
  47. package/dist/examples/CodeBlock.module.js +0 -9
  48. package/dist/examples/CodeBlock_module.css +0 -66
  49. package/dist/examples/DragBlock.d.ts +0 -11
  50. package/dist/examples/DragBlock.js +0 -38
  51. package/dist/examples/DragBlock.module.js +0 -9
  52. package/dist/examples/DragBlock_module.css +0 -43
  53. package/dist/examples/DragHandler.d.ts +0 -2
  54. package/dist/examples/DragHandler.js +0 -44
  55. package/dist/examples/DragHandler.module.js +0 -8
  56. package/dist/examples/DragHandler_module.css +0 -18
  57. package/dist/examples/Editor.d.ts +0 -8
  58. package/dist/examples/Editor.js +0 -44
  59. package/dist/examples/Editor.module.js +0 -12
  60. package/dist/examples/Editor_module.css +0 -127
  61. package/dist/examples/FloatingMenu.d.ts +0 -17
  62. package/dist/examples/FloatingMenu.js +0 -244
  63. package/dist/examples/FloatingMenu.module.js +0 -9
  64. package/dist/examples/FloatingMenu_module.css +0 -75
  65. package/dist/examples/LinksHint.d.ts +0 -7
  66. package/dist/examples/LinksHint.js +0 -50
  67. package/dist/examples/LinksHint.module.js +0 -6
  68. package/dist/examples/LinksHint_module.css +0 -28
  69. package/dist/examples/Menu.d.ts +0 -6
  70. package/dist/examples/Menu.js +0 -79
  71. package/dist/examples/Menu.module.js +0 -8
  72. package/dist/examples/Menu_module.css +0 -38
  73. package/dist/examples/colors.d.ts +0 -10
  74. package/dist/examples/colors.js +0 -12
  75. package/dist/examples/getCommands.d.ts +0 -2
  76. package/dist/examples/getCommands.js +0 -87
  77. package/dist/examples/getPlugins.d.ts +0 -2
  78. package/dist/examples/getPlugins.js +0 -127
  79. package/dist/examples/getShortcuts.d.ts +0 -2
  80. package/dist/examples/getShortcuts.js +0 -90
  81. package/dist/examples/icons/bold.d.ts +0 -2
  82. package/dist/examples/icons/bold.js +0 -27
  83. package/dist/examples/icons/check.d.ts +0 -2
  84. package/dist/examples/icons/check.js +0 -24
  85. package/dist/examples/icons/chevronRight.d.ts +0 -2
  86. package/dist/examples/icons/chevronRight.js +0 -24
  87. package/dist/examples/icons/color.d.ts +0 -2
  88. package/dist/examples/icons/color.js +0 -30
  89. package/dist/examples/icons/copy.d.ts +0 -2
  90. package/dist/examples/icons/copy.js +0 -27
  91. package/dist/examples/icons/cross.d.ts +0 -2
  92. package/dist/examples/icons/cross.js +0 -27
  93. package/dist/examples/icons/drag.d.ts +0 -2
  94. package/dist/examples/icons/drag.js +0 -39
  95. package/dist/examples/icons/edit.d.ts +0 -2
  96. package/dist/examples/icons/edit.js +0 -30
  97. package/dist/examples/icons/external.d.ts +0 -2
  98. package/dist/examples/icons/external.js +0 -30
  99. package/dist/examples/icons/heading1.d.ts +0 -2
  100. package/dist/examples/icons/heading1.js +0 -45
  101. package/dist/examples/icons/heading2.d.ts +0 -2
  102. package/dist/examples/icons/heading2.js +0 -45
  103. package/dist/examples/icons/heading3.d.ts +0 -2
  104. package/dist/examples/icons/heading3.js +0 -48
  105. package/dist/examples/icons/italic.d.ts +0 -2
  106. package/dist/examples/icons/italic.js +0 -30
  107. package/dist/examples/icons/link.d.ts +0 -2
  108. package/dist/examples/icons/link.js +0 -30
  109. package/dist/examples/icons/ol.d.ts +0 -2
  110. package/dist/examples/icons/ol.js +0 -36
  111. package/dist/examples/icons/strikethrough.d.ts +0 -2
  112. package/dist/examples/icons/strikethrough.js +0 -27
  113. package/dist/examples/icons/text.d.ts +0 -2
  114. package/dist/examples/icons/text.js +0 -22
  115. package/dist/examples/icons/types.d.ts +0 -3
  116. package/dist/examples/icons/ul.d.ts +0 -2
  117. package/dist/examples/icons/ul.js +0 -39
  118. package/dist/examples/icons/underline.d.ts +0 -2
  119. package/dist/examples/icons/underline.js +0 -27
  120. package/dist/examples/store.d.ts +0 -8
  121. package/dist/examples/store.js +0 -6
  122. package/dist/examples/styles.module.js +0 -11
  123. package/dist/examples/styles_module.css +0 -78
  124. package/dist/examples/text.d.ts +0 -3
  125. package/dist/examples/text.js +0 -60
  126. package/dist/examples/ui/Button/Button.d.ts +0 -8
  127. package/dist/examples/ui/Button/Button.js +0 -15
  128. package/dist/examples/ui/Button/ButtonWrapper.d.ts +0 -4
  129. package/dist/examples/ui/Button/ButtonWrapper.js +0 -14
  130. package/dist/examples/ui/Button/index.d.ts +0 -2
  131. package/dist/examples/ui/Button/index.js +0 -3
  132. package/dist/examples/ui/Button/styles.module.js +0 -10
  133. package/dist/examples/ui/Button/styles_module.css +0 -72
  134. package/dist/examples/ui/Button/types.d.ts +0 -1
  135. package/dist/examples/ui/Button/types.js +0 -0
  136. package/dist/examples/ui/Dropdown/Dropdown.d.ts +0 -16
  137. package/dist/examples/ui/Dropdown/Dropdown.js +0 -75
  138. package/dist/examples/ui/Dropdown/index.d.ts +0 -1
  139. package/dist/examples/ui/Dropdown/index.js +0 -2
  140. package/dist/examples/ui/Menu/Menu.d.ts +0 -41
  141. package/dist/examples/ui/Menu/Menu.js +0 -404
  142. package/dist/examples/ui/Menu/MenuDelimiter.d.ts +0 -1
  143. package/dist/examples/ui/Menu/MenuDelimiter.js +0 -6
  144. package/dist/examples/ui/Menu/MenuHotkey.d.ts +0 -6
  145. package/dist/examples/ui/Menu/MenuHotkey.js +0 -12
  146. package/dist/examples/ui/Menu/MenuIcon.d.ts +0 -6
  147. package/dist/examples/ui/Menu/MenuIcon.js +0 -12
  148. package/dist/examples/ui/Menu/MenuItem.d.ts +0 -6
  149. package/dist/examples/ui/Menu/MenuItem.js +0 -17
  150. package/dist/examples/ui/Menu/MenuTitle.d.ts +0 -6
  151. package/dist/examples/ui/Menu/MenuTitle.js +0 -12
  152. package/dist/examples/ui/Menu/SafeSpace.d.ts +0 -6
  153. package/dist/examples/ui/Menu/SafeSpace.js +0 -65
  154. package/dist/examples/ui/Menu/index.d.ts +0 -2
  155. package/dist/examples/ui/Menu/index.js +0 -2
  156. package/dist/examples/ui/Menu/styles.module.js +0 -21
  157. package/dist/examples/ui/Menu/styles_module.css +0 -140
  158. package/dist/examples/ui/Menu/types.d.ts +0 -16
  159. package/dist/examples/ui/Menu/types.js +0 -0
  160. package/dist/examples/ui/useMenuPosition.d.ts +0 -18
  161. package/dist/examples/ui/useMenuPosition.js +0 -51
  162. package/dist/examples/ui/useMergeRefs.d.ts +0 -23
  163. package/dist/examples/ui/useMergeRefs.js +0 -11
  164. package/src/examples/Backdrop.module.css +0 -8
  165. package/src/examples/Backdrop.tsx +0 -16
  166. package/src/examples/CodeBlock.module.css +0 -65
  167. package/src/examples/CodeBlock.tsx +0 -109
  168. package/src/examples/DragBlock.module.css +0 -42
  169. package/src/examples/DragBlock.tsx +0 -57
  170. package/src/examples/DragHandler.module.css +0 -17
  171. package/src/examples/DragHandler.tsx +0 -39
  172. package/src/examples/Editor.module.css +0 -129
  173. package/src/examples/Editor.tsx +0 -68
  174. package/src/examples/FloatingMenu.module.css +0 -74
  175. package/src/examples/FloatingMenu.tsx +0 -274
  176. package/src/examples/LinksHint.module.css +0 -27
  177. package/src/examples/LinksHint.tsx +0 -58
  178. package/src/examples/Menu.module.css +0 -37
  179. package/src/examples/Menu.tsx +0 -80
  180. package/src/examples/colors.ts +0 -11
  181. package/src/examples/getCommands.tsx +0 -76
  182. package/src/examples/getPlugins.tsx +0 -143
  183. package/src/examples/getShortcuts.ts +0 -107
  184. package/src/examples/icons/bold.tsx +0 -20
  185. package/src/examples/icons/check.tsx +0 -19
  186. package/src/examples/icons/chevronRight.tsx +0 -19
  187. package/src/examples/icons/color.tsx +0 -23
  188. package/src/examples/icons/copy.tsx +0 -20
  189. package/src/examples/icons/cross.tsx +0 -20
  190. package/src/examples/icons/drag.tsx +0 -24
  191. package/src/examples/icons/edit.tsx +0 -21
  192. package/src/examples/icons/external.tsx +0 -21
  193. package/src/examples/icons/heading1.tsx +0 -26
  194. package/src/examples/icons/heading2.tsx +0 -26
  195. package/src/examples/icons/heading3.tsx +0 -27
  196. package/src/examples/icons/italic.tsx +0 -21
  197. package/src/examples/icons/link.tsx +0 -21
  198. package/src/examples/icons/ol.tsx +0 -23
  199. package/src/examples/icons/strikethrough.tsx +0 -20
  200. package/src/examples/icons/text.tsx +0 -18
  201. package/src/examples/icons/types.ts +0 -3
  202. package/src/examples/icons/ul.tsx +0 -24
  203. package/src/examples/icons/underline.tsx +0 -20
  204. package/src/examples/store.ts +0 -14
  205. package/src/examples/styles.module.css +0 -77
  206. package/src/examples/text.tsx +0 -133
  207. package/src/examples/ui/Button/Button.tsx +0 -34
  208. package/src/examples/ui/Button/ButtonWrapper.tsx +0 -22
  209. package/src/examples/ui/Button/index.ts +0 -2
  210. package/src/examples/ui/Button/styles.module.css +0 -75
  211. package/src/examples/ui/Button/types.ts +0 -1
  212. package/src/examples/ui/Dropdown/Dropdown.tsx +0 -101
  213. package/src/examples/ui/Dropdown/index.ts +0 -1
  214. package/src/examples/ui/Menu/Menu.tsx +0 -576
  215. package/src/examples/ui/Menu/MenuDelimiter.tsx +0 -3
  216. package/src/examples/ui/Menu/MenuHotkey.tsx +0 -17
  217. package/src/examples/ui/Menu/MenuIcon.tsx +0 -17
  218. package/src/examples/ui/Menu/MenuItem.tsx +0 -45
  219. package/src/examples/ui/Menu/MenuTitle.tsx +0 -17
  220. package/src/examples/ui/Menu/SafeSpace.tsx +0 -84
  221. package/src/examples/ui/Menu/index.ts +0 -2
  222. package/src/examples/ui/Menu/styles.module.css +0 -143
  223. package/src/examples/ui/Menu/types.ts +0 -18
  224. package/src/examples/ui/useMenuPosition.ts +0 -72
  225. package/src/examples/ui/useMergeRefs.ts +0 -39
  226. /package/dist/{examples/icons → plugins/EmojiPlugin}/types.js +0 -0
@@ -1,9 +0,0 @@
1
- import "./CodeBlock_module.css";
2
- const CodeBlock_module = {
3
- root: "root-qalHKY",
4
- button: "button-NFVN8i",
5
- menu: "menu-tWodT1",
6
- content: "content-vvTcTm",
7
- customMenu: "customMenu-PLCVVP"
8
- };
9
- export { CodeBlock_module as default };
@@ -1,66 +0,0 @@
1
- .root-qalHKY {
2
- background-color: var(--kona-editor-alt-background-color);
3
- border-radius: 8px;
4
- flex-direction: column;
5
- padding: 4px;
6
- display: flex;
7
- }
8
-
9
- .button-NFVN8i {
10
- cursor: pointer;
11
- background-color: #0000;
12
- border-radius: 4px;
13
- outline: none;
14
- justify-content: center;
15
- align-items: center;
16
- width: 20px;
17
- height: 20px;
18
- margin: 0;
19
- padding: 0;
20
- display: inline-flex;
21
-
22
- &:active {
23
- transform: scale(.9);
24
- }
25
- }
26
-
27
- .menu-tWodT1 {
28
- justify-content: space-between;
29
- column-gap: 4px;
30
- padding: 4px 0;
31
- display: flex;
32
- }
33
-
34
- .content-vvTcTm {
35
- background-color: var(--kona-editor-background-color);
36
- border-radius: 6px;
37
- padding: 8px 4px;
38
- font-size: 14px;
39
- }
40
-
41
- .customMenu-PLCVVP {
42
- background-color: var(--kona-editor-background-color);
43
- border: 1px solid var(--kona-editor-border-color);
44
- z-index: 21;
45
- border-radius: 8px;
46
- width: 200px;
47
- max-height: 250px;
48
- font-size: 12px;
49
- position: absolute;
50
- overflow-y: auto;
51
- box-shadow: 0 1px 3px #00000006;
52
-
53
- &::-webkit-scrollbar {
54
- width: 6px;
55
- }
56
-
57
- &::-webkit-scrollbar-track {
58
- background: none;
59
- }
60
-
61
- &::-webkit-scrollbar-thumb {
62
- background-color: #00000040;
63
- border-radius: 10px;
64
- }
65
- }
66
-
@@ -1,11 +0,0 @@
1
- import type { ConnectDragPreview, ConnectDragSource, ConnectDropTarget } from 'react-dnd';
2
- import type { RenderElementProps } from 'slate-react';
3
- type Props = {
4
- props: RenderElementProps;
5
- dragRef: ConnectDragSource;
6
- dropRef: ConnectDropTarget;
7
- previewRef: ConnectDragPreview;
8
- position: 'top' | 'bottom' | null;
9
- };
10
- export declare const DragBlock: (props: Props) => import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1,38 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import clsx from "clsx";
3
- import DragBlock_module from "./DragBlock.module.js";
4
- import { DragHandler } from "./DragHandler.js";
5
- const DragBlock = (props)=>{
6
- const { props: { attributes, element, children }, dragRef: drag, dropRef: drop, previewRef: preview, position } = props;
7
- return /*#__PURE__*/ jsx("div", {
8
- className: clsx(DragBlock_module.root, {
9
- [DragBlock_module.top]: 'top' === position,
10
- [DragBlock_module.bottom]: 'bottom' === position
11
- }),
12
- ...attributes,
13
- children: /*#__PURE__*/ jsxs("div", {
14
- className: DragBlock_module.block,
15
- ref: (e)=>{
16
- drop(preview(e));
17
- },
18
- children: [
19
- /*#__PURE__*/ jsx("div", {
20
- className: DragBlock_module.drag,
21
- ref: (element)=>{
22
- drag(element);
23
- },
24
- contentEditable: false,
25
- children: /*#__PURE__*/ jsx(DragHandler, {
26
- attributes: attributes,
27
- element: element,
28
- children: children
29
- })
30
- }),
31
- /*#__PURE__*/ jsx("div", {
32
- children: children
33
- })
34
- ]
35
- })
36
- });
37
- };
38
- export { DragBlock };
@@ -1,9 +0,0 @@
1
- import "./DragBlock_module.css";
2
- const DragBlock_module = {
3
- root: "root-QYAUnT",
4
- top: "top-qIwygJ",
5
- bottom: "bottom-K22AI8",
6
- drag: "drag-v0MSZ1",
7
- block: "block-y_k_tl"
8
- };
9
- export { DragBlock_module as default };
@@ -1,43 +0,0 @@
1
- .root-QYAUnT {
2
- border-top: 2px solid #0000;
3
- border-bottom: 2px solid #0000;
4
- position: relative;
5
- }
6
-
7
- .top-qIwygJ {
8
- border-top: 2px solid #3498db;
9
- }
10
-
11
- .bottom-K22AI8 {
12
- border-bottom: 2px solid #3498db;
13
- }
14
-
15
- .drag-v0MSZ1 {
16
- vertical-align: baseline;
17
- cursor: move;
18
- opacity: 0;
19
- width: 16px;
20
- line-height: 1.2;
21
- transition: opacity .25s;
22
- display: inline-block;
23
- }
24
-
25
- .block-y_k_tl {
26
- border-radius: 4px;
27
- grid-template-columns: 16px 1fr;
28
- align-items: start;
29
- column-gap: 8px;
30
- padding: 4px 8px;
31
- transition: background-color .25s;
32
- display: grid;
33
- position: relative;
34
-
35
- &:hover {
36
- background-color: #00000004;
37
- }
38
-
39
- &:hover .drag-v0MSZ1 {
40
- opacity: 1;
41
- }
42
- }
43
-
@@ -1,2 +0,0 @@
1
- import type { RenderElementProps } from 'slate-react';
2
- export declare const DragHandler: (props: RenderElementProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,44 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { HeadingsPlugin, ListsPlugin } from "../plugins/index.js";
3
- import DragHandler_module from "./DragHandler.module.js";
4
- import { DragIcon } from "./icons/drag.js";
5
- const DragHandler = (props)=>{
6
- switch(props.element.type){
7
- case ListsPlugin.LIST_ITEM_ELEMENT:
8
- return /*#__PURE__*/ jsx("div", {
9
- className: DragHandler_module.dragHandler,
10
- children: /*#__PURE__*/ jsx(DragIcon, {
11
- size: 16
12
- })
13
- });
14
- case HeadingsPlugin.HeadingLevel1:
15
- return /*#__PURE__*/ jsx("div", {
16
- className: DragHandler_module.dragHandlerHeading1,
17
- children: /*#__PURE__*/ jsx(DragIcon, {
18
- size: 16
19
- })
20
- });
21
- case HeadingsPlugin.HeadingLevel2:
22
- return /*#__PURE__*/ jsx("div", {
23
- className: DragHandler_module.dragHandlerHeading2,
24
- children: /*#__PURE__*/ jsx(DragIcon, {
25
- size: 16
26
- })
27
- });
28
- case HeadingsPlugin.HeadingLevel3:
29
- return /*#__PURE__*/ jsx("div", {
30
- className: DragHandler_module.dragHandlerHeading3,
31
- children: /*#__PURE__*/ jsx(DragIcon, {
32
- size: 16
33
- })
34
- });
35
- default:
36
- return /*#__PURE__*/ jsx("div", {
37
- className: DragHandler_module.dragHandler,
38
- children: /*#__PURE__*/ jsx(DragIcon, {
39
- size: 16
40
- })
41
- });
42
- }
43
- };
44
- export { DragHandler };
@@ -1,8 +0,0 @@
1
- import "./DragHandler_module.css";
2
- const DragHandler_module = {
3
- dragHandler: "dragHandler-H8B8NE",
4
- dragHandlerHeading1: "dragHandlerHeading1-MaU64L",
5
- dragHandlerHeading2: "dragHandlerHeading2-e8kwqj",
6
- dragHandlerHeading3: "dragHandlerHeading3-Yd2WHq"
7
- };
8
- export { DragHandler_module as default };
@@ -1,18 +0,0 @@
1
- .dragHandler-H8B8NE {
2
- cursor: grab;
3
- position: absolute;
4
- top: 9px;
5
- }
6
-
7
- .dragHandlerHeading1-MaU64L {
8
- top: 10px;
9
- }
10
-
11
- .dragHandlerHeading2-e8kwqj {
12
- top: 8px;
13
- }
14
-
15
- .dragHandlerHeading3-Yd2WHq {
16
- top: 6px;
17
- }
18
-
@@ -1,8 +0,0 @@
1
- import type { Descendant } from 'slate';
2
- type Props = {
3
- initialValueType?: 'kona-editor' | 'html';
4
- value?: any;
5
- onChange?: (value: Descendant[]) => void;
6
- };
7
- export declare const ExampleEditor: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<unknown>>;
8
- export {};
@@ -1,44 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
3
- import { DndProvider } from "react-dnd";
4
- import { HTML5Backend } from "react-dnd-html5-backend";
5
- import { deserialize } from "../core/deserialize.js";
6
- import { serialize } from "../core/serialize.js";
7
- import { KonaEditor } from "../editor.js";
8
- import Editor_module from "./Editor.module.js";
9
- import { getPlugins } from "./getPlugins.js";
10
- import { text as external_text_js_text } from "./text.js";
11
- const initialValue = external_text_js_text;
12
- const ExampleEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
13
- const { value: defaultValue = external_text_js_text, initialValueType = 'kona-editor' } = props;
14
- const [plugins] = useState(getPlugins());
15
- const [value, setValue] = useState(null);
16
- const editorRef = useRef(null);
17
- useImperativeHandle(ref, ()=>({
18
- serialize: serialize(plugins)
19
- }), [
20
- plugins
21
- ]);
22
- useEffect(()=>{
23
- if ('kona-editor' === initialValueType) setValue(defaultValue);
24
- else {
25
- const parsed = deserialize(plugins)(defaultValue);
26
- parsed && setValue(parsed);
27
- }
28
- }, []);
29
- return /*#__PURE__*/ jsx(DndProvider, {
30
- backend: HTML5Backend,
31
- children: /*#__PURE__*/ jsx("div", {
32
- className: [
33
- Editor_module.root
34
- ].join(' '),
35
- children: value && /*#__PURE__*/ jsx(KonaEditor, {
36
- ref: editorRef,
37
- initialValue: value || initialValue,
38
- plugins: plugins,
39
- onChange: props.onChange || console.log
40
- })
41
- })
42
- });
43
- });
44
- export { ExampleEditor };
@@ -1,12 +0,0 @@
1
- import "./Editor_module.css";
2
- const Editor_module = {
3
- root: "root-zl84ra",
4
- button: "button-fdBqbh",
5
- active: "active-xvaPVY",
6
- divider: "divider-XDKye7",
7
- floating: "floating-R_uFiU",
8
- hint: "hint-zEtmE0",
9
- editorToolbar: "editorToolbar-FXIohe",
10
- backdrop: "backdrop-TUV3we"
11
- };
12
- export { Editor_module as default };
@@ -1,127 +0,0 @@
1
- .root-zl84ra {
2
- border: 1px solid var(--kona-editor-border-color);
3
- border-radius: 8px;
4
- width: 600px;
5
- height: calc(100vh - 256px);
6
- max-height: 100vh;
7
- overflow: hidden;
8
- }
9
-
10
- .root-zl84ra {
11
- & [role="textbox"] {
12
- outline: none;
13
- padding: 16px;
14
- }
15
-
16
- & h1 {
17
- font-size: 24px;
18
- font-weight: 600;
19
- }
20
-
21
- & h2 {
22
- font-size: 20px;
23
- font-weight: 600;
24
- }
25
-
26
- & h3 {
27
- font-size: 18px;
28
- font-weight: 600;
29
- }
30
-
31
- & ol {
32
- list-style: decimal;
33
- }
34
-
35
- & ul {
36
- list-style: outside;
37
- }
38
-
39
- & li {
40
- list-style-position: inside;
41
- }
42
- }
43
-
44
- .button-fdBqbh {
45
- cursor: pointer;
46
- width: 24px;
47
- height: 24px;
48
- color: inherit;
49
- background-color: #0000;
50
- border: none;
51
- border-radius: 4px;
52
- outline: none;
53
- justify-content: center;
54
- align-items: center;
55
- margin: 0;
56
- padding: 0;
57
- transition: background-color .25s;
58
- display: inline-flex;
59
- }
60
-
61
- .button-fdBqbh.active-xvaPVY {
62
- background-color: #eee;
63
- }
64
-
65
- .divider-XDKye7 {
66
- background-color: #ccc;
67
- width: 1px;
68
- height: 24px;
69
- display: inline-block;
70
- }
71
-
72
- .floating-R_uFiU {
73
- height: 24px;
74
- }
75
-
76
- .hint-zEtmE0 {
77
- background-color: var(--background-color);
78
- color: var(--text-color);
79
- border: 1px solid var(--border-color);
80
- border-radius: 4px;
81
- padding: 2px;
82
- }
83
-
84
- .editorToolbar-FXIohe {
85
- background-color: #f9f9f9;
86
- justify-content: space-between;
87
- column-gap: 4px;
88
- padding: 8px;
89
- display: flex;
90
-
91
- & select {
92
- color: inherit;
93
- background-color: #fff;
94
- border: 1px solid #ddd;
95
- border-radius: 4px;
96
- outline: none;
97
- padding: 4px;
98
- }
99
-
100
- & button {
101
- cursor: pointer;
102
- color: inherit;
103
- background-color: #fff;
104
- border: 1px solid #ddd;
105
- border-radius: 4px;
106
- outline: none;
107
- align-items: center;
108
- padding: 4px;
109
- display: inline-flex;
110
- }
111
- }
112
-
113
- .backdrop-TUV3we {
114
- z-index: 1;
115
- position: fixed;
116
- inset: 0;
117
- }
118
-
119
- .hint-zEtmE0 {
120
- color: #444;
121
- background-color: #fff;
122
- border: 1px solid #ccc;
123
- border-radius: 4px;
124
- padding: 2px;
125
- box-shadow: 0 1px 3px #0000000f;
126
- }
127
-
@@ -1,17 +0,0 @@
1
- import type { MapStore } from 'nanostores';
2
- import type { Editor } from 'slate';
3
- type Mode = 'main' | 'link' | 'colors';
4
- type Props = {
5
- $store: MapStore<{
6
- isFloatingMenuOpen: boolean;
7
- floatingMenuMode: Mode;
8
- url?: string;
9
- }>;
10
- editor: Editor;
11
- commands: {
12
- onClose: () => void;
13
- onUpdate: () => void;
14
- };
15
- };
16
- export declare const FloatingMenu: (props: Props) => import("react/jsx-runtime").JSX.Element;
17
- export {};