diff --git a/demo/index.tsx b/demo/index.tsx index 76ed0da..37af6ea 100644 --- a/demo/index.tsx +++ b/demo/index.tsx @@ -1,24 +1,20 @@ import * as React from "react"; import ReactDOM from "react-dom"; -import { - Box, - Button, - ChakraProvider, - HStack, - Textarea -} from "@chakra-ui/react"; +import { Box, ChakraProvider, HStack, Textarea } from "@chakra-ui/react"; import { useTextAreaMarkdownEditor } from "../src/hooks/use-markdown-editor"; -import { faBold, faItalic } from "@fortawesome/free-solid-svg-icons"; +import { faBold, faItalic, faCode } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { bold, italic } from "../src"; +import { bold, code, italic } from "../src"; +import { ToolbarButton } from "./toolbar-button"; export type DemoProps = {}; -export const Demo: React.FunctionComponent = props => { +export const Demo: React.FunctionComponent = () => { const { ref, commandController } = useTextAreaMarkdownEditor({ commandMap: { bold: bold, - italic: italic + italic: italic, + code: code } }); @@ -26,26 +22,27 @@ export const Demo: React.FunctionComponent = props => { - - + + { + await commandController.executeCommand("code"); + }} + > + +