import React from "react"; import Background from "../../pb_background/_background"; import Flex from "../../pb_flex/_flex"; import FlexItem from "../../pb_flex/_flex_item"; import SectionSeparator from "../../pb_section_separator/_section_separator"; import EditorButton from "./EditorButton"; import ToolbarDropdown from "./ToolbarDropdown"; import ToolbarNodes from "./ToolbarNodes"; import { ToolbarTypes } from "./EditorTypes"; import ToolbarHistoryItems from "./ToolbarHistory"; import MoreExtensionsDropdown from "./MoreExtensionsDropdown"; const EditorToolbar = ({ editor, extensions }: any): React.ReactElement => { const toolbaritems = [ { icon: "bold", text: "Bold", classname:`toolbar_button ${editor.isActive('bold') ? 'is-active' : ''}`, onclick:()=>editor.chain().focus().toggleBold().run(), }, { icon: "italic", text: "Italic", classname:`toolbar_button ${editor.isActive('italic') ? 'is-active' : ''}`, onclick:() => editor.chain().focus().toggleItalic().run(), }, { icon: "strikethrough", text: "Strikethrough", classname:`toolbar_button ${editor.isActive('strike') ? 'is-active' : ''}`, onclick:() => editor.chain().focus().toggleStrike().run(), }, ] return ( {toolbaritems && toolbaritems.map( ({ icon, text, classname, onclick}: ToolbarTypes, index: number) => ( ) )} { extensions && ( <> ) } ); }; export default EditorToolbar