// @flow import * as React from "react"; import type {Value, Change} from 'slate'; import styled from 'styled-components'; import {Container} from './components/item'; import FullScreenIcon from './components/fullScreen'; import {AlignCenter, AlignLeft, AlignRight} from '@canner/slate-icon-align'; import Blockquote from '@canner/slate-icon-blockquote'; import Table from '@canner/slate-icon-table'; import CodeBlock from '@canner/slate-icon-codeblock'; import {Header1, Header2, Header3} from '@canner/slate-icon-header'; import Hr from '@canner/slate-icon-hr'; import Image from '@canner/slate-icon-image'; import {Indent, Outdent} from '@canner/slate-icon-indent'; import Link from '@canner/slate-icon-link'; import {OlList, UlList} from '@canner/slate-icon-list'; import Undo from '@canner/slate-icon-undo'; import Redo from '@canner/slate-icon-redo'; import {TerminalIcon} from './components/terminal/terminalIcon'; import {CloudwareIcon} from './components/cloudware/cloudwareIcon'; import {ImageIcon} from './components/image/imageIcon'; type Props = { value: Value, isFull?: boolean, onChange: (change: Change) => void, goFull: () => void, serviceConfig: any } const IconContainer = styled.div` display: inline-block; background: transparent; color: #222; cursor: pointer; -webkit-transition: background 0.2s ease 0s; border-bottom: 0.5px solid #ebebeb; &:hover { background: #ebebeb; } ` const Seperator = styled.div` height: 35px; width: 1px; margin: 2px 0; background: #ebebeb; display: inline-block; vertical-align: top; `; export default class Toolbar extends React.Component { render() { const { value, onChange, goFull, isFull, serviceConfig } = this.props; const options = [ Undo, Redo, 'seperator', Header1, Header2, Header3, Blockquote, Hr, 'seperator', AlignLeft, AlignCenter, AlignRight, Indent, Outdent, 'seperator', OlList, UlList, 'seperator', Link, CodeBlock, Table, 'ImageIcon', 'seperator', 'TerminalIcon', 'CloudwareIcon', ] /* Video, FontColor, FontBgColor, 'seperator',*/ return ( {options.map((Type, i) => { if (Type === 'seperator') return if (Type === 'fullScreen') { return ( ) } if(Type === 'TerminalIcon'){ return( ) } if(Type === 'CloudwareIcon'){ return( ) } if(Type === 'ImageIcon'){ return( ) } // special plugin if (Type === 'image') { Type = Image } return ( ) })} ); } }