@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.
- package/README.md +23 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -0
- package/dist/core/createEditable.d.ts +7 -0
- package/dist/core/createEditable.js +110 -0
- package/dist/core/createEditor.d.ts +2 -0
- package/dist/core/createEditor.js +167 -0
- package/dist/core/deserialize.d.ts +3 -0
- package/dist/core/deserialize.js +33 -0
- package/dist/core/queries.d.ts +2 -0
- package/dist/core/queries.js +10 -0
- package/dist/core/serialize.d.ts +3 -0
- package/dist/core/serialize.js +13 -0
- package/dist/core/styles.module.js +6 -0
- package/dist/core/styles_module.css +29 -0
- package/dist/defaultValue.d.ts +4 -0
- package/dist/defaultValue.js +13 -0
- package/dist/editor.d.ts +10 -0
- package/dist/editor.js +43 -0
- package/dist/elements/BaseElement.d.ts +2 -0
- package/dist/elements/BaseElement.js +6 -0
- package/dist/examples/Backdrop.d.ts +5 -0
- package/dist/examples/Backdrop.js +13 -0
- package/dist/examples/Backdrop.module.js +5 -0
- package/dist/examples/Backdrop_module.css +6 -0
- package/dist/examples/DragBlock.d.ts +11 -0
- package/dist/examples/DragBlock.js +38 -0
- package/dist/examples/DragBlock.module.js +9 -0
- package/dist/examples/DragBlock_module.css +43 -0
- package/dist/examples/DragHandler.d.ts +2 -0
- package/dist/examples/DragHandler.js +44 -0
- package/dist/examples/DragHandler.module.js +8 -0
- package/dist/examples/DragHandler_module.css +18 -0
- package/dist/examples/Editor.d.ts +2 -0
- package/dist/examples/Editor.js +23 -0
- package/dist/examples/Editor.module.js +12 -0
- package/dist/examples/Editor_module.css +128 -0
- package/dist/examples/FloatingMenu.d.ts +17 -0
- package/dist/examples/FloatingMenu.js +244 -0
- package/dist/examples/FloatingMenu.module.js +9 -0
- package/dist/examples/FloatingMenu_module.css +75 -0
- package/dist/examples/LanguageSelector.d.ts +10 -0
- package/dist/examples/LanguageSelector.js +154 -0
- package/dist/examples/LanguageSelector.module.js +7 -0
- package/dist/examples/LanguageSelector_module.css +52 -0
- package/dist/examples/LinksHint.d.ts +7 -0
- package/dist/examples/LinksHint.js +50 -0
- package/dist/examples/LinksHint.module.js +6 -0
- package/dist/examples/LinksHint_module.css +28 -0
- package/dist/examples/Menu.d.ts +6 -0
- package/dist/examples/Menu.js +79 -0
- package/dist/examples/Menu.module.js +8 -0
- package/dist/examples/Menu_module.css +38 -0
- package/dist/examples/colors.d.ts +10 -0
- package/dist/examples/colors.js +12 -0
- package/dist/examples/getCommands.d.ts +2 -0
- package/dist/examples/getCommands.js +87 -0
- package/dist/examples/getPlugins.d.ts +2 -0
- package/dist/examples/getPlugins.js +127 -0
- package/dist/examples/getShortcuts.d.ts +2 -0
- package/dist/examples/getShortcuts.js +90 -0
- package/dist/examples/icons/bold.d.ts +2 -0
- package/dist/examples/icons/bold.js +27 -0
- package/dist/examples/icons/check.d.ts +2 -0
- package/dist/examples/icons/check.js +24 -0
- package/dist/examples/icons/chevronRight.d.ts +2 -0
- package/dist/examples/icons/chevronRight.js +24 -0
- package/dist/examples/icons/color.d.ts +2 -0
- package/dist/examples/icons/color.js +30 -0
- package/dist/examples/icons/copy.d.ts +2 -0
- package/dist/examples/icons/copy.js +27 -0
- package/dist/examples/icons/cross.d.ts +2 -0
- package/dist/examples/icons/cross.js +27 -0
- package/dist/examples/icons/drag.d.ts +2 -0
- package/dist/examples/icons/drag.js +39 -0
- package/dist/examples/icons/edit.d.ts +2 -0
- package/dist/examples/icons/edit.js +30 -0
- package/dist/examples/icons/external.d.ts +2 -0
- package/dist/examples/icons/external.js +30 -0
- package/dist/examples/icons/heading1.d.ts +2 -0
- package/dist/examples/icons/heading1.js +45 -0
- package/dist/examples/icons/heading2.d.ts +2 -0
- package/dist/examples/icons/heading2.js +45 -0
- package/dist/examples/icons/heading3.d.ts +2 -0
- package/dist/examples/icons/heading3.js +48 -0
- package/dist/examples/icons/italic.d.ts +2 -0
- package/dist/examples/icons/italic.js +30 -0
- package/dist/examples/icons/link.d.ts +2 -0
- package/dist/examples/icons/link.js +30 -0
- package/dist/examples/icons/ol.d.ts +2 -0
- package/dist/examples/icons/ol.js +36 -0
- package/dist/examples/icons/strikethrough.d.ts +2 -0
- package/dist/examples/icons/strikethrough.js +27 -0
- package/dist/examples/icons/text.d.ts +2 -0
- package/dist/examples/icons/text.js +22 -0
- package/dist/examples/icons/types.d.ts +3 -0
- package/dist/examples/icons/types.js +0 -0
- package/dist/examples/icons/ul.d.ts +2 -0
- package/dist/examples/icons/ul.js +39 -0
- package/dist/examples/icons/underline.d.ts +2 -0
- package/dist/examples/icons/underline.js +27 -0
- package/dist/examples/store.d.ts +8 -0
- package/dist/examples/store.js +6 -0
- package/dist/examples/styles.module.js +11 -0
- package/dist/examples/styles_module.css +78 -0
- package/dist/examples/text.d.ts +3 -0
- package/dist/examples/text.js +60 -0
- package/dist/examples/ui/Button/Button.d.ts +8 -0
- package/dist/examples/ui/Button/Button.js +15 -0
- package/dist/examples/ui/Button/ButtonWrapper.d.ts +4 -0
- package/dist/examples/ui/Button/ButtonWrapper.js +14 -0
- package/dist/examples/ui/Button/index.d.ts +2 -0
- package/dist/examples/ui/Button/index.js +3 -0
- package/dist/examples/ui/Button/styles.module.js +10 -0
- package/dist/examples/ui/Button/styles_module.css +72 -0
- package/dist/examples/ui/Button/types.d.ts +1 -0
- package/dist/examples/ui/Button/types.js +0 -0
- package/dist/examples/ui/Dropdown/Dropdown.d.ts +16 -0
- package/dist/examples/ui/Dropdown/Dropdown.js +75 -0
- package/dist/examples/ui/Dropdown/index.d.ts +1 -0
- package/dist/examples/ui/Dropdown/index.js +2 -0
- package/dist/examples/ui/Menu/Menu.d.ts +41 -0
- package/dist/examples/ui/Menu/Menu.js +404 -0
- package/dist/examples/ui/Menu/MenuDelimiter.d.ts +1 -0
- package/dist/examples/ui/Menu/MenuDelimiter.js +6 -0
- package/dist/examples/ui/Menu/MenuHotkey.d.ts +6 -0
- package/dist/examples/ui/Menu/MenuHotkey.js +12 -0
- package/dist/examples/ui/Menu/MenuIcon.d.ts +6 -0
- package/dist/examples/ui/Menu/MenuIcon.js +12 -0
- package/dist/examples/ui/Menu/MenuItem.d.ts +6 -0
- package/dist/examples/ui/Menu/MenuItem.js +17 -0
- package/dist/examples/ui/Menu/MenuTitle.d.ts +6 -0
- package/dist/examples/ui/Menu/MenuTitle.js +12 -0
- package/dist/examples/ui/Menu/SafeSpace.d.ts +6 -0
- package/dist/examples/ui/Menu/SafeSpace.js +65 -0
- package/dist/examples/ui/Menu/index.d.ts +2 -0
- package/dist/examples/ui/Menu/index.js +2 -0
- package/dist/examples/ui/Menu/styles.module.js +21 -0
- package/dist/examples/ui/Menu/styles_module.css +140 -0
- package/dist/examples/ui/Menu/types.d.ts +16 -0
- package/dist/examples/ui/Menu/types.js +0 -0
- package/dist/examples/ui/useMenuPosition.d.ts +18 -0
- package/dist/examples/ui/useMenuPosition.js +51 -0
- package/dist/examples/ui/useMergeRefs.d.ts +23 -0
- package/dist/examples/ui/useMergeRefs.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/plugins/AttachmentsPlugin/AttachmentsPlugin.d.ts +17 -0
- package/dist/plugins/AttachmentsPlugin/AttachmentsPlugin.js +37 -0
- package/dist/plugins/AttachmentsPlugin/index.d.ts +1 -0
- package/dist/plugins/AttachmentsPlugin/index.js +2 -0
- package/dist/plugins/AttachmentsPlugin/types.d.ts +11 -0
- package/dist/plugins/AttachmentsPlugin/types.js +0 -0
- package/dist/plugins/BasicFormattingPlugin/BasicFormattingPlugin.d.ts +20 -0
- package/dist/plugins/BasicFormattingPlugin/BasicFormattingPlugin.js +76 -0
- package/dist/plugins/BasicFormattingPlugin/index.d.ts +1 -0
- package/dist/plugins/BasicFormattingPlugin/index.js +2 -0
- package/dist/plugins/BreaksPlugin/BreaksPlugin.d.ts +15 -0
- package/dist/plugins/BreaksPlugin/BreaksPlugin.js +50 -0
- package/dist/plugins/BreaksPlugin/index.d.ts +1 -0
- package/dist/plugins/BreaksPlugin/index.js +2 -0
- package/dist/plugins/CodeBlockPlugin/CodeBlock.d.ts +9 -0
- package/dist/plugins/CodeBlockPlugin/CodeBlock.js +18 -0
- package/dist/plugins/CodeBlockPlugin/CodeBlockLine.d.ts +2 -0
- package/dist/plugins/CodeBlockPlugin/CodeBlockLine.js +9 -0
- package/dist/plugins/CodeBlockPlugin/CodeBlockPlugin.d.ts +55 -0
- package/dist/plugins/CodeBlockPlugin/CodeBlockPlugin.js +224 -0
- package/dist/plugins/CodeBlockPlugin/index.d.ts +1 -0
- package/dist/plugins/CodeBlockPlugin/index.js +2 -0
- package/dist/plugins/CodeBlockPlugin/styles.module.js +6 -0
- package/dist/plugins/CodeBlockPlugin/styles_module.css +12 -0
- package/dist/plugins/CodeBlockPlugin/types.d.ts +8 -0
- package/dist/plugins/CodeBlockPlugin/types.js +0 -0
- package/dist/plugins/CodeBlockPlugin/utils.d.ts +13 -0
- package/dist/plugins/CodeBlockPlugin/utils.js +87 -0
- package/dist/plugins/CommandsPlugin/CommandsPlugin.d.ts +11 -0
- package/dist/plugins/CommandsPlugin/CommandsPlugin.js +65 -0
- package/dist/plugins/CommandsPlugin/Menu.d.ts +11 -0
- package/dist/plugins/CommandsPlugin/Menu.js +153 -0
- package/dist/plugins/CommandsPlugin/actions.d.ts +7 -0
- package/dist/plugins/CommandsPlugin/actions.js +29 -0
- package/dist/plugins/CommandsPlugin/index.d.ts +2 -0
- package/dist/plugins/CommandsPlugin/index.js +2 -0
- package/dist/plugins/CommandsPlugin/styles.module.js +9 -0
- package/dist/plugins/CommandsPlugin/styles_module.css +66 -0
- package/dist/plugins/CommandsPlugin/types.d.ts +27 -0
- package/dist/plugins/CommandsPlugin/types.js +0 -0
- package/dist/plugins/DnDPlugin/DnDPlugin.d.ts +33 -0
- package/dist/plugins/DnDPlugin/DnDPlugin.js +110 -0
- package/dist/plugins/DnDPlugin/index.d.ts +1 -0
- package/dist/plugins/DnDPlugin/index.js +2 -0
- package/dist/plugins/DnDPlugin/styles.module.js +9 -0
- package/dist/plugins/DnDPlugin/styles_module.css +43 -0
- package/dist/plugins/FloatingMenuPlugin/FloatingMenu.d.ts +9 -0
- package/dist/plugins/FloatingMenuPlugin/FloatingMenu.js +89 -0
- package/dist/plugins/FloatingMenuPlugin/FloatingMenuPlugin.d.ts +15 -0
- package/dist/plugins/FloatingMenuPlugin/FloatingMenuPlugin.js +36 -0
- package/dist/plugins/FloatingMenuPlugin/index.d.ts +2 -0
- package/dist/plugins/FloatingMenuPlugin/index.js +2 -0
- package/dist/plugins/FloatingMenuPlugin/styles.module.js +7 -0
- package/dist/plugins/FloatingMenuPlugin/styles_module.css +23 -0
- package/dist/plugins/FloatingMenuPlugin/types.d.ts +16 -0
- package/dist/plugins/FloatingMenuPlugin/types.js +0 -0
- package/dist/plugins/HeadingsPlugin/HeadingsPlugin.d.ts +19 -0
- package/dist/plugins/HeadingsPlugin/HeadingsPlugin.js +64 -0
- package/dist/plugins/HeadingsPlugin/index.d.ts +1 -0
- package/dist/plugins/HeadingsPlugin/index.js +2 -0
- package/dist/plugins/HighlightsPlugin/HighlightsPlugin.d.ts +16 -0
- package/dist/plugins/HighlightsPlugin/HighlightsPlugin.js +36 -0
- package/dist/plugins/HighlightsPlugin/index.d.ts +1 -0
- package/dist/plugins/HighlightsPlugin/index.js +2 -0
- package/dist/plugins/LinksPlugin/Link.d.ts +11 -0
- package/dist/plugins/LinksPlugin/Link.js +89 -0
- package/dist/plugins/LinksPlugin/LinksPlugin.d.ts +17 -0
- package/dist/plugins/LinksPlugin/LinksPlugin.js +102 -0
- package/dist/plugins/LinksPlugin/constants.d.ts +1 -0
- package/dist/plugins/LinksPlugin/constants.js +2 -0
- package/dist/plugins/LinksPlugin/index.d.ts +2 -0
- package/dist/plugins/LinksPlugin/index.js +2 -0
- package/dist/plugins/LinksPlugin/styles.module.js +11 -0
- package/dist/plugins/LinksPlugin/styles_module.css +71 -0
- package/dist/plugins/LinksPlugin/types.d.ts +18 -0
- package/dist/plugins/LinksPlugin/types.js +0 -0
- package/dist/plugins/ListsPlugin/ListsPlugin.d.ts +32 -0
- package/dist/plugins/ListsPlugin/ListsPlugin.js +218 -0
- package/dist/plugins/ListsPlugin/index.d.ts +1 -0
- package/dist/plugins/ListsPlugin/index.js +2 -0
- package/dist/plugins/ListsPlugin/styles.module.js +6 -0
- package/dist/plugins/ListsPlugin/styles_module.css +8 -0
- package/dist/plugins/MenuPlugin/Menu.d.ts +2 -0
- package/dist/plugins/MenuPlugin/Menu.js +14 -0
- package/dist/plugins/MenuPlugin/MenuPlugin.d.ts +7 -0
- package/dist/plugins/MenuPlugin/MenuPlugin.js +19 -0
- package/dist/plugins/MenuPlugin/index.d.ts +1 -0
- package/dist/plugins/MenuPlugin/index.js +2 -0
- package/dist/plugins/MenuPlugin/styles.module.js +6 -0
- package/dist/plugins/MenuPlugin/styles_module.css +33 -0
- package/dist/plugins/MenuPlugin/types.d.ts +4 -0
- package/dist/plugins/MenuPlugin/types.js +0 -0
- package/dist/plugins/NodeIdPlugin/NodeIdPlugin.d.ts +15 -0
- package/dist/plugins/NodeIdPlugin/NodeIdPlugin.js +36 -0
- package/dist/plugins/NodeIdPlugin/index.d.ts +1 -0
- package/dist/plugins/NodeIdPlugin/index.js +2 -0
- package/dist/plugins/PlaceholderPlugin/PlaceholderPlugin.d.ts +16 -0
- package/dist/plugins/PlaceholderPlugin/PlaceholderPlugin.js +44 -0
- package/dist/plugins/PlaceholderPlugin/index.d.ts +1 -0
- package/dist/plugins/PlaceholderPlugin/index.js +2 -0
- package/dist/plugins/PlaceholderPlugin/styles.module.js +5 -0
- package/dist/plugins/PlaceholderPlugin/styles_module.css +14 -0
- package/dist/plugins/ShortcutsPlugin/ShortcutsPlugin.d.ts +24 -0
- package/dist/plugins/ShortcutsPlugin/ShortcutsPlugin.js +55 -0
- package/dist/plugins/ShortcutsPlugin/index.d.ts +2 -0
- package/dist/plugins/ShortcutsPlugin/index.js +2 -0
- package/dist/plugins/TableOfContentsPlugin/TableOfContentsPlugin.d.ts +18 -0
- package/dist/plugins/TableOfContentsPlugin/TableOfContentsPlugin.js +76 -0
- package/dist/plugins/TableOfContentsPlugin/index.d.ts +1 -0
- package/dist/plugins/TableOfContentsPlugin/index.js +2 -0
- package/dist/plugins/TableOfContentsPlugin/styles.module.js +10 -0
- package/dist/plugins/TableOfContentsPlugin/styles_module.css +114 -0
- package/dist/plugins/index.d.ts +16 -0
- package/dist/plugins/index.js +17 -0
- package/dist/queries/getMatchedGroups.d.ts +0 -0
- package/dist/queries/getMatchedGroups.js +0 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.js +0 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +8 -0
- package/package.json +71 -0
- package/src/constants.ts +1 -0
- package/src/core/createEditable.tsx +159 -0
- package/src/core/createEditor.ts +244 -0
- package/src/core/deserialize.ts +57 -0
- package/src/core/queries.ts +10 -0
- package/src/core/serialize.ts +38 -0
- package/src/core/styles.module.css +28 -0
- package/src/defaultValue.ts +10 -0
- package/src/editor.tsx +55 -0
- package/src/elements/BaseElement.tsx +5 -0
- package/src/examples/Backdrop.module.css +8 -0
- package/src/examples/Backdrop.tsx +16 -0
- package/src/examples/DragBlock.module.css +42 -0
- package/src/examples/DragBlock.tsx +57 -0
- package/src/examples/DragHandler.module.css +17 -0
- package/src/examples/DragHandler.tsx +39 -0
- package/src/examples/Editor.module.css +130 -0
- package/src/examples/Editor.tsx +26 -0
- package/src/examples/FloatingMenu.module.css +74 -0
- package/src/examples/FloatingMenu.tsx +274 -0
- package/src/examples/LanguageSelector.module.css +51 -0
- package/src/examples/LanguageSelector.tsx +99 -0
- package/src/examples/LinksHint.module.css +27 -0
- package/src/examples/LinksHint.tsx +58 -0
- package/src/examples/Menu.module.css +37 -0
- package/src/examples/Menu.tsx +80 -0
- package/src/examples/colors.ts +11 -0
- package/src/examples/getCommands.tsx +76 -0
- package/src/examples/getPlugins.tsx +143 -0
- package/src/examples/getShortcuts.ts +107 -0
- package/src/examples/icons/bold.tsx +20 -0
- package/src/examples/icons/check.tsx +19 -0
- package/src/examples/icons/chevronRight.tsx +19 -0
- package/src/examples/icons/color.tsx +23 -0
- package/src/examples/icons/copy.tsx +20 -0
- package/src/examples/icons/cross.tsx +20 -0
- package/src/examples/icons/drag.tsx +24 -0
- package/src/examples/icons/edit.tsx +21 -0
- package/src/examples/icons/external.tsx +21 -0
- package/src/examples/icons/heading1.tsx +26 -0
- package/src/examples/icons/heading2.tsx +26 -0
- package/src/examples/icons/heading3.tsx +27 -0
- package/src/examples/icons/italic.tsx +21 -0
- package/src/examples/icons/link.tsx +21 -0
- package/src/examples/icons/ol.tsx +23 -0
- package/src/examples/icons/strikethrough.tsx +20 -0
- package/src/examples/icons/text.tsx +18 -0
- package/src/examples/icons/types.ts +3 -0
- package/src/examples/icons/ul.tsx +24 -0
- package/src/examples/icons/underline.tsx +20 -0
- package/src/examples/store.ts +14 -0
- package/src/examples/styles.module.css +77 -0
- package/src/examples/text.tsx +133 -0
- package/src/examples/ui/Button/Button.tsx +34 -0
- package/src/examples/ui/Button/ButtonWrapper.tsx +22 -0
- package/src/examples/ui/Button/index.ts +2 -0
- package/src/examples/ui/Button/styles.module.css +75 -0
- package/src/examples/ui/Button/types.ts +1 -0
- package/src/examples/ui/Dropdown/Dropdown.tsx +101 -0
- package/src/examples/ui/Dropdown/index.ts +1 -0
- package/src/examples/ui/Menu/Menu.tsx +576 -0
- package/src/examples/ui/Menu/MenuDelimiter.tsx +3 -0
- package/src/examples/ui/Menu/MenuHotkey.tsx +17 -0
- package/src/examples/ui/Menu/MenuIcon.tsx +17 -0
- package/src/examples/ui/Menu/MenuItem.tsx +45 -0
- package/src/examples/ui/Menu/MenuTitle.tsx +17 -0
- package/src/examples/ui/Menu/SafeSpace.tsx +84 -0
- package/src/examples/ui/Menu/index.ts +2 -0
- package/src/examples/ui/Menu/styles.module.css +143 -0
- package/src/examples/ui/Menu/types.ts +18 -0
- package/src/examples/ui/useMenuPosition.ts +72 -0
- package/src/examples/ui/useMergeRefs.ts +39 -0
- package/src/index.ts +2 -0
- package/src/plugins/AttachmentsPlugin/AttachmentsPlugin.tsx +41 -0
- package/src/plugins/AttachmentsPlugin/index.ts +1 -0
- package/src/plugins/AttachmentsPlugin/types.ts +12 -0
- package/src/plugins/BasicFormattingPlugin/BasicFormattingPlugin.tsx +100 -0
- package/src/plugins/BasicFormattingPlugin/index.ts +1 -0
- package/src/plugins/BreaksPlugin/BreaksPlugin.tsx +70 -0
- package/src/plugins/BreaksPlugin/index.ts +1 -0
- package/src/plugins/CodeBlockPlugin/CodeBlock.tsx +20 -0
- package/src/plugins/CodeBlockPlugin/CodeBlockLine.tsx +7 -0
- package/src/plugins/CodeBlockPlugin/CodeBlockPlugin.tsx +304 -0
- package/src/plugins/CodeBlockPlugin/index.ts +1 -0
- package/src/plugins/CodeBlockPlugin/styles.module.css +11 -0
- package/src/plugins/CodeBlockPlugin/types.ts +10 -0
- package/src/plugins/CodeBlockPlugin/utils.ts +117 -0
- package/src/plugins/CommandsPlugin/CommandsPlugin.tsx +99 -0
- package/src/plugins/CommandsPlugin/Menu.tsx +205 -0
- package/src/plugins/CommandsPlugin/actions.ts +41 -0
- package/src/plugins/CommandsPlugin/index.ts +2 -0
- package/src/plugins/CommandsPlugin/styles.module.css +69 -0
- package/src/plugins/CommandsPlugin/types.ts +32 -0
- package/src/plugins/DnDPlugin/DnDPlugin.tsx +200 -0
- package/src/plugins/DnDPlugin/index.ts +1 -0
- package/src/plugins/DnDPlugin/styles.module.css +42 -0
- package/src/plugins/FloatingMenuPlugin/FloatingMenu.tsx +144 -0
- package/src/plugins/FloatingMenuPlugin/FloatingMenuPlugin.tsx +44 -0
- package/src/plugins/FloatingMenuPlugin/index.ts +2 -0
- package/src/plugins/FloatingMenuPlugin/styles.module.css +22 -0
- package/src/plugins/FloatingMenuPlugin/types.ts +18 -0
- package/src/plugins/HeadingsPlugin/HeadingsPlugin.tsx +75 -0
- package/src/plugins/HeadingsPlugin/index.ts +1 -0
- package/src/plugins/HighlightsPlugin/HighlightsPlugin.tsx +56 -0
- package/src/plugins/HighlightsPlugin/index.ts +1 -0
- package/src/plugins/LinksPlugin/Link.tsx +90 -0
- package/src/plugins/LinksPlugin/LinksPlugin.tsx +128 -0
- package/src/plugins/LinksPlugin/constants.ts +1 -0
- package/src/plugins/LinksPlugin/index.ts +2 -0
- package/src/plugins/LinksPlugin/styles.module.css +73 -0
- package/src/plugins/LinksPlugin/types.ts +19 -0
- package/src/plugins/ListsPlugin/ListsPlugin.tsx +355 -0
- package/src/plugins/ListsPlugin/index.ts +1 -0
- package/src/plugins/ListsPlugin/styles.module.css +7 -0
- package/src/plugins/MenuPlugin/Menu.tsx +9 -0
- package/src/plugins/MenuPlugin/MenuPlugin.tsx +20 -0
- package/src/plugins/MenuPlugin/index.ts +1 -0
- package/src/plugins/MenuPlugin/styles.module.css +33 -0
- package/src/plugins/MenuPlugin/types.ts +5 -0
- package/src/plugins/NodeIdPlugin/NodeIdPlugin.ts +62 -0
- package/src/plugins/NodeIdPlugin/index.ts +1 -0
- package/src/plugins/PlaceholderPlugin/PlaceholderPlugin.tsx +66 -0
- package/src/plugins/PlaceholderPlugin/index.ts +1 -0
- package/src/plugins/PlaceholderPlugin/styles.module.css +17 -0
- package/src/plugins/ShortcutsPlugin/ShortcutsPlugin.tsx +133 -0
- package/src/plugins/ShortcutsPlugin/index.ts +2 -0
- package/src/plugins/TableOfContentsPlugin/TableOfContentsPlugin.tsx +102 -0
- package/src/plugins/TableOfContentsPlugin/index.ts +1 -0
- package/src/plugins/TableOfContentsPlugin/styles.module.css +113 -0
- package/src/plugins/index.ts +20 -0
- package/src/queries/getMatchedGroups.ts +0 -0
- package/src/types.ts +87 -0
- 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,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
|
+
);
|