2020-06-06 17:00:20 +02:00
|
|
|
import * as React from 'react';
|
2020-07-03 23:32:39 +02:00
|
|
|
import CommandService from '../../../../lib/services/CommandService';
|
2020-06-06 17:00:20 +02:00
|
|
|
|
|
|
|
const ToolbarBase = require('../../../Toolbar.min.js');
|
2020-06-10 23:08:59 +02:00
|
|
|
const { buildStyle, themeStyle } = require('lib/theme');
|
2020-06-06 17:00:20 +02:00
|
|
|
|
|
|
|
interface ToolbarProps {
|
|
|
|
theme: number,
|
|
|
|
dispatch: Function,
|
|
|
|
disabled: boolean,
|
|
|
|
}
|
|
|
|
|
|
|
|
function styles_(props:ToolbarProps) {
|
2020-07-23 00:13:23 +02:00
|
|
|
return buildStyle('CodeMirrorToolbar', props.theme, (/* theme:any*/) => {
|
2020-06-06 17:00:20 +02:00
|
|
|
const theme = themeStyle(props.theme);
|
|
|
|
return {
|
|
|
|
root: {
|
|
|
|
flex: 1,
|
|
|
|
marginBottom: 0,
|
|
|
|
borderTop: `1px solid ${theme.dividerColor}`,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Toolbar(props:ToolbarProps) {
|
|
|
|
const styles = styles_(props);
|
|
|
|
|
2020-07-03 23:32:39 +02:00
|
|
|
const cmdService = CommandService.instance();
|
|
|
|
|
|
|
|
const toolbarItems = [
|
|
|
|
cmdService.commandToToolbarButton('textBold'),
|
|
|
|
cmdService.commandToToolbarButton('textItalic'),
|
|
|
|
{ type: 'separator' },
|
|
|
|
cmdService.commandToToolbarButton('textLink'),
|
|
|
|
cmdService.commandToToolbarButton('textCode'),
|
|
|
|
cmdService.commandToToolbarButton('attachFile'),
|
|
|
|
{ type: 'separator' },
|
|
|
|
cmdService.commandToToolbarButton('textNumberedList'),
|
|
|
|
cmdService.commandToToolbarButton('textBulletedList'),
|
|
|
|
cmdService.commandToToolbarButton('textCheckbox'),
|
|
|
|
cmdService.commandToToolbarButton('textHeading'),
|
|
|
|
cmdService.commandToToolbarButton('textHorizontalRule'),
|
|
|
|
cmdService.commandToToolbarButton('insertDateTime'),
|
|
|
|
];
|
|
|
|
|
|
|
|
return <ToolbarBase disabled={props.disabled} style={styles.root} items={toolbarItems} />;
|
2020-06-06 17:00:20 +02:00
|
|
|
}
|